Commit a329cf87 authored by cellee's avatar cellee

Merge branch 'final' of http://120.77.240.215:9701/Maple/tostumi.git into final

parents 13c6e474 b0128b20
......@@ -6,19 +6,28 @@
height: 100vh;
overflow: auto;
background: @layout-body-background;
background-image: url("../assets/background.png");
background-image: url('../assets/background_1.png');
background-repeat: no-repeat;
background-position: center left;
background-position: center right;
margin-left: -44px;
background-color: #fff;
&.active {
background-image: url('../assets//background_2.png');
}
}
.contain{
width: 700px;
height: 300px;
.contain {
width: 500px;
// height: 300px;
position: absolute;
left: 207px;
top: 50vh;
top: 45vh;
margin-top: -297px;
background-color: white;
padding: 60px 80px;
box-shadow: 1px 2px 20px 0px #ccc;
border-radius: 30px;
}
.lang {
......@@ -31,25 +40,29 @@
}
}
@media (min-width:1603px) {
@media (min-width: 1603px) {
.container {
background-image: url("../assets/background.png");
background-image: url('../assets/background_1.png');
background-repeat: no-repeat;
background-position: center center;
//background-size: 100%;
// background-size:100% 100%;
// background-attachment: fixed;
background-position: 70% 50%;
background-color: #fff;
&.active {
background-image: url('../assets//background_2.png');
}
}
.contain{
width: 700px;
height: 300px;
.contain {
width: 500px;
position: absolute;
left: 50vw;
top:50vh;
top: 45vh;
margin-left: -639px;
margin-top: -297px;
background-color: white;
padding: 60px 80px;
box-shadow: 1px 2px 20px 0px #ccc;
border-radius: 30px;
}
}
......@@ -87,20 +100,19 @@
font-size: @font-size-base;
}
.box1{
font-size:36px;
font-family:"PingFang SC";
font-weight:800;
color:rgba(129,152,177,1);
line-height:48px;
.box1 {
font-size: 36px;
font-family: 'PingFang SC';
font-weight: 800;
color: #8bc53fff;
line-height: 48px;
margin-bottom: 26px;
}
.box2{
font-size:38px;
font-family:PingFang SC;
font-weight:800;
color:rgba(0,43,96,1);
line-height:48px;
margin-bottom: 89px;
}
\ No newline at end of file
.box2 {
font-size: 65px;
font-family: PingFang SC;
line-height: 48px;
margin-bottom: 50px;
color: #8bc53fff;
margin-top: 35px;
}
import { DefaultFooter, MenuDataItem, getMenuData, getPageTitle } from '@ant-design/pro-layout';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { Link, useIntl, ConnectProps, connect } from 'umi';
import React from 'react';
import SelectLang from '@/components/SelectLang';
import { MenuDataItem, getMenuData, getPageTitle } from '@ant-design/pro-layout';
import { useIntl, ConnectProps, connect } from 'umi';
import React, { useEffect } from 'react';
import { ConnectState } from '@/models/connect';
import logo from '../assets/logo.svg';
import logo from '../assets/toslogo.png';
// import {goReserPwd} from '@/models/login';
import styles from './UserLayout.less';
export interface UserLayoutProps extends Partial<ConnectProps> {
breadcrumbNameMap: {
[path: string]: MenuDataItem;
};
result?: boolean;
}
const UserLayout: React.FC<UserLayoutProps> = (props) => {
......@@ -19,14 +18,14 @@ const UserLayout: React.FC<UserLayoutProps> = (props) => {
route = {
routes: [],
},
} = props;
const { routes = [] } = route;
const {
children,
location = {
pathname: '',
},
result,
dispatch,
} = props;
const { routes = [] } = route;
const { formatMessage } = useIntl();
const { breadcrumb } = getMenuData(routes);
const title = getPageTitle({
......@@ -35,17 +34,52 @@ const UserLayout: React.FC<UserLayoutProps> = (props) => {
breadcrumb,
...props,
});
return (
<div className={styles.container}>
// useEffect(() => {
// console.log(location.pathname);
// if (location.pathname === '/user/login2') {
// console.log('更改ui');
// dispatch &&
// dispatch({
// type: 'login/goResetPwd',
// payload: {
// result: true,
// },
// });
// } else {
// dispatch &&
// dispatch({
// type: 'login/goResetPwd',
// payload: {
// result: false,
// },
// });
// }
// }, [location]);
console.log(result);
return (
<div className={styles.container + ' ' + (result ? styles.active : '')}>
<div className={styles.contain}>
<div className={styles.box1}>Welcome To</div>
<div className={styles.box2}>TOS Management Background</div>
{!result ? (
<>
<img src={logo} alt="" />
<div className={styles.box2}>Sign In</div>
</>
) : (
<div className={styles.box1}>
Change <br /> Password
</div>
)}
{children}
</div>
</div>
);
};
export default connect(({ settings }: ConnectState) => ({ ...settings }))(UserLayout);
export default connect(({ settings, login }: ConnectState) => {
return {
...settings,
result: login.result,
};
})(UserLayout);
......@@ -31,7 +31,6 @@ export default {
return { ...state, CurData };
},
returnCurDataDetail(state: object, { CurDataDetail }: any) {
console.log(state);
return { ...state, CurDataDetail };
},
returnPage7(state: object, { Data7 }: any) {
......@@ -94,6 +93,7 @@ export default {
status: number;
pictrues: string[];
time: string;
deleted: number;
} = {
community: tmp.communityName || tmp.communityName,
address: tmp.addressAndpostalCode || tmp.residentialAddress,
......@@ -109,6 +109,7 @@ export default {
status: tmp2.handleStatus,
pictrues: picFromate(tmp2.imgUrl),
time: timestampToTime4(tmp2.createTime.time),
deleted: tmp.deleted,
};
yield put({ type: 'returnCurDataDetail', CurDataDetail });
}
......
......@@ -18,6 +18,8 @@ export interface StateType {
userName?: string;
password?: string;
result?: boolean;
resultLogin?: boolean;
userStatus?: number;
}
export interface LoginModelType {
......@@ -28,11 +30,13 @@ export interface LoginModelType {
logout: Effect;
reset: Effect;
goResetPwd: Effect;
setResult: Effect;
};
reducers: {
changeLoginStatus: Reducer<StateType>;
saveToken: Reducer<StateType>;
resetPwd: Reducer<StateType>;
setResultLogin: Reducer<StateType>
};
}
......@@ -45,6 +49,8 @@ const Model: LoginModelType = {
userName: '',
password: '',
result: false,
resultLogin: false,
userStatus: 0, // 0:首次登陆 1:修改密码
},
reducers: {
......@@ -61,32 +67,52 @@ const Model: LoginModelType = {
return { ...state, token, userName, password, result };
},
resetPwd(state, { result, userName }) {
console.log(result, userName);
return { ...state, result, userName };
resetPwd(state, { result, userName, userStatus }) {
return { ...state, result, userName, userStatus };
},
setResultLogin(state, { resultLogin }) {
return {
...state,
resultLogin
}
},
},
effects: {
*login({ payload }, { call, put }) {
const response = yield call(AccountLogin, payload);
console.log(payload);
const response = yield call(AccountLogin, payload.values);
if (response.status === 'resetPwd') {
// console.log('跳转到修改密码页面');
yield put({
type: 'resetPwd',
result: true,
userName: response.userName,
userStatus: 0,
});
message.success('Reset your password for your first login!', 3);
message.success('Reset your password for your first login!');
history.push('/user/login2');
} else if (response.status === 'ok' && response.token != null) {
yield put({
type: 'changeLoginStatus',
payload: response,
});
if (payload.remenber) {
const remenberUserName = getCookie("remenberUserName");
const remenberPwd = getCookie("remenberPwd");
if (!remenberUserName || !remenberPwd) {
// 存储密码
setCookie("remenberUserName", payload.values.userName, 7)
setCookie("remenberPwd", payload.values.password, 7)
}
} else {
setCookie("remenberUserName", "", -1)
setCookie("remenberPwd", "", -1)
}
// Login successfully response.status === 'ok'
message.success('Login Successfully!', 3);
const userMessage = yield call(AccountCheckLogin, payload); //请求时间网络
const userMessage = yield call(AccountCheckLogin, payload.values); //请求时间网络
setCookie('token', userMessage.token);
setCookie('id', userMessage.userModel.id);
......@@ -127,11 +153,17 @@ const Model: LoginModelType = {
// 只跳到首页
history.replace('/');
} else {
message.error('Login Error! Username or Password is wrong!', 3);
// message.error('Login Error! Username or Password is wrong!', 3);
yield put({
type: "setResultLogin",
resultLogin: true,
})
}
},
*logout({}, { call, put }) {
*logout({ }, { call, put }) {
const { redirect } = getPageQuery();
// Note: There may be security issues, please note
// const response = yield call(AccountOut, payload);
......@@ -155,9 +187,14 @@ const Model: LoginModelType = {
*reset({ payload }, { call, put }) {
const res = yield call(resetPassword, payload);
console.log(res);
if (res.error_code === '0000') {
message.success('Modified successfully, please log in again!', 3);
message.success('Modified successfully, please log in again!');
yield put({
type: 'resetPwd',
result: false,
userName: '',
userStatus: 0,
});
history.push('/');
} else {
message.error('Change password failed,Please try again!');
......@@ -165,15 +202,21 @@ const Model: LoginModelType = {
},
*goResetPwd({ payload }, { call, put }) {
console.log('跳转到修改密码页面');
console.log(payload);
yield put({
type: 'resetPwd',
result: false,
result: true,
userName: payload,
userStatus: 1,
});
history.push('login2');
},
*setResult({ payload }, { call, put }) {
yield put({
type: "setResultLogin",
resultLogin: payload.resultLogin || false,
})
}
},
};
......
......@@ -40,7 +40,15 @@ const Card = (props: any) => {
const columns = objectColumns([
['Community', 'community_name'],
['Requestor', 'apply_name'],
[
'Requestor',
'apply_name',
(text: string, record: { exist: string }) => (
<div>
{text} {record.exist === '1' && '(Canceled)'}
</div>
),
],
[
'Unit No',
null,
......
......@@ -112,7 +112,9 @@ const CardDetail = (props: any) => {
<Row gutter={8} style={{ marginTop: 16 }}>
<Col>Owner Name:</Col>
<Col span={3}>{onwerDetail.owerName}</Col>
<Col span={3}>
{onwerDetail.owerName} {onwerDetail.deleted === 1 && '(Canceled)'}{' '}
</Col>
<Col>Contact Details:</Col>
<Col span={2}>{onwerDetail.owerPhone}</Col>
<Col>{onwerDetail.owerEmail}</Col>
......
......@@ -143,7 +143,7 @@ const Detail = (props: any) => {
{CurDataDetail.address}{' '}
</Descriptions.Item>
<Descriptions.Item label="User Name" span={2}>
{CurDataDetail.name}
{CurDataDetail.name} {CurDataDetail.deleted === 1 && '(Canceled)'}
</Descriptions.Item>
<Descriptions.Item label="Contact Details" span={2}>
{CurDataDetail.phone} &nbsp;&nbsp;&nbsp;&nbsp; {CurDataDetail.email}
......
......@@ -50,7 +50,17 @@ const PropertyServices = (props: any) => {
const columns = [
{ title: 'Community', dataIndex: 'community_name' },
{ title: 'Requestor', dataIndex: 'owner_name' },
{
title: 'Requestor',
dataIndex: 'owner_name',
render: (text: string, record: { exist: string }) => {
return (
<div>
{text} {record.exist === '1' && '(Canceled)'}
</div>
);
},
},
{
title: parseInt(serviceTypeGobal) - 1 === 0 ? 'Attended By' : 'Description',
......
......@@ -29,7 +29,15 @@ const Renovation = (props: any) => {
const columns = objectColumns([
['Community', 'communityName'],
['Applicant', 'applyforName'],
[
'Applicant',
'applyforName',
(text: string, record: { exist: string }) => (
<div>
{text} {record.exist === '1' && '(Canceled)'}{' '}
</div>
),
],
[
'Unit',
null,
......
......@@ -104,7 +104,9 @@ const RenovationDetail = (props: any) => {
<Row gutter={8} style={{ marginTop: 16 }}>
<Col>Owner Name:</Col>
<Col span={3}>{onwerDetail.owerName}</Col>
<Col span={3}>
{onwerDetail.owerName} {onwerDetail.deleted === 1 && '(Canceled)'}
</Col>
<Col>Contact Details:</Col>
<Col span={2}>{onwerDetail.owerPhone}</Col>
<Col>{onwerDetail.owerEmail}</Col>
......
import { ArrowLeftOutlined } from '@ant-design/icons';
import { message, Form, Button } from 'antd';
import { message, Form, Button, Checkbox, Input } from 'antd';
import React, { useState, useEffect, useCallback } from 'react';
import { connect, Dispatch, history } from 'umi';
import { StateType } from '@/models/login';
import { LoginParamsType, getCaptcha, ValidateCaptcha } from '@/services/login';
import { ConnectState } from '@/models/connect';
import { ExclamationCircleFilled } from '@ant-design/icons';
import styles from './style.less';
import { getCookie } from '@/utils/method';
interface LoginProps {
dispatch: Dispatch;
......@@ -15,7 +19,7 @@ interface LoginProps {
const Login: React.FC<LoginProps> = (props) => {
const { userLogin = {}, submitting, dispatch } = props;
const { status, type: loginType } = userLogin;
const { status, type: loginType, resultLogin } = userLogin;
const [userName, setUsername] = useState('');
const [forgetflag, setForgetFlag] = useState(false);
......@@ -23,17 +27,35 @@ const Login: React.FC<LoginProps> = (props) => {
const [count, setCount] = useState<number>(60);
const [timing, setTiming] = useState(false);
const [remenber, setRemenber] = useState(false);
const [form] = Form.useForm();
// 判断本地是否存储的有账号密码
useEffect(() => {
if (location.pathname === '/user/login') {
const name = getCookie('remenberUserName');
const Pwd = getCookie('remenberPwd');
console.log(name, Pwd);
if (Pwd && name) {
setRemenber(true);
const values = {
userName: name,
password: Pwd,
};
form.setFieldsValue(values);
}
}
}, []);
// 提交按钮
const handleSubmit = async (values: LoginParamsType) => {
console.log(values);
if (forgetflag) {
if (!values.userName || !values.code) {
message.error('The mailbox or verification code cannot be empty!!!');
return;
}
console.log('校验验证码!');
const res = await ValidateCaptcha({ account: values.userName, code: values.code });
console.log(res);
if (res.error_code === '0000') {
console.log('通过跳转到修改密码页面');
......@@ -43,12 +65,18 @@ const Login: React.FC<LoginProps> = (props) => {
});
} else {
message.error('MemberCode!');
dispatch({
type: 'login/setResult',
payload: {
resultLogin: true,
},
});
}
} else {
if (values.userName && values.password) {
dispatch({
type: 'login/login',
payload: { ...values },
payload: { values, remenber },
});
} else {
message.error('The username or password cannot be empty!');
......@@ -62,15 +90,17 @@ const Login: React.FC<LoginProps> = (props) => {
};
// 登录
const returnHandle = (e: any) => {
const returnHandle = () => {
history.push('/user/login');
};
// 忘记密码
const gotoForgetHandle = (e: any) => {
const gotoForgetHandle = () => {
history.push('/user/forget');
};
const handleSend = (e: any) => {
// 发送验证码
const handleSend = () => {
if (timing) return;
if (
userName !== '' &&
......@@ -83,14 +113,10 @@ const Login: React.FC<LoginProps> = (props) => {
}
};
// 监听路由
useEffect(() => {
if (location.pathname == '/user/forget') {
setForgetFlag(true);
} else {
setForgetFlag(false);
}
}, [location.pathname]);
// 保存密码
const onRemenberChange = (e: Readonly<{ target: { checked: boolean } }>) => {
setRemenber(e.target.checked);
};
// 获取验证码
const onGetCaptcha = useCallback(async (email: string) => {
......@@ -106,10 +132,24 @@ const Login: React.FC<LoginProps> = (props) => {
}
}, []);
// 监听路由
useEffect(() => {
if (location.pathname == '/user/forget') {
setForgetFlag(true);
} else {
setForgetFlag(false);
}
// 路由发生变化 清楚错误提示
dispatch({
type: 'login/setResult',
payload: {},
});
}, [location.pathname]);
// 发送验证码的秒数
useEffect(() => {
console.log('计算秒数');
let interval: number = 0;
console.log(timing);
if (timing) {
interval = window.setInterval(() => {
setCount((preSecond) => {
......@@ -129,15 +169,18 @@ const Login: React.FC<LoginProps> = (props) => {
return (
<div>
{forgetflag ? (
<div style={{ position: 'absolute', top: -50, cursor: 'pointer' }} onClick={returnHandle}>
<div
style={{ position: 'absolute', top: 20, left: 30, cursor: 'pointer' }}
onClick={returnHandle}
>
<ArrowLeftOutlined style={{ fontSize: '28px' }} />
</div>
) : (
<div />
)}
<Form onFinish={handleSubmit}>
<Form onFinish={handleSubmit} form={form}>
<div className={styles.box1}>
{forgetflag ? 'Please enter email address' : 'Account Name'}
{forgetflag ? 'Please enter email address' : 'Account Numbers'}
</div>
<Form.Item name="userName" initialValue={userName || ''}>
<input className={styles.input} onChange={usernameHandle} />
......@@ -150,35 +193,59 @@ const Login: React.FC<LoginProps> = (props) => {
<Form.Item name="code" initialValue="">
<input className={styles.input5} />
</Form.Item>
<div className={styles.button2} style={{ float: 'right' }} onClick={handleSend}>
<div
className={styles.button2 + ' ' + (timing ? '' : userName && styles.active)}
style={{ float: 'right' }}
onClick={handleSend}
>
{timing ? `${count} 秒` : 'Send'}
</div>
</div>
) : (
<div>
<Form.Item name="password" initialValue="">
<input className={styles.input2} type="password" />
<Input.Password className={styles.input2} />
</Form.Item>
<div>
<div className={styles.input3} onClick={gotoForgetHandle}>
Forget Password
</div>
<div className={styles.input4}>
{status === 'error' && loginType === 'account' && !submitting && (
<div>Wrong account or password</div>
)}
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Checkbox
checked={remenber}
className={styles.checkbox}
onChange={onRemenberChange}
>
Remenber me
</Checkbox>
<div className={styles.input3} onClick={gotoForgetHandle}>
Forget Password
</div>
</div>
</div>
</div>
)}
<div className={styles.input4}>
{resultLogin && (
<div>
<ExclamationCircleFilled style={{ fontSize: '20px', marginRight: '5px' }} />
{location.pathname === '/user/forget' ? 'MemberCode' : 'Wrong account or password'}
</div>
)}
</div>
<Form.Item>
<Button
style={{ width: 330, height: 50, fontSize: 20 }}
style={{
width: 330,
height: 50,
fontSize: 20,
backgroundColor: '#B4D87CFF',
borderColor: '#B4D87CFF',
marginTop: '40px',
borderRadius: '16px',
}}
type="primary"
htmlType="submit"
shape="round"
>
{forgetflag ? 'Next' : 'Submit'}
{forgetflag ? 'Next' : 'Log In'}
</Button>
</Form.Item>
</Form>
......
......@@ -12,15 +12,16 @@ const Login2 = (props: {
result: React.SetStateAction<boolean>;
dispatch: any;
userName: string;
userStatus: number;
}) => {
const { history, result, dispatch, userName } = props;
const { history, result, dispatch, userName, userStatus } = props;
console.log(userName);
const [resetPwd, setResetPwd] = useState(false);
// const [resetPwd, setResetPwd] = useState(false);
useEffect(() => {
setResetPwd(result);
}, [result]);
// useEffect(() => {
// setResetPwd(result);
// }, [result]);
useEffect(() => {
if (!userName) {
......@@ -31,11 +32,16 @@ const Login2 = (props: {
// 修改密码
const onFinish = (values: Password) => {
console.log('修改密码');
/**
* @param 0 首次登录
* @param 1 修改密码
*/
dispatch({
type: 'login/reset',
payload: {
tosUserName: userName,
tosUserPwd: values.password,
userStatus,
},
});
};
......@@ -45,7 +51,7 @@ const Login2 = (props: {
<Form layout="vertical" onFinish={onFinish} requiredMark={false}>
<Form.Item
name="password"
label="Password"
label="New password"
rules={[
{
required: true,
......@@ -60,7 +66,7 @@ const Login2 = (props: {
<Form.Item
name="confirm"
label="Confirm Password"
label="Confirm the new password"
dependencies={['password']}
hasFeedback
className={styles.passStyle}
......@@ -83,7 +89,7 @@ const Login2 = (props: {
</Form.Item>
<Form.Item className={styles.passBtn}>
<Button size="large" type="primary" shape="round" htmlType={'submit'}>
{resetPwd ? 'Submit' : 'Accomplish'}
Confirm
</Button>
</Form.Item>
</Form>
......@@ -91,9 +97,9 @@ const Login2 = (props: {
);
};
function map(state: { login: { result: boolean; userName: string } }) {
const { result, userName } = state.login;
return { result, userName };
function map(state: { login: { result: boolean; userName: string; userStatus: number } }) {
const { result, userName, userStatus } = state.login;
return { result, userName, userStatus };
}
export default connect(map)(Login2);
......@@ -41,48 +41,81 @@
.box1 {
font-size: 20px;
font-family: 'PingFang SC';
font-weight: 800;
color: rgba(129, 152, 177, 1);
color: #8bc53fff;
margin-bottom: 20px;
}
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
-webkit-text-fill-color: #6a912cff !important;
transition: background-color 50000s ease-in-out 0s;
}
.input {
border: none;
background: none;
outline: none;
border-bottom: 1px solid rgba(78, 80, 105, 1);
background-color: #add65457;
width: 330px;
margin-bottom: 20px;
font-size: 20px;
font-family: 'PingFang SC';
font-weight: 800;
color: rgba(0, 26, 84, 1);
padding: 4px 11px;
color: #6a912cff;
box-shadow: none !important;
input {
background-color: transparent;
border: 0 !important;
}
}
.input2 {
border: none;
background: none;
outline: none;
border-bottom: 1px solid rgba(78, 80, 105, 1);
background-color: #add65457;
width: 330px;
font-size: 20px;
font-family: 'PingFang SC';
font-weight: 800;
color: rgba(0, 26, 84, 1);
box-shadow: none !important;
input {
background-color: transparent;
border: 0 !important;
color: #6a912cff !important;
}
}
.input3 {
cursor: pointer;
font-size: 20px;
font-size: 14px;
font-family: 'PingFang SC';
font-weight: 800;
color: rgba(0, 26, 84, 1);
opacity: 0.3;
color: #8bc53fff;
}
.checkbox {
color: #8bc53fff;
:global {
.ant-checkbox-checked .ant-checkbox-inner:after {
border-color: #8bc53fff !important;
}
.ant-checkbox-checked .ant-checkbox-inner {
background-color: #fff;
border-color: #8bc53fff;
}
}
}
.input4 {
width: 400px;
height: 20px;
font-size: 20px;
font-size: 14px;
font-family: PingFang SC;
font-weight: 800;
font-weight: 600;
color: rgba(255, 56, 56, 1);
margin-top: 14px;
}
.button {
width: 100px;
......@@ -95,19 +128,20 @@
border: none;
background: none;
outline: none;
border-bottom: 1px solid rgba(78, 80, 105, 1);
width: 176px;
font-size: 20px;
font-family: 'PingFang SC';
font-weight: 800;
color: rgba(0, 26, 84, 1);
color: #6a912cff;
background-color: #add65457;
padding-left: 10px;
box-sizing: border-box;
}
.button2 {
width: 120px;
height: 34px;
border-radius: 26px;
background: none;
border: 1px solid rgba(78, 80, 105, 1);
border: 1px solid #8bc53fff;
line-height: 34px;
text-align: center;
position: absolute;
......@@ -118,7 +152,12 @@
font-size: 20px;
font-family: 'PingFang SC';
font-weight: 800;
color: rgba(0, 26, 84, 1);
color: #8bc53fff;
opacity: 0.3;
&.active {
opacity: 1;
}
}
.box2 {
width: 100%;
......@@ -132,14 +171,13 @@
.ant-form-item-required {
font-size: 20px;
font-family: 'PingFang SC';
font-weight: 800;
color: rgba(129, 152, 177, 1);
color: #8bc53fff;
}
.ant-form-item-control-input {
width: 330px;
border-bottom: 1px solid rgba(78, 80, 105, 1);
box-shadow: none;
background-color: #add65457;
}
.ant-input-affix-wrapper-focused {
......@@ -147,12 +185,24 @@
}
}
}
:global {
.ant-form-item-has-error .ant-input,
.ant-form-item-has-error .ant-input-affix-wrapper,
.ant-form-item-has-error .ant-input:hover,
.ant-form-item-has-error .ant-input-affix-wrapper:hover {
background: transparent !important;
}
}
.passBtn {
margin-top: 80px;
:global {
.ant-btn {
width: 330px;
height: 51px;
font-size: 20px;
background-color: #8bc53fff;
border: 0;
}
}
}
......@@ -45,18 +45,13 @@ export async function getFakeCaptcha(mobile: string) {
}
export async function getCaptcha(email: object) {
console.log('获取验证码');
console.log(email);
return request('/tos/send/code', { method: 'POST', data: email });
}
export async function ValidateCaptcha(params: CodeType) {
console.log('校验验证码');
console.log(params);
return request('/tos/validate/code', { method: 'POST', data: params });
}
export async function resetPassword(params: PwdType) {
console.log('重置密码');
return request('/tos/user/resetPwd', { method: 'POST', data: params });
}
......@@ -6,7 +6,7 @@
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\log.ts
*/
import { message } from 'antd';
// import { message } from 'antd';
export const printf = (playload: any, resp: any) => {
console.log('请求错误码:' + '(' + playload.index + ')' + resp.error_code);
......@@ -22,12 +22,14 @@ export const logOut = () => {
// 清掉本域名所有cookie
let keys = document.cookie.match(/[^ =;]+(?==)/g);
if (keys) {
for (var i = keys.length; i--; ) {
document.cookie = keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString();
document.cookie =
keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + new Date(0).toUTCString();
document.cookie =
keys[i] + '=0;path=/;domain=ratingdog.cn;expires=' + new Date(0).toUTCString();
for (var i = keys.length; i--;) {
if (keys[i] !== "remenberUserName" && keys[i] !== "remenberPwd") {
document.cookie = keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString();
document.cookie =
keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + new Date(0).toUTCString();
document.cookie =
keys[i] + '=0;path=/;domain=ratingdog.cn;expires=' + new Date(0).toUTCString();
}
}
}
window.location.pathname = '/user/login';
......
......@@ -48,11 +48,17 @@ export const getCookie = (key: string) => {
return '';
};
export const setCookie = (key: string, value: string) => {
// cookie 设置时间,防止刷新就丢失
var d = new Date();
d.setTime(d.getTime() + 1 * 24 * 60 * 60 * 1000);
var expires = 'expires=' + d.toUTCString();
export const setCookie = (key: string, value: string, time?: number) => {
let expires: string;
// 是否传入缓存时间
if (time) {
expires = "expores=" + time;
} else {
// cookie 设置时间,防止刷新就丢失
var d = new Date();
d.setTime(d.getTime() + 1 * 24 * 60 * 60 * 1000);
expires = 'expires=' + d.toUTCString();
}
document.cookie = key + '=' + value + '; ' + expires + ';path=/';
};
......
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