From a9abe435bdc23bda340c84f45deb363eccf907a7 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 02 四月 2024 10:06:17 +0800 Subject: [PATCH] 个人中心 --- pages/personalCenter/index.js | 41 +++++++++++++++++++++++++++-------------- 1 files changed, 27 insertions(+), 14 deletions(-) diff --git a/pages/personalCenter/index.js b/pages/personalCenter/index.js index 0d20c2e..9fa904c 100644 --- a/pages/personalCenter/index.js +++ b/pages/personalCenter/index.js @@ -47,7 +47,7 @@ { title: '鍑轰功鐢宠', icon: '/static/images/personal/chushu.png', - url: '/packagePersonal/pages/publishBooks/index', + url: '', type: 'publishBooks', } ]; @@ -135,6 +135,14 @@ barHeight: systInfo.statusBarHeight, navBarHeight: navBarHeight, }); + + }, + onShow() { + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + this.getTabBar().setData({ + active: 4 + }) + } // 妫�鏌ョ櫥褰曠姸鎬� const token = wx.getStorageSync(app.config.tokenKey) if (!token) { @@ -148,16 +156,9 @@ }) } else { this.setData({ - currAuthStep: 1, + currAuthStep: 3, }); this.getUserInfo() - } - }, - onShow() { - if (typeof this.getTabBar === 'function' && this.getTabBar()) { - this.getTabBar().setData({ - active: 4 - }) } }, /** @@ -185,7 +186,7 @@ this.setData({ userTypeActive: JSON.parse(userTypeData.data).userType, }); - type = userTypeList.find((item) => item.value === this.data.userTypeActive)?.lable; + type = this.data.userTypeList.find((item) => item.value === this.data.userTypeActive)?.lable; } else { type = '' } @@ -194,11 +195,12 @@ let teacherRole = res.roleLinks.find((item) => item.role.refCode == 'teacher') let teacherInfos = res.infoList.find((item) => item.type == 'teacherInfo') let WeChatInfo = res.infoList.find((item) => item.type === "WeChat"); + let secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword') if (teacherRole && teacherInfos) { defaultUser = { ...teacherInfos, - nickName: teacherInfos.name, - icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo ? WeChatInfo.icon : '', + nickName: nickNameData && JSON.parse(nickNameData.data).nickName ? JSON.parse(nickNameData.data).nickName : WeChatInfo.name, + icon: nickNameData && JSON.parse(nickNameData.data).icon ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon, userId: res.userId, role: 'Teacher', roleId: teacherRole.role.id, @@ -211,8 +213,8 @@ } else if (WeChatInfo) { defaultUser = { ...WeChatInfo, - nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : WeChatInfo.name, - icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon, + nickName: nickNameData && JSON.parse(nickNameData.data).nickName ? JSON.parse(nickNameData.data).nickName : WeChatInfo.name, + icon: nickNameData && JSON.parse(nickNameData.data).icon ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon, userId: res.userId, userType: type, role: 'Student', @@ -220,6 +222,17 @@ this.setData({ currAuthStep: 3, }); + } else if (secretData) { + defaultUser = { + nickName: nickNameData && JSON.parse(nickNameData.data).nickName ? JSON.parse(nickNameData.data).nickName : secretData.credential, + icon: nickNameData && JSON.parse(nickNameData.data).icon != "" ? JSON.parse(nickNameData.data).icon : "", + userId: res.userId, + role: "Student", + userType: type, + } + this.setData({ + currAuthStep: 3, + }); } this.setData({ userInfo: defaultUser -- Gitblit v1.9.1