bug fix
This commit is contained in:
23
src/pages/about/index.tsx
Normal file
23
src/pages/about/index.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Title: 地产详情
|
||||
* Routes:
|
||||
* - ./src/pages/routes
|
||||
*/
|
||||
import React from 'react';
|
||||
import Header from '@/components/Header';
|
||||
import { formatMessage } from 'umi-plugin-locale';
|
||||
|
||||
import styles from './style.less';
|
||||
|
||||
const AboutPage: React.FC = () => {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Header title={formatMessage({ id: 'about.title' })} />
|
||||
<div className={styles.body}>
|
||||
body
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AboutPage;
|
||||
9
src/pages/about/style.less
Normal file
9
src/pages/about/style.less
Normal file
@@ -0,0 +1,9 @@
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body {
|
||||
flex-grow: 1;
|
||||
}
|
||||
@@ -32,23 +32,25 @@ export interface CheckModelState {
|
||||
codeTimer: number;
|
||||
}
|
||||
|
||||
const initState: CheckModelState = {
|
||||
pageState: PageState.Pending,
|
||||
pageStep: PageStep.Check,
|
||||
areacodes: [],
|
||||
areacode: undefined,
|
||||
phone: '',
|
||||
password: '',
|
||||
pwdConfirm: '',
|
||||
inviter: '',
|
||||
verifyCode: '',
|
||||
submitting: false,
|
||||
sendingCode: false,
|
||||
codeTimer: -1,
|
||||
};
|
||||
|
||||
const model: Model = {
|
||||
namespace: 'check',
|
||||
|
||||
state: {
|
||||
pageState: PageState.Pending,
|
||||
pageStep: PageStep.Check,
|
||||
areacodes: [],
|
||||
areacode: undefined,
|
||||
phone: '',
|
||||
password: '',
|
||||
pwdConfirm: '',
|
||||
inviter: '',
|
||||
verifyCode: '',
|
||||
submitting: false,
|
||||
sendingCode: false,
|
||||
codeTimer: -1,
|
||||
} as CheckModelState,
|
||||
state: initState,
|
||||
|
||||
effects: {
|
||||
*back(_, { select, put }) {
|
||||
@@ -123,7 +125,7 @@ const model: Model = {
|
||||
}
|
||||
},
|
||||
|
||||
*submitLogin(_, { put, call, select }) {
|
||||
*submitLogin(_, { put, call, select, all }) {
|
||||
const { areacode, phone, password } = yield select((state: any) => state.check);
|
||||
if (!areacode) return message.warn(formatMessage({ id: 'check.msgArea' }));
|
||||
if (!validPhone(phone)) return message.warn(formatMessage({ id: 'check.msgPhone' }));
|
||||
@@ -135,16 +137,20 @@ const model: Model = {
|
||||
yield put({ type: 'user/updateToken', payload: token });
|
||||
yield delay(10);
|
||||
const user = yield call(getUserInfo, true);
|
||||
yield put({ type: 'user/updateUser', payload: user });
|
||||
yield all([
|
||||
put({ type: 'user/updateUser', payload: user }),
|
||||
put({ type: 'onUpdateState', ...initState }),
|
||||
]);
|
||||
} catch(e) {
|
||||
message.error(e.message);
|
||||
yield put({ type: 'user/logout' });
|
||||
} finally {
|
||||
yield put({ type: 'onUpdateState', submitting: false });
|
||||
yield all([
|
||||
put({ type: 'user/logout' }),
|
||||
put({ type: 'onUpdateState', submitting: false }),
|
||||
]);
|
||||
}
|
||||
},
|
||||
|
||||
*submitRegister(_, { put, select, call }) {
|
||||
*submitRegister(_, { put, select, call, all }) {
|
||||
const { areacode, phone, password, verifyCode, inviter, pwdConfirm } = yield select((state: any) => state.check);
|
||||
if (!areacode) return message.warn(formatMessage({ id: 'check.msgArea' }));
|
||||
if (!validPhone(phone)) return message.warn(formatMessage({ id: 'check.msgPhone' }));
|
||||
@@ -159,12 +165,16 @@ const model: Model = {
|
||||
yield put({ type: 'user/updateToken', payload: token });
|
||||
yield delay(10);
|
||||
const user = yield call(getUserInfo, true);
|
||||
yield put({ type: 'user/updateUser', payload: user });
|
||||
yield all([
|
||||
put({ type: 'user/updateUser', payload: user }),
|
||||
put({ type: 'onUpdateState', ...initState }),
|
||||
]);
|
||||
} catch(e) {
|
||||
message.error(e.message);
|
||||
yield put({ type: 'user/logout' });
|
||||
} finally {
|
||||
yield put({ type: 'onUpdateState', submitting: false });
|
||||
yield all([
|
||||
put({ type: 'user/logout' }),
|
||||
put({ type: 'onUpdateState', submitting: false }),
|
||||
]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
|
||||
.register {
|
||||
height: 100%;
|
||||
padding-top: @header-height;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { formatMessage } from 'umi-plugin-locale';
|
||||
import { validPwd, validPhone, validPhoneInput } from '@/utils/validate';
|
||||
import { changePhone, sendCode } from './service';
|
||||
import { dispatch } from '@/utils/utils';
|
||||
import { encodePhone } from '@/utils/transform';
|
||||
|
||||
export interface ChphoneModelState {
|
||||
pageState: PageState;
|
||||
@@ -75,8 +76,8 @@ const model: Model = {
|
||||
if (!code) return message.warn(formatMessage({ id: 'check.msgCode' }));
|
||||
yield put({ type: 'onUpdateState', submitting: true });
|
||||
try {
|
||||
yield call(changePhone, phone, code);
|
||||
yield put({ type: 'user/updateUser', payload: { phone } });
|
||||
yield call(changePhone, areacode, phone, code);
|
||||
yield put({ type: 'user/updateUser', payload: { phone: encodePhone(areacode, phone) } });
|
||||
Modal.success({
|
||||
okText: formatMessage({ id: 'common.iknow' }),
|
||||
title: formatMessage({ id: 'common.prompt' }),
|
||||
|
||||
@@ -2,9 +2,9 @@ import http from '@/utils/http';
|
||||
import { encodePhone } from '@/utils/transform';
|
||||
import { AreaCode } from '@/types/common';
|
||||
|
||||
export async function changePhone(phone: string, code: string) {
|
||||
export async function changePhone(areacode: AreaCode, phone: string, code: string) {
|
||||
const { ok, msg } = await http.post('/user/chphone', {
|
||||
phone,
|
||||
phone: encodePhone(areacode, phone),
|
||||
code,
|
||||
});
|
||||
if (ok) return;
|
||||
@@ -16,7 +16,7 @@ export async function sendCode(areacode: AreaCode, phone: string) {
|
||||
'/sign/send',
|
||||
{
|
||||
phone: encodePhone(areacode, phone),
|
||||
type: 'signUp',
|
||||
type: 'changePhone',
|
||||
},
|
||||
);
|
||||
if (ok) {
|
||||
|
||||
@@ -82,8 +82,8 @@ const CommunityPage: React.FC<HomeCommunityModelState & DispatchProp> = ({
|
||||
/> : <div className="fake">{(it.nickname && it.nickname[0]) || 'F'}</div>}
|
||||
</div>
|
||||
<div className="line">
|
||||
<span>{it.nickname}</span>
|
||||
<span className="time">{formatMessage({ id: 'home.community.time' })}{it.registryTime}</span>
|
||||
<span>{it.nickname || it.phone}</span>
|
||||
<span className="time">{formatMessage({ id: 'home.community.time' })}{it.createdAt}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -52,6 +52,7 @@ const ProfilePage: React.FC<UserModelState & DispatchProp> = ({
|
||||
className="group"
|
||||
logo={logoAbout}
|
||||
title="profile.about"
|
||||
onClick={() => dispatch(routerRedux.push('/about'))}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user