Commit 48f179ed authored by hewenhao's avatar hewenhao

feat: 更新账户

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