From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 26 四月 2022 19:23:18 +0800
Subject: [PATCH] 2022-04-26

---
 src/components/header/index.jsx |   76 ++++++++++++++++++++++++++++++-------
 1 files changed, 61 insertions(+), 15 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index dca77b8..5b2824b 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -38,7 +38,8 @@
     visible: false, // 淇敼瀵嗙爜妯℃�佹
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     confirmLoading: false,
-    userName: sessionStorage.getItem('User_Name'),
+    userName: '',
+    fullName: '',
     logourl: window.GLOB.mainlogo,
     appVersion: window.GLOB.appVersion,
     loginVisible: false,
@@ -189,10 +190,19 @@
 
         const { menulist, thdMenuList } = this.getMenulist(result)
 
+        let systems = []
+        if ((options.sysType === 'local' || options.sysType === 'SSO') && result.sys_list) {
+          systems = result.sys_list
+
+          if (options.sysType === 'local' && window.GLOB.systemType !== 'production' && systems.length > 10) {
+            systems.length = 10
+          }
+        }
+
         this.setState({
           menulist,
           thdMenuList,
-          systems: window.GLOB.systemType === 'production' || options.sysType === 'SSO' ? (result.sys_list || []) : []
+          systems: systems
         })
         
         let mainMenu = menulist[0] || ''
@@ -446,7 +456,6 @@
             message: result.message,
             duration: 10
           })
-          return
         } else if (result.func_detail && result.func_detail.length > 0) {
           this.writeFuncs(result.func_detail)
         }
@@ -551,18 +560,40 @@
       url = url + '/'
     }
 
-    let href = url + 'index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
-      UserID: sessionStorage.getItem('UserID'),
-      LoginUID: sessionStorage.getItem('LoginUID'),
-      User_Name: sessionStorage.getItem('User_Name'),
-      Full_Name: sessionStorage.getItem('Full_Name'),
-      avatar: sessionStorage.getItem('avatar'),
-      dataM: system.dataM ? 'true' : '',
-      debug: system.debug || '',
-      role_id: system.role_id || ''
-    })))
+    let key = Utils.getuuid()
 
-    window.open(href)
+    let _param = {
+      func: 'webapi_scan_binding_key',
+      binding_type: 'mk',
+      scan_type: 'toggle',
+      scan_appkey: system.scan_appkey,
+      id: key
+    }
+
+    Api.getSystemConfig(_param).then(res => {
+      if (!res.status) {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+      } else if (res.thd_party_appid && res.thd_party_member_id && res.thd_party_openid) {
+        let href = url + 'admin/index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({
+          appid: res.thd_party_appid,
+          memberId: res.thd_party_member_id,
+          openid: res.thd_party_openid,
+          key: key
+        })))
+
+        window.open(href)
+      } else {
+        notification.warning({
+          top: 92,
+          message: '淇℃伅缂哄け锛岃鑱旂郴绠$悊鍛橈紒',
+          duration: 5
+        })
+      }
+    })
   }
 
   dropdownMenuChange = (visible) => {
@@ -579,6 +610,15 @@
   UNSAFE_componentWillMount () {
     // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁
     this.getRolesMenu()
+
+    let fullName = sessionStorage.getItem('Full_Name') || ''
+    let userName = sessionStorage.getItem('User_Name') || ''
+
+    if (fullName.toLowerCase() === userName.toLowerCase()) {
+      userName = ''
+    }
+
+    this.setState({fullName, userName})
   }
 
   componentDidMount () {
@@ -586,6 +626,12 @@
     setTimeout(() => {
       Api.getAppVersion().then(() => {}, () => {})
     }, 1000)
+    // Api.genericInterface({
+    //   func: 's_get_fcc_account_data',
+    //   fcc_date: '2022-03-01',
+    //   search_type: ''
+    // }).then(res => {
+    // })
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -802,7 +848,7 @@
           <div>
             <img src={this.state.avatar || avatar} alt=""/>
             <span>
-              <span className="username">{this.state.userName}</span> <DownOutlined />
+              <span className="username"><span>{this.state.fullName}</span>{this.state.userName ? <span>{this.state.userName}</span> : null}</span> <DownOutlined />
             </span>
           </div>
         </Dropdown>

--
Gitblit v1.8.0