提交 48b072b1 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 实验ID动态化

上级 4e562a2e
......@@ -19,8 +19,7 @@ router.beforeEach(async (to, from, next) => {
return
}
if (!to.query.experiment_id) {
to.query.experiment_id = '7025368348925886464'
next({ path: to.path, query: to.query })
next({ path: to.path, query: { ...to.query, experiment_id: from.query.experiment_id || '7025368348925886464' } })
} else {
next()
}
......
......@@ -13,10 +13,13 @@ const httpRequest = axios.create({
// 请求拦截
httpRequest.interceptors.request.use(
function (config) {
const params = new URLSearchParams(window.location.search)
if (config.method === 'get')
config.params = Object.assign({}, config.params, { experiment_id: '7025368348925886464' })
config.params = Object.assign({}, config.params, { experiment_id: params.get('experiment_id') })
if (config.method === 'post') config.data = Object.assign({}, config.data, { experiment_id: '7025368348925886464' })
if (config.method === 'post')
config.data = Object.assign({}, config.data, { experiment_id: params.get('experiment_id') })
return config
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论