From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 一月 2022 17:21:25 +0800
Subject: [PATCH] 2022-01-21

---
 src/views/rolemanage/index.jsx |   79 ++++++++++++++++++++++++++++++---------
 1 files changed, 61 insertions(+), 18 deletions(-)

diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx
index 61acc7f..06a4db8 100644
--- a/src/views/rolemanage/index.jsx
+++ b/src/views/rolemanage/index.jsx
@@ -34,7 +34,15 @@
         align: 'center',
         render: (text, record) => (
           <div>
-            <Button type="link" onClick={() => this.deleteMenu(record)} style={{color: '#ff4d4f'}}>鍒犻櫎</Button>
+            {record.type !== 'none' ?
+              <Button type="link" onClick={() => this.deleteMenu(record)} style={{color: '#ff4d4f'}}>鍒犻櫎</Button> :
+              <Button type="link" onClick={() => {
+                notification.warning({
+                  top: 92,
+                  message: '褰撳墠绯荤粺鑿滃崟灏氭湭鍒涘缓銆�',
+                  duration: 5
+                })
+              }} style={{color: '#ff4d4f', opacity: '0.5'}}>鍒犻櫎</Button>}
             <Button type="link" onClick={() => this.jumpApp(record)} style={{color: '#1890ff', marginLeft: '5px'}}>缂栬緫</Button>
           </div>
         ),
@@ -55,6 +63,7 @@
   oriTrees = null
 
   UNSAFE_componentWillMount() {
+    document.body.className = ''
     let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
 
     this.setState({app: param}, () => {
@@ -111,26 +120,48 @@
 
     Api.getCloudConfig(param).then(result => {
       if (result.status) {
-        this.setState({
-          menulist: result.menus.map(item => {
-            item.nodes = ''
-            item.type = 'view'
-            if (item.menus_rolelist) {
-              try {
-                let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist)))
-                item.nodes = pageParam
-                if (pageParam.login) {
-                  item.nodes = ''
-                } else if (pageParam.type === 'navbar') {
-                  item.type = 'navbar'
-                }
-              } catch (e) {
+        let ub = app.user_binding === 'true' && app.userbind ? false : true
+        let im = app.instantMessage ? false : true
+
+        let menus = result.menus.map(item => {
+          item.nodes = ''
+          item.type = 'view'
+          if (item.menus_rolelist) {
+            try {
+              let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist)))
+              item.nodes = pageParam
+              if (pageParam.login) {
+                item.nodes = ''
+              } else if (pageParam.type === 'navbar') {
+                item.type = 'navbar'
+              } else if (pageParam.type === 'im') {
+                item.type = 'im'
                 item.nodes = ''
               }
+            } catch (e) {
+              item.nodes = ''
             }
-            
-            return item
-          })
+          }
+
+          if (!ub && app.userbind === item.MenuID) {
+            ub = true
+          }
+          if (!im && app.instantMessage === item.MenuID) {
+            im = true
+          }
+          
+          return item
+        })
+
+        if (!im) {
+          menus.push({nodes: '', type: 'none', MenuID: app.instantMessage, MenuName: '鍗虫椂閫氫俊'})
+        }
+        if (!ub) {
+          menus.push({nodes: '', type: 'none', MenuID: app.userbind, MenuName: '鐢ㄦ埛缁戝畾'})
+        }
+
+        this.setState({
+          menulist: menus
         }, () => {
           if (reset && (!this.oriTrees || this.oriTrees.length === 0)) {
             this.initMenutree()
@@ -808,6 +839,18 @@
     if (app.typename === 'pc') {
       route = 'pcdesign'
     }
+    if (item.type === 'navbar') {
+      notification.warning({
+        top: 92,
+        message: '瀵艰埅鏍忎笉鍙崟鐙紪杈戯紝璇峰湪鍚湁瀵艰埅鏍忕殑椤甸潰涓慨鏀广��',
+        duration: 5
+      })
+      return
+    }
+
+    if (app.instantMessage && item.MenuID === app.instantMessage) {
+      route = 'imdesign'
+    }
 
     window.open(window.location.href.replace(/#.+/ig, `#/${route}/${window.btoa(window.encodeURIComponent(JSON.stringify({...app, MenuID: item.MenuID, type: 'app'})))}`))
   }

--
Gitblit v1.8.0