From 10db09788d74b441a2efd85f5d4614e944b07bb3 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 26 三月 2024 20:07:11 +0800 Subject: [PATCH] 问题修改 --- packageDomain/pages/teacherCertification/index.js | 79 ++++++++++++++++++++++----------------- 1 files changed, 44 insertions(+), 35 deletions(-) diff --git a/packageDomain/pages/teacherCertification/index.js b/packageDomain/pages/teacherCertification/index.js index c245a0a..82493b7 100644 --- a/packageDomain/pages/teacherCertification/index.js +++ b/packageDomain/pages/teacherCertification/index.js @@ -88,44 +88,40 @@ this.setData({ userId: res.userId }) + let nickNameData = res.infoList.find((item) => item.type == 'nickName') 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 studentInfo = res.infoList.find((item) => item.type == 'Default') - let phoneInfo = res.secretList.find((item) => item.type == 'MobilePhone') - let emailInfo = res.secretList.find((item) => item.type == 'EMail') + let secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword') + let WeChatInfo = res.infoList.find((item) => item.type === "WeChat"); let defaultUser = {}; if (teacherRole && teacherInfos) { defaultUser = { ...teacherInfos, - nickName: teacherInfos.fullName, - avatarUrl: teacherInfos.icon, + nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : teacherInfos.name, + icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo ? WeChatInfo.icon : '', userId: res.userId, - phoneNumber: phoneInfo?.credential, - Email: emailInfo ? emailInfo.credential : JSON.parse(teacherInfos.data).email, role: 'Teacher', - roleId: teacherRole.role.id + roleId: teacherRole.role.id, } + this.setData({ + currAuthStep: 2, + }); - } else if (wechatInfo) { + } else if (WeChatInfo) { defaultUser = { - ...wechatInfo, - nickName: wechatInfo.name, - avatarUrl: wechatInfo.icon, + ...WeChatInfo, + nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : WeChatInfo.name, + icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon, userId: res.userId, - phoneNumber: phoneInfo?.credential, - Email: emailInfo?.credential, - role: 'Student' } - } else if (studentInfo) { + this.setData({ + currAuthStep: 3, + }); + } else if (secretData) { defaultUser = { - ...studentInfo, - nickName: wechatInfo.name ? wechatInfo.name : studentInfo.nickName, - avatarUrl: wechatInfo.icon, + nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : secretData.credential, + icon: nickNameData ? JSON.parse(nickNameData.data).icon : "", userId: res.userId, - phoneNumber: phoneInfo?.credential, - Email: emailInfo?.credential, - role: 'Student' } } wx.setStorageSync(app.config.userInfoKey, JSON.stringify(defaultUser)); @@ -171,7 +167,6 @@ }) } let info = getTopicMsgCmsItemFile(this.data.worksInfo, resData.cmsItemDataList) - console.log(info) this.setData({ 'teacherInfo.fullName': info.fullName, 'teacherInfo.schoolName': info.schoolName, @@ -201,7 +196,8 @@ md5: ele.file.md5, linkType: 'LinkFile', linkProtectType: 'Public', - url: app.config.requestCtx + `/file/GetPreViewImage?md5=` + ele.md5 + url: app.config.requestCtx + `/file/GetPreViewImage?md5=` + ele.md5, + imgUrl: ele.file.imgUrl } arr.push(imgObj); this.setData({ @@ -214,7 +210,8 @@ linkType: 'LinkFile', linkProtectType: 'Public', url: - app.config.requestCtx + `/file/GetPreViewImage?md5=` + this.data.teacherInfo.relevantCertificates + app.config.requestCtx + `/file/GetPreViewImage?md5=` + this.data.teacherInfo.relevantCertificates, + imgUrl: app.config.requestCtx + `/file/GetPreViewImage?md5=` + this.data.teacherInfo.relevantCertificates, } arr.push(imgObj); this.setData({ @@ -299,11 +296,11 @@ this.setData({ teachVisible: true }); }, onPickerChange(e) { - const { value, label } = e.detail; + const { label } = e.detail; this.setData({ teachVisible: false, teachText: label[0], - 'teacherInfo.positionalTitle': value.join[0], + 'teacherInfo.positionalTitle': label[0], }); }, onPickerCancel(e) { @@ -353,7 +350,6 @@ sourceType: ['album', 'camera'], // 鍙互鎸囧畾鏉ユ簮鏄浉鍐岃繕鏄浉鏈猴紝榛樿浜岃�呴兘鏈� success: function (res) { // 杩斿洖閫夊畾鐓х墖鐨勬湰鍦版枃浠惰矾寰勫垪琛紝tempFilePath涔熷彲浠ヤ綔涓篿mg鏍囩鐨剆rc灞炴�ф樉绀哄浘鐗� - console.log(res.tempFiles[0], 12); wx.getFileSystemManager().readFile({ filePath: res.tempFiles[0].tempFilePath, //閫夋嫨鍥剧墖杩斿洖鐨勭浉瀵硅矾寰� // encoding: 'binary', //缂栫爜鏍煎紡 @@ -448,7 +444,6 @@ }) }, onChange() { - console.log(this.data.teacherInfo.agree, 12) if (this.data.teacherInfo.agree) { this.setData({ 'teacherInfo.agree': false, @@ -472,11 +467,22 @@ reasonTxtShow: e.detail.visible }); }, + onCloseProtocol() { + this.setData({ + protocolShow: false, + }); + }, //鏌ョ湅涓洪�氳繃鍘熷洜 previewReason() { this.setData({ reasonTxtShow: true, + }); + }, + + onCloseReasonTxt() { + this.setData({ + reasonTxtShow: false, }); }, @@ -522,7 +528,7 @@ }) return } - if (that.data.teacherInfo.relevantCertificates.length == 0) { + if (that.data.imgPics.length == 0) { wx.showToast({ title: "璇蜂笂浼犲伐浣滆瘉锛�", icon: 'none', @@ -538,7 +544,6 @@ that.data.teacherInfo, that.data.imgPics ); - console.log(dataRequests, 4) const data = { description: '', icon: '', @@ -575,7 +580,8 @@ icon: 'none', duration: 1000, }) - that.newGetTeacherInfo() + that.getUserRole() + // that.newGetTeacherInfo() } }) } @@ -611,7 +617,8 @@ icon: 'none', duration: 1000, }) - that.newGetTeacherInfo() + // that.newGetTeacherInfo() + that.getUserRole() } }) }) @@ -630,13 +637,15 @@ * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 */ onPullDownRefresh() { + if (wx.getStorageSync(app.config.tokenKey)) { + this.getUserRole() + } }, /** * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� */ onReachBottom() { - }, /** -- Gitblit v1.9.1