Compare commits

...

2 Commits

Author SHA1 Message Date
Gwk
c5407b3070 Merge branch 'master' of https://git.flyfish.group/gaowk/saas-page-web
# Conflicts:
#	index.html
2022-08-30 16:10:57 +08:00
Gwk
a07097d5f4 1 2022-08-30 16:01:31 +08:00

View File

@ -32,13 +32,14 @@
</div> </div>
</div> </div>
<script> <script>
// var host = 'http://192.168.26.198:10089'; // var ctx = 'http://192.168.26.198:3000';
var ctx = '/epi-project' var ctx = '/epi-project'
var app = new Vue({ var app = new Vue({
el: '#app', el: '#app',
data: { data: {
tenantList: [], tenantList: [],
selectedTenant: null selectedTenant: null,
isMiniProgram: false
}, },
methods: { methods: {
selChange(tenant) { selChange(tenant) {
@ -48,23 +49,28 @@
opacity: 'toggle' opacity: 'toggle'
}) })
localStorage.setItem('tenant', tenant.identifier); localStorage.setItem('tenant', tenant.identifier);
wx.miniProgram.getEnv(function(res) { if (this.isMiniProgram) {
if (res.miniprogram) { wx.miniProgram.postMessage({
wx.miniProgram.postMessage({ data: {
data: { tenant: tenant.identifier
tenant: tenant.identifier }
} })
}) } else {
} // 跳转业务系统
}); location.href = '/'
// 跳转业务系统 }
location.href = '/'
} }
}, },
created() { created() {
fetch(ctx + '/tenants').then(r => r.json()).then(res => { fetch(ctx + '/tenants').then(r => r.json()).then(res => {
this.tenantList = res.data; 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'
} }
}) })