2022-08-30 01:39:22 +00:00
|
|
|
<!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>
|
2022-08-30 08:10:57 +00:00
|
|
|
// var ctx = 'http://192.168.26.198:3000';
|
2022-08-30 07:50:31 +00:00
|
|
|
var ctx = '/epi-project'
|
2022-08-30 01:39:22 +00:00
|
|
|
var app = new Vue({
|
|
|
|
el: '#app',
|
|
|
|
data: {
|
|
|
|
tenantList: [],
|
2022-08-30 08:01:31 +00:00
|
|
|
selectedTenant: null,
|
2022-08-30 08:10:57 +00:00
|
|
|
isMiniProgram: false
|
2022-08-30 01:39:22 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
selChange(tenant) {
|
|
|
|
this.selectedTenant = tenant;
|
|
|
|
$('#sel-body').animate({
|
|
|
|
height: 'toggle',
|
|
|
|
opacity: 'toggle'
|
|
|
|
})
|
|
|
|
localStorage.setItem('tenant', tenant.identifier);
|
2022-08-30 08:10:57 +00:00
|
|
|
if (this.isMiniProgram) {
|
|
|
|
wx.miniProgram.postMessage({
|
|
|
|
data: {
|
|
|
|
tenant: tenant.identifier
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
// 跳转业务系统
|
|
|
|
location.href = '/'
|
|
|
|
}
|
2022-08-30 01:39:22 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
2022-08-30 07:50:31 +00:00
|
|
|
fetch(ctx + '/tenants').then(r => r.json()).then(res => {
|
2022-08-30 01:39:22 +00:00
|
|
|
this.tenantList = res.data;
|
|
|
|
})
|
2022-08-30 08:10:57 +00:00
|
|
|
if (!window.WeixinJSBridge || !WeixinJSBridge.invoke) {
|
|
|
|
document.addEventListener('WeixinJSBridgeReady', () => {
|
|
|
|
this.isMiniProgram = window.__wxjs_environment === 'miniprogram'
|
|
|
|
}, false)
|
|
|
|
}
|
|
|
|
this.isMiniProgram = window.__wxjs_environment === 'miniprogram'
|
2022-08-30 01:39:22 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
$('.sel-input').click(() => {
|
|
|
|
$('#sel-body').animate({
|
|
|
|
height: 'toggle',
|
|
|
|
opacity: 'toggle'
|
|
|
|
})
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|