Compare commits
2 Commits
d708ef7d29
...
c5407b3070
Author | SHA1 | Date | |
---|---|---|---|
c5407b3070 | |||
a07097d5f4 |
18
index.html
18
index.html
@ -32,13 +32,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// var host = 'http://192.168.26.198:10089';
|
||||
// var ctx = 'http://192.168.26.198:3000';
|
||||
var ctx = '/epi-project'
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
tenantList: [],
|
||||
selectedTenant: null
|
||||
selectedTenant: null,
|
||||
isMiniProgram: false
|
||||
},
|
||||
methods: {
|
||||
selChange(tenant) {
|
||||
@ -48,23 +49,28 @@
|
||||
opacity: 'toggle'
|
||||
})
|
||||
localStorage.setItem('tenant', tenant.identifier);
|
||||
wx.miniProgram.getEnv(function(res) {
|
||||
if (res.miniprogram) {
|
||||
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'
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user