|
@@ -10,7 +10,12 @@ import { useDispatch, useSelector } from "react-redux";
|
|
|
import { MessageFu } from "@/utils/message";
|
|
|
import { Button, Input } from "antd";
|
|
|
import MyPopconfirm from "@/components/MyPopconfirm";
|
|
|
-import { A3_APIdel, A3_APIgetList } from "@/store/action/A3culture";
|
|
|
+import {
|
|
|
+ A3_APIdel,
|
|
|
+ A3_APIgetCon,
|
|
|
+ A3_APIgetList,
|
|
|
+ A3_APIsetCon,
|
|
|
+} from "@/store/action/A3culture";
|
|
|
import { A3tableType } from "@/types";
|
|
|
import { RootState } from "@/store";
|
|
|
import MyTable from "@/components/MyTable";
|
|
@@ -91,6 +96,28 @@ function A3culture() {
|
|
|
];
|
|
|
}, [delTableFu]);
|
|
|
|
|
|
+ // 离线状态
|
|
|
+ const [state, setState] = useState(-1);
|
|
|
+
|
|
|
+ const getStateFu = useCallback(async () => {
|
|
|
+ const res = await A3_APIgetCon();
|
|
|
+ if (res.code === 0) {
|
|
|
+ setState(res.data);
|
|
|
+ }
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ const setStateFu = useCallback(async () => {
|
|
|
+ const res = await A3_APIsetCon(state === 1 ? 0 : 1);
|
|
|
+ if (res.code === 0) {
|
|
|
+ MessageFu.success("设置商城状态成功!");
|
|
|
+ getStateFu();
|
|
|
+ }
|
|
|
+ }, [getStateFu, state]);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getStateFu();
|
|
|
+ }, [getStateFu]);
|
|
|
+
|
|
|
return (
|
|
|
<div className={styles.A3culture}>
|
|
|
<div className="pageTitle"></div>
|
|
@@ -114,6 +141,10 @@ function A3culture() {
|
|
|
</div>
|
|
|
<div>
|
|
|
<Button onClick={resetSelectFu}>重置</Button> 
|
|
|
+ <Button type="primary" onClick={setStateFu}>
|
|
|
+ 商城状态({state === 1 ? "开" : state === 0 ? "关" : " - "})
|
|
|
+ </Button>
|
|
|
+  
|
|
|
<Button type="primary" onClick={() => setEditId(-1)}>
|
|
|
新增
|
|
|
</Button>
|