chore: 跑一遍 auto-correct (#468)
This commit is contained in:
@@ -60,7 +60,7 @@ class ApiClient {
|
||||
clearAuthToken() {
|
||||
delete this.defaultHeaders['Authorization'];
|
||||
localStorage.removeItem('authToken');
|
||||
// 断开WebSocket连接,因为token已经无效
|
||||
// 断开 WebSocket 连接,因为 token 已经无效
|
||||
wsManager.disconnect();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
export let onsubmit: (request: UpdateVideoStatusRequest) => void;
|
||||
|
||||
// 视频任务名称(与后端 VideoStatus 对应)
|
||||
const videoTaskNames = ['视频封面', '视频信息', 'UP主头像', 'UP主信息', '分页下载'];
|
||||
const videoTaskNames = ['视频封面', '视频信息', 'UP 主头像', 'UP 主信息', '分页下载'];
|
||||
|
||||
// 分页任务名称(与后端 PageStatus 对应)
|
||||
const pageTaskNames = ['视频封面', '视频内容', '视频信息', '视频弹幕', '视频字幕'];
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
case 'collection':
|
||||
return '合集';
|
||||
case 'upper':
|
||||
return 'UP主';
|
||||
return 'UP 主';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
let customPath = '';
|
||||
let loading = false;
|
||||
|
||||
// 根据类型和item生成默认路径
|
||||
// 根据类型和 item 生成默认路径
|
||||
function generateDefaultPath(): string {
|
||||
if (!item) return '';
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
case 'upper': {
|
||||
const upper = item as UpperWithSubscriptionStatus;
|
||||
return `UP主/${upper.uname}`;
|
||||
return `UP 主/${upper.uname}`;
|
||||
}
|
||||
default:
|
||||
return '';
|
||||
@@ -63,7 +63,7 @@
|
||||
case 'collection':
|
||||
return '合集';
|
||||
case 'upper':
|
||||
return 'UP主';
|
||||
return 'UP 主';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
@@ -145,7 +145,7 @@
|
||||
open = false;
|
||||
}
|
||||
|
||||
// 当对话框打开时重置path
|
||||
// 当对话框打开时重置 path
|
||||
$: if (open && item) {
|
||||
customPath = generateDefaultPath();
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ export interface CollectionsResponse {
|
||||
total: number;
|
||||
}
|
||||
|
||||
// UP主相关类型
|
||||
// UP 主相关类型
|
||||
export interface UpperWithSubscriptionStatus {
|
||||
mid: number;
|
||||
uname: string;
|
||||
|
||||
@@ -122,7 +122,7 @@ export class WebSocketManager {
|
||||
} catch (error) {
|
||||
console.error('Failed to parse WebSocket message:', error, event.data);
|
||||
toast.error('解析 WebSocket 消息失败', {
|
||||
description: `消息内容: ${event.data}\n错误信息: ${error instanceof Error ? error.message : String(error)}`
|
||||
description: `消息内容:${event.data}\n错误信息:${error instanceof Error ? error.message : String(error)}`
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ export class WebSocketManager {
|
||||
} catch (error) {
|
||||
console.error('Failed to send message:', error);
|
||||
toast.error('发送 WebSocket 消息失败', {
|
||||
description: `消息内容: ${JSON.stringify(message)}\n错误信息: ${error instanceof Error ? error.message : String(error)}`
|
||||
description: `消息内容:${JSON.stringify(message)}\n错误信息:${error instanceof Error ? error.message : String(error)}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
const response = await api.getDashboard();
|
||||
dashboardData = response.data;
|
||||
} catch (error) {
|
||||
console.error('加载仪表盘数据失败:', error);
|
||||
console.error('加载仪表盘数据失败:', error);
|
||||
toast.error('加载仪表盘数据失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
async function loadCollections(page: number = 0) {
|
||||
loading = true;
|
||||
try {
|
||||
const response = await api.getFollowedCollections(page + 1, pageSize); // API使用1基索引
|
||||
const response = await api.getFollowedCollections(page + 1, pageSize); // API 使用 1 基索引
|
||||
collections = response.data.collections;
|
||||
totalCount = response.data.total;
|
||||
} catch (error) {
|
||||
console.error('加载合集失败:', error);
|
||||
console.error('加载合集失败:', error);
|
||||
toast.error('加载合集失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
@@ -92,7 +92,7 @@
|
||||
<div class="flex items-center justify-center py-12">
|
||||
<div class="space-y-2 text-center">
|
||||
<p class="text-muted-foreground">暂无合集数据</p>
|
||||
<p class="text-muted-foreground text-sm">请先在B站关注一些合集,或检查账号配置</p>
|
||||
<p class="text-muted-foreground text-sm">请先在 B 站关注一些合集,或检查账号配置</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
const response = await api.getCreatedFavorites();
|
||||
favorites = response.data.favorites;
|
||||
} catch (error) {
|
||||
console.error('加载收藏夹失败:', error);
|
||||
console.error('加载收藏夹失败:', error);
|
||||
toast.error('加载收藏夹失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
@@ -73,7 +73,7 @@
|
||||
<div class="flex items-center justify-center py-12">
|
||||
<div class="space-y-2 text-center">
|
||||
<p class="text-muted-foreground">暂无收藏夹数据</p>
|
||||
<p class="text-muted-foreground text-sm">请先在B站创建收藏夹,或检查账号配置</p>
|
||||
<p class="text-muted-foreground text-sm">请先在 B 站创建收藏夹,或检查账号配置</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
async function loadUppers(page: number = 0) {
|
||||
loading = true;
|
||||
try {
|
||||
const response = await api.getFollowedUppers(page + 1, pageSize); // API使用1基索引
|
||||
const response = await api.getFollowedUppers(page + 1, pageSize); // API 使用 1 基索引
|
||||
uppers = response.data.uppers;
|
||||
totalCount = response.data.total;
|
||||
} catch (error) {
|
||||
console.error('加载UP主失败:', error);
|
||||
toast.error('加载UP主失败', {
|
||||
console.error('加载 UP 主失败:', error);
|
||||
toast.error('加载 UP 主失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
} finally {
|
||||
@@ -92,8 +92,8 @@
|
||||
{:else}
|
||||
<div class="flex items-center justify-center py-12">
|
||||
<div class="space-y-2 text-center">
|
||||
<p class="text-muted-foreground">暂无UP主数据</p>
|
||||
<p class="text-muted-foreground text-sm">请先在B站关注一些UP主,或检查账号配置</p>
|
||||
<p class="text-muted-foreground">暂无 UP 主数据</p>
|
||||
<p class="text-muted-foreground text-sm">请先在 B 站关注一些 UP 主,或检查账号配置</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
async function loadVideoDetail() {
|
||||
const videoId = parseInt($page.params.id);
|
||||
if (isNaN(videoId)) {
|
||||
error = '无效的视频ID';
|
||||
toast.error('无效的视频ID');
|
||||
error = '无效的视频 ID';
|
||||
toast.error('无效的视频 ID');
|
||||
return;
|
||||
}
|
||||
loading = true;
|
||||
@@ -35,7 +35,7 @@
|
||||
const result = await api.getVideo(videoId);
|
||||
videoData = result.data;
|
||||
} catch (error) {
|
||||
console.error('加载视频详情失败:', error);
|
||||
console.error('加载视频详情失败:', error);
|
||||
toast.error('加载视频详情失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
@@ -79,7 +79,7 @@
|
||||
toast.error('状态更新失败');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('状态更新失败:', error);
|
||||
console.error('状态更新失败:', error);
|
||||
toast.error('状态更新失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
@@ -161,7 +161,7 @@
|
||||
}}
|
||||
mode="detail"
|
||||
showActions={false}
|
||||
taskNames={['视频封面', '视频信息', 'UP主头像', 'UP主信息', '分页下载']}
|
||||
taskNames={['视频封面', '视频信息', 'UP 主头像', 'UP 主信息', '分页下载']}
|
||||
bind:resetDialogOpen
|
||||
bind:resetting
|
||||
onReset={async (forceReset: boolean) => {
|
||||
@@ -225,8 +225,8 @@
|
||||
{:else}
|
||||
<div class="py-12 text-center">
|
||||
<div class="space-y-2">
|
||||
<p class="text-muted-foreground">暂无分P数据</p>
|
||||
<p class="text-muted-foreground text-sm">该视频可能为单P视频</p>
|
||||
<p class="text-muted-foreground">暂无分 P 数据</p>
|
||||
<p class="text-muted-foreground text-sm">该视频可能为单 P 视频</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
const result = await api.getVideos(params);
|
||||
videosData = result.data;
|
||||
} catch (error) {
|
||||
console.error('加载视频失败:', error);
|
||||
console.error('加载视频失败:', error);
|
||||
toast.error('加载视频失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
@@ -111,7 +111,7 @@
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('重置失败:', error);
|
||||
console.error('重置失败:', error);
|
||||
toast.error('重置失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
@@ -133,7 +133,7 @@
|
||||
toast.info('没有需要重置的视频');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('重置失败:', error);
|
||||
console.error('重置失败:', error);
|
||||
toast.error('重置失败', {
|
||||
description: (error as ApiError).message
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user