From 044a4ec4ebe85f8c00e889fe3914de17a6ea1f28 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 17 十月 2024 18:18:01 +0800
Subject: [PATCH] 2024-10-17

---
 src/components/header/index.jsx |   96 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 62 insertions(+), 34 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 8465cc8..3602f41 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')),
@@ -32,7 +34,8 @@
     thdMenuList: [],
     debug: sessionStorage.getItem('debug') === 'true' && window.GLOB.memberLevel > 0,
     collapse: sessionStorage.getItem('collapse') === 'true',
-    lang: sessionStorage.getItem('lang') || ''
+    lang: sessionStorage.getItem('lang') || '',
+    dict: window.GLOB.dict
   }
 
   UNSAFE_componentWillMount () {
@@ -53,7 +56,9 @@
   componentDidMount () {
     // 鑾峰彇绯荤粺鐨勭増鏈俊鎭紝寤舵椂鏌ヨ
     setTimeout(() => {
-      Api.getAppVersion()
+      if (!window.GLOB.$error) {
+        Api.getAppVersion()
+      }
     }, 1000)
 
     // sessionStorage 璺ㄩ〉闈㈠叡浜�
@@ -106,21 +111,24 @@
       setTimeout(() => {
         sessionStorage.clear()
         this.props.history.replace('/login')
+        window.location.reload()
       }, 2000)
     })
   }
 
   logout = () => {
+    const { dict } = this.state
     // 閫�鍑虹櫥褰�
-    let _this = this
+    let that = this
     confirm({
-      title: '鎮ㄧ‘瀹氳閫�鍑哄悧?',
+      title: dict['logout_query'] || '鎮ㄧ‘瀹氳閫�鍑哄悧锛�',
       content: '',
-      okText: '纭畾',
-      cancelText: '鍙栨秷',
+      okText: dict['ok'] || '纭畾',
+      cancelText: dict['cancel'] || '鍙栨秷',
       onOk() {
         sessionStorage.clear()
-        _this.props.history.replace('/login')
+        that.props.history.replace('/login')
+        window.location.reload()
       },
       onCancel() {}
     })
@@ -284,7 +292,7 @@
 
           if (PageParam.OpenType === 'outpage' && PageParam.linkUrl) {
             fstItem.OpenType = 'newpage'
-            fstItem.src = PageParam.linkUrl
+            fstItem.src = window.GLOB.systemType === 'production' && PageParam.linkProUrl ? PageParam.linkProUrl : PageParam.linkUrl
             if (/#\/iframe\//.test(fstItem.src)) {
               fstItem.src = fstItem.src.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))
               fstItem.type = 'iframe'
@@ -340,7 +348,7 @@
 
                   if (trdItem.type === 'NewPage') {
                     trdItem.OpenType = 'newpage'
-                    trdItem.src = PageParam.url || ''
+                    trdItem.src = window.GLOB.systemType === 'production' && PageParam.proUrl ? PageParam.proUrl : PageParam.url || ''
                     if (/#\/iframe\//.test(trdItem.src)) {
                       trdItem.src = trdItem.src.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID'))
                       trdItem.type = 'iframe'
@@ -437,11 +445,12 @@
           sessionStorage.setItem('cloudDataM', res.dataM ? 'true' : '')
           sessionStorage.setItem('cloudRole_id', res.role_id || '')
 
-          let _url = window.location.href.split('#')[0] + 'cloud'
+          sessionStorage.setItem('CloudLogo', res.open_logo || '')
+
           if (param.remember) {
-            localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: param.password}))))
+            localStorage.setItem(window.GLOB.sysSign + 'cloud', window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: param.password}))))
           } else {
-            localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: ''}))))
+            localStorage.setItem(window.GLOB.sysSign + 'cloud', window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: ''}))))
           }
 
           window.GLOB.mainMenu = null
@@ -559,25 +568,31 @@
   }
 
   verup = () => {
+    const { dict } = this.state
+
     confirm({
-      title: '椤甸潰鏇存柊',
-      content: '閲嶆柊鍔犺浇搴旂敤淇℃伅',
+      title: dict['page_upd'] || '椤甸潰鏇存柊',
+      content: dict['reload_app'] || '閲嶆柊鍔犺浇搴旂敤淇℃伅',
+      okText: dict['ok'] || '纭畾',
+      cancelText: dict['cancel'] || '鍙栨秷',
       onOk() {
         return new Promise(resolve => {
           if (!window.GLOB.IndexDB) {
             notification.warning({
               top: 92,
-              message: '鏇存柊澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�',
+              message: dict['exc_fail'] || '鏇存柊澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�',
               duration: 2
             })
             resolve()
           } else {
             Api.updateAppVersion()
             Api.delCacheConfig('all')
+            localStorage.removeItem(window.location.href.split('#')[0] + 'AuthCode')
+
             setTimeout(() => {
               notification.success({
                 top: 92,
-                message: '鏇存柊鎴愬姛锛�',
+                message: dict['exc_success'] || '鏇存柊鎴愬姛锛�',
                 duration: 2
               })
               resolve()
@@ -591,15 +606,8 @@
 
   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: '鍏抽棴'
+      title: (window.GLOB.dict['sys_ver'] || '绯荤粺鐗堟湰') + ' v' + window.GLOB.appVersion,
+      okText: window.GLOB.dict['got_it'] || '鐭ラ亾浜�',
     })
   }
 
@@ -610,32 +618,32 @@
   }
 
   render () {
-    const { thdMenuList, searchkey, debug, menulist, collapse } = this.state
+    const { thdMenuList, searchkey, debug, menulist, collapse, dict } = this.state
     const navBar = window.GLOB.navBar
 
     const menu = (
       <Menu className="header-dropdown">
         {debug && <Menu.Item key="switch">
-          缂栬緫
+          {dict['edit'] || '缂栬緫'}
           <Switch size="small" style={{marginLeft: '7px'}} checked={false} onChange={this.changeEditState} />
         </Menu.Item>}
-        <Menu.Item key="password" onClick={this.changePassword}>淇敼瀵嗙爜</Menu.Item>
-        {this.state.systems.length ? <Menu.SubMenu style={{minWidth: '110px'}} title="鍒囨崲绯荤粺">
+        <Menu.Item key="password" onClick={this.changePassword}>{dict['ch_pwd'] || '淇敼瀵嗙爜'}</Menu.Item>
+        {this.state.systems.length ? <Menu.SubMenu style={{minWidth: '110px'}} title={dict['swt_sys'] || '鍒囨崲绯荤粺'}>
           {this.state.systems.map((system, index) => (
             <Menu.Item style={{minWidth: '100px', lineHeight: '30px'}} key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item>
           ))}
         </Menu.SubMenu> : null}
-        <Menu.Item key="doc" onClick={this.gotoDoc}>鏂囨。涓績</Menu.Item>
+        <Menu.Item key="doc" onClick={this.gotoDoc}>{dict['doc_center'] || '鏂囨。涓績'}</Menu.Item>
         <Menu.Item key="verup" onClick={this.verup}>
-          椤甸潰鏇存柊
+          {dict['page_upd'] || '椤甸潰鏇存柊'}
         </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}>
-          鍏充簬
+          {dict['about'] || '鍏充簬'}
         </Menu.Item> : null}
-        <Menu.Item key="logout" onClick={this.logout}>閫�鍑�</Menu.Item>
+        <Menu.Item key="logout" onClick={this.logout}>{dict['logout'] || '閫�鍑�'}</Menu.Item>
       </Menu>
     )
 
@@ -802,6 +810,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