瀏覽代碼

feat: 1111

lanjianrong 5 年之前
父節點
當前提交
a45aae566f
共有 3 個文件被更改,包括 15 次插入11 次删除
  1. 8 8
      src/app.tsx
  2. 3 3
      src/layouts/BasicLayout.jsx
  3. 4 0
      src/pages/document.ejs

+ 8 - 8
src/app.tsx

@@ -9,16 +9,16 @@ const PermDataList = [
     value: 2
   }
 ]
-export async function render(oldRender) {
+export function render(oldRender) {
   const path = window.location.pathname
   if (path !== '/user/login') {
-    const { data = [] } = await apiGetRoles()
-    const permVal = PermDataList.find(item => path.startsWith(item.key))?.value
-    if (permVal) {
-      const prem = await getDataPerm()
-      setAuthCache(PERM_LIST_KEY, prem?.data || [])
-    }
-    setAuthority(data)
+    apiGetRoles().then(roles => {
+      setAuthority(roles.data)
+      const permVal = PermDataList.find(item => path.startsWith(item.key))?.value
+      if (permVal) {
+        getDataPerm().then(prem => setAuthCache(PERM_LIST_KEY, prem?.data || []))
+      }
+    })
   }
   oldRender()
 }

+ 3 - 3
src/layouts/BasicLayout.jsx

@@ -27,9 +27,9 @@ const menuDataRender = menuList =>
       ...item,
       children: item.children ? menuDataRender(item.children) : undefined
     }
-    // if (item.icon) {
-    //   localItem.icon = <IconPark type={item.icon} size="16" className="anticon anticon-form" />
-    // }
+    if (item.icon) {
+      localItem.icon = <iconpark-icon name={item.icon} size="16" class="anticon anticon-form" />
+    }
     return Authorized.check(item.authority, localItem, null)
   })
 

+ 4 - 0
src/pages/document.ejs

@@ -22,6 +22,10 @@
     <link rel="icon" href="<%= context.config.publicPath +'favicon.ico'%>" type="image/x-icon" />
   </head>
   <body>
+    <script
+      defer
+      src="https://sf1-hscdn-tos.pstatp.com/obj/iconpark/icons_1832_39.57820ea46a42d8bbbaa87c0d7a61ad8d.js"
+    ></script>
     <noscript>Out-of-the-box mid-stage front/design solution!</noscript>
     <div id="root">
       <style>