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