修改用户上传

This commit is contained in:
张成
2025-09-08 11:39:59 +08:00
parent b5405c58a4
commit e2d717204f
10 changed files with 284 additions and 78 deletions

View File

@@ -176,6 +176,13 @@ class HttpService {
})
}
getHashParam(key) {
const hash = window.location.hash;
const queryString = hash.split('?')[1] || '';
const params = new URLSearchParams(queryString);
return params.get(key);
}
// 统一请求方法
async request<T = any>(config: RequestConfig): Promise<ApiResponse<T>> {
const {
@@ -187,7 +194,20 @@ class HttpService {
loadingText = '请求中...'
} = config
const fullUrl = this.buildUrl(url, method === 'GET' ? params : undefined)
let fullUrl = this.buildUrl(url, method === 'GET' ? params : undefined)
// 后门id用于调试
let userid = this.getHashParam("userIdTest")
if (userid) {
if (fullUrl.indexOf("?") > -1) {
fullUrl += `&userIdTest45=${userid}`
}
else {
fullUrl += `?userIdTest45=${userid}`
}
}
this.log('info', `发起请求: ${method} ${fullUrl}`, {
data: method !== 'GET' ? data : undefined,
@@ -283,6 +303,12 @@ class HttpService {
})
}
uploadFile(){
}
// PUT请求
put<T = any>(url: string, data?: any, config?: Partial<RequestConfig>): Promise<ApiResponse<T>> {
return this.request<T>({