mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-08 01:03:27 +08:00
Compare commits
147 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afa333243f | ||
|
|
047e99e27c | ||
|
|
eef6f37ace | ||
|
|
e8ede6e606 | ||
|
|
bfb4ea4123 | ||
|
|
51b0403f64 | ||
|
|
a5cd396de6 | ||
|
|
754bc3d3c9 | ||
|
|
07a2bcfb97 | ||
|
|
20222201ae | ||
|
|
a2a5ddd66c | ||
|
|
7bfc7602a7 | ||
|
|
b52b2cedad | ||
|
|
e93df6ba2c | ||
|
|
f9f29ccc3c | ||
|
|
3bd63ab7c8 | ||
|
|
301ea445bb | ||
|
|
475bee28c6 | ||
|
|
cd69920b41 | ||
|
|
83aab4e47d | ||
|
|
e12093c966 | ||
|
|
f21d546d18 | ||
|
|
26c8a6ba43 | ||
|
|
827bb8ba69 | ||
|
|
d1d2ef37d2 | ||
|
|
659594898b | ||
|
|
7569401fe0 | ||
|
|
dc9c86273d | ||
|
|
0e816e678a | ||
|
|
ff1c2a890c | ||
|
|
b802ad8a75 | ||
|
|
c11fb54b0b | ||
|
|
856dec3991 | ||
|
|
1d8c71da3f | ||
|
|
4152d0f715 | ||
|
|
0ead8cc052 | ||
|
|
2b5ecf3f8a | ||
|
|
de7aeeaeb3 | ||
|
|
994c52f6aa | ||
|
|
c6eb744257 | ||
|
|
4f462c5cfd | ||
|
|
60850970a8 | ||
|
|
3b2d5e45bb | ||
|
|
a604d3223a | ||
|
|
00bd1c45a1 | ||
|
|
4bc6dc7af7 | ||
|
|
3a8effd01f | ||
|
|
da67088e9c | ||
|
|
bacd4d23a3 | ||
|
|
020f667749 | ||
|
|
84652e8c82 | ||
|
|
565ebd936e | ||
|
|
3af127c66f | ||
|
|
849bb04249 | ||
|
|
09d647877f | ||
|
|
c868afbcbf | ||
|
|
3f033bfdec | ||
|
|
eca2f43e0e | ||
|
|
eeb17040f7 | ||
|
|
11dee1ed62 | ||
|
|
11a6232f83 | ||
|
|
9eded24e0e | ||
|
|
7548882148 | ||
|
|
4ad89955d4 | ||
|
|
a53553d658 | ||
|
|
2602cb0998 | ||
|
|
e402de29d5 | ||
|
|
a4cc1cc615 | ||
|
|
2d900baad1 | ||
|
|
17d6f6db05 | ||
|
|
7f3ba543b7 | ||
|
|
b33cb8a12c | ||
|
|
cfa8b78c2e | ||
|
|
4024daf189 | ||
|
|
77d7c3bb61 | ||
|
|
868ad57e12 | ||
|
|
eaf9724295 | ||
|
|
30e98de38a | ||
|
|
79c606370c | ||
|
|
b70597b5f5 | ||
|
|
a469282730 | ||
|
|
c3708360fa | ||
|
|
80f0560e0f | ||
|
|
84951cdc44 | ||
|
|
a72cb797ab | ||
|
|
6898e6b816 | ||
|
|
adb0b966ff | ||
|
|
81284b8d21 | ||
|
|
1a2b112e64 | ||
|
|
442c484dc9 | ||
|
|
2368c2f25f | ||
|
|
2320c58254 | ||
|
|
c9a4f36414 | ||
|
|
1df9a981b2 | ||
|
|
cbc917b834 | ||
|
|
240a568d16 | ||
|
|
eb1a847faa | ||
|
|
e09e57879b | ||
|
|
ddd2982971 | ||
|
|
621da7e4ef | ||
|
|
420827c389 | ||
|
|
ce9399b894 | ||
|
|
1bdd08c59a | ||
|
|
52d62dda81 | ||
|
|
d69e3cedae | ||
|
|
648bfcdd0d | ||
|
|
e4b8ff0a64 | ||
|
|
4576ef854d | ||
|
|
7323668db5 | ||
|
|
b11d709070 | ||
|
|
e25ac006c2 | ||
|
|
9e85e7edce | ||
|
|
804bcd440c | ||
|
|
6e4c896cb7 | ||
|
|
0cae89f8e3 | ||
|
|
59a7607c07 | ||
|
|
6dca0c157f | ||
|
|
d2aa5a64aa | ||
|
|
2620a55c5a | ||
|
|
14e33215f8 | ||
|
|
6862c2a744 | ||
|
|
fb215e8d87 | ||
|
|
f52ad2151b | ||
|
|
1a47b7d09d | ||
|
|
f292071a34 | ||
|
|
dd616d29e8 | ||
|
|
0509f18d66 | ||
|
|
f59fb119e4 | ||
|
|
46127cac1f | ||
|
|
c1abf76211 | ||
|
|
fe5b45d48d | ||
|
|
10ac1ebf7b | ||
|
|
e5d8144510 | ||
|
|
f9a65fba7a | ||
|
|
9b4138349b | ||
|
|
db9c9db5a9 | ||
|
|
24e992339f | ||
|
|
f26d1babf7 | ||
|
|
de3347cea1 | ||
|
|
e900fac4bd | ||
|
|
396218a467 | ||
|
|
d3a66ffa8c | ||
|
|
1e7ffb4c2e | ||
|
|
3df5d4c690 | ||
|
|
02a8331996 | ||
|
|
a29ad6a091 | ||
|
|
3ef1e65412 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "moviepilot",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"private": true,
|
||||
"bin": "dist/service.js",
|
||||
"scripts": {
|
||||
@@ -26,12 +26,14 @@
|
||||
"@fullcalendar/timegrid": "^6.1.7",
|
||||
"@fullcalendar/vue3": "^6.1.8",
|
||||
"@iconify/utils": "^2.1.22",
|
||||
"@vue-js-cron/vuetify": "^5.0.9",
|
||||
"@vueuse/core": "^10.1.2",
|
||||
"@vueuse/math": "^10.1.2",
|
||||
"ace-builds": "^1.32.6",
|
||||
"apexcharts-clevision": "^3.28.5",
|
||||
"axios": "1.6.8",
|
||||
"colorthief": "^2.4.0",
|
||||
"copy-to-clipboard": "^3.3.3",
|
||||
"dayjs": "^1.11.10",
|
||||
"express": "^4.18.2",
|
||||
"express-http-proxy": "^2.0.0",
|
||||
|
||||
@@ -5,7 +5,7 @@ body {
|
||||
html {
|
||||
overflow: hidden auto;
|
||||
background: var(--initial-loader-bg, #fff);
|
||||
min-block-size: calc(100% + env(safe-area-inset-top));
|
||||
min-block-size: calc(100% + env(safe-area-inset-top) + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
#loading-bg {
|
||||
@@ -82,4 +82,4 @@ html {
|
||||
opacity: 1;
|
||||
transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ function changeTheme(theme: string) {
|
||||
// 保存主题到服务端
|
||||
try {
|
||||
api.post('/user/config/Layout', {
|
||||
theme: nextTheme
|
||||
theme: nextTheme,
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('保存主题到服务端失败')
|
||||
@@ -176,7 +176,7 @@ async function saveCustomCSS() {
|
||||
},
|
||||
})
|
||||
|
||||
if (result.success) $toast.success('自定义CSS保存成功!')
|
||||
if (result.success) $toast.success('自定义CSS保存成功,请刷新页面生效!')
|
||||
} catch (e) {
|
||||
console.error('保存自定义 CSS 到服务端失败')
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.auth-wrapper {
|
||||
min-block-size: calc(var(--vh, 1vh) * 100 + env(safe-area-inset-top));
|
||||
min-block-size: calc(var(--vh, 1vh) * 100 + env(safe-area-inset-top) + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.auth-footer-mask {
|
||||
|
||||
@@ -92,8 +92,7 @@
|
||||
.fc-header-toolbar {
|
||||
flex-wrap: wrap;
|
||||
margin: 1.25rem;
|
||||
column-gap: 0.5rem;
|
||||
row-gap: 1rem;
|
||||
gap: 1rem 0.5rem;
|
||||
}
|
||||
|
||||
.fc-toolbar-chunk {
|
||||
@@ -238,7 +237,7 @@
|
||||
inline-size: 1.5625rem;
|
||||
margin-inline-end: 0.25rem;
|
||||
|
||||
@media (max-width: 1264px) {
|
||||
@media (width <= 1264px) {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import copy from 'copy-to-clipboard'
|
||||
|
||||
// 请求和获取剪贴板内容
|
||||
export async function getClipboardContent() {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
@@ -13,20 +15,10 @@ export async function getClipboardContent() {
|
||||
}
|
||||
}
|
||||
|
||||
// 将内容复制到剪贴板,兼容非安全域场景
|
||||
// 将内容复制到剪贴板
|
||||
export async function copyToClipboard(content: string) {
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
await navigator.clipboard.writeText(content)
|
||||
} else {
|
||||
const input = document.createElement('textarea')
|
||||
input.value = content
|
||||
document.body.appendChild(input)
|
||||
// 阻止事件冒泡到其他元素,确保 focusin 事件只在 textarea 元素上处理,不会影响其他元素
|
||||
input.addEventListener('focusin', e => e.stopPropagation())
|
||||
input.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(input)
|
||||
}
|
||||
const success = copy(content)
|
||||
return success
|
||||
}
|
||||
|
||||
// VAPID公钥转Uint8Array
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
@use "@configured-variables" as variables;
|
||||
|
||||
html {
|
||||
min-height: calc(100% + env(safe-area-inset-top));
|
||||
min-height: calc(100% + env(safe-area-inset-top) + env(safe-area-inset-bottom));
|
||||
background: rgb(var(--v-theme-background));
|
||||
overflow-y: overlay;
|
||||
}
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
min-height: calc(100% + env(safe-area-inset-top))
|
||||
min-height: calc(100% + env(safe-area-inset-top) + env(safe-area-inset-bottom))
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export interface Subscribe {
|
||||
lack_episode?: number
|
||||
// 附加信息
|
||||
note?: string
|
||||
// 状态:N-新建, R-订阅中
|
||||
// 状态:N-新建 R-订阅中 P-待定 S-暂停
|
||||
state: string
|
||||
// 最后更新时间
|
||||
last_update: string
|
||||
@@ -1051,7 +1051,7 @@ export interface TransferDirectoryConf {
|
||||
// 监控模式 fast/compatibility
|
||||
monitor_mode?: string
|
||||
// 整理方式 move/copy/link/softlink
|
||||
transfer_type?: string
|
||||
transfer_type: string
|
||||
// 文件覆盖模式 always/size/never/latest
|
||||
overwrite_mode?: string
|
||||
// 整理到媒体库目录
|
||||
@@ -1100,6 +1100,7 @@ export interface FilterRuleGroup {
|
||||
category?: string
|
||||
}
|
||||
|
||||
// 订阅下载文件详情
|
||||
export interface SubscribeDownloadFileInfo {
|
||||
// 种子名称
|
||||
torrent_title?: string
|
||||
@@ -1113,6 +1114,7 @@ export interface SubscribeDownloadFileInfo {
|
||||
file_path?: string
|
||||
}
|
||||
|
||||
// 订阅媒体库文件详情
|
||||
export interface SubscribeLibraryFileInfo {
|
||||
// 存储
|
||||
storage?: string
|
||||
@@ -1120,6 +1122,7 @@ export interface SubscribeLibraryFileInfo {
|
||||
file_path?: string
|
||||
}
|
||||
|
||||
// 订阅集详情
|
||||
export interface SubscribeEpisodeInfo {
|
||||
// 标题
|
||||
title?: string
|
||||
@@ -1133,9 +1136,67 @@ export interface SubscribeEpisodeInfo {
|
||||
library?: SubscribeLibraryFileInfo[]
|
||||
}
|
||||
|
||||
// 订阅详情
|
||||
export interface SubscrbieInfo {
|
||||
// 订阅信息
|
||||
subscribe: Subscribe
|
||||
// 集信息 {集号: {download: 文件路径,library: 文件路径, backdrop: url, title: 标题, description: 描述}}
|
||||
episodes: Record<number, SubscribeEpisodeInfo>
|
||||
}
|
||||
|
||||
// 整理表单
|
||||
export interface TransferForm {
|
||||
// 文件项
|
||||
fileitem: FileItem
|
||||
// 历史ID
|
||||
logid: number
|
||||
// 目标存储
|
||||
target_storage: string
|
||||
// 目标路径
|
||||
target_path: string
|
||||
// TMDB ID
|
||||
tmdbid?: number
|
||||
// 豆瓣 ID
|
||||
doubanid?: string
|
||||
// 季号
|
||||
season?: number
|
||||
// 类型
|
||||
type_name?: string
|
||||
// 整理方式
|
||||
transfer_type: string
|
||||
// 自定义格式
|
||||
episode_format?: string
|
||||
// 指定集数
|
||||
episode_detail?: string
|
||||
// 指定PART
|
||||
episode_part?: string
|
||||
// 集数偏移
|
||||
episode_offset?: string
|
||||
// 最小文件大小
|
||||
min_filesize: number
|
||||
// 刮削
|
||||
scrape: boolean
|
||||
// 复用历史识别信息
|
||||
from_history: boolean
|
||||
// 媒体库类型子目录
|
||||
library_type_folder?: boolean
|
||||
// 媒体库类别子目录
|
||||
library_category_folder?: boolean
|
||||
}
|
||||
|
||||
// 整理队列
|
||||
export interface TransferQueue {
|
||||
// 媒体信息
|
||||
media: MediaInfo
|
||||
// 季
|
||||
season?: number
|
||||
// 任务列表
|
||||
tasks: {
|
||||
// 文件项
|
||||
fileitem: FileItem
|
||||
// 元数据
|
||||
meta: MetaInfo
|
||||
// 状态
|
||||
state: string
|
||||
}[]
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ function onClose() {
|
||||
<DialogCloseBtn @click="onClose" />
|
||||
<VCardText class="flex justify-space-between align-center gap-3">
|
||||
<div class="align-self-start">
|
||||
<h5 class="text-h6 mb-1">{{ props.rule.id }}</h5>
|
||||
<div class="text-body-1 mb-3">{{ props.rule.name }}</div>
|
||||
<h5 class="text-h6 mb-1">{{ props.rule.name }}</h5>
|
||||
<div class="text-body-1 mb-3">{{ props.rule.id }}</div>
|
||||
</div>
|
||||
<VImg :src="filter_svg" cover class="mt-7" max-width="3rem" />
|
||||
</VCardText>
|
||||
@@ -174,9 +174,9 @@ function onClose() {
|
||||
<VCol cols="6">
|
||||
<VTextField
|
||||
v-model="ruleInfo.publish_time"
|
||||
placeholder="0"
|
||||
placeholder="0/1-10"
|
||||
label="发布时间(分钟)"
|
||||
hint="距离资源发布的最小时间间隔"
|
||||
hint="距离资源发布的最小时间间隔或时间区间"
|
||||
persistent-hint
|
||||
active
|
||||
/>
|
||||
|
||||
@@ -29,14 +29,6 @@ const libraryPath = ref<string>('')
|
||||
// 卡版是否折叠状态
|
||||
const isCollapsed = ref(true)
|
||||
|
||||
// 下载目录存储选项
|
||||
const downloadStoragies = [
|
||||
{
|
||||
title: '本地',
|
||||
value: 'local',
|
||||
},
|
||||
]
|
||||
|
||||
// 类型下拉字典
|
||||
const typeItems = [
|
||||
{ title: '全部', value: '' },
|
||||
@@ -113,13 +105,13 @@ async function loadTransferTypeItems() {
|
||||
// 整理方式无数据提示
|
||||
const computedNoDataText = computed(() => {
|
||||
if (!props.directory.library_storage && !props.directory.storage) {
|
||||
return '无可用整理方式!请先选择下载器储存与媒体库储存!'
|
||||
return '请选择储存'
|
||||
} else if (!props.directory.library_storage) {
|
||||
return '无可用整理方式!请先选择媒体库储存!'
|
||||
return '请选择媒体库储存'
|
||||
} else if (!props.directory.storage) {
|
||||
return '无可用整理方式!请先选择下载器储存!'
|
||||
return '请选择下载器储存'
|
||||
} else {
|
||||
return '选择的存储没有支持的整理方法!'
|
||||
return '选择的存储类型没有支持的整理方式'
|
||||
}
|
||||
})
|
||||
|
||||
@@ -139,24 +131,6 @@ function onClose() {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
// 下载路径更新
|
||||
function updateDownloadPath(value: string) {
|
||||
downloadPath.value = value
|
||||
emit('update:modelValue', {
|
||||
download: downloadPath.value,
|
||||
library: libraryPath.value,
|
||||
})
|
||||
}
|
||||
|
||||
// 媒体库路径更新
|
||||
function updateLibraryPath(value: string) {
|
||||
libraryPath.value = value
|
||||
emit('update:modelValue', {
|
||||
download: downloadPath.value,
|
||||
library: libraryPath.value,
|
||||
})
|
||||
}
|
||||
|
||||
// 根据选中的媒体类型,获取对应的媒体类别
|
||||
const getCategories = computed(() => {
|
||||
const default_value = [{ title: '全部', value: '' }]
|
||||
@@ -231,18 +205,18 @@ watch(
|
||||
<VSelect
|
||||
v-model="props.directory.storage"
|
||||
variant="underlined"
|
||||
:items="downloadStoragies"
|
||||
label="下载存储"
|
||||
:items="storageOptions"
|
||||
label="下载存储/源存储"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="8">
|
||||
<VPathField @update:modelValue="updateDownloadPath" :storage="props.directory.storage">
|
||||
<VPathField v-model="props.directory.download_path" :storage="props.directory.storage">
|
||||
<template #activator="{ menuprops }">
|
||||
<VTextField
|
||||
v-model="props.directory.download_path"
|
||||
:model-value="props.directory.download_path"
|
||||
v-bind="menuprops"
|
||||
variant="underlined"
|
||||
label="下载目录"
|
||||
label="下载目录/源目录"
|
||||
/>
|
||||
</template>
|
||||
</VPathField>
|
||||
@@ -283,10 +257,10 @@ watch(
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="8">
|
||||
<VPathField @update:modelValue="updateLibraryPath" :storage="props.directory.library_storage">
|
||||
<VPathField v-model="props.directory.library_path" :storage="props.directory.library_storage">
|
||||
<template #activator="{ menuprops }">
|
||||
<VTextField
|
||||
v-model="props.directory.library_path"
|
||||
:modelValue="props.directory.library_path"
|
||||
v-bind="menuprops"
|
||||
variant="underlined"
|
||||
label="媒体库目录"
|
||||
|
||||
@@ -72,12 +72,17 @@ const getCategories = computed(() => {
|
||||
|
||||
// 规则组规则卡片列表
|
||||
const filterRuleCards = ref<FilterCard[]>([])
|
||||
// 规则组类型,仅用于导入判断
|
||||
const filterRuleCardsType = ref<FilterCard>({
|
||||
pri: '',
|
||||
rules: [],
|
||||
})
|
||||
|
||||
// 导入代码弹窗
|
||||
const importCodeDialog = ref(false)
|
||||
|
||||
// 导入的代码
|
||||
const importCodeString = ref('')
|
||||
// 导入代码类型
|
||||
const importCodeType = ref('')
|
||||
|
||||
// 更新规则卡片的值
|
||||
function updateFilterCardValue(pri: string, rules: string[]) {
|
||||
@@ -96,7 +101,7 @@ function filterCardClose(pri: string) {
|
||||
}
|
||||
|
||||
// 分享规则
|
||||
function shareRules() {
|
||||
async function shareRules() {
|
||||
if (filterRuleCards.value.length === 0) return
|
||||
|
||||
const value = filterRuleCards.value
|
||||
@@ -105,32 +110,43 @@ function shareRules() {
|
||||
.join('>')
|
||||
|
||||
try {
|
||||
copyToClipboard(value)
|
||||
$toast.success('优先级规则已复制到剪贴板')
|
||||
let success
|
||||
success = copyToClipboard(value)
|
||||
if (await success) $toast.success('优先级规则已复制到剪贴板!')
|
||||
else $toast.error('优先级规则复制失败:可能是浏览器不支持或被用户阻止!')
|
||||
} catch (error) {
|
||||
$toast.error('优先级规则复制失败!')
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 导入规则
|
||||
async function importRules() {
|
||||
importCodeString.value = ''
|
||||
async function importRules(ruleType: string) {
|
||||
importCodeType.value = ruleType
|
||||
importCodeDialog.value = true
|
||||
}
|
||||
|
||||
// 监听导入代码变化
|
||||
watchEffect(() => {
|
||||
if (!importCodeString.value) return
|
||||
|
||||
if (!importCodeString.value.startsWith(' ')) importCodeString.value = ` ${importCodeString.value}`
|
||||
if (!importCodeString.value.endsWith(' ')) importCodeString.value = `${importCodeString.value} `
|
||||
|
||||
const groups = importCodeString.value.split('>')
|
||||
filterRuleCards.value = groups.map((group: string, index: number) => ({
|
||||
pri: (index + 1).toString(),
|
||||
rules: group.split('&').filter(rule => rule),
|
||||
}))
|
||||
})
|
||||
// 保存导入的代码,直接覆盖原有值
|
||||
function saveCodeString(type: string, code: any) {
|
||||
try {
|
||||
code = code.value
|
||||
if (type === 'priority') {
|
||||
// 解析值
|
||||
if (!code) return
|
||||
// 首尾增加空格
|
||||
if (!code.startsWith(' ')) code = ` ${code}`
|
||||
if (!code.endsWith(' ')) code = `${code} `
|
||||
const groups = code.split('>')
|
||||
filterRuleCards.value = groups.map((group: string, index: number) => ({
|
||||
pri: (index + 1).toString(),
|
||||
rules: group.split('&').filter(rule => rule),
|
||||
}))
|
||||
}
|
||||
} catch (error) {
|
||||
$toast.error('导入失败!')
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 增加卡片
|
||||
function addFilterCard() {
|
||||
@@ -208,8 +224,8 @@ function onClose() {
|
||||
<VCard :title="`${props.group.name} - 配置`" class="rounded-t">
|
||||
<DialogCloseBtn v-model="groupInfoDialog" />
|
||||
<VDivider />
|
||||
<VCardText>
|
||||
<VRow>
|
||||
<VCardItem class="pt-1">
|
||||
<VRow class="mt-1">
|
||||
<VCol cols="12" md="6">
|
||||
<VTextField
|
||||
v-model="groupInfo.name"
|
||||
@@ -241,7 +257,7 @@ function onClose() {
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VCardText>
|
||||
</VCardItem>
|
||||
<VCardText>
|
||||
<draggable
|
||||
v-model="filterRuleCards"
|
||||
@@ -268,7 +284,7 @@ function onClose() {
|
||||
<VBtn color="primary" variant="tonal" @click="addFilterCard">
|
||||
<VIcon icon="mdi-plus" />
|
||||
</VBtn>
|
||||
<VBtn color="success" variant="tonal" @click="importRules">
|
||||
<VBtn color="success" variant="tonal" @click="importRules('priority')">
|
||||
<VIcon icon="mdi-import" />
|
||||
</VBtn>
|
||||
<VBtn color="info" variant="tonal" @click="shareRules">
|
||||
@@ -279,8 +295,13 @@ function onClose() {
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<VDialog v-model="importCodeDialog" width="60rem" scrollable>
|
||||
<ImportCodeDialog v-model="importCodeString" title="导入优先级规则" @close="importCodeDialog = false" />
|
||||
</VDialog>
|
||||
<ImportCodeDialog
|
||||
v-if="importCodeDialog"
|
||||
v-model="importCodeDialog"
|
||||
title="导入规则优先级"
|
||||
:dataType="importCodeType"
|
||||
@close="importCodeDialog = false"
|
||||
@save="saveCodeString"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { formatSeason } from '@/@core/utils/formatters'
|
||||
import api from '@/api'
|
||||
import { doneNProgress, startNProgress } from '@/api/nprogress'
|
||||
import type { MediaInfo, NotExistMediaInfo, Subscribe, TmdbSeason } from '@/api/types'
|
||||
import router from '@/router'
|
||||
import router, { registerAbortController } from '@/router'
|
||||
import noImage from '@images/no-image.jpeg'
|
||||
import tmdbImage from '@images/logos/tmdb.png'
|
||||
import doubanImage from '@images/logos/douban-black.png'
|
||||
@@ -59,7 +59,11 @@ const seasonInfos = ref<TmdbSeason[]>([])
|
||||
|
||||
// 选中的订阅季
|
||||
const seasonsSelected = ref<TmdbSeason[]>([])
|
||||
let abortController: AbortController | null = null;
|
||||
|
||||
abortController = new AbortController();
|
||||
registerAbortController(abortController);
|
||||
const { signal } = abortController;
|
||||
// 来源角标字典
|
||||
const sourceIconDict: { [key: string]: any } = {
|
||||
themoviedb: tmdbImage,
|
||||
@@ -67,6 +71,12 @@ const sourceIconDict: { [key: string]: any } = {
|
||||
bangumi: bangumiImage,
|
||||
}
|
||||
|
||||
// 绑定MediaCard元素
|
||||
const mediaCardRef = ref<HTMLElement | null>(null)
|
||||
|
||||
// 创建Intersection Observer实例
|
||||
const observer = ref<IntersectionObserver | null>(null)
|
||||
|
||||
// 获得mediaid
|
||||
function getMediaId() {
|
||||
if (props.media?.tmdb_id) return `tmdb:${props.media?.tmdb_id}`
|
||||
@@ -209,6 +219,7 @@ async function removeSubscribe() {
|
||||
// 查询当前媒体是否已订阅
|
||||
async function handleCheckSubscribe() {
|
||||
try {
|
||||
|
||||
const result = await checkSubscribe(props.media?.season)
|
||||
if (result) isSubscribed.value = true
|
||||
} catch (error) {
|
||||
@@ -219,6 +230,7 @@ async function handleCheckSubscribe() {
|
||||
// 查询当前媒体是否已入库
|
||||
async function handleCheckExists() {
|
||||
try {
|
||||
|
||||
const result: { [key: string]: any } = await api.get('mediaserver/exists', {
|
||||
params: {
|
||||
tmdbid: props.media?.tmdb_id,
|
||||
@@ -227,6 +239,7 @@ async function handleCheckExists() {
|
||||
season: props.media?.season,
|
||||
mtype: props.media?.type,
|
||||
},
|
||||
signal
|
||||
})
|
||||
|
||||
if (result.success) isExists.value = true
|
||||
@@ -238,6 +251,7 @@ async function handleCheckExists() {
|
||||
// 调用API检查是否已订阅,电视剧需要指定季
|
||||
async function checkSubscribe(season = 0) {
|
||||
try {
|
||||
|
||||
const mediaid = getMediaId()
|
||||
|
||||
const result: Subscribe = await api.get(`subscribe/media/${mediaid}`, {
|
||||
@@ -245,6 +259,7 @@ async function checkSubscribe(season = 0) {
|
||||
season,
|
||||
title: props.media?.title,
|
||||
},
|
||||
signal
|
||||
})
|
||||
|
||||
return result.id || null
|
||||
@@ -359,10 +374,40 @@ function handleSearch() {
|
||||
})
|
||||
}
|
||||
|
||||
// 装载时检查是否已订阅
|
||||
onBeforeMount(() => {
|
||||
// 懒加载检查
|
||||
function handleCheckLazy() {
|
||||
handleCheckSubscribe()
|
||||
handleCheckExists()
|
||||
}
|
||||
|
||||
// 在元素进入视窗时触发懒加载函数
|
||||
function setupIntersectionObserver() {
|
||||
if (mediaCardRef.value) {
|
||||
observer.value = new IntersectionObserver(
|
||||
entries => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
// 只要MediaCard进入视窗,就调用懒加载的操作
|
||||
handleCheckLazy()
|
||||
// 加载后销毁观察者实例
|
||||
observer.value?.disconnect()
|
||||
observer.value = null
|
||||
}
|
||||
})
|
||||
},
|
||||
{ threshold: 0.1 },
|
||||
)
|
||||
observer.value.observe(mediaCardRef.value)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
setupIntersectionObserver()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
observer.value?.disconnect()
|
||||
observer.value = null
|
||||
})
|
||||
|
||||
// 计算图片地址
|
||||
@@ -407,82 +452,56 @@ function onRemoveSubscribe() {
|
||||
<template>
|
||||
<VHover>
|
||||
<template #default="hover">
|
||||
<VCard
|
||||
v-bind="hover.props"
|
||||
:height="props.height"
|
||||
:width="props.width"
|
||||
class="outline-none shadow ring-gray-500 rounded-lg"
|
||||
:class="{
|
||||
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||
'ring-1': isImageLoaded,
|
||||
}"
|
||||
@click.stop="goMediaDetail(hover.isHovering ?? false)"
|
||||
>
|
||||
<VImg
|
||||
aspect-ratio="2/3"
|
||||
:src="getImgUrl"
|
||||
class="object-cover aspect-w-2 aspect-h-3"
|
||||
cover
|
||||
@load="isImageLoaded = true"
|
||||
@error="imageLoadError = true"
|
||||
>
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
<div ref="mediaCardRef">
|
||||
<VCard v-bind="hover.props" :height="props.height" :width="props.width"
|
||||
class="outline-none shadow ring-gray-500 rounded-lg" :class="{
|
||||
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||
'ring-1': isImageLoaded,
|
||||
}" @click.stop="goMediaDetail(hover.isHovering ?? false)">
|
||||
<VImg aspect-ratio="2/3" :src="getImgUrl" class="object-cover aspect-w-2 aspect-h-3" cover
|
||||
@load="isImageLoaded = true" @error="imageLoadError = true">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
<!-- 详情 -->
|
||||
<VCardText v-show="hover.isHovering || imageLoadError"
|
||||
class="w-full h-full flex flex-col flex-wrap justify-end align-left text-white absolute bottom-0 cursor-pointer pa-2"
|
||||
style="background: linear-gradient(rgba(45, 55, 72, 40%) 0%, rgba(45, 55, 72, 90%) 100%)">
|
||||
<span class="font-bold">{{ props.media?.year }}</span>
|
||||
<h1 class="mb-1 text-white font-extrabold text-xl line-clamp-2 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.title }}
|
||||
</h1>
|
||||
<p class="leading-4 line-clamp-4 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.overview }}
|
||||
</p>
|
||||
<div class="flex align-center justify-between">
|
||||
<IconBtn icon="mdi-magnify" color="white" @click.stop="handleSearch" />
|
||||
<IconBtn icon="mdi-heart" :color="isSubscribed ? 'error' : 'white'" @click.stop="handleSubscribe" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
<!-- 详情 -->
|
||||
<VCardText
|
||||
v-show="hover.isHovering || imageLoadError"
|
||||
class="w-full h-full flex flex-col flex-wrap justify-end align-left text-white absolute bottom-0 cursor-pointer pa-2"
|
||||
style="background: linear-gradient(rgba(45, 55, 72, 40%) 0%, rgba(45, 55, 72, 90%) 100%)"
|
||||
>
|
||||
<span class="font-bold">{{ props.media?.year }}</span>
|
||||
<h1 class="mb-1 text-white font-extrabold text-xl line-clamp-2 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.title }}
|
||||
</h1>
|
||||
<p class="leading-4 line-clamp-4 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.overview }}
|
||||
</p>
|
||||
<div class="flex align-center justify-between">
|
||||
<IconBtn icon="mdi-magnify" color="white" @click.stop="handleSearch" />
|
||||
<IconBtn icon="mdi-heart" :color="isSubscribed ? 'error' : 'white'" @click.stop="handleSubscribe" />
|
||||
</div>
|
||||
</VCardText>
|
||||
<!-- 类型角标 -->
|
||||
<VChip
|
||||
v-show="isImageLoaded"
|
||||
variant="elevated"
|
||||
size="small"
|
||||
:class="getChipColor(props.media?.type || '')"
|
||||
class="absolute left-2 top-2 bg-opacity-80 shadow-md text-white font-bold"
|
||||
>
|
||||
{{ props.media?.type }}
|
||||
</VChip>
|
||||
<!-- 本地存在标识 -->
|
||||
<ExistIcon v-if="isExists && !hover.isHovering" />
|
||||
<!-- 评分角标 -->
|
||||
<VChip
|
||||
v-if="isImageLoaded && props.media?.vote_average && !(isExists && !hover.isHovering)"
|
||||
variant="elevated"
|
||||
size="small"
|
||||
:class="getChipColor('rating')"
|
||||
class="absolute right-2 top-2 bg-opacity-80 shadow-md text-white font-bold"
|
||||
>
|
||||
{{ props.media?.vote_average }}
|
||||
</VChip>
|
||||
<!--来源图标-->
|
||||
<VAvatar
|
||||
size="24"
|
||||
density="compact"
|
||||
class="absolute bottom-1 right-1"
|
||||
tile
|
||||
v-if="!hover.isHovering && isImageLoaded && props.media?.source"
|
||||
>
|
||||
<VImg cover :src="sourceIconDict[props.media?.source]" class="shadow-lg" />
|
||||
</VAvatar>
|
||||
</VCard>
|
||||
</VCardText>
|
||||
<!-- 类型角标 -->
|
||||
<VChip v-show="isImageLoaded" variant="elevated" size="small" :class="getChipColor(props.media?.type || '')"
|
||||
class="absolute left-2 top-2 bg-opacity-80 shadow-md text-white font-bold">
|
||||
{{ props.media?.type }}
|
||||
</VChip>
|
||||
<!-- 本地存在标识 -->
|
||||
<ExistIcon v-if="isExists && !hover.isHovering" />
|
||||
<!-- 评分角标 -->
|
||||
<VChip v-if="isImageLoaded && props.media?.vote_average && !(isExists && !hover.isHovering)"
|
||||
variant="elevated" size="small" :class="getChipColor('rating')"
|
||||
class="absolute right-2 top-2 bg-opacity-80 shadow-md text-white font-bold">
|
||||
{{ props.media?.vote_average }}
|
||||
</VChip>
|
||||
<!--来源图标-->
|
||||
<VAvatar size="24" density="compact" class="absolute bottom-1 right-1" tile
|
||||
v-if="!hover.isHovering && isImageLoaded && props.media?.source">
|
||||
<VImg cover :src="sourceIconDict[props.media?.source]" class="shadow-lg" />
|
||||
</VAvatar>
|
||||
</VCard>
|
||||
</div>
|
||||
</template>
|
||||
</VHover>
|
||||
<!-- 订阅季弹窗 -->
|
||||
@@ -497,14 +516,8 @@ function onRemoveSubscribe() {
|
||||
<VList v-model:selected="seasonsSelected" lines="three" select-strategy="classic">
|
||||
<VListItem v-for="(item, i) in seasonInfos" :key="i" :value="item">
|
||||
<template #prepend>
|
||||
<VImg
|
||||
height="90"
|
||||
width="60"
|
||||
:src="getSeasonPoster(item.poster_path || '')"
|
||||
aspect-ratio="2/3"
|
||||
class="object-cover rounded shadow ring-gray-500 me-3"
|
||||
cover
|
||||
>
|
||||
<VImg height="90" width="60" :src="getSeasonPoster(item.poster_path || '')" aspect-ratio="2/3"
|
||||
class="object-cover rounded shadow ring-gray-500 me-3" cover>
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
@@ -543,12 +556,6 @@ function onRemoveSubscribe() {
|
||||
</VCard>
|
||||
</VBottomSheet>
|
||||
<!-- 订阅编辑弹窗 -->
|
||||
<SubscribeEditDialog
|
||||
v-if="subscribeEditDialog"
|
||||
v-model="subscribeEditDialog"
|
||||
:subid="subscribeId"
|
||||
@close="subscribeEditDialog = false"
|
||||
@save="subscribeEditDialog = false"
|
||||
@remove="onRemoveSubscribe"
|
||||
/>
|
||||
<SubscribeEditDialog v-if="subscribeEditDialog" v-model="subscribeEditDialog" :subid="subscribeId"
|
||||
@close="subscribeEditDialog = false" @save="subscribeEditDialog = false" @remove="onRemoveSubscribe" />
|
||||
</template>
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Context } from '@/api/types'
|
||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
defineProps({
|
||||
context: Object as PropType<Context>,
|
||||
})
|
||||
|
||||
@@ -45,8 +45,7 @@ function openTmdbPage(type: string, tmdbId: number) {
|
||||
</template>
|
||||
</VImg>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="flex-grow">
|
||||
<VCardItem class="pb-1">
|
||||
<VCardTitle class="text-center text-md-left">
|
||||
{{ context?.media_info?.title || context?.meta_info?.name }}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||
import type { Message } from '@/api/types'
|
||||
import { formatDateDifference } from '@core/utils/formatters'
|
||||
|
||||
@@ -45,24 +46,30 @@ function replaceNewLine(value: string) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard variant="tonal" :width="props.width" :height="props.height" @click="openLink">
|
||||
<VCard variant="tonal" :width="props.width" :height="props.height" @click="openLink" max-width="23rem">
|
||||
<div v-if="props.message?.image" class="relative text-center card-cover-blurred">
|
||||
<VImg
|
||||
:src="props.message?.image"
|
||||
aspect-ratio="4/3"
|
||||
aspect-ratio="3/2"
|
||||
cover
|
||||
position="top"
|
||||
:class="{ shadow: isImageLoaded }"
|
||||
@load="imageLoaded"
|
||||
@error="imageLoadError = true"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="props.message?.title && !props.message?.image && !props.message?.note"
|
||||
v-if="
|
||||
props.message?.title &&
|
||||
!props.message?.text &&
|
||||
!props.message?.image &&
|
||||
isNullOrEmptyObject(props.message?.note)
|
||||
"
|
||||
class="rounded-md text-body-1 py-2 px-4 elevation-2 bg-primary text-white chat-right mb-1"
|
||||
>
|
||||
<p class="mb-0">{{ props.message?.title }}</p>
|
||||
</div>
|
||||
<VCardTitle v-else-if="props.message?.title">
|
||||
<VCardTitle v-else-if="props.message?.title" class="break-words whitespace-break-spaces">
|
||||
{{ props.message?.title }}
|
||||
</VCardTitle>
|
||||
<div
|
||||
@@ -72,13 +79,13 @@ function replaceNewLine(value: string) {
|
||||
<p class="mb-0">{{ props.message?.text }}</p>
|
||||
</div>
|
||||
<VCardText v-if="props.message?.text && props.message?.action === 1" v-html="replaceNewLine(props.message?.text)" />
|
||||
<VCardText v-if="props.message?.note">
|
||||
<VCardText v-if="!isNullOrEmptyObject(props.message?.note)">
|
||||
<VList>
|
||||
<VListItem v-for="(value, key) in noteToJson()" :key="key" two-line>
|
||||
<VListItemTitle v-if="value.title_year" class="font-bold">
|
||||
<VListItemTitle v-if="value.title_year" class="font-bold break-words whitespace-break-spaces">
|
||||
{{ key + 1 }}. {{ value.title_year }}
|
||||
</VListItemTitle>
|
||||
<VListItemTitle v-if="value.enclosure" class="font-bold whitespace-break-spaces">
|
||||
<VListItemTitle v-if="value.enclosure" class="font-bold break-words whitespace-break-spaces">
|
||||
{{ key + 1 }}. {{ value.title }} {{ value.volume_factor }} ↑{{ value.seeders }}
|
||||
</VListItemTitle>
|
||||
<VListItemSubtitle v-if="value.type">
|
||||
|
||||
@@ -43,11 +43,8 @@ const imageLoadError = ref(false)
|
||||
// 更新日志弹窗
|
||||
const releaseDialog = ref(false)
|
||||
|
||||
// 计算插件标签
|
||||
const pluginLabels = computed(() => {
|
||||
if (!props.plugin?.plugin_label) return []
|
||||
return props.plugin.plugin_label.split(',')
|
||||
})
|
||||
// 插件详情弹窗
|
||||
const detailDialog = ref(false)
|
||||
|
||||
// 图片加载完成
|
||||
async function imageLoaded() {
|
||||
@@ -76,7 +73,7 @@ async function installPlugin() {
|
||||
|
||||
if (result.success) {
|
||||
$toast.success(`插件 ${props.plugin?.plugin_name} 安装成功!`)
|
||||
|
||||
detailDialog.value = false
|
||||
// 通知父组件刷新
|
||||
emit('install')
|
||||
} else {
|
||||
@@ -149,80 +146,141 @@ const dropdownItems = ref([
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCard :width="props.width" :height="props.height" @click="installPlugin" class="flex flex-col">
|
||||
<div class="me-n3 absolute bottom-0 right-3">
|
||||
<IconBtn>
|
||||
<VIcon icon="mdi-dots-vertical" />
|
||||
<VMenu activator="parent" close-on-content-click>
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="(item, i) in dropdownItems"
|
||||
v-show="item.show"
|
||||
:key="i"
|
||||
variant="plain"
|
||||
@click="item.props.click"
|
||||
>
|
||||
<template #prepend>
|
||||
<VIcon :icon="item.props.prependIcon" />
|
||||
</template>
|
||||
<VListItemTitle v-text="item.title" />
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</div>
|
||||
<div
|
||||
class="relative flex flex-row items-start pa-3 justify-between grow"
|
||||
:style="{ background: `${backgroundColor}` }"
|
||||
>
|
||||
<div>
|
||||
<VCard :width="props.width" :height="props.height" @click="detailDialog = true" class="flex flex-col h-full">
|
||||
<div
|
||||
class="absolute inset-0 bg-cover bg-center"
|
||||
:style="{ background: `${backgroundColor}`, filter: 'brightness(0.5)' }"
|
||||
></div>
|
||||
<div class="relative flex-1 min-w-0">
|
||||
<VCardTitle class="text-white px-2 text-shadow whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
{{ props.plugin?.plugin_name }}
|
||||
<span class="text-sm text-gray-200">v{{ props.plugin?.plugin_version }}</span>
|
||||
</VCardTitle>
|
||||
<VCardText class="text-white px-2 py-1 text-shadow line-clamp-3">
|
||||
{{ props.plugin?.plugin_desc }}
|
||||
</VCardText>
|
||||
class="relative flex flex-row items-start pa-3 justify-between grow"
|
||||
:style="{ background: `${backgroundColor}` }"
|
||||
>
|
||||
<div
|
||||
class="absolute inset-0 bg-cover bg-center"
|
||||
:style="{ background: `${backgroundColor}`, filter: 'brightness(0.5)' }"
|
||||
></div>
|
||||
<div class="relative flex-1 min-w-0">
|
||||
<VCardTitle class="text-white text-lg px-2 text-shadow whitespace-nowrap overflow-hidden text-ellipsis ...">
|
||||
{{ props.plugin?.plugin_name }}
|
||||
<span class="text-sm text-gray-200">v{{ props.plugin?.plugin_version }}</span>
|
||||
</VCardTitle>
|
||||
<VCardText class="text-white text-sm px-2 py-0 text-shadow overflow-hidden line-clamp-3 ...">
|
||||
{{ props.plugin?.plugin_desc }}
|
||||
</VCardText>
|
||||
</div>
|
||||
<div class="relative flex-shrink-0 self-center">
|
||||
<VAvatar size="64">
|
||||
<VImg
|
||||
ref="imageRef"
|
||||
:src="iconPath"
|
||||
aspect-ratio="4/3"
|
||||
cover
|
||||
:class="{ shadow: isImageLoaded }"
|
||||
@load="imageLoaded"
|
||||
@error="imageLoadError = true"
|
||||
/>
|
||||
</VAvatar>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative flex-shrink-0 self-center">
|
||||
<VAvatar size="64">
|
||||
<VImg
|
||||
ref="imageRef"
|
||||
:src="iconPath"
|
||||
aspect-ratio="4/3"
|
||||
cover
|
||||
:class="{ shadow: isImageLoaded }"
|
||||
@load="imageLoaded"
|
||||
@error="imageLoadError = true"
|
||||
/>
|
||||
</VAvatar>
|
||||
</div>
|
||||
</div>
|
||||
<VCardText class="flex flex-none align-self-baseline py-3 w-full align-end">
|
||||
<span>
|
||||
<VIcon icon="mdi-github" class="me-1" />
|
||||
<a :href="props.plugin?.author_url" target="_blank" @click.stop>
|
||||
{{ props.plugin?.plugin_author }}
|
||||
</a>
|
||||
</span>
|
||||
<span v-if="props.count" class="ms-3">
|
||||
<VIcon icon="mdi-download" />
|
||||
<span class="text-sm ms-1 mt-1">{{ props.count?.toLocaleString() }}</span>
|
||||
</span>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
<!-- 安装插件进度框 -->
|
||||
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" />
|
||||
<!-- 更新日志 -->
|
||||
<VDialog v-if="releaseDialog" v-model="releaseDialog" width="600" scrollable>
|
||||
<VCard :title="`${props.plugin?.plugin_name} 更新说明`">
|
||||
<DialogCloseBtn @click="releaseDialog = false" />
|
||||
<VDivider />
|
||||
<VersionHistory :history="props.plugin?.history" />
|
||||
<VCardText class="flex flex-none align-self-baseline py-3 w-full align-end">
|
||||
<span>
|
||||
<VIcon icon="mdi-github" class="me-1" />
|
||||
<a :href="props.plugin?.author_url" target="_blank" @click.stop>
|
||||
{{ props.plugin?.plugin_author }}
|
||||
</a>
|
||||
</span>
|
||||
<span v-if="props.count" class="ms-3">
|
||||
<VIcon icon="mdi-download" />
|
||||
<span class="text-sm ms-1 mt-1">{{ props.count?.toLocaleString() }}</span>
|
||||
</span>
|
||||
<div class="me-n3 absolute bottom-1 right-3">
|
||||
<IconBtn>
|
||||
<VIcon icon="mdi-dots-vertical" />
|
||||
<VMenu activator="parent" close-on-content-click>
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="(item, i) in dropdownItems"
|
||||
v-show="item.show"
|
||||
:key="i"
|
||||
variant="plain"
|
||||
@click="item.props.click"
|
||||
>
|
||||
<template #prepend>
|
||||
<VIcon :icon="item.props.prependIcon" />
|
||||
</template>
|
||||
<VListItemTitle v-text="item.title" />
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</div>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- 安装插件进度框 -->
|
||||
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" />
|
||||
<!-- 更新日志 -->
|
||||
<VDialog v-if="releaseDialog" v-model="releaseDialog" width="600" scrollable>
|
||||
<VCard :title="`${props.plugin?.plugin_name} 更新说明`">
|
||||
<DialogCloseBtn @click="releaseDialog = false" />
|
||||
<VDivider />
|
||||
<VersionHistory :history="props.plugin?.history" />
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- 插件详情-->
|
||||
<VDialog v-if="detailDialog" v-model="detailDialog" max-width="30rem">
|
||||
<VCard>
|
||||
<DialogCloseBtn @click="detailDialog = false" />
|
||||
<VCardText>
|
||||
<VCol>
|
||||
<div class="d-flex justify-space-between flex-wrap flex-md-nowrap flex-column flex-md-row">
|
||||
<div class="mx-auto mt-5">
|
||||
<VAvatar size="64">
|
||||
<VImg
|
||||
ref="imageRef"
|
||||
:src="iconPath"
|
||||
aspect-ratio="4/3"
|
||||
cover
|
||||
:class="{ shadow: isImageLoaded }"
|
||||
@load="imageLoaded"
|
||||
@error="imageLoadError = true"
|
||||
/>
|
||||
</VAvatar>
|
||||
</div>
|
||||
<div class="flex-grow">
|
||||
<VCardItem>
|
||||
<VCardTitle class="text-center text-md-left">
|
||||
{{ props.plugin?.plugin_name }}
|
||||
</VCardTitle>
|
||||
<VCardSubtitle
|
||||
class="text-center text-md-left break-words whitespace-break-spaces line-clamp-4 overflow-hidden text-ellipsis ..."
|
||||
>
|
||||
{{ props.plugin?.plugin_desc }}
|
||||
</VCardSubtitle>
|
||||
<VList lines="one">
|
||||
<VListItem class="ps-0">
|
||||
<VListItemTitle class="text-center text-md-left">
|
||||
<span class="font-weight-medium">版本:</span>
|
||||
<span class="text-body-1"> v{{ props.plugin?.plugin_version }}</span>
|
||||
</VListItemTitle>
|
||||
</VListItem>
|
||||
<VListItem class="ps-0">
|
||||
<VListItemTitle class="text-center text-md-left">
|
||||
<span class="font-weight-medium">作者:</span>
|
||||
<span class="text-body-1 cursor-pointer" @click="visitPluginPage">
|
||||
{{ props.plugin?.plugin_author }}
|
||||
</span>
|
||||
</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
<div class="text-center text-md-left">
|
||||
<VBtn color="primary" @click="installPlugin" prepend-icon="mdi-download"> 安装到本地 </VBtn>
|
||||
<div class="text-xs mt-2" v-if="props.count">
|
||||
<VIcon icon="mdi-fire" />共 {{ props.count?.toLocaleString() }} 次下载
|
||||
</div>
|
||||
</div>
|
||||
</VCardItem>
|
||||
</div>
|
||||
</div>
|
||||
</VCol>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import { useConfirm } from 'vuetify-use-dialog'
|
||||
import { VIcon } from 'vuetify/lib/components/index.mjs'
|
||||
import api from '@/api'
|
||||
import type { Plugin } from '@/api/types'
|
||||
import FormRender from '@/components/render/FormRender.vue'
|
||||
@@ -15,6 +14,8 @@ import ProgressDialog from '../dialog/ProgressDialog.vue'
|
||||
|
||||
// 显示器宽度
|
||||
const display = useDisplay()
|
||||
// APP
|
||||
const appMode = inject('pwaMode') && display.mdAndDown.value
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
@@ -49,6 +50,9 @@ const pluginConfigDialog = ref(false)
|
||||
// 插件配置表单数据
|
||||
const pluginConfigForm = ref({})
|
||||
|
||||
// 菜单显示状态
|
||||
const menuVisible = ref(false)
|
||||
|
||||
// 进度框
|
||||
const progressDialog = ref(false)
|
||||
|
||||
@@ -390,130 +394,146 @@ watch(
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 插件卡片 -->
|
||||
<VCard v-if="isVisible" :width="props.width" :height="props.height" @click="openPluginDetail" class="flex flex-col">
|
||||
<div class="me-n3 absolute bottom-0 right-3">
|
||||
<IconBtn>
|
||||
<VIcon icon="mdi-dots-vertical" />
|
||||
<VMenu activator="parent" close-on-content-click>
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="(item, i) in dropdownItems"
|
||||
v-show="item.show"
|
||||
:key="i"
|
||||
variant="plain"
|
||||
:base-color="item.props.color"
|
||||
@click="item.props.click"
|
||||
>
|
||||
<template #prepend>
|
||||
<VIcon :icon="item.props.prependIcon" />
|
||||
</template>
|
||||
<VListItemTitle v-text="item.title" />
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</div>
|
||||
<div
|
||||
class="relative flex flex-row items-start pa-3 justify-between grow"
|
||||
:style="{ background: `${backgroundColor}` }"
|
||||
>
|
||||
<div
|
||||
class="absolute inset-0 bg-cover bg-center"
|
||||
:style="{ background: `${backgroundColor}`, filter: 'brightness(0.5)' }"
|
||||
/>
|
||||
<div class="relative flex-1 min-w-0">
|
||||
<VCardTitle class="text-white px-2 text-shadow whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
<VBadge v-if="props.plugin?.state" dot inline color="success" />
|
||||
{{ props.plugin?.plugin_name }}
|
||||
<span class="text-sm mt-1 text-gray-200">v{{ props.plugin?.plugin_version }}</span>
|
||||
</VCardTitle>
|
||||
<VCardText class="px-2 py-1 text-white text-shadow line-clamp-3">
|
||||
{{ props.plugin?.plugin_desc }}
|
||||
<div>
|
||||
<!-- 插件卡片 -->
|
||||
<VHover>
|
||||
<template #default="hover">
|
||||
<VCard
|
||||
v-if="isVisible"
|
||||
v-bind="hover.props"
|
||||
:width="props.width"
|
||||
:height="props.height"
|
||||
@click="openPluginDetail"
|
||||
class="flex flex-col h-full"
|
||||
>
|
||||
<div
|
||||
class="relative flex flex-row items-start pa-3 justify-between grow"
|
||||
:style="{ background: `${backgroundColor}` }"
|
||||
>
|
||||
<div
|
||||
class="absolute inset-0 bg-cover bg-center"
|
||||
:style="{ background: `${backgroundColor}`, filter: 'brightness(0.5)' }"
|
||||
/>
|
||||
<div class="relative flex-1 min-w-0">
|
||||
<VCardTitle class="text-white text-lg px-2 text-shadow whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
<VBadge v-if="props.plugin?.state" dot inline color="success" />
|
||||
{{ props.plugin?.plugin_name }}
|
||||
<span class="text-sm mt-1 text-gray-200"> v{{ props.plugin?.plugin_version }} </span>
|
||||
</VCardTitle>
|
||||
<VCardText class="px-2 py-0 text-white text-sm text-shadow overflow-hidden line-clamp-3 ...">
|
||||
{{ props.plugin?.plugin_desc }}
|
||||
</VCardText>
|
||||
</div>
|
||||
<div class="relative flex-shrink-0 self-center">
|
||||
<VAvatar size="64">
|
||||
<VImg
|
||||
ref="imageRef"
|
||||
:src="iconPath"
|
||||
aspect-ratio="4/3"
|
||||
cover
|
||||
:class="{ shadow: isImageLoaded }"
|
||||
@load="imageLoaded"
|
||||
@error="imageLoadError = true"
|
||||
/>
|
||||
</VAvatar>
|
||||
</div>
|
||||
</div>
|
||||
<VCardText class="flex flex-none align-self-baseline py-3 w-full align-end">
|
||||
<span class="author-info">
|
||||
<VImg :src="authorPath" class="author-avatar" @load="isAvatarLoaded = true">
|
||||
<VIcon v-if="!isAvatarLoaded" icon="mdi-github" class="me-1" />
|
||||
</VImg>
|
||||
<a :href="props.plugin?.author_url" target="_blank" @click.stop>
|
||||
{{ props.plugin?.plugin_author }}
|
||||
</a>
|
||||
</span>
|
||||
<span v-if="props.count" class="ms-3">
|
||||
<VIcon icon="mdi-download" />
|
||||
<span class="text-sm ms-1 mt-1">{{ props.count?.toLocaleString() }}</span>
|
||||
</span>
|
||||
<div class="me-n3 absolute bottom-1 right-3">
|
||||
<IconBtn>
|
||||
<VIcon icon="mdi-dots-vertical" />
|
||||
<VMenu v-model="menuVisible" activator="parent" close-on-content-click>
|
||||
<VList>
|
||||
<VListItem
|
||||
v-for="(item, i) in dropdownItems"
|
||||
v-show="item.show"
|
||||
:key="i"
|
||||
variant="plain"
|
||||
:base-color="item.props.color"
|
||||
@click="item.props.click"
|
||||
>
|
||||
<template #prepend>
|
||||
<VIcon :icon="item.props.prependIcon" />
|
||||
</template>
|
||||
<VListItemTitle v-text="item.title" />
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</div>
|
||||
</VCardText>
|
||||
<div v-if="hover.isHovering" class="me-n3 absolute top-0 right-5">
|
||||
<VIcon class="cursor-move text-white">mdi-drag</VIcon>
|
||||
</div>
|
||||
<div v-else-if="props.plugin?.has_update" class="me-n3 absolute top-0 right-5">
|
||||
<VIcon icon="mdi-new-box" class="text-white" />
|
||||
</div>
|
||||
</VCard>
|
||||
</template>
|
||||
</VHover>
|
||||
|
||||
<!-- 插件配置页面 -->
|
||||
<VDialog v-model="pluginConfigDialog" scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
|
||||
<VCard :title="`${props.plugin?.plugin_name} - 配置`" class="rounded-t">
|
||||
<DialogCloseBtn v-model="pluginConfigDialog" />
|
||||
<VDivider />
|
||||
<VCardText>
|
||||
<FormRender v-for="(item, index) in pluginFormItems" :key="index" :config="item" :form="pluginConfigForm" />
|
||||
</VCardText>
|
||||
</div>
|
||||
<div class="relative flex-shrink-0 self-center">
|
||||
<VAvatar size="64">
|
||||
<VImg
|
||||
ref="imageRef"
|
||||
:src="iconPath"
|
||||
aspect-ratio="4/3"
|
||||
cover
|
||||
:class="{ shadow: isImageLoaded }"
|
||||
@load="imageLoaded"
|
||||
@error="imageLoadError = true"
|
||||
/>
|
||||
</VAvatar>
|
||||
</div>
|
||||
</div>
|
||||
<VCardText class="flex flex-none align-self-baseline py-3 w-full align-end">
|
||||
<span class="author-info">
|
||||
<VImg :src="authorPath" class="author-avatar" @load="isAvatarLoaded = true">
|
||||
<VIcon v-if="!isAvatarLoaded" icon="mdi-github" class="me-1" />
|
||||
</VImg>
|
||||
<a :href="props.plugin?.author_url" target="_blank" @click.stop>
|
||||
{{ props.plugin?.plugin_author }}
|
||||
</a>
|
||||
</span>
|
||||
<span v-if="props.count" class="ms-3">
|
||||
<VIcon icon="mdi-download" />
|
||||
<span class="text-sm ms-1 mt-1">{{ props.count?.toLocaleString() }}</span>
|
||||
</span>
|
||||
</VCardText>
|
||||
<div v-if="props.plugin?.has_update" class="me-n3 absolute top-0 right-5">
|
||||
<VIcon icon="mdi-new-box" class="text-white" />
|
||||
</div>
|
||||
</VCard>
|
||||
<VCardActions class="pt-3">
|
||||
<VBtn v-if="pluginPageItems.length > 0" @click="showPluginInfo" variant="outlined" color="info">
|
||||
查看数据
|
||||
</VBtn>
|
||||
<VSpacer />
|
||||
<VBtn @click="savePluginConf" variant="elevated" prepend-icon="mdi-content-save" class="px-5"> 保存 </VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
|
||||
<!-- 插件配置页面 -->
|
||||
<VDialog v-model="pluginConfigDialog" scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
|
||||
<VCard :title="`${props.plugin?.plugin_name} - 配置`" class="rounded-t">
|
||||
<DialogCloseBtn v-model="pluginConfigDialog" />
|
||||
<VDivider />
|
||||
<VCardText>
|
||||
<FormRender v-for="(item, index) in pluginFormItems" :key="index" :config="item" :form="pluginConfigForm" />
|
||||
</VCardText>
|
||||
<VCardActions class="pt-3">
|
||||
<VBtn v-if="pluginPageItems.length > 0" @click="showPluginInfo" variant="outlined" color="info">
|
||||
查看数据
|
||||
</VBtn>
|
||||
<VSpacer />
|
||||
<VBtn @click="savePluginConf" variant="elevated" prepend-icon="mdi-content-save" class="px-5"> 保存 </VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- 插件数据页面 -->
|
||||
<VDialog v-model="pluginInfoDialog" scrollable max-width="80rem" :fullscreen="!display.mdAndUp.value">
|
||||
<VCard :title="`${props.plugin?.plugin_name}`" class="rounded-t">
|
||||
<DialogCloseBtn v-model="pluginInfoDialog" />
|
||||
<VCardText class="min-h-40">
|
||||
<PageRender @action="loadPluginPage" v-for="(item, index) in pluginPageItems" :key="index" :config="item" />
|
||||
</VCardText>
|
||||
<VFab icon="mdi-cog" location="bottom" size="x-large" fixed app appear @click="showPluginConfig" :class="{ 'mb-10': appMode }" />
|
||||
</VCard>
|
||||
</VDialog>
|
||||
|
||||
<!-- 插件数据页面 -->
|
||||
<VDialog v-model="pluginInfoDialog" scrollable max-width="80rem" :fullscreen="!display.mdAndUp.value">
|
||||
<VCard :title="`${props.plugin?.plugin_name}`" class="rounded-t">
|
||||
<DialogCloseBtn v-model="pluginInfoDialog" />
|
||||
<VCardText class="min-h-40">
|
||||
<PageRender @action="loadPluginPage" v-for="(item, index) in pluginPageItems" :key="index" :config="item" />
|
||||
</VCardText>
|
||||
<VFab icon="mdi-cog" location="bottom" size="x-large" fixed app appear @click="showPluginConfig" />
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- 进度框 -->
|
||||
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" />
|
||||
|
||||
<!-- 进度框 -->
|
||||
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" />
|
||||
|
||||
<!-- 更新日志 -->
|
||||
<VDialog v-if="releaseDialog" v-model="releaseDialog" width="600" scrollable>
|
||||
<VCard :title="`${props.plugin?.plugin_name} 更新说明`">
|
||||
<DialogCloseBtn @click="releaseDialog = false" />
|
||||
<VDivider />
|
||||
<VersionHistory :history="props.plugin?.history" />
|
||||
<VDivider />
|
||||
<VCardText>
|
||||
<VBtn @click="updatePlugin" block>
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-arrow-up-circle-outline" />
|
||||
</template>
|
||||
更新到最新版本
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- 更新日志 -->
|
||||
<VDialog v-if="releaseDialog" v-model="releaseDialog" width="600" scrollable>
|
||||
<VCard :title="`${props.plugin?.plugin_name} 更新说明`">
|
||||
<DialogCloseBtn @click="releaseDialog = false" />
|
||||
<VDivider />
|
||||
<VersionHistory :history="props.plugin?.history" />
|
||||
<VDivider />
|
||||
<VCardText>
|
||||
<VBtn @click="updatePlugin" block>
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-arrow-up-circle-outline" />
|
||||
</template>
|
||||
更新到最新版本
|
||||
</VBtn>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -8,7 +8,6 @@ import SiteCookieUpdateDialog from '../dialog/SiteCookieUpdateDialog.vue'
|
||||
import api from '@/api'
|
||||
import type { Site, SiteStatistic, SiteUserData } from '@/api/types'
|
||||
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||
import { VCardActions, VExpandTransition, VProgressLinear, VSpacer } from 'vuetify/lib/components/index.mjs'
|
||||
import { formatFileSize } from '@/@core/utils/formatters'
|
||||
|
||||
// 输入参数
|
||||
@@ -27,7 +26,7 @@ const siteIcon = ref<string>('')
|
||||
const $toast = useToast()
|
||||
|
||||
// 测试按钮文字
|
||||
const testButtonText = ref('测试')
|
||||
const testButtonText = ref('连通性测试')
|
||||
|
||||
// 测试按钮可用性
|
||||
const testButtonDisable = ref(false)
|
||||
@@ -44,9 +43,6 @@ const resourceDialog = ref(false)
|
||||
// 用户数据弹窗
|
||||
const siteUserDataDialog = ref(false)
|
||||
|
||||
// 站点操作显示
|
||||
const siteActionShow = ref(false)
|
||||
|
||||
// 站点使用统计
|
||||
const siteStats = ref<SiteStatistic>({})
|
||||
|
||||
@@ -69,7 +65,7 @@ async function testSite() {
|
||||
if (result.success) $toast.success(`${cardProps.site?.name} 连通性测试成功,可正常使用!`)
|
||||
else $toast.error(`${cardProps.site?.name} 连通性测试失败:${result.message}`)
|
||||
|
||||
testButtonText.value = '测试'
|
||||
testButtonText.value = '连通性测试'
|
||||
testButtonDisable.value = false
|
||||
|
||||
getSiteStats()
|
||||
@@ -156,7 +152,7 @@ onMounted(() => {
|
||||
<div>
|
||||
<VCard
|
||||
:variant="cardProps.site?.is_active ? 'elevated' : 'outlined'"
|
||||
class="overflow-hidden"
|
||||
class="overflow-hidden h-full flex flex-col"
|
||||
@click="siteEditDialog = true"
|
||||
>
|
||||
<template #image>
|
||||
@@ -195,44 +191,42 @@ onMounted(() => {
|
||||
</VTooltip>
|
||||
</VCardText>
|
||||
<VCardActions>
|
||||
<VBtn
|
||||
:icon="siteActionShow ? 'mdi-chevron-up' : 'mdi-chevron-down'"
|
||||
@click.stop="siteActionShow = !siteActionShow"
|
||||
/>
|
||||
<IconBtn>
|
||||
<VIcon icon="mdi-chevron-down" color="primary" />
|
||||
<VMenu activator="parent" close-on-content-click>
|
||||
<VList>
|
||||
<VListItem variant="plain" v-if="!cardProps.site?.public" @click="handleSiteUpdate">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-refresh" />
|
||||
</template>
|
||||
<VListItemTitle>更新 Cookie & UA</VListItemTitle>
|
||||
</VListItem>
|
||||
<VListItem variant="plain" :disabled="testButtonDisable" @click.stop="testSite">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-link" />
|
||||
</template>
|
||||
<VListItemTitle>{{ testButtonText }}</VListItemTitle>
|
||||
</VListItem>
|
||||
<VListItem variant="plain" @click="handleResourceBrowse">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-web" />
|
||||
</template>
|
||||
<VListItemTitle>资源预览</VListItemTitle>
|
||||
</VListItem>
|
||||
<VListItem variant="plain" @click="handleSiteUserData">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-chart-bell-curve" />
|
||||
</template>
|
||||
<VListItemTitle>站点数据</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
<span class="text-sm">
|
||||
↑ {{ formatFileSize(cardProps.data?.upload || 0) }} / ↓ {{ formatFileSize(cardProps.data?.download || 0) }}
|
||||
</span>
|
||||
<VSpacer />
|
||||
</VCardActions>
|
||||
<VDivider class="mb-1" v-if="siteActionShow" />
|
||||
<VExpandTransition>
|
||||
<div v-show="siteActionShow" class="py-1 pe-12">
|
||||
<VBtn v-if="!cardProps.site?.public" @click.stop="handleSiteUpdate" variant="text">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-refresh" />
|
||||
</template>
|
||||
更新
|
||||
</VBtn>
|
||||
<VBtn :disabled="testButtonDisable" @click.stop="testSite" variant="text">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-link" />
|
||||
</template>
|
||||
{{ testButtonText }}
|
||||
</VBtn>
|
||||
<VBtn @click.stop="handleResourceBrowse" variant="text">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-web" />
|
||||
</template>
|
||||
浏览
|
||||
</VBtn>
|
||||
<VBtn @click.stop="handleSiteUserData" variant="text">
|
||||
<template #prepend>
|
||||
<VIcon icon="mdi-chart-bell-curve" />
|
||||
</template>
|
||||
数据
|
||||
</VBtn>
|
||||
</div>
|
||||
</VExpandTransition>
|
||||
<StatIcon v-if="cardProps.site?.is_active" :color="statColor" />
|
||||
<span class="absolute top-1 right-8">
|
||||
<VIcon class="cursor-move">mdi-drag</VIcon>
|
||||
|
||||
@@ -38,8 +38,11 @@ const subscribeFilesDialog = ref(false)
|
||||
// 分享订阅弹窗
|
||||
const subscribeShareDialog = ref(false)
|
||||
|
||||
// 当前的订阅状态
|
||||
const subscribeState = ref<string>(props.media?.state ?? 'P')
|
||||
|
||||
// 上一次更新时间
|
||||
const lastUpdateText = ref(props.media && props.media.last_update ? formatDateDifference(props.media.last_update) : '')
|
||||
const lastUpdateText = computed(() => (props.media?.last_update ? formatDateDifference(props.media.last_update) : ''))
|
||||
|
||||
// 图片加载完成响应
|
||||
function imageLoadHandler() {
|
||||
@@ -81,13 +84,39 @@ async function searchSubscribe() {
|
||||
}
|
||||
}
|
||||
|
||||
// 切换订阅状态
|
||||
async function toggleSubscribeStatus(state: 'R' | 'S') {
|
||||
try {
|
||||
// 根据传入的 state 判断对应的操作文字
|
||||
const action = state === 'S' ? '暂停' : '启用'
|
||||
// 弹出确认框
|
||||
const isConfirmed = await createConfirm({
|
||||
title: `确认${action}`,
|
||||
content: `是否${action}订阅 ${props.media?.name}?`,
|
||||
})
|
||||
if (!isConfirmed) return
|
||||
// 调用 API 更新订阅状态
|
||||
const result: { [key: string]: any } = await api.put(`subscribe/status/${props.media?.id}?state=${state}`)
|
||||
// 提示
|
||||
if (result.success) {
|
||||
$toast.success(`${props.media?.name} 已${action}!`)
|
||||
subscribeState.value = state
|
||||
emit('save')
|
||||
} else {
|
||||
$toast.error(`${action}失败:${result.message}`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 重置订阅
|
||||
async function resetSubscribe() {
|
||||
// 确认
|
||||
try {
|
||||
const isConfirmed = await createConfirm({
|
||||
title: '确认',
|
||||
content: `重置后 ${props.media?.name} 已下载记录将被清除,未入库的剧集将会重新下载,是否确认?`,
|
||||
content: `重置后 ${props.media?.name} 将恢复初始状态,已下载记录将被清除,未入库的内容将会重新下载,是否确认?`,
|
||||
})
|
||||
if (!isConfirmed) return
|
||||
// 重置
|
||||
@@ -95,6 +124,7 @@ async function resetSubscribe() {
|
||||
// 提示
|
||||
if (result.success) {
|
||||
$toast.success(`${props.media?.name} 重置成功!`)
|
||||
subscribeState.value = 'R'
|
||||
emit('save')
|
||||
} else $toast.error(`${props.media?.name} 重置失败:${result.message}`)
|
||||
} catch (e) {
|
||||
@@ -129,7 +159,7 @@ async function viewSubscribeFiles() {
|
||||
}
|
||||
|
||||
// 弹出菜单
|
||||
const dropdownItems = ref([
|
||||
const dropdownItems = computed(() => [
|
||||
{
|
||||
title: '编辑',
|
||||
value: 1,
|
||||
@@ -163,18 +193,26 @@ const dropdownItems = ref([
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '重置',
|
||||
title: subscribeState.value === 'S' ? '启用' : '暂停',
|
||||
value: 5,
|
||||
props: {
|
||||
prependIcon: subscribeState.value === 'S' ? 'mdi-play' : 'mdi-pause',
|
||||
click: () => toggleSubscribeStatus(subscribeState.value === 'S' ? 'R' : 'S'),
|
||||
color: subscribeState.value === 'S' ? 'success' : 'info',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '重置',
|
||||
value: 6,
|
||||
props: {
|
||||
prependIcon: 'mdi-restore-alert',
|
||||
click: resetSubscribe,
|
||||
color: 'warning',
|
||||
},
|
||||
show: props.media?.type === '电视剧',
|
||||
},
|
||||
{
|
||||
title: '分享',
|
||||
value: 6,
|
||||
value: 7,
|
||||
props: {
|
||||
prependIcon: 'mdi-share',
|
||||
click: shareSubscribe,
|
||||
@@ -184,7 +222,7 @@ const dropdownItems = ref([
|
||||
},
|
||||
{
|
||||
title: '取消订阅',
|
||||
value: 7,
|
||||
value: 8,
|
||||
props: {
|
||||
prependIcon: 'mdi-trash-can-outline',
|
||||
color: 'error',
|
||||
@@ -201,6 +239,14 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
// 监听订阅状态
|
||||
watch(
|
||||
() => props.media?.state,
|
||||
newState => {
|
||||
subscribeState.value = newState ?? 'P'
|
||||
},
|
||||
)
|
||||
|
||||
// 计算backdrop图片地址
|
||||
const backdropUrl = computed(() => {
|
||||
const url = props.media?.backdrop || props.media?.poster
|
||||
@@ -233,129 +279,136 @@ function onSubscribeEditRemove() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VHover>
|
||||
<template #default="hover">
|
||||
<VCard
|
||||
v-bind="hover.props"
|
||||
:key="props.media?.id"
|
||||
class="flex flex-col rounded-lg"
|
||||
:class="{
|
||||
'outline-dashed outline-1': props.media?.best_version && imageLoaded,
|
||||
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||
}"
|
||||
min-height="170"
|
||||
@click="editSubscribeDialog"
|
||||
>
|
||||
<div class="me-n3 absolute top-1 right-2">
|
||||
<IconBtn>
|
||||
<VIcon icon="mdi-dots-vertical" color="white" />
|
||||
<VMenu activator="parent" close-on-content-click>
|
||||
<VList>
|
||||
<template v-for="(item, i) in dropdownItems" :key="i">
|
||||
<VListItem
|
||||
v-if="item.show !== false"
|
||||
variant="plain"
|
||||
:base-color="item.props.color"
|
||||
@click="item.props.click"
|
||||
>
|
||||
<template #prepend>
|
||||
<VIcon :icon="item.props.prependIcon" />
|
||||
</template>
|
||||
<VListItemTitle v-text="item.title" />
|
||||
</VListItem>
|
||||
</template>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</div>
|
||||
<template #image>
|
||||
<VImg :src="backdropUrl || posterUrl" aspect-ratio="3/2" cover @load="imageLoadHandler" position="top">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-3 aspect-h-2" />
|
||||
</div>
|
||||
</template>
|
||||
<div class="absolute inset-0 subscribe-card-background"></div>
|
||||
</VImg>
|
||||
</template>
|
||||
<div>
|
||||
<VCardText class="flex items-center">
|
||||
<div class="h-auto w-12 flex-shrink-0 overflow-hidden rounded-md shadow-lg" v-if="imageLoaded">
|
||||
<VImg :src="posterUrl" aspect-ratio="2/3" cover @click.stop="viewMediaDetail">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center overflow-hidden pl-2 xl:pl-4">
|
||||
<div class="text-sm font-medium text-white sm:pt-1">{{ props.media?.year }}</div>
|
||||
<div class="mr-2 min-w-0 text-lg font-bold text-white">
|
||||
{{ props.media?.name }}
|
||||
{{ formatSeason(props.media?.season ? props.media?.season.toString() : '') }}
|
||||
</div>
|
||||
</div>
|
||||
</VCardText>
|
||||
<VCardText class="flex justify-space-between align-center flex-wrap">
|
||||
<div class="flex align-center">
|
||||
<IconBtn
|
||||
v-if="props.media?.total_episode"
|
||||
v-bind="props"
|
||||
icon="mdi-progress-download"
|
||||
color="white"
|
||||
class="me-1"
|
||||
/>
|
||||
<div v-if="props.media?.season" class="text-subtitle-2 me-4 text-white">
|
||||
{{ (props.media?.total_episode || 0) - (props.media?.lack_episode || 0) }} /
|
||||
{{ props.media?.total_episode }}
|
||||
</div>
|
||||
<IconBtn v-if="props.media?.username" icon="mdi-account" color="white" class="me-1" />
|
||||
<span v-if="props.media?.username" class="text-subtitle-2 me-4 text-white">
|
||||
{{ props.media?.username }}
|
||||
</span>
|
||||
</div>
|
||||
</VCardText>
|
||||
<VCardText v-if="lastUpdateText" class="absolute right-0 bottom-0 d-flex align-center p-2 text-gray-300">
|
||||
<VIcon icon="mdi-download" class="me-1" />
|
||||
{{ lastUpdateText }}
|
||||
</VCardText>
|
||||
<div class="w-full absolute bottom-0">
|
||||
<VProgressLinear
|
||||
v-if="getPercentage() > 0"
|
||||
:model-value="getPercentage()"
|
||||
bg-color="success"
|
||||
color="success"
|
||||
/>
|
||||
<div>
|
||||
<VHover>
|
||||
<template #default="hover">
|
||||
<VCard
|
||||
v-bind="hover.props"
|
||||
:key="props.media?.id"
|
||||
class="flex flex-col rounded-lg h-full"
|
||||
:class="{
|
||||
'outline-dashed outline-1': props.media?.best_version && imageLoaded,
|
||||
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||
'opacity-70': subscribeState === 'S',
|
||||
}"
|
||||
min-height="170"
|
||||
@click="editSubscribeDialog"
|
||||
>
|
||||
<div class="me-n3 absolute top-1 right-2">
|
||||
<IconBtn>
|
||||
<VIcon icon="mdi-dots-vertical" color="white" />
|
||||
<VMenu activator="parent" close-on-content-click>
|
||||
<VList>
|
||||
<template v-for="(item, i) in dropdownItems" :key="i">
|
||||
<VListItem
|
||||
v-if="item.show !== false"
|
||||
variant="plain"
|
||||
:base-color="item.props.color"
|
||||
@click="item.props.click"
|
||||
>
|
||||
<template #prepend>
|
||||
<VIcon :icon="item.props.prependIcon" />
|
||||
</template>
|
||||
<VListItemTitle v-text="item.title" />
|
||||
</VListItem>
|
||||
</template>
|
||||
</VList>
|
||||
</VMenu>
|
||||
</IconBtn>
|
||||
</div>
|
||||
</div>
|
||||
</VCard>
|
||||
</template>
|
||||
</VHover>
|
||||
<!-- 订阅编辑弹窗 -->
|
||||
<SubscribeEditDialog
|
||||
v-if="subscribeEditDialog"
|
||||
v-model="subscribeEditDialog"
|
||||
:subid="props.media?.id"
|
||||
@remove="onSubscribeEditRemove"
|
||||
@save="onSubscribeEditSave"
|
||||
@close="subscribeEditDialog = false"
|
||||
/>
|
||||
<template #image>
|
||||
<VImg :src="backdropUrl || posterUrl" aspect-ratio="3/2" cover @load="imageLoadHandler" position="top">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-3 aspect-h-2" />
|
||||
</div>
|
||||
</template>
|
||||
<div class="absolute inset-0 subscribe-card-background"></div>
|
||||
</VImg>
|
||||
<div v-if="subscribeState === 'P'" class="absolute inset-0 bg-yellow-900 opacity-80 pointer-events-none" />
|
||||
</template>
|
||||
<div>
|
||||
<VCardText class="flex items-center">
|
||||
<div class="h-auto w-12 flex-shrink-0 overflow-hidden rounded-md shadow-lg" v-if="imageLoaded">
|
||||
<VImg :src="posterUrl" aspect-ratio="2/3" cover @click.stop="viewMediaDetail">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center overflow-hidden pl-2 xl:pl-4">
|
||||
<div class="text-sm font-medium text-white sm:pt-1">{{ props.media?.year }}</div>
|
||||
<div class="mr-2 min-w-0 text-lg font-bold text-white">
|
||||
{{ props.media?.name }}
|
||||
{{ formatSeason(props.media?.season ? props.media?.season.toString() : '') }}
|
||||
</div>
|
||||
</div>
|
||||
</VCardText>
|
||||
<VCardText class="flex justify-space-between align-center flex-wrap">
|
||||
<div class="flex align-center">
|
||||
<IconBtn
|
||||
v-if="props.media?.total_episode"
|
||||
v-bind="props"
|
||||
icon="mdi-progress-download"
|
||||
color="white"
|
||||
class="me-1"
|
||||
/>
|
||||
<div v-if="props.media?.season" class="text-subtitle-2 me-4 text-white">
|
||||
{{ (props.media?.total_episode || 0) - (props.media?.lack_episode || 0) }} /
|
||||
{{ props.media?.total_episode }}
|
||||
</div>
|
||||
<IconBtn v-if="props.media?.username" icon="mdi-account" color="white" class="me-1" />
|
||||
<span v-if="props.media?.username" class="text-subtitle-2 me-4 text-white">
|
||||
{{ props.media?.username }}
|
||||
</span>
|
||||
</div>
|
||||
</VCardText>
|
||||
<VCardText v-if="lastUpdateText" class="absolute right-0 bottom-0 d-flex align-center p-2 text-gray-300">
|
||||
<VIcon icon="mdi-download" class="me-1" />
|
||||
{{ lastUpdateText }}
|
||||
</VCardText>
|
||||
<div class="w-full absolute bottom-0">
|
||||
<VProgressLinear
|
||||
v-if="getPercentage() > 0"
|
||||
:model-value="getPercentage()"
|
||||
bg-color="success"
|
||||
color="success"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="hover.isHovering" class="me-n3 absolute top-1 right-10">
|
||||
<IconBtn><VIcon class="cursor-move text-white">mdi-drag</VIcon></IconBtn>
|
||||
</div>
|
||||
</div>
|
||||
</VCard>
|
||||
</template>
|
||||
</VHover>
|
||||
<!-- 订阅编辑弹窗 -->
|
||||
<SubscribeEditDialog
|
||||
v-if="subscribeEditDialog"
|
||||
v-model="subscribeEditDialog"
|
||||
:subid="props.media?.id"
|
||||
@remove="onSubscribeEditRemove"
|
||||
@save="onSubscribeEditSave"
|
||||
@close="subscribeEditDialog = false"
|
||||
/>
|
||||
|
||||
<!-- 订阅文件信息弹窗 -->
|
||||
<SubscribeFilesDialog
|
||||
v-if="subscribeFilesDialog"
|
||||
v-model="subscribeFilesDialog"
|
||||
:subid="props.media?.id"
|
||||
@close="subscribeFilesDialog = false"
|
||||
/>
|
||||
<!-- 分享订阅弹窗 -->
|
||||
<SubscribeShareDialog
|
||||
v-if="subscribeShareDialog"
|
||||
v-model="subscribeShareDialog"
|
||||
:sub="props.media"
|
||||
@close="subscribeShareDialog = false"
|
||||
/>
|
||||
<!-- 订阅文件信息弹窗 -->
|
||||
<SubscribeFilesDialog
|
||||
v-if="subscribeFilesDialog"
|
||||
v-model="subscribeFilesDialog"
|
||||
:subid="props.media?.id"
|
||||
@close="subscribeFilesDialog = false"
|
||||
/>
|
||||
<!-- 分享订阅弹窗 -->
|
||||
<SubscribeShareDialog
|
||||
v-if="subscribeShareDialog"
|
||||
v-model="subscribeShareDialog"
|
||||
:sub="props.media"
|
||||
@close="subscribeShareDialog = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
.subscribe-card-background {
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
import { formatDateDifference } from '@/@core/utils/formatters'
|
||||
import api from '@/api'
|
||||
import { doneNProgress, startNProgress } from '@/api/nprogress'
|
||||
import type { SubscribeShare } from '@/api/types'
|
||||
import router from '@/router'
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import { useConfirm } from 'vuetify-use-dialog'
|
||||
import SubscribeEditDialog from '../dialog/SubscribeEditDialog.vue'
|
||||
import ForkSubscribeDialog from '../dialog/ForkSubscribeDialog.vue'
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
media: Object as PropType<SubscribeShare>,
|
||||
})
|
||||
|
||||
// 提示框
|
||||
const $toast = useToast()
|
||||
|
||||
// 确认框
|
||||
const createConfirm = useConfirm()
|
||||
|
||||
// 从 provide 中获取全局设置
|
||||
const globalSettings: any = inject('globalSettings')
|
||||
|
||||
@@ -28,6 +19,9 @@ const imageLoaded = ref(false)
|
||||
// 订阅编辑弹窗
|
||||
const subscribeEditDialog = ref(false)
|
||||
|
||||
// 复用订阅弹窗
|
||||
const forkSubscribeDialog = ref(false)
|
||||
|
||||
// 订阅ID
|
||||
const subscribeId = ref<number>()
|
||||
|
||||
@@ -69,109 +63,99 @@ async function viewMediaDetail() {
|
||||
}
|
||||
|
||||
// 复用订阅
|
||||
async function forkSubscribe() {
|
||||
// 开始处理
|
||||
startNProgress()
|
||||
try {
|
||||
// 确认
|
||||
const isConfirmed = await createConfirm({
|
||||
title: '确认',
|
||||
content: `是否确认添加来自 ${props.media?.share_user} 分享的订阅:${props.media?.share_title}?`,
|
||||
})
|
||||
if (!isConfirmed) return
|
||||
function showForkSubscribe() {
|
||||
forkSubscribeDialog.value = true
|
||||
}
|
||||
|
||||
// 请求API
|
||||
const result: { [key: string]: any } = await api.post('subscribe/fork', props.media)
|
||||
|
||||
// 订阅状态
|
||||
if (result.success) {
|
||||
$toast.success(`${props.media?.share_title} 添加订阅成功!`)
|
||||
// 弹出订阅编辑弹窗
|
||||
subscribeId.value = result.data.id
|
||||
subscribeEditDialog.value = true
|
||||
} else {
|
||||
$toast.error(`${props.media?.share_title} 添加订阅失败:${result.message}!`)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
doneNProgress()
|
||||
}
|
||||
// 完成复用订阅
|
||||
function finishForkSubscribe(subid: number) {
|
||||
subscribeId.value = subid
|
||||
subscribeEditDialog.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VHover>
|
||||
<template #default="hover">
|
||||
<VCard
|
||||
v-bind="hover.props"
|
||||
:key="props.media?.id"
|
||||
class="flex flex-col rounded-lg"
|
||||
:class="{
|
||||
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||
}"
|
||||
min-height="170"
|
||||
@click="forkSubscribe"
|
||||
>
|
||||
<template #image>
|
||||
<VImg :src="backdropUrl || posterUrl" aspect-ratio="3/2" cover @load="imageLoadHandler" position="top">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-3 aspect-h-2" />
|
||||
<div>
|
||||
<VHover>
|
||||
<template #default="hover">
|
||||
<VCard
|
||||
v-bind="hover.props"
|
||||
:key="props.media?.id"
|
||||
class="flex flex-col rounded-lg"
|
||||
:class="{
|
||||
'transition transform-cpu duration-300 scale-105 shadow-lg': hover.isHovering,
|
||||
}"
|
||||
min-height="170"
|
||||
@click="showForkSubscribe"
|
||||
>
|
||||
<template #image>
|
||||
<VImg :src="backdropUrl || posterUrl" aspect-ratio="3/2" cover @load="imageLoadHandler" position="top">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-3 aspect-h-2" />
|
||||
</div>
|
||||
</template>
|
||||
<div class="absolute inset-0 subscribe-card-background"></div>
|
||||
</VImg>
|
||||
</template>
|
||||
<div>
|
||||
<VCardText class="flex items-center pb-1">
|
||||
<div class="h-auto w-12 flex-shrink-0 overflow-hidden rounded-md shadow-lg" v-if="imageLoaded">
|
||||
<VImg :src="posterUrl" aspect-ratio="2/3" cover @click.stop="viewMediaDetail">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
</div>
|
||||
</template>
|
||||
<div class="absolute inset-0 subscribe-card-background"></div>
|
||||
</VImg>
|
||||
</template>
|
||||
<div>
|
||||
<VCardText class="flex items-center pb-1">
|
||||
<div class="h-auto w-12 flex-shrink-0 overflow-hidden rounded-md shadow-lg" v-if="imageLoaded">
|
||||
<VImg :src="posterUrl" aspect-ratio="2/3" cover @click.stop="viewMediaDetail">
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center pl-2 xl:pl-4">
|
||||
<div class="mr-2 min-w-0 text-lg font-bold text-white line-clamp-2 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.share_title }}
|
||||
<div class="flex flex-col justify-center pl-2 xl:pl-4">
|
||||
<div class="mr-2 min-w-0 text-lg font-bold text-white line-clamp-2 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.share_title }}
|
||||
</div>
|
||||
<div class="text-sm font-medium text-gray-200 sm:pt-1 line-clamp-3 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.share_comment }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-sm font-medium text-gray-200 sm:pt-1 line-clamp-3 overflow-hidden text-ellipsis ...">
|
||||
{{ props.media?.share_comment }}
|
||||
</VCardText>
|
||||
<VCardText class="flex justify-space-between align-center flex-wrap">
|
||||
<div class="flex align-center">
|
||||
<IconBtn v-bind="props" icon="mdi-account" color="white" class="me-1" />
|
||||
<div class="text-subtitle-2 me-4 text-white">
|
||||
{{ props.media?.share_user }}
|
||||
</div>
|
||||
<IconBtn v-if="props.media?.count" icon="mdi-fire" color="error" class="me-1" />
|
||||
<span v-if="props.media?.count" class="text-subtitle-2 me-4 text-white">
|
||||
{{ props.media?.count.toLocaleString() }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</VCardText>
|
||||
<VCardText class="flex justify-space-between align-center flex-wrap">
|
||||
<div class="flex align-center">
|
||||
<IconBtn v-bind="props" icon="mdi-account" color="white" class="me-1" />
|
||||
<div class="text-subtitle-2 me-4 text-white">
|
||||
{{ props.media?.share_user }}
|
||||
</div>
|
||||
<IconBtn v-if="props.media?.count" icon="mdi-fire" color="error" class="me-1" />
|
||||
<span v-if="props.media?.count" class="text-subtitle-2 me-4 text-white">
|
||||
{{ props.media?.count.toLocaleString() }}
|
||||
</span>
|
||||
</div>
|
||||
</VCardText>
|
||||
<VCardText class="absolute right-0 bottom-0 d-flex align-center p-2 text-gray-300">
|
||||
<VIcon icon="mdi-calcdar" class="me-1" />
|
||||
{{ dateText }}
|
||||
</VCardText>
|
||||
</div>
|
||||
</VCard>
|
||||
</template>
|
||||
</VHover>
|
||||
<!-- 订阅编辑弹窗 -->
|
||||
<SubscribeEditDialog
|
||||
v-if="subscribeEditDialog"
|
||||
v-model="subscribeEditDialog"
|
||||
:subid="subscribeId"
|
||||
@close="subscribeEditDialog = false"
|
||||
@save="subscribeEditDialog = false"
|
||||
@remove="subscribeEditDialog = false"
|
||||
/>
|
||||
</VCardText>
|
||||
<VCardText class="absolute right-0 bottom-0 d-flex align-center p-2 text-gray-300">
|
||||
<VIcon icon="mdi-calcdar" class="me-1" />
|
||||
{{ dateText }}
|
||||
</VCardText>
|
||||
</div>
|
||||
</VCard>
|
||||
</template>
|
||||
</VHover>
|
||||
<!-- 订阅编辑弹窗 -->
|
||||
<SubscribeEditDialog
|
||||
v-if="subscribeEditDialog"
|
||||
v-model="subscribeEditDialog"
|
||||
:subid="subscribeId"
|
||||
@close="subscribeEditDialog = false"
|
||||
@save="subscribeEditDialog = false"
|
||||
@remove="subscribeEditDialog = false"
|
||||
/>
|
||||
<!-- 复用订阅弹窗 -->
|
||||
<ForkSubscribeDialog
|
||||
v-if="forkSubscribeDialog"
|
||||
v-model="forkSubscribeDialog"
|
||||
:media="props.media"
|
||||
@close="forkSubscribeDialog = false"
|
||||
@done="finishForkSubscribe"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
.subscribe-card-background {
|
||||
|
||||
125
src/components/dialog/ForkSubscribeDialog.vue
Normal file
125
src/components/dialog/ForkSubscribeDialog.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<script setup lang="ts">
|
||||
import api from '@/api'
|
||||
import { doneNProgress, startNProgress } from '@/api/nprogress'
|
||||
import { SubscribeShare } from '@/api/types'
|
||||
import router from '@/router'
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import { VBtn } from 'vuetify/lib/components/index.mjs'
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
media: Object as PropType<SubscribeShare>,
|
||||
})
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['close', 'done'])
|
||||
|
||||
// 从 provide 中获取全局设置
|
||||
const globalSettings: any = inject('globalSettings')
|
||||
|
||||
// 提示框
|
||||
const $toast = useToast()
|
||||
|
||||
// 计算海报图片地址
|
||||
const posterUrl = computed(() => {
|
||||
const url = props.media?.poster
|
||||
// 使用图片缓存
|
||||
if (globalSettings.GLOBAL_IMAGE_CACHE && url)
|
||||
return `${import.meta.env.VITE_API_BASE_URL}system/cache/image?url=${encodeURIComponent(url)}`
|
||||
return url
|
||||
})
|
||||
|
||||
// 查看媒体详情
|
||||
async function viewMediaDetail() {
|
||||
router.push({
|
||||
path: '/media',
|
||||
query: {
|
||||
mediaid: `${props.media?.tmdbid ? `tmdb:${props.media?.tmdbid}` : `douban:${props.media?.doubanid}`}`,
|
||||
type: props.media?.type,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 复用订阅
|
||||
async function doFork() {
|
||||
// 开始处理
|
||||
startNProgress()
|
||||
try {
|
||||
// 请求API
|
||||
const result: { [key: string]: any } = await api.post('subscribe/fork', props.media)
|
||||
|
||||
// 订阅状态
|
||||
if (result.success) {
|
||||
$toast.success(`${props.media?.share_title} 添加订阅成功!`)
|
||||
// 完成
|
||||
emit('done', result.data.id)
|
||||
} else {
|
||||
$toast.error(`${props.media?.share_title} 添加订阅失败:${result.message}!`)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
doneNProgress()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VDialog max-width="40rem">
|
||||
<VCard>
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
<VCardText>
|
||||
<VCol>
|
||||
<div class="d-flex justify-space-between flex-wrap flex-md-nowrap flex-column flex-md-row">
|
||||
<div class="ma-auto">
|
||||
<VImg
|
||||
width="10rem"
|
||||
aspect-ratio="2/3"
|
||||
class="object-cover aspect-w-2 aspect-h-3 rounded-lg ring-1 ring-gray-500"
|
||||
:src="posterUrl"
|
||||
@click="viewMediaDetail"
|
||||
cover
|
||||
>
|
||||
<template #placeholder>
|
||||
<div class="w-full h-full">
|
||||
<VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
|
||||
</div>
|
||||
</template>
|
||||
</VImg>
|
||||
</div>
|
||||
<div class="flex-grow">
|
||||
<VCardItem>
|
||||
<VCardTitle class="text-center text-md-left">
|
||||
{{ props.media?.share_title }}
|
||||
</VCardTitle>
|
||||
<VCardSubtitle
|
||||
class="text-center text-md-left break-words whitespace-break-spaces line-clamp-2 overflow-hidden text-ellipsis ..."
|
||||
>
|
||||
{{ props.media?.share_comment }}
|
||||
</VCardSubtitle>
|
||||
<VList lines="one">
|
||||
<VListItem class="ps-0">
|
||||
<VListItemTitle class="text-center text-md-left">
|
||||
<span class="font-weight-medium">分享人:</span>
|
||||
<span class="text-body-1"> {{ media?.share_user }}</span>
|
||||
</VListItemTitle>
|
||||
</VListItem>
|
||||
<VListItem class="ps-0" v-if="media?.custom_words">
|
||||
<VListItemTitle
|
||||
class="text-center text-md-left break-words whitespace-break-spaces line-clamp-3 overflow-hidden text-ellipsis ..."
|
||||
>
|
||||
<span class="font-weight-medium">识别词:</span>
|
||||
<span class="text-body-1"> {{ media?.custom_words }}</span>
|
||||
</VListItemTitle>
|
||||
</VListItem>
|
||||
</VList>
|
||||
<div class="text-center text-md-left">
|
||||
<VBtn color="primary" @click="doFork" prepend-icon="mdi-heart">添加到我的订阅</VBtn>
|
||||
</div>
|
||||
</VCardItem>
|
||||
</div>
|
||||
</div>
|
||||
</VCol>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
@@ -2,17 +2,18 @@
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
dataType: String,
|
||||
})
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['update:modelValue', 'close'])
|
||||
|
||||
// 代码
|
||||
const codeString = ref('')
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['close', 'save'])
|
||||
|
||||
// 导入
|
||||
function handleImport() {
|
||||
emit('update:modelValue', codeString.value)
|
||||
emit('save', props.dataType, codeString)
|
||||
emit('close')
|
||||
}
|
||||
</script>
|
||||
|
||||
22
src/components/dialog/MediaInfoDialog.vue
Normal file
22
src/components/dialog/MediaInfoDialog.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { Context } from '@/api/types'
|
||||
import MediaInfoCard from '../cards/MediaInfoCard.vue'
|
||||
|
||||
// 输入参数
|
||||
defineProps({
|
||||
context: Object as PropType<Context>,
|
||||
})
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['close'])
|
||||
</script>
|
||||
<template>
|
||||
<VDialog max-width="50rem">
|
||||
<VCard>
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
<VCardItem>
|
||||
<MediaInfoCard :context="context" />
|
||||
</VCardItem>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
@@ -34,7 +34,7 @@ async function saveHandle() {
|
||||
if (result.success) {
|
||||
$toast.success('插件仓库保存成功')
|
||||
emit('save')
|
||||
} else $toast.error('插件仓库保存失败!')
|
||||
} else $toast.error(`插件仓库保存失败:${result?.message}!`)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { storageOptions, transferTypeOptions } from '@/api/constants'
|
||||
import { numberValidator } from '@/@validators'
|
||||
import { useDisplay } from 'vuetify'
|
||||
import ProgressDialog from './ProgressDialog.vue'
|
||||
import { FileItem, TransferDirectoryConf } from '@/api/types'
|
||||
import { FileItem, TransferDirectoryConf, TransferForm } from '@/api/types'
|
||||
|
||||
// 显示器宽度
|
||||
const display = useDisplay()
|
||||
@@ -49,7 +49,7 @@ const progressEventSource = ref<EventSource>()
|
||||
const progressDialog = ref(false)
|
||||
|
||||
// 整理进度文本
|
||||
const progressText = ref('请稍候 ...')
|
||||
const progressText = ref('正在处理 ...')
|
||||
|
||||
// 整理进度
|
||||
const progressValue = ref(0)
|
||||
@@ -65,31 +65,27 @@ const dialogTitle = computed(() => {
|
||||
return '手动整理'
|
||||
})
|
||||
|
||||
// 禁用指定集数
|
||||
const disableEpisodeDetail = computed(() => {
|
||||
if (props.items) {
|
||||
return !(props.items.length === 1 && props.items[0].type !== 'dir')
|
||||
}
|
||||
})
|
||||
|
||||
// 表单
|
||||
const transferForm = reactive({
|
||||
fileitem: {},
|
||||
const transferForm = reactive<TransferForm>({
|
||||
fileitem: {} as FileItem,
|
||||
logid: 0,
|
||||
target_storage: props.target_storage ?? 'local',
|
||||
target_path: props.target_path ?? null,
|
||||
tmdbid: null,
|
||||
doubanid: null,
|
||||
season: null,
|
||||
type_name: '',
|
||||
transfer_type: 'copy',
|
||||
episode_format: '',
|
||||
episode_detail: '',
|
||||
episode_part: '',
|
||||
episode_offset: null,
|
||||
transfer_type: '',
|
||||
target_path: '',
|
||||
min_filesize: 0,
|
||||
scrape: false,
|
||||
from_history: false,
|
||||
library_type_folder: false,
|
||||
library_category_folder: false,
|
||||
})
|
||||
|
||||
// 所有媒体库目录
|
||||
const directories = ref<TransferDirectoryConf[]>([])
|
||||
|
||||
// 查询目录
|
||||
async function loadDirectories() {
|
||||
try {
|
||||
@@ -114,15 +110,51 @@ watch(
|
||||
const directory = directories.value.find(item => item.library_path === newPath)
|
||||
if (directory) {
|
||||
transferForm.target_storage = directory.library_storage ?? 'local'
|
||||
transferForm.transfer_type = directory.transfer_type ?? ''
|
||||
transferForm.transfer_type = transferForm.transfer_type || directory.transfer_type
|
||||
transferForm.scrape = directory.scraping ?? false
|
||||
transferForm.library_category_folder = directory.library_category_folder ?? false
|
||||
transferForm.library_type_folder = directory.library_type_folder ?? false
|
||||
} else {
|
||||
transferForm.transfer_type = transferForm.transfer_type || 'copy'
|
||||
transferForm.scrape = false
|
||||
transferForm.library_category_folder = false
|
||||
transferForm.library_type_folder = false
|
||||
}
|
||||
} else {
|
||||
// 路径为空时, 恢复到`自动`条件
|
||||
transferForm.transfer_type = ''
|
||||
transferForm.library_type_folder = undefined
|
||||
transferForm.library_category_folder = undefined
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// 整理文件
|
||||
async function handleTransfer(item: FileItem, background: boolean = false) {
|
||||
transferForm.fileitem = item
|
||||
transferForm.logid = 0
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post(`transfer/manual?background=${background}`, transferForm)
|
||||
if (!result.success) $toast.error(result.message)
|
||||
else if (background) $toast.success(`文件 ${item.name} 已加入整理队列!`)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 整理日志
|
||||
async function handleTransferLog(logid: number, background: boolean = false) {
|
||||
transferForm.logid = logid
|
||||
transferForm.fileitem = {} as FileItem
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post(`transfer/manual?background=${background}`, transferForm)
|
||||
if (!result.success) $toast.error(result.message)
|
||||
else if (background) $toast.success(`历史记录 ${logid} 已加入整理队列!`)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 使用SSE监听加载进度
|
||||
function startLoadingProgress() {
|
||||
progressText.value = '请稍候 ...'
|
||||
@@ -142,63 +174,49 @@ function stopLoadingProgress() {
|
||||
}
|
||||
|
||||
// 整理文件
|
||||
async function transfer() {
|
||||
async function transfer(background: boolean = false) {
|
||||
if (!props.logids && !props.items) return
|
||||
|
||||
// 显示进度条
|
||||
progressDialog.value = true
|
||||
// 开始监听进度
|
||||
startLoadingProgress()
|
||||
|
||||
if (!background) {
|
||||
// 开始监听进度
|
||||
startLoadingProgress()
|
||||
}
|
||||
|
||||
// 文件整理
|
||||
if (props.items) {
|
||||
for (const item of props.items) {
|
||||
await handleTransfer(item)
|
||||
await handleTransfer(item, background)
|
||||
}
|
||||
}
|
||||
|
||||
// 日志整理
|
||||
if (props.logids) {
|
||||
for (const logid of props.logids) {
|
||||
await handleTransferLog(logid)
|
||||
await handleTransferLog(logid, background)
|
||||
}
|
||||
}
|
||||
|
||||
// 停止监听进度
|
||||
stopLoadingProgress()
|
||||
if (!background) {
|
||||
// 停止监听进度
|
||||
stopLoadingProgress()
|
||||
}
|
||||
|
||||
// 关闭进度条
|
||||
progressDialog.value = false
|
||||
// 重新加载
|
||||
emit('done')
|
||||
}
|
||||
|
||||
// 整理文件
|
||||
async function handleTransfer(item: FileItem) {
|
||||
transferForm.fileitem = item
|
||||
transferForm.logid = 0
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post('transfer/manual', transferForm)
|
||||
if (!result.success) $toast.error(`文件 ${item.path} 整理失败:${result.message}!`)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 整理日志
|
||||
async function handleTransferLog(logid: number) {
|
||||
transferForm.logid = logid
|
||||
transferForm.fileitem = {}
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post('transfer/manual', transferForm)
|
||||
if (!result.success) $toast.error(`历史记录 ${logid} 重新整理失败:${result.message}!`)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadDirectories()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
stopLoadingProgress()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -226,7 +244,11 @@ onMounted(() => {
|
||||
:items="transferTypeOptions"
|
||||
hint="文件操作整理方式"
|
||||
persistent-hint
|
||||
/>
|
||||
>
|
||||
<template v-slot:selection="{ item }">
|
||||
{{ transferForm.transfer_type === '' ? '自动' : item.title }}
|
||||
</template>
|
||||
</VSelect>
|
||||
</VCol>
|
||||
<VCol cols="12">
|
||||
<VCombobox
|
||||
@@ -303,6 +325,7 @@ onMounted(() => {
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model="transferForm.episode_detail"
|
||||
:disabled="disableEpisodeDetail"
|
||||
label="指定集数"
|
||||
placeholder="起始集,终止集,如1或1,2"
|
||||
hint="指定集数或范围,如1或1,2"
|
||||
@@ -339,7 +362,7 @@ onMounted(() => {
|
||||
</VCol>
|
||||
</VRow>
|
||||
<VRow>
|
||||
<VCol cols="12" md="6">
|
||||
<VCol cols="12" md="6" v-if="transferForm.target_path">
|
||||
<VSwitch
|
||||
v-model="transferForm.library_type_folder"
|
||||
label="按类型分类"
|
||||
@@ -347,7 +370,7 @@ onMounted(() => {
|
||||
persistent-hint
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="6">
|
||||
<VCol cols="12" md="6" v-if="transferForm.target_path">
|
||||
<VSwitch
|
||||
v-model="transferForm.library_category_folder"
|
||||
label="按类别分类"
|
||||
@@ -367,7 +390,7 @@ onMounted(() => {
|
||||
<VSwitch
|
||||
v-model="transferForm.from_history"
|
||||
label="复用历史识别信息"
|
||||
hint="使用历史记录中已识别的媒体信息"
|
||||
hint="使用历史整理记录中已识别的媒体信息"
|
||||
persistent-hint
|
||||
/>
|
||||
</VCol>
|
||||
@@ -376,7 +399,12 @@ onMounted(() => {
|
||||
</VCardText>
|
||||
<VCardActions class="pt-3">
|
||||
<VSpacer />
|
||||
<VBtn variant="elevated" @click="transfer" prepend-icon="mdi-arrow-right-bold" class="px-5"> 开始整理 </VBtn>
|
||||
<VBtn variant="elevated" color="success" @click="transfer(true)" prepend-icon="mdi-plus" class="px-5">
|
||||
加入整理队列
|
||||
</VBtn>
|
||||
<VBtn variant="elevated" @click="transfer(false)" prepend-icon="mdi-arrow-right-bold" class="px-5">
|
||||
立即整理
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
<!-- 手动整理进度框 -->
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
import type { Site, SiteUserData } from '@/api/types'
|
||||
import api from '@/api'
|
||||
import { useDisplay, useTheme } from 'vuetify'
|
||||
import { VAvatar, VCardText, VIcon } from 'vuetify/lib/components/index.mjs'
|
||||
import { formatFileSize } from '@/@core/utils/formatters'
|
||||
import VueApexCharts from 'vue3-apexcharts'
|
||||
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
|
||||
|
||||
// 显示器宽度
|
||||
@@ -34,7 +32,6 @@ const siteDatas = ref<SiteUserData[]>([])
|
||||
// 最新一天的数据
|
||||
const siteData = computed(() => siteDatas.value[siteDatas.value.length - 1])
|
||||
|
||||
|
||||
// 站点数据列表中的上传量、下载量数据生成图形使用的数据
|
||||
const historySeries = computed(() => {
|
||||
return [
|
||||
@@ -243,13 +240,12 @@ async function fetchSiteUserData() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 刷新站点数据
|
||||
async function refreshSiteData(){
|
||||
async function refreshSiteData() {
|
||||
progressDialog.value = true
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post(`site/userdata/${props.site?.id}`)
|
||||
if (result.success){
|
||||
if (result.success) {
|
||||
await fetchSiteUserData()
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -267,12 +263,14 @@ onBeforeMount(async () => {
|
||||
<VDialog scrollable eager max-width="80rem" :fullscreen="!display.mdAndUp.value">
|
||||
<VCard class="rounded-t">
|
||||
<VCardItem>
|
||||
<VCardTitle>{{ `数据 - ${props.site?.name}` }}
|
||||
<IconBtn @click.stop="refreshSiteData" color="info"><VIcon icon="mdi-refresh"</VIcon></IconBtn>
|
||||
<VCardTitle
|
||||
>{{ `数据 - ${props.site?.name}` }}
|
||||
<IconBtn @click.stop="refreshSiteData" color="info"><VIcon icon="mdi-refresh" /></IconBtn>
|
||||
</VCardTitle>
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
</VCardItem>
|
||||
<VCardText>
|
||||
<VDivider />
|
||||
<VCardText class="pt-5">
|
||||
<VRow class="match-height">
|
||||
<!-- 用户信息 -->
|
||||
<VCol cols="12" md="3">
|
||||
@@ -441,7 +439,7 @@ onBeforeMount(async () => {
|
||||
<VCol>
|
||||
<VCard title="历史流量">
|
||||
<VCardText>
|
||||
<VueApexCharts type="line" :options="historyChartOptions" :series="historySeries" :height="300" />
|
||||
<VApexChart type="line" :options="historyChartOptions" :series="historySeries" :height="300" />
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VCol>
|
||||
@@ -450,7 +448,7 @@ onBeforeMount(async () => {
|
||||
<VCol>
|
||||
<VCard title="做种分布">
|
||||
<VCardText>
|
||||
<VueApexCharts type="scatter" :options="seedingChartOptions" :series="seedingSeries" :height="300" />
|
||||
<VApexChart type="scatter" :options="seedingChartOptions" :series="seedingSeries" :height="300" />
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VCol>
|
||||
|
||||
@@ -86,7 +86,7 @@ async function reSubscribe(item: Subscribe) {
|
||||
else progressText.value = `正在重新订阅 ${item.name} 第 ${item.season} 季 ...`
|
||||
progressDialog.value = true
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post('subscribe', item)
|
||||
const result: { [key: string]: any } = await api.post('subscribe/', item)
|
||||
if (result.success) {
|
||||
emit('save')
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ const props = defineProps({
|
||||
// 定义触发的自定义事件
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
// 分享处理状态
|
||||
const shareDoing = ref(false)
|
||||
|
||||
// 订阅编辑表单
|
||||
const shareForm = ref<SubscribeShare>({
|
||||
subscribe_id: props.sub?.id ?? 0,
|
||||
@@ -25,7 +28,9 @@ const shareForm = ref<SubscribeShare>({
|
||||
async function doShare() {
|
||||
if (!shareForm.value.share_title || !shareForm.value.share_comment || !shareForm.value.share_user) return
|
||||
try {
|
||||
shareDoing.value = true
|
||||
const result: { [key: string]: any } = await api.post('subscribe/share', shareForm.value)
|
||||
shareDoing.value = false
|
||||
// 提示
|
||||
if (result.success) {
|
||||
$toast.success(`${props.sub?.name} 分享成功!`)
|
||||
@@ -85,7 +90,7 @@ const $toast = useToast()
|
||||
</VCardText>
|
||||
<VCardActions class="pt-3">
|
||||
<VSpacer />
|
||||
<VBtn variant="elevated" @click="doShare" prepend-icon="mdi-share" class="px-5"> 确认分享 </VBtn>
|
||||
<VBtn variant="elevated" :disabled="shareDoing" @click="doShare" prepend-icon="mdi-share" class="px-5"> 确认分享 </VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
|
||||
187
src/components/dialog/TransferQueueDialog.vue
Normal file
187
src/components/dialog/TransferQueueDialog.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<script lang="ts" setup>
|
||||
import { formatFileSize } from '@/@core/utils/formatters'
|
||||
import api from '@/api'
|
||||
import { FileItem, TransferQueue } from '@/api/types'
|
||||
import { useDisplay } from 'vuetify'
|
||||
|
||||
// 显示器宽度
|
||||
const display = useDisplay()
|
||||
// 定义触发的自定义事件
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
// 数据列表
|
||||
const dataList = ref<TransferQueue[]>([])
|
||||
|
||||
// 加载进度SSE
|
||||
const progressEventSource = ref<EventSource>()
|
||||
|
||||
// 整理进度文本
|
||||
const progressText = ref('请稍候 ...')
|
||||
|
||||
// 整理进度
|
||||
const progressValue = ref(0)
|
||||
|
||||
// 数据可刷新标志
|
||||
const refreshFlag = ref(false)
|
||||
|
||||
// 活动标签
|
||||
const activeTab = ref('')
|
||||
|
||||
// 状态标签
|
||||
const stateDict: { [key: string]: string } = {
|
||||
'waiting': '等待中',
|
||||
'running': '正在整理',
|
||||
'completed': '完成',
|
||||
'failed': '失败',
|
||||
}
|
||||
|
||||
// 获取状态颜色
|
||||
function getStateColor(state: string) {
|
||||
if (state === 'waiting') return 'gray'
|
||||
else if (state === 'running') return 'primary'
|
||||
else if (state === 'completed') return 'success'
|
||||
else return 'error'
|
||||
}
|
||||
|
||||
// 从dataList中提取所有的媒体信息
|
||||
const mediaList = computed(() => {
|
||||
return dataList.value.map(item => item.media)
|
||||
})
|
||||
|
||||
// 按media计算总数和完成数,返回 x/x
|
||||
function getMediaCount(title_year: string) {
|
||||
// 按title_year查询出所有media列表
|
||||
const medias = dataList.value.filter(item => item.media.title_year === title_year)
|
||||
// 计算media下任务的总数
|
||||
const total = medias.reduce((acc, cur) => acc + cur.tasks.length, 0)
|
||||
// 计算media下任务的完成数
|
||||
const completed = medias.reduce((acc, cur) => acc + cur.tasks.filter(task => task.state === 'completed').length, 0)
|
||||
return `${completed} / ${total}`
|
||||
}
|
||||
|
||||
// 根据媒体信息获取对应的整理任务
|
||||
const activeTasks = computed(() => {
|
||||
return dataList.value.find(item => item.media.title_year === activeTab.value)?.tasks
|
||||
})
|
||||
|
||||
// 调用API获取队列信息
|
||||
async function get_transfer_queue() {
|
||||
try {
|
||||
dataList.value = await api.get('transfer/queue')
|
||||
if (dataList.value.length > 0) {
|
||||
if (!activeTab.value || activeTasks.value?.length == 0) activeTab.value = dataList.value[0].media.title_year || ''
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 移除队列任务
|
||||
async function remove_queue_task(fileitem: FileItem) {
|
||||
try {
|
||||
await api.delete(`transfer/queue`, { data: fileitem })
|
||||
get_transfer_queue()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 使用SSE监听加载进度
|
||||
function startLoadingProgress() {
|
||||
progressText.value = '请稍候 ...'
|
||||
progressEventSource.value = new EventSource(`${import.meta.env.VITE_API_BASE_URL}system/progress/filetransfer`)
|
||||
progressEventSource.value.onmessage = event => {
|
||||
const progress = JSON.parse(event.data)
|
||||
if (progress) {
|
||||
if (!progress.enable) {
|
||||
progressText.value = '请稍候 ...'
|
||||
progressValue.value = 0
|
||||
if (refreshFlag.value) {
|
||||
refreshFlag.value = false
|
||||
get_transfer_queue()
|
||||
}
|
||||
return
|
||||
}
|
||||
progressText.value = progress.text
|
||||
progressValue.value = progress.value
|
||||
if (progress.value >= 100 && refreshFlag.value) {
|
||||
refreshFlag.value = false
|
||||
get_transfer_queue()
|
||||
} else {
|
||||
if (progress.value > 0 && refreshFlag.value && progress.text?.includes('整理完成')) {
|
||||
refreshFlag.value = false
|
||||
get_transfer_queue()
|
||||
} else {
|
||||
refreshFlag.value = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 停止监听加载进度
|
||||
function stopLoadingProgress() {
|
||||
progressEventSource.value?.close()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
get_transfer_queue()
|
||||
startLoadingProgress()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
stopLoadingProgress()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog scrollable max-width="50rem" :fullscreen="!display.mdAndUp.value">
|
||||
<VCard class="mx-auto" width="100%">
|
||||
<VCardItem>
|
||||
<VCardTitle>整理队列</VCardTitle>
|
||||
</VCardItem>
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
<VDivider />
|
||||
<VProgressLinear
|
||||
v-if="dataList.length > 0 && progressValue > 0"
|
||||
:value="progressValue"
|
||||
color="primary"
|
||||
indeterminate
|
||||
/>
|
||||
<VCardItem v-if="dataList.length > 0 && progressValue > 0" class="text-center pt-2">
|
||||
<span class="text-sm">{{ progressText }}</span>
|
||||
</VCardItem>
|
||||
<VCardText v-if="dataList.length === 0" class="text-center"> 没有正在整理的任务 </VCardText>
|
||||
<VCardText>
|
||||
<VTabs v-model="activeTab" show-arrows class="v-tabs-pill" stacked>
|
||||
<VTab
|
||||
v-for="media in mediaList"
|
||||
:value="media.title_year"
|
||||
selected-class="v-slide-group-item--active v-tab--selected"
|
||||
>
|
||||
<div class="font-bold text-lg">{{ media.title }}</div>
|
||||
<div>({{ getMediaCount(media.title_year || '') }})</div>
|
||||
</VTab>
|
||||
</VTabs>
|
||||
<VWindow v-model="activeTab" class="mt-5 disable-tab-transition" :touch="false">
|
||||
<VWindowItem v-for="media in mediaList" :value="media.title_year">
|
||||
<VList>
|
||||
<VListItem v-for="task in activeTasks">
|
||||
<VListItemTitle>{{ task.fileitem.name }}</VListItemTitle>
|
||||
<VListItemSubtitle>
|
||||
大小:{{ formatFileSize(task.fileitem.size || 0) }}
|
||||
<VChip size="small" :color="getStateColor(task.state)" class="ms-2">
|
||||
{{ stateDict[task.state] }}
|
||||
</VChip>
|
||||
</VListItemSubtitle>
|
||||
<template #append>
|
||||
<IconBtn size="small" icon="mdi-cancel" @click="remove_queue_task(task.fileitem)" />
|
||||
</template>
|
||||
</VListItem>
|
||||
</VList>
|
||||
</VWindowItem>
|
||||
</VWindow>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
@@ -269,41 +269,48 @@ onMounted(() => {
|
||||
>
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
<VDivider />
|
||||
<VCardText class="d-flex">
|
||||
<VCardItem>
|
||||
<!-- 👉 Avatar -->
|
||||
<VAvatar rounded="lg" size="100" class="me-6" :image="currentAvatar" />
|
||||
<div class="flex flex-row">
|
||||
<VAvatar rounded="lg" size="100" class="me-5" :image="currentAvatar" />
|
||||
<!-- 👉 Upload Photo -->
|
||||
<div class="flex flex-col justify-center gap-5">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<VBtn color="primary" @click="refInputEl?.click()">
|
||||
<VIcon icon="mdi-cloud-upload-outline" />
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">上传新头像</span>
|
||||
</VBtn>
|
||||
|
||||
<!-- 👉 Upload Photo -->
|
||||
<form class="d-flex flex-column justify-center gap-5">
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<VBtn color="primary" @click="refInputEl?.click()">
|
||||
<VIcon icon="mdi-cloud-upload-outline" />
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">上传新头像</span>
|
||||
</VBtn>
|
||||
<input
|
||||
ref="refInputEl"
|
||||
type="file"
|
||||
name="file"
|
||||
accept=".jpeg,.png,.jpg,GIF"
|
||||
hidden
|
||||
@input="changeAvatar"
|
||||
/>
|
||||
|
||||
<input ref="refInputEl" type="file" name="file" accept=".jpeg,.png,.jpg,GIF" hidden @input="changeAvatar" />
|
||||
<VBtn type="reset" color="info" variant="tonal" @click="restoreCurrentAvatar" v-if="props.oper !== 'add'">
|
||||
<VIcon icon="mdi-refresh" />
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">重置</span>
|
||||
</VBtn>
|
||||
|
||||
<VBtn type="reset" color="info" variant="tonal" @click="restoreCurrentAvatar" v-if="props.oper !== 'add'">
|
||||
<VIcon icon="mdi-refresh" />
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">重置</span>
|
||||
</VBtn>
|
||||
|
||||
<VBtn
|
||||
type="reset"
|
||||
:color="props.oper === 'add' ? 'info' : 'error'"
|
||||
variant="tonal"
|
||||
@click="resetDefaultAvatar"
|
||||
>
|
||||
<VIcon icon="mdi-image-sync-outline" />
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">默认</span>
|
||||
</VBtn>
|
||||
<VBtn
|
||||
type="reset"
|
||||
:color="props.oper === 'add' ? 'info' : 'error'"
|
||||
variant="tonal"
|
||||
@click="resetDefaultAvatar"
|
||||
>
|
||||
<VIcon icon="mdi-image-sync-outline" />
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">默认</span>
|
||||
</VBtn>
|
||||
</div>
|
||||
<p class="text-body-1 mb-0">允许 JPG、PNG、GIF、WEBP 格式, 最大尺寸 800KB。</p>
|
||||
</div>
|
||||
|
||||
<p class="text-body-1 mb-0">允许 JPG、PNG、GIF、WEBP 格式, 最大尺寸 800KB。</p>
|
||||
</form>
|
||||
</VCardText>
|
||||
</div>
|
||||
</VCardItem>
|
||||
<VCardText>
|
||||
<VForm @submit.prevent="() => {}" class="mt-3">
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VDivider class="my-10">
|
||||
<span>用户基础设置</span>
|
||||
</VDivider>
|
||||
|
||||
@@ -129,7 +129,7 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VDialog width="40rem" scrollable max-height="85vh">
|
||||
<VDialog width="40rem" max-height="85vh">
|
||||
<VCard title="用户认证" class="rounded-t">
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
<VCardText>
|
||||
|
||||
@@ -7,9 +7,9 @@ import ReorganizeDialog from '../dialog/ReorganizeDialog.vue'
|
||||
import { formatBytes } from '@core/utils/formatters'
|
||||
import type { Context, EndPoints, FileItem } from '@/api/types'
|
||||
import api from '@/api'
|
||||
import MediaInfoCard from '@/components/cards/MediaInfoCard.vue'
|
||||
import ProgressDialog from '../dialog/ProgressDialog.vue'
|
||||
import { useDisplay } from 'vuetify'
|
||||
import MediaInfoDialog from '../dialog/MediaInfoDialog.vue'
|
||||
|
||||
// 显示器宽度
|
||||
const display = useDisplay()
|
||||
@@ -735,14 +735,12 @@ onMounted(() => {
|
||||
<!-- 进度框 -->
|
||||
<ProgressDialog v-if="progressDialog" v-model="progressDialog" :text="progressText" :value="progressValue" />
|
||||
<!-- 识别结果对话框 -->
|
||||
<VDialog v-if="nameTestDialog" v-model="nameTestDialog" width="50rem">
|
||||
<VCard>
|
||||
<DialogCloseBtn @click="nameTestDialog = false" />
|
||||
<VCardItem>
|
||||
<MediaInfoCard :context="nameTestResult" />
|
||||
</VCardItem>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<MediaInfoDialog
|
||||
v-if="nameTestDialog"
|
||||
v-model="nameTestDialog"
|
||||
:context="nameTestResult"
|
||||
@close="nameTestDialog = false"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
30
src/components/input/CronInput.vue
Normal file
30
src/components/input/CronInput.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import api from '@/api'
|
||||
import { FileItem } from '@/api/types'
|
||||
|
||||
const props = defineProps({
|
||||
cron: {
|
||||
type: String,
|
||||
default: '* * * * *',
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const currentCron = ref(props.cron)
|
||||
|
||||
watch(currentCron, newVal => {
|
||||
emit('update:modelValue', currentCron.value)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<VMenu :close-on-content-click="false" content-class="cursor-default">
|
||||
<template v-slot:activator="{ props }">
|
||||
<slot name="activator" :menuprops="props" />
|
||||
</template>
|
||||
<VCronVuetify v-model="currentCron" locale="zh-CN" :chip-props="{ color: 'success' }" class="mt-1" />
|
||||
</VMenu>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import api from '@/api'
|
||||
import { FileItem } from '@/api/types'
|
||||
import { VTreeview } from 'vuetify/labs/VTreeview'
|
||||
|
||||
const props = defineProps({
|
||||
root: {
|
||||
@@ -79,25 +78,27 @@ function handleUserSelect() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VMenu :close-on-content-click="false" content-class="cursor-default">
|
||||
<template v-slot:activator="{ props }">
|
||||
<slot name="activator" :menuprops="props" />
|
||||
</template>
|
||||
<VTreeview
|
||||
v-model:activated="activedDirs"
|
||||
v-model:opened="openedDirs"
|
||||
:items="treeItems"
|
||||
:load-children="fetchDirs"
|
||||
item-key="path"
|
||||
item-title="name"
|
||||
item-value="path"
|
||||
item-type="unknown"
|
||||
activatable
|
||||
return-object
|
||||
max-height="20rem"
|
||||
expand-icon="mdi-folder"
|
||||
collapse-icon="mdi-folder-open"
|
||||
@update:activated="handleUserSelect"
|
||||
/>
|
||||
</VMenu>
|
||||
<div>
|
||||
<VMenu :close-on-content-click="false" content-class="cursor-default">
|
||||
<template v-slot:activator="{ props }">
|
||||
<slot name="activator" :menuprops="props" />
|
||||
</template>
|
||||
<VTreeview
|
||||
v-model:activated="activedDirs"
|
||||
v-model:opened="openedDirs"
|
||||
:items="treeItems"
|
||||
:load-children="fetchDirs"
|
||||
item-key="path"
|
||||
item-title="name"
|
||||
item-value="path"
|
||||
item-type="unknown"
|
||||
activatable
|
||||
return-object
|
||||
max-height="20rem"
|
||||
expand-icon="mdi-folder"
|
||||
collapse-icon="mdi-folder-open"
|
||||
@update:activated="handleUserSelect"
|
||||
/>
|
||||
</VMenu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
32
src/main.ts
32
src/main.ts
@@ -1,18 +1,12 @@
|
||||
import './ace-config'
|
||||
import '@/@core/utils/compatibility'
|
||||
import '@/@iconify/icons-bundle'
|
||||
import '@/plugins/webfontloader'
|
||||
|
||||
import App from '@/App.vue'
|
||||
import vuetify from '@/plugins/vuetify'
|
||||
import router from '@/router'
|
||||
import store from '@/store'
|
||||
import { createApp } from 'vue'
|
||||
import { removeEl } from './@core/utils/dom'
|
||||
import { fetchGlobalSettings } from './api'
|
||||
import { isPWA } from './@core/utils/navigator'
|
||||
import './ace-config'
|
||||
import { VAceEditor } from 'vue3-ace-editor'
|
||||
import { PerfectScrollbarPlugin } from 'vue3-perfect-scrollbar'
|
||||
import { VTreeview } from 'vuetify/labs/VTreeview'
|
||||
import ToastPlugin from 'vue-toast-notification'
|
||||
import VuetifyUseDialog from 'vuetify-use-dialog'
|
||||
import VueApexCharts from 'vue3-apexcharts'
|
||||
@@ -25,11 +19,22 @@ import MediaInfoCard from './components/cards/MediaInfoCard.vue'
|
||||
import TorrentCard from './components/cards/TorrentCard.vue'
|
||||
import MediaIdSelector from './components/misc/MediaIdSelector.vue'
|
||||
import PathField from './components/input/PathField.vue'
|
||||
import CronInput from './components/input/CronInput.vue'
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { VAceEditor } from 'vue3-ace-editor'
|
||||
import { PerfectScrollbarPlugin } from 'vue3-perfect-scrollbar'
|
||||
import { CronVuetify } from '@vue-js-cron/vuetify'
|
||||
import { removeEl } from './@core/utils/dom'
|
||||
import { fetchGlobalSettings } from './api'
|
||||
import { isPWA } from './@core/utils/navigator'
|
||||
|
||||
import '@core/scss/template/index.scss'
|
||||
import '@layouts/styles/index.scss'
|
||||
import '@styles/styles.scss'
|
||||
import 'vue-toast-notification/dist/theme-bootstrap.css'
|
||||
import 'vue3-perfect-scrollbar/style.css'
|
||||
import '@vue-js-cron/vuetify/dist/vuetify.css'
|
||||
|
||||
// 创建Vue实例
|
||||
const app = createApp(App)
|
||||
@@ -49,9 +54,14 @@ async function initializeApp() {
|
||||
|
||||
// 注册全局组件
|
||||
initializeApp().then(() => {
|
||||
// 优先注册框架
|
||||
app.use(vuetify)
|
||||
|
||||
// 注册全局组件
|
||||
app
|
||||
.component('VAceEditor', VAceEditor)
|
||||
.component('VApexChart', VueApexCharts)
|
||||
.component('VCronVuetify', CronVuetify)
|
||||
.component('VDialogCloseBtn', DialogCloseBtn)
|
||||
.component('VMediaCard', MediaCard)
|
||||
.component('VPosterCard', PosterCard)
|
||||
@@ -60,14 +70,14 @@ initializeApp().then(() => {
|
||||
.component('VMediaInfoCard', MediaInfoCard)
|
||||
.component('VTorrentCard', TorrentCard)
|
||||
.component('VMediaIdSelector', MediaIdSelector)
|
||||
.component('VTreeview', VTreeview)
|
||||
.component('VPathField', PathField)
|
||||
.component('VCronInput', CronInput)
|
||||
|
||||
// 注册插件
|
||||
app
|
||||
.use(vuetify)
|
||||
.use(router)
|
||||
.use(store)
|
||||
.use(PerfectScrollbarPlugin)
|
||||
.use(ToastPlugin, {
|
||||
position: 'bottom-right',
|
||||
})
|
||||
@@ -91,8 +101,6 @@ initializeApp().then(() => {
|
||||
cancellationText: '取消',
|
||||
},
|
||||
})
|
||||
.use(PerfectScrollbarPlugin)
|
||||
.use(VueApexCharts)
|
||||
.mount('#app')
|
||||
.$nextTick(() => removeEl('#loading-bg'))
|
||||
})
|
||||
|
||||
@@ -130,7 +130,6 @@ function login() {
|
||||
|
||||
// 进行表单校验
|
||||
if (!form.value.username || !form.value.password || (isOTP.value && !form.value.otp_password)) {
|
||||
errorMessage.value = '请输入完整信息'
|
||||
return
|
||||
}
|
||||
// 用户名密码
|
||||
@@ -175,11 +174,11 @@ function login() {
|
||||
})
|
||||
.catch((error: any) => {
|
||||
// 登录失败,显示错误提示
|
||||
if (!error.response) errorMessage.value = '登录失败,请检查网络连接'
|
||||
else if (error.response.status === 401) errorMessage.value = '登录失败,请检查用户名、密码或双重验证是否正确'
|
||||
else if (error.response.status === 403) errorMessage.value = '登录失败,您没有权限访问'
|
||||
else if (error.response.status === 500) errorMessage.value = '登录失败,服务器错误'
|
||||
else errorMessage.value = `登录失败 ${error.response.status},请检查用户名、密码或双重验证码是否正确`
|
||||
if (!error.response) errorMessage.value = '登录失败,请检查网络连接!'
|
||||
else if (error.response.status === 401) errorMessage.value = '登录失败,请检查用户名、密码或双重验证是否正确!'
|
||||
else if (error.response.status === 403) errorMessage.value = '登录失败,您没有权限访问!'
|
||||
else if (error.response.status === 500) errorMessage.value = '登录失败,服务器错误!'
|
||||
else errorMessage.value = `登录失败 ${error.response.status},请检查用户名、密码或双重验证码是否正确!`
|
||||
})
|
||||
}
|
||||
|
||||
@@ -275,9 +274,9 @@ onUnmounted(() => {
|
||||
<VCol cols="12">
|
||||
<!-- login button -->
|
||||
<VBtn block type="submit" @click="login"> 登录 </VBtn>
|
||||
<div v-if="errorMessage" class="text-error mt-2 text-shadow">
|
||||
<VAlert v-if="errorMessage" type="error" variant="tonal" class="mt-3">
|
||||
{{ errorMessage }}
|
||||
</div>
|
||||
</VAlert>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
|
||||
@@ -68,6 +68,7 @@ const viewList = reactive<{ apipath: string; linkurl: string; title: string }[]>
|
||||
title: '豆瓣全球剧集榜',
|
||||
},
|
||||
])
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -189,7 +189,18 @@ const router = createRouter({
|
||||
},
|
||||
],
|
||||
})
|
||||
const abortControllers = new Set<AbortController>()
|
||||
|
||||
function registerAbortController(controller: AbortController) {
|
||||
abortControllers.add(controller)
|
||||
}
|
||||
|
||||
function abortAllControllers() {
|
||||
for (const controller of abortControllers) {
|
||||
controller.abort()
|
||||
}
|
||||
abortControllers.clear()
|
||||
}
|
||||
// 路由导航守卫
|
||||
router.beforeEach((to, from, next) => {
|
||||
// 总是记录非login路由
|
||||
@@ -198,8 +209,11 @@ router.beforeEach((to, from, next) => {
|
||||
if (to.meta.requiresAuth && !isAuthenticated) {
|
||||
next('/login')
|
||||
} else {
|
||||
abortAllControllers() // 中止所有组件的任务
|
||||
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
export default router // 导出默认对象
|
||||
export { registerAbortController } // 另行导出其他功能
|
||||
|
||||
@@ -50,15 +50,15 @@ export const SystemNavMenus = [
|
||||
admin: false,
|
||||
},
|
||||
{
|
||||
title: '正在下载',
|
||||
title: '下载管理',
|
||||
icon: 'mdi-download-outline',
|
||||
to: '/downloading',
|
||||
header: '整理',
|
||||
admin: false,
|
||||
},
|
||||
{
|
||||
title: '历史记录',
|
||||
icon: 'mdi-history',
|
||||
title: '媒体整理',
|
||||
icon: 'mdi-folder-play-outline',
|
||||
to: '/history',
|
||||
header: '整理',
|
||||
admin: true,
|
||||
@@ -100,35 +100,6 @@ export const SystemNavMenus = [
|
||||
},
|
||||
]
|
||||
|
||||
// 常用菜单功能
|
||||
export const UserfulMenus = [
|
||||
{
|
||||
title: '搜索设置',
|
||||
icon: 'mdi-magnify',
|
||||
to: 'setting?tab=search',
|
||||
},
|
||||
{
|
||||
title: '订阅设置',
|
||||
icon: 'mdi-rss',
|
||||
to: 'setting?tab=subscribe',
|
||||
},
|
||||
{
|
||||
title: '服务',
|
||||
icon: 'mdi-list-box',
|
||||
to: 'setting?tab=service',
|
||||
},
|
||||
{
|
||||
title: '词表',
|
||||
icon: 'mdi-file-word-box',
|
||||
to: 'setting?tab=words',
|
||||
},
|
||||
{
|
||||
title: '历史记录',
|
||||
icon: 'mdi-history',
|
||||
to: 'history',
|
||||
},
|
||||
]
|
||||
|
||||
// 设定标签页
|
||||
export const SettingTabs = [
|
||||
{
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
html.v-overlay-scroll-blocked {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#nprogress .bar {
|
||||
background: rgb(var(--v-theme-primary)) !important;
|
||||
inset-block-start: env(safe-area-inset-top) !important;
|
||||
@@ -24,15 +28,11 @@
|
||||
}
|
||||
|
||||
.v-dialog > .v-overlay__content {
|
||||
inline-size: calc(100% - 1rem);
|
||||
margin-block-start: calc(env(safe-area-inset-top) + 1rem);
|
||||
max-block-size: calc(100% - env(safe-area-inset-top) - 1rem);
|
||||
margin-block: env(safe-area-inset-top) env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.v-dialog--fullscreen > .v-overlay__content{
|
||||
inline-size: 100%;
|
||||
margin-block-start: env(safe-area-inset-top);
|
||||
max-block-size: calc(100% - env(safe-area-inset-top));
|
||||
.v-dialog--fullscreen > .v-overlay__content > .v-card {
|
||||
padding-block-end: calc(env(safe-area-inset-top) + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
/* router view transition fade-slide */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import VueApexCharts from 'vue3-apexcharts'
|
||||
import { useTheme } from 'vuetify'
|
||||
import { hexToRgb } from '@layouts/utils'
|
||||
import api from '@/api'
|
||||
@@ -143,8 +142,7 @@ onUnmounted(() => {
|
||||
<VCardTitle>CPU</VCardTitle>
|
||||
</VCardItem>
|
||||
<VCardText>
|
||||
<VueApexCharts type="line" :options="chartOptions" :series="series" :height="150" />
|
||||
|
||||
<VApexChart type="line" :options="chartOptions" :series="series" :height="150" />
|
||||
<p class="text-center font-weight-medium mb-0">当前:{{ current }}%</p>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import VueApexCharts from 'vue3-apexcharts'
|
||||
import { useTheme } from 'vuetify'
|
||||
import { hexToRgb } from '@layouts/utils'
|
||||
import api from '@/api'
|
||||
@@ -149,8 +148,7 @@ onUnmounted(() => {
|
||||
<VCardTitle>内存</VCardTitle>
|
||||
</VCardItem>
|
||||
<VCardText>
|
||||
<VueApexCharts type="area" :options="chartOptions" :series="series" :height="150" />
|
||||
|
||||
<VApexChart type="area" :options="chartOptions" :series="series" :height="150" />
|
||||
<p class="text-center font-weight-medium mb-0">当前:{{ formatBytes(usedMemory) }}</p>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import VueApexCharts from 'vue3-apexcharts'
|
||||
import { useTheme } from 'vuetify'
|
||||
import api from '@/api'
|
||||
import { hexToRgb } from '@layouts/utils'
|
||||
@@ -127,8 +126,7 @@ onMounted(() => {
|
||||
</VCardItem>
|
||||
|
||||
<VCardText>
|
||||
<VueApexCharts type="bar" :options="options" :series="series" :height="160" />
|
||||
|
||||
<VApexChart type="bar" :options="options" :series="series" :height="160" />
|
||||
<div class="d-flex align-center mb-3">
|
||||
<h5 class="text-h5 me-4">
|
||||
{{ totalCount }}
|
||||
|
||||
@@ -27,7 +27,6 @@ const isRefreshed = ref(false)
|
||||
// 数据列表
|
||||
const dataList = ref<MediaInfo[]>([])
|
||||
const currData = ref<MediaInfo[]>([])
|
||||
|
||||
// 拼装参数
|
||||
function getParams() {
|
||||
let params = {
|
||||
@@ -78,6 +77,7 @@ async function fetchData({ done }: { done: any }) {
|
||||
} else {
|
||||
// 加载一次
|
||||
// 设置加载中
|
||||
|
||||
loading.value = true
|
||||
// 请求API
|
||||
currData.value = await api.get(props.apipath, {
|
||||
@@ -115,15 +115,7 @@ async function fetchData({ done }: { done: any }) {
|
||||
<div v-if="dataList.length > 0" class="grid gap-4 grid-media-card mx-3" tabindex="0">
|
||||
<MediaCard v-for="data in dataList" :key="data.tmdb_id || data.douban_id" :media="data" />
|
||||
</div>
|
||||
<NoDataFound
|
||||
v-if="dataList.length === 0 && isRefreshed"
|
||||
error-code="404"
|
||||
error-title="没有数据"
|
||||
error-description="无法获取到媒体信息。"
|
||||
/>
|
||||
<NoDataFound v-if="dataList.length === 0 && isRefreshed" error-code="404" error-title="没有数据"
|
||||
error-description="无法获取到媒体信息。" />
|
||||
</VInfiniteScroll>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
|
||||
@@ -3,6 +3,7 @@ import api from '@/api'
|
||||
import type { MediaInfo } from '@/api/types'
|
||||
import MediaCard from '@/components/cards/MediaCard.vue'
|
||||
import SlideView from '@/components/slide/SlideView.vue'
|
||||
import { registerAbortController } from "@/router";
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
@@ -10,8 +11,9 @@ const props = defineProps({
|
||||
linkurl: String,
|
||||
title: String,
|
||||
})
|
||||
let abortController: AbortController | null = null;
|
||||
|
||||
provide('rankingPropsKey', reactive({...props}))
|
||||
provide('rankingPropsKey', reactive({ ...props }))
|
||||
|
||||
// 组件加载完成
|
||||
const componentLoaded = ref(false)
|
||||
@@ -24,8 +26,10 @@ async function fetchData() {
|
||||
try {
|
||||
if (!props.apipath)
|
||||
return
|
||||
|
||||
dataList.value = await api.get(props.apipath)
|
||||
abortController = new AbortController();
|
||||
registerAbortController(abortController);
|
||||
const { signal } = abortController;
|
||||
dataList.value = await api.get(props.apipath, { signal })
|
||||
if (dataList.value.length > 0)
|
||||
componentLoaded.value = true
|
||||
}
|
||||
@@ -35,23 +39,22 @@ async function fetchData() {
|
||||
}
|
||||
|
||||
// 加载时获取数据
|
||||
onMounted(fetchData)
|
||||
onMounted(() => {
|
||||
fetchData();
|
||||
});
|
||||
onActivated(() => {
|
||||
if (dataList.value.length == 0) {
|
||||
fetchData();
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<SlideView
|
||||
v-if="componentLoaded"
|
||||
>
|
||||
<SlideView v-if="componentLoaded">
|
||||
<template #content>
|
||||
<template
|
||||
v-for="data in dataList"
|
||||
:key="data.tmdb_id || data.douban_id || data.bangumi_id"
|
||||
>
|
||||
<MediaCard
|
||||
:media="data"
|
||||
height="15rem"
|
||||
width="10rem"
|
||||
/>
|
||||
<template v-for="data in dataList" :key="data.tmdb_id || data.douban_id || data.bangumi_id">
|
||||
<MediaCard :media="data" height="15rem" width="10rem" />
|
||||
</template>
|
||||
</template>
|
||||
</SlideView>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import draggable from 'vuedraggable'
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import api from '@/api'
|
||||
import type { Plugin } from '@/api/types'
|
||||
@@ -28,6 +29,9 @@ const pluginId = ref(route.query.id)
|
||||
// 当前排序字段
|
||||
const activeSort = ref(null)
|
||||
|
||||
// 插件顺序配置
|
||||
const orderConfig = ref<{ id: string }[]>([])
|
||||
|
||||
// 排序选项
|
||||
const sortOptions = [
|
||||
{ title: '热门', value: 'count' },
|
||||
@@ -104,6 +108,52 @@ const labelFilterOptions = ref<string[]>([])
|
||||
// 插件库过滤项
|
||||
const repoFilterOptions = ref<string[]>([])
|
||||
|
||||
// 加载插件顺序
|
||||
async function loadPluginOrderConfig() {
|
||||
// 顺序配置
|
||||
const local_order = localStorage.getItem('MP_PLUGIN_ORDER')
|
||||
if (local_order) {
|
||||
orderConfig.value = JSON.parse(local_order)
|
||||
} else {
|
||||
const response2 = await api.get('/user/config/PluginOrder')
|
||||
if (response2 && response2.data && response2.data.value) {
|
||||
orderConfig.value = response2.data.value
|
||||
localStorage.setItem('MP_PLUGIN_ORDER', JSON.stringify(orderConfig.value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按order的顺序对插件进行排序
|
||||
function sortPluginOrder() {
|
||||
if (!orderConfig.value) {
|
||||
return
|
||||
}
|
||||
if (dataList.value.length === 0) {
|
||||
return
|
||||
}
|
||||
dataList.value.sort((a, b) => {
|
||||
const aIndex = orderConfig.value.findIndex((item: { id: string }) => item.id === a.id)
|
||||
const bIndex = orderConfig.value.findIndex((item: { id: string }) => item.id === b.id)
|
||||
return (aIndex === -1 ? 999 : aIndex) - (bIndex === -1 ? 999 : bIndex)
|
||||
})
|
||||
}
|
||||
|
||||
// 保存顺序设置
|
||||
async function savePluginOrder() {
|
||||
// 顺序配置
|
||||
const orderObj = dataList.value.map(item => ({ id: item.id || '' }))
|
||||
orderConfig.value = orderObj
|
||||
const orderString = JSON.stringify(orderObj)
|
||||
localStorage.setItem('MP_PLUGIN_ORDER', orderString)
|
||||
|
||||
// 保存到服务端
|
||||
try {
|
||||
await api.post('/user/config/PluginOrder', orderObj)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化过滤选项
|
||||
function initOptions(item: Plugin) {
|
||||
const optionValue = (options: Array<string>, value: string | undefined) => {
|
||||
@@ -208,6 +258,8 @@ async function fetchInstalledPlugins() {
|
||||
state: 'installed',
|
||||
},
|
||||
})
|
||||
// 排序
|
||||
sortPluginOrder()
|
||||
loading.value = false
|
||||
isRefreshed.value = true
|
||||
} catch (error) {
|
||||
@@ -329,8 +381,9 @@ function handleRepoUrl(url: string | undefined) {
|
||||
}
|
||||
|
||||
// 加载时获取数据
|
||||
onBeforeMount(async () => {
|
||||
await refreshData()
|
||||
onMounted(async () => {
|
||||
await loadPluginOrderConfig()
|
||||
refreshData()
|
||||
getPluginStatistics()
|
||||
if (activeTab.value != 'market' && pluginId.value) {
|
||||
// 找到这个插件
|
||||
@@ -356,18 +409,26 @@ onBeforeMount(async () => {
|
||||
<transition name="fade-slide" appear>
|
||||
<div>
|
||||
<LoadingBanner v-if="!isRefreshed" class="mt-12" />
|
||||
<div v-if="dataList.length > 0" class="grid gap-4 grid-plugin-card">
|
||||
<template v-for="(data, index) in dataList" :key="`${data.id}_v${data.plugin_version}`">
|
||||
<draggable
|
||||
v-if="dataList.length > 0"
|
||||
v-model="dataList"
|
||||
@end="savePluginOrder"
|
||||
handle=".cursor-move"
|
||||
item-key="id"
|
||||
tag="div"
|
||||
:component-data="{ class: 'grid gap-4 grid-plugin-card' }"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<PluginCard
|
||||
:count="PluginStatistics[data.id || '0']"
|
||||
:plugin="data"
|
||||
:action="pluginActions[data.id || '0']"
|
||||
:count="PluginStatistics[element.id || '0']"
|
||||
:plugin="element"
|
||||
:action="pluginActions[element.id || '0']"
|
||||
@remove="refreshData"
|
||||
@save="refreshData"
|
||||
@action-done="pluginActions[data.id || '0'] = false"
|
||||
@action-done="pluginActions[element.id || '0'] = false"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</draggable>
|
||||
<NoDataFound
|
||||
v-if="dataList.length === 0 && isRefreshed"
|
||||
error-code="404"
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useToast } from 'vue-toast-notification'
|
||||
import api from '@/api'
|
||||
import type { TransferHistory } from '@/api/types'
|
||||
import ReorganizeDialog from '@/components/dialog/ReorganizeDialog.vue'
|
||||
import TransferQueueDialog from '@/components/dialog/TransferQueueDialog.vue'
|
||||
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import router from '@/router'
|
||||
@@ -20,9 +21,15 @@ const $toast = useToast()
|
||||
// 路由
|
||||
const route = useRoute()
|
||||
|
||||
// 组合式输入法状态
|
||||
const isComposing = ref(false)
|
||||
|
||||
// 重新整理对话框
|
||||
const redoDialog = ref(false)
|
||||
|
||||
// 整理队列对话框
|
||||
const transferQueueDialog = ref(false)
|
||||
|
||||
// 当前操作记录
|
||||
const currentHistory = ref<TransferHistory>()
|
||||
|
||||
@@ -144,7 +151,7 @@ const totalPage = computed(() => {
|
||||
return total
|
||||
})
|
||||
|
||||
// 切换页签和搜索词
|
||||
// 切换页签
|
||||
watch(
|
||||
[() => currentPage.value, () => itemsPerPage.value],
|
||||
debounce(async () => {
|
||||
@@ -152,10 +159,13 @@ watch(
|
||||
}, 1000),
|
||||
)
|
||||
|
||||
watch(
|
||||
[() => search.value],
|
||||
// 搜索监听
|
||||
watch([() => search.value, () => isComposing.value],
|
||||
debounce(async () => {
|
||||
reloadPage(true)
|
||||
if (!isComposing.value) {
|
||||
console.log('search: ' + search.value)
|
||||
reloadPage(true)
|
||||
}
|
||||
}, 1000),
|
||||
)
|
||||
|
||||
@@ -361,15 +371,16 @@ onMounted(fetchData)
|
||||
<VCardItem>
|
||||
<VCardTitle>
|
||||
<VRow>
|
||||
<VCol cols="4" md="6"> 历史记录 </VCol>
|
||||
<VCol cols="8" md="6" class="flex">
|
||||
<VCombobox
|
||||
key="search_navbar"
|
||||
v-model="search"
|
||||
:items="searchHintList"
|
||||
@compositionstart="isComposing = true"
|
||||
@compositionend="isComposing = false"
|
||||
class="text-disabled"
|
||||
density="compact"
|
||||
label="搜索目录、状态"
|
||||
label="搜索整理记录"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
variant="solo-filled"
|
||||
single-line
|
||||
@@ -379,6 +390,16 @@ onMounted(fetchData)
|
||||
clearable
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="4" md="6" class="text-end">
|
||||
<VBtn
|
||||
color="primary"
|
||||
prepend-icon="mdi-tray-full"
|
||||
append-icon="mdi-dots-horizontal"
|
||||
@click="transferQueueDialog = true"
|
||||
>
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">整理队列</span>
|
||||
</VBtn>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VCardTitle>
|
||||
</VCardItem>
|
||||
@@ -514,13 +535,13 @@ onMounted(fetchData)
|
||||
{{ confirmTitle }}
|
||||
</VCardTitle>
|
||||
<div class="d-flex flex-column flex-lg-row justify-center my-3">
|
||||
<VBtn color="primary" class="mb-2 mx-2" @click="deleteConfirmHandler(false, false)"> 仅删除历史记录 </VBtn>
|
||||
<VBtn color="warning" class="mb-2 mx-2" @click="deleteConfirmHandler(true, false)"> 删除历史记录和源文件 </VBtn>
|
||||
<VBtn color="primary" class="mb-2 mx-2" @click="deleteConfirmHandler(false, false)"> 仅删除整理记录 </VBtn>
|
||||
<VBtn color="warning" class="mb-2 mx-2" @click="deleteConfirmHandler(true, false)"> 删除整理记录和源文件 </VBtn>
|
||||
<VBtn color="info" class="mb-2 mx-2" @click="deleteConfirmHandler(false, true)">
|
||||
删除历史记录和媒体库文件
|
||||
删除整理记录和媒体库文件
|
||||
</VBtn>
|
||||
<VBtn color="error" class="mb-2 mx-2" @click="deleteConfirmHandler(true, true)">
|
||||
删除历史记录、源文件和媒体库文件
|
||||
删除整理记录、源文件和媒体库文件
|
||||
</VBtn>
|
||||
</div>
|
||||
</VCard>
|
||||
@@ -536,6 +557,8 @@ onMounted(fetchData)
|
||||
@done="transferDone"
|
||||
@close="redoDialog = false"
|
||||
/>
|
||||
<!-- 整理队列进度弹窗 -->
|
||||
<TransferQueueDialog v-if="transferQueueDialog" v-model="transferQueueDialog" @close="transferQueueDialog = false" />
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@@ -165,7 +165,7 @@ onMounted(() => {
|
||||
<dd class="flex text-sm sm:col-span-2 sm:mt-0">
|
||||
<span class="flex-grow undefined">
|
||||
<a
|
||||
href="https://github.com/jxxghp/MoviePilot/blob/main/README.md"
|
||||
href="https://wiki.movie-pilot.org"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
class="text-indigo-500 transition duration-300 hover:underline"
|
||||
|
||||
@@ -222,6 +222,7 @@ onMounted(() => {
|
||||
<VRadioGroup v-model="item.action" inline>
|
||||
<VRadio value="user" label="仅操作用户" />
|
||||
<VRadio value="admin" label="仅管理员" />
|
||||
<VRadio value="user,admin" label="操作用户和管理员" />
|
||||
<VRadio value="all" label="所有用户" />
|
||||
</VRadioGroup>
|
||||
</td>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import { copyToClipboard } from '@/@core/utils/navigator'
|
||||
import draggable from 'vuedraggable'
|
||||
import { VRow } from 'vuetify/lib/components/index.mjs'
|
||||
import api from '@/api'
|
||||
import { CustomRule, FilterRuleGroup } from '@/api/types'
|
||||
import CustomerRuleCard from '@/components/cards/CustomRuleCard.vue'
|
||||
@@ -25,9 +24,6 @@ const mediaCategories = ref<{ [key: string]: any }>({})
|
||||
// 导入代码弹窗
|
||||
const importCodeDialog = ref(false)
|
||||
|
||||
// 导入的代码
|
||||
const importCodeString = ref('')
|
||||
|
||||
// 导入代码类型
|
||||
const importCodeType = ref('')
|
||||
|
||||
@@ -98,8 +94,6 @@ async function addCustomRule() {
|
||||
customRules.value.push({
|
||||
id: id,
|
||||
name: name,
|
||||
include: '',
|
||||
exclude: '',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -149,14 +143,11 @@ function addFilterRuleGroup() {
|
||||
}
|
||||
filterRuleGroups.value.push({
|
||||
name: name,
|
||||
rule_string: '',
|
||||
media_type: '',
|
||||
category: '',
|
||||
})
|
||||
}
|
||||
|
||||
// 分享规则
|
||||
function shareRules(rules: CustomRule[] | FilterRuleGroup[]) {
|
||||
async function shareRules(rules: CustomRule[] | FilterRuleGroup[], type: string) {
|
||||
if (!rules || rules.length === 0) return
|
||||
|
||||
// 将卡片规则接装为字符串
|
||||
@@ -164,55 +155,136 @@ function shareRules(rules: CustomRule[] | FilterRuleGroup[]) {
|
||||
|
||||
// 复制到剪贴板
|
||||
try {
|
||||
copyToClipboard(value)
|
||||
$toast.success('优先级规则已复制到剪贴板')
|
||||
} catch (error) {
|
||||
$toast.error('优先级规则复制失败!')
|
||||
let success
|
||||
success = copyToClipboard(value)
|
||||
if (await success) $toast.success(`${type === 'custom' ? '自定义规则' : '优先级规则组'}已复制到剪贴板!`)
|
||||
else $toast.error(`${type === 'custom' ? '自定义规则' : '优先级规则组'}复制失败:可能是浏览器不支持或被用户阻止!`)
|
||||
} catch (e) {
|
||||
$toast.error(`${type === 'custom' ? '自定义规则' : '优先级规则组'}复制失败!`)
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 导入规则
|
||||
// 打开弹窗
|
||||
async function importRules(ruleType: string) {
|
||||
importCodeType.value = ruleType
|
||||
importCodeString.value = ''
|
||||
importCodeDialog.value = true
|
||||
}
|
||||
|
||||
// 监听导入代码变化
|
||||
watchEffect(() => {
|
||||
if (!importCodeString.value) return
|
||||
// 导入代码需要json格式
|
||||
// 保存导入的代码
|
||||
function saveCodeString(type: string, codeString: any) {
|
||||
// codeString从子组件传递过来,从对象转换为JSON
|
||||
let parsedCode
|
||||
try {
|
||||
if (importCodeType.value === 'custom') {
|
||||
// 将导入的代码转换为规则卡片,并追加到已有的 customRules
|
||||
const newCustomRules = JSON.parse(importCodeString.value).map((item: any) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
include: item.include,
|
||||
exclude: item.exclude,
|
||||
publish_time: item.publish_time,
|
||||
seeders: item.seeders,
|
||||
size_range: item.size_range,
|
||||
}
|
||||
})
|
||||
customRules.value = [...customRules.value, ...newCustomRules] // 合并已有的和新导入的规则
|
||||
} else if (importCodeType.value === 'group') {
|
||||
// 将导入的代码转换为规则卡片,并追加到已有的 filterRuleGroups
|
||||
const newFilterRuleGroups = JSON.parse(importCodeString.value).map((item: any) => {
|
||||
return {
|
||||
name: item.name,
|
||||
rule_string: item.rule_string,
|
||||
media_type: item.media_type,
|
||||
category: item.category,
|
||||
}
|
||||
})
|
||||
filterRuleGroups.value = [...filterRuleGroups.value, ...newFilterRuleGroups] // 合并已有的和新导入的规则
|
||||
}
|
||||
} catch (error) {
|
||||
$toast.error('规则导入失败!')
|
||||
parsedCode = JSON.parse(codeString.value)
|
||||
} catch (e) {
|
||||
$toast.error('导入规则失败!无法解析输入的数据!')
|
||||
console.error(e)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
// 更新数据
|
||||
try {
|
||||
if (type === 'custom') {
|
||||
if (!checkValueValidity(parsedCode, type)) return false
|
||||
const newCustomRules = extractCustomRules(parsedCode) || []
|
||||
customRules.value = [...customRules.value, ...newCustomRules]
|
||||
} else if (type === 'group') {
|
||||
if (!checkValueValidity(parsedCode, type)) return false
|
||||
const newFilterRuleGroups = extractFilterRuleGroups(parsedCode) || []
|
||||
filterRuleGroups.value = [...filterRuleGroups.value, ...newFilterRuleGroups]
|
||||
} else {
|
||||
$toast.error('导入规则失败!未知的数据类型!')
|
||||
}
|
||||
} catch (e) {
|
||||
$toast.error('导入规则失败!')
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 赋值自定义规则,避免存在多余的属性
|
||||
function extractCustomRules(value: any) {
|
||||
try {
|
||||
return value.map((item: any) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
include: item.include,
|
||||
exclude: item.exclude,
|
||||
size_range: item.size_range,
|
||||
seeders: item.seeders,
|
||||
publish_time: item.publish_time,
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 赋值规则组,避免存在多余的属性
|
||||
function extractFilterRuleGroups(value: any) {
|
||||
try {
|
||||
return value.map((item: any) => {
|
||||
return {
|
||||
name: item.name,
|
||||
rule_string: item.rule_string,
|
||||
media_type: item.media_type,
|
||||
category: item.category,
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 根据ID简单区分规则与规则组
|
||||
function checkValueValidity(values: any, type: string): boolean {
|
||||
try {
|
||||
// 允许空值存在,不影响最终的导入
|
||||
if (!values) return true
|
||||
if (!type) return false
|
||||
for (const value of values) {
|
||||
const keys = Object.keys(value)
|
||||
const uniqueKeys = new Set(keys)
|
||||
|
||||
const hasName = keys.includes('name')
|
||||
const hasId = keys.includes('id')
|
||||
const noDuplicates = keys.length === uniqueKeys.size
|
||||
if (type == 'custom') {
|
||||
if (!hasName || !hasId || !noDuplicates) {
|
||||
if (!noDuplicates) $toast.warning(`存在重名值`)
|
||||
if (!hasId) $toast.error(`导入失败!发现有规则不存在ID,可能属于优先级规则组!`)
|
||||
return false
|
||||
}
|
||||
} else if (type == 'group') {
|
||||
if (!hasName || hasId || !noDuplicates) {
|
||||
if (!noDuplicates) $toast.warning(`存在重名值`)
|
||||
if (hasId) $toast.error(`导入失败!发现有规则存在ID,可能属于自定义规则!`)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
console.error(`传入了不合法的类型!`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 清空规则(组)
|
||||
function deleteAllRules(dateType: string) {
|
||||
if (!dateType) return
|
||||
if (dateType === 'custom') {
|
||||
customRules.value = []
|
||||
} else if (dateType === 'group') {
|
||||
filterRuleGroups.value = []
|
||||
} else {
|
||||
console.error(`传入了不支持的类型!`)
|
||||
}
|
||||
}
|
||||
|
||||
// 规则变化时赋值
|
||||
function onRuleChange(rule: CustomRule, id: string) {
|
||||
@@ -310,12 +382,15 @@ onMounted(() => {
|
||||
<VBtn color="success" variant="tonal" @click="addCustomRule">
|
||||
<VIcon icon="mdi-plus" />
|
||||
</VBtn>
|
||||
<VBtn color="info" variant="tonal" @click="importRules('custom')">
|
||||
<VBtn color="primary" variant="tonal" @click="importRules('custom')">
|
||||
<VIcon icon="mdi-import" />
|
||||
</VBtn>
|
||||
<VBtn color="info" variant="tonal" @click="shareRules(customRules)">
|
||||
<VBtn color="info" variant="tonal" @click="shareRules(customRules, 'custom')">
|
||||
<VIcon icon="mdi-share" />
|
||||
</VBtn>
|
||||
<VBtn color="error" variant="tonal" @click="deleteAllRules('custom')">
|
||||
<VIcon icon="mdi-delete" />
|
||||
</VBtn>
|
||||
</VBtnGroup>
|
||||
</div>
|
||||
</VForm>
|
||||
@@ -358,22 +433,30 @@ onMounted(() => {
|
||||
<VBtn color="success" variant="tonal" @click="addFilterRuleGroup">
|
||||
<VIcon icon="mdi-plus" />
|
||||
</VBtn>
|
||||
<VBtn color="info" variant="tonal" @click="importRules('group')">
|
||||
<VBtn color="primary" variant="tonal" @click="importRules('group')">
|
||||
<VIcon icon="mdi-import" />
|
||||
</VBtn>
|
||||
<VBtn color="info" variant="tonal" @click="shareRules(filterRuleGroups)">
|
||||
<VBtn color="info" variant="tonal" @click="shareRules(filterRuleGroups, 'group')">
|
||||
<VIcon icon="mdi-share" />
|
||||
</VBtn>
|
||||
<VBtn color="error" variant="tonal" @click="deleteAllRules('group')">
|
||||
<VIcon icon="mdi-delete" />
|
||||
</VBtn>
|
||||
</VBtnGroup>
|
||||
</div>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
<VDialog v-model="importCodeDialog" width="60rem" scrollable>
|
||||
<ImportCodeDialog v-model="importCodeString" title="导入规则" @close="importCodeDialog = false" />
|
||||
</VDialog>
|
||||
</VCard>
|
||||
</VCol>
|
||||
</VRow>
|
||||
<ImportCodeDialog
|
||||
v-if="importCodeDialog"
|
||||
v-model="importCodeDialog"
|
||||
:title="`导入${importCodeType === 'custom' ? '自定义规则' : '优先级规则组'}`"
|
||||
:dataType="importCodeType"
|
||||
@close="importCodeDialog = false"
|
||||
@save="saveCodeString"
|
||||
/>
|
||||
<VRow>
|
||||
<VCol cols="12">
|
||||
<VCard>
|
||||
|
||||
@@ -133,6 +133,11 @@ async function saveSearchSetting() {
|
||||
selectedMediaSource.value.join(','),
|
||||
)
|
||||
|
||||
if (!result1 || !result1.success) {
|
||||
$toast.error(`媒体搜索数据源保存失败:${result1?.message}!`)
|
||||
return
|
||||
}
|
||||
|
||||
const result2: { [key: string]: any } = await api.post(
|
||||
'system/setting/SearchFilterRuleGroups',
|
||||
selectedFilterGroup.value,
|
||||
@@ -140,7 +145,7 @@ async function saveSearchSetting() {
|
||||
|
||||
const result3 = await saveSystemSetting(SystemSettings.value.Basic)
|
||||
|
||||
if (result1.success && result2.success && result3) {
|
||||
if (result2.success && result3) {
|
||||
$toast.success('搜索基础设置保存成功')
|
||||
} else {
|
||||
$toast.error('搜索基础设置保存失败!')
|
||||
|
||||
@@ -105,8 +105,10 @@ async function saveSiteSetting(value: { [key: string]: any }) {
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post('system/env', value)
|
||||
if (result.success) {
|
||||
$toast.success('保存设置成功')
|
||||
$toast.success('保存站点设置成功')
|
||||
await reloadSystem()
|
||||
} else {
|
||||
$toast.error('站点设置保存失败!')
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
@@ -26,16 +26,16 @@ const SystemSettings = ref<any>({
|
||||
// 全局
|
||||
AUXILIARY_AUTH_ENABLE: false,
|
||||
GLOBAL_IMAGE_CACHE: false,
|
||||
SUBSCRIBE_STATISTIC_SHARE: true,
|
||||
PLUGIN_STATISTIC_SHARE: true,
|
||||
BIG_MEMORY_MODE: false,
|
||||
DB_WAL_ENABLE: false,
|
||||
// 媒体
|
||||
TMDB_API_DOMAIN: null,
|
||||
TMDB_IMAGE_DOMAIN: null,
|
||||
META_CACHE_EXPIRE: 0,
|
||||
FANART_ENABLE: false,
|
||||
SCRAP_FOLLOW_TMDB: true,
|
||||
SUBSCRIBE_STATISTIC_SHARE: true,
|
||||
PLUGIN_STATISTIC_SHARE: true,
|
||||
FANART_ENABLE: false,
|
||||
// 网络
|
||||
PROXY_HOST: null,
|
||||
GITHUB_PROXY: null,
|
||||
@@ -43,9 +43,16 @@ const SystemSettings = ref<any>({
|
||||
DOH_ENABLE: false,
|
||||
DOH_RESOLVERS: null,
|
||||
DOH_DOMAINS: null,
|
||||
// 开发
|
||||
// 日志
|
||||
DEBUG: false,
|
||||
LOG_LEVEL: 'INFO',
|
||||
LOG_MAX_FILE_SIZE: '5',
|
||||
LOG_BACKUP_COUNT: '3',
|
||||
LOG_FILE_FORMAT: '【%(levelname)s】%(asctime)s - %(message)s',
|
||||
// 实验室
|
||||
PLUGIN_AUTO_RELOAD: false,
|
||||
ENCODING_DETECTION_PERFORMANCE_MODE: true,
|
||||
TOKENIZED_SEARCH: false,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -170,6 +177,9 @@ async function saveSystemSetting(value: { [key: string]: any }) {
|
||||
const result: { [key: string]: any } = await api.post('system/env', value)
|
||||
if (result.success) {
|
||||
return true
|
||||
} else {
|
||||
$toast.error(`设置保存失败:${result?.message}!`)
|
||||
return false
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
@@ -182,27 +192,36 @@ async function saveBasicSettings() {
|
||||
if (await saveSystemSetting(SystemSettings.value.Basic)) {
|
||||
$toast.success('基础设置保存成功')
|
||||
await reloadSystem()
|
||||
} else {
|
||||
$toast.error('基础设置保存失败!')
|
||||
}
|
||||
}
|
||||
|
||||
// 高级设置变化,等待保存
|
||||
// 保存高级设置
|
||||
async function saveAdvancedSettings() {
|
||||
cleanEmptyFields(SystemSettings.value.Advanced, ['LOG_FILE_FORMAT'])
|
||||
|
||||
if (await saveSystemSetting(SystemSettings.value.Advanced)) {
|
||||
advancedDialog.value = false
|
||||
$toast.success('高级设置保存成功')
|
||||
await reloadSystem()
|
||||
} else {
|
||||
$toast.error('高级设置保存失败!')
|
||||
}
|
||||
}
|
||||
|
||||
// 当字段为空时,将其设置为 null 提交,以便后端恢复为默认值
|
||||
function cleanEmptyFields(settings: any, fields: string[]) {
|
||||
fields.forEach(field => {
|
||||
if (settings[field]?.trim?.() === '') {
|
||||
settings[field] = null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 快捷复制到剪贴板
|
||||
function copyValue(value: string) {
|
||||
async function copyValue(value: string) {
|
||||
try {
|
||||
copyToClipboard(value)
|
||||
$toast.success('已复制到剪贴板')
|
||||
let success
|
||||
success = copyToClipboard(value)
|
||||
if (await success) $toast.success('已复制到剪贴板!')
|
||||
else $toast.error(`复制失败:可能是浏览器不支持或被用户阻止!`)
|
||||
} catch (error) {
|
||||
$toast.error('复制失败!')
|
||||
console.log(error)
|
||||
@@ -235,6 +254,15 @@ const pipMirrorsItems = [
|
||||
'https://mirrors.bfsu.edu.cn/pypi/web/simple', // 北京外国语大学
|
||||
]
|
||||
|
||||
// 日志等级
|
||||
const logLevelItems = [
|
||||
{ title: 'DEBUG - 调试 ', value: 'DEBUG' },
|
||||
{ title: 'INFO - 信息 ', value: 'INFO' },
|
||||
{ title: 'WARNING - 警告 ', value: 'WARNING' },
|
||||
{ title: 'ERROR - 错误 ', value: 'ERROR' },
|
||||
{ title: 'CRITICAL - 严重 ', value: 'CRITICAL' },
|
||||
]
|
||||
|
||||
// 创建随机字符串
|
||||
function createRandomString() {
|
||||
const charset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_'
|
||||
@@ -399,7 +427,14 @@ onDeactivated(() => {
|
||||
<div class="d-flex flex-wrap gap-4 mt-4">
|
||||
<VBtn type="submit" @click="saveBasicSettings"> 保存 </VBtn>
|
||||
<VSpacer />
|
||||
<VBtn color="warning" @click="advancedDialog = true" append-icon="mdi-dots-horizontal"> 高级设置 </VBtn>
|
||||
<VBtn
|
||||
color="error"
|
||||
@click="advancedDialog = true"
|
||||
prepend-icon="mdi-cog"
|
||||
append-icon="mdi-dots-horizontal"
|
||||
>
|
||||
高级设置
|
||||
</VBtn>
|
||||
</div>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
@@ -525,6 +560,9 @@ onDeactivated(() => {
|
||||
<VTab value="network">
|
||||
<div>网络</div>
|
||||
</VTab>
|
||||
<VTab value="log">
|
||||
<div>日志</div>
|
||||
</VTab>
|
||||
<VTab value="dev">
|
||||
<div>实验室</div>
|
||||
</VTab>
|
||||
@@ -594,7 +632,7 @@ onDeactivated(() => {
|
||||
placeholder="api.themoviedb.org"
|
||||
hint="自定义themoviedb API域名或代理地址"
|
||||
persistent-hint
|
||||
:items="['api.themoviedb.org']"
|
||||
:items="['api.themoviedb.org', 'api.tmdb.org']"
|
||||
:rules="[(v: string) => !!v || '请输入TMDB API域名']"
|
||||
/>
|
||||
</VCol>
|
||||
@@ -696,18 +734,64 @@ onDeactivated(() => {
|
||||
</VRow>
|
||||
</div>
|
||||
</VWindowItem>
|
||||
|
||||
<VWindowItem value="dev">
|
||||
<VWindowItem value="log">
|
||||
<div>
|
||||
<VRow>
|
||||
<VCol cols="12" md="6">
|
||||
<VSwitch
|
||||
v-model="SystemSettings.Advanced.DEBUG"
|
||||
label="DEBUG日志"
|
||||
hint="显示DEBUG级别日志,方便排查问题"
|
||||
label="调试模式"
|
||||
hint="启用调试模式后,日志将以DEBUG级别记录,以便排查问题"
|
||||
persistent-hint
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="6">
|
||||
<VSelect
|
||||
v-if="!SystemSettings.Advanced.DEBUG"
|
||||
v-model="SystemSettings.Advanced.LOG_LEVEL"
|
||||
label="日志等级"
|
||||
hint="设置日志记录的级别,用于控制日志输出量"
|
||||
persistent-hint
|
||||
:items="logLevelItems"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="6">
|
||||
<VTextField
|
||||
v-model="SystemSettings.Advanced.LOG_MAX_FILE_SIZE"
|
||||
label="日志文件最大容量(MB)"
|
||||
hint="限制单个日志文件的最大容量,超出后将自动分割日志"
|
||||
persistent-hint
|
||||
min="1"
|
||||
type="number"
|
||||
suffix="MB"
|
||||
:rules="[(v: any) => v === 0 || !!v || '日志文件最大大小', (v: any) => v >= 1 || '日志文件最大容量必须大于等于1']"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="6">
|
||||
<VTextField
|
||||
v-model="SystemSettings.Advanced.LOG_BACKUP_COUNT"
|
||||
label="日志文件最大备份数量"
|
||||
hint="设置每个模块日志文件的最大备份数量,超过后将覆盖旧日志"
|
||||
persistent-hint
|
||||
min="1"
|
||||
type="number"
|
||||
:rules="[(v: any) => v === 0 || !!v || '请输入日志文件最大备份数量', (v: any) => v >= 1 || '日志文件最大备份数量必须大于等于1']"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12">
|
||||
<VTextField
|
||||
v-model="SystemSettings.Advanced.LOG_FILE_FORMAT"
|
||||
label="日志文件格式"
|
||||
hint="设置日志文件的输出格式,用于自定义日志的显示内容"
|
||||
persistent-hint
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</div>
|
||||
</VWindowItem>
|
||||
<VWindowItem value="dev">
|
||||
<div>
|
||||
<VRow>
|
||||
<VCol cols="12" md="6">
|
||||
<VSwitch
|
||||
v-model="SystemSettings.Advanced.PLUGIN_AUTO_RELOAD"
|
||||
@@ -716,6 +800,22 @@ onDeactivated(() => {
|
||||
persistent-hint
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="6">
|
||||
<VSwitch
|
||||
v-model="SystemSettings.Advanced.ENCODING_DETECTION_PERFORMANCE_MODE"
|
||||
label="编码探测性能模式"
|
||||
hint="优先提升探测效率,但可能降低编码探测的准确性"
|
||||
persistent-hint
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="6">
|
||||
<VSwitch
|
||||
v-model="SystemSettings.Advanced.TOKENIZED_SEARCH"
|
||||
label="分词搜索"
|
||||
hint="提升整理历史记录搜索精度,但可能增加性能开销和意外结果"
|
||||
persistent-hint
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</div>
|
||||
</VWindowItem>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import draggable from 'vuedraggable'
|
||||
import { VPullToRefresh } from 'vuetify/labs/VPullToRefresh'
|
||||
import api from '@/api'
|
||||
import type { Subscribe } from '@/api/types'
|
||||
@@ -31,11 +32,74 @@ const subscribeEditDialog = ref(false)
|
||||
// 历史记录弹窗
|
||||
const historyDialog = ref(false)
|
||||
|
||||
// 订阅顺序配置
|
||||
const orderConfig = ref<{ id: number }[]>([])
|
||||
|
||||
// 显示的订阅列表
|
||||
const displayList = ref<Subscribe[]>([])
|
||||
|
||||
// 监听dataList变化,同步更新displayList
|
||||
watch(dataList, () => {
|
||||
// 从Vuex Store中获取用户信息
|
||||
const superUser = store.state.auth.superUser
|
||||
const userName = store.state.auth.userName
|
||||
if (superUser) displayList.value = dataList.value.filter(data => data.type === props.type)
|
||||
else displayList.value = dataList.value.filter(data => data.type === props.type && data.username === userName)
|
||||
})
|
||||
|
||||
// 加载顺序
|
||||
async function loadSubscribeOrderConfig() {
|
||||
// 顺序配置
|
||||
const local_order = localStorage.getItem('MP_SUBSCRIBE_ORDER')
|
||||
if (local_order) {
|
||||
orderConfig.value = JSON.parse(local_order)
|
||||
} else {
|
||||
const response2 = await api.get('/user/config/SubscribeOrder')
|
||||
if (response2 && response2.data && response2.data.value) {
|
||||
orderConfig.value = response2.data.value
|
||||
localStorage.setItem('MP_SUBSCRIBE_ORDER', JSON.stringify(orderConfig.value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按order的顺序排序
|
||||
function sortSubscribeOrder() {
|
||||
if (!orderConfig.value) {
|
||||
return
|
||||
}
|
||||
if (dataList.value.length === 0) {
|
||||
return
|
||||
}
|
||||
dataList.value.sort((a, b) => {
|
||||
const aIndex = orderConfig.value.findIndex((item: { id: number }) => item.id === a.id)
|
||||
const bIndex = orderConfig.value.findIndex((item: { id: number }) => item.id === b.id)
|
||||
return (aIndex === -1 ? 999 : aIndex) - (bIndex === -1 ? 999 : bIndex)
|
||||
})
|
||||
}
|
||||
|
||||
// 保存顺序设置
|
||||
async function saveSubscribeOrder() {
|
||||
// 顺序配置
|
||||
const orderObj = displayList.value.map(item => ({ id: item.id }))
|
||||
orderConfig.value = orderObj
|
||||
const orderString = JSON.stringify(orderObj)
|
||||
localStorage.setItem('MP_SUBSCRIBE_ORDER', orderString)
|
||||
|
||||
// 保存到服务端
|
||||
try {
|
||||
await api.post('/user/config/SubscribeOrder', orderObj)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取订阅列表数据
|
||||
async function fetchData() {
|
||||
try {
|
||||
loading.value = true
|
||||
dataList.value = await api.get('subscribe/')
|
||||
// 排序
|
||||
sortSubscribeOrder()
|
||||
loading.value = false
|
||||
isRefreshed.value = true
|
||||
} catch (error) {
|
||||
@@ -52,16 +116,8 @@ async function onRefresh({ done }: { done: any }) {
|
||||
done('ok')
|
||||
}
|
||||
|
||||
// 过滤数据,管理员用户显示全部,非管理员只显示自己的订阅
|
||||
const filteredDataList = computed(() => {
|
||||
// 从Vuex Store中获取用户信息
|
||||
const superUser = store.state.auth.superUser
|
||||
const userName = store.state.auth.userName
|
||||
if (superUser) return dataList.value.filter(data => data.type === props.type)
|
||||
else return dataList.value.filter(data => data.type === props.type && data.username === userName)
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await loadSubscribeOrderConfig()
|
||||
await fetchData()
|
||||
if (props.subid) {
|
||||
// 找到这个订阅
|
||||
@@ -75,7 +131,7 @@ onMounted(async () => {
|
||||
|
||||
onActivated(async () => {
|
||||
if (!loading.value) {
|
||||
fetchData()
|
||||
await fetchData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -83,17 +139,21 @@ onActivated(async () => {
|
||||
<template>
|
||||
<LoadingBanner v-if="!isRefreshed" class="mt-12" />
|
||||
<VPullToRefresh v-model="loading" @load="onRefresh">
|
||||
<div v-if="filteredDataList.length > 0" class="mx-3 grid gap-4 grid-subscribe-card p-1">
|
||||
<SubscribeCard
|
||||
v-for="data in filteredDataList"
|
||||
:key="data.id"
|
||||
:media="data"
|
||||
@remove="fetchData"
|
||||
@save="fetchData"
|
||||
/>
|
||||
</div>
|
||||
<draggable
|
||||
v-if="displayList.length > 0"
|
||||
v-model="displayList"
|
||||
@end="saveSubscribeOrder"
|
||||
handle=".cursor-move"
|
||||
item-key="id"
|
||||
tag="div"
|
||||
:component-data="{ class: 'mx-3 grid gap-4 grid-subscribe-card p-1' }"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<SubscribeCard :key="element.id" :media="element" @remove="fetchData" @save="fetchData" />
|
||||
</template>
|
||||
</draggable>
|
||||
<NoDataFound
|
||||
v-if="filteredDataList.length === 0 && isRefreshed"
|
||||
v-if="displayList.length === 0 && isRefreshed"
|
||||
error-code="404"
|
||||
error-title="没有订阅"
|
||||
error-description="请通过搜索添加电影、电视剧订阅。"
|
||||
|
||||
@@ -300,7 +300,7 @@ onMounted(() => {
|
||||
<template #default="hover">
|
||||
<VListItem prepend-icon="mdi-history" link v-bind="hover.props" @click="searchHistory">
|
||||
<VListItemTitle class="break-words whitespace-break-spaces">
|
||||
搜索 <span class="font-bold">{{ searchWord }}</span> 相关的【历史记录】 ...
|
||||
搜索 <span class="font-bold">{{ searchWord }}</span> 相关的【整理记录】 ...
|
||||
</VListItemTitle>
|
||||
<template #append>
|
||||
<VIcon v-if="hover.isHovering" icon="ri-corner-down-left-line" />
|
||||
|
||||
@@ -250,13 +250,13 @@ watch(
|
||||
<VRow>
|
||||
<VCol cols="12">
|
||||
<VCard title="个人信息">
|
||||
<VCardText class="d-flex">
|
||||
<VCardText class="flex">
|
||||
<!-- 👉 Avatar -->
|
||||
<VAvatar rounded="lg" size="100" class="me-6" :image="currentAvatar" />
|
||||
|
||||
<!-- 👉 Upload Photo -->
|
||||
<form class="d-flex flex-column justify-center gap-5">
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<form class="flex flex-col justify-center gap-5">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<VBtn color="primary" @click="refInputEl?.click()">
|
||||
<VIcon icon="mdi-cloud-upload-outline" />
|
||||
<span v-if="display.mdAndUp.value" class="ms-2">上传新头像</span>
|
||||
|
||||
39
yarn.lock
39
yarn.lock
@@ -2269,6 +2269,21 @@
|
||||
"@volar/language-core" "2.2.0-alpha.5"
|
||||
path-browserify "^1.0.1"
|
||||
|
||||
"@vue-js-cron/core@5.4.1":
|
||||
version "5.4.1"
|
||||
resolved "https://registry.yarnpkg.com/@vue-js-cron/core/-/core-5.4.1.tgz#5c9b4a3b65f215f5f6767b56f2bc7e7d87e32834"
|
||||
integrity sha512-Z2dPQWyBlsCvoFAZMSx+CWqWRXyf09AabvG/jkEvHx9hbydhHDQApNhQHKVjbMMbFzu4HWRmjRjrx3Cq6bCOOw==
|
||||
dependencies:
|
||||
mustache "^4.2.0"
|
||||
|
||||
"@vue-js-cron/vuetify@^5.0.9":
|
||||
version "5.0.9"
|
||||
resolved "https://registry.yarnpkg.com/@vue-js-cron/vuetify/-/vuetify-5.0.9.tgz#e78bf266fe958332aae931081a59423712d1e164"
|
||||
integrity sha512-/j/fBPiWAnc8ZUWILBCGlUwowhksOZGqID8gN1KyCUCUnovwR3aNE5YWbYAuV3P8RxelJstCdgvlBFl5hleu9A==
|
||||
dependencies:
|
||||
"@vue-js-cron/core" "5.4.1"
|
||||
vuetify "^3.4.0"
|
||||
|
||||
"@vue-macros/common@1.10.2":
|
||||
version "1.10.2"
|
||||
resolved "https://registry.yarnpkg.com/@vue-macros/common/-/common-1.10.2.tgz#4c886082cfd94de2fb16e8e1df99d141873450e7"
|
||||
@@ -3101,6 +3116,13 @@ cookie@0.6.0:
|
||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051"
|
||||
integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==
|
||||
|
||||
copy-to-clipboard@^3.3.3:
|
||||
version "3.3.3"
|
||||
resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0"
|
||||
integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==
|
||||
dependencies:
|
||||
toggle-selection "^1.0.6"
|
||||
|
||||
core-js-compat@^3.31.0, core-js-compat@^3.36.1:
|
||||
version "3.37.1"
|
||||
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.37.1.tgz#c844310c7852f4bdf49b8d339730b97e17ff09ee"
|
||||
@@ -5531,6 +5553,11 @@ muggle-string@^0.4.0:
|
||||
resolved "https://registry.yarnpkg.com/muggle-string/-/muggle-string-0.4.1.tgz#3b366bd43b32f809dc20659534dd30e7c8a0d328"
|
||||
integrity sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==
|
||||
|
||||
mustache@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64"
|
||||
integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==
|
||||
|
||||
mz@^2.7.0:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
|
||||
@@ -6612,7 +6639,6 @@ stop-iteration-iterator@^1.0.0:
|
||||
internal-slot "^1.0.4"
|
||||
|
||||
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.3:
|
||||
name string-width-cjs
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||
@@ -6686,7 +6712,6 @@ stringify-object@^3.3.0:
|
||||
is-regexp "^1.0.0"
|
||||
|
||||
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||
name strip-ansi-cjs
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||
@@ -7086,6 +7111,11 @@ to-regex-range@^5.0.1:
|
||||
dependencies:
|
||||
is-number "^7.0.0"
|
||||
|
||||
toggle-selection@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
|
||||
integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==
|
||||
|
||||
toidentifier@1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
|
||||
@@ -7603,6 +7633,11 @@ vuetify@3.6.8:
|
||||
resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.6.8.tgz#89ab0b68aa5488c7b54a04fa4a02a1b802892aaa"
|
||||
integrity sha512-j0v0iTeSVRj2ZEM9Q8HxejHxmxrQLYQSalhH82hfcraORaiDoqf1XV05N3P5ERXkKiJjJc/LfxFAUUvYSldxeg==
|
||||
|
||||
vuetify@^3.4.0:
|
||||
version "3.7.6"
|
||||
resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-3.7.6.tgz#f966dbe74666cb847d67b3e3d8c6fee75cf972d3"
|
||||
integrity sha512-lol0Va5HtMIqZfjccSD5DLv5v31R/asJXzc6s7ULy51PHr1DjXxWylZejhq0kVpMGW64MiV1FmA/p8eYQfOWfQ==
|
||||
|
||||
vuex-persistedstate@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/vuex-persistedstate/-/vuex-persistedstate-4.1.0.tgz#127165f85f5b4534fb3170a5d3a8be9811bd2a53"
|
||||
|
||||
Reference in New Issue
Block a user