68 lines
1.4 KiB
JavaScript
68 lines
1.4 KiB
JavaScript
/*
|
|
* 手太欠
|
|
* 愿这世界都如故事里一样 美好而动人~
|
|
*/
|
|
|
|
Page({
|
|
data: {
|
|
payCode : '', // code获取openid
|
|
openId : '', // openid
|
|
disabled : false, // 支付按钮
|
|
payStatus : false, // 支付弹框
|
|
catchtouchmove: false
|
|
},
|
|
|
|
onLoad(options) {
|
|
if(options.invite != undefined) {
|
|
getApp().globalData.inviteText = options.invite
|
|
}
|
|
wx.login({
|
|
success: res => {
|
|
this.setData({
|
|
payCode: res.code
|
|
})
|
|
// 获取openid
|
|
this.openInfo()
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* openid
|
|
*/
|
|
openInfo() {
|
|
wx.$api.auth.codeOpenid({code: this.data.payCode}).then(res => {
|
|
this.setData({
|
|
openId: res.data
|
|
})
|
|
}).catch(err => {})
|
|
},
|
|
|
|
/**
|
|
* 处理未登录时的转跳
|
|
*/
|
|
assessGo(){
|
|
if(wx.getStorageSync("token") != ''){
|
|
wx.navigateTo({
|
|
url: '/pages/index/assess/assess?code=' + this.data.openId
|
|
})
|
|
return
|
|
}
|
|
|
|
// 去登录
|
|
wx.navigateTo({
|
|
url: "/pages/login/index?type=indexDemo"
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 微信分享
|
|
*/
|
|
onShareAppMessage(){
|
|
return {
|
|
title : '水感应',
|
|
path : "/pages/index/index?invite=" + wx.getStorageSync("invite")
|
|
}
|
|
},
|
|
})
|