From 1a7cbe83682996bfb65099dcf1e56e5a05a9b1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=99=AF=E5=AD=A6?= <5412262+sun_jing_xue@user.noreply.gitee.com> Date: Thu, 7 Aug 2025 14:41:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=81=E7=B1=BBOA=E9=97=AE=E9=A2=98=E4=B8=8E?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E8=AF=A6=E6=83=85=E8=A7=A3=E5=AF=86=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/supplier/ViewReviewPage/index.tsx | 33 ++++++++++++++----- .../components/CreateModal.tsx | 2 +- .../components/CategoryAddModal.tsx | 6 ++-- .../components/CategoryAddModal.tsx | 2 -- .../components/SupplierAddModal.tsx | 6 ++-- src/utils/request.ts | 1 + 6 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/pages/supplier/ViewReviewPage/index.tsx b/src/pages/supplier/ViewReviewPage/index.tsx index f5edb31..6d5e986 100644 --- a/src/pages/supplier/ViewReviewPage/index.tsx +++ b/src/pages/supplier/ViewReviewPage/index.tsx @@ -3,26 +3,43 @@ import React, { useState, useEffect } from 'react'; import { useLocation } from 'umi'; // 或者 'react-router-dom' import ResultModal from './components/ResultModal'; import ViewModal from './components/ViewModal'; +import { refreshDictCache } from '@/servers/api/login'; +import dayjs from 'dayjs'; + const ViewReviewPage: React.FC = () => { const [modalVisible, setModalVisible] = useState(false); // 控制弹窗 const [modalRecord, setModalRecord] = useState(null); + - // 解析url参数 ?id=xxx - const location = useLocation(); useEffect(() => { - // 获取id参数 const params = new URLSearchParams(location.search); - const id = params.get('id'); - if (id) { - setModalRecord({ id }); // 只传id也可以,后面可以根据id扩展更多参数 + const base64 = params.get('code'); + console.log(base64); + if (!base64) return; + // 解码 + const decodedStr = atob(base64); + // 再次转成参数 + const p2 = new URLSearchParams(decodedStr); + if (p2.get('id')) { + if (!sessionStorage.getItem('dict')) { + refreshDictCache().then((res) => { + if (res.code == 200) { + sessionStorage.setItem('dict', JSON.stringify(res.data)) + } + }) + } + const nowStr = dayjs().format('YYYY-MM-DD HH:mm:ss'); + sessionStorage.setItem('userId', `${p2.get('userId')}_${nowStr}` ) + setModalRecord({ id: p2.get('id') }); setModalVisible(true); } - }, [location.search]); + }, []); + return ( -
+
{/* 其他页面内容 */} void; }> = ({ vi