Bladeren bron

增加详情页权限

shaogen1995 1 maand geleden
bovenliggende
commit
5db7af83e7

+ 12 - 16
后台管理/src/components/NotFound/index.tsx

@@ -1,26 +1,22 @@
-import { Result } from "antd";
-import { useEffect, useRef } from "react";
+import { Result } from 'antd'
+import { useEffect, useRef } from 'react'
 
 export default function NotFound() {
-  const timeRef = useRef(-1);
+  const timeRef = useRef(-1)
 
   useEffect(() => {
     timeRef.current = window.setTimeout(() => {
-      const dom: HTMLDivElement = document.querySelector(".noFindPage")!;
-      dom.style.opacity = "1";
-    }, 500);
+      const dom: HTMLDivElement = document.querySelector('.noFindPage')!
+      dom.style.opacity = '1'
+    }, 500)
     return () => {
-      clearTimeout(timeRef.current);
-    };
-  }, []);
+      clearTimeout(timeRef.current)
+    }
+  }, [])
 
   return (
-    <div className="noFindPage">
-      <Result
-        status="404"
-        title="404"
-        subTitle="找不到页面,或没有权限!"
-      />
+    <div className='noFindPage'>
+      <Result status='404' title='404' subTitle='找不到页面,或没有权限!' />
     </div>
-  );
+  )
 }

+ 0 - 2
后台管理/src/pages/A0addGoods/index.tsx

@@ -110,8 +110,6 @@ function A0addGoods({ sId, closeFu, isEdit, orderId, isEditresubmit }: Props) {
                     filesRef.current?.showList(resFlie.data || [])
                   }
                 }
-
-                console.log(1234564, obj)
               } catch (error) {
                 MessageFu.warning('JSON数据错误')
               }

+ 13 - 8
后台管理/src/pages/A0goodsInfo/Tab2log/index.tsx

@@ -13,11 +13,14 @@ type Props = {
 }
 
 function Tab2log({ sId }: Props) {
+  const [loding, setLoding] = useState(false)
+
   const [list, setList] = useState<B1listType[]>([])
 
   const getListFu = useCallback(async () => {
     const res = await API_getGoodsLog(sId)
     if (res.code === 0) {
+      setLoding(true)
       setList(res.data)
     }
   }, [sId])
@@ -73,14 +76,16 @@ function Tab2log({ sId }: Props) {
 
   return (
     <div className={styles.Tab2log}>
-      <MyTable
-        yHeight={690}
-        list={list}
-        columnsTemp={goodsLogTableC}
-        staBtn={staBtn}
-        lastBtn={tableLastBtn}
-        pagingInfo={false}
-      />
+      {loding ? (
+        <MyTable
+          yHeight={690}
+          list={list}
+          columnsTemp={goodsLogTableC}
+          staBtn={staBtn}
+          lastBtn={tableLastBtn}
+          pagingInfo={false}
+        />
+      ) : null}
     </div>
   )
 }

+ 2 - 2
后台管理/src/pages/Layout/data.ts

@@ -138,13 +138,13 @@ export default tabLeftArr
 // 里面的页面,不是左边的tab栏
 export const routerSon: RouterTypeRow = [
   {
-    id: 1,
+    id: 400,
     name: '藏品登记-查看',
     path: '/register_look/:key/:id',
     Com: React.lazy(() => import('../B2register/B2look'))
   },
   {
-    id: 1,
+    id: 500,
     name: '藏品修改-查看',
     path: '/edit_look/:key/:id',
     Com: React.lazy(() => import('../B3edit/B3look'))

+ 6 - 1
后台管理/src/pages/Layout/index.tsx

@@ -50,6 +50,8 @@ function Layout() {
     setPath(pathTemp)
   }, [location])
 
+  const [routerSonRes, setRouterSonRes] = useState<RouterTypeRow>([])
+
   // 获取用户权限信息
   const getUserAuthFu = useCallback(async () => {
     const userInfo = getTokenInfo().user
@@ -65,6 +67,9 @@ function Layout() {
         if (v.authority) isOkIdArr.push(v.id)
       })
 
+      // 详情页,也需要看下有没有页面权限
+      setRouterSonRes(routerSon.filter(v => isOkIdArr.includes(v.id)))
+
       // 是管理员
       if (userInfo.isAdmin === 1) {
         ;[2100, 2200, 2300, 2400, 2500].forEach(v => {
@@ -249,7 +254,7 @@ function Layout() {
                   ))}
 
                   {/* 非tab栏页面 */}
-                  {routerSon.map(v => (
+                  {routerSonRes.map(v => (
                     <AuthRoute key={v.id} exact path={v.path} component={v.Com} />
                   ))}