You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
//app.js
|
|
const storage = require('./utils/storage')
|
|
|
|
App({
|
|
evn: 2, // 0: 开发版本;1:测试版本;2:生产版本
|
|
tmplIds: ['AFoM5TOfsgERsfcetNSB0UlmEixnLF1ySXr54Bqno2M', 'lOQ8Gvyy_dTk68bYGpRVnVA0M7DsYYrV81Gd39GUPBA'],
|
|
version: '2.1.0',
|
|
xAppId: '503258978847953926',
|
|
userInfo: null,
|
|
//----------------------------------------------globalData--------------------------------------
|
|
globalData: {
|
|
token: null,
|
|
agenting: 1,
|
|
keyboardHeight: 0,
|
|
isIos: false
|
|
},
|
|
//-----------------------------------------onLaunch---------------------------------------------
|
|
onLaunch: function () {
|
|
if (this.evn != 2) {
|
|
var senv = storage.get('dev-env')
|
|
if(senv){
|
|
this.evn = senv == 'test' ? 1 : 0
|
|
} else {
|
|
wx.request({
|
|
url: 'https://pv.sohu.com/cityjson?ie=utf-8',
|
|
success: function (result) {
|
|
var start = result.data.indexOf('{')
|
|
var end = result.data.indexOf('}')
|
|
var ipo = JSON.parse(result.data.substring(start, end + 1))
|
|
if(ipo.cip == '113.66.211.195'){
|
|
console.log(ipo.cip)
|
|
storage.put('dev-env', 'dev')
|
|
} else {
|
|
storage.put('dev-env', 'test')
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
})
|