Commit b232a222 by 张立顺

请求配置修改

1 parent 0200292f
Showing 1 changed file with 55 additions and 28 deletions
......@@ -41,12 +41,12 @@ Vue.prototype.to = function (name, params) {
// import 'lib-flexible/flexible.js'
import VConsole from 'vconsole'
var baseConfig = {
axios: {
appkey: 'd7ffc3346fc9a45bccaaa35300d59022',
secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
}
}
// var baseConfig = {
// axios: {
// appkey: 'd7ffc3346fc9a45bccaaa35300d59022',
// secret: '4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353'
// }
// }
import * as Sentry from '@sentry/vue'
import { BrowserTracing } from '@sentry/tracing'
......@@ -66,6 +66,27 @@ process.env.NODE_ENV === 'production' &&
// We recommend adjusting this value in production
tracesSampleRate: 1.0
})
const baseConfig = {
sysName: '嘀加支付宝h5系统',
hasReg: false,
hasAuth: false,
vconsole: true,
env: 'develop',
axios: {
baseURL: 'http://192.168.3.226:9711',
appkey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
timeout: 50000,
result: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: 0,
code_message_map: {}
}
}
}
window.$fetchConfig = baseConfig
// const isMock = ['prod', 'production'].includes(process.env.NODE_ENV)
// 使用fetch 解决axios提前实例化导致sign里面的secret不能通过配置中心动态获取
......@@ -82,32 +103,38 @@ fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=dj-c
)
.then(response => {
console.log(response)
const { code, data } = response
code == '200' && ((baseConfig = data), (window.$fetchConfig = data))
if (code == '200') {
baseConfig = data
window.$fetchConfig = data
} else {
baseConfig = response
window.$fetchConfig = response
}
// && ((baseConfig = data), (window.$fetchConfig = data))
})
.catch(el => {
// console.log(el)
baseConfig = {
sysName: '嘀加支付宝h5系统',
hasReg: false,
hasAuth: false,
vconsole: true,
env: 'develop',
axios: {
baseURL: 'http://192.168.3.226:9711',
appkey: '48e5e13229b82c1b4e6e8c96151f0637',
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
timeout: 50000,
result: {
data_key: 'data',
message_key: 'message',
code_key: 'code',
code_success_value: 0,
code_message_map: {}
}
}
}
// baseConfig = {
// sysName: '嘀加支付宝h5系统',
// hasReg: false,
// hasAuth: false,
// vconsole: true,
// env: 'develop',
// axios: {
// baseURL: 'http://192.168.3.226:9711',
// appkey: '48e5e13229b82c1b4e6e8c96151f0637',
// secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
// timeout: 50000,
// result: {
// data_key: 'data',
// message_key: 'message',
// code_key: 'code',
// code_success_value: 0,
// code_message_map: {}
// }
// }
// }
})
.finally(() => {
init()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!