From d5e92a5383860b5fcd449507028b84bddf3a41f2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 14 四月 2020 17:32:52 +0800
Subject: [PATCH] 2020-04-14

---
 src/index.js                      |    5 ++
 public/options.text               |   18 +++++++++
 src/components/header/index.jsx   |   58 ++++++++++++++++++++++++++++
 src/components/sidemenu/index.jsx |   14 +++++-
 public/options.js                 |    1 
 src/components/sidemenu/config.js |    1 
 6 files changed, 93 insertions(+), 4 deletions(-)

diff --git a/public/options.js b/public/options.js
index 2a66cdd..eb6dd43 100644
--- a/public/options.js
+++ b/public/options.js
@@ -3,6 +3,7 @@
   appId: '201912040924165801464FF1788654BC5AC73',
   appkey: '20191106103859640976D6E924E464D029CF0',
   mainSystemApi: 'http://cloud.mk9h.cn/webapi/dostars',
+  systemType: 'test',
   platTitle: '',
   platName: '',
   favicon: '',
diff --git a/public/options.text b/public/options.text
new file mode 100644
index 0000000..9bbc4c2
--- /dev/null
+++ b/public/options.text
@@ -0,0 +1,18 @@
+service       -- 鏈嶅姟鍚�
+appId         -- 浜戠鐢熸垚鐨勫簲鐢↖D
+appkey        -- 浜戠鐢熸垚鐨勫簲鐢ㄥ瘑閽�
+mainSystemApi -- sso绯荤粺鐨勬帴鍙h矾寰勶紝娉細涓氬姟绯荤粺闇�瑕佸~鍐欙紝涓斿�间负閫氱敤鎺ュ彛鐨勫畬鏁磋矾寰�
+systemType    -- 涓氬姟绯荤粺浣跨敤姝ゅ弬鏁帮紝鍒ゆ柇绯荤粺涓烘祴璇曟垨姝e紡锛坱est銆乷fficial锛夛紝姝e紡绯荤粺寮�鍙戞潈闄愬彧鏈夌郴缁熷崌绾�
+platTitle     -- 绯荤粺鏍囬鏍忔爣棰�
+platName      -- 绯荤粺鍚嶇О
+favicon       -- 绯荤粺鏍囬鏍忓浘鏍�
+loginlogo     -- 鐧诲綍椤祃ogo
+mainlogo      -- 涓婚〉logo
+bgImage       -- 鐧诲綍椤佃儗鏅浘
+copyRight     -- 鍏徃鐗堟潈鍙婂悕绉扮瓑淇℃伅
+ICP           -- icp澶囨淇℃伅
+lineColor     -- 鍒嗗壊绾块鑹�
+webSite       -- 鍏徃缃戝潃
+doclogo       -- 鏂囨。绠$悊logo
+style         -- 椤甸潰椋庢牸
+filter        -- 椤甸潰婊ら暅锛屽�间负'true'鏃讹紝椤甸潰鏄剧ず涓洪粦鐧借壊
\ No newline at end of file
diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 761bfd3..0ddce70 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -146,6 +146,7 @@
       return
     }
     if (value.PageParam.OpenType === 'menu') {
+      console.log(value)
       this.props.modifyMainMenu(value)
     } else {
       window.open('#/' + value.PageParam.linkUrl + '/')
@@ -300,6 +301,13 @@
   }
 
   changeEditState = (state) => {
+    const { menulist } = this.state
+
+    if (!state) { // 閫�鍑虹紪杈戯紝椤甸潰鍒锋柊
+      window.location.reload()
+      return
+    }
+
     // 淇敼缂栬緫鐘舵��
     let UserID = sessionStorage.getItem('CloudUserID')
     let LoginUID = sessionStorage.getItem('CloudLoginUID')
@@ -323,6 +331,32 @@
         _userName = sessionStorage.getItem('CloudUserName')
       }
 
+      if (window.GLOB.systemType === 'official' && state) {
+        this.props.resetEditLevel('level4')
+        this.props.modifyMainMenu({
+          MenuID: 'systemManageView'
+        })
+
+        this.setState({
+          userName: _userName,
+          avatar: _avatar
+        })
+        this.props.resetEditState(state)
+
+        return
+      } else if (window.GLOB.systemType === 'official' && !state) {
+        this.props.resetEditLevel(false)
+        this.props.modifyMainMenu(menulist[0] || '')
+
+        this.setState({
+          userName: _userName,
+          avatar: _avatar
+        })
+        this.props.resetEditState(state)
+
+        return
+      }
+
       this.setState({
         menulist: null,
         userName: _userName,
@@ -333,7 +367,7 @@
       this.props.resetEditState(state)
     }
 
-    if (state && this.props.sysRoles.length === 0 && this.props.permFuncField.length === 0) {
+    if (state && this.props.sysRoles.length === 0 && this.props.permFuncField.length === 0 && window.GLOB.systemType !== 'official') {
       Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => {
         if (res.status) {
           let _permFuncField = []
@@ -384,6 +418,23 @@
             _avatar = Utils.getrealurl(res.icon) // 澶村儚
           }
 
+          if (window.GLOB.systemType === 'official') {
+            this.props.resetEditLevel('level4')
+            this.props.modifyMainMenu({
+              MenuID: 'systemManageView'
+            })
+    
+            this.setState({
+              loginVisible: false,
+              loginLoading: false,
+              userName: res.UserName,
+              avatar: _avatar
+            })
+            this.props.resetEditState(true)
+    
+            return
+          }
+
           this.setState({
             menulist: null,
             loginVisible: false,
@@ -428,6 +479,11 @@
    * @description 閫�鍑虹鐞嗙晫闈㈣彍鍗�
    */
   exitManage = () => {
+    if (window.GLOB.systemType === 'official') { // 姝e紡绯荤粺鐗堟湰鍗囩骇鍚庯紝椤甸潰鍒锋柊
+      window.location.reload()
+      return
+    }
+
     this.props.resetEditState(true)
     this.props.resetEditLevel(false)
     this.reload()
diff --git a/src/components/sidemenu/config.js b/src/components/sidemenu/config.js
index 9c90389..a5e15ec 100644
--- a/src/components/sidemenu/config.js
+++ b/src/components/sidemenu/config.js
@@ -30,6 +30,7 @@
       text: '浼犺緭鍙锋煡璇�'
     }, {
       src: '',
+      systems: ['official'],
       PageParam: {OpenType: 'newtab', Template: 'VerupTable'},
       type: 'VerupTable',
       MenuID: '1583979633842550imkchl4qt4qppsiv',
diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx
index 7f7df7d..f74cfad 100644
--- a/src/components/sidemenu/index.jsx
+++ b/src/components/sidemenu/index.jsx
@@ -173,9 +173,17 @@
   enterManageView = (type) => {
     let menulist = SySMenuList[type]
 
-    menulist.forEach(menu => {
-      menu.children = menu.children.filter(item => !item.systems || item.systems.includes(options.systemType))
-    })
+    if (window.GLOB.systemType === 'official') {
+      menulist.forEach(menu => {
+        menu.children = menu.children.filter(item => item.systems && item.systems.includes(window.GLOB.systemType))
+      })
+
+      menulist = menulist.filter(menu => menu.children.length > 0)
+    } else {
+      menulist.forEach(menu => {
+        menu.children = menu.children.filter(item => !item.systems || item.systems.includes(options.systemType))
+      })
+    }
 
     this.setState({
       subMenulist: menulist,
diff --git a/src/index.js b/src/index.js
index 3da6d82..972a1c4 100644
--- a/src/index.js
+++ b/src/index.js
@@ -4,6 +4,7 @@
 import {Provider} from 'react-redux'
 import store from '@/store'
 import * as serviceWorker from './serviceWorker'
+import options from '@/store/options.js'
 import '@/assets/css/main.scss'
 import '@/assets/css/action.scss'
 import '@/assets/css/minkeicon.css'
@@ -24,6 +25,10 @@
 
 window.GLOB = window.GLOB || {}
 
+if (!(options.systemType === 'local' && window.GLOB.systemType === 'official')) {
+  window.GLOB.systemType = 'test'
+}
+
 let _systemMsg = localStorage.getItem(window.location.href.split('#')[0] + 'system')
 
 if (_systemMsg) {

--
Gitblit v1.8.0