Commit d411c48b authored by Sixiang_Zzb's avatar Sixiang_Zzb

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

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