From da407d4525cd6ea211d952fc2fd96f5ba30510e8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 27 十一月 2024 15:43:28 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/header/FakeFab.jsx | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/zy-acs-flow/src/map/header/FakeFab.jsx b/zy-acs-flow/src/map/header/FakeFab.jsx
index 010b52c..f39f6d4 100644
--- a/zy-acs-flow/src/map/header/FakeFab.jsx
+++ b/zy-acs-flow/src/map/header/FakeFab.jsx
@@ -1,26 +1,38 @@
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
- Select,
- MenuItem,
- Button,
- Box,
- useTheme,
Fab,
} from '@mui/material';
import LensBlurIcon from '@mui/icons-material/LensBlur';
-import { getFakeSign } from "../http";
+import { getFakeSign, setFakeSign } from "../http";
const FakeFab = (props) => {
const [fakeRun, setFakeRun] = useState(false);
- const querySign = () => {
- getFakeSign(null, (data) => {
+ useEffect(() => {
+ getFakeSign(null, (res) => {
+ setFakeRun(res);
+ });
+ }, [props]);
+
+ const handleToggle = () => {
+ getFakeSign(null, (res) => {
+ let pass = true;
+ // if (!res) {
+ // const pwd = prompt("please enter password:");
+ // if (pwd === 'xltys1995') {
+ // pass = true;
+ // } else {
+ // pass = false;
+ // alert('Incorrect password');
+ // }
+ // }
+ if (pass) {
+ setFakeSign(!res, (updatedSign) => {
+ setFakeRun(updatedSign);
+ });
+ }
});
}
-
- useEffect(() => {
- querySign();
- }, []);
return (
<>
@@ -28,9 +40,7 @@
variant="extended"
color={fakeRun ? 'primary' : 'default'}
size="small"
- onClick={() => {
- setFakeRun(!fakeRun);
- }}
+ onClick={handleToggle}
>
<LensBlurIcon />
{/* {translate('page.map.action.adapt')} */}
--
Gitblit v1.9.1