feat: 视频问题

This commit is contained in:
2025-11-28 20:26:47 +08:00
parent 46b98e78e5
commit d9f3103304
26 changed files with 1582 additions and 1021 deletions

View File

@@ -6,7 +6,7 @@
*/
import { createClientAxios } from '@gold/api/axios/client'
import authService from '@/services/AuthService'
import { refreshToken } from '@/api/auth'
import router from '@/router'
/**
@@ -29,16 +29,19 @@ export function createHttpClient(options = {}) {
return
}
// 默认处理:使用 AuthService 尝试刷新token
await authService.handleAuthError(
error,
() => {
// 刷新失败使用router跳转避免整页刷新
router.push('/login')
}
)
// 如果刷新成功AuthService返回null不跳转不抛出错误
// 业务代码可以捕获这个错误并重试请求
// 默认处理尝试刷新token
try {
await refreshToken()
// 刷新成功标记错误已处理token已更新
error._handled = true
error._tokenRefreshed = true
console.info('Token刷新成功可以重试原请求')
// 不抛出错误,交给上层决定是否重试
} catch (refreshError) {
// 刷新失败使用router跳转避免整页刷新
console.error('刷新token失败:', refreshError)
router.push('/login')
}
},
on403: (error) => {
// 403没有权限直接跳转到登录页
@@ -106,7 +109,7 @@ export default http
* console.error('请求失败:', error.message)
* }
*
* 注意:当 401 发生时,AuthService 会自动尝试刷新 token。
* 注意:当 401 发生时,系统会自动尝试刷新 token。
* 如果刷新成功,会使用相同的 http 实例重新发起请求,
* 确保自定义拦截器被正确应用。
*/

View File

@@ -6,8 +6,8 @@
import http from './http'
import { API_BASE } from '@gold/config/api'
// 统一使用 /api/tik 前缀,与 tikhub 保持一致
const BASE_URL = `${API_BASE.APP}/api/tik/file`
// 使用 webApi 前缀,确保能够被代理
const BASE_URL = `${API_BASE.APP_TIK}/file`
/**
* 素材库 API 服务
@@ -104,7 +104,7 @@ export const MaterialService = {
/**
* 素材分组 API 服务
*/
const GROUP_BASE_URL = `${API_BASE.APP}/api/tik/file/group`
const GROUP_BASE_URL = `${API_BASE.APP_TIK}/file/group`
export const MaterialGroupService = {
/**