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