From 6d71b3fac75a35e8ebf08e71ba40c5be8a586024 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 08 九月 2021 18:10:17 +0800
Subject: [PATCH] 2021-09-08

---
 src/components/header/index.jsx |   53 ++++++++---------------------------------------------
 1 files changed, 8 insertions(+), 45 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 1485833..9f703f8 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -4,7 +4,7 @@
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import moment from 'moment'
-import { Dropdown, Menu, Icon, Modal, Form, notification, Switch, Input, Badge } from 'antd'
+import { Dropdown, Menu, Icon, Modal, Form, notification, Switch, Input } from 'antd'
 
 import {
   toggleCollapse,
@@ -22,12 +22,14 @@
 import enUS from '@/locales/en-US/main.js'
 import Utils from '@/utils/utils.js'
 import avatar from '@/assets/img/avatar.jpg'
+import asyncComponent from '@/utils/asyncComponent'
 import Resetpwd from './resetpwd'
 import LoginForm from './loginform'
 import './index.scss'
 
 const { confirm } = Modal
 const { Search } = Input
+const VersionsUp = asyncComponent(() => import('./versions'))
 
 class Header extends Component {
   static propTpyes = {
@@ -46,8 +48,6 @@
     systems: [],
     searchkey: '',
     thdMenuList: [],
-    oriVersion: '',
-    newVersion: '',
     debug: sessionStorage.getItem('debug') === 'true',
     navBar: ['linkage_navigation', 'linkage', 'menu_board', 'menu_board_navigation'].includes(window.GLOB.navBar) ? 'topmenu' : '',
     menuType: window.GLOB.navBar
@@ -596,12 +596,7 @@
   componentDidMount () {
     // 鑾峰彇绯荤粺鐨勭増鏈俊鎭紝寤舵椂鏌ヨ
     setTimeout(() => {
-      Api.getAppVersion().then(res => {
-        this.setState({
-          oriVersion: res.oldVersion,
-          newVersion: res.newVersion
-        })
-      }, () => {})
+      Api.getAppVersion().then(() => {}, () => {})
     }, 1000)
   }
 
@@ -616,38 +611,6 @@
     this.setState = () => {
       return
     }
-  }
-
-  verup = () => {
-    const { oriVersion, newVersion } = this.state
-    const _this = this
-
-    confirm({
-      title: this.state.dict['main.verup'],
-      content: `鏈�鏂扮増鏈�${newVersion}锛屽綋鍓嶇増鏈�${oriVersion}`,
-      onOk() {
-        return new Promise(resolve => {
-          if (!window.GLOB.WebSql) {
-            notification.warning({
-              top: 92,
-              message: '鍗囩骇澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�',
-              duration: 2
-            })
-            resolve()
-          } else {
-            Api.updateAppVersion(newVersion)
-            notification.success({
-              top: 92,
-              message: '鍗囩骇鎴愬姛锛�',
-              duration: 2
-            })
-            _this.setState({oriVersion: newVersion})
-            resolve()
-          }
-        })
-      },
-      onCancel() {}
-    })
   }
 
   gotoDoc = () => {
@@ -702,7 +665,7 @@
 
   render () {
     const { mainMenu, collapse } = this.props
-    const { thdMenuList, searchkey, oriVersion, newVersion, debug, menulist, navBar, menuType } = this.state
+    const { thdMenuList, searchkey, debug, menulist, navBar, menuType } = this.state
 
     const menu = (
       <Menu className="header-dropdown">
@@ -717,9 +680,9 @@
           ))}
         </Menu.SubMenu> : null}
         <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item>
-        {oriVersion ? <Menu.Item key="verup" onClick={this.verup}>
-          <Badge dot={oriVersion !== newVersion}>{this.state.dict['main.verup']}</Badge>
-        </Menu.Item> : null}
+        <Menu.Item style={{padding: 0}} key="verup">
+          <VersionsUp debug={debug} />
+        </Menu.Item>
         <Menu.Item key="logout" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item>
       </Menu>
     )

--
Gitblit v1.8.0