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.
96 lines
2.1 KiB
96 lines
2.1 KiB
<script>
|
|
import config from "common/config.js";
|
|
import {
|
|
navParams
|
|
} from "common/nav-calc-utils.js";
|
|
export default {
|
|
globalData: {
|
|
wxSilentLoginURL: config.baseUrl + "/lpkcustomer/wxSilentLogin",
|
|
sid: "",
|
|
token: "",
|
|
navInfo: {
|
|
|
|
}
|
|
},
|
|
onLaunch: function() {
|
|
|
|
const updateManager = uni.getUpdateManager();
|
|
|
|
updateManager.onCheckForUpdate(function(res) {
|
|
// 请求完新版本信息的回调
|
|
console.log(res.hasUpdate);
|
|
});
|
|
|
|
updateManager.onUpdateReady(function(res) {
|
|
uni.showModal({
|
|
title: '更新提示',
|
|
content: '新版本已经准备好,是否重启应用?',
|
|
success(res) {
|
|
if (res.confirm) {
|
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
updateManager.applyUpdate();
|
|
}
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
updateManager.onUpdateFailed(function(res) {
|
|
// 新的版本下载失败
|
|
});
|
|
|
|
|
|
this.globalData.navInfo = navParams()
|
|
let _this = this;
|
|
wx.login({
|
|
success: function(res) {
|
|
uni.request({
|
|
// 组装请求地址
|
|
url:_this.globalData.wxSilentLoginURL + "?wxCode=" + res.code,
|
|
method: "GET",
|
|
header: {
|
|
'content-type': "application/x-www-form-urlencoded"
|
|
},
|
|
data: {
|
|
"wxCode": res.code
|
|
},
|
|
success: res => {
|
|
if (res.statusCode == 200) {
|
|
if (!res.data.success) {
|
|
if (res.data.code == "110") {
|
|
// 需要绑定手机号
|
|
uni.reLaunch({
|
|
url: '/pages/index/BindPhone?openid=' +
|
|
res.data.data.wxMpOpenid
|
|
})
|
|
} else {
|
|
// _this.status = 'more'
|
|
}
|
|
} else {
|
|
// 成功后跳转主页
|
|
_this.globalData.sid = res.data.data.sid
|
|
console.log("用户sid",_this.globalData.sid)
|
|
}
|
|
} else {
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
}
|
|
});
|
|
},
|
|
fail: function(res) {
|
|
}
|
|
});
|
|
},
|
|
onShow: function() {
|
|
console.log('App Show')
|
|
},
|
|
onHide: function() {
|
|
console.log('App Hide')
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
/*每个页面公共css */
|
|
</style>
|