代码拉取完成,页面将自动刷新
const config=require('/utils/config.js');
App({
/**
* 当小程序初始化完成时,会触发 onLaunch(全局只触发一次)
*/
onLaunch: function () {
},
/**
* 当小程序启动,或从后台进入前台显示,会触发 onShow
*/
onShow: function (options) {
this.checkInternet()
var that=this
wx.login({
success:(res)=>{
config.ajax('POST',{
wxcode: res.code
}, config.wxLogin,(res)=>{
that.globalData.openid = res.data.data.openId
config.ajax('POST', {
openId: res.data.data.openId
}, config.isSubscibe, (res) => {
that.globalData.isSubscibe = res.data.data
}, (res) => {
})
},(res)=>{
})
},
fail: function(res) {},
complete: function(res) {},
})
},
checkInternet() {
try {
wx.getNetworkType({
success: function (res) {
if (res.networkType != 'wifi') {
wx.showToast({
title: '您当前的网络的状态为' + res.networkType + '网络!请注意您的流量费用',
icon: 'none',
mask: true,
})
}
}
})
}
catch (err) {
}
},
/**
* 当小程序从前台进入后台,会触发 onHide
*/
onHide: function () {
},
/**
* 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息
*/
onError: function (msg) {
},
globalData: {
openid:null,
isSubscibe:false
},
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。