From 130845d133c5559a5a78603de03ebf4d9e6fd98f Mon Sep 17 00:00:00 2001 From: saplf Date: Sun, 8 Sep 2019 15:23:46 +0800 Subject: [PATCH] About page&home/estate change --- src/app.ts | 5 +- src/assets/a_android.png | Bin 0 -> 1061 bytes src/assets/a_ios.png | Bin 0 -> 1063 bytes src/assets/a_telegram.png | Bin 0 -> 1515 bytes src/config.ts | 16 +++++++ src/locales/en-US.ts | 7 +++ src/locales/zh-CN.ts | 9 +++- src/pages/about/index.tsx | 78 +++++++++++++++++++++++++++++-- src/pages/about/style.less | 71 ++++++++++++++++++++++++++++ src/pages/home/estate/index.tsx | 5 +- src/pages/home/estate/model.ts | 35 +++++++++++++- src/pages/home/estate/service.ts | 18 +++++++ src/pages/routes.tsx | 1 - src/utils/h5plus.ts | 10 +--- src/utils/http.ts | 4 +- 15 files changed, 235 insertions(+), 24 deletions(-) create mode 100644 src/assets/a_android.png create mode 100644 src/assets/a_ios.png create mode 100644 src/assets/a_telegram.png create mode 100644 src/config.ts diff --git a/src/app.ts b/src/app.ts index 5063fc7..2c0b331 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,13 +1,10 @@ export const dva = { config: { - onError(err: ErrorEvent | any) { + onError(err: ErrorEvent) { err.preventDefault(); // tslint:disable-next-line: no-console console.error(err.message); - if (err.name === 'ChunkLoadError') { - location.reload(); - } }, }, }; diff --git a/src/assets/a_android.png b/src/assets/a_android.png new file mode 100644 index 0000000000000000000000000000000000000000..4a0185e65726fcb793415f31a79209951fd21ded GIT binary patch literal 1061 zcmV+=1ls$FP)pivR!rD?)WM00004bW%=J085D3!wGzd z000B5NklSQv3D-2$$sGdk%e4~o zCbMSkuI~*sGw*+*Z>Ij(7YM*^x6iuH_7+kWZ6 zVt6y1j;|m4YkI|nV88T_A#74#-adCLW<^3+1-}b4S|)0T$AVzLZotSGW{MYC!j6o1 zk<(%qQe~V-SisJd86Tokuw=%EJb^V=T*xP|r_SgIHp`lZ2bsW|i8+vbnootQ7isUpTz>@*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(ar{?#p=TA4ySdl) zbbY)$7e?r9?zKI>@*>ye1h|^J#_^!M*wuuWtGUkM(&IHvlWfO5(+y$mIS~%cH*AuFWjNkXHivmg0<`rS^qyvZ zd`~*F?I$C5VJQ=G7nZV9bgcZ-r1$@1a6D%GW{3S|Y$q3pf*A&_N4ZJR{T}5Ox-wgW zwR_IiMMcRR2~EQ%9dpN_Y|djK338(O$Q_Bskv|fenLkFWjN-zia36GHj(gW7dDgv;G+-0Ry3hKK4AP0Q(KWS3*V(u^qavs{{Jae&}1+aWW zrQ}tmY&sUksO3{S1%#0$E4*q6VGnkd_$*;eY*r{$(n#mOGgn3FHCXo&*se&7j8r9>VIoB%002ovPDHLkV1g>Y>(>AP literal 0 HcmV?d00001 diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..18b3d82 --- /dev/null +++ b/src/config.ts @@ -0,0 +1,16 @@ + +export default { + exitPaths: [ + '/check', + '/home/estate', + '/home/fund', + '/home/market', + '/home/profile', + ], + baseURL: 'https://server.fiv.tacever.org/v1', + // baseURL: 'http://yapi.faronear.org/mock/20/v1', + linkAndroid: 'xxx', + linkIOS: '', + linkTelegram: 'https://t.me/fivhome', + linkEmail: 'team-fiv@outlook.com', +}; diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index 0fe5b82..6e34ac3 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -174,4 +174,11 @@ export default { 'system.chooseLang': 'Choose Language', 'about.title': '关于第五维度', + 'about.desc': '数字货币财富管理平台', + 'about.appTitle': '下载 APP', + 'about.appDesc': '(点击相应图标获取 APP 下载地址)', + 'about.comTitle': '加入社区', + 'about.comDesc': '(点击相应图标获取社区地址)', + 'about.contact': '联系我们', + 'about.copyright': 'Copyright ©2019 第五维度', } diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index e0ca803..d7132a8 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -156,7 +156,7 @@ export default { 'profile.identity': '实名认证', 'profile.share': '社区推广', 'profile.msg': '消息中心', - 'profile.about': '关于洛格', + 'profile.about': '关于第五维度', 'account.title': '我的账户', 'account.nickname': '昵称', @@ -174,4 +174,11 @@ export default { 'system.chooseLang': '请选择语言', 'about.title': '关于第五维度', + 'about.desc': '数字货币财富管理平台', + 'about.appTitle': '下载 APP', + 'about.appDesc': '(点击相应图标获取 APP 下载地址)', + 'about.comTitle': '加入社区', + 'about.comDesc': '(点击相应图标获取社区地址)', + 'about.contact': '联系我们', + 'about.copyright': 'Copyright ©2019 第五维度', } diff --git a/src/pages/about/index.tsx b/src/pages/about/index.tsx index d1f4004..afce216 100644 --- a/src/pages/about/index.tsx +++ b/src/pages/about/index.tsx @@ -3,19 +3,89 @@ * Routes: * - ./src/pages/routes */ -import React from 'react'; -import Header from '@/components/Header'; +import React, { useState } from 'react'; import { formatMessage } from 'umi-plugin-locale'; +import FittedImage from 'react-fitted-image'; +import { Modal } from 'antd'; +import { QRCanvas } from 'qrcanvas-react'; +import Header from '@/components/Header'; +import config from '@/config'; +import logo from '@/assets/bg_login.png'; +import pAndroid from '@/assets/a_android.png'; +import pIOS from '@/assets/a_ios.png'; +import pTelegram from '@/assets/a_telegram.png'; import styles from './style.less'; const AboutPage: React.FC = () => { + const [info, setInfo] = useState(''); + + const showInfo = ( + setInfo('')} + > +
+ {info && } + {info} +
+
+ ); + return (
-
- body +
+
+ +
+ + {formatMessage({ id: 'app.name' })} + {formatMessage({ id: 'about.desc' })} + +
+ {(config.linkAndroid || config.linkIOS) && ( +
+ {formatMessage({ id: 'about.appTitle' })} + {formatMessage({ id: 'about.appDesc' })} +
+ {config.linkAndroid &&
setInfo(config.linkAndroid)}> +
+ Android +
} + {config.linkIOS &&
setInfo(config.linkIOS)}> +
+ iOS +
} +
+
+ )} + {config.linkTelegram && ( +
+ {formatMessage({ id: 'about.comTitle' })} + {formatMessage({ id: 'about.comDesc' })} +
+
setInfo(config.linkTelegram)}> +
+ Telegram +
+
+
+ )} +
+ {formatMessage({ id: 'about.contact' })} + {config.linkEmail} +
+
+ +
{formatMessage({ id: 'about.copyright' })}
+ {showInfo}
); } diff --git a/src/pages/about/style.less b/src/pages/about/style.less index 6a1573f..560c58f 100644 --- a/src/pages/about/style.less +++ b/src/pages/about/style.less @@ -1,3 +1,5 @@ +@import '../../global.less'; + .container { height: 100%; display: flex; @@ -6,4 +8,73 @@ .body { flex-grow: 1; + display: flex; + flex-direction: column; + align-items: center; + overflow-y: auto; + + :global { + .logo { + width: 64px; + margin: 16px 0 10px; + } + + .app-name, .app-desc { + color: #000; + font-size: 0.9rem; + } + + .app-desc { + margin-bottom: 20px; + } + } +} + +.content { + align-self: stretch; + border: 1px solid @hint-color; + margin: 0 20px; + border-radius: 4px; + padding: 20px; + display: flex; + flex-direction: column; + + :global { + .section { + display: flex; + flex-direction: column; + align-items: center; + } + + .section:nth-child(n+2) { + margin-top: 10px; + } + + .desc { + font-size: 0.8rem; + } + + .icon-list { + display: flex; + flex-direction: row; + justify-content: center; + } + + .icon-item { + display: flex; + flex-direction: column; + align-items: center; + margin: 8px 10px 0; + } + + .icon-icon { + width: 64px; + } + } +} + +.dlg { + display: flex; + flex-direction: column; + align-items: center; } diff --git a/src/pages/home/estate/index.tsx b/src/pages/home/estate/index.tsx index c986d8e..13d4937 100644 --- a/src/pages/home/estate/index.tsx +++ b/src/pages/home/estate/index.tsx @@ -20,7 +20,7 @@ const MinePage: React.FC = ({ useEffect(() => { if (!data || errorList) { - dispatch({ type: 'homeMine/loadList' }); + dispatch({ type: 'homeMine/loadList', payload: false }); } if (!info || errorBasic) { dispatch({ type: 'homeMine/loadBasic' }); @@ -29,8 +29,7 @@ const MinePage: React.FC = ({ const onRefresh = () => { if (refreshingBasic || refreshingList) return; - dispatch({ type: 'homeMine/loadList', payload: true }); - dispatch({ type: 'homeMine/loadBasic' }); + dispatch({ type: 'homeMine/refresh' }); }; const renderBanner = ( diff --git a/src/pages/home/estate/model.ts b/src/pages/home/estate/model.ts index 53ae02e..83224da 100644 --- a/src/pages/home/estate/model.ts +++ b/src/pages/home/estate/model.ts @@ -1,6 +1,7 @@ import { Model } from 'dva'; import { Mines, MineBasic } from '@/types/common'; -import { getMineList, getMineBasic } from './service'; +import { getMineList, getMineBasic, refresh, RefreshData } from './service'; +import { message } from 'antd'; export interface HomeMineModelState { refreshingList: boolean; @@ -78,6 +79,38 @@ const MineModel: Model = { }); } }, + + *refresh(_, { put, call, select }) { + const { refreshingBasic } = yield select((state: any) => state.homeMine); + if (refreshingBasic) return; + + yield put({ + type: 'onUpdateState', + refreshingBasic: true, + refreshingList: true, + errorBasic: false, + errorList: false, + }); + try { + const info = (yield call(refresh)) as RefreshData; + yield put({ + type: 'onUpdateState', + info: info.basic, + data: info.list, + refreshingBasic: false, + refreshingList: false, + errorBasic: false, + }); + } catch (e) { + message.error(e.message); + yield put({ + type: 'onUpdateState', + refreshingBasic: false, + refreshingList: false, + errorBasic: true, + }); + } + }, }, reducers: { diff --git a/src/pages/home/estate/service.ts b/src/pages/home/estate/service.ts index 3299368..f51a2c1 100644 --- a/src/pages/home/estate/service.ts +++ b/src/pages/home/estate/service.ts @@ -2,6 +2,11 @@ import http from '@/utils/http'; import { Mines, MineBasic } from '@/types/common'; import { loadMineList, storeMineList } from '@/utils/storage'; +export interface RefreshData { + basic: MineBasic; + list: Mines; +} + export async function getMineBasic(): Promise { const { ok, @@ -33,3 +38,16 @@ export async function getMineList(refresh = false): Promise { } throw Error(msg); } + +export async function refresh(): Promise { + const { + ok, + data, + msg, + } = await http.get('/fund/refresh'); + if (ok && data) { + storeMineList(data); + return data; + } + throw Error(msg); +} diff --git a/src/pages/routes.tsx b/src/pages/routes.tsx index 164f7b1..031b76d 100644 --- a/src/pages/routes.tsx +++ b/src/pages/routes.tsx @@ -7,7 +7,6 @@ import styles from './index.css'; const unauthorizedPaths = [ '/check', - '/register', ]; const Page: React.FC = ({ diff --git a/src/utils/h5plus.ts b/src/utils/h5plus.ts index a7f57fd..345a099 100644 --- a/src/utils/h5plus.ts +++ b/src/utils/h5plus.ts @@ -1,5 +1,6 @@ import { dispatch, getState } from './utils'; import { routerRedux } from 'dva'; +import config from '@/config'; const isApp = () => { const r = typeof window.plus !== 'undefined'; @@ -32,13 +33,6 @@ const scan = () => { }); }; -const firstPaths = [ - '/check', - '/home/estate', - '/home/fund', - '/home/market', - '/home/profile', -]; const backButtonHandler = () => { const barcode = window.plus.barcode.getBarcodeById(barcodeId); if (barcode) { @@ -46,7 +40,7 @@ const backButtonHandler = () => { return; } const { pathname } = getState().router.location; - if (firstPaths.includes(pathname)) { + if (config.exitPaths.includes(pathname)) { window.plus.runtime.quit(); } else { dispatch(routerRedux.goBack()); diff --git a/src/utils/http.ts b/src/utils/http.ts index 95b8f61..1e57593 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -3,6 +3,7 @@ import { formatMessage } from 'umi-plugin-locale'; import _ from 'lodash'; import { globalState } from '@/services/common'; import { isDev, dispatch } from './utils'; +import config from '@/config'; export interface AppResp { ok: boolean, @@ -19,8 +20,7 @@ const errorMap = { 403: 'common.403', }; -const baseURL = 'https://server.fiv.tacever.org/v1'; -// const baseURL = 'http://yapi.faronear.org/mock/20/v1'; +const { baseURL } = config; const instance = axios.create({ baseURL, });