fix 修复 无法获取token问题 将 globalHeaders 改为函数
This commit is contained in:
parent
53ac5fb43c
commit
50891e99ac
@ -50,7 +50,7 @@ const props = defineProps({
|
|||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
const upload = reactive<UploadOption>({
|
const upload = reactive<UploadOption>({
|
||||||
headers: globalHeaders,
|
headers: globalHeaders(),
|
||||||
url: import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload'
|
url: import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload'
|
||||||
})
|
})
|
||||||
const myQuillEditor = ref();
|
const myQuillEditor = ref();
|
||||||
|
@ -66,7 +66,7 @@ const uploadList = ref<any[]>([]);
|
|||||||
|
|
||||||
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||||
const uploadFileUrl = ref(baseUrl + "/resource/oss/upload"); // 上传文件服务器地址
|
const uploadFileUrl = ref(baseUrl + "/resource/oss/upload"); // 上传文件服务器地址
|
||||||
const headers = ref(globalHeaders);
|
const headers = ref(globalHeaders());
|
||||||
|
|
||||||
const fileList = ref<any[]>([]);
|
const fileList = ref<any[]>([]);
|
||||||
const showTip = computed(
|
const showTip = computed(
|
||||||
|
@ -70,7 +70,7 @@ const dialogVisible = ref(false);
|
|||||||
|
|
||||||
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||||
const uploadImgUrl = ref(baseUrl + "/resource/oss/upload"); // 上传的图片服务器地址
|
const uploadImgUrl = ref(baseUrl + "/resource/oss/upload"); // 上传的图片服务器地址
|
||||||
const headers = ref(globalHeaders);
|
const headers = ref(globalHeaders());
|
||||||
|
|
||||||
const fileList = ref<any[]>([]);
|
const fileList = ref<any[]>([]);
|
||||||
const showTip = computed(
|
const showTip = computed(
|
||||||
|
@ -16,7 +16,7 @@ export default {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
url: url,
|
url: url,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
headers: globalHeaders,
|
headers: globalHeaders(),
|
||||||
});
|
});
|
||||||
const isBlob = blobValidate(res.data);
|
const isBlob = blobValidate(res.data);
|
||||||
if (isBlob) {
|
if (isBlob) {
|
||||||
@ -40,7 +40,7 @@ export default {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
url: url,
|
url: url,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
headers: globalHeaders,
|
headers: globalHeaders(),
|
||||||
});
|
});
|
||||||
const isBlob = blobValidate(res.data);
|
const isBlob = blobValidate(res.data);
|
||||||
if (isBlob) {
|
if (isBlob) {
|
||||||
|
@ -14,10 +14,12 @@ import { encrypt } from '@/utils/jsencrypt';
|
|||||||
let downloadLoadingInstance: LoadingInstance;
|
let downloadLoadingInstance: LoadingInstance;
|
||||||
// 是否显示重新登录
|
// 是否显示重新登录
|
||||||
export const isRelogin = { show: false };
|
export const isRelogin = { show: false };
|
||||||
export const globalHeaders = {
|
export const globalHeaders = () => {
|
||||||
|
return {
|
||||||
Authorization: "Bearer " + getToken(),
|
Authorization: "Bearer " + getToken(),
|
||||||
clientid: import.meta.env.VITE_APP_CLIENT_ID
|
clientid: import.meta.env.VITE_APP_CLIENT_ID
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
|
||||||
axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID;
|
axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID;
|
||||||
|
@ -335,7 +335,7 @@ const upload = reactive<ImportOption>({
|
|||||||
// 是否更新已经存在的用户数据
|
// 是否更新已经存在的用户数据
|
||||||
updateSupport: 0,
|
updateSupport: 0,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: globalHeaders,
|
headers: globalHeaders(),
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
|
url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user