86 lines
2.4 KiB
HTML
86 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title></title>
|
|
<meta name="viewport"
|
|
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
|
<script src="js/v2.6.10/vue.min.js" type="text/javascript" charset="utf-8"></script>
|
|
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js" type="text/javascript" charset="utf-8"></script>
|
|
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js">
|
|
</script>
|
|
<link rel="stylesheet" href="css/style.css">
|
|
<link rel="stylesheet" href="css/scroll.css">
|
|
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<h1>智慧防疫平台</h1>
|
|
<div class="sel-div">
|
|
<div class="sel-input">
|
|
<p class="sel-placeholder" v-if="!selectedTenant">请选择租户</p>
|
|
<p class="sel-text" v-else>{{selectedTenant.name}}</p>
|
|
<img src="img/arrow.png" />
|
|
</div>
|
|
<div class="sel-body" id="sel-body">
|
|
<div class="set-place"></div>
|
|
<div class="option-body">
|
|
<div :class="{'active-option':selectedTenant && tenant.identifier == selectedTenant.identifier}"
|
|
v-for="tenant in tenantList" @click="selChange(tenant)">{{tenant.name}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
// var ctx = 'http://192.168.26.198:3000';
|
|
var ctx = '/epi-project'
|
|
var app = new Vue({
|
|
el: '#app',
|
|
data: {
|
|
tenantList: [],
|
|
selectedTenant: null,
|
|
isMiniProgram: false
|
|
},
|
|
methods: {
|
|
selChange(tenant) {
|
|
this.selectedTenant = tenant;
|
|
$('#sel-body').animate({
|
|
height: 'toggle',
|
|
opacity: 'toggle'
|
|
})
|
|
localStorage.setItem('tenant', tenant.identifier);
|
|
if (this.isMiniProgram) {
|
|
wx.miniProgram.postMessage({
|
|
data: {
|
|
tenant: tenant.identifier
|
|
}
|
|
})
|
|
} else {
|
|
// 跳转业务系统
|
|
location.href = '/'
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
fetch(ctx + '/tenants').then(r => r.json()).then(res => {
|
|
this.tenantList = res.data;
|
|
})
|
|
if (!window.WeixinJSBridge || !WeixinJSBridge.invoke) {
|
|
document.addEventListener('WeixinJSBridgeReady', () => {
|
|
this.isMiniProgram = window.__wxjs_environment === 'miniprogram'
|
|
}, false)
|
|
}
|
|
this.isMiniProgram = window.__wxjs_environment === 'miniprogram'
|
|
}
|
|
})
|
|
|
|
$('.sel-input').click(() => {
|
|
$('#sel-body').animate({
|
|
height: 'toggle',
|
|
opacity: 'toggle'
|
|
})
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|