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