Commit d411c48b authored by Sixiang_Zzb's avatar Sixiang_Zzb

LIFE用户管理模块测试bug处理

parent 03026ae7
......@@ -114,10 +114,12 @@ export default {
}
break;
// 删除失败的案例
// case 16:{
// Result = resp;
// yield put({ type: 'returnResult', Result });
// } break;
case 16:
{
Result = resp;
yield put({ type: 'returnResult', Result });
}
break;
}
} else {
switch (playload.index) {
......
......@@ -57,9 +57,7 @@ const CardAdd = (props: any) => {
if (communityInfo != null) {
form.setFieldsValue({
zipCode:
communityInfo.data.rows.residentialAddress +
' SINGAPORE' +
communityInfo.data.rows.residentialZipCode,
communityInfo.data.rows.residentialAddress + communityInfo.data.rows.residentialZipCode,
});
}
}, [communityInfo]);
......
......@@ -27,7 +27,6 @@ const ChargeManager = (props: any) => {
const unit = formatMessage({ id: 'R.charge.unit' });
const submissionTime = formatMessage({ id: 'R.charge.submissionTime' });
const actions = formatMessage({ id: 'R.charge.actions' });
const addaccount = formatMessage({ id: 'R.charge.addaccount' });
const [loading, setLoading] = useState(false);
......
......@@ -132,6 +132,7 @@ const Users = (props: any) => {
// 监听路由变化更新数据
useEffect(() => {
console.log(readyData);
if (location.query) {
readyData = {
...readyData,
......@@ -262,7 +263,7 @@ const Users = (props: any) => {
pagination={
Data != null
? {
current: readyData.pageNum,
defaultCurrent: parseInt(readyData.pageNum),
total: Data.data.page.totalRow,
showSizeChanger: false,
pageSize: Data.data.page.curPageSize,
......
......@@ -46,9 +46,7 @@ const UsersAdd = (props: any) => {
if (postman.extend != null) {
formRef.current.setFieldsValue({
addressAndpostalCode:
communityInfo.data.rows.residentialAddress +
' SINGAPORE' +
communityInfo.data.rows.residentialZipCode,
communityInfo.data.rows.residentialAddress + communityInfo.data.rows.residentialZipCode,
});
}
}
......
......@@ -94,13 +94,18 @@ const UsersDetail = (props: any) => {
}, [Result]);
useEffect(() => {
console.log(returnValue);
if (returnValue != null) {
message.success('Delete Successfully!');
RA(13, {
id: DataSave.id,
owerName: DataSave.owerName,
enable: DataSave.enable,
});
if (returnValue.error_code !== '0001') {
message.success('Delete Successfully!', 3);
RA(13, {
id: DataSave.id,
owerName: DataSave.owerName,
enable: DataSave.enable,
});
} else {
message.error(returnValue.error_msg, 3);
}
}
}, [returnValue]);
......@@ -192,10 +197,10 @@ const UsersDetail = (props: any) => {
const checkData = (rule: any, value: any, callback: any) => {
if (value) {
if (/^\d{11}$/g.test(value)) {
if (/^1\d{7}|1[3|5|7|8]\d{9}$/g.test(value)) {
callback();
} else {
callback(new Error('Please enter the correct cell phone number!'));
callback(new Error('Incorrect format of mobile phone number!'));
}
}
callback('*it is required!');
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button,Form,Upload } from 'antd';
import { Input, Menu, Table, Space, Pagination, Tooltip, Button, Form, Upload } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
......@@ -12,62 +12,36 @@ import TableShow from '../../components/TableShow/TableShow';
import { getCookie } from '@/utils/method';
import PictureOptions from '@/components/PictureOptions/PictureOptions';
const Guard = (props:any) => {
const Guard = (props: any) => {
const { dispatch, CommunityList, token } = props;
const tosCommunityget = (values: any) => {
dispatch({ type: 'Init/tosCommunityget', playload: values });
};
// const [page, setPage] = useState({ token: '' });
const { dispatch, CommunityList,token} = props;
const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) };
const [page, setPage] = useState({ token: "" })
useEffect(() => {
tosCommunityget(null)
setPage({ token: getCookie("token") });
}, []);
tosCommunityget(null);
// setPage({ token: getCookie('token') });
}, []);
const onFinish = (values:any) => {
console.log(values)
}
const uploadButton = (
<div>
<div className="ant-upload-text">Upload</div>
</div>
);
return (
<div className={styles.base}>
<TitleGet title={"Version 1.2.4"} />
<p>
token:{page.token}
name:{getCookie("name")}
phone:{getCookie("phone")}
</p>
{
/* <Form name="basic" onFinish={onFinish}>
<Form.Item name="">
<PictureOptions
data={{
userToken: token,
imageType: 'categoriesImageName',
extends: "extend",
}} />
</Form.Item>
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</Form> */
}
{/* <TableShow /> */}
{/* <div>{token}</div>
<Line /> */}
<TitleGet title={'Version 1.2.4'} />
{/* <p>
token:{page.token}
name:{getCookie('name')}
phone:{getCookie('phone')}
</p> */}
</div>
);
};
function mapStateToProps(state:any) {
const { CommunityList } = state.Init;
const { token } = state.login;
function mapStateToProps(state: any) {
const { CommunityList } = state.Init;
const { token } = state.login;
return {
CommunityList,
token
token,
};
}
......
......@@ -4,7 +4,7 @@ import {
WeiboCircleOutlined,
ArrowLeftOutlined,
} from '@ant-design/icons';
import { Alert, Checkbox, Input } from 'antd';
import { Alert, Checkbox, Input, message, Form, Button } from 'antd';
import React, { useState, useEffect } from 'react';
import { Link, connect, Dispatch, history, Redirect } from 'umi';
import { StateType } from '@/models/login';
......@@ -27,22 +27,31 @@ const Login: React.FC<LoginProps> = (props) => {
const { status, type: loginType } = userLogin;
const [type, setType] = useState<string>('account');
const [userName, setUsername] = useState('');
const [password, setPasswd] = useState('');
// const [userName, setUsername] = useState('');
// const [password, setPasswd] = useState('');
const [forgetflag, setForgetFlag] = useState(false);
const { dispatch } = props;
const handleSubmit = (values: LoginParamsType) => {
const { dispatch } = props;
dispatch({
type: 'login/login',
payload: { userName, password },
});
};
const usernameHandle = (e: any) => {
setUsername(e.target.value);
};
const passwdHandle = (e: any) => {
setPasswd(e.target.value);
console.log(values);
if (forgetflag) {
console.log('验证码!');
}
if (values.userName !== '' && values.password !== '') {
dispatch({
type: 'login/login',
payload: { ...values },
});
} else {
message.error('The username or password cannot be empty!');
}
};
// const usernameHandle = (e: any) => {
// setUsername(e.target.value);
// };
// const passwdHandle = (e: any) => {
// setPasswd(e.target.value);
// };
const returnHandle = (e: any) => {
history.push('/user/login');
......@@ -52,20 +61,18 @@ const Login: React.FC<LoginProps> = (props) => {
};
const handleSend = (e: any) => {
console.log('触发了发送事件', e);
console.log(password);
console.log(userName);
if (
password !== '' &&
/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(password)
userName !== '' &&
/^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(userName)
) {
console.log('邮箱正确!');
console.log(Captcha);
} else {
console.log('邮箱格式错误!');
message.warning('Please enter the correct email address!');
}
};
const { location } = props;
const [forgetflag, setForgetFlag] = useState(false);
useEffect(() => {
if (location.pathname == '/user/forget') {
setForgetFlag(true);
......@@ -76,17 +83,21 @@ const Login: React.FC<LoginProps> = (props) => {
return (
<div>
{forgetflag ? (
{/* {forgetflag ? (
<div style={{ position: 'absolute', top: -50, cursor: 'pointer' }} onClick={returnHandle}>
<ArrowLeftOutlined style={{ fontSize: '28px' }} />
</div>
) : (
<div />
)}
<div />
)}
<LoginForm activeKey={type} onTabChange={setType} onSubmit={handleSubmit}>
<div className={styles.box1}>Account Number</div>
<div className={styles.box1}>
{forgetflag ? 'Please enter email address' : 'Account Name'}
</div>
<input className={styles.input} onChange={usernameHandle} />
<div className={styles.box1}>{forgetflag ? 'Please enter email address' : 'Password'}</div>
<div className={styles.box1}>
{forgetflag ? 'Please enter a verification code' : 'Password'}
</div>
{forgetflag ? (
<div className={styles.box2}>
<input className={styles.input5} onChange={passwdHandle} />
......@@ -95,24 +106,76 @@ const Login: React.FC<LoginProps> = (props) => {
</div>
</div>
) : (
<div>
<input className={styles.input2} onChange={passwdHandle} type="password" />
<div>
<input className={styles.input2} onChange={passwdHandle} type="password" />
<div>
<div className={styles.input3} onClick={gotoForgetHandle}>
Forget Password
<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>
<div className={styles.input4}>
{status === 'error' && loginType === 'account' && !submitting && (
<div>Wrong account or password</div>
)}
</div>
</div>
)}
</div>
)}
<Submit className={styles.button} loading={submitting} style={{ width: 330 }}>
{forgetflag ? 'Next' : '登录'}
</Submit>
</LoginForm>
</LoginForm> */}
{forgetflag ? (
<div style={{ position: 'absolute', top: -50, cursor: 'pointer' }} onClick={returnHandle}>
<ArrowLeftOutlined style={{ fontSize: '28px' }} />
</div>
) : (
<div />
)}
<Form onFinish={handleSubmit}>
<div className={styles.box1}>
{forgetflag ? 'Please enter email address' : 'Account Name'}
</div>
<Form.Item name="userName">
<input className={styles.input} />
</Form.Item>
<div className={styles.box1}>
{forgetflag ? 'Please enter a verification code' : 'Password'}
</div>
{forgetflag ? (
<div className={styles.box2}>
<input className={styles.input5} />
<div className={styles.button2} style={{ float: 'right' }} onClick={handleSend}>
Send
</div>
</div>
) : (
<div>
<Form.Item name="password">
<input className={styles.input2} type="password" />
</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>
</div>
</div>
)}
<Form.Item>
<Button
style={{ width: 330, height: 50, fontSize: 20 }}
type="primary"
htmlType="submit"
shape="round"
>
{forgetflag ? 'Next' : 'Submit'}
</Button>
</Form.Item>
</Form>
</div>
);
};
......
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