Commit 4ac63b98 authored by Sixiang_Zzb's avatar Sixiang_Zzb

会计页面

parent 9bb79978
......@@ -146,8 +146,13 @@ export default defineConfig({
// },
],
},
{},
],
},
{
path: 'UploadAccount',
component: './UserManagement/ServiceProviderManagement/UploadAccount',
},
{
path: '/PropertyManagement',
name: 'propertymanagement',
......
......@@ -6,6 +6,7 @@ import { ConnectState } from '@/models/connect';
import { CurrentUser } from '@/models/user';
import login from '@/pages/user/login';
import { getCookie } from '@/utils/method';
import { message } from 'antd';
interface SecurityLayoutProps extends ConnectProps {
loading?: boolean;
......@@ -14,21 +15,21 @@ interface SecurityLayoutProps extends ConnectProps {
}
interface SecurityLayoutState {
token:String,
token: String;
isReady: boolean;
}
class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayoutState> {
state: SecurityLayoutState = {
isReady: false,
token:"abc123",
token: 'abc123',
};
componentDidMount() {
this.setState({
isReady: true,
});
const { dispatch ,login} = this.props;
const { dispatch, login } = this.props;
// console.log("安全登录中")
// console.log(login)
if (dispatch) {
......@@ -43,38 +44,90 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
}
render() {
const { isReady,token } = this.state;
const { children, loading, currentUser,login } = this.props;
const { isReady, token } = this.state;
const { children, loading, currentUser, login, history, location } = this.props;
// You can replace it to your authentication rule (such as check token exists)
// 你可以把它替换成你自己的登录认证规则(比如判断 token 是否存在)
// console.log("是否已登录" + getCookie("token"))
// console.log('是否已登录' + getCookie('token'));
// const isLogin = currentUser && currentUser.name;//isLogin为关键点
var isLogin = false
if (getCookie("token").length!=0) {
isLogin=true
const routeAuth = [
[1, '/manager/data/lookUp'],
[2, '/manager/account/lookUp'],
[3, '/manager/account/edit'],
[4, '/manager/account/addProfile'],
[5, '/manager/account/logOutProfile'],
[6, '/manager/vps/lookUp'],
[7, '/manager/vps/edit'],
[8, '/manager/vps/add'],
[9, '/manager/vps/logOut'],
[10, '/manager/tosMoney/lookUp'],
[11, '/manager/tosMoney/add'],
[12, '/manager/tosServices/lookUp'],
[13, '/manager/tosServices/edit'],
[14, '/manager/tosServices/logOut'],
[15, '/manager/order/lookUp'],
[16, '/manager/order/edit'],
[17, '/manager/contract/lookUp'],
[18, '/manager/contract/edit'],
[19, '/manager/contract/add'],
[20, '/manager/village/lookUp'],
[21, '/manager/village/edit'],
[22, '/manager/village/add'],
[23, '/manager/notice/lookUp'],
[24, '/manager/notice/edit'],
[25, '/manager/notice/add'],
[26, '/manager/visitor/lookUp'],
[27, '/manager/bookingService/lookUp'],
[28, '/manager/bookingService/edit'],
[29, '/manager/bookingService/add'],
[30, '/manager/backgroundAccount/lookUp'],
[31, '/manager/backgroundAccount/edit'],
[32, '/manager/lifeAccount/lookUp'],
[33, '/manager/lifeAccount/edit'],
[34, '/manager/lifeAccount/add'],
[35, '/manager/lifeAccount/logOut'],
[36, '/manager/lifeAccount/familyMembers/add'],
[37, '/manager/lifeAccount/familyMembers/logOut'],
];
var isLogin = false;
// 权限判断
let auth = false;
if (getCookie('token').length != 0) {
console.log('是否有权限');
isLogin = true;
// console.log(currentUser?.permission);
// console.log(location.pathname);
// const flag = routeAuth.some((v) => {
// return v[1] === location.pathname;
// });
// console.log(flag);
}
const queryString = stringify({
redirect: window.location.href,
});
if ((!isLogin && loading) || !isReady) {
// console.log("页面加载")
console.log('页面加载');
return <PageLoading />;
}
if (!isLogin && window.location.pathname !== '/user/login') {
// message.error('Please Re Login!', 3, () => {
console.log('未登录返回登录页!');
return <Redirect to={`/user/login?${queryString}`} />;
// });
}
return children;
}
}
export default connect(({ user, loading,login}: ConnectState) => ({
export default connect(({ user, loading, login }: ConnectState) => ({
currentUser: user.currentUser,
loading: loading.models.user,
login: login
login: login,
}))(SecurityLayout);
......@@ -67,11 +67,7 @@ const Model: LoginModelType = {
console.log(userMessage);
console.log(userMessage.token);
setCookie('token', userMessage.token);
// tosUserName: "admin"
// tosUserPhone: "18818881888"
setCookie('name', response.token.tosUserName);
setCookie('phone', response.token.tosUserPhone);
setCookie('id', response.token.id);
setCookie('permission', userMessage.permission);
console.log('获取到Token:' + getCookie('token'));
yield put({
type: 'saveToken',
......
.container {
width: 100vw;
height: 100vh;
}
.box {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
}
.btn {
position: absolute;
right: 0px;
bottom: -50px;
}
.ant-btn {
width: 100px;
}
.container {
width: 100vw;
height: 100vh;
}
.box {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
}
.btn {
position: absolute;
right: 0px;
bottom: -50px;
}
.ant-btn {
width: 100px;
}
import React from 'react';
import { Form, Input, Button, Divider } from 'antd';
import styles from './UploadAccount.less';
const UploadAccount = () => {
const handleLogin = (value: string) => {
console.log(value);
};
return (
<div className={styles.container}>
<Form className={styles.box} onFinish={handleLogin}>
<Form.Item name={'password'}>
<Input.Password
style={{ width: 220 }}
placeholder={'Please enter your password'}
></Input.Password>
</Form.Item>
<Divider />
<Form.Item className={styles.btn}>
<Button htmlType={'submit'}>登录</Button>
</Form.Item>
</Form>
</div>
);
};
export default UploadAccount;
......@@ -2,6 +2,8 @@ import RenderAuthorize from '@/components/Authorized';
import { getAuthority } from './authority';
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable import/no-mutable-exports */
// console.log(RenderAuthorize);
let Authorized = RenderAuthorize(getAuthority());
// Reload the rights component
......
......@@ -4,6 +4,7 @@
*/
import { extend } from 'umi-request';
import { notification } from 'antd';
import getRequest from 'umi-request';
const codeMessage = {
200: '服务器成功返回请求的数据。',
......@@ -45,6 +46,17 @@ const errorHandler = (error: { response: Response }): Response => {
return response;
};
// request拦截器, 改变url 或 options.
// getRequest.interceptors.request.use((url, options) => {
// console.log(url);
// console.log(options);
// return {
// url: `${url}&interceptors=yes`,
// options: { ...options, interceptors: true },
// };
// });
/**
* 配置request请求时的默认参数
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment