From 9483baffba9a24a2a36fc8739fc65b59317d9142 Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期四, 03 七月 2025 14:18:46 +0800 Subject: [PATCH] 队列拆分 --- zy-acs-flow/src/map/header/FakeFab.jsx | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/zy-acs-flow/src/map/header/FakeFab.jsx b/zy-acs-flow/src/map/header/FakeFab.jsx index c26bf57..eb3f593 100644 --- a/zy-acs-flow/src/map/header/FakeFab.jsx +++ b/zy-acs-flow/src/map/header/FakeFab.jsx @@ -1,11 +1,14 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; +import { useTranslate } from "react-admin"; import { Fab, } from '@mui/material'; import LensBlurIcon from '@mui/icons-material/LensBlur'; import { getFakeSign, setFakeSign } from "../http"; +import { VERIFY_PASSWORD } from '@/config/setting'; const FakeFab = (props) => { + const translate = useTranslate(); const [fakeRun, setFakeRun] = useState(false); useEffect(() => { @@ -16,9 +19,23 @@ const handleToggle = () => { getFakeSign(null, (res) => { - setFakeSign(!res, (updatedSign) => { - setFakeRun(updatedSign); - }); + let pass = true; + if (!res) { + const pwd = prompt("please enter password:"); + if (pwd === VERIFY_PASSWORD) { + pass = true; + } else { + pass = false; + if (pwd) { + alert('Incorrect password'); + } + } + } + if (pass) { + setFakeSign(!res, (updatedSign) => { + setFakeRun(updatedSign); + }); + } }); } @@ -31,7 +48,7 @@ onClick={handleToggle} > <LensBlurIcon /> - {/* {translate('page.map.action.adapt')} */} + {translate('page.map.action.fake')} </Fab> </> ) -- Gitblit v1.9.1