no message

This commit is contained in:
2025-08-16 01:03:25 +08:00
parent f4fd78955e
commit 764fbf7560
3 changed files with 38 additions and 5 deletions
+6 -2
View File
@@ -7,14 +7,18 @@ import { BASE_URL, Authorization } from '@/utils/config.js'
function request(options) {
const { url, method = 'GET', data = {}, headers = {}, isShowLoading = true } = options;
// const token = uni.getStorageSync(tokenKey); // 获取token, 根据实际情况调整获取方式
const token = getStorageFun(TOKEN_NAME); // 获取token, 根据实际情况调整获取方式
const defaultHeaders = {
let defaultHeaders = {
"Authorization": Authorization,
'HSM-AUTH': token ? token : '', // 如果存在token, 则添加到请求头中
'content-type': ['post', 'POST'].includes(method) ? 'application/x-www-form-urlencoded' : 'application/json',
};
if(options.cha){
defaultHeaders['content-type']= 'application/json'
}
console.log('defaultHeaders',defaultHeaders,method)
if (token) {
defaultHeaders['HSM-AUTH'] = token;
}