From 7ccc7757913dddc5a32a700e997bdf3cdff9826e Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Fri, 20 Sep 2024 14:27:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E7=BC=BA=E5=B0=91=20useLocation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Detail/ProductsTree.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/products/Detail/ProductsTree.jsx b/src/views/products/Detail/ProductsTree.jsx index 65cff51..fff21cd 100644 --- a/src/views/products/Detail/ProductsTree.jsx +++ b/src/views/products/Detail/ProductsTree.jsx @@ -1,4 +1,5 @@ import { createContext, useEffect, useState } from 'react'; +import { useLocation } from 'react-router-dom'; import { Tree, Input, Divider } from 'antd'; import { CaretDownOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; @@ -42,7 +43,7 @@ const getParentKey = (key, tree) => { const ProductsTree = ({ onNodeSelect, ...props }) => { const { t } = useTranslation(); - + const location = useLocation(); const isEditPage = location.pathname.includes('edit'); const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]); const [activeAgency] = useProductsStore((state) => [state.activeAgency]); From 0de97b9ea869b16c119f26c984f76c4366b426bb Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Fri, 20 Sep 2024 14:37:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=AE=A2=E6=9C=8D=E5=92=8C=E5=9C=B0?= =?UTF-8?q?=E6=8E=A5=E5=85=B1=E7=94=A8=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/App.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/views/App.jsx b/src/views/App.jsx index 6800622..4665957 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -71,6 +71,10 @@ function App() { } } + // 地接和客服权限不同,产品管理页面也不同 + const isProductPermitted = isPermitted(PERM_PRODUCTS_MANAGEMENT) || isPermitted(PERM_PRODUCTS_INFO_PUT) + const productLink = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? '/products' : '/products/edit' + return ( {t('menu.Feedback')} } : null, isPermitted(PERM_OVERSEA) ? { key: 'report', label: {t('menu.Report')} } : null, isPermitted(PERM_AIR_TICKET) ? { key: 'airticket', label: {t('menu.Airticket')} } : null, - isPermitted(PERM_PRODUCTS_MANAGEMENT) ? { key: 'products', label: {t('menu.Products')} } : null, - isPermitted(PERM_PRODUCTS_INFO_PUT) ? { key: 'products', label: {t('menu.Products')} } : null, + isProductPermitted ? { key: 'products', label: {t('menu.Products')} } : null, { key: 'notice', label: (