Commit 48f179ed authored by hewenhao's avatar hewenhao

feat: 更新账户

parent 565369f4
...@@ -113,7 +113,7 @@ export function getAreaAndGrades () { ...@@ -113,7 +113,7 @@ export function getAreaAndGrades () {
}).then(({ data }) => data) }).then(({ data }) => data)
} }
export const completeGuide = () => requestAfterSilentLogin<void, { userId?: number }>(user => ({ export const receivePoint = () => requestAfterSilentLogin<void, { userId?: number }>(user => ({
method: 'GET', method: 'GET',
url: '/service-idea/stage/user/receivePoint', url: '/service-idea/stage/user/receivePoint',
data: { userId: user?.userId } data: { userId: user?.userId }
......
...@@ -52,7 +52,14 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => { ...@@ -52,7 +52,14 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
}, [updateGuideActive, isMainGuideComplete]) }, [updateGuideActive, isMainGuideComplete])
const loadData = useCallback(() => { const loadData = useCallback(() => {
return getAreaAndGrades().then(setData) return getAreaAndGrades()
.then(setData)
.catch(() => {
setData({
areas: ['成都', '重庆', '宜宾', '自贡', '乐山', '南充', '遂宁', '德阳', '其他'],
grades: ['一年级', '二年级', '三年级', '四年级', '五年级', '六年级']
})
})
}, []) }, [])
const handleConfirmArea = useCallback((val: string) => { const handleConfirmArea = useCallback((val: string) => {
......
import { View, RootPortal, Image, Button } from '@tarojs/components' import { View, RootPortal, Image, Button } from '@tarojs/components'
import { showToast } from '@tarojs/taro' import { showToast } from '@tarojs/taro'
import { useBoolean } from '@/hooks' import { useBoolean } from '@/hooks'
import { completeGuide } from '@/api' import { receivePoint } from '@/api'
import giftAssets from '@/assets/oss/assets-gift' import giftAssets from '@/assets/oss/assets-gift'
import styles from './shared.module.scss' import styles from './shared.module.scss'
...@@ -17,7 +17,7 @@ const ModalReceivePoint = (props: ReceivePointProps) => { ...@@ -17,7 +17,7 @@ const ModalReceivePoint = (props: ReceivePointProps) => {
if (loading) return if (loading) return
loadingActions.setTrue() loadingActions.setTrue()
try { try {
await completeGuide() await receivePoint()
loadingActions.setFalse() loadingActions.setFalse()
onConfirm && onConfirm() onConfirm && onConfirm()
} catch (err) { } catch (err) {
......
...@@ -70,6 +70,7 @@ const guideModel: GuideModel = { ...@@ -70,6 +70,7 @@ const guideModel: GuideModel = {
const newUserInfo = { ...userInfo, pointReceive: 'Y' } as UserInfo const newUserInfo = { ...userInfo, pointReceive: 'Y' } as UserInfo
updateStorage(StorageKeys.userInfo, newUserInfo) updateStorage(StorageKeys.userInfo, newUserInfo)
helpers.getStoreActions().userModel.updateState({ userInfo: newUserInfo }) helpers.getStoreActions().userModel.updateState({ userInfo: newUserInfo })
helpers.getStoreActions().userModel.fetchAccount()
}), }),
nextGroupGuide: action(state => { nextGroupGuide: action(state => {
state.groupGuideStep += 1 state.groupGuideStep += 1
......
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