Browse Source

no message

feature/v2.1
xpz2018 4 years ago
parent
commit
462681da30
1 changed files with 27 additions and 0 deletions
  1. 27
      app.js

27
app.js

@ -1,4 +1,6 @@
//app.js
const storage = require('./utils/storage')
App({
evn: 1, // 0: 开发版本;1:测试版本;2:生产版本
tmplIds: ['AFoM5TOfsgERsfcetNSB0UlmEixnLF1ySXr54Bqno2M', 'lOQ8Gvyy_dTk68bYGpRVnVA0M7DsYYrV81Gd39GUPBA'],
@ -11,5 +13,30 @@ App({
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')
}
}
})
}
}
console.log(this.evn)
}
})
Loading…
Cancel
Save