From 35f47af801eb0a810bacb58e56021d387d5e7af6 Mon Sep 17 00:00:00 2001 From: lyp Date: Thu, 8 May 2025 18:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 4 +-- src/App.tsx | 3 ++ src/components/payment/Payment.tsx | 54 ++++++++++++++++-------------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/.env.dev b/.env.dev index 4197d04..d2a3c32 100644 --- a/.env.dev +++ b/.env.dev @@ -7,5 +7,5 @@ VITE_AI_SHOP_BASE_URL=http://192.168.0.115:8081 VITE_WEBSOCKET_BASE_URL=ws://${VITE_HOST}:7025/copyright # 18634604067 VITE_USERID=80d3365e-0597-4988-979e-18ef1c3ec671 -VITE_CURRENT_THEME=fzkj -# VITE_CURRENT_THEME=mzw +# VITE_CURRENT_THEME=fzkj +VITE_CURRENT_THEME=mzw diff --git a/src/App.tsx b/src/App.tsx index 39eedc7..9fc0471 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -153,6 +153,8 @@ const App: React.FC = () => { url: '/api/user-info/get-user-self', onSuccess({ data }: any) { // console.log('嘻嘻嘻', data); + sessionStorage.setItem('isWxPay', data.isWxPay); + sessionStorage.setItem('isZfbPay', data.isZfbPay); // setIsUpdateWxUsernamePhone(data.isUpdateWxUsernamePhone); // if (data.isUpdateWxUsernamePhone == 1) { // if (data.isUpdateWxUsernamePhone == 1) { @@ -160,6 +162,7 @@ const App: React.FC = () => { // } // setUserId(data.userId); // const currentToken = sessionStorage.getItem('token'); + sessionStorage.setItem('token', data.accessToken); const token = sessionStorage.getItem('token'); if (token) { diff --git a/src/components/payment/Payment.tsx b/src/components/payment/Payment.tsx index ce0a190..a3e8f66 100644 --- a/src/components/payment/Payment.tsx +++ b/src/components/payment/Payment.tsx @@ -134,36 +134,38 @@ export default function Payment(props: IPaymentProps) { } }) } - const [showWX,setShowWX] = useState(true) //是否显示微信支付 - const [showZFB,setShowZFB] = useState(true) //是否显示支付宝支付 - const getUserINfo = (() => { - get({ - messageApi, - url: '/api/user-info/get-user-self', - onSuccess({ data }) { - // console.log('信息',data); - // if(data.isWxPay){ - // setShowWX(true) - // }else{ - // setShowWX(false) - // } - // if(data.isZfbPay){ - // setShowZFB(true) - // }else{ - // setShowZFB(false) - // } - setShowWX(data.isWxPay == 1 ? true : false); - setShowZFB(data.isZfbPay == 1 ? true : false); + // const [showWX,setShowWX] = useState(true) //是否显示微信支付 + // const [showZFB,setShowZFB] = useState(true) //是否显示支付宝支付 + const showWX = sessionStorage.getItem('isWxPay'); + const showZFB = sessionStorage.getItem('isZfbPay'); + // const getUserINfo = (() => { + // get({ + // messageApi, + // url: '/api/user-info/get-user-self', + // onSuccess({ data }) { + // // console.log('信息',data); + // // if(data.isWxPay){ + // // setShowWX(true) + // // }else{ + // // setShowWX(false) + // // } + // // if(data.isZfbPay){ + // // setShowZFB(true) + // // }else{ + // // setShowZFB(false) + // // } + // setShowWX(data.isWxPay == 1 ? true : false); + // setShowZFB(data.isZfbPay == 1 ? true : false); - } - }) - }) + // } + // }) + // }) useEffect(() => { getPackageList(value, packPage); console.log(import.meta.env.VITE_PAY); // console.log(globalContext); - getUserINfo() + // getUserINfo() }, []) const packColumns: TableColumnsType = [ { @@ -980,7 +982,7 @@ export default function Payment(props: IPaymentProps) { }}> @@ -988,7 +990,7 @@ export default function Payment(props: IPaymentProps) {