fix(api):update store
This commit is contained in:
parent
f7e8a7bd1e
commit
c08daa777e
45
src/App.tsx
45
src/App.tsx
|
@ -36,30 +36,29 @@ const App = (props: Store) => {
|
||||||
<>
|
<>
|
||||||
<MyComponent>
|
<MyComponent>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
|
<Modal
|
||||||
|
title="登录"
|
||||||
|
className="owner_model"
|
||||||
|
width={"50%"}
|
||||||
|
open={usrStore.isNeedLogin}
|
||||||
|
afterClose={() => {}}
|
||||||
|
onOk={() => {
|
||||||
|
formRef.current?.submit();
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
usrStore.closeLoginDilog();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
formName="login_basic"
|
||||||
|
colProps={4}
|
||||||
|
formDatas={loginForm}
|
||||||
|
onFinish={onFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
</MyComponent>
|
</MyComponent>
|
||||||
|
|
||||||
<Modal
|
|
||||||
title="登录"
|
|
||||||
className="owner_model"
|
|
||||||
width={"50%"}
|
|
||||||
open={usrStore.isNeedLogin}
|
|
||||||
afterClose={() => {}}
|
|
||||||
onOk={() => {
|
|
||||||
formRef.current?.submit();
|
|
||||||
}}
|
|
||||||
onCancel={() => {
|
|
||||||
usrStore.closeLoginDilog();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SimpleForm
|
|
||||||
formRef={formRef}
|
|
||||||
formName="login_basic"
|
|
||||||
colProps={4}
|
|
||||||
formDatas={loginForm}
|
|
||||||
onFinish={onFinish}
|
|
||||||
onFinishFailed={onFinishFailed}
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ import Modal from "antd/lib/modal";
|
||||||
import { PlusOutlined } from "@ant-design/icons";
|
import { PlusOutlined } from "@ant-design/icons";
|
||||||
import Upload, { RcFile, UploadFile, UploadProps } from "antd/lib/upload";
|
import Upload, { RcFile, UploadFile, UploadProps } from "antd/lib/upload";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import Config from "@/util/config";
|
||||||
|
|
||||||
interface UploadFileProps {
|
interface UploadFileProps {
|
||||||
imgList: Array<UploadFileEx>;
|
imgList: Array<UploadFileEx>;
|
||||||
|
@ -14,6 +15,7 @@ interface UploadFileEx extends UploadFile {
|
||||||
redictUrl?: string;
|
redictUrl?: string;
|
||||||
id?: number;
|
id?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getBase64 = (file: RcFile): Promise<string> =>
|
const getBase64 = (file: RcFile): Promise<string> =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
|
@ -45,7 +47,7 @@ const AliUpload = (props: UploadFileProps) => {
|
||||||
|
|
||||||
const handleChange: UploadProps["onChange"] = ({ fileList: newFileList }) => {
|
const handleChange: UploadProps["onChange"] = ({ fileList: newFileList }) => {
|
||||||
newFileList.forEach((i)=>{
|
newFileList.forEach((i)=>{
|
||||||
i.url = "http://127.0.0.1:12214/uploads/"+i.name
|
i.url = `${Config.uploadUrl}uploads/`+i.name
|
||||||
})
|
})
|
||||||
setFileList(newFileList);
|
setFileList(newFileList);
|
||||||
props.onChnage(newFileList)
|
props.onChnage(newFileList)
|
||||||
|
@ -62,7 +64,7 @@ const AliUpload = (props: UploadFileProps) => {
|
||||||
<Upload
|
<Upload
|
||||||
listType="picture-card"
|
listType="picture-card"
|
||||||
fileList={files}
|
fileList={files}
|
||||||
action={"http://127.0.0.1:12214/v1/public/fts/upload"}
|
action={`${Config.uploadUrl}v1/public/fts/upload`}
|
||||||
onPreview={handlePreview}
|
onPreview={handlePreview}
|
||||||
maxCount={1}
|
maxCount={1}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
|
|
@ -1,12 +1,99 @@
|
||||||
|
import { Content, Header } from "antd/es/layout/layout";
|
||||||
import "./layout.less";
|
import "./layout.less";
|
||||||
import React from "react";
|
import { Menu } from "antd";
|
||||||
const LayOut = (props: any) => {
|
import { Footer } from "antd/lib/layout/layout";
|
||||||
|
import { Outlet, useNavigate } from "react-router";
|
||||||
|
import { HomeTwoTone } from "@ant-design/icons";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { Store } from "antd/es/form/interface";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
const LayOut = (props: Store) => {
|
||||||
|
const { usrStore } = props;
|
||||||
|
const nav = useNavigate();
|
||||||
|
console.log(usrStore.isNeedLogin);
|
||||||
|
useEffect(() => {
|
||||||
|
if (usrStore.isNeedLogin) {
|
||||||
|
nav("/login");
|
||||||
|
}
|
||||||
|
}, [usrStore,nav]);
|
||||||
|
const items = [
|
||||||
|
{
|
||||||
|
key: "/admin/user",
|
||||||
|
label: `用户管理`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/dep",
|
||||||
|
label: `部门管理`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/archives",
|
||||||
|
label: `档案管理`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/whseMgmt",
|
||||||
|
label: `仓库管理`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/leaveApproval",
|
||||||
|
label: `请假审批`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/politicalStudy",
|
||||||
|
label: `政治学习`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: `/admin/polRegulations`,
|
||||||
|
label: `政治法规管理`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/materialMgmt",
|
||||||
|
label: `物资管理`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/teamMgmt",
|
||||||
|
label: `队伍属性管理`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/admin/persMgmt",
|
||||||
|
label: `个人身份管理`,
|
||||||
|
},
|
||||||
|
];
|
||||||
return (
|
return (
|
||||||
<div className="layout">
|
<div className="layout">
|
||||||
|
<Header
|
||||||
|
style={{
|
||||||
|
position: "sticky",
|
||||||
|
top: 0,
|
||||||
|
zIndex: 1,
|
||||||
|
width: "100%",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
padding: "0 10px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<HomeTwoTone
|
||||||
|
onClick={() => nav("/")}
|
||||||
|
style={{ fontSize: "36px", marginRight: "10px" }}
|
||||||
|
/>
|
||||||
|
<Menu
|
||||||
|
theme="dark"
|
||||||
|
mode="horizontal"
|
||||||
|
defaultSelectedKeys={["/admin/user"]}
|
||||||
|
items={items}
|
||||||
|
onClick={(e) => {
|
||||||
|
nav(e.key);
|
||||||
|
}}
|
||||||
|
style={{ flex: 1, minWidth: 0 }}
|
||||||
|
/>
|
||||||
|
</Header>
|
||||||
|
<Content style={{ padding: "0 20px" }}>
|
||||||
|
<Outlet />
|
||||||
|
</Content>
|
||||||
|
<Footer style={{ textAlign: "center" }}>
|
||||||
|
Ant Design ©{new Date().getFullYear()} Created by Ant UED
|
||||||
|
</Footer>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LayOut;
|
export default inject("usrStore")(observer(LayOut));
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
html{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
|
|
|
@ -18,7 +18,7 @@ const HomeLeft = () => {
|
||||||
MapUtl.makerList[0].setIcon(newIcon);
|
MapUtl.makerList[0].setIcon(newIcon);
|
||||||
};
|
};
|
||||||
const jumpToUser = () => {
|
const jumpToUser = () => {
|
||||||
navigate("/user");
|
navigate("admin/user");
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
const LeaveApproval = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>leaveApproval</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LeaveApproval;
|
|
@ -10,17 +10,17 @@ const Login = (props) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
usrStore.login({
|
usrStore.login({
|
||||||
userName: values.username,
|
userName: values.account,
|
||||||
passWord: values.password,
|
passWord: values.password,
|
||||||
});
|
});
|
||||||
navigate("/", { replace: true });
|
navigate("/admin/user", { replace: true });
|
||||||
};
|
};
|
||||||
const onFinishFailed = () => {};
|
const onFinishFailed = () => {};
|
||||||
const loginForm = [
|
const loginForm = [
|
||||||
{
|
{
|
||||||
type: "input",
|
type: "input",
|
||||||
label: "用户名",
|
label: "用户名",
|
||||||
name: "username",
|
name: "account",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入用户名!" }],
|
rules: [{ required: true, message: "请输入用户名!" }],
|
||||||
},
|
},
|
||||||
|
@ -42,7 +42,7 @@ const Login = (props) => {
|
||||||
<SimpleForm
|
<SimpleForm
|
||||||
formRef={formRef}
|
formRef={formRef}
|
||||||
formName="login_basic"
|
formName="login_basic"
|
||||||
colProps={4}
|
colProps={16}
|
||||||
formDatas={loginForm}
|
formDatas={loginForm}
|
||||||
onFinish={onFinish}
|
onFinish={onFinish}
|
||||||
initialValues={true}
|
initialValues={true}
|
||||||
|
@ -54,7 +54,7 @@ const Login = (props) => {
|
||||||
formRef.current?.submit();
|
formRef.current?.submit();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Login
|
登录
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
const MaterialMgmt = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>MaterialMgmt</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MaterialMgmt;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
const PersMgmt = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>PersMgmt</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PersMgmt;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
const PolRegulations = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>PolRegulations</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PolRegulations;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
const PoliticalStudy = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>PoliticalStudy</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PoliticalStudy;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
const TeamMgmt = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>TeamMgmt</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TeamMgmt;
|
||||||
|
|
|
@ -164,7 +164,6 @@ const User = (props: Store) => {
|
||||||
>
|
>
|
||||||
添加用户
|
添加用户
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
type="default"
|
type="default"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -173,66 +172,6 @@ const User = (props: Store) => {
|
||||||
>
|
>
|
||||||
标签管理
|
标签管理
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
onClick={() => {
|
|
||||||
nav("/dep");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
部门管理
|
|
||||||
</Button>
|
|
||||||
<Button type="default" onClick={() => {}}>
|
|
||||||
部门管理
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
onClick={() => {
|
|
||||||
nav("/archives");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
档案管理
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
onClick={() => {
|
|
||||||
nav("/archives");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
仓库管理
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
onClick={() => {
|
|
||||||
nav("/dep");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
请假审批
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
onClick={() => {
|
|
||||||
nav("/dep");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
政治学习
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
onClick={() => {
|
|
||||||
nav("/dep");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
政治法规管理
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
onClick={() => {
|
|
||||||
nav("/dep");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
物资管理
|
|
||||||
</Button>
|
|
||||||
</Space>
|
</Space>
|
||||||
|
|
||||||
<BTable store={usrStore} columns={columns} dataSource={usrStore.list} />
|
<BTable store={usrStore} columns={columns} dataSource={usrStore.list} />
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
const WhseMgmt = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p>WhseMgmt</p>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WhseMgmt;
|
||||||
|
|
|
@ -1,27 +1,17 @@
|
||||||
import { createHashRouter } from "react-router-dom";
|
import { createHashRouter } from "react-router-dom";
|
||||||
import App from "@/App";
|
import App from "@/App";
|
||||||
import ErrorPage from "@/pages/errorPage";
|
|
||||||
import Login from "@/pages/login/login";
|
import Login from "@/pages/login/login";
|
||||||
import { homeRouter } from "@/router/routers/home_router"
|
import { homeRouter } from "@/router/routers/home_router";
|
||||||
const routers = createHashRouter([
|
const routers = createHashRouter([
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
element: <App />,
|
element: <App />,
|
||||||
children: [
|
|
||||||
...homeRouter,
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/login",
|
||||||
element: <Login />,
|
element: <Login />,
|
||||||
},
|
},
|
||||||
{
|
...homeRouter
|
||||||
path: "/404",
|
|
||||||
element: <ErrorPage />,
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
export { routers };
|
||||||
|
|
||||||
|
|
||||||
export { routers };
|
|
||||||
|
|
|
@ -1,38 +1,86 @@
|
||||||
|
import LayOut from "@/components/layout/layout";
|
||||||
import Archives from "@/pages/archives";
|
import Archives from "@/pages/archives";
|
||||||
import Dep from "@/pages/dep";
|
import Dep from "@/pages/dep";
|
||||||
import Home from "@/pages/home/home";
|
import Home from "@/pages/home/home";
|
||||||
|
import LeaveApproval from "@/pages/leaveApproval";
|
||||||
|
import MaterialMgmt from "@/pages/materialMgmt";
|
||||||
|
import PersMgmt from "@/pages/persMgmt";
|
||||||
|
import PoliticalStudy from "@/pages/politicalStudy";
|
||||||
|
import PolRegulations from "@/pages/polRegulations";
|
||||||
import Tag from "@/pages/tag/tag";
|
import Tag from "@/pages/tag/tag";
|
||||||
|
import TeamMgmt from "@/pages/teamMgmt";
|
||||||
import User from "@/pages/user/user";
|
import User from "@/pages/user/user";
|
||||||
|
import WhseMgmt from "@/pages/whseMgmt";
|
||||||
export const homeRouter = [
|
export const homeRouter = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
index: true,
|
index: true,
|
||||||
element: <Home />
|
element: <Home />,
|
||||||
// element: <Navigate to="/dashbord" replace />
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/dashbord",
|
path: "/dashbord",
|
||||||
index: false,
|
index: false,
|
||||||
element: <Home />
|
element: <Home />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/user",
|
path: "/admin",
|
||||||
index: true,
|
element: <LayOut />,
|
||||||
element: <User />
|
children: [
|
||||||
|
{
|
||||||
|
path: "/admin/user",
|
||||||
|
index: true,
|
||||||
|
element: <User />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/tag",
|
||||||
|
index: true,
|
||||||
|
element: <Tag />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/dep",
|
||||||
|
index: true,
|
||||||
|
element: <Dep />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/archives",
|
||||||
|
index: true,
|
||||||
|
element: <Archives />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/leaveApproval",
|
||||||
|
index: true,
|
||||||
|
element: <LeaveApproval />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/materialMgmt",
|
||||||
|
index: true,
|
||||||
|
element: <MaterialMgmt />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/persMgmt",
|
||||||
|
index: true,
|
||||||
|
element: <PersMgmt />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/politicalStudy",
|
||||||
|
index: true,
|
||||||
|
element: <PoliticalStudy />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/polRegulations",
|
||||||
|
index: true,
|
||||||
|
element: <PolRegulations />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/teamMgmt",
|
||||||
|
index: true,
|
||||||
|
element: <TeamMgmt />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/admin/whseMgmt",
|
||||||
|
index: true,
|
||||||
|
element: <WhseMgmt />,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
];
|
||||||
path: "/tag",
|
|
||||||
index: true,
|
|
||||||
element: <Tag />
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/dep",
|
|
||||||
index: true,
|
|
||||||
element: <Dep />
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/archives",
|
|
||||||
index: true,
|
|
||||||
element: <Archives />
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import Config from "@/util/config";
|
||||||
import axios, { AxiosResponse } from "axios";
|
import axios, { AxiosResponse } from "axios";
|
||||||
// 添加请求拦截器
|
// 添加请求拦截器
|
||||||
// axios.defaults.headers.common["CommonType"] = "shouka";
|
|
||||||
axios.defaults.headers.common["Content-Type"] = "application/json; charset=utf8";
|
axios.defaults.headers.common["Content-Type"] = "application/json; charset=utf8";
|
||||||
axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
|
||||||
axios.interceptors.request.use((config) => {
|
axios.interceptors.request.use((config) => {
|
||||||
config.baseURL = "http://127.0.0.1:12214/v1/";
|
config.baseURL = `${Config.baseUrl}v1/`;
|
||||||
config.timeout = 5000;
|
config.timeout = 5000;
|
||||||
let token = window.localStorage.getItem("token")
|
let token = window.localStorage.getItem("token")
|
||||||
config.headers.Authorization = token ?? "1"
|
config.headers.Authorization = token ?? "1"
|
||||||
|
@ -18,6 +18,7 @@ axios.interceptors.request.use((config) => {
|
||||||
// 添加响应拦截器
|
// 添加响应拦截器
|
||||||
axios.interceptors.response.use((res: AxiosResponse) => {
|
axios.interceptors.response.use((res: AxiosResponse) => {
|
||||||
if (res.data.status === 401) {
|
if (res.data.status === 401) {
|
||||||
|
console.log("res.data.status",res.data.status);
|
||||||
store.usrStore.openLoginDilog()
|
store.usrStore.openLoginDilog()
|
||||||
store.usrStore.logOut()
|
store.usrStore.logOut()
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ class ArchivesStore extends BaseStore<TagDataType> {
|
||||||
makeObservable(this, {})
|
makeObservable(this, {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const archivesStore = new ArchivesStore()
|
export const archivesStore = new ArchivesStore()
|
||||||
export default archivesStore;
|
|
||||||
|
|
|
@ -16,5 +16,5 @@ class ArchivesCategoryStore extends BaseStore<TagDataType> {
|
||||||
makeObservable(this, {})
|
makeObservable(this, {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const acStore = new ArchivesCategoryStore()
|
export const acStore = new ArchivesCategoryStore()
|
||||||
export default acStore;
|
|
||||||
|
|
|
@ -16,6 +16,5 @@ class DepStore extends BaseStore<TagDataType> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-anonymous-default-export
|
export const depStore = new DepStore();
|
||||||
export default new DepStore();
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import usrStore from '@/store/user'
|
import usrStore from '@/store/user'
|
||||||
import tagStore from '@/store/tag'
|
import tagStore from '@/store/tag'
|
||||||
import depStore from '@/store/dep'
|
import { depStore } from '@/store/dep'
|
||||||
import archivesStore from '@/store/archives'
|
import { archivesStore } from '@/store/archives'
|
||||||
import folderStore from '@/store/folder';
|
import folderStore from '@/store/folder';
|
||||||
import acStore from '@/store/archives_category';
|
import { acStore } from '@/store/archives_category';
|
||||||
|
|
||||||
const store = {
|
const store = {
|
||||||
usrStore,
|
usrStore,
|
||||||
|
|
|
@ -16,6 +16,6 @@ class TagStore extends BaseStore<TagDataType> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-anonymous-default-export
|
export const tagStore = new TagStore();
|
||||||
export default new TagStore();
|
export default tagStore;
|
||||||
|
|
|
@ -43,9 +43,14 @@ class UserStore extends BaseStore<UserDataType> {
|
||||||
password: params.passWord,
|
password: params.passWord,
|
||||||
genre: 1
|
genre: 1
|
||||||
}
|
}
|
||||||
let data =await baseHttp.post(UserConfig.LOGINURI, param)
|
try {
|
||||||
window.localStorage.setItem("token", data.data.token ?? "");
|
let data = await baseHttp.post(UserConfig.LOGINURI, param)
|
||||||
this.closeLoginDilog()
|
window.localStorage.setItem("token", data.data.token ?? "");
|
||||||
|
return true
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
openLoginDilog() {
|
openLoginDilog() {
|
||||||
this.isNeedLogin = true;
|
this.isNeedLogin = true;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class Config {
|
||||||
|
static baseUrl = "http://127.0.0.1:12214/";
|
||||||
|
static uploadUrl = "http://127.0.0.1:12214/";
|
||||||
|
}
|
||||||
|
export default Config;
|
Loading…
Reference in New Issue