修改用户上传
This commit is contained in:
@@ -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>({
|
||||
|
||||
Reference in New Issue
Block a user