修改 报错上传一级 用户认证逻辑

This commit is contained in:
张成
2025-10-05 12:30:48 +08:00
parent 2548e15ac4
commit 6058580b29
5 changed files with 9 additions and 20 deletions

View File

@@ -2,6 +2,7 @@ import Taro from '@tarojs/taro'
import envConfig from '@/config/env'
import { API_CONFIG } from '@/config/api'
import httpService from './httpService'
import tokenManager from '../utils/tokenManager'
// 用户接口
export interface UploadFilesData {
@@ -84,22 +85,17 @@ class UploadApi {
async upload_oss_img(file_path: string): Promise<any> {
try {
let fullUrl = `${envConfig.apiBaseURL}/api${API_CONFIG.UPLOAD.OSS_IMG}`
// 后门id用于调试
let userid = httpService.getHashParam("userIdTest")
if (userid) {
if (fullUrl.indexOf("?") > -1) {
fullUrl += `&userIdTest45=${userid}`
}
else {
fullUrl += `?userIdTest45=${userid}`
}
}
const authHeader = tokenManager.getAuthHeader()
const response = await Taro.uploadFile({
url: fullUrl,
filePath: file_path,
name: 'file',
header: authHeader,
});
const result = JSON.parse(response.data);