Commit 536b967c authored by raca's avatar raca

Merge branch 'feature/2023-04-19-iter' of…

Merge branch 'feature/2023-04-19-iter' of https://118.24.71.244/hewenhao/GeekLearnMathWeapp into feature/2023-04-19-iter
parents 9b3652cc e90d4cf8
...@@ -29,7 +29,6 @@ const MainPage = () => { ...@@ -29,7 +29,6 @@ const MainPage = () => {
const stageList = useStoreState(state => state.mainModel.stageList) const stageList = useStoreState(state => state.mainModel.stageList)
const player = useStoreState(state => state.mainModel.player) const player = useStoreState(state => state.mainModel.player)
const isReady = useStoreState(state => state.mainModel.isReady) const isReady = useStoreState(state => state.mainModel.isReady)
const point = useStoreState(state => state.userModel.point)
const isGroupGuideComplete = useStoreState(state => state.guideModel.isGroupGuideComplete) const isGroupGuideComplete = useStoreState(state => state.guideModel.isGroupGuideComplete)
const isMainGuideComplete = useStoreState(state => state.guideModel.isMainGuideComplete) const isMainGuideComplete = useStoreState(state => state.guideModel.isMainGuideComplete)
const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount) const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount)
...@@ -58,12 +57,14 @@ const MainPage = () => { ...@@ -58,12 +57,14 @@ const MainPage = () => {
isGroupGuideComplete || isGroupGuideComplete ||
userInfo.pointReceive === 'N' || userInfo.pointReceive === 'N' ||
!userInfo.city || !userInfo.city ||
!userInfo.grade !userInfo.grade ||
stageList.length < 1
) { ) {
return return
} }
const currentIndex = stageList.findIndex(c => c.status === StageStatus.CURRENT) const currentIndex = stageList.findIndex(c => c.status === StageStatus.CURRENT)
const point = await fetchAccount()
if (point < 50 || currentIndex >= 3) { if (point < 50 || currentIndex >= 3) {
const res = await fetchTribeInfo() const res = await fetchTribeInfo()
...@@ -73,7 +74,7 @@ const MainPage = () => { ...@@ -73,7 +74,7 @@ const MainPage = () => {
} }
} }
fn() fn()
}, [point, isGroupGuideComplete, stageList, updateGroupGuideActive, userInfo, fetchTribeInfo, isMainGuideComplete, isFocus]) }, [fetchAccount, isGroupGuideComplete, stageList, updateGroupGuideActive, userInfo, fetchTribeInfo, isMainGuideComplete, isFocus])
onAppHide(() => { onAppHide(() => {
player.pause() player.pause()
......
...@@ -18,7 +18,7 @@ export interface UserModel { ...@@ -18,7 +18,7 @@ export interface UserModel {
updating: boolean; updating: boolean;
isEyeProtectionMode: boolean; isEyeProtectionMode: boolean;
updateState: Action<UserModel, Partial<State<UserModel>>>; updateState: Action<UserModel, Partial<State<UserModel>>>;
fetchAccount: Thunk<UserModel, void, void, AppStoreModel>; fetchAccount: Thunk<UserModel, void, void, AppStoreModel, Promise<number>>;
setting: SettintType; setting: SettintType;
getSetting: Thunk<UserModel, void, void, AppStoreModel>; getSetting: Thunk<UserModel, void, void, AppStoreModel>;
updateUserInfo: Thunk<UserModel, Partial<UpdateUserInfoIn>, void, AppStoreModel>; updateUserInfo: Thunk<UserModel, Partial<UpdateUserInfoIn>, void, AppStoreModel>;
...@@ -144,8 +144,10 @@ const userModel: UserModel = { ...@@ -144,8 +144,10 @@ const userModel: UserModel = {
const cardNum = list.find(c => c.accountType === 'CARD')?.amount ?? 0 const cardNum = list.find(c => c.accountType === 'CARD')?.amount ?? 0
const point = list.find(c => c.accountType === 'POINT')?.amount ?? 0 const point = list.find(c => c.accountType === 'POINT')?.amount ?? 0
actions.updateState({ cardNum, point }) actions.updateState({ cardNum, point })
return point
} catch (err) { } catch (err) {
actions.updateState({ cardNum: 0, point: 0 }) actions.updateState({ cardNum: 0, point: 0 })
return 0
} }
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment