From 9a11e62adeb8d435b52a361eb62d5b59e1deef2a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 23 五月 2024 21:14:50 +0800
Subject: [PATCH] 2024-05-23

---
 src/components/header/index.jsx |   85 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 69 insertions(+), 16 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 7db59b7..1a8b396 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -10,6 +10,7 @@
 import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
 import avatar from '@/assets/img/avatar.jpg'
+import wxicon from '@/assets/img/wx-icon.png'
 import './index.scss'
 
 const { confirm } = Modal
@@ -24,6 +25,7 @@
     userName: '',
     fullName: '',
     logourl: window.GLOB.mainlogo,
+    wxVisible: false,
     loginVisible: false,
     loginLoading: false,
     avatar: Utils.getrealurl(sessionStorage.getItem('avatar')),
@@ -31,7 +33,8 @@
     searchkey: '',
     thdMenuList: [],
     debug: sessionStorage.getItem('debug') === 'true' && window.GLOB.memberLevel > 0,
-    collapse: sessionStorage.getItem('collapse') === 'true'
+    collapse: sessionStorage.getItem('collapse') === 'true',
+    lang: sessionStorage.getItem('lang') || ''
   }
 
   UNSAFE_componentWillMount () {
@@ -60,7 +63,7 @@
       if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) {
         localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage))
       } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) {
-        localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions}))
+        localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: this.state.thdMenuList, mkActions: window.GLOB.mkActions}))
       } else if (e.key === 'menuUpdate') {
         let vals = e.newValue.split(',')
         let menuId = vals[1]
@@ -180,13 +183,22 @@
       }
 
       window.GLOB.mainMenu = mainMenu
-      window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}]
+
+      thdMenuList.forEach(item => {
+        window.GLOB.mkThdMenus.set(item.MenuID, item)
+      })
+
+      window.GLOB.mkThdMenus.set('home_page_id', {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'})
 
       MKEmitter.emit('mainMenuChange')
 
       if (_menu) {
         this.openTab(_menu, 0)
       }
+
+      setTimeout(() => {
+        this.getwork()
+      }, 100)
     })
     
     // 鑾峰彇瑙掕壊鏉冮檺, edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A'
@@ -205,7 +217,7 @@
               _permAction[menu.MenuID] = true
             })
           }
-        } else {
+        } else if (!/PRIMARY KEY/ig.test(result.message)) {
           notification.error({
             top: 92,
             message: result.message,
@@ -218,6 +230,29 @@
     }, 50)
   }
 
+  getwork = () => {
+    if (sessionStorage.getItem('work_grade')) return
+
+    let param = {func: 's_get_local_my_worker_v1'}
+
+    if (window.GLOB.forcedUpdate) {
+      param.s_version_up = 'true'
+    }
+    
+    Api.genericInterface(param).then(result => {
+      sessionStorage.setItem('work_grade', result.work_grade || 0)
+      sessionStorage.setItem('work_group', result.work_group || '')
+
+      if (!result.status && sessionStorage.getItem('debug') === 'true') {
+        notification.error({
+          top: 92,
+          message: /s_get_local_my_worker_v1/.test(result.message) ? '鑱屽憳淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛樸��' : result.message,
+          duration: 10
+        })
+      }
+    })
+  }
+
   openTab = (menu, times) => {
     if (times > 50) return
     times++
@@ -228,7 +263,7 @@
       MKEmitter.emit('modifyTabs', menu)
     } else {
       setTimeout(() => {
-        this.openTab(times)
+        this.openTab(menu, times)
       }, 200)
     }
   }
@@ -302,6 +337,8 @@
                   trdItem.type = PageParam.Template || 'CommonTable'
                   trdItem.OpenType = PageParam.OpenType || 'newtab'
                   trdItem.hidden = PageParam.hidden || 'false'
+                  trdItem.menuColor = PageParam.menuColor || ''
+                  trdItem.urlFields = PageParam.urlFields || ''
 
                   if (trdItem.type === 'NewPage') {
                     trdItem.OpenType = 'newpage'
@@ -401,6 +438,8 @@
           sessionStorage.setItem('CloudAvatar', res.icon)
           sessionStorage.setItem('cloudDataM', res.dataM ? 'true' : '')
           sessionStorage.setItem('cloudRole_id', res.role_id || '')
+
+          sessionStorage.setItem('CloudLogo', res.open_logo || '')
 
           let _url = window.location.href.split('#')[0] + 'cloud'
           if (param.remember) {
@@ -539,6 +578,8 @@
           } else {
             Api.updateAppVersion()
             Api.delCacheConfig('all')
+            localStorage.removeItem(window.location.href.split('#')[0] + 'AuthCode')
+
             setTimeout(() => {
               notification.success({
                 top: 92,
@@ -557,14 +598,6 @@
   about = () => {
     Modal.success({
       title: '绯荤粺鐗堟湰v' + window.GLOB.appVersion
-    })
-  }
-
-  wxnotice = () => {
-    Modal.success({
-      className: 'mk-wx-notice',
-      title: <QrCode card={{qrWidth: 320, color: '#000000'}} value={window.GLOB.baseurl + 'mob/wxnotice.html?userid=' + sessionStorage.getItem('UserID') + '&loginuid=' + sessionStorage.getItem('LoginUID')}/>,
-      okText: '鍏抽棴'
     })
   }
 
@@ -594,7 +627,7 @@
         <Menu.Item key="verup" onClick={this.verup}>
           椤甸潰鏇存柊
         </Menu.Item>
-        {window.GLOB.WXNotice ? <Menu.Item key="wxnotice" onClick={this.wxnotice}>
+        {window.GLOB.WXNotice ? <Menu.Item key="wxnotice" onClick={() => this.setState({wxVisible: true})}>
           寰俊娑堟伅
         </Menu.Item> : null}
         {window.GLOB.appVersion ? <Menu.Item key="version" onClick={this.about}>
@@ -680,7 +713,7 @@
                             <div className="title" onClick={e => e.stopPropagation()}>{cell.MenuName}</div>
                             <div className="menu-detail">
                               {cell.children && cell.children.map(m => (
-                                <div key={m.MenuID} title={m.MenuName} onClick={() => {this.changeVerMenu(m)}}>
+                                <div key={m.MenuID} title={m.MenuName} style={m.menuColor ? {color: m.menuColor} : null} onClick={() => {this.changeVerMenu(m)}}>
                                   {m.MenuName}
                                 </div>
                               ))}
@@ -755,7 +788,7 @@
         </Dropdown>
         {/* 缂栬緫鐘舵�佺櫥褰� */}
         <Modal
-          title="鐧诲綍寮�鍙戞満"
+          title={<span>鐧诲綍寮�鍙戞満{this.state.lang === 'en-US' ? <span style={{color: 'red'}}>锛堣嫳鏂囷級</span> : ''}</span>}
           visible={this.state.loginVisible}
           onOk={this.loginSubmit}
           width={'430px'}
@@ -767,6 +800,26 @@
         </Modal>
         {/* 淇敼瀵嗙爜 */}
         <Resetpwd />
+        {/* 寰俊娑堟伅 */}
+        <Modal
+          wrapClassName="mk-wx-sms-modal"
+          visible={this.state.wxVisible}
+          title="鎵爜鍏虫敞  鎺ユ敹娑堟伅"
+          width={400}
+          centered={true}
+          onCancel={() => this.setState({wxVisible: false})}
+          footer={null}
+          destroyOnClose
+        >
+          <div className="wx-sms-wrap">
+            <QrCode card={{qrWidth: 200, color: '#000000'}} value={window.GLOB.baseurl + 'mob/wxnotice.html?userid=' + sessionStorage.getItem('UserID') + '&loginuid=' + sessionStorage.getItem('LoginUID')}/>
+            <div className="tip">
+              <img src={wxicon} alt=""/>
+              <span>寰俊鎵爜</span>
+              <span>鍏虫敞鍏紬鍙�</span>
+            </div>
+          </div>
+        </Modal>
       </header>
     )
   }

--
Gitblit v1.8.0