Files
quinn-accounts/pages/myself/index.js
2023-02-08 16:59:00 +08:00

37 lines
914 B
JavaScript

const app = getApp()
Page({
data: {
noLogin: true,
},
onLoad: function (options) {
let openId = wx.getStorageSync("userId");
if (openId) {
this.setData({
noLogin : false
})
}
},
onShow: function () {
if (wx.canIUse('hideHomeButton')) {
wx.hideHomeButton()
}
},
loginAcc () {
let that = this;
wx.login({
success (res) {
if (res.code) {
app.$api.loginAccount({"wxCode":res.code}).then(t=>{
wx.setStorageSync("userId",t.data)
that.setData({
noLogin : false
})
})
} else {
console.log('登录失败!' + res.errMsg)
}
}
})
}
});