切面处理站点code

This commit is contained in:
Vinjor 2025-06-20 09:42:33 +08:00
parent aa38cbd31a
commit 9d87907f0b

View File

@ -1,7 +1,7 @@
import axios from 'axios'
import { Notification, MessageBox, Message, Loading } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import { getToken,getTenantId } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from "@/utils/ruoyi";
import cache from '@/plugins/cache'
@ -31,12 +31,16 @@ service.interceptors.request.use(config => {
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
//拼接当前管理的站点code
config.params.tenantId = getTenantId()
let url = config.url + '?' + tansParams(config.params);
url = url.slice(0, -1);
config.params = {};
config.url = url;
}
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
//拼接当前管理的站点code
config.data.tenantId = getTenantId()
const requestObj = {
url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,