| | |
| | | import qs from 'qs'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { getToken, Message } from '@/utils'; |
| | | import { isWeb, isWeChat } from '@/utils/env'; |
| | | import { tokenIsExpired, SensitiveManage } from '@life-payment/utils'; |
| | | import { useUserStoreWithOut } from '@/stores/modules/user'; |
| | | |
| | |
| | | } |
| | | |
| | | export function endLoading() { |
| | | Taro.hideNavigationBarLoading(); |
| | | if (isWeChat) { |
| | | Taro.hideNavigationBarLoading(); |
| | | } |
| | | Taro.hideLoading(); |
| | | } |
| | | |
| | |
| | | REDIRECT = 9, |
| | | } |
| | | // 与后端约定的响应数据格式 |
| | | interface ResponseStructure { |
| | | export interface ResponseStructure { |
| | | success: boolean; |
| | | data: any; |
| | | /** |
| | |
| | | } |
| | | |
| | | const AxiosOptions: AxiosRequestConfig = { |
| | | baseURL: process.env.BASE_URL, |
| | | baseURL: isWeb ? process.env.BASE_URL_H5 : process.env.BASE_URL, |
| | | timeout: 10 * 1000, |
| | | headers: { |
| | | Accept: 'application/json, text/plain, */*', |
| | |
| | | withCredentials: true, |
| | | }; |
| | | |
| | | const config: RequestConfig<ResponseStructure, IRequestOptions> = { |
| | | export const config: RequestConfig<ResponseStructure, IRequestOptions> = { |
| | | ...AxiosOptions, |
| | | |
| | | errorConfig: { |