修改 报错上传一级 用户认证逻辑
This commit is contained in:
@@ -11,7 +11,7 @@ interface TitleTextareaProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TitleTextarea: React.FC<TitleTextareaProps> = ({
|
const TitleTextarea: React.FC<TitleTextareaProps> = ({
|
||||||
value,
|
value='',
|
||||||
onChange,
|
onChange,
|
||||||
maxLength = 20,
|
maxLength = 20,
|
||||||
placeholder = '好的标题更吸引人哦'
|
placeholder = '好的标题更吸引人哦'
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class HttpService {
|
|||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
Taro.reLaunch({
|
Taro.reLaunch({
|
||||||
url: '/pages/login/index'
|
url: '/login_pages/index/index'
|
||||||
})
|
})
|
||||||
reject(new Error('用户不存在'))
|
reject(new Error('用户不存在'))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -101,13 +101,6 @@ export const wechat_auth_login = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (auth_response.code === 0) {
|
if (auth_response.code === 0) {
|
||||||
// 登录成功后,更新用户信息到 store
|
|
||||||
try {
|
|
||||||
await useUser.getState().fetchUserInfo();
|
|
||||||
} catch (error) {
|
|
||||||
console.error("更新用户信息到 store 失败:", error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
message: "微信登录成功",
|
message: "微信登录成功",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import Taro from '@tarojs/taro'
|
|||||||
import envConfig from '@/config/env'
|
import envConfig from '@/config/env'
|
||||||
import { API_CONFIG } from '@/config/api'
|
import { API_CONFIG } from '@/config/api'
|
||||||
import httpService from './httpService'
|
import httpService from './httpService'
|
||||||
|
import tokenManager from '../utils/tokenManager'
|
||||||
|
|
||||||
// 用户接口
|
// 用户接口
|
||||||
export interface UploadFilesData {
|
export interface UploadFilesData {
|
||||||
@@ -84,22 +85,17 @@ class UploadApi {
|
|||||||
async upload_oss_img(file_path: string): Promise<any> {
|
async upload_oss_img(file_path: string): Promise<any> {
|
||||||
try {
|
try {
|
||||||
let fullUrl = `${envConfig.apiBaseURL}/api${API_CONFIG.UPLOAD.OSS_IMG}`
|
let fullUrl = `${envConfig.apiBaseURL}/api${API_CONFIG.UPLOAD.OSS_IMG}`
|
||||||
// 后门id,用于调试
|
|
||||||
let userid = httpService.getHashParam("userIdTest")
|
const authHeader = tokenManager.getAuthHeader()
|
||||||
if (userid) {
|
|
||||||
if (fullUrl.indexOf("?") > -1) {
|
|
||||||
fullUrl += `&userIdTest45=${userid}`
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fullUrl += `?userIdTest45=${userid}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = await Taro.uploadFile({
|
const response = await Taro.uploadFile({
|
||||||
url: fullUrl,
|
url: fullUrl,
|
||||||
filePath: file_path,
|
filePath: file_path,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
|
header: authHeader,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const result = JSON.parse(response.data);
|
const result = JSON.parse(response.data);
|
||||||
|
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从 loginService 移过来的用户相关方法
|
||||||
|
|
||||||
// 获取用户详细信息
|
// 获取用户详细信息
|
||||||
export const fetchUserProfile = async (): Promise<ApiResponse<UserInfoType>> => {
|
export const fetchUserProfile = async (): Promise<ApiResponse<UserInfoType>> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user