fix: 修复BUG
This commit is contained in:
parent
9652712677
commit
fbe68ba683
|
@ -2,7 +2,6 @@ import {
|
||||||
AxiosConfig,
|
AxiosConfig,
|
||||||
AxiosResponse,
|
AxiosResponse,
|
||||||
AxiosRequestHeaders,
|
AxiosRequestHeaders,
|
||||||
AxiosError,
|
|
||||||
InternalAxiosRequestConfig
|
InternalAxiosRequestConfig
|
||||||
} from './types'
|
} from './types'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
@ -76,10 +75,6 @@ const defaultRequestInterceptors = (config: InternalAxiosRequestConfig) => {
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
;(error: AxiosError) => {
|
|
||||||
console.log(error)
|
|
||||||
Promise.reject(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultResponseInterceptors = (response: AxiosResponse<any>) => {
|
const defaultResponseInterceptors = (response: AxiosResponse<any>) => {
|
||||||
if (response?.config?.responseType === 'blob') {
|
if (response?.config?.responseType === 'blob') {
|
||||||
|
@ -91,11 +86,6 @@ const defaultResponseInterceptors = (response: AxiosResponse<any>) => {
|
||||||
ElMessage.error(response.data.message)
|
ElMessage.error(response.data.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;(error: AxiosError) => {
|
|
||||||
console.log('err' + error) // for debug
|
|
||||||
ElMessage.error(error.message)
|
|
||||||
return Promise.reject(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
export { defaultResponseInterceptors, defaultRequestInterceptors }
|
export { defaultResponseInterceptors, defaultRequestInterceptors }
|
||||||
export default config
|
export default config
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import axios from 'axios'
|
import axios, { AxiosError } from 'axios'
|
||||||
import config, { defaultRequestInterceptors, defaultResponseInterceptors } from './config'
|
import config, { defaultRequestInterceptors, defaultResponseInterceptors } from './config'
|
||||||
|
|
||||||
import { AxiosInstance, InternalAxiosRequestConfig, RequestConfig, AxiosResponse } from './types'
|
import { AxiosInstance, InternalAxiosRequestConfig, RequestConfig, AxiosResponse } from './types'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
const { interceptors, baseUrl } = config
|
const { interceptors, baseUrl } = config
|
||||||
export const PATH_URL = baseUrl[import.meta.env.VITE_API_BASE_PATH]
|
export const PATH_URL = baseUrl[import.meta.env.VITE_API_BASE_PATH]
|
||||||
|
@ -27,9 +28,13 @@ axiosInstance.interceptors.response.use(
|
||||||
(res: AxiosResponse) => {
|
(res: AxiosResponse) => {
|
||||||
const url = res.config.url || ''
|
const url = res.config.url || ''
|
||||||
abortControllerMap.delete(url)
|
abortControllerMap.delete(url)
|
||||||
return res.data
|
return res
|
||||||
},
|
},
|
||||||
(err: any) => err
|
(error: AxiosError) => {
|
||||||
|
console.log('err: ' + error) // for debug
|
||||||
|
ElMessage.error(error.message)
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
axiosInstance.interceptors.request.use(requestInterceptors || defaultRequestInterceptors)
|
axiosInstance.interceptors.request.use(requestInterceptors || defaultRequestInterceptors)
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
import introJs from 'intro.js'
|
|
||||||
import { IntroJs, Step, Options } from 'intro.js'
|
|
||||||
import 'intro.js/introjs.css'
|
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
|
||||||
import { useDesign } from '@/hooks/web/useDesign'
|
|
||||||
|
|
||||||
export const useIntro = (setps?: Step[], options?: Options) => {
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
const { variables } = useDesign()
|
|
||||||
|
|
||||||
const defaultSetps: Step[] = setps || [
|
|
||||||
{
|
|
||||||
element: `#${variables.namespace}-menu`,
|
|
||||||
title: t('common.menu'),
|
|
||||||
intro: t('common.menuDes'),
|
|
||||||
position: 'right'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
element: `#${variables.namespace}-tool-header`,
|
|
||||||
title: t('common.tool'),
|
|
||||||
intro: t('common.toolDes'),
|
|
||||||
position: 'left'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
element: `#${variables.namespace}-tags-view`,
|
|
||||||
title: t('common.tagsView'),
|
|
||||||
intro: t('common.tagsViewDes'),
|
|
||||||
position: 'bottom'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const defaultOptions: Options = options || {
|
|
||||||
prevLabel: t('common.prevLabel'),
|
|
||||||
nextLabel: t('common.nextLabel'),
|
|
||||||
skipLabel: t('common.skipLabel'),
|
|
||||||
doneLabel: t('common.doneLabel')
|
|
||||||
}
|
|
||||||
|
|
||||||
const introRef: IntroJs = introJs()
|
|
||||||
|
|
||||||
introRef.addSteps(defaultSetps).setOptions(defaultOptions)
|
|
||||||
|
|
||||||
return {
|
|
||||||
introRef
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +1,10 @@
|
||||||
import { createTypes, VueTypesInterface, VueTypeValidableDef } from 'vue-types'
|
import { VueTypeValidableDef, VueTypesInterface, createTypes, toValidableType } from 'vue-types'
|
||||||
import { CSSProperties } from 'vue'
|
import { CSSProperties } from 'vue'
|
||||||
|
|
||||||
// 自定义扩展vue-types
|
|
||||||
type PropTypes = VueTypesInterface & {
|
type PropTypes = VueTypesInterface & {
|
||||||
readonly style: VueTypeValidableDef<CSSProperties>
|
readonly style: VueTypeValidableDef<CSSProperties>
|
||||||
}
|
}
|
||||||
|
const newPropTypes = createTypes({
|
||||||
const propTypes = createTypes({
|
|
||||||
func: undefined,
|
func: undefined,
|
||||||
bool: undefined,
|
bool: undefined,
|
||||||
string: undefined,
|
string: undefined,
|
||||||
|
@ -15,15 +13,12 @@ const propTypes = createTypes({
|
||||||
integer: undefined
|
integer: undefined
|
||||||
}) as PropTypes
|
}) as PropTypes
|
||||||
|
|
||||||
// 需要自定义扩展的类型
|
class propTypes extends newPropTypes {
|
||||||
// see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
|
static get style() {
|
||||||
propTypes.extend([
|
return toValidableType('style', {
|
||||||
{
|
type: [String, Object]
|
||||||
name: 'style',
|
})
|
||||||
getter: true,
|
|
||||||
type: [String, Object],
|
|
||||||
default: undefined
|
|
||||||
}
|
}
|
||||||
])
|
}
|
||||||
|
|
||||||
export { propTypes }
|
export { propTypes }
|
||||||
|
|
Loading…
Reference in New Issue