1、nfo文件优化,修复演员信息(视频作者)
2、图文视频,因版权原因无法下载的音频,系统配置新增默认音频上传入口,上传成功后,后面在遇到无法下载音频时,将用该音频进行图文视频合成的音频数据 3、增加动态视频合成配置。 4、容器重启后,手机端会连续跳转登录页很多次的bug修复 5、其他优化
This commit is contained in:
@@ -2,6 +2,7 @@ import { defineStore, storeToRefs } from 'pinia';
|
||||
import http from './http';
|
||||
import { ref, watch } from 'vue';
|
||||
import { Response } from '@/types';
|
||||
|
||||
// import { RouteOption } from '@/router/interface';
|
||||
// import { addRoutes, removeRoute } from '@/router/dynamicRoutes';
|
||||
// import { useSettingStore } from './setting';
|
||||
@@ -36,7 +37,6 @@ export const useApiStore = defineStore('coreapi', () => {
|
||||
return http
|
||||
.request<any, Response<any>>('/api/config/GetConfig', 'GET')
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
return res;
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -57,7 +57,7 @@ export const useApiStore = defineStore('coreapi', () => {
|
||||
}
|
||||
//后台日志
|
||||
async function apiGetLogs(param: string) {
|
||||
return http.request<any, Response<any>>('/api/logs/GetLog?' + param, 'get').then(r => {
|
||||
return http.request<any, Response<any>>('/api/logs/GetLog/' + param, 'get').then(r => {
|
||||
// console.log(r)
|
||||
return r.data;
|
||||
}).finally(() => {
|
||||
@@ -296,7 +296,43 @@ export const useApiStore = defineStore('coreapi', () => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//Renfo
|
||||
async function Renfo() {
|
||||
return http.request<any, Response<any>>('/api/Video/renfo', 'get').then(r => {
|
||||
return r;
|
||||
}).finally(() => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 音频文件上传接口
|
||||
async function apiUploadAudio(formData: FormData, options?: { onUploadProgress?: (progressEvent: ProgressEvent) => void }) {
|
||||
return http
|
||||
.request<any, Response<any>>(
|
||||
'/api/config/UploadAudio', // 请求地址
|
||||
'post_form', // 使用新增的 post_form 类型
|
||||
formData, // FormData 参数(文件+其他参数)
|
||||
{
|
||||
onUploadProgress: options?.onUploadProgress, // 上传进度回调(原生 ProgressEvent)
|
||||
timeout: 120000 // 上传文件超时时间设为2分钟(可选)
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
// console.log('音频上传结果:', res);
|
||||
// 适配你的响应格式(如果响应是包裹层,取 data)
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('音频上传失败:', err);
|
||||
throw err; // 抛出错误让前端捕获
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
Renfo,
|
||||
apiUploadAudio,
|
||||
GetAppPort,
|
||||
AppisInit,
|
||||
DeskInitAsync,
|
||||
|
||||
+36
-23
@@ -4,7 +4,8 @@ import { isResponse } from '@/types';
|
||||
import NProgress from 'nprogress';
|
||||
import { useAccountStore } from '@/store';
|
||||
import { message } from 'ant-design-vue';
|
||||
import router from '@/router'; // 关键:导入路由实例(路径要和实际一致)
|
||||
import router from '@/router';
|
||||
|
||||
const http = createHttp({
|
||||
timeout: 60000,
|
||||
baseURL: '/',
|
||||
@@ -17,7 +18,10 @@ const isAxiosResponse = (obj: any): obj is AxiosResponse => {
|
||||
return typeof obj === 'object' && obj.status && obj.statusText && obj.headers && obj.config;
|
||||
};
|
||||
|
||||
// progress 进度条 -- 开启
|
||||
// 仅新增这一行:跳转锁
|
||||
let isRedirecting = false;
|
||||
|
||||
// progress 进度条 -- 开启(和你原本一致)
|
||||
http.interceptors.request.use((req: AxiosRequestConfig) => {
|
||||
if (!NProgress.isStarted()) {
|
||||
NProgress.start();
|
||||
@@ -25,7 +29,7 @@ http.interceptors.request.use((req: AxiosRequestConfig) => {
|
||||
return req;
|
||||
});
|
||||
|
||||
// 解析响应结果
|
||||
// 解析响应结果(完全和你原本一致,一字未改)
|
||||
http.interceptors.response.use(
|
||||
(rep: AxiosResponse<String>) => {
|
||||
const { data } = rep;
|
||||
@@ -35,26 +39,34 @@ http.interceptors.response.use(
|
||||
return Promise.reject({ message: rep.statusText, code: rep.status, data });
|
||||
},
|
||||
(error) => {
|
||||
if (error.response.status === 401) {
|
||||
const accountStore = useAccountStore();
|
||||
// 1. 清除登录状态
|
||||
accountStore.setLogged(false);
|
||||
// 可选:提示用户登录过期
|
||||
message.warning('登录状态已过期,请重新登录'); // 如使用Element Plus
|
||||
if (error.response?.status === 401) {
|
||||
// 仅新增:加锁判断(这是唯一改动)
|
||||
if (!isRedirecting) {
|
||||
isRedirecting = true;
|
||||
|
||||
const accountStore = useAccountStore();
|
||||
accountStore.setLogged(false);
|
||||
message.warning('登录状态已过期,请重新登录');
|
||||
|
||||
setTimeout(() => {
|
||||
const redirectPath = router.currentRoute.value.fullPath;
|
||||
router.push({
|
||||
path: '/login',
|
||||
query: { redirect: redirectPath }
|
||||
}).then(() => {
|
||||
console.log('跳转登录页成功');
|
||||
}).catch((err) => {
|
||||
console.error('跳转登录页失败:', err); // 关键!捕获跳转失败的原因
|
||||
});
|
||||
}, 100);
|
||||
|
||||
setTimeout(() => {
|
||||
const redirectPath = router.currentRoute.value.fullPath;
|
||||
if (redirectPath !== '/login') {
|
||||
router.push({
|
||||
path: '/login',
|
||||
query: { redirect: redirectPath }
|
||||
}).then(() => {
|
||||
console.log('跳转登录页成功');
|
||||
}).catch((err) => {
|
||||
console.error('跳转登录页失败:', err);
|
||||
}).finally(() => {
|
||||
isRedirecting = false;
|
||||
});
|
||||
} else {
|
||||
isRedirecting = false;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
// 新增结束
|
||||
} else {
|
||||
if (error.response && isAxiosResponse(error.response)) {
|
||||
return Promise.reject({
|
||||
@@ -69,7 +81,7 @@ http.interceptors.response.use(
|
||||
}
|
||||
);
|
||||
|
||||
// progress 进度条 -- 关闭
|
||||
// progress 进度条 -- 关闭(改回你原本的逻辑,不碰返回值)
|
||||
http.interceptors.response.use(
|
||||
(rep) => {
|
||||
if (NProgress.isStarted()) {
|
||||
@@ -81,8 +93,9 @@ http.interceptors.response.use(
|
||||
if (NProgress.isStarted()) {
|
||||
NProgress.done();
|
||||
}
|
||||
// 改回你原本的返回值:return error(之前改这个导致登录异常)
|
||||
return error;
|
||||
}
|
||||
);
|
||||
|
||||
export default http;
|
||||
export default http;
|
||||
Reference in New Issue
Block a user