浏览代码

藏品详情页 都新窗口打开

shaogen1995 4 月之前
父节点
当前提交
fbd55f0296

+ 3 - 7
src/pages/B_enterTibet/B3goodsTable/index.tsx

@@ -6,16 +6,12 @@ import { B3eTableC } from '@/utils/tableData'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import classNames from 'classnames'
 import Y1cathet from '@/pages/Y_goodsDetails/Y1cathet'
+import { openGoodsInfoFu } from '@/utils/history'
 
 function B3goodsTable() {
   // 点击删除
   const delTableFu = useCallback(async (id: number) => {}, [])
 
-  // 点击查看 新窗口打开 待完善
-  const lookPage = useCallback((id: number) => {
-    window.open('/#/goodsLook/99', '_blank')
-  }, [])
-
   // 打开侧边栏
   const [cathet, setCathet] = useState(0)
 
@@ -44,7 +40,7 @@ function B3goodsTable() {
         render: (item: any) => {
           return (
             <>
-              <Button size='small' type='text' onClick={() => lookPage(item.id)}>
+              <Button size='small' type='text' onClick={() => openGoodsInfoFu(item.id)}>
                 查看
               </Button>
               <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
@@ -53,7 +49,7 @@ function B3goodsTable() {
         }
       }
     ]
-  }, [delTableFu, lookPage])
+  }, [delTableFu])
 
   return (
     <div className={styles.B3goodsTable}>

+ 2 - 6
src/pages/D_storeManage/D1storage/D1goods/index.tsx

@@ -6,7 +6,7 @@ import { TypeD1Gform } from './type'
 import MyTable from '@/components/MyTable'
 import { D1GtableC } from '@/utils/tableData'
 import Y1cathet from '@/pages/Y_goodsDetails/Y1cathet'
-import history from '@/utils/history'
+import { openGoodsInfoFu } from '@/utils/history'
 import classNames from 'classnames'
 
 const baseFormData: TypeD1Gform = {
@@ -112,11 +112,7 @@ function D1goods({ lookData }: Props) {
         title: '操作',
         render: (item: any) => {
           return (
-            <Button
-              size='small'
-              type='text'
-              onClick={() => history.push(`/storage_look/${item.id}`)}
-            >
+            <Button size='small' type='text' onClick={() => openGoodsInfoFu(item.id)}>
               查看
             </Button>
           )

+ 7 - 7
src/pages/Layout/data.ts

@@ -246,7 +246,7 @@ const tabLeftArr: RouterType = [
       // 不需要 高亮的 详情页
       {
         id: 9901,
-        name: '查看藏品详情',
+        name: '藏品详情',
         path: '/goodsLook/:id',
         pathLast: '/goodsLook',
         Com: React.lazy(() => import('../Y_goodsDetails/Y2look'))
@@ -271,12 +271,12 @@ export const routerSon: RouterTypeRow = [
     path: '/storSet_site/:id',
     Com: React.lazy(() => import('../D_storeManage/D2storSet/D2site'))
   },
-  {
-    id: 3,
-    name: '库房管理-查看藏品详情',
-    path: '/storage_look/:id',
-    Com: React.lazy(() => import('../Y_goodsDetails/Y2look'))
-  },
+  // {
+  //   id: 3,
+  //   name: '库房管理-查看藏品详情',
+  //   path: '/storage_look/:id',
+  //   Com: React.lazy(() => import('../Y_goodsDetails/Y2look'))
+  // },
 
   {
     id: 4,

+ 2 - 2
src/pages/Y_goodsDetails/Y1cathet/index.tsx

@@ -2,7 +2,7 @@ import React from 'react'
 import styles from './index.module.scss'
 import { Button } from 'antd'
 import Y1main from './Y1main'
-import history from '@/utils/history'
+import { openGoodsInfoFu } from '@/utils/history'
 
 type Props = {
   sId: number
@@ -16,7 +16,7 @@ function Y1cathet({ sId, closeFu }: Props) {
         <h2>藏品详情</h2>
         <div>
           <span>更多操作请在详情页中进行</span>&emsp;
-          <Button type='primary' onClick={() => history.push(`/storage_look/${sId}`)}>
+          <Button type='primary' onClick={() => openGoodsInfoFu(sId)}>
             查看详情
           </Button>
           &emsp;<Button onClick={closeFu}>收起</Button>

+ 6 - 1
src/utils/history.ts

@@ -1,3 +1,8 @@
-import { createHashHistory  } from 'history'
+import { createHashHistory } from 'history'
 const history = createHashHistory()
 export default history
+
+// 所有藏品详情 全部新页面打开
+export const openGoodsInfoFu = (id: number) => {
+  window.open(`/#/goodsLook/${id}`, '_blank')
+}