|
|
@@ -17,10 +17,6 @@ Page({
|
|
|
|
|
|
onLoad: function (options) {
|
|
|
this.autoLogin();
|
|
|
- this.setData({
|
|
|
- userCode: app.globalData.userCode
|
|
|
- });
|
|
|
- console.log('', app.globalData);
|
|
|
},
|
|
|
|
|
|
onShow() {
|
|
|
@@ -41,7 +37,8 @@ Page({
|
|
|
const token = wx.getStorageSync('accessToken');
|
|
|
if (token) {
|
|
|
this.setData({
|
|
|
- isLoggedIn: true
|
|
|
+ isLoggedIn: true,
|
|
|
+ userCode: app.globalData.userCode
|
|
|
});
|
|
|
// 已经登录
|
|
|
console.log('已经登录')
|
|
|
@@ -50,12 +47,15 @@ Page({
|
|
|
return;
|
|
|
}
|
|
|
// 未登录,执行登录
|
|
|
- const res = await app.login();
|
|
|
- this.setData({
|
|
|
- isLoggedIn: true
|
|
|
+ const res = await app.login().then(res => {
|
|
|
+ console.log('用户ID:', app.globalData.userCode)
|
|
|
+ this.setData({
|
|
|
+ isLoggedIn: true,
|
|
|
+ userCode: app.globalData.userCode
|
|
|
+ });
|
|
|
+ console.log('重新登录', res)
|
|
|
+ this.interstitalLoad();
|
|
|
});
|
|
|
- console.log('重新登录', res)
|
|
|
- this.interstitalLoad();
|
|
|
} catch (error) {
|
|
|
console.error('登录失败:', error);
|
|
|
}
|
|
|
@@ -93,8 +93,8 @@ Page({
|
|
|
|
|
|
goToReadingHistory() {
|
|
|
SendEvent('mine_reading_history', {"uuid": app.globalData.uuid});
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/readingHistory/readingHistory'
|
|
|
- })
|
|
|
+ wx.switchTab({
|
|
|
+ url: '/pages/bookshelf/bookshelf'
|
|
|
+ });
|
|
|
}
|
|
|
})
|