Files
quinn-accounts/pages/myself/index.js
2023-02-12 00:17:42 +08:00

45 lines
1.0 KiB
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()
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
return {
title: '南瓜瞄记账'
}
},
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)
}
}
})
}
});