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

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

@@ -11,7 +11,7 @@ interface TitleTextareaProps {
}
const TitleTextarea: React.FC<TitleTextareaProps> = ({
value,
value='',
onChange,
maxLength = 20,
placeholder = '好的标题更吸引人哦'

View File

@@ -128,7 +128,7 @@ class HttpService {
icon: 'none'
})
Taro.reLaunch({
url: '/pages/login/index'
url: '/login_pages/index/index'
})
reject(new Error('用户不存在'))
return

View File

@@ -101,13 +101,6 @@ export const wechat_auth_login = async (
});
if (auth_response.code === 0) {
// 登录成功后,更新用户信息到 store
try {
await useUser.getState().fetchUserInfo();
} catch (error) {
console.error("更新用户信息到 store 失败:", error);
}
return {
success: true,
message: "微信登录成功",

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);

View File

@@ -574,7 +574,7 @@ export class UserService {
}
}
// 从 loginService 移过来的用户相关方法
// 获取用户详细信息
export const fetchUserProfile = async (): Promise<ApiResponse<UserInfoType>> => {