storeEffect.js
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// pages/tab/storeEffect/storeEffect.js — 店效(原首页 H5,web-view 页用 cover-tab-bar)
const { setCustomTabBar } = require('~/utils/setCustomTabBar')
Page({
data: {
webUrl: '',
userInfo: {},
},
onLoad() {
this.getUserInfo()
this.init()
},
getUserInfo() {
const userInfo = wx.$util.getUserInfo()
this.setData({ userInfo })
},
init() {
let index = 2
const accountInfo = wx.getAccountInfoSync()
const envName = accountInfo.miniProgram.envVersion
const manual = false
const release = false
switch (envName) {
case 'develop':
break
case 'trial':
index = manual ? index : 2
break
case 'release':
index = release ? index : 3
break
default:
index = 3
break
}
const webUrls = {
develop: 'http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=',
trial: 'https://scrm.test.glsx.com.cn/glsx-bi-report/#/?phone=',
release: 'https://scrm.glsx.com.cn/glsx-bi-report/#/?phone=',
preRelease: 'http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=',
}
const target = ['ip', 'develop', 'trial', 'release', 'preRelease']
const webUrl = webUrls[target[index]]
this.setData({ webUrl })
},
onShow() {
setCustomTabBar(this, 1)
this.getUserInfo()
},
})