修改 报错上传一级 用户认证逻辑
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user