Commit 7e4c34ca by 胡悦

修复bug

1 parent 4d66a493
...@@ -11,7 +11,7 @@ import fetchConfig from './utils/config' ...@@ -11,7 +11,7 @@ import fetchConfig from './utils/config'
import VConsole from 'vconsole' import VConsole from 'vconsole'
import 'assets/styles/common.scss' import 'assets/styles/common.scss'
const app = createApp(App) const app = createApp(App)
const vConsole = new VConsole() let vConsole: object = {}
import { components } from './libs/vant' import { components } from './libs/vant'
components.forEach(component => app.use(component)); components.forEach(component => app.use(component));
app.component('svg-icon', SvgIcon) app.component('svg-icon', SvgIcon)
...@@ -19,6 +19,7 @@ app.component('svg-icon', SvgIcon) ...@@ -19,6 +19,7 @@ app.component('svg-icon', SvgIcon)
fetchConfig().then(res => { fetchConfig().then(res => {
// axios.defaults.baseURL = res.request.baseURL // axios.defaults.baseURL = res.request.baseURL
localStorage.setItem('config', JSON.stringify(res)) localStorage.setItem('config', JSON.stringify(res))
if (res.vconsole) vConsole = new VConsole()
}) })
// app.config.globalProperties.$axios = apis // app.config.globalProperties.$axios = apis
// setupStore(app) // setupStore(app)
......
...@@ -6,7 +6,12 @@ import { createSign } from './util' ...@@ -6,7 +6,12 @@ import { createSign } from './util'
const options: any = localStorage.getItem('config') const options: any = localStorage.getItem('config')
interface Config { interface Config {
response: object, response: {
'code_key': string,
'code_success_value': 0,
'data_key': string,
'errId_logout_value': string
},
request: { request: {
baseURL: string baseURL: string
}, },
...@@ -48,7 +53,7 @@ service.interceptors.request.use((config: AxiosRequestConfig) => { ...@@ -48,7 +53,7 @@ service.interceptors.request.use((config: AxiosRequestConfig) => {
service.interceptors.response.use((r) => { service.interceptors.response.use((r) => {
console.log(r) console.log(r)
const { data: res, config: { returnAll } } = r const { data: res, config: { returnAll } } = r
const { code_key, code_success_value = '0', data_key = 'data', errId_logout_value, logout_function = 'logout' } = response const { code_key, code_success_value, data_key = 'data', errId_logout_value } = response
const errId = 'errId' const errId = 'errId'
if (returnAll) { if (returnAll) {
return res return res
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!