1 Star 0 Fork 0

Augly/demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
Augly 提交于 2018-07-07 00:52 +08:00 . 提交demo
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
},
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/Q_Augly/demo.git
git@gitee.com:Q_Augly/demo.git
Q_Augly
demo
demo
master

搜索帮助