|
@@ -10,8 +10,27 @@ import { Button, Input, Popconfirm, Table } from "antd";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { RootState } from "@/store";
|
|
import { RootState } from "@/store";
|
|
import { A1tableType } from "@/types";
|
|
import { A1tableType } from "@/types";
|
|
-import { A1_APIdel, A1_APIgetList } from "@/store/action/A1List";
|
|
|
|
|
|
+import {
|
|
|
|
+ A1_APIdel,
|
|
|
|
+ A1_APIgetList,
|
|
|
|
+ isTokenFlagAPI,
|
|
|
|
+} from "@/store/action/A1List";
|
|
import { MessageFu } from "@/utils/message";
|
|
import { MessageFu } from "@/utils/message";
|
|
|
|
+import history from "@/utils/history";
|
|
|
|
+import { removeTokenInfo } from "@/utils/storage";
|
|
|
|
+
|
|
|
|
+const isTokenFlagFu = (val: boolean, url: string) => {
|
|
|
|
+ if (val) {
|
|
|
|
+ // token 有效
|
|
|
|
+ window.open(url);
|
|
|
|
+ } else {
|
|
|
|
+ // token 失效
|
|
|
|
+ MessageFu.warning("登录失效,请重新登录!");
|
|
|
|
+ removeTokenInfo();
|
|
|
|
+ history.push("/login");
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
function A1List() {
|
|
function A1List() {
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
@@ -56,12 +75,18 @@ function A1List() {
|
|
[tableSelect]
|
|
[tableSelect]
|
|
);
|
|
);
|
|
|
|
|
|
- const lookFu = useCallback((id: number) => {
|
|
|
|
- MessageFu.warning("等待开发");
|
|
|
|
|
|
+ const lookFu = useCallback(async (code: string) => {
|
|
|
|
+ const res = await isTokenFlagAPI();
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ isTokenFlagFu(res.data, `/scene/index.html?m=${code}`);
|
|
|
|
+ }
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
- const editFu = useCallback((id: number) => {
|
|
|
|
- MessageFu.warning("等待开发");
|
|
|
|
|
|
+ const editFu = useCallback(async (code: string) => {
|
|
|
|
+ const res = await isTokenFlagAPI();
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ isTokenFlagFu(res.data, `/scene/edit.html?m=${code}`);
|
|
|
|
+ }
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
const delTableFu = useCallback(
|
|
const delTableFu = useCallback(
|
|
@@ -94,11 +119,19 @@ function A1List() {
|
|
title: "操作",
|
|
title: "操作",
|
|
render: (item: A1tableType) => (
|
|
render: (item: A1tableType) => (
|
|
<>
|
|
<>
|
|
- <Button size="small" type="text" onClick={() => lookFu(item.id)}>
|
|
|
|
|
|
+ <Button
|
|
|
|
+ size="small"
|
|
|
|
+ type="text"
|
|
|
|
+ onClick={() => lookFu(item.sceneCode)}
|
|
|
|
+ >
|
|
查看
|
|
查看
|
|
</Button>
|
|
</Button>
|
|
|
|
|
|
- <Button size="small" type="text" onClick={() => editFu(item.id)}>
|
|
|
|
|
|
+ <Button
|
|
|
|
+ size="small"
|
|
|
|
+ type="text"
|
|
|
|
+ onClick={() => editFu(item.sceneCode)}
|
|
|
|
+ >
|
|
编辑
|
|
编辑
|
|
</Button>
|
|
</Button>
|
|
<Popconfirm
|
|
<Popconfirm
|