完善地址
This commit is contained in:
@ -7,7 +7,7 @@ import VueHook from 'alova/vue'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { ContentTypeEnum, ResultEnum, ShowMessage } from './tools/enum'
|
||||
import { useUserStore } from '@/store'
|
||||
import { jump, SWITCH_TAB, NAVIGATE_TO } from '@/utils/tools'
|
||||
import { router } from '@/utils/tools'
|
||||
|
||||
// 配置动态Tag
|
||||
export const API_DOMAINS = {
|
||||
@ -72,13 +72,13 @@ const alovaInstance = createAlova({
|
||||
|
||||
if (!token) {
|
||||
toast.info('请先登录')
|
||||
jump('/pages/my/my', SWITCH_TAB, 500)
|
||||
router.switchTab('/pages/my/my', 500)
|
||||
throw new Error('[请求错误]:未登录')
|
||||
}
|
||||
|
||||
if (!mobile) {
|
||||
toast.info('请先绑定手机号')
|
||||
jump('/pages/login/mobile', NAVIGATE_TO, 500)
|
||||
router.navigateTo('/pages/login/mobile', 500)
|
||||
throw new Error('[请求错误]:未绑定手机号')
|
||||
}
|
||||
|
||||
@ -121,15 +121,13 @@ const alovaInstance = createAlova({
|
||||
|
||||
// 处理业务逻辑错误
|
||||
const { code, msg, data } = rawData as IResponse
|
||||
// if (code === ResultEnum.Unauthorized) {
|
||||
// if (config.meta?.toast !== false) {
|
||||
// toast.info(msg)
|
||||
// setTimeout(() => {
|
||||
// uni.navigateTo({ url: '/pages/login/mobile' })
|
||||
// })
|
||||
// }
|
||||
// throw new Error(`登录超时[${code}]:${msg}`)
|
||||
// }
|
||||
if (code === ResultEnum.Unauthorized) {
|
||||
if (config.meta?.toast !== false) {
|
||||
toast.info(msg)
|
||||
router.switchTab('/pages/my/my')
|
||||
}
|
||||
throw new Error(`登录超时[${code}]:${msg}`)
|
||||
}
|
||||
|
||||
if (code === ResultEnum.Success) {
|
||||
if (config.meta?.toast !== false && msg) {
|
||||
|
||||
Reference in New Issue
Block a user