From 05707c8c6adb1042597c52091ad25ed64d15bb55 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期四, 21 三月 2024 14:38:19 +0800
Subject: [PATCH] 设置

---
 pages/personalCenter/index.js |   54 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/pages/personalCenter/index.js b/pages/personalCenter/index.js
index 1cfeaa4..7ece773 100644
--- a/pages/personalCenter/index.js
+++ b/pages/personalCenter/index.js
@@ -117,7 +117,6 @@
     moreMenu,
     moreMenu1,
     visible: false,
-
   },
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
@@ -168,7 +167,9 @@
         let userTypeData = res.infoList.find((item) => item.type == 'userType')
         let type = "";
         if (userTypeData) {
-          this.data.userTypeActive = JSON.parse(userTypeData.data).userType;
+          this.setData({
+            userTypeActive: JSON.parse(userTypeData.data).userType,
+          });
           type = userTypeList.find((item) => item.value === this.data.userTypeActive)?.lable;
         } else {
           type = '-'
@@ -251,14 +252,47 @@
   },
   //淇敼鐢ㄦ埛绫诲瀷
   editUserType() {
-    this.setData({
-      visible: true,
-    });
+    if (!this.data.visible) {
+      this.setData({
+        visible: true,
+      });
+    }
   },
   onVisibleChange(e) {
     this.setData({
       visible: e.detail.visible,
     });
+  },
+  tabUserTypeClick(e) {
+    console.log(e)
+    let { info } = e.currentTarget.dataset;
+    this.setData({
+      userTypeActive: info.value,
+    });
+  },
+  submit() {
+    let userTypeInfo = {
+      requests: [
+        {
+          data: JSON.stringify({ userType: this.data.userTypeActive }),
+          name: '鐢ㄦ埛绫诲瀷',
+          type: 'userType'
+        }
+      ]
+    }
+    app.MG.identity.setAppUserInfo(userTypeInfo).then((res) => {
+      if (res) {
+        wx.showToast({
+          title: "淇敼鎴愬姛",
+          icon: 'success',
+          duration: 1000,
+        })
+        this.getUserInfo()
+        this.setData({
+          visible: false,
+        });
+      }
+    })
   },
   //璁剧疆
   gotoUserEditPage() {
@@ -284,14 +318,16 @@
     }
   },
 
+  onPageScroll(e) {
+    this.setData({
+      isWhite: e.scrollTop > 20 ? true : false
+    })
+  },
+
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
    */
   onShareAppMessage() {
 
   },
-  //璺宠浆鍏充簬鎴戜滑鍜岃仈绯绘垜浠�
-  onAboutUS() {
-    console.log(111);
-  }
 })
\ No newline at end of file

--
Gitblit v1.9.1