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

---
 pages/personalCenter/index.js |   87 +++++++++++++++++++++++++++----------------
 1 files changed, 55 insertions(+), 32 deletions(-)

diff --git a/pages/personalCenter/index.js b/pages/personalCenter/index.js
index 7ece773..a6682bd 100644
--- a/pages/personalCenter/index.js
+++ b/pages/personalCenter/index.js
@@ -1,6 +1,5 @@
 const app = getApp()
-const menuData = [
-  {
+const menuData = [{
     title: '鎴戠殑璁㈠崟',
     icon: '/static/images/personal/order.png',
     url: '/packagePersonal/pages/myOrder/index',
@@ -49,8 +48,7 @@
     type: 'publishBooks',
   }
 ];
-const moreMenu = [
-  {
+const moreMenu = [{
     title: '鎴戠殑娑堟伅',
     icon: '/static/images/personal/notification.png',
     url: '/packagePersonal/pages/myMassage/index',
@@ -63,8 +61,7 @@
     type: 'feedback',
   }
 ];
-const moreMenu1 = [
-  {
+const moreMenu1 = [{
     title: '鍏充簬鎴戜滑',
     icon: '/static/images/personal/about.png',
     url: '/packagePersonal/pages/aboutUs/index?types=jsek_aboutUs',
@@ -77,8 +74,7 @@
     type: 'contact',
   }
 ];
-const userTypeList = [
-  {
+const userTypeList = [{
     lable: '涓亴鏁欏笀',
     value: 'vocSchoolTeachers'
   },
@@ -117,6 +113,13 @@
     moreMenu,
     moreMenu1,
     visible: false,
+    baseRefresh: {
+      value: false
+    },
+    loadingProps: {
+      size: '50rpx',
+    },
+    scrollTop: 0,
   },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -142,22 +145,27 @@
         url: "/pages/testLogin/index",
       });
     }
-
   },
   onShow() {
-
+    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
+      this.getTabBar().setData({
+        active: 4
+      })
+    }
   },
   /**
    * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
    */
   onPullDownRefresh() {
+    this.setData({
+      'baseRefresh.value': true,
+    })
     this.getUserInfo()
   },
   /**
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
-  onReachBottom() {
-  },
+  onReachBottom() {},
   // 鑾峰彇鐧诲綍鐢ㄦ埛韬唤
   getUserInfo() {
     app.MG.identity.getCurrentAppUser().then(res => {
@@ -175,6 +183,7 @@
           type = '-'
         }
         let defaultUser = {};
+        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')
@@ -182,8 +191,8 @@
         if (teacherRole && teacherInfos) {
           defaultUser = {
             ...teacherInfos,
-            fullName: teacherInfos.fullName,
-            icon: teacherInfos.icon,
+            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : teacherInfos.name,
+            icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo ? WeChatInfo.icon : '',
             userId: res.userId,
             role: 'Teacher',
             roleId: teacherRole.role.id,
@@ -196,20 +205,22 @@
         } else if (WeChatInfo) {
           defaultUser = {
             ...WeChatInfo,
-            fullName: WeChatInfo.name,
-            icon: WeChatInfo.icon,
+            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : WeChatInfo.name,
+            icon: nickNameData ? JSON.parse(nickNameData.data).icon : WeChatInfo.icon,
             userId: res.userId,
-            userType: type
+            userType: type,
+            role: 'Student',
           }
           this.setData({
             currAuthStep: 3,
           });
         } else if (secretData) {
           defaultUser = {
-            fullName: secretData.credential,
-            icon: "",
+            nickName: nickNameData ? JSON.parse(nickNameData.data).nickName : secretData.credential,
+            icon: nickNameData ? JSON.parse(nickNameData.data).icon : "",
             userId: res.userId,
-            userType: type
+            userType: type,
+            role: 'Student',
           }
         }
         this.setData({
@@ -217,6 +228,11 @@
         })
         this.getTeacherInfo()
         wx.setStorageSync(app.config.userInfoKey, JSON.stringify(this.data.userInfo));
+        setTimeout(() => {
+          this.setData({
+            'baseRefresh.value': false,
+          })
+        }, 500);
       }
     });
   },
@@ -264,21 +280,22 @@
     });
   },
   tabUserTypeClick(e) {
-    console.log(e)
-    let { info } = e.currentTarget.dataset;
+    let {
+      info
+    } = e.currentTarget.dataset;
     this.setData({
       userTypeActive: info.value,
     });
   },
   submit() {
     let userTypeInfo = {
-      requests: [
-        {
-          data: JSON.stringify({ userType: this.data.userTypeActive }),
-          name: '鐢ㄦ埛绫诲瀷',
-          type: 'userType'
-        }
-      ]
+      requests: [{
+        data: JSON.stringify({
+          userType: this.data.userTypeActive
+        }),
+        name: '鐢ㄦ埛绫诲瀷',
+        type: 'userType'
+      }]
     }
     app.MG.identity.setAppUserInfo(userTypeInfo).then((res) => {
       if (res) {
@@ -303,7 +320,6 @@
 
   //鐐瑰嚮鐩綍
   toPages(item) {
-    console.log(item)
     let info = item.currentTarget.dataset.info
     if (info.url) {
       wx.navigateTo({
@@ -318,12 +334,19 @@
     }
   },
 
-  onPageScroll(e) {
+  onScroll(e) {
     this.setData({
-      isWhite: e.scrollTop > 20 ? true : false
+      isWhite: e.detail.scrollTop > 10 ? true : false
     })
+    const {
+      scrollTop
+    } = e.detail;
+    this.setData({
+      scrollTop
+    });
   },
 
+
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */

--
Gitblit v1.9.1