Commit 6ed5e071 by 胡悦

修改request

1 parent 448d808d
......@@ -15,10 +15,7 @@ console.log(apis)
app.config.globalProperties.$axios = apis
setupStore(app)
setupRouter(app)
const fetchConfig = function (isEnv = true) {
return window.fetch('https://oss-config.dev.glsx.com.cn/mock/618cb9331072f92988f05a23/wx/config', {}).then(res => res.json())
}
app.config.globalProperties.$mockConfig = await fetchConfig()
router.isReady().then(() => {
app.mount('#app')
})
......
const fetchConfig = function (isEnv = true) {
return window.fetch('https://oss-config.dev.glsx.com.cn/mock/618cb9331072f92988f05a23/wx/config', {}).then(res => res.json())
}
const $mockConfig = await fetchConfig()
export default $mockConfig
\ No newline at end of file
......@@ -3,6 +3,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import router, { resetRoute } from '../router'
import qs from 'qs'
import { createSign } from './util'
import $mockConfig from './config'
function getSession(key: string) {
let json: any = window.sessionStorage.getItem(key)
return JSON.parse(json)
......@@ -10,23 +11,21 @@ function getSession(key: string) {
export const PATH_URL: string = '/api' || import.meta.env.VITE_API_URL
const { response = {}, request = {}, headers = {}, alert, sign, signWay = 'sha1', secret } = $mockConfig
// 配置新建一个axios 实例
const service: AxiosInstance = axios.create({
baseURL: PATH_URL,
baseURL: request.baseURL,
timeout: 50000,
headers: {
'Content-Type': 'application/json'
}
})
const customer = {
response: '1',
alert: '2',
sign: {
a: '10',
b: '11'
},
secret: '4',
signWay: '5',
response,
alert,
sign,
secret,
signWay
// sessionId: headers.token
}
// 添加请求拦截器
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!