Small fix
This commit is contained in:
@@ -111,7 +111,7 @@
|
||||
"frameworks" : [] /*调用Native.js调用原生Objective-c API需要引用的FrameWork,如需调用GameCenter,则添加"GameKit.framework"*/
|
||||
},
|
||||
"google" : {
|
||||
"packagename" : "org.faronear.fiv", /*Android应用包名,如io.dcloud.HelloH5*/
|
||||
"packagename" : "org.tacever.fiv", /*Android应用包名,如io.dcloud.HelloH5*/
|
||||
"keystore" : "unpackage/key/fiv.keystore", /*Android应用打包使用的密钥库文件*/
|
||||
"password" : "fiv2019lwhx", /*Android应用打包使用密钥库中证书的密码*/
|
||||
"aliasname" : "fiv", /*Android应用打包使用密钥库中证书的别名*/
|
||||
|
||||
@@ -9,8 +9,8 @@ export default {
|
||||
],
|
||||
baseURL: 'https://server.fiv.tacever.org/v1',
|
||||
// baseURL: 'http://yapi.faronear.org/mock/20/v1',
|
||||
linkAndroid: 'xxx',
|
||||
linkIOS: '',
|
||||
linkAndroid: 'https://fivhome.github.io/app/android.apk',
|
||||
linkIOS: 'https://fivapp.github.io',
|
||||
linkTelegram: 'https://t.me/fivhome',
|
||||
linkEmail: 'team-fiv@outlook.com',
|
||||
};
|
||||
|
||||
@@ -19,11 +19,8 @@ const MinePage: React.FC<HomeMineModelState & DispatchProp> = ({
|
||||
}) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!data || errorList) {
|
||||
dispatch({ type: 'homeMine/loadList', payload: false });
|
||||
}
|
||||
if (!info || errorBasic) {
|
||||
dispatch({ type: 'homeMine/loadBasic' });
|
||||
if (!data || errorList || !info || errorBasic) {
|
||||
dispatch({ type: 'homeMine/load' });
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Model } from 'dva';
|
||||
import { Mines, MineBasic } from '@/types/common';
|
||||
import { getMineList, getMineBasic, refresh, RefreshData } from './service';
|
||||
import { message } from 'antd';
|
||||
import { loadMineList } from '@/utils/storage';
|
||||
|
||||
export interface HomeMineModelState {
|
||||
refreshingList: boolean;
|
||||
@@ -27,6 +28,18 @@ const MineModel: Model = {
|
||||
} as HomeMineModelState,
|
||||
|
||||
effects: {
|
||||
*load(_, { put, all }) {
|
||||
const cached = loadMineList();
|
||||
if (cached && cached.length) {
|
||||
yield all([
|
||||
put({ type: 'loadList', payload: false }),
|
||||
put({ type: 'loadBasic' }),
|
||||
]);
|
||||
} else {
|
||||
yield put({ type: 'refresh' });
|
||||
}
|
||||
},
|
||||
|
||||
*loadList({ payload: refresh }, { put, call, select }) {
|
||||
const { refreshingList } = yield select((state: any) => state.homeMine);
|
||||
if (refreshingList) return;
|
||||
@@ -81,8 +94,11 @@ const MineModel: Model = {
|
||||
},
|
||||
|
||||
*refresh(_, { put, call, select }) {
|
||||
const { refreshingBasic } = yield select((state: any) => state.homeMine);
|
||||
if (refreshingBasic) return;
|
||||
const {
|
||||
homeMine: { refreshingBasic, refreshingList },
|
||||
user: { user },
|
||||
} = yield select();
|
||||
if (refreshingBasic || refreshingList || !user) return;
|
||||
|
||||
yield put({
|
||||
type: 'onUpdateState',
|
||||
@@ -92,7 +108,8 @@ const MineModel: Model = {
|
||||
errorList: false,
|
||||
});
|
||||
try {
|
||||
const info = (yield call(refresh)) as RefreshData;
|
||||
const info = (yield call(refresh, user.inviter)) as RefreshData;
|
||||
if (info && info.basic) {
|
||||
yield put({
|
||||
type: 'onUpdateState',
|
||||
info: info.basic,
|
||||
@@ -101,6 +118,7 @@ const MineModel: Model = {
|
||||
refreshingList: false,
|
||||
errorBasic: false,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
message.error(e.message);
|
||||
yield put({
|
||||
@@ -108,6 +126,7 @@ const MineModel: Model = {
|
||||
refreshingBasic: false,
|
||||
refreshingList: false,
|
||||
errorBasic: true,
|
||||
errorList: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -39,15 +39,17 @@ export async function getMineList(refresh = false): Promise<Mines> {
|
||||
throw Error(msg);
|
||||
}
|
||||
|
||||
export async function refresh(): Promise<RefreshData> {
|
||||
export async function refresh(inviter: string): Promise<RefreshData> {
|
||||
const {
|
||||
ok,
|
||||
data,
|
||||
msg,
|
||||
} = await http.get<RefreshData>('/fund/refresh');
|
||||
if (ok && data) {
|
||||
storeMineList(data);
|
||||
return data;
|
||||
} = await http.get<RefreshData>('/fund/refresh', { inviter });
|
||||
if (ok) {
|
||||
if (data && data.list) {
|
||||
storeMineList(data.list);
|
||||
}
|
||||
return data as any;
|
||||
}
|
||||
throw Error(msg);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface User {
|
||||
email?: string;
|
||||
token: string;
|
||||
inviteCode: string;
|
||||
inviter: string;
|
||||
}
|
||||
|
||||
export enum SendCodeType {
|
||||
|
||||
@@ -97,7 +97,7 @@ async function filter<T>(
|
||||
|
||||
function groupUrl(url: string, params?: any): string {
|
||||
const postfix = _.keys(params || {})
|
||||
.map(key => `${key}=${encodeURIComponent(params[key]) || ''}`)
|
||||
.map(key => `${key}=${encodeURIComponent(params[key] || '') || ''}`)
|
||||
.join('&');
|
||||
if (!postfix) return url;
|
||||
return `${url}?${postfix}`;
|
||||
|
||||
Reference in New Issue
Block a user