diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index e14484e..0fcaee4 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -172,4 +172,6 @@ export default { 'system.language': 'Language', 'system.currency': 'Currency', 'system.chooseLang': 'Choose Language', + + 'about.title': '关于第五维度', } diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index ae2f4d4..e161633 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -172,4 +172,6 @@ export default { 'system.language': '语言偏好', 'system.currency': '法币偏好', 'system.chooseLang': '请选择语言', + + 'about.title': '关于第五维度', } diff --git a/src/pages/about/index.tsx b/src/pages/about/index.tsx new file mode 100644 index 0000000..d1f4004 --- /dev/null +++ b/src/pages/about/index.tsx @@ -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 ( +
+
+
+ body +
+
+ ); +} + +export default AboutPage; diff --git a/src/pages/about/style.less b/src/pages/about/style.less new file mode 100644 index 0000000..6a1573f --- /dev/null +++ b/src/pages/about/style.less @@ -0,0 +1,9 @@ +.container { + height: 100%; + display: flex; + flex-direction: column; +} + +.body { + flex-grow: 1; +} diff --git a/src/pages/check/model.ts b/src/pages/check/model.ts index 62f27fa..173b598 100644 --- a/src/pages/check/model.ts +++ b/src/pages/check/model.ts @@ -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 }), + ]); } }, diff --git a/src/pages/check/style.less b/src/pages/check/style.less index c8e152c..0762b1e 100644 --- a/src/pages/check/style.less +++ b/src/pages/check/style.less @@ -58,7 +58,6 @@ .register { height: 100%; - padding-top: @header-height; display: flex; flex-direction: column; } diff --git a/src/pages/chphone/model.ts b/src/pages/chphone/model.ts index 83d41e2..32f3c2c 100644 --- a/src/pages/chphone/model.ts +++ b/src/pages/chphone/model.ts @@ -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' }), diff --git a/src/pages/chphone/service.ts b/src/pages/chphone/service.ts index b1453fc..d8f902c 100644 --- a/src/pages/chphone/service.ts +++ b/src/pages/chphone/service.ts @@ -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) { diff --git a/src/pages/home/market/index.tsx b/src/pages/home/market/index.tsx index 1795ac1..cfffe45 100644 --- a/src/pages/home/market/index.tsx +++ b/src/pages/home/market/index.tsx @@ -82,8 +82,8 @@ const CommunityPage: React.FC = ({ /> :
{(it.nickname && it.nickname[0]) || 'F'}
}
- {it.nickname} - {formatMessage({ id: 'home.community.time' })}{it.registryTime} + {it.nickname || it.phone} + {formatMessage({ id: 'home.community.time' })}{it.createdAt}
); diff --git a/src/pages/home/profile/index.tsx b/src/pages/home/profile/index.tsx index 40a8689..e5bfcec 100644 --- a/src/pages/home/profile/index.tsx +++ b/src/pages/home/profile/index.tsx @@ -52,6 +52,7 @@ const ProfilePage: React.FC = ({ className="group" logo={logoAbout} title="profile.about" + onClick={() => dispatch(routerRedux.push('/about'))} /> diff --git a/src/types/common.ts b/src/types/common.ts index 780e7cb..14ca8c8 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -252,7 +252,9 @@ export interface Inviter { nickname: string; - registryTime: string; + createdAt: string; + + phone: string; } export type Inviters = Inviter[];