From cbeffcc0902631909c0373f274752a97ddaf2d4e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 06 八月 2022 01:41:54 +0800
Subject: [PATCH] 2022-08-06

---
 src/components/header/index.jsx |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 1b78675..afbac7f 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -14,7 +14,7 @@
   initMenuPermission,
   logout
 } from '@/store/action'
-import asyncComponent from '@/utils/asyncComponent'
+import asyncComponent from '@/utils/asyncSpinComponent'
 import Api from '@/api'
 import MKEmitter from '@/utils/events.js'
 import options from '@/store/options.js'
@@ -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,
@@ -66,6 +67,8 @@
   }
 
   resetPwdSubmit = () => {
+    if (!this.formRef) return
+
     this.formRef.handleConfirm().then(res => {
       this.setState({
         confirmLoading: true
@@ -398,12 +401,31 @@
   }
 
   loginSubmit = () => {
+    if (!this.loginRef) return
+
     this.setState({
       loginLoading: true
     })
+
     this.loginRef.handleConfirm().then(param => {
       Api.getusermsg(param.username, param.password, true).then(res => {
         if (res.status) {
+          this.setState({
+            loginLoading: false
+          })
+
+          if (res.modifydate) {
+            let s = (new Date().getTime() - new Date(res.modifydate).getTime()) / (1000 * 24 * 60 * 60)
+            if (!isNaN(s) && s > 90) {
+              Modal.warning({
+                width: 520,
+                title: <span>绯荤粺妫�娴嬪埌鎮ㄧ殑璐︽埛瀛樺湪椋庨櫓锛岃鍙婃椂鍒�<a target="_blank" rel="noopener noreferrer" href="https://cloud.mk9h.cn/admin/index.html">浜戜腑蹇�</a>淇敼瀵嗙爜锛�</span>,
+                okText: '鐭ラ亾浜�'
+              })
+              return
+            }
+          }
+
           sessionStorage.setItem('CloudUserID', res.UserID)
           sessionStorage.setItem('CloudLoginUID', res.LoginUID)
           sessionStorage.setItem('CloudUserName', res.UserName)
@@ -609,6 +631,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 () {
@@ -643,7 +674,7 @@
       let url = `${ssodomain}/doc/index.html#?appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}`
       window.open(url)
     } else if (options.sysType === 'SSO' || options.sysType === 'cloud') {
-      window.open(`${window.location.href.replace(/\/index.html(.*)|\/#(.*)/ig, '')}/doc/index.html#?appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}`)
+      window.open(`${window.location.href.replace(/\/admin(.*)|\/index.html(.*)|\/#(.*)/ig, '')}/doc/index.html#?appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}`)
     }
   }
 
@@ -838,7 +869,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