From 0b523220931d70aa752c3beaca5ed32ca85511c5 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 28 三月 2024 11:36:05 +0800
Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master

---
 packageDomain/pages/teacherCertification/index.js |   99 +++++++++++++++++++++++++++----------------------
 1 files changed, 54 insertions(+), 45 deletions(-)

diff --git a/packageDomain/pages/teacherCertification/index.js b/packageDomain/pages/teacherCertification/index.js
index 82493b7..4079d7d 100644
--- a/packageDomain/pages/teacherCertification/index.js
+++ b/packageDomain/pages/teacherCertification/index.js
@@ -1,8 +1,13 @@
 const app = getApp();
 import SparkMD5 from 'spark-md5'
 import tool from "../../../assets/js/toolClass.js";
-import { getTopicMsgCmsItemFile } from '../../../assets/js/middleGround/tool.js';
+import {
+  getTopicMsgCmsItemFile
+} from '../../../assets/js/middleGround/tool.js';
 import FormData from '../../../utils/formdata/index.js';
+import {
+  loginInfo
+} from '../../../assets/js/login';
 Page({
 
   /**
@@ -46,10 +51,21 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad() {
+    //鑾峰彇鑱岀О
     this.getpositionalTitle();
     this.getAgreement();
-
     if (wx.getStorageSync(app.config.tokenKey)) {
+      this.getUserRole()
+    }
+    // 妫�鏌ョ櫥褰曠姸鎬�
+    const token = wx.getStorageSync(app.config.tokenKey)
+    if (!token) {
+      loginInfo(app, (data) => {
+        if (data) {
+          this.getUserRole()
+        }
+      })
+    } else {
       this.getUserRole()
     }
   },
@@ -91,7 +107,6 @@
         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 secretData = res.secretList.find(i => i.type == 'LoginNameAndPassword')
         let WeChatInfo = res.infoList.find((item) => item.type === "WeChat");
         let defaultUser = {};
         if (teacherRole && teacherInfos) {
@@ -103,9 +118,6 @@
             role: 'Teacher',
             roleId: teacherRole.role.id,
           }
-          this.setData({
-            currAuthStep: 2,
-          });
 
         } else if (WeChatInfo) {
           defaultUser = {
@@ -114,20 +126,13 @@
             icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon,
             userId: res.userId,
           }
-          this.setData({
-            currAuthStep: 3,
-          });
-        } else if (secretData) {
-          defaultUser = {
-            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : secretData.credential,
-            icon: nickNameData ? JSON.parse(nickNameData.data).icon : "",
-            userId: res.userId,
-          }
+
         }
         wx.setStorageSync(app.config.userInfoKey, JSON.stringify(defaultUser));
       }
     })
   },
+  //鑾峰彇瀛楁
   getType() {
     app.MG.resource.getCmsTypeByRefCode({
       refCodes: ['jsek_teacherCertification']
@@ -139,6 +144,7 @@
       this.newGetTeacherInfo()
     })
   },
+  //鑾峰彇鏁欏笀鐘舵��
   newGetTeacherInfo() {
     const data = {
       start: 0,
@@ -209,8 +215,7 @@
                 md5: this.data.teacherInfo.relevantCertificates,
                 linkType: 'LinkFile',
                 linkProtectType: 'Public',
-                url:
-                  app.config.requestCtx + `/file/GetPreViewImage?md5=` + this.data.teacherInfo.relevantCertificates,
+                url: app.config.requestCtx + `/file/GetPreViewImage?md5=` + this.data.teacherInfo.relevantCertificates,
                 imgUrl: app.config.requestCtx + `/file/GetPreViewImage?md5=` + this.data.teacherInfo.relevantCertificates,
               }
               arr.push(imgObj);
@@ -221,11 +226,10 @@
           }
 
         }
-      } catch (error) {
-      }
+      } catch (error) {}
     })
   },
-
+  //鑾峰彇鑱岀О
   getpositionalTitle() {
     const data = {
       refCodes: ['positionalTitle']
@@ -293,10 +297,14 @@
 
   //閫夋嫨鑱岀О
   onTeachPicker() {
-    this.setData({ teachVisible: true });
+    this.setData({
+      teachVisible: true
+    });
   },
   onPickerChange(e) {
-    const { label } = e.detail;
+    const {
+      label
+    } = e.detail;
     this.setData({
       teachVisible: false,
       teachText: label[0],
@@ -311,7 +319,9 @@
   },
   //杈撳叆鎵嬫満鍙�
   onPhoneInput(e) {
-    const { phoneError } = this.data;
+    const {
+      phoneError
+    } = this.data;
     const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value);
     if (phoneError === isPhoneNumber) {
       this.setData({
@@ -322,7 +332,9 @@
   },
   //杈撳叆搴ф満
   onTelphoneInput(e) {
-    const { telphoneError } = this.data;
+    const {
+      telphoneError
+    } = this.data;
     const isPhoneNumber = /^0\d{2}-\d{8}$|^0\d{3}-\d{7}$/.test(e.detail.value);
     if (telphoneError === isPhoneNumber) {
       this.setData({
@@ -332,7 +344,9 @@
     }
   },
   onEmailInput(e) {
-    const { emailError } = this.data;
+    const {
+      emailError
+    } = this.data;
     const isPhoneNumber = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(e.detail.value);
     if (emailError === isPhoneNumber) {
       this.setData({
@@ -345,7 +359,7 @@
   chooseImg(e) {
     var that = this;
     wx.chooseMedia({
-      // count: 1, // 榛樿9
+      count: 1,
       sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈�
       sourceType: ['album', 'camera'], // 鍙互鎸囧畾鏉ユ簮鏄浉鍐岃繕鏄浉鏈猴紝榛樿浜岃�呴兘鏈�
       success: function (res) {
@@ -383,14 +397,14 @@
                   data: data.buffer,
                   success(res1) {
                     if (res1.statusCode == 200) {
-                      resolve(res1.data); if (res1.data) {
+                      resolve(res1.data);
+                      if (res1.data) {
                         let arr = [];
                         let imgObj = {
                           md5: md5,
                           linkType: 'LinkFile',
                           linkProtectType: 'Public',
-                          url:
-                            app.config.requestCtx + `/file/GetPreViewImage?md5=` + md5,
+                          url: app.config.requestCtx + `/file/GetPreViewImage?md5=` + md5,
                           imgUrl: res.tempFiles[0].tempFilePath
                         }
                         arr = [...that.data.imgPics, ...[imgObj]];
@@ -563,13 +577,11 @@
         delete basicInfo.worksInfo
         delete basicInfo.state
         const userInfo = {
-          requests: [
-            {
-              data: JSON.stringify(basicInfo),
-              name: that.data.teacherInfo.fullName + '',
-              type: 'newTeacherInfo'
-            }
-          ]
+          requests: [{
+            data: JSON.stringify(basicInfo),
+            name: that.data.teacherInfo.fullName + '',
+            type: 'newTeacherInfo'
+          }]
         }
         app.MG.identity.setAppUserInfo(userInfo).then((res) => {
           if (res) {
@@ -601,13 +613,11 @@
         delete basicInfo.worksInfo
         delete basicInfo.state
         const userInfo = {
-          requests: [
-            {
-              data: JSON.stringify(basicInfo),
-              name: that.data.teacherInfo.fullName + '',
-              type: 'teacherInfo'
-            }
-          ]
+          requests: [{
+            data: JSON.stringify(basicInfo),
+            name: that.data.teacherInfo.fullName + '',
+            type: 'teacherInfo'
+          }]
         }
         app.MG.identity.setAppUserInfo(userInfo).then((res) => {
           app.MG.ugc.newTopicMessage(data).then(() => {
@@ -645,8 +655,7 @@
   /**
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
-  onReachBottom() {
-  },
+  onReachBottom() {},
 
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�

--
Gitblit v1.9.1