From b45a01a8bee4a9bff5f9c248ead301b8675d1099 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 28 十月 2022 17:22:35 +0800
Subject: [PATCH] 2022.10.28

---
 pages/m_user/mine/mine.js |  135 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 2 deletions(-)

diff --git a/pages/m_user/mine/mine.js b/pages/m_user/mine/mine.js
index a5515b2..ffdc436 100644
--- a/pages/m_user/mine/mine.js
+++ b/pages/m_user/mine/mine.js
@@ -1,4 +1,6 @@
 // pages/mine/mine.js
+import userservice from '../../../service/userservice'
+
 const app = getApp()
 
 Page({
@@ -7,7 +9,11 @@
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-
+    version: app.globalData.version,
+    //璁よ瘉鐘舵�侊紝[浼佷笟, 鍦烘櫙, 涓汉]
+    authStatus:[],
+    //鍦烘櫙绫诲瀷
+    sceneType: app.globalData.userInfo.extension2
   },
 
   /**
@@ -15,13 +21,138 @@
    */
   onLoad: function (options) {
     this.setData({
-      userRealName: app.globalData.userInfo.realname
+      userRealName: app.globalData.userInfo.realname,
+      sceneType: app.globalData.userInfo.extension2
     })
+    this.getBaseInfo()
+  },
+
+  onShow() {
+    this.getAuthStatus()
+  },
+
+  //鑾峰彇鐢ㄦ埛璁よ瘉鐘舵��
+  getAuthStatus() {
+    var that = this
+    userservice.getAuthStatus(app.globalData.accessToken.openId, app.globalData.accessToken.userId, {
+      success(res) {
+        if (res.success) {
+          that.setData({
+            authStatus: res.data
+          })
+        }else{
+          wx.showToast({
+            title: res.message,
+            duration: 2000,
+            icon: 'error',
+          })
+        }
+      }
+    })
+  },
+
+  getBaseInfo() {
+    var that = this
+    userservice.getBaseInfo(app.globalData.accessToken.userId, {
+      success(data) {
+        if (data.company != null) {
+          that.setData({
+            companyName: data.company.ciName
+          }) 
+        }
+      }
+    }, app.globalData.accessToken.openId)
   },
 
   logout() {
     wx.reLaunch({
       url: '/pages/m_user/userlogin/userlogin',
     })
+  },
+
+  goto(e) {
+    var url = ""
+    var index = e.currentTarget.dataset.index
+    switch (index) {
+      case "1":
+        //宸ヤ綔鎻愰啋
+        url = "/pages/m_notice/notice/notice"
+        break;
+      case "2":
+        //鎶�鏈敮鎸�
+        url = "/pages/m_user/p_support/p_support"
+        break;
+      case "3":
+        //鎴戠殑鏀惰棌
+        url = ""
+        break;
+      case "4":
+        //鎴戣鍜ㄨ
+        url = "/pages/m_consult/consultonline/consultonline"
+        break;
+      case "5":
+        //鐜繚鏃ョ▼
+        url = "/pages/m_service/p_schedule/p_schedule"
+        break;
+      case "6":
+        //鍏充簬
+        url = "/pages/m_user/p_about/p_about"
+        break;
+      case "7":
+        //鎿嶄綔鎸囧紩
+        url = "/pages/m_user/p_instructions/p_instructions"
+        break;
+    }
+    if (url != "") {
+      wx.navigateTo({
+        url: url
+      })
+    } else {
+      wx.showToast({
+        title: '鍔熻兘鏁鏈熷緟',
+        duration: 1000,
+        icon: 'none',
+        mask: true,
+      })
+    }
+  },
+
+  //璁よ瘉
+  gotoAuthentication(e) {
+    //绛夊緟璁よ瘉鐘舵�佸姞杞藉畬姣�
+    if (this.data.authStatus.length == 0) return
+    var url = ""
+    var index = e.currentTarget.dataset.index
+    switch (index) {
+      //浼佷笟璁よ瘉
+      case "0":
+        url = "/pages/m_user/companyauthentication/companyauthentication"
+        break;
+      //鍦烘櫙璁よ瘉
+      case "1":
+        url = "/pages/m_user/sceneauthentication/sceneauthentication"
+        break;
+      //涓汉璁よ瘉
+      case "2":
+        url = "/pages/m_user/personalauthentication/personalauthentication"
+        break;
+    }
+    if (url != "") {
+      wx.navigateTo({
+        url: url,
+        success: (res) => {
+          res.eventChannel.emit('acceptDataFromOpenerPage', {
+            authStatus: this.data.authStatus[parseInt(index)]
+          })
+        },
+      })
+    } else {
+      wx.showToast({
+        title: '鍔熻兘鏁鏈熷緟',
+        duration: 1000,
+        icon: 'none',
+        mask: true,
+      })
+    }
   }
 })
\ No newline at end of file

--
Gitblit v1.9.3