Compare commits

...

35 Commits

Author SHA1 Message Date
jxxghp
cdbcef5232 release 2024-04-25 13:52:12 +08:00
jxxghp
d5d6bfdc56 feat:插件详情支持动态API调用 2024-04-25 13:30:25 +08:00
jxxghp
75ae7f0c15 Merge pull request #115 from hotlcc/develop-20240425-页面优化 2024-04-25 12:07:22 +08:00
Allen
6931451f18 媒体详情页面搜索资源按钮当下拉选项只有一个时不触发下拉框直接搜索 2024-04-25 11:25:52 +08:00
jxxghp
f5625e1354 fix bug 2024-04-25 10:26:20 +08:00
jxxghp
d1be4a30b6 feat:前端版本号显示 2024-04-25 10:19:09 +08:00
jxxghp
5c13362db2 fix fullscreen 2024-04-25 09:48:12 +08:00
jxxghp
6c71dce80c 历史记录可排序 2024-04-25 08:51:02 +08:00
jxxghp
790c397951 fix ui 2024-04-25 08:44:36 +08:00
jxxghp
e28e74b874 Merge pull request #113 from hotlcc/develop-20240424-1-插件搜索框宽度优化 2024-04-24 21:42:10 +08:00
Allen
b99ea22d89 插件搜索弹出框小屏下全屏 2024-04-24 21:28:15 +08:00
jxxghp
8938195c5d fix 2024-04-24 18:21:08 +08:00
jxxghp
887b4a7862 fix ui 2024-04-24 18:02:30 +08:00
jxxghp
7c9c39fa0e 更新 package.json 2024-04-24 17:41:07 +08:00
jxxghp
3b800753ec Merge pull request #112 from hotlcc/develop-20240424-VDialog优化 2024-04-24 17:40:28 +08:00
jxxghp
647119052c Merge pull request #111 from dh336699/hotfix-history-scofield 2024-04-24 17:38:07 +08:00
Allen
e9ce6bbd4e 消息中心弹窗小屏时全屏 2024-04-24 17:34:37 +08:00
Allen
1fee27f78e 系统健康检查弹窗小屏时全屏 2024-04-24 17:34:16 +08:00
Allen
e7a334861d 规则测试弹窗小屏时全屏 2024-04-24 17:33:07 +08:00
Allen
267ae3436d 实时日志弹窗小屏时全屏 2024-04-24 17:32:48 +08:00
hao.dai
60ff9f1891 fix: 1.登录双重认证增加防抖 2.历史记录搜索框增加防抖 3.开启项目vscode配置文件 2024-04-24 17:29:54 +08:00
Allen
f83efd23df 网络测试弹窗小屏下全屏 2024-04-24 17:29:24 +08:00
Allen
db60f02745 名称测试弹窗小屏下全屏 2024-04-24 17:28:30 +08:00
Allen
3e109bd27c dashborad配置弹窗小屏下全屏 2024-04-24 17:25:50 +08:00
Allen
c4ccf6e3fa 订阅编辑弹窗小屏时全屏 2024-04-24 17:16:27 +08:00
Allen
fb1a246e4a 订阅历史弹窗小屏时全屏 2024-04-24 17:15:20 +08:00
Allen
a418b03c06 文件整理弹窗小屏时全屏 2024-04-24 17:13:32 +08:00
Allen
e9fee000ca 插件数据页面小屏下全屏 2024-04-24 17:09:26 +08:00
Allen
71c13e0653 插件配置弹窗小屏下全屏 2024-04-24 17:08:46 +08:00
Allen
32d7f933f8 站点编辑弹窗小屏下全屏 2024-04-24 17:07:15 +08:00
Allen
f28dd810ce 站点资源弹窗小屏下全屏 2024-04-24 17:05:46 +08:00
Allen
aaedd88ca7 站点更新弹窗小屏下全屏展示 2024-04-24 17:04:04 +08:00
Allen
00dee40917 站点更新弹窗添加关闭按钮 2024-04-24 16:49:50 +08:00
hao.dai
019248b605 Merge remote-tracking branch 'upstream/main'
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2024-04-24 15:43:56 +08:00
hao.dai
826f37bcc4 fix: 账号设置warning问题 2024-04-24 15:43:11 +08:00
20 changed files with 960 additions and 1555 deletions

View File

@@ -39,6 +39,7 @@ jobs:
run: | run: |
yarn yarn
yarn build yarn build
echo "$frontend_version" > dist/version.txt
zip -r dist.zip dist zip -r dist.zip dist
- name: Generate Release - name: Generate Release

View File

@@ -6,9 +6,6 @@
"[javascript]": { "[javascript]": {
"editor.formatOnSave": false "editor.formatOnSave": false
}, },
"[typescript]": {
"editor.formatOnSave": false
},
"[markdown]": { "[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint" "editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
}, },
@@ -25,7 +22,7 @@
}, },
// Vue // Vue
"[vue]": { "[vue]": {
"editor.formatOnSave": false "editor.formatOnSave": true
}, },
// Extension: Volar // Extension: Volar
"volar.preview.port": 3000, "volar.preview.port": 3000,
@@ -34,6 +31,10 @@
"source.fixAll.eslint": "explicit", "source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit" "source.fixAll.stylelint": "explicit"
}, },
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"eslint.alwaysShowStatus": true, "eslint.alwaysShowStatus": true,
"eslint.format.enable": true, "eslint.format.enable": true,
// Extension: Stylelint // Extension: Stylelint

View File

@@ -1,6 +1,6 @@
{ {
"name": "moviepilot", "name": "moviepilot",
"version": "1.8.3-1", "version": "1.8.4",
"private": true, "private": true,
"bin": "dist/service.js", "bin": "dist/service.js",
"scripts": { "scripts": {

View File

@@ -1,4 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
// 定义输入参数
const props = defineProps({
// 是否显示
innerClass: String,
})
// 定义触发的自定义事件 // 定义触发的自定义事件
const emit = defineEmits(['click', 'update:modelValue']) const emit = defineEmits(['click', 'update:modelValue'])
// 按钮点击 // 按钮点击
@@ -9,10 +14,7 @@ function onClick() {
</script> </script>
<template> <template>
<IconBtn <IconBtn :class="props.innerClass ? props.innerClass : 'absolute right-3 top-3'" @click.stop="onClick">
class="absolute right-3 top-3"
@click.stop="onClick"
>
<VIcon icon="mdi-close" /> <VIcon icon="mdi-close" />
</IconBtn> </IconBtn>
</template> </template>

View File

@@ -11,6 +11,10 @@ import { isNullOrEmptyObject } from '@core/utils'
import noImage from '@images/logos/plugin.png' import noImage from '@images/logos/plugin.png'
import { getDominantColor } from '@/@core/utils/image' import { getDominantColor } from '@/@core/utils/image'
import store from '@/store' import store from '@/store'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 输入参数 // 输入参数
const props = defineProps({ const props = defineProps({
@@ -58,7 +62,7 @@ const pluginInfoDialog = ref(false)
const progressText = ref('正在更新插件...') const progressText = ref('正在更新插件...')
// 插件数据页面配置项 // 插件数据页面配置项
let pluginPageItems = reactive([]) let pluginPageItems = ref([])
// 图片是否加载完成 // 图片是否加载完成
const isImageLoaded = ref(false) const isImageLoaded = ref(false)
@@ -70,12 +74,15 @@ const imageLoadError = ref(false)
const releaseDialog = ref(false) const releaseDialog = ref(false)
// 监听动作标识如为true则打开详情 // 监听动作标识如为true则打开详情
watch(() => props.action, (newAction, oldAction) => { watch(
if (newAction && !oldAction) { () => props.action,
openPluginDetail() (newAction, oldAction) => {
emit('actionDone') if (newAction && !oldAction) {
} openPluginDetail()
}) emit('actionDone')
}
},
)
// 图片加载完成 // 图片加载完成
async function imageLoaded() { async function imageLoaded() {
@@ -90,7 +97,7 @@ function showUpdateHistory() {
// 检查当前版本是否有更新日志 // 检查当前版本是否有更新日志
if (isNullOrEmptyObject(props.plugin?.history)) { if (isNullOrEmptyObject(props.plugin?.history)) {
updatePlugin() updatePlugin()
} else{ } else {
releaseDialog.value = true releaseDialog.value = true
} }
} }
@@ -110,11 +117,10 @@ async function uninstallPlugin() {
}, },
}) })
if (!isConfirmed) if (!isConfirmed) return
return
try { try {
// 显示等待提示框 // 显示等待提示框
progressDialog.value = true progressDialog.value = true
progressText.value = `正在卸载 ${props.plugin?.plugin_name} ...` progressText.value = `正在卸载 ${props.plugin?.plugin_name} ...`
const result: { [key: string]: any } = await api.delete(`plugin/${props.plugin?.id}`) const result: { [key: string]: any } = await api.delete(`plugin/${props.plugin?.id}`)
@@ -125,12 +131,10 @@ async function uninstallPlugin() {
// 通知父组件刷新 // 通知父组件刷新
emit('remove') emit('remove')
} } else {
else {
$toast.error(`插件 ${props.plugin?.plugin_name} 卸载失败:${result.message}}`) $toast.error(`插件 ${props.plugin?.plugin_name} 卸载失败:${result.message}}`)
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -141,11 +145,9 @@ async function loadPluginForm() {
const result: { [key: string]: any } = await api.get(`plugin/form/${props.plugin?.id}`) const result: { [key: string]: any } = await api.get(`plugin/form/${props.plugin?.id}`)
if (result) { if (result) {
pluginFormItems = result.conf pluginFormItems = result.conf
if (result.model) if (result.model) pluginConfigForm.value = result.model
pluginConfigForm.value = result.model
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -154,10 +156,8 @@ async function loadPluginForm() {
async function loadPluginPage() { async function loadPluginPage() {
try { try {
const result: [] = await api.get(`plugin/page/${props.plugin?.id}`) const result: [] = await api.get(`plugin/page/${props.plugin?.id}`)
if (result) if (result) pluginPageItems.value = result
pluginPageItems = result } catch (error) {
}
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -166,10 +166,8 @@ async function loadPluginPage() {
async function loadPluginConf() { async function loadPluginConf() {
try { try {
const result: { [key: string]: any } = await api.get(`plugin/${props.plugin?.id}`) const result: { [key: string]: any } = await api.get(`plugin/${props.plugin?.id}`)
if (!isNullOrEmptyObject(result)) if (!isNullOrEmptyObject(result)) pluginConfigForm.value = result
pluginConfigForm.value = result } catch (error) {
}
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -187,13 +185,11 @@ async function savePluginConf() {
$toast.success(`插件 ${props.plugin?.plugin_name} 配置已保存`) $toast.success(`插件 ${props.plugin?.plugin_name} 配置已保存`)
// 通知父组件刷新 // 通知父组件刷新
emit('save') emit('save')
} } else {
else {
progressDialog.value = false progressDialog.value = false
$toast.error(`插件 ${props.plugin?.plugin_name} 配置保存失败:${result.message}}`) $toast.error(`插件 ${props.plugin?.plugin_name} 配置保存失败:${result.message}}`)
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -219,8 +215,7 @@ async function showPluginConfig() {
// 计算图标路径 // 计算图标路径
const iconPath: Ref<string> = computed(() => { const iconPath: Ref<string> = computed(() => {
if (imageLoadError.value) if (imageLoadError.value) return noImage
return noImage
// 如果是网络图片则使用代理后返回 // 如果是网络图片则使用代理后返回
if (props.plugin?.plugin_icon?.startsWith('http')) if (props.plugin?.plugin_icon?.startsWith('http'))
return `${import.meta.env.VITE_API_BASE_URL}system/img/1?imgurl=${encodeURIComponent(props.plugin?.plugin_icon)}` return `${import.meta.env.VITE_API_BASE_URL}system/img/1?imgurl=${encodeURIComponent(props.plugin?.plugin_icon)}`
@@ -243,8 +238,7 @@ async function resetPlugin() {
}, },
}) })
if (!isConfirmed) if (!isConfirmed) return
return
try { try {
const result: { [key: string]: any } = await api.get(`plugin/reset/${props.plugin?.id}`) const result: { [key: string]: any } = await api.get(`plugin/reset/${props.plugin?.id}`)
@@ -252,12 +246,10 @@ async function resetPlugin() {
$toast.success(`插件 ${props.plugin?.plugin_name} 数据已重置`) $toast.success(`插件 ${props.plugin?.plugin_name} 数据已重置`)
// 通知父组件刷新 // 通知父组件刷新
emit('save') emit('save')
} } else {
else {
$toast.error(`插件 ${props.plugin?.plugin_name} 重置失败:${result.message}}`) $toast.error(`插件 ${props.plugin?.plugin_name} 重置失败:${result.message}}`)
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -270,15 +262,12 @@ async function updatePlugin() {
progressDialog.value = true progressDialog.value = true
progressText.value = `正在更新 ${props.plugin?.plugin_name} ...` progressText.value = `正在更新 ${props.plugin?.plugin_name} ...`
const result: { [key: string]: any } = await api.get( const result: { [key: string]: any } = await api.get(`plugin/install/${props.plugin?.id}`, {
`plugin/install/${props.plugin?.id}`, params: {
{ repo_url: props.plugin?.repo_url,
params: { force: true,
repo_url: props.plugin?.repo_url,
force: true,
},
}, },
) })
// 隐藏等待提示框 // 隐藏等待提示框
progressDialog.value = false progressDialog.value = false
@@ -288,12 +277,10 @@ async function updatePlugin() {
// 通知父组件刷新 // 通知父组件刷新
emit('save') emit('save')
} } else {
else {
$toast.error(`插件 ${props.plugin?.plugin_name} 更新失败:${result.message}`) $toast.error(`插件 ${props.plugin?.plugin_name} 更新失败:${result.message}`)
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -306,16 +293,16 @@ function visitAuthorPage() {
// 查看日志URL // 查看日志URL
function openLoggerWindow() { function openLoggerWindow() {
const token = store.state.auth.token const token = store.state.auth.token
const url = `${import.meta.env.VITE_API_BASE_URL}system/logging?token=${token}&length=-1&logfile=plugins/${props.plugin?.id?.toLowerCase()}.log` const url = `${
import.meta.env.VITE_API_BASE_URL
}system/logging?token=${token}&length=-1&logfile=plugins/${props.plugin?.id?.toLowerCase()}.log`
window.open(url, '_blank') window.open(url, '_blank')
} }
// 打开插件详情 // 打开插件详情
function openPluginDetail() { function openPluginDetail() {
if (props.plugin?.has_page) if (props.plugin?.has_page) showPluginInfo()
showPluginInfo() else showPluginConfig()
else
showPluginConfig()
} }
// 弹出菜单 // 弹出菜单
@@ -391,41 +378,26 @@ const dropdownItems = ref([
]) ])
// 监听插件状态变化 // 监听插件状态变化
watch(() => props.plugin?.has_update, (newHasUpdate, oldHasUpdate) => { watch(
const updateItemIndex = dropdownItems.value.findIndex(item => item.value === 3) () => props.plugin?.has_update,
if (updateItemIndex !== -1) (newHasUpdate, oldHasUpdate) => {
dropdownItems.value[updateItemIndex].show = newHasUpdate const updateItemIndex = dropdownItems.value.findIndex(item => item.value === 3)
}) if (updateItemIndex !== -1) dropdownItems.value[updateItemIndex].show = newHasUpdate
},
)
</script> </script>
<template> <template>
<!-- 插件卡片 --> <!-- 插件卡片 -->
<VCard <VCard v-if="isVisible" :width="props.width" :height="props.height" @click="openPluginDetail">
v-if="isVisible" <div class="relative pa-4 text-center card-cover-blurred" :style="{ background: `${backgroundColor}` }">
:width="props.width" <div v-if="props.plugin?.has_update" class="me-n3 absolute top-0 left-1">
:height="props.height" <VIcon icon="mdi-new-box" class="text-white" />
@click="openPluginDetail"
>
<div
class="relative pa-4 text-center card-cover-blurred"
:style="{ background: `${backgroundColor}` }"
>
<div
v-if="props.plugin?.has_update"
class="me-n3 absolute top-0 left-1"
>
<VIcon
icon="mdi-new-box"
class="text-white"
/>
</div> </div>
<div class="me-n3 absolute top-0 right-3"> <div class="me-n3 absolute top-0 right-3">
<IconBtn> <IconBtn>
<VIcon icon="mdi-dots-vertical" class="text-white" /> <VIcon icon="mdi-dots-vertical" class="text-white" />
<VMenu <VMenu activator="parent" close-on-content-click>
activator="parent"
close-on-content-click
>
<VList> <VList>
<VListItem <VListItem
v-for="(item, i) in dropdownItems" v-for="(item, i) in dropdownItems"
@@ -444,9 +416,7 @@ watch(() => props.plugin?.has_update, (newHasUpdate, oldHasUpdate) => {
</VMenu> </VMenu>
</IconBtn> </IconBtn>
</div> </div>
<VAvatar <VAvatar size="8rem">
size="8rem"
>
<VImg <VImg
ref="imageRef" ref="imageRef"
:src="iconPath" :src="iconPath"
@@ -465,116 +435,63 @@ watch(() => props.plugin?.has_update, (newHasUpdate, oldHasUpdate) => {
<VCardItem class="py-2"> <VCardItem class="py-2">
<VCardTitle class="flex items-center flex-row"> <VCardTitle class="flex items-center flex-row">
<VBadge v-if="props.plugin?.state" dot inline color="success" class="me-1 mb-1" /> <VBadge v-if="props.plugin?.state" dot inline color="success" class="me-1 mb-1" />
{{ props.plugin?.plugin_name }}<span class="text-sm ms-2 mt-1 text-gray-500">v{{ props.plugin?.plugin_version }}</span> {{ props.plugin?.plugin_name
}}<span class="text-sm ms-2 mt-1 text-gray-500">v{{ props.plugin?.plugin_version }}</span>
</VCardTitle> </VCardTitle>
</VCardItem> </VCardItem>
<VCardText> <VCardText>
{{ props.plugin?.plugin_desc }} {{ props.plugin?.plugin_desc }}
</VCardText> </VCardText>
</VCard> </VCard>
<!-- 插件配置页面 --> <!-- 插件配置页面 -->
<VDialog <VDialog v-model="pluginConfigDialog" scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
v-model="pluginConfigDialog" <VCard :title="`${props.plugin?.plugin_name} - 配置`" class="rounded-t">
scrollable <DialogCloseBtn v-model="pluginConfigDialog" />
max-width="60rem"
>
<VCard
:title="`${props.plugin?.plugin_name} - 配置`"
class="rounded-t"
>
<DialogCloseBtn v-model='pluginConfigDialog' />
<VCardText> <VCardText>
<FormRender <FormRender v-for="(item, index) in pluginFormItems" :key="index" :config="item" :form="pluginConfigForm" />
v-for="(item, index) in pluginFormItems"
:key="index"
:config="item"
:form="pluginConfigForm"
/>
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VBtn v-if="pluginPageItems.length > 0" @click="showPluginInfo"> <VBtn v-if="pluginPageItems.length > 0" @click="showPluginInfo"> 查看数据 </VBtn>
查看数据
</VBtn>
<VSpacer /> <VSpacer />
<VBtn <VBtn variant="tonal" @click="savePluginConf"> 保存 </VBtn>
variant="tonal"
@click="savePluginConf"
>
保存
</VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 插件数据页面 --> <!-- 插件数据页面 -->
<VDialog <VDialog v-model="pluginInfoDialog" scrollable max-width="80rem" :fullscreen="!display.mdAndUp.value">
v-model="pluginInfoDialog" <VCard :title="`${props.plugin?.plugin_name}`" class="rounded-t">
scrollable <DialogCloseBtn v-model="pluginInfoDialog" />
max-width="80rem"
>
<VCard
:title="`${props.plugin?.plugin_name}`"
class="rounded-t"
>
<DialogCloseBtn v-model='pluginInfoDialog' />
<VCardText> <VCardText>
<PageRender <PageRender @action="loadPluginPage" v-for="(item, index) in pluginPageItems" :key="index" :config="item" />
v-for="(item, index) in pluginPageItems"
:key="index"
:config="item"
/>
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VBtn <VBtn @click="showPluginConfig"> 配置 </VBtn>
@click="showPluginConfig"
>
配置
</VBtn>
<VSpacer /> <VSpacer />
<VBtn <VBtn variant="tonal" @click="pluginInfoDialog = false"> 关闭 </VBtn>
variant="tonal"
@click="pluginInfoDialog = false"
>
关闭
</VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 更新插件进度框 --> <!-- 更新插件进度框 -->
<VDialog <VDialog v-model="progressDialog" :scrim="false" width="25rem">
v-model="progressDialog" <VCard color="primary">
:scrim="false"
width="25rem"
>
<VCard
color="primary"
>
<VCardText class="text-center"> <VCardText class="text-center">
{{ progressText }} {{ progressText }}
<VProgressLinear <VProgressLinear indeterminate color="white" class="mb-0 mt-1" />
indeterminate
color="white"
class="mb-0 mt-1"
/>
</VCardText> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 更新日志 --> <!-- 更新日志 -->
<VDialog <VDialog v-if="releaseDialog" v-model="releaseDialog" width="600" scrollable>
v-if="releaseDialog"
v-model="releaseDialog"
width="600"
scrollable
>
<VCard> <VCard>
<DialogCloseBtn @click="releaseDialog = false" /> <DialogCloseBtn @click="releaseDialog = false" />
<VCardTitle>{{ props.plugin?.plugin_name }} 更新说明</VCardTitle> <VCardTitle>{{ props.plugin?.plugin_name }} 更新说明</VCardTitle>
<VersionHistory :history="props.plugin?.history" /> <VersionHistory :history="props.plugin?.history" />
<VCardText> <VCardText>
<VBtn <VBtn @click="updatePlugin" block>
@click="updatePlugin"
block
>
<template #prepend> <template #prepend>
<VIcon icon="mdi-arrow-up-circle-outline" /> <VIcon icon="mdi-arrow-up-circle-outline" />
</template> </template>
@@ -592,7 +509,7 @@ watch(() => props.plugin?.has_update, (newHasUpdate, oldHasUpdate) => {
-webkit-backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
backdrop-filter: blur(2px); backdrop-filter: blur(2px);
background: rgba(29, 39, 59, 48%); background: rgba(29, 39, 59, 48%);
content: ""; content: '';
inset: 0; inset: 0;
} }
</style> </style>

View File

@@ -8,6 +8,10 @@ import api from '@/api'
import type { Site, SiteStatistic } from '@/api/types' import type { Site, SiteStatistic } from '@/api/types'
import ExistIcon from '@core/components/ExistIcon.vue' import ExistIcon from '@core/components/ExistIcon.vue'
import { isNullOrEmptyObject } from '@/@core/utils' import { isNullOrEmptyObject } from '@/@core/utils'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 输入参数 // 输入参数
const cardProps = defineProps({ const cardProps = defineProps({
@@ -66,8 +70,7 @@ const siteStats = ref<SiteStatistic>({})
async function getSiteIcon() { async function getSiteIcon() {
try { try {
siteIcon.value = (await api.get(`site/icon/${cardProps.site?.id}`)).data.icon siteIcon.value = (await api.get(`site/icon/${cardProps.site?.id}`)).data.icon
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -79,17 +82,14 @@ async function testSite() {
testButtonDisable.value = true testButtonDisable.value = true
const result: { [key: string]: any } = await api.get(`site/test/${cardProps.site?.id}`) const result: { [key: string]: any } = await api.get(`site/test/${cardProps.site?.id}`)
if (result.success) if (result.success) $toast.success(`${cardProps.site?.name} 连通性测试成功,可正常使用!`)
$toast.success(`${cardProps.site?.name} 连通性测试成功,可正常使用!`) else $toast.error(`${cardProps.site?.name} 连通性测试失败:${result.message}`)
else
$toast.error(`${cardProps.site?.name} 连通性测试失败:${result.message}`)
testButtonText.value = '测试' testButtonText.value = '测试'
testButtonDisable.value = false testButtonDisable.value = false
getSiteStats() getSiteStats()
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -97,9 +97,8 @@ async function testSite() {
// 查询站点使用统计 // 查询站点使用统计
async function getSiteStats() { async function getSiteStats() {
try { try {
siteStats.value = (await api.get(`site/statistic/${cardProps.site?.domain}`)) siteStats.value = await api.get(`site/statistic/${cardProps.site?.domain}`)
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -117,8 +116,7 @@ async function handleResourceBrowse() {
// 调用API更新站点Cookie UA // 调用API更新站点Cookie UA
async function updateSiteCookie() { async function updateSiteCookie() {
try { try {
if (!userPwForm.value.username || !userPwForm.value.password) if (!userPwForm.value.username || !userPwForm.value.password) return
return
// 更新按钮状态 // 更新按钮状态
siteCookieDialog.value = false siteCookieDialog.value = false
@@ -127,26 +125,20 @@ async function updateSiteCookie() {
progressDialog.value = true progressDialog.value = true
progressText.value = `正在更新 ${cardProps.site?.name} Cookie & UA ...` progressText.value = `正在更新 ${cardProps.site?.name} Cookie & UA ...`
const result: { [key: string]: any } = await api.get( const result: { [key: string]: any } = await api.get(`site/cookie/${cardProps.site?.id}`, {
`site/cookie/${cardProps.site?.id}`, params: {
{ username: userPwForm.value.username,
params: { password: userPwForm.value.password,
username: userPwForm.value.username, code: userPwForm.value.code,
password: userPwForm.value.password,
code: userPwForm.value.code,
},
}, },
) })
if (result.success) if (result.success) $toast.success(`${cardProps.site?.name} 更新Cookie & UA 成功!`)
$toast.success(`${cardProps.site?.name} 更新Cookie & UA 成功!`) else $toast.error(`${cardProps.site?.name} 更新失败:${result.message}`)
else
$toast.error(`${cardProps.site?.name} 更新失败:${result.message}`)
progressDialog.value = false progressDialog.value = false
updateButtonDisable.value = false updateButtonDisable.value = false
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -158,25 +150,21 @@ function openSitePage() {
// 根据站点状态显示不同的状态图标 // 根据站点状态显示不同的状态图标
const statColor = computed(() => { const statColor = computed(() => {
if (isNullOrEmptyObject(siteStats.value)){ if (isNullOrEmptyObject(siteStats.value)) {
return 'secondary' return 'secondary'
} }
if (siteStats.value?.lst_state == 1){ if (siteStats.value?.lst_state == 1) {
return 'error' return 'error'
} } else if (siteStats.value?.lst_state == 0) {
else if (siteStats.value?.lst_state == 0){ if (!siteStats.value?.seconds) return 'secondary'
if (!siteStats.value?.seconds) if (siteStats.value?.seconds >= 5) return 'warning'
return 'secondary'
if (siteStats.value?.seconds >= 5)
return 'warning'
return 'success' return 'success'
} }
}) })
// 监听resourceDialog如果为false则重新查询站点使用统计 // 监听resourceDialog如果为false则重新查询站点使用统计
watch(resourceDialog, (value) => { watch(resourceDialog, value => {
if (!value) if (!value) getSiteStats()
getSiteStats()
}) })
// 装载时查询站点图标 // 装载时查询站点图标
@@ -195,11 +183,7 @@ onMounted(() => {
@click="siteEditDialog = true" @click="siteEditDialog = true"
> >
<template #image> <template #image>
<VAvatar <VAvatar class="absolute right-2 bottom-2 rounded" variant="flat" rounded="0">
class="absolute right-2 bottom-2 rounded"
variant="flat"
rounded="0"
>
<VImg :src="siteIcon" /> <VImg :src="siteIcon" />
</VAvatar> </VAvatar>
</template> </template>
@@ -216,83 +200,41 @@ onMounted(() => {
<StatIcon v-if="cardProps.site?.is_active" :color="statColor" /> <StatIcon v-if="cardProps.site?.is_active" :color="statColor" />
<VCardText class="py-2"> <VCardText class="py-2">
<VTooltip <VTooltip v-if="cardProps.site?.render === 1" text="浏览器仿真">
v-if="cardProps.site?.render === 1"
text="浏览器仿真"
>
<template #activator="{ props }"> <template #activator="{ props }">
<VIcon <VIcon color="primary" class="me-2" v-bind="props" icon="mdi-apple-safari" />
color="primary"
class="me-2"
v-bind="props"
icon="mdi-apple-safari"
/>
</template> </template>
</VTooltip> </VTooltip>
<VTooltip <VTooltip v-if="cardProps.site?.proxy === 1" text="代理">
v-if="cardProps.site?.proxy === 1"
text="代理"
>
<template #activator="{ props }"> <template #activator="{ props }">
<VIcon <VIcon color="primary" class="me-2" v-bind="props" icon="mdi-network-outline" />
color="primary"
class="me-2"
v-bind="props"
icon="mdi-network-outline"
/>
</template> </template>
</VTooltip> </VTooltip>
<VTooltip <VTooltip v-if="cardProps.site?.limit_interval" text="流控">
v-if="cardProps.site?.limit_interval"
text="流控"
>
<template #activator="{ props }"> <template #activator="{ props }">
<VIcon <VIcon color="primary" class="me-2" v-bind="props" icon="mdi-speedometer" />
color="primary"
class="me-2"
v-bind="props"
icon="mdi-speedometer"
/>
</template> </template>
</VTooltip> </VTooltip>
<VTooltip <VTooltip v-if="cardProps.site?.filter" text="过滤">
v-if="cardProps.site?.filter"
text="过滤"
>
<template #activator="{ props }"> <template #activator="{ props }">
<VIcon <VIcon color="primary" class="me-2" v-bind="props" icon="mdi-filter-cog-outline" />
color="primary"
class="me-2"
v-bind="props"
icon="mdi-filter-cog-outline"
/>
</template> </template>
</VTooltip> </VTooltip>
</VCardText> </VCardText>
<VDivider <VDivider class="opacity-75" style="border-color: rgba(var(--v-theme-on-background), var(--v-selected-opacity))" />
class="opacity-75"
style="border-color: rgba(var(--v-theme-on-background), var(--v-selected-opacity));"
/>
<VCardActions> <VCardActions>
<VBtn <VBtn v-if="!cardProps.site?.public" :disabled="updateButtonDisable" @click.stop="handleSiteUpdate">
v-if="!cardProps.site?.public"
:disabled="updateButtonDisable"
@click.stop="handleSiteUpdate"
>
<template #prepend> <template #prepend>
<VIcon icon="mdi-refresh" /> <VIcon icon="mdi-refresh" />
</template> </template>
更新 更新
</VBtn> </VBtn>
<VBtn <VBtn :disabled="testButtonDisable" @click.stop="testSite">
:disabled="testButtonDisable"
@click.stop="testSite"
>
<template #prepend> <template #prepend>
<VIcon icon="mdi-link" /> <VIcon icon="mdi-link" />
</template> </template>
@@ -307,49 +249,29 @@ onMounted(() => {
</VCardActions> </VCardActions>
</VCard> </VCard>
<!-- 更新站点Cookie & UA弹窗 --> <!-- 更新站点Cookie & UA弹窗 -->
<VDialog <VDialog v-model="siteCookieDialog" max-width="50rem" :fullscreen="!display.mdAndUp.value">
v-model="siteCookieDialog"
max-width="50rem"
>
<!-- Dialog Content --> <!-- Dialog Content -->
<VCard title="更新站点Cookie & UA"> <VCard title="更新站点Cookie & UA">
<DialogCloseBtn @click="siteCookieDialog = false" />
<VCardText> <VCardText>
<VForm @submit.prevent="() => {}"> <VForm @submit.prevent="() => {}">
<VRow> <VRow>
<VCol <VCol cols="12" md="4">
cols="12" <VTextField v-model="userPwForm.username" label="用户名" :rules="[requiredValidator]" />
md="4"
>
<VTextField
v-model="userPwForm.username"
label="用户名"
:rules="[requiredValidator]"
/>
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VTextField <VTextField
v-model="userPwForm.password" v-model="userPwForm.password"
label="密码" label="密码"
:type="isPasswordVisible ? 'text' : 'password'" :type="isPasswordVisible ? 'text' : 'password'"
:append-inner-icon=" :append-inner-icon="isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
"
:rules="[requiredValidator]" :rules="[requiredValidator]"
@click:append-inner="isPasswordVisible = !isPasswordVisible" @click:append-inner="isPasswordVisible = !isPasswordVisible"
@keydown.enter="updateSiteCookie" @keydown.enter="updateSiteCookie"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12" <VTextField v-model="userPwForm.code" label="两步验证" />
md="4"
>
<VTextField
v-model="userPwForm.code"
label="两步验证"
/>
</VCol> </VCol>
</VRow> </VRow>
</VForm> </VForm>
@@ -357,12 +279,7 @@ onMounted(() => {
<VCardActions> <VCardActions>
<VSpacer /> <VSpacer />
<VBtn <VBtn variant="tonal" @click="updateSiteCookie"> 开始更新 </VBtn>
variant="tonal"
@click="updateSiteCookie"
>
开始更新
</VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
</VDialog> </VDialog>
@@ -370,7 +287,12 @@ onMounted(() => {
v-if="siteEditDialog" v-if="siteEditDialog"
v-model="siteEditDialog" v-model="siteEditDialog"
:siteid="cardProps.site?.id" :siteid="cardProps.site?.id"
@save="siteEditDialog = false; emit('update')" @save="
() => {
siteEditDialog = false
emit('update')
}
"
@remove="emit('remove')" @remove="emit('remove')"
@close="siteEditDialog = false" @close="siteEditDialog = false"
/> />
@@ -381,6 +303,7 @@ onMounted(() => {
max-width="80rem" max-width="80rem"
scrollable scrollable
z-index="1010" z-index="1010"
:fullscreen="!display.mdAndUp.value"
> >
<!-- Dialog Content --> <!-- Dialog Content -->
<VCard :title="`浏览站点 - ${cardProps.site?.name}`"> <VCard :title="`浏览站点 - ${cardProps.site?.name}`">
@@ -390,21 +313,11 @@ onMounted(() => {
</VCardText> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>
<VDialog <VDialog v-model="progressDialog" :scrim="false" width="25rem">
v-model="progressDialog" <VCard color="primary">
:scrim="false"
width="25rem"
>
<VCard
color="primary"
>
<VCardText class="text-center"> <VCardText class="text-center">
{{ progressText }} {{ progressText }}
<VProgressLinear <VProgressLinear indeterminate color="white" class="mb-0 mt-1" />
indeterminate
color="white"
class="mb-0 mt-1"
/>
</VCardText> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>

View File

@@ -4,6 +4,10 @@ import TmdbSelector from '../misc/TmdbSelector.vue'
import store from '@/store' import store from '@/store'
import api from '@/api' import api from '@/api'
import { numberValidator } from '@/@validators' import { numberValidator } from '@/@validators'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 输入参数 // 输入参数
const props = defineProps({ const props = defineProps({
@@ -55,7 +59,6 @@ const transferForm = reactive({
episode_part: '', episode_part: '',
episode_offset: null, episode_offset: null,
min_filesize: 0, min_filesize: 0,
}) })
watchEffect(() => { watchEffect(() => {
@@ -72,7 +75,7 @@ function startLoadingProgress() {
progressEventSource.value = new EventSource( progressEventSource.value = new EventSource(
`${import.meta.env.VITE_API_BASE_URL}system/progress/filetransfer?token=${token}`, `${import.meta.env.VITE_API_BASE_URL}system/progress/filetransfer?token=${token}`,
) )
progressEventSource.value.onmessage = (event) => { progressEventSource.value.onmessage = event => {
const progress = JSON.parse(event.data) const progress = JSON.parse(event.data)
if (progress) { if (progress) {
progressText.value = progress.text progressText.value = progress.text
@@ -89,8 +92,7 @@ function stopLoadingProgress() {
// 整理文件 // 整理文件
// eslint-disable-next-line sonarjs/cognitive-complexity // eslint-disable-next-line sonarjs/cognitive-complexity
async function transfer() { async function transfer() {
if (!props.logids && !props.path) if (!props.logids && !props.path) return
return
// 显示进度条 // 显示进度条
progressDialog.value = true progressDialog.value = true
@@ -100,32 +102,33 @@ async function transfer() {
if (props.path) { if (props.path) {
// 文件整理 // 文件整理
try { try {
const result: { [key: string]: any } = await api.post('transfer/manual', {}, { const result: { [key: string]: any } = await api.post(
params: transferForm, 'transfer/manual',
}) {},
{
params: transferForm,
},
)
// 显示结果 // 显示结果
if (result.success) if (result.success) $toast.success(`${props.path} 整理完成!`)
$toast.success(`${props.path} 整理完成`) else $toast.error(`${props.path} 整理失败:${result.message}`)
} catch (e) {
else
$toast.error(`${props.path} 整理失败:${result.message}`)
}
catch (e) {
console.log(e) console.log(e)
} }
} } else if (props.logids) {
else if (props.logids) {
// 日志整理 // 日志整理
for (const logid of props.logids) { for (const logid of props.logids) {
transferForm.logid = logid transferForm.logid = logid
try { try {
const result: { [key: string]: any } = await api.post('transfer/manual', {}, { const result: { [key: string]: any } = await api.post(
params: transferForm, 'transfer/manual',
}) {},
if (!result.success) {
$toast.error(`历史记录 ${logid} 重新整理失败:${result.message}`) params: transferForm,
} },
catch (e) { )
if (!result.success) $toast.error(`历史记录 ${logid} 重新整理失败:${result.message}`)
} catch (e) {
console.log(e) console.log(e)
} }
} }
@@ -141,10 +144,7 @@ async function transfer() {
</script> </script>
<template> <template>
<VDialog <VDialog scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
scrollable
max-width="60rem"
>
<VCard <VCard
:title="`${props.path ? `整理 - ${props.path}` : `整理 - 共 ${props.logids?.length} 条记录`}`" :title="`${props.path ? `整理 - ${props.path}` : `整理 - 共 ${props.logids?.length} 条记录`}`"
class="rounded-t" class="rounded-t"
@@ -153,10 +153,7 @@ async function transfer() {
<VCardText class="pt-2"> <VCardText class="pt-2">
<VForm @submit.prevent="() => {}"> <VForm @submit.prevent="() => {}">
<VRow> <VRow>
<VCol <VCol cols="12" md="8">
cols="12"
md="8"
>
<VTextField <VTextField
v-model="transferForm.target" v-model="transferForm.target"
label="目的路径" label="目的路径"
@@ -164,10 +161,7 @@ async function transfer() {
hint="留空将自动整理到媒体库目录" hint="留空将自动整理到媒体库目录"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VSelect <VSelect
v-model="transferForm.transfer_type" v-model="transferForm.transfer_type"
label="整理方式" label="整理方式"
@@ -184,20 +178,18 @@ async function transfer() {
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VSelect <VSelect
v-model="transferForm.type_name" v-model="transferForm.type_name"
label="类型" label="类型"
:items="[{ title: '自动', value: '' }, { title: '电影', value: '电影' }, { title: '电视剧', value: '电视剧' }]" :items="[
{ title: '自动', value: '' },
{ title: '电影', value: '电影' },
{ title: '电视剧', value: '电视剧' },
]"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VTextField <VTextField
v-model="transferForm.tmdbid" v-model="transferForm.tmdbid"
:disabled="transferForm.type_name === ''" :disabled="transferForm.type_name === ''"
@@ -209,10 +201,7 @@ async function transfer() {
@click:append-inner="tmdbSelectorDialog = true" @click:append-inner="tmdbSelectorDialog = true"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VSelect <VSelect
v-show="transferForm.type_name === '电视剧'" v-show="transferForm.type_name === '电视剧'"
v-model.number="transferForm.season" v-model.number="transferForm.season"
@@ -267,49 +256,23 @@ async function transfer() {
</VForm> </VForm>
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VBtn depressed @click="emit('close')"> <VBtn depressed @click="emit('close')"> 取消 </VBtn>
取消
</VBtn>
<VSpacer /> <VSpacer />
<VBtn <VBtn variant="tonal" @click="transfer"> 开始整理 </VBtn>
variant="tonal"
@click="transfer"
>
开始整理
</VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
<!-- 手动整理进度框 --> <!-- 手动整理进度框 -->
<VDialog <VDialog v-model="progressDialog" :scrim="false" width="25rem">
v-model="progressDialog" <VCard color="primary">
:scrim="false"
width="25rem"
>
<VCard
color="primary"
>
<VCardText class="text-center"> <VCardText class="text-center">
{{ progressText }} {{ progressText }}
<VProgressLinear <VProgressLinear v-if="progressValue" color="white" class="mb-0 mt-1" :model-value="progressValue" />
v-if="progressValue"
color="white"
class="mb-0 mt-1"
:model-value="progressValue"
/>
</VCardText> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>
<!-- TMDB ID搜索框 --> <!-- TMDB ID搜索框 -->
<VDialog <VDialog v-model="tmdbSelectorDialog" width="40rem" scrollable max-height="85vh">
v-model="tmdbSelectorDialog" <TmdbSelector v-model="transferForm.tmdbid" @close="tmdbSelectorDialog = false" />
width="40rem"
scrollable
max-height="85vh"
>
<TmdbSelector
v-model="transferForm.tmdbid"
@close="tmdbSelectorDialog = false"
/>
</VDialog> </VDialog>
</VDialog> </VDialog>
</template> </template>

View File

@@ -4,6 +4,10 @@ import type { Site } from '@/api/types'
import { doneNProgress, startNProgress } from '@/api/nprogress' import { doneNProgress, startNProgress } from '@/api/nprogress'
import { numberValidator, requiredValidator } from '@/@validators' import { numberValidator, requiredValidator } from '@/@validators'
import api from '@/api' import api from '@/api'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 输入参数 // 输入参数
const props = defineProps({ const props = defineProps({
@@ -48,8 +52,7 @@ const priorityItems = ref(
// 监控输入参数 // 监控输入参数
watchEffect(async () => { watchEffect(async () => {
if (props.siteid) if (props.siteid) fetchSiteInfo()
fetchSiteInfo()
}) })
// 查询站点信息 // 查询站点信息
@@ -58,27 +61,24 @@ async function fetchSiteInfo() {
siteForm.value = await api.get(`site/${props.siteid}`) siteForm.value = await api.get(`site/${props.siteid}`)
siteForm.value.proxy = siteForm.value.proxy === 1 siteForm.value.proxy = siteForm.value.proxy === 1
siteForm.value.render = siteForm.value.render === 1 siteForm.value.render = siteForm.value.render === 1
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
// 调用API 新增站点 // 调用API 新增站点
async function addSite() { async function addSite() {
if (!siteForm.value?.url) if (!siteForm.value?.url) return
return
startNProgress() startNProgress()
try { try {
const result: { [key: string]: string } = await api.post('site/', siteForm.value) const result: { [key: string]: string } = await api.post('site/', siteForm.value)
if (result.success) { if (result.success) {
$toast.success('新增站点成功') $toast.success('新增站点成功')
emit('save') emit('save')
} else {
$toast.error(`新增站点失败:${result.message}`)
} }
} catch (error) {
else { $toast.error(`新增站点失败:${result.message}`) }
}
catch (error) {
console.error(error) console.error(error)
} }
doneNProgress() doneNProgress()
@@ -88,12 +88,9 @@ async function addSite() {
async function deleteSiteInfo() { async function deleteSiteInfo() {
try { try {
const result: { [key: string]: any } = await api.delete(`site/${siteForm.value?.id}`) const result: { [key: string]: any } = await api.delete(`site/${siteForm.value?.id}`)
if (result.success) if (result.success) emit('remove')
emit('remove')
else $toast.error(`${siteForm.value?.name} 删除失败:${result.message}`) else $toast.error(`${siteForm.value?.name} 删除失败:${result.message}`)
} } catch (error) {
catch (error) {
$toast.error(`${siteForm.value?.name} 删除失败!`) $toast.error(`${siteForm.value?.name} 删除失败!`)
console.error(error) console.error(error)
} }
@@ -107,10 +104,10 @@ async function updateSiteInfo() {
if (result.success) { if (result.success) {
$toast.success(`${siteForm.value?.name} 更新成功!`) $toast.success(`${siteForm.value?.name} 更新成功!`)
emit('save') emit('save')
} else {
$toast.error(`${siteForm.value?.name} 更新失败:${result.message}`)
} }
else { $toast.error(`${siteForm.value?.name} 更新失败:${result.message}`) } } catch (error) {
}
catch (error) {
$toast.error(`${siteForm.value?.name} 更新失败!`) $toast.error(`${siteForm.value?.name} 更新失败!`)
console.error(error) console.error(error)
} }
@@ -119,13 +116,7 @@ async function updateSiteInfo() {
</script> </script>
<template> <template>
<VDialog <VDialog scrollable :close-on-back="false" persistent eager max-width="60rem" :fullscreen="!display.mdAndUp.value">
scrollable
:close-on-back="false"
persistent
eager
max-width="60rem"
>
<VCard <VCard
:title="`${props.oper === 'add' ? '新增' : '编辑'}站点${props.oper !== 'add' ? ` - ${siteForm.name}` : ''}`" :title="`${props.oper === 'add' ? '新增' : '编辑'}站点${props.oper !== 'add' ? ` - ${siteForm.name}` : ''}`"
class="rounded-t" class="rounded-t"
@@ -134,10 +125,7 @@ async function updateSiteInfo() {
<VCardText class="pt-2"> <VCardText class="pt-2">
<VForm @submit.prevent="() => {}"> <VForm @submit.prevent="() => {}">
<VRow> <VRow>
<VCol <VCol cols="12" md="6">
cols="12"
md="6"
>
<VTextField <VTextField
v-model="siteForm.url" v-model="siteForm.url"
label="站点地址" label="站点地址"
@@ -145,10 +133,7 @@ async function updateSiteInfo() {
hint="格式http://www.example.com/" hint="格式http://www.example.com/"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="3">
cols="12"
md="3"
>
<VSelect <VSelect
v-model="siteForm.pri" v-model="siteForm.pri"
label="优先级" label="优先级"
@@ -157,15 +142,8 @@ async function updateSiteInfo() {
hint="站点资源下载优先级,优先级数字越小越优先下载" hint="站点资源下载优先级,优先级数字越小越优先下载"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="3">
cols="12" <VSelect v-model="siteForm.is_active" :items="statusItems" label="状态" />
md="3"
>
<VSelect
v-model="siteForm.is_active"
:items="statusItems"
label="状态"
/>
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
@@ -192,10 +170,7 @@ async function updateSiteInfo() {
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VTextField <VTextField
v-model="siteForm.limit_interval" v-model="siteForm.limit_interval"
label="单位周期(秒)" label="单位周期(秒)"
@@ -203,10 +178,7 @@ async function updateSiteInfo() {
hint="设定站点限流的单位周期单位为秒0为不限流" hint="设定站点限流的单位周期单位为秒0为不限流"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VTextField <VTextField
v-model="siteForm.limit_count" v-model="siteForm.limit_count"
label="访问次数" label="访问次数"
@@ -214,10 +186,7 @@ async function updateSiteInfo() {
hint="设定单位周期内站点允许的访问次数0为不限制" hint="设定单位周期内站点允许的访问次数0为不限制"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VTextField <VTextField
v-model="siteForm.limit_seconds" v-model="siteForm.limit_seconds"
label="访问间隔(秒)" label="访问间隔(秒)"
@@ -227,20 +196,10 @@ async function updateSiteInfo() {
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol <VCol cols="12" md="6">
cols="12" <VSwitch v-model="siteForm.proxy" label="代理" hint="站点是否需要代理访问,需要设置好代理服务器信息" />
md="6"
>
<VSwitch
v-model="siteForm.proxy"
label="代理"
hint="站点是否需要代理访问,需要设置好代理服务器信息"
/>
</VCol> </VCol>
<VCol <VCol cols="12" md="6">
cols="12"
md="6"
>
<VSwitch <VSwitch
v-model="siteForm.render" v-model="siteForm.render"
label="仿真" label="仿真"
@@ -251,36 +210,11 @@ async function updateSiteInfo() {
</VForm> </VForm>
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VBtn <VBtn v-if="props.oper === 'add'" @click="emit('close')"> 取消 </VBtn>
v-if="props.oper === 'add'" <VBtn v-else color="error" @click="deleteSiteInfo"> 删除 </VBtn>
@click="emit('close')"
>
取消
</VBtn>
<VBtn
v-else
color="error"
@click="deleteSiteInfo"
>
删除
</VBtn>
<VSpacer /> <VSpacer />
<VBtn <VBtn v-if="props.oper === 'add'" color="primary" variant="tonal" @click="addSite"> 新增 </VBtn>
v-if="props.oper === 'add'" <VBtn v-else color="primary" variant="tonal" @click="updateSiteInfo"> 保存 </VBtn>
color="primary"
variant="tonal"
@click="addSite"
>
新增
</VBtn>
<VBtn
v-else
color="primary"
variant="tonal"
@click="updateSiteInfo"
>
保存
</VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
</VDialog> </VDialog>

View File

@@ -3,6 +3,10 @@ import { useToast } from 'vue-toast-notification'
import { numberValidator } from '@/@validators' import { numberValidator } from '@/@validators'
import api from '@/api' import api from '@/api'
import type { Site, Subscribe } from '@/api/types' import type { Site, Subscribe } from '@/api/types'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 输入参数 // 输入参数
const props = defineProps({ const props = defineProps({
@@ -44,7 +48,7 @@ const subscribeForm = ref<Subscribe>({
current_priority: 0, current_priority: 0,
save_path: '', save_path: '',
date: '', date: '',
show_edit_dialog: false show_edit_dialog: false,
}) })
// 提示框 // 提示框
@@ -59,10 +63,10 @@ async function updateSubscribeInfo() {
$toast.success(`${subscribeForm.value.name} 更新成功!`) $toast.success(`${subscribeForm.value.name} 更新成功!`)
// 通知父组件刷新 // 通知父组件刷新
emit('save') emit('save')
} else {
$toast.error(`${subscribeForm.value.name} 更新失败:${result.message}`)
} }
else { $toast.error(`${subscribeForm.value.name} 更新失败:${result.message}`) } } catch (e) {
}
catch (e) {
console.log(e) console.log(e)
} }
} }
@@ -71,23 +75,16 @@ async function updateSubscribeInfo() {
async function saveDefaultSubscribeConfig() { async function saveDefaultSubscribeConfig() {
try { try {
let subscribe_config_url = '' let subscribe_config_url = ''
if (props.type === '电影') if (props.type === '电影') subscribe_config_url = 'system/setting/DefaultMovieSubscribeConfig'
subscribe_config_url = 'system/setting/DefaultMovieSubscribeConfig' else subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
else
subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
const result: { [key: string]: any } = await api.post( const result: { [key: string]: any } = await api.post(subscribe_config_url, subscribeForm.value)
subscribe_config_url, if (result.success) $toast.success(`${props.type}订阅默认规则保存成功`)
subscribeForm.value) else $toast.error(`${props.type}订阅默认规则保存失败!`)
if (result.success)
$toast.success(`${props.type}订阅默认规则保存成功`)
else
$toast.error(`${props.type}订阅默认规则保存失败!`)
// 通知父组件刷新 // 通知父组件刷新
emit('save') emit('save')
} } catch (error) {
catch (error) {
console.log(error) console.log(error)
} }
} }
@@ -96,17 +93,13 @@ async function saveDefaultSubscribeConfig() {
async function queryDefaultSubscribeConfig() { async function queryDefaultSubscribeConfig() {
try { try {
let subscribe_config_url = '' let subscribe_config_url = ''
if (props.type === '电影') if (props.type === '电影') subscribe_config_url = 'system/setting/DefaultMovieSubscribeConfig'
subscribe_config_url = 'system/setting/DefaultMovieSubscribeConfig' else subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
else
subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
const result: { [key: string]: any } = await api.get(subscribe_config_url) const result: { [key: string]: any } = await api.get(subscribe_config_url)
if (result.data.value) if (result.data.value) subscribeForm.value = result.data?.value ?? ''
subscribeForm.value = result.data?.value ?? '' } catch (error) {
}
catch (error) {
console.log(error) console.log(error)
} }
} }
@@ -118,8 +111,7 @@ async function loadSites() {
// 过滤站点,只有启用的站点才显示 // 过滤站点,只有启用的站点才显示
siteList.value = data.filter(item => item.is_active) siteList.value = data.filter(item => item.is_active)
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -127,10 +119,9 @@ async function loadSites() {
// 获取站点列表选择框数据 // 获取站点列表选择框数据
async function getSiteList() { async function getSiteList() {
// 加载订阅站点列表 // 加载订阅站点列表
if (!siteList.value.length) if (!siteList.value.length) await loadSites()
await loadSites()
const maps = siteList.value.map((item) => { const maps = siteList.value.map(item => {
return { return {
title: item.name, title: item.name,
value: item.id, value: item.id,
@@ -143,14 +134,11 @@ async function getSiteList() {
// 获取订阅信息 // 获取订阅信息
async function getSubscribeInfo() { async function getSubscribeInfo() {
try { try {
const result: Subscribe = await api.get( const result: Subscribe = await api.get(`subscribe/${props.subid}`)
`subscribe/${props.subid}`,
)
subscribeForm.value = result subscribeForm.value = result
subscribeForm.value.best_version = subscribeForm.value.best_version === 1 subscribeForm.value.best_version = subscribeForm.value.best_version === 1
subscribeForm.value.search_imdbid = subscribeForm.value.search_imdbid === 1 subscribeForm.value.search_imdbid = subscribeForm.value.search_imdbid === 1
} } catch (e) {
catch (e) {
console.log(e) console.log(e)
} }
} }
@@ -158,16 +146,13 @@ async function getSubscribeInfo() {
// 删除订阅 // 删除订阅
async function removeSubscribe() { async function removeSubscribe() {
try { try {
const result: { [key: string]: any } = await api.delete( const result: { [key: string]: any } = await api.delete(`subscribe/${props.subid}`)
`subscribe/${props.subid}`,
)
if (result.success) { if (result.success) {
// 通知父组件刷新 // 通知父组件刷新
emit('remove') emit('remove')
} }
} } catch (e) {
catch (e) {
console.log(e) console.log(e)
} }
} }
@@ -258,31 +243,27 @@ const effectOptions = ref([
onMounted(() => { onMounted(() => {
getSiteList() getSiteList()
if (props.subid) if (props.subid) getSubscribeInfo()
getSubscribeInfo()
if (props.default) if (props.default) queryDefaultSubscribeConfig()
queryDefaultSubscribeConfig()
}) })
</script> </script>
<template> <template>
<VDialog <VDialog scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
scrollable
max-width="60rem"
>
<VCard <VCard
:title="`${props.default ? `${props.type}默认订阅规则` : `编辑订阅 - ${subscribeForm.name} ${subscribeForm.season ? `第 ${subscribeForm.season} 季` : ''}`}`" :title="`${
props.default
? `${props.type}默认订阅规则`
: `编辑订阅 - ${subscribeForm.name} ${subscribeForm.season ? `第 ${subscribeForm.season} 季` : ''}`
}`"
class="rounded-t" class="rounded-t"
> >
<VCardText class="pt-2"> <VCardText class="pt-2">
<DialogCloseBtn @click="emit('close')" /> <DialogCloseBtn @click="emit('close')" />
<VForm @submit.prevent="() => {}"> <VForm @submit.prevent="() => {}">
<VRow> <VRow>
<VCol <VCol cols="12" md="8">
cols="12"
md="8"
>
<VTextField <VTextField
v-if="!props.default" v-if="!props.default"
v-model="subscribeForm.keyword" v-model="subscribeForm.keyword"
@@ -290,11 +271,7 @@ onMounted(() => {
hint="设定搜索关键词后将使用此关键词搜索站点资源否则自动使用themoviedb中的名称搜索" hint="设定搜索关键词后将使用此关键词搜索站点资源否则自动使用themoviedb中的名称搜索"
/> />
</VCol> </VCol>
<VCol <VCol v-if="subscribeForm.type === '电视剧'" cols="12" md="2">
v-if="subscribeForm.type === '电视剧'"
cols="12"
md="2"
>
<VTextField <VTextField
v-model="subscribeForm.total_episode" v-model="subscribeForm.total_episode"
label="总集数" label="总集数"
@@ -302,11 +279,7 @@ onMounted(() => {
hint="设定剧集的总集数以应对themoviedb中剧集信息未维护完整导致提前结束订阅的情况" hint="设定剧集的总集数以应对themoviedb中剧集信息未维护完整导致提前结束订阅的情况"
/> />
</VCol> </VCol>
<VCol <VCol v-if="subscribeForm.type === '电视剧'" cols="12" md="2">
v-if="subscribeForm.type === '电视剧'"
cols="12"
md="2"
>
<VTextField <VTextField
v-model="subscribeForm.start_episode" v-model="subscribeForm.start_episode"
label="开始集数" label="开始集数"
@@ -316,62 +289,32 @@ onMounted(() => {
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol <VCol cols="12" md="4">
cols="12" <VSelect v-model="subscribeForm.quality" label="质量" :items="qualityOptions" />
md="4"
>
<VSelect
v-model="subscribeForm.quality"
label="质量"
:items="qualityOptions"
/>
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12" <VSelect v-model="subscribeForm.resolution" label="分辨率" :items="resolutionOptions" />
md="4"
>
<VSelect
v-model="subscribeForm.resolution"
label="分辨率"
:items="resolutionOptions"
/>
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12" <VSelect v-model="subscribeForm.effect" label="特效" :items="effectOptions" />
md="4"
>
<VSelect
v-model="subscribeForm.effect"
label="特效"
:items="effectOptions"
/>
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VTextField <VTextField
v-model="subscribeForm.include" v-model="subscribeForm.include"
label="包含(关键字、正则式)" label="包含(关键字、正则式)"
hint="支持正则表达式,多个关键字用 | 分隔表示或" hint="支持正则表达式,多个关键字用 | 分隔表示或"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VTextField <VTextField
v-model="subscribeForm.exclude" v-model="subscribeForm.exclude"
label="排除(关键字、正则式)" label="排除(关键字、正则式)"
hint="支持正则表达式,多个关键字用 | 分隔表示或" hint="支持正则表达式,多个关键字用 | 分隔表示或"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VSelect <VSelect
v-model="subscribeForm.sites" v-model="subscribeForm.sites"
:items="selectSitesOptions" :items="selectSitesOptions"
@@ -383,9 +326,7 @@ onMounted(() => {
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol <VCol cols="12">
cols="12"
>
<VTextField <VTextField
v-model="subscribeForm.save_path" v-model="subscribeForm.save_path"
label="保存路径" label="保存路径"
@@ -394,30 +335,21 @@ onMounted(() => {
</VCol> </VCol>
</VRow> </VRow>
<VRow> <VRow>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VSwitch <VSwitch
v-model="subscribeForm.best_version" v-model="subscribeForm.best_version"
label="洗版" label="洗版"
hint="开启后不管媒体库是否存在,均会根据洗版优先级进行过滤下载,直到下载到了最高优先级的资源为止" hint="开启后不管媒体库是否存在,均会根据洗版优先级进行过滤下载,直到下载到了最高优先级的资源为止"
/> />
</VCol> </VCol>
<VCol <VCol cols="12" md="4">
cols="12"
md="4"
>
<VSwitch <VSwitch
v-model="subscribeForm.search_imdbid" v-model="subscribeForm.search_imdbid"
label="使用 ImdbID 搜索" label="使用 ImdbID 搜索"
hint="开启后将使用 ImdbID 搜索资源,搜索结果更精确,但不是所有站点都支持" hint="开启后将使用 ImdbID 搜索资源,搜索结果更精确,但不是所有站点都支持"
/> />
</VCol> </VCol>
<VCol v-if="props.default" <VCol v-if="props.default" cols="12" md="4">
cols="12"
md="4"
>
<VSwitch <VSwitch
v-model="subscribeForm.show_edit_dialog" v-model="subscribeForm.show_edit_dialog"
label="订阅时编辑更多规则" label="订阅时编辑更多规则"
@@ -429,14 +361,9 @@ onMounted(() => {
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VBtn v-if="!props.default" color="error" @click="removeSubscribe"> <VBtn v-if="!props.default" color="error" @click="removeSubscribe"> 取消订阅 </VBtn>
取消订阅
</VBtn>
<VSpacer /> <VSpacer />
<VBtn <VBtn variant="tonal" @click=";`${props.default ? saveDefaultSubscribeConfig() : updateSubscribeInfo()}`">
variant="tonal"
@click="`${props.default ? saveDefaultSubscribeConfig() : updateSubscribeInfo()}`"
>
保存 保存
</VBtn> </VBtn>
</VCardActions> </VCardActions>

View File

@@ -1,7 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import api from '@/api'; import api from '@/api'
import { Subscribe } from '@/api/types'; import { Subscribe } from '@/api/types'
import { formatDateDifference } from '@core/utils/formatters' import { formatDateDifference } from '@core/utils/formatters'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 输入参数 // 输入参数
const props = defineProps({ const props = defineProps({
@@ -77,14 +81,12 @@ async function loadHistory({ done }: { done: any }) {
// 重新订阅 // 重新订阅
async function reSubscribe(item: Subscribe) { async function reSubscribe(item: Subscribe) {
if (item.type === '电影') if (item.type === '电影') progressText.value = `正在重新订阅 ${item.name} ...`
progressText.value = `正在重新订阅 ${item.name} ...` else progressText.value = `正在重新订阅 ${item.name}${item.season} ...`
else
progressText.value = `正在重新订阅 ${item.name}${item.season} 季 ...`
progressDialog.value = true progressDialog.value = true
try { try {
const result: {[key: string]: any} = await api.post('subscribe', item) const result: { [key: string]: any } = await api.post('subscribe', item)
if (result.success){ if (result.success) {
emit('save') emit('save')
} }
} catch (e) { } catch (e) {
@@ -96,9 +98,9 @@ async function reSubscribe(item: Subscribe) {
// 删除记录 // 删除记录
async function deleteHistory(item: Subscribe) { async function deleteHistory(item: Subscribe) {
try { try {
const result: {[key: string]: any} = await api.delete(`subscribe/history/${item.id}`) const result: { [key: string]: any } = await api.delete(`subscribe/history/${item.id}`)
if (result.success){ if (result.success) {
historyList.value = historyList.value.filter((i) => i.id !== item.id) historyList.value = historyList.value.filter(i => i.id !== item.id)
} }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
@@ -124,35 +126,25 @@ const dropdownItems = ref([
prependIcon: 'mdi-delete', prependIcon: 'mdi-delete',
click: deleteHistory, click: deleteHistory,
}, },
} },
]) ])
</script> </script>
<template> <template>
<VDialog <VDialog scrollable max-width="50rem" :fullscreen="!display.mdAndUp.value">
scrollable <VCard class="mx-auto" width="100%">
max-width="50rem"
max-height="90vh"
>
<VCard
class="mx-auto"
width="100%"
>
<VCardItem class="pb-0"> <VCardItem class="pb-0">
<VCardTitle>{{ props.type + '订阅历史' }}</VCardTitle> <VCardTitle>{{ props.type + '订阅历史' }}</VCardTitle>
</VCardItem> </VCardItem>
<DialogCloseBtn @click="() => { emit('close') }" /> <DialogCloseBtn
<VList @click="
lines="two" () => {
> emit('close')
<VInfiniteScroll }
mode="intersect" "
side="end" />
:items="historyList" <VList lines="two">
class="overflow-hidden" <VInfiniteScroll mode="intersect" side="end" :items="historyList" class="overflow-hidden" @load="loadHistory">
@load="loadHistory"
>
<template #loading> <template #loading>
<LoadingBanner /> <LoadingBanner />
</template> </template>
@@ -186,13 +178,8 @@ const dropdownItems = ref([
<template #append> <template #append>
<div class="me-n3"> <div class="me-n3">
<IconBtn> <IconBtn>
<VIcon <VIcon icon="mdi-dots-vertical" />
icon="mdi-dots-vertical" <VMenu activator="parent" close-on-content-click>
/>
<VMenu
activator="parent"
close-on-content-click
>
<VList> <VList>
<VListItem <VListItem
v-for="(menu, i) in dropdownItems" v-for="(menu, i) in dropdownItems"
@@ -217,21 +204,11 @@ const dropdownItems = ref([
</VList> </VList>
</VCard> </VCard>
<!-- 进度框 --> <!-- 进度框 -->
<VDialog <VDialog v-model="progressDialog" :scrim="false" width="25rem">
v-model="progressDialog" <VCard color="primary">
:scrim="false"
width="25rem"
>
<VCard
color="primary"
>
<VCardText class="text-center"> <VCardText class="text-center">
{{ progressText }} {{ progressText }}
<VProgressLinear <VProgressLinear indeterminate color="white" class="mb-0 mt-1" />
indeterminate
color="white"
class="mb-0 mt-1"
/>
</VCardText> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>

View File

@@ -1,6 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { isNullOrEmptyObject } from '@/@core/utils'
import api from '@/api'
import { type PropType, ref } from 'vue' import { type PropType, ref } from 'vue'
// 定议外部事件
const emit = defineEmits(['action'])
// 组件接口 // 组件接口
interface RenderProps { interface RenderProps {
component: string component: string
@@ -9,6 +14,7 @@ interface RenderProps {
content?: any content?: any
slots?: any slots?: any
props?: any props?: any
events?: any
} }
// 输入参数 // 输入参数
@@ -16,43 +22,64 @@ const elementProps = defineProps({
config: Object as PropType<RenderProps>, config: Object as PropType<RenderProps>,
}) })
// 配置元素 // 元素API事件响应
const formItem = ref<RenderProps>(elementProps.config ?? { async function commonAction(api_path: string, method: string, params = {}) {
component: 'div', if (!api_path || !method) return
text: '', if (method.toUpperCase() === 'GET') {
html: '', await api.get(api_path, {
props: {}, params: params,
content: [], })
slots: {}, } else {
}) await api.post(api_path, params)
}
emit('action')
}
// 组装事件
let componentEvents: { [key: string]: any } = {}
if (!isNullOrEmptyObject(elementProps.config?.events)) {
for (const key in elementProps.config?.events) {
const attr = elementProps.config?.events[key]
const func = async () => {
await commonAction(attr['api'], attr['method'], attr['params'])
}
componentEvents[key] = func
}
} else {
componentEvents = {}
}
</script> </script>
<template> <template>
<Component <Component
:is="formItem.component" :is="elementProps.config?.component"
v-if="!formItem.html" v-if="!elementProps.config?.html"
v-bind="formItem.props" v-bind="elementProps.config?.props"
v-on="componentEvents"
> >
{{ formItem.text }} {{ elementProps.config?.text }}
<template v-for="(content, name) in (formItem.slots || [])" :key="name" v-slot:[name]="{_props}"> <template v-for="(content, name) in elementProps.config?.slots || []" :key="name" v-slot:[name]="{ _props }">
<slot :name="name" v-bind="_props"> <slot :name="name" v-bind="_props">
<PageRender <PageRender
v-for="(slotItem, slotIndex) in (content || [])" v-for="(slotItem, slotIndex) in content || []"
:key="slotIndex" :key="slotIndex"
:config="slotItem" :config="slotItem"
@action="emit('action')"
/> />
</slot> </slot>
</template> </template>
<PageRender <PageRender
v-for="(innerItem, innerIndex) in (formItem.content || [])" v-for="(innerItem, innerIndex) in elementProps.config?.content || []"
:key="innerIndex" :key="innerIndex"
:config="innerItem" :config="innerItem"
@action="emit('action')"
/> />
</Component> </Component>
<Component <Component
:is="formItem.component" :is="elementProps.config?.component"
v-if="formItem.html" v-if="elementProps.config?.html"
v-bind="formItem.props" v-bind="elementProps.config?.props"
v-html="formItem.html" v-html="elementProps.config?.html"
v-on="componentEvents"
/> />
</template> </template>

View File

@@ -7,6 +7,10 @@ import ModuleTestView from '@/views/system/ModuleTestView.vue'
import MessageView from '@/views/system/MessageView.vue' import MessageView from '@/views/system/MessageView.vue'
import store from '@/store' import store from '@/store'
import api from '@/api' import api from '@/api'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// App捷径 // App捷径
const appsMenu = ref(false) const appsMenu = ref(false)
@@ -63,8 +67,7 @@ async function sendMessage() {
user_message.value = '' user_message.value = ''
sendButtonDisabled.value = false sendButtonDisabled.value = false
scrollMessageToEnd() scrollMessageToEnd()
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -88,10 +91,7 @@ onMounted(() => {
> >
<!-- Menu Activator --> <!-- Menu Activator -->
<template #activator="{ props }"> <template #activator="{ props }">
<IconBtn <IconBtn class="me-2" v-bind="props">
class="me-2"
v-bind="props"
>
<VIcon icon="mdi-checkbox-multiple-blank-outline" /> <VIcon icon="mdi-checkbox-multiple-blank-outline" />
</IconBtn> </IconBtn>
</template> </template>
@@ -107,132 +107,61 @@ onMounted(() => {
</VCardItem> </VCardItem>
<div class="ps ps--active-y"> <div class="ps ps--active-y">
<VRow class="ma-0 mt-n1"> <VRow class="ma-0 mt-n1">
<VCol <VCol cols="6" class="text-center cursor-pointer pa-0 shortcut-icon border-e">
cols="6" <VListItem class="pa-4" @click="nameTestDialog = true">
class="text-center cursor-pointer pa-0 shortcut-icon border-e" <VAvatar size="48" variant="tonal">
>
<VListItem
class="pa-4"
@click="nameTestDialog = true"
>
<VAvatar
size="48"
variant="tonal"
>
<VIcon icon="mdi-text-recognition" /> <VIcon icon="mdi-text-recognition" />
</VAvatar> </VAvatar>
<h6 class="text-base font-weight-medium mt-2 mb-0"> <h6 class="text-base font-weight-medium mt-2 mb-0">识别</h6>
识别
</h6>
<span class="text-sm">名称识别测试</span> <span class="text-sm">名称识别测试</span>
</VListItem> </VListItem>
</VCol> </VCol>
<VCol <VCol cols="6" class="text-center cursor-pointer pa-0 shortcut-icon border-e" @click="() => {}">
cols="6" <VListItem class="pa-4" @click="ruleTestDialog = true">
class="text-center cursor-pointer pa-0 shortcut-icon border-e" <VAvatar size="48" variant="tonal">
@click="() => {}"
>
<VListItem
class="pa-4"
@click="ruleTestDialog = true"
>
<VAvatar
size="48"
variant="tonal"
>
<VIcon icon="mdi-filter-cog-outline" /> <VIcon icon="mdi-filter-cog-outline" />
</VAvatar> </VAvatar>
<h6 class="text-base font-weight-medium mt-2 mb-0"> <h6 class="text-base font-weight-medium mt-2 mb-0">优先级</h6>
优先级
</h6>
<span class="text-sm">优先级规则测试</span> <span class="text-sm">优先级规则测试</span>
</VListItem> </VListItem>
</VCol> </VCol>
</VRow> </VRow>
<VRow class="ma-0 mt-n1 border-t"> <VRow class="ma-0 mt-n1 border-t">
<VCol <VCol cols="6" class="text-center cursor-pointer pa-0 shortcut-icon border-e" @click="() => {}">
cols="6" <VListItem class="pa-4" @click="loggingDialog = true">
class="text-center cursor-pointer pa-0 shortcut-icon border-e" <VAvatar size="48" variant="tonal">
@click="() => {}"
>
<VListItem
class="pa-4"
@click="loggingDialog = true"
>
<VAvatar
size="48"
variant="tonal"
>
<VIcon icon="mdi-file-document-outline" /> <VIcon icon="mdi-file-document-outline" />
</VAvatar> </VAvatar>
<h6 class="text-base font-weight-medium mt-2 mb-0"> <h6 class="text-base font-weight-medium mt-2 mb-0">日志</h6>
日志
</h6>
<span class="text-sm">实时日志</span> <span class="text-sm">实时日志</span>
</VListItem> </VListItem>
</VCol> </VCol>
<VCol <VCol cols="6" class="text-center cursor-pointer pa-0 shortcut-icon" @click="() => {}">
cols="6" <VListItem class="pa-4" @click="netTestDialog = true">
class="text-center cursor-pointer pa-0 shortcut-icon" <VAvatar size="48" variant="tonal">
@click="() => {}"
>
<VListItem
class="pa-4"
@click="netTestDialog = true"
>
<VAvatar
size="48"
variant="tonal"
>
<VIcon icon="mdi-network-outline" /> <VIcon icon="mdi-network-outline" />
</VAvatar> </VAvatar>
<h6 class="text-base font-weight-medium mt-2 mb-0"> <h6 class="text-base font-weight-medium mt-2 mb-0">网络</h6>
网络
</h6>
<span class="text-sm">网速连通性测试</span> <span class="text-sm">网速连通性测试</span>
</VListItem> </VListItem>
</VCol> </VCol>
</VRow> </VRow>
<VRow class="ma-0 mt-n1 border-t"> <VRow class="ma-0 mt-n1 border-t">
<VCol <VCol cols="6" class="text-center cursor-pointer pa-0 shortcut-icon border-e" @click="() => {}">
cols="6" <VListItem class="pa-4" @click="systemTestDialog = true">
class="text-center cursor-pointer pa-0 shortcut-icon border-e" <VAvatar size="48" variant="tonal">
@click="() => {}"
>
<VListItem
class="pa-4"
@click="systemTestDialog = true"
>
<VAvatar
size="48"
variant="tonal"
>
<VIcon icon="mdi-cog-outline" /> <VIcon icon="mdi-cog-outline" />
</VAvatar> </VAvatar>
<h6 class="text-base font-weight-medium mt-2 mb-0"> <h6 class="text-base font-weight-medium mt-2 mb-0">系统</h6>
系统
</h6>
<span class="text-sm">健康检查</span> <span class="text-sm">健康检查</span>
</VListItem> </VListItem>
</VCol> </VCol>
<VCol <VCol cols="6" class="text-center cursor-pointer pa-0 shortcut-icon border-e" @click="() => {}">
cols="6" <VListItem class="pa-4" @click="messageDialog = true">
class="text-center cursor-pointer pa-0 shortcut-icon border-e" <VAvatar size="48" variant="tonal">
@click="() => {}"
>
<VListItem
class="pa-4"
@click="messageDialog = true"
>
<VAvatar
size="48"
variant="tonal"
>
<VIcon icon="mdi-message-outline" /> <VIcon icon="mdi-message-outline" />
</VAvatar> </VAvatar>
<h6 class="text-base font-weight-medium mt-2 mb-0"> <h6 class="text-base font-weight-medium mt-2 mb-0">消息</h6>
消息
</h6>
<span class="text-sm">消息中心</span> <span class="text-sm">消息中心</span>
</VListItem> </VListItem>
</VCol> </VCol>
@@ -241,37 +170,30 @@ onMounted(() => {
</VCard> </VCard>
</VMenu> </VMenu>
<!-- 名称测试弹窗 --> <!-- 名称测试弹窗 -->
<VDialog <VDialog v-if="nameTestDialog" v-model="nameTestDialog" max-width="50rem" scrollable>
v-if="nameTestDialog"
v-model="nameTestDialog"
max-width="50rem"
>
<VCard title="名称识别测试"> <VCard title="名称识别测试">
<DialogCloseBtn @click="nameTestDialog = false" /> <DialogCloseBtn @click="nameTestDialog = false" />
<VCardItem> <VCardText>
<NameTestView /> <NameTestView />
</VCardItem> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 网络测试弹窗 --> <!-- 网络测试弹窗 -->
<VDialog <VDialog v-if="netTestDialog" v-model="netTestDialog" max-width="35rem" max-height="85vh" scrollable>
v-if="netTestDialog"
v-model="netTestDialog"
max-width="35rem"
>
<VCard title="网络测试"> <VCard title="网络测试">
<DialogCloseBtn @click="netTestDialog = false" /> <DialogCloseBtn @click="netTestDialog = false" />
<VCardItem> <VCardText>
<NetTestView /> <NetTestView />
</VCardItem> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 实时日志弹窗 --> <!-- 实时日志弹窗 -->
<VDialog <VDialog
v-if="loggingDialog" v-if="loggingDialog"
v-model="loggingDialog" v-model="loggingDialog"
class="w-full lg:w-4/5"
scrollable scrollable
max-width="70rem"
:fullscreen="!display.mdAndUp.value"
> >
<VCard> <VCard>
<DialogCloseBtn @click="loggingDialog = false" /> <DialogCloseBtn @click="loggingDialog = false" />
@@ -279,7 +201,9 @@ onMounted(() => {
<VCardTitle class="inline-flex"> <VCardTitle class="inline-flex">
实时日志 实时日志
<a class="mx-2 inline-flex items-center justify-center" :href="allLoggingUrl()" target="_blank"> <a class="mx-2 inline-flex items-center justify-center" :href="allLoggingUrl()" target="_blank">
<div class="inline-flex cursor-pointer items-center rounded-full bg-gray-600 px-2 text-sm text-gray-200 ring-1 ring-gray-500 transition hover:bg-gray-700"> <div
class="inline-flex cursor-pointer items-center rounded-full bg-gray-600 px-2 text-sm text-gray-200 ring-1 ring-gray-500 transition hover:bg-gray-700"
>
<VIcon icon="mdi-open-in-new" /> <VIcon icon="mdi-open-in-new" />
<span class="ms-1">在新窗口中打开</span> <span class="ms-1">在新窗口中打开</span>
</div> </div>
@@ -292,12 +216,7 @@ onMounted(() => {
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 规则测试弹窗 --> <!-- 规则测试弹窗 -->
<VDialog <VDialog v-if="ruleTestDialog" v-model="ruleTestDialog" max-width="50rem" scrollable>
v-if="ruleTestDialog"
v-model="ruleTestDialog"
max-width="50rem"
scrollable
>
<VCard title="优先级测试"> <VCard title="优先级测试">
<DialogCloseBtn @click="ruleTestDialog = false" /> <DialogCloseBtn @click="ruleTestDialog = false" />
<VCardText> <VCardText>
@@ -306,12 +225,7 @@ onMounted(() => {
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 系统健康检查弹窗 --> <!-- 系统健康检查弹窗 -->
<VDialog <VDialog v-if="systemTestDialog" v-model="systemTestDialog" max-width="35rem" max-height="85vh" scrollable>
v-if="systemTestDialog"
v-model="systemTestDialog"
max-width="50rem"
scrollable
>
<VCard title="系统健康检查"> <VCard title="系统健康检查">
<DialogCloseBtn @click="systemTestDialog = false" /> <DialogCloseBtn @click="systemTestDialog = false" />
<VCardText> <VCardText>
@@ -325,6 +239,7 @@ onMounted(() => {
v-model="messageDialog" v-model="messageDialog"
max-width="60rem" max-width="60rem"
scrollable scrollable
:fullscreen="!display.mdAndUp.value"
> >
<VCard title="消息中心"> <VCard title="消息中心">
<DialogCloseBtn @click="messageDialog = false" /> <DialogCloseBtn @click="messageDialog = false" />
@@ -345,13 +260,7 @@ onMounted(() => {
@keydown.enter="sendMessage" @keydown.enter="sendMessage"
> >
<template #append> <template #append>
<VBtn <VBtn color="primary" :disabled="sendButtonDisabled" @click="sendMessage"> 发送 </VBtn>
color="primary"
:disabled="sendButtonDisabled"
@click="sendMessage"
>
发送
</VBtn>
</template> </template>
</VTextField> </VTextField>
</VCardItem> </VCardItem>

View File

@@ -11,6 +11,10 @@ import MediaServerLibrary from '@/views/dashboard/MediaServerLibrary.vue'
import MediaServerPlaying from '@/views/dashboard/MediaServerPlaying.vue' import MediaServerPlaying from '@/views/dashboard/MediaServerPlaying.vue'
import api from '@/api' import api from '@/api'
import { isNullOrEmptyObject } from '@/@core/utils' import { isNullOrEmptyObject } from '@/@core/utils'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 仪表盘配置 // 仪表盘配置
const dashboard_names = { const dashboard_names = {
@@ -56,8 +60,8 @@ function setDashboardConfig() {
// 保存到服务端 // 保存到服务端
api.post('/user/config/Dashboard', data, { api.post('/user/config/Dashboard', data, {
headers: { headers: {
"Content-Type": "application/json" 'Content-Type': 'application/json',
} },
}) })
dialog.value = false dialog.value = false
} }
@@ -65,131 +69,63 @@ function setDashboardConfig() {
<template> <template>
<!-- 底部操作按钮 --> <!-- 底部操作按钮 -->
<VFab <VFab icon="mdi-view-dashboard-edit" location="bottom end" size="x-large" fixed app appear @click="dialog = true" />
icon="mdi-view-dashboard-edit"
location="bottom end"
size="x-large"
fixed
app
appear
@click="dialog = true"
/>
<VRow class="match-height"> <VRow class="match-height">
<VCol <VCol v-if="config.storage" cols="12" md="4">
v-if="config.storage"
cols="12"
md="4"
>
<AnalyticsStorage /> <AnalyticsStorage />
</VCol> </VCol>
<VCol <VCol v-if="config.mediaStatistic" cols="12" md="8">
v-if="config.mediaStatistic"
cols="12"
md="8"
>
<AnalyticsMediaStatistic /> <AnalyticsMediaStatistic />
</VCol> </VCol>
<VCol <VCol v-if="config.weeklyOverview" cols="12" md="4">
v-if="config.weeklyOverview"
cols="12"
md="4"
>
<AnalyticsWeeklyOverview /> <AnalyticsWeeklyOverview />
</VCol> </VCol>
<VCol <VCol v-if="config.speed" cols="12" md="4">
v-if="config.speed"
cols="12"
md="4"
>
<AnalyticsSpeed /> <AnalyticsSpeed />
</VCol> </VCol>
<VCol <VCol v-if="config.scheduler" cols="12" md="4">
v-if="config.scheduler"
cols="12"
md="4"
>
<AnalyticsScheduler /> <AnalyticsScheduler />
</VCol> </VCol>
<VCol <VCol v-if="config.cpu" cols="12" md="6">
v-if="config.cpu"
cols="12"
md="6"
>
<AnalyticsCpu /> <AnalyticsCpu />
</VCol> </VCol>
<VCol <VCol v-if="config.memory" cols="12" md="6">
v-if="config.memory"
cols="12"
md="6"
>
<AnalyticsMemory /> <AnalyticsMemory />
</VCol> </VCol>
<VCol <VCol v-if="config.library" cols="12">
v-if="config.library"
cols="12"
>
<MediaServerLibrary /> <MediaServerLibrary />
</VCol> </VCol>
<VCol <VCol v-if="config.playing" cols="12">
v-if="config.playing"
cols="12"
>
<MediaServerPlaying /> <MediaServerPlaying />
</VCol> </VCol>
<VCol <VCol v-if="config.latest" cols="12">
v-if="config.latest"
cols="12"
>
<MediaServerLatest /> <MediaServerLatest />
</VCol> </VCol>
</VRow> </VRow>
<!-- 弹窗根据配置生成选项 --> <!-- 弹窗根据配置生成选项 -->
<VDialog <VDialog v-model="dialog" max-width="40rem" scrollable :fullscreen="!display.mdAndUp.value">
v-model="dialog"
max-width="600"
scrollable
>
<VCard title="设置仪表板"> <VCard title="设置仪表板">
<VCardText> <VCardText>
<VRow> <VRow>
<VCol <VCol v-for="(item, key) in dashboard_names" :key="key" cols="12" md="4" sm="4">
v-for="(item, key) in dashboard_names" <VCheckbox v-model="config[key]" :label="dashboard_names[key]" />
:key="key"
cols="12"
md="4"
>
<VCheckbox
v-model="config[key]"
:label="dashboard_names[key]"
/>
</VCol> </VCol>
</VRow> </VRow>
</VCardText> </VCardText>
<VCardActions> <VCardActions>
<VBtn <VBtn color="primary" @click="dialog = false"> 取消 </VBtn>
color="primary"
@click="dialog = false"
>
取消
</VBtn>
<VSpacer /> <VSpacer />
<VBtn <VBtn color="primary" variant="tonal" @click="setDashboardConfig"> 保存 </VBtn>
color="primary"
variant="tonal"
@click="setDashboardConfig"
>
保存
</VBtn>
</VCardActions> </VCardActions>
</VCard> </VCard>
</vdialog> </VDialog>
</template> </template>

View File

@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { debounce } from 'lodash'
import { VForm } from 'vuetify/components/VForm' import { VForm } from 'vuetify/components/VForm'
import { useStore } from 'vuex' import { useStore } from 'vuex'
import { requiredValidator } from '@/@validators' import { requiredValidator } from '@/@validators'
@@ -48,9 +49,8 @@ async function fetchBackgroundImage() {
console.log(error) console.log(error)
}) })
} }
// 查询是否开启双重验证 // 查询是否开启双重验证
async function fetchOTP() { const fetchOTP = debounce(async () => {
const userid = usernameInput.value?.value const userid = usernameInput.value?.value
if (!userid) { if (!userid) {
isOTP.value = false isOTP.value = false
@@ -64,22 +64,22 @@ async function fetchOTP() {
.catch((error: any) => { .catch((error: any) => {
console.log(error) console.log(error)
}) })
} }, 500)
// 加载用户监控面板配置 // 加载用户监控面板配置
async function loadDashboardConfig() { async function loadDashboardConfig() {
const response = await api.get('/user/config/Dashboard') const response = await api.get('/user/config/Dashboard')
if (response && response.data && response.data.value) { if (response && response.data && response.data.value) {
const data = JSON.stringify(response.data.value) const data = JSON.stringify(response.data.value)
if (data != localStorage.getItem("MP_DASHBOARD")) { if (data != localStorage.getItem('MP_DASHBOARD')) {
localStorage.setItem("MP_DASHBOARD", data) localStorage.setItem('MP_DASHBOARD', data)
} }
} }
} }
// 尝试加载用户监控面板配置(本地无配置时才加载) // 尝试加载用户监控面板配置(本地无配置时才加载)
async function tryLoadDashboardConfig() { async function tryLoadDashboardConfig() {
if (localStorage.getItem("MP_DASHBOARD")) { if (localStorage.getItem('MP_DASHBOARD')) {
return return
} }
await loadDashboardConfig() await loadDashboardConfig()
@@ -128,22 +128,17 @@ function login() {
store.dispatch('auth/updateSuperUser', superuser) store.dispatch('auth/updateSuperUser', superuser)
store.dispatch('auth/updateUserName', username) store.dispatch('auth/updateUserName', username)
store.dispatch('auth/updateAvatar', avatar) store.dispatch('auth/updateAvatar', avatar)
// 登录后处理 // 登录后处理
afterLogin() afterLogin()
}) })
.catch((error: any) => { .catch((error: any) => {
// 登录失败,显示错误提示 // 登录失败,显示错误提示
if (!error.response) if (!error.response) errorMessage.value = '登录失败,请检查网络连接'
errorMessage.value = '登录失败,请检查网络连接' else if (error.response.status === 401) errorMessage.value = '登录失败,请检查用户名、密码或双重验证是否正确'
else if (error.response.status === 401) else if (error.response.status === 403) errorMessage.value = '登录失败,您没有权限访问'
errorMessage.value = '登录失败,请检查用户名、密码或双重验证是否正确' else if (error.response.status === 500) errorMessage.value = '登录失败,服务器错误'
else if (error.response.status === 403) else errorMessage.value = `登录失败 ${error.response.status},请检查用户名、密码或双重验证码是否正确`
errorMessage.value = '登录失败,您没有权限访问'
else if (error.response.status === 500)
errorMessage.value = '登录失败,服务器错误'
else
errorMessage.value = `登录失败 ${error.response.status},请检查用户名、密码或双重验证码是否正确`
}) })
} }
@@ -156,8 +151,7 @@ onMounted(() => {
// 如果token存在且保持登录状态为true则跳转到首页 // 如果token存在且保持登录状态为true则跳转到首页
if (token && remember) { if (token && remember) {
router.push('/') router.push('/')
} } else {
else {
// 获取背景图片 // 获取背景图片
fetchBackgroundImage() fetchBackgroundImage()
} }
@@ -186,16 +180,11 @@ onMounted(() => {
</div> </div>
</template> </template>
<VCardTitle class="font-weight-semibold text-2xl text-uppercase"> <VCardTitle class="font-weight-semibold text-2xl text-uppercase"> MoviePilot </VCardTitle>
MoviePilot
</VCardTitle>
</VCardItem> </VCardItem>
<VCardText> <VCardText>
<VForm <VForm ref="refForm" @submit.prevent="() => {}">
ref="refForm"
@submit.prevent="() => {}"
>
<VRow> <VRow>
<!-- username --> <!-- username -->
<VCol cols="12"> <VCol cols="12">
@@ -214,42 +203,22 @@ onMounted(() => {
v-model="form.password" v-model="form.password"
label="密码" label="密码"
:type="isPasswordVisible ? 'text' : 'password'" :type="isPasswordVisible ? 'text' : 'password'"
:append-inner-icon=" :append-inner-icon="isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
"
:rules="[requiredValidator]" :rules="[requiredValidator]"
@click:append-inner="isPasswordVisible = !isPasswordVisible" @click:append-inner="isPasswordVisible = !isPasswordVisible"
/> />
</VCol> </VCol>
<VCol cols="12"> <VCol cols="12">
<VTextField <VTextField v-if="isOTP" v-model="form.otp_password" label="双重验证码" type="input" />
v-if="isOTP"
v-model="form.otp_password"
label="双重验证码"
type="input"
/>
<!-- remember me checkbox --> <!-- remember me checkbox -->
<div class="d-flex align-center justify-space-between flex-wrap"> <div class="d-flex align-center justify-space-between flex-wrap">
<VCheckbox <VCheckbox v-model="form.remember" label="保持登录" required />
v-model="form.remember"
label="保持登录"
required
/>
</div> </div>
</VCol> </VCol>
<VCol cols="12"> <VCol cols="12">
<!-- login button --> <!-- login button -->
<VBtn <VBtn block type="submit" @click="login"> 登录 </VBtn>
block <div v-if="errorMessage" class="text-error mt-2 text-shadow">
type="submit"
@click="login"
>
登录
</VBtn>
<div
v-if="errorMessage"
class="text-error mt-2 text-shadow"
>
{{ errorMessage }} {{ errorMessage }}
</div> </div>
</VCol> </VCol>
@@ -262,7 +231,7 @@ onMounted(() => {
</template> </template>
<style lang="scss"> <style lang="scss">
@use "@core/scss/pages/page-auth.scss"; @use '@core/scss/pages/page-auth.scss';
.v-card-item__prepend { .v-card-item__prepend {
padding-inline-end: 0 !important; padding-inline-end: 0 !important;

View File

@@ -502,7 +502,7 @@ onBeforeMount(() => {
</span> </span>
</div> </div>
<div class="media-actions"> <div class="media-actions">
<VBtn v-if="mediaDetail.tmdb_id || mediaDetail.douban_id || mediaDetail.bangumi_id" variant="tonal" color="info" class="mb-2"> <VBtn v-if="(mediaDetail.tmdb_id || mediaDetail.douban_id || mediaDetail.bangumi_id) && mediaDetail.imdb_id" variant="tonal" color="info" class="mb-2">
<template #prepend> <template #prepend>
<VIcon icon="mdi-magnify" /> <VIcon icon="mdi-magnify" />
</template> </template>
@@ -528,6 +528,12 @@ onBeforeMount(() => {
</VList> </VList>
</VMenu> </VMenu>
</VBtn> </VBtn>
<VBtn v-if="(mediaDetail.tmdb_id || mediaDetail.douban_id || mediaDetail.bangumi_id) && !mediaDetail.imdb_id" variant="tonal" color="info" class="mb-2" @click="handleSearch('title')">
<template #prepend>
<VIcon icon="mdi-magnify" />
</template>
搜索资源
</VBtn>
<VBtn v-if="mediaDetail.type === '电影' || mediaDetail.douban_id || mediaDetail.bangumi_id" class="ms-2 mb-2" :color="getSubscribeColor" variant="tonal" @click="handleSubscribe(0)"> <VBtn v-if="mediaDetail.type === '电影' || mediaDetail.douban_id || mediaDetail.bangumi_id" class="ms-2 mb-2" :color="getSubscribeColor" variant="tonal" @click="handleSubscribe(0)">
<template #prepend> <template #prepend>
<VIcon :icon="getSubscribeIcon" /> <VIcon :icon="getSubscribeIcon" />

View File

@@ -6,6 +6,10 @@ import NoDataFound from '@/components/NoDataFound.vue'
import PluginAppCard from '@/components/cards/PluginAppCard.vue' import PluginAppCard from '@/components/cards/PluginAppCard.vue'
import PluginCard from '@/components/cards/PluginCard.vue' import PluginCard from '@/components/cards/PluginCard.vue'
import noImage from '@images/logos/plugin.png' import noImage from '@images/logos/plugin.png'
import { useDisplay } from 'vuetify'
// 显示器宽度
const display = useDisplay()
// 已安装插件列表 // 已安装插件列表
const dataList = ref<Plugin[]>([]) const dataList = ref<Plugin[]>([])
@@ -58,15 +62,12 @@ async function installPlugin(item: Plugin) {
progressDialog.value = true progressDialog.value = true
progressText.value = `正在安装 ${item?.plugin_name} v${item?.plugin_version} ...` progressText.value = `正在安装 ${item?.plugin_name} v${item?.plugin_version} ...`
const result: { [key: string]: any } = await api.get( const result: { [key: string]: any } = await api.get(`plugin/install/${item?.id}`, {
`plugin/install/${item?.id}`, params: {
{ repo_url: item?.repo_url,
params: { force: item?.has_update,
repo_url: item?.repo_url,
force: item?.has_update,
},
}, },
) })
// 隐藏等待提示框 // 隐藏等待提示框
progressDialog.value = false progressDialog.value = false
@@ -76,12 +77,10 @@ async function installPlugin(item: Plugin) {
// 刷新 // 刷新
refreshData() refreshData()
} } else {
else {
$toast.error(`插件 ${item?.plugin_name} 安装失败:${result.message}`) $toast.error(`插件 ${item?.plugin_name} 安装失败:${result.message}`)
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -92,8 +91,7 @@ function openPlugin(item: Plugin) {
if (item.installed === true) { if (item.installed === true) {
// 标记插件动作 // 标记插件动作
pluginActions.value[item.id || '0'] = true pluginActions.value[item.id || '0'] = true
} } else {
else {
// 如果是未安装插件则安装 // 如果是未安装插件则安装
installPlugin(item) installPlugin(item)
} }
@@ -113,8 +111,7 @@ function pluginIconError(item: Plugin) {
// 插件图标地址 // 插件图标地址
function pluginIcon(item: Plugin) { function pluginIcon(item: Plugin) {
// 如果图片加载错误 // 如果图片加载错误
if (pluginIconLoaded.value[item.id || '0'] === false) if (pluginIconLoaded.value[item.id || '0'] === false) return noImage
return noImage
// 如果是网络图片则使用代理后返回 // 如果是网络图片则使用代理后返回
if (item?.plugin_icon?.startsWith('http')) if (item?.plugin_icon?.startsWith('http'))
return `${import.meta.env.VITE_API_BASE_URL}system/img/1?imgurl=${encodeURIComponent(item?.plugin_icon)}` return `${import.meta.env.VITE_API_BASE_URL}system/img/1?imgurl=${encodeURIComponent(item?.plugin_icon)}`
@@ -145,8 +142,7 @@ async function fetchInstalledPlugins() {
}, },
}) })
isRefreshed.value = true isRefreshed.value = true
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -171,8 +167,7 @@ async function fetchUninstalledPlugins() {
} }
} }
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -181,8 +176,7 @@ async function fetchUninstalledPlugins() {
async function getPluginStatistics() { async function getPluginStatistics() {
try { try {
PluginStatistics.value = await api.get('plugin/statistic') PluginStatistics.value = await api.get('plugin/statistic')
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -196,8 +190,7 @@ function refreshData() {
// 对uninstalledList进行排序按PluginStatistics倒序 // 对uninstalledList进行排序按PluginStatistics倒序
const sortedUninstalledList = computed(() => { const sortedUninstalledList = computed(() => {
const list = uninstalledList.value.filter(item => !item.has_update) const list = uninstalledList.value.filter(item => !item.has_update)
if (PluginStatistics.value.length === 0) if (PluginStatistics.value.length === 0) return list
return list
return list.sort((a, b) => { return list.sort((a, b) => {
return PluginStatistics.value[b.id || '0'] - PluginStatistics.value[a.id || '0'] return PluginStatistics.value[b.id || '0'] - PluginStatistics.value[a.id || '0']
}) })
@@ -211,14 +204,8 @@ onBeforeMount(() => {
</script> </script>
<template> <template>
<LoadingBanner <LoadingBanner v-if="!isRefreshed" class="mt-12" />
v-if="!isRefreshed" <div v-if="dataList.length > 0" class="grid gap-4 grid-plugin-card">
class="mt-12"
/>
<div
v-if="dataList.length > 0"
class="grid gap-4 grid-plugin-card"
>
<PluginCard <PluginCard
v-for="data in dataList" v-for="data in dataList"
:key="`${data.id}_v${data.plugin_version}`" :key="`${data.id}_v${data.plugin_version}`"
@@ -237,15 +224,7 @@ onBeforeMount(() => {
error-description="点击右下角按钮前往插件市场安装插件" error-description="点击右下角按钮前往插件市场安装插件"
/> />
<!-- App市场 --> <!-- App市场 -->
<VFab <VFab icon="mdi-store-plus" location="bottom end" size="x-large" fixed app appear @click="PluginAppDialog = true" />
icon="mdi-store-plus"
location="bottom end"
size="x-large"
fixed
app
appear
@click="PluginAppDialog = true"
/>
<VDialog <VDialog
v-if="PluginAppDialog" v-if="PluginAppDialog"
v-model="PluginAppDialog" v-model="PluginAppDialog"
@@ -265,23 +244,14 @@ onBeforeMount(() => {
<VSpacer /> <VSpacer />
<VToolbarItems> <VToolbarItems>
<VBtn <VBtn size="x-large" @click="pluginDialogClose">
size="x-large" <VIcon color="white" icon="mdi-close" />
@click="pluginDialogClose"
>
<VIcon
color="white"
icon="mdi-close"
/>
</VBtn> </VBtn>
</VToolbarItems> </VToolbarItems>
</VToolbar> </VToolbar>
</div> </div>
<VCardText> <VCardText>
<LoadingBanner <LoadingBanner v-if="!isAppMarketLoaded" class="mt-12" />
v-if="!isAppMarketLoaded"
class="mt-12"
/>
<div v-if="isAppMarketLoaded" class="grid gap-4 grid-plugin-card"> <div v-if="isAppMarketLoaded" class="grid gap-4 grid-plugin-card">
<PluginAppCard <PluginAppCard
v-for="data in sortedUninstalledList" v-for="data in sortedUninstalledList"
@@ -319,12 +289,10 @@ onBeforeMount(() => {
scrollable scrollable
:z-index="1010" :z-index="1010"
max-width="40rem" max-width="40rem"
max-height="85vh" :max-height="!display.mdAndUp.value ? '' : '85vh'"
:fullscreen="!display.mdAndUp.value"
> >
<VCard <VCard class="mx-auto" width="100%">
class="mx-auto"
width="100%"
>
<VToolbar flat class="p-0"> <VToolbar flat class="p-0">
<VTextField <VTextField
v-model="keyword" v-model="keyword"
@@ -338,20 +306,12 @@ onBeforeMount(() => {
/> />
</VToolbar> </VToolbar>
<DialogCloseBtn @click="closeSearchDialog" /> <DialogCloseBtn @click="closeSearchDialog" />
<VList <VList v-if="filterPlugins.length > 0" lines="two">
v-if="filterPlugins.length > 0"
lines="two"
>
<template v-for="(item, i) in filterPlugins" :key="i"> <template v-for="(item, i) in filterPlugins" :key="i">
<VListItem <VListItem @click="openPlugin(item)">
@click="openPlugin(item)"
>
<template #prepend> <template #prepend>
<VAvatar> <VAvatar>
<VImg <VImg :src="pluginIcon(item)" @error="pluginIconError(item)">
:src="pluginIcon(item)"
@error="pluginIconError(item)"
>
<template #placeholder> <template #placeholder>
<div class="w-full h-full"> <div class="w-full h-full">
<VSkeletonLoader class="object-cover aspect-w-1 aspect-h-1" /> <VSkeletonLoader class="object-cover aspect-w-1 aspect-h-1" />
@@ -362,13 +322,7 @@ onBeforeMount(() => {
</template> </template>
<VListItemTitle> <VListItemTitle>
{{ item.plugin_name }}<span class="text-sm ms-2 mt-1 text-gray-500">v{{ item?.plugin_version }}</span> {{ item.plugin_name }}<span class="text-sm ms-2 mt-1 text-gray-500">v{{ item?.plugin_version }}</span>
<VIcon <VIcon v-if="item.installed" color="success" icon="mdi-check-circle" class="ms-2" size="small" />
v-if="item.installed"
color="success"
icon="mdi-check-circle"
class="ms-2"
size="small"
/>
</VListItemTitle> </VListItemTitle>
<VListItemSubtitle class="mt-2" v-html="item.plugin_desc" /> <VListItemSubtitle class="mt-2" v-html="item.plugin_desc" />
</VListItem> </VListItem>
@@ -377,21 +331,11 @@ onBeforeMount(() => {
</VCard> </VCard>
</VDialog> </VDialog>
<!-- 安装插件进度框 --> <!-- 安装插件进度框 -->
<VDialog <VDialog v-model="progressDialog" :scrim="false" width="25rem">
v-model="progressDialog" <VCard color="primary">
:scrim="false"
width="25rem"
>
<VCard
color="primary"
>
<VCardText class="text-center"> <VCardText class="text-center">
{{ progressText }} {{ progressText }}
<VProgressLinear <VProgressLinear indeterminate color="white" class="mb-0 mt-1" />
indeterminate
color="white"
class="mb-0 mt-1"
/>
</VCardText> </VCardText>
</VCard> </VCard>
</VDialog> </VDialog>

View File

@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { debounce } from 'lodash'
import { ref, unref } from 'vue' import { ref, unref } from 'vue'
import { useToast } from 'vue-toast-notification' import { useToast } from 'vue-toast-notification'
import api from '@/api' import api from '@/api'
@@ -28,27 +29,27 @@ const headers = [
{ {
title: '标题', title: '标题',
key: 'title', key: 'title',
sortable: false, sortable: true,
}, },
{ {
title: '目录', title: '目录',
key: 'src', key: 'src',
sortable: false, sortable: true,
}, },
{ {
title: '转移方式', title: '转移方式',
key: 'mode', key: 'mode',
sortable: false, sortable: true,
}, },
{ {
title: '时间', title: '时间',
key: 'date', key: 'date',
sortable: false, sortable: true,
}, },
{ {
title: '状态', title: '状态',
key: 'status', key: 'status',
sortable: false, sortable: true,
}, },
{ {
title: '', title: '',
@@ -58,11 +59,13 @@ const headers = [
] ]
const pageRange = [ const pageRange = [
{title: '25', value: 25}, { title: '25', value: 25 },
{title: '50', value: 50}, { title: '50', value: 50 },
{title: '100', value: 100}, { title: '100', value: 100 },
{title: '1000', value: 1000}, { title: '500', value: 500 },
{title: 'All', value: -1}] { title: '1000', value: 1000 },
{ title: 'All', value: -1 },
]
// 数据列表 // 数据列表
const dataList = ref<TransferHistory[]>([]) const dataList = ref<TransferHistory[]>([])
@@ -112,30 +115,32 @@ const TransferDict: { [key: string]: string } = {
// 分页提示 // 分页提示
const pageTip = computed(() => { const pageTip = computed(() => {
const begin = unref(itemsPerPage) * (unref(currentPage) - 1) + 1 const begin = unref(itemsPerPage) * (unref(currentPage) - 1) + 1
const end = unref(itemsPerPage) * unref(currentPage) === -1 ? 'ALL' : unref(itemsPerPage) * unref(currentPage) const end = unref(itemsPerPage) * unref(currentPage) === -1 ? 'ALL' : unref(itemsPerPage) * unref(currentPage)
return { return {
begin, begin,
end end,
} }
}) })
// 分页总数 // 分页总数
const totalPage = computed(() => { const totalPage = computed(() => {
const total = Math.ceil(unref(totalItems) /unref(itemsPerPage)) const total = Math.ceil(unref(totalItems) / unref(itemsPerPage))
return total return total
}) })
// 切换页签和搜索词 // 切换页签和搜索词
watch( watch(
[() => currentPage.value, () => itemsPerPage.value, () => search.value], [() => currentPage.value, () => itemsPerPage.value, () => search.value],
async () => { debounce(async () => {
await fetchData() await fetchData()
}) }, 1000),
)
// 获取订阅列表数据 // 获取订阅列表数据
async function fetchData(page = currentPage.value, count = itemsPerPage.value) { async function fetchData(page = currentPage.value, count = itemsPerPage.value) {
loading.value = true loading.value = true
try { try {
const result: { [key: string]: any } = await api.get('history/transfer', { const result: { [key: string]: any } = await api.get('history/transfer', {
params: { params: {
@@ -150,8 +155,7 @@ async function fetchData(page = currentPage.value, count = itemsPerPage.value) {
searchHintList.value = ['失败', '成功', ...new Set(dataList.value.map(item => item.title || ''))].filter( searchHintList.value = ['失败', '成功', ...new Set(dataList.value.map(item => item.title || ''))].filter(
title => title !== '', title => title !== '',
) )
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
loading.value = false loading.value = false
@@ -159,12 +163,9 @@ async function fetchData(page = currentPage.value, count = itemsPerPage.value) {
// 根据 type 返回不同的图标 // 根据 type 返回不同的图标
function getIcon(type: string) { function getIcon(type: string) {
if (type === '电影') if (type === '电影') return 'mdi-movie'
return 'mdi-movie' else if (type === '电视剧') return 'mdi-television-classic'
else if (type === '电视剧') else return 'mdi-help-circle'
return 'mdi-television-classic'
else
return 'mdi-help-circle'
} }
// 删除历史记录 // 删除历史记录
@@ -184,10 +185,8 @@ async function remove(item: TransferHistory, deleteSrc: boolean, deleteDest: boo
data: item, data: item,
}) })
if (!result.success) if (!result.success) $toast.error(`删除失败: ${result.msg}`)
$toast.error(`删除失败: ${result.msg}`) } catch (error) {
}
catch (error) {
console.error(error) console.error(error)
} }
} }
@@ -196,8 +195,7 @@ async function remove(item: TransferHistory, deleteSrc: boolean, deleteDest: boo
async function removeSingle(deleteSrc: boolean, deleteDest: boolean) { async function removeSingle(deleteSrc: boolean, deleteDest: boolean) {
// 关闭弹窗 // 关闭弹窗
deleteConfirmDialog.value = false deleteConfirmDialog.value = false
if (!currentHistory.value) if (!currentHistory.value) return
return
// 删除 // 删除
await remove(currentHistory.value, deleteSrc, deleteDest) await remove(currentHistory.value, deleteSrc, deleteDest)
@@ -211,8 +209,7 @@ async function removeBatch(deleteSrc: boolean, deleteDest: boolean) {
deleteConfirmDialog.value = false deleteConfirmDialog.value = false
// 总条数 // 总条数
const total = selected.value.length const total = selected.value.length
if (total === 0) if (total === 0) return
return
// 已处理条数 // 已处理条数
let handled = 0 let handled = 0
@@ -237,16 +234,13 @@ async function removeBatch(deleteSrc: boolean, deleteDest: boolean) {
// 响应删除操作 // 响应删除操作
async function deleteConfirmHandler(deleteSrc: boolean, deleteDest: boolean) { async function deleteConfirmHandler(deleteSrc: boolean, deleteDest: boolean) {
if (currentHistory.value) if (currentHistory.value) await removeSingle(deleteSrc, deleteDest)
await removeSingle(deleteSrc, deleteDest) else await removeBatch(deleteSrc, deleteDest)
else
await removeBatch(deleteSrc, deleteDest)
} }
// 批量删除历史记录 // 批量删除历史记录
async function removeHistoryBatch() { async function removeHistoryBatch() {
if (selected.value.length === 0) if (selected.value.length === 0) return
return
// 清空当前操作记录 // 清空当前操作记录
currentHistory.value = undefined currentHistory.value = undefined
@@ -257,26 +251,20 @@ async function removeHistoryBatch() {
// 计算根路径 // 计算根路径
function getRootPath(path: string, type: string, category: string) { function getRootPath(path: string, type: string, category: string) {
if (!path) if (!path) return ''
return ''
let index = -2 let index = -2
if (type !== '电影') if (type !== '电影') index = -3
index = -3
if (category) if (category) index -= 1
index -= 1
if (path.includes('/')) if (path.includes('/')) return path.split('/').slice(0, index).join('/')
return path.split('/').slice(0, index).join('/') else return path.split('\\').slice(0, index).join('\\')
else
return path.split('\\').slice(0, index).join('\\')
} }
// 批量重新整理 // 批量重新整理
async function retransferBatch() { async function retransferBatch() {
if (selected.value.length === 0) if (selected.value.length === 0) return
return
// 清空当前操作记录 // 清空当前操作记录
currentHistory.value = undefined currentHistory.value = undefined
@@ -292,8 +280,7 @@ async function retransferBatch() {
const category = selected.value[0].category ?? '' const category = selected.value[0].category ?? ''
// 计算根路径 // 计算根路径
redoTarget.value = getRootPath(dest, mediaType, category) redoTarget.value = getRootPath(dest, mediaType, category)
} } else {
else {
redoTarget.value = '' redoTarget.value = ''
} }
// 打开识别弹窗 // 打开识别弹窗
@@ -329,7 +316,6 @@ const dropdownItems = ref([
// 初始加载数据 // 初始加载数据
onMounted(fetchData) onMounted(fetchData)
</script> </script>
<template> <template>
@@ -337,9 +323,7 @@ onMounted(fetchData)
<VCardItem> <VCardItem>
<VCardTitle> <VCardTitle>
<VRow> <VRow>
<VCol cols="4" md="6"> <VCol cols="4" md="6"> 历史记录 </VCol>
历史记录
</VCol>
<VCol cols="8" md="6" class="flex"> <VCol cols="8" md="6" class="flex">
<VCombobox <VCombobox
key="search_navbar" key="search_navbar"
@@ -389,7 +373,7 @@ onMounted(fetchData)
</div> </div>
</template> </template>
<template #item.src="{ item }"> <template #item.src="{ item }">
<small>{{ item?.src }} <br>=> {{ item?.dest }}</small> <small>{{ item?.src }} <br />=> {{ item?.dest }}</small>
</template> </template>
<template #item.mode="{ item }"> <template #item.mode="{ item }">
<VChip variant="outlined" color="primary" size="small"> <VChip variant="outlined" color="primary" size="small">
@@ -397,14 +381,10 @@ onMounted(fetchData)
</VChip> </VChip>
</template> </template>
<template #item.status="{ item }"> <template #item.status="{ item }">
<VChip v-if="item?.status" color="success" size="small"> <VChip v-if="item?.status" color="success" size="small"> 成功 </VChip>
成功
</VChip>
<v-tooltip v-else :text="item?.errmsg"> <v-tooltip v-else :text="item?.errmsg">
<template #activator="{ props }"> <template #activator="{ props }">
<VChip v-bind="props" color="error" size="small"> <VChip v-bind="props" color="error" size="small"> 失败 </VChip>
失败
</VChip>
</template> </template>
</v-tooltip> </v-tooltip>
</template> </template>
@@ -432,22 +412,13 @@ onMounted(fetchData)
</VMenu> </VMenu>
</IconBtn> </IconBtn>
</template> </template>
<template #no-data> <template #no-data> 没有数据 </template>
没有数据
</template>
</VDataTableVirtual> </VDataTableVirtual>
<div class="flex items-center justify-end"> <div class="flex items-center justify-end">
<div class="w-auto"> <div class="w-auto">
<VSelect <VSelect v-model="itemsPerPage" :items="pageRange" density="compact" variant="solo" flat />
v-model="itemsPerPage"
:items="pageRange"
density="compact"
variant="solo"
flat
size="small"
/>
</div> </div>
<div class="w-auto text-sm">{{pageTip.begin}}-{{pageTip.end}} / {{totalItems}}</div> <div class="w-auto text-sm">{{ pageTip.begin }}-{{ pageTip.end }} / {{ totalItems }}</div>
<VPagination <VPagination
v-model="currentPage" v-model="currentPage"
show-first-last-page show-first-last-page
@@ -466,12 +437,8 @@ onMounted(fetchData)
{{ confirmTitle }} {{ confirmTitle }}
</VCardTitle> </VCardTitle>
<div class="d-flex flex-column flex-lg-row justify-center my-3"> <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 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>
<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 color="info" class="mb-2 mx-2" @click="deleteConfirmHandler(false, true)">
删除历史记录和媒体库文件 删除历史记录和媒体库文件
</VBtn> </VBtn>

View File

@@ -30,13 +30,10 @@ function showReleaseDialog(title: string, body: string) {
// 查询系统环境变量 // 查询系统环境变量
async function querySystemEnv() { async function querySystemEnv() {
try { try {
const result: { [key: string]: any } = await api.get( const result: { [key: string]: any } = await api.get('system/env')
'system/env',
)
systemEnv.value = result.data systemEnv.value = result.data
} } catch (error) {
catch (error) {
console.log(error) console.log(error)
} }
} }
@@ -44,17 +41,13 @@ async function querySystemEnv() {
// 查询所有Release // 查询所有Release
async function queryAllRelease() { async function queryAllRelease() {
try { try {
const result: { [key: string]: any } = await api.get( const result: { [key: string]: any } = await api.get('system/versions')
'system/versions',
)
allRelease.value = result.data ?? [] allRelease.value = result.data ?? []
// 最新版本 // 最新版本
if (allRelease.value.length > 0) if (allRelease.value.length > 0) latestRelease.value = allRelease.value[0].tag_name
latestRelease.value = allRelease.value[0].tag_name } catch (error) {
}
catch (error) {
console.log(error) console.log(error)
} }
} }
@@ -75,22 +68,25 @@ onMounted(() => {
<div class="px-3"> <div class="px-3">
<div class="section"> <div class="section">
<div> <div>
<h3 class="heading"> <h3 class="heading">关于 MoviePilot</h3>
关于 MoviePilot
</h3>
</div> </div>
<div class="section border-t border-gray-800"> <div class="section border-t border-gray-800">
<dl> <dl>
<div> <div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">软件版本</dt>
软件版本
</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0"> <dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow flex flex-row items-center truncate"> <span class="flex-grow flex flex-row items-center truncate">
<code class="truncate">{{ systemEnv.VERSION }}</code> <code class="truncate">{{ systemEnv.VERSION }}</code>
<a v-if="latestRelease === systemEnv.VERSION" href="https://github.com/jxxghp/MoviePilot/releases" target="_blank" rel="noopener noreferrer"> <a
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap bg-green-500 bg-opacity-80 border border-green-500 !text-green-100 ml-2 !cursor-pointer transition hover:bg-green-400"> v-if="latestRelease === systemEnv.VERSION"
href="https://github.com/jxxghp/MoviePilot/releases"
target="_blank"
rel="noopener noreferrer"
>
<span
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap bg-green-500 bg-opacity-80 border border-green-500 !text-green-100 ml-2 !cursor-pointer transition hover:bg-green-400"
>
最新 最新
</span> </span>
</a> </a>
@@ -98,11 +94,19 @@ onMounted(() => {
</dd> </dd>
</div> </div>
</div> </div>
<div v-if="systemEnv.FRONTEND_VERSION">
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold">前端版本</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow flex flex-row items-center truncate">
<code class="truncate">{{ systemEnv.FRONTEND_VERSION }}</code>
</span>
</dd>
</div>
</div>
<div> <div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">认证资源版本</dt>
认证资源版本
</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0"> <dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow flex flex-row items-center truncate"> <span class="flex-grow flex flex-row items-center truncate">
<code class="truncate">{{ systemEnv.AUTH_VERSION }}</code> <code class="truncate">{{ systemEnv.AUTH_VERSION }}</code>
@@ -112,9 +116,7 @@ onMounted(() => {
</div> </div>
<div> <div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">站点资源版本</dt>
站点资源版本
</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0"> <dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow flex flex-row items-center truncate"> <span class="flex-grow flex flex-row items-center truncate">
<code class="truncate">{{ systemEnv.INDEXER_VERSION }}</code> <code class="truncate">{{ systemEnv.INDEXER_VERSION }}</code>
@@ -124,9 +126,7 @@ onMounted(() => {
</div> </div>
<div> <div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">配置目录</dt>
配置目录
</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0"> <dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow undefined"> <span class="flex-grow undefined">
<code>{{ systemEnv.CONFIG_DIR }}</code> <code>{{ systemEnv.CONFIG_DIR }}</code>
@@ -134,9 +134,7 @@ onMounted(() => {
</dd> </dd>
</div> </div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">数据目录</dt>
数据目录
</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0"> <dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow undefined"><code>/moviepilot</code></span> <span class="flex-grow undefined"><code>/moviepilot</code></span>
</dd> </dd>
@@ -144,9 +142,7 @@ onMounted(() => {
</div> </div>
<div> <div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">时区</dt>
时区
</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0"> <dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow undefined"> <span class="flex-grow undefined">
<code>{{ systemEnv.TZ }}</code> <code>{{ systemEnv.TZ }}</code>
@@ -159,44 +155,55 @@ onMounted(() => {
</div> </div>
<div class="section"> <div class="section">
<div> <div>
<h3 class="heading"> <h3 class="heading">支援</h3>
支援
</h3>
</div> </div>
<div class="section border-t border-gray-800"> <div class="section border-t border-gray-800">
<dl> <dl>
<div> <div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">文档</dt>
文档 <dd class="flex text-sm sm:col-span-2 sm:mt-0">
</dt><dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow undefined"> <span class="flex-grow undefined">
<a href="https://github.com/jxxghp/MoviePilot/blob/main/README.md" target="_blank" rel="noreferrer" class="text-indigo-500 transition duration-300 hover:underline"> <a
href="https://github.com/jxxghp/MoviePilot/blob/main/README.md"
target="_blank"
rel="noreferrer"
class="text-indigo-500 transition duration-300 hover:underline"
>
https://github.com/jxxghp/MoviePilot/blob/main/README.md https://github.com/jxxghp/MoviePilot/blob/main/README.md
</a> </a>
</span> </span>
</dd> </dd>
</div> </div>
</div><div> </div>
<div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">问题反馈</dt>
问题反馈 <dd class="flex text-sm sm:col-span-2 sm:mt-0">
</dt><dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow undefined"> <span class="flex-grow undefined">
<a href="https://github.com/jxxghp/MoviePilot/issues/new/choose" target="_blank" rel="noreferrer" class="text-indigo-500 transition duration-300 hover:underline"> <a
href="https://github.com/jxxghp/MoviePilot/issues/new/choose"
target="_blank"
rel="noreferrer"
class="text-indigo-500 transition duration-300 hover:underline"
>
https://github.com/jxxghp/MoviePilot/issues/new/choose https://github.com/jxxghp/MoviePilot/issues/new/choose
</a> </a>
</span> </span>
</dd> </dd>
</div> </div>
</div><div> </div>
<div>
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4"> <div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold"> <dt class="block text-sm font-bold">发布频道</dt>
发布频道
</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0"> <dd class="flex text-sm sm:col-span-2 sm:mt-0">
<span class="flex-grow undefined"> <span class="flex-grow undefined">
<a href="https://t.me/moviepilot_channel" target="_blank" rel="noreferrer" class="text-indigo-500 transition duration-300 hover:underline"> <a
href="https://t.me/moviepilot_channel"
target="_blank"
rel="noreferrer"
class="text-indigo-500 transition duration-300 hover:underline"
>
https://t.me/moviepilot_channel https://t.me/moviepilot_channel
</a> </a>
</span> </span>
@@ -208,21 +215,31 @@ onMounted(() => {
</div> </div>
<div class="section"> <div class="section">
<div> <div>
<h3 class="heading"> <h3 class="heading">软件版本</h3>
软件版本
</h3>
<div class="section space-y-3"> <div class="section space-y-3">
<div> <div>
<div v-for="release in allRelease" :key="release.tag_name" class="mb-3 flex w-full flex-col space-y-3 rounded-md px-4 py-2 shadow-md ring-1 ring-gray-400 sm:flex-row sm:space-y-0 sm:space-x-3"> <div
v-for="release in allRelease"
:key="release.tag_name"
class="mb-3 flex w-full flex-col space-y-3 rounded-md px-4 py-2 shadow-md ring-1 ring-gray-400 sm:flex-row sm:space-y-0 sm:space-x-3"
>
<div class="flex w-full flex-grow items-center justify-start space-x-2 truncate sm:justify-start"> <div class="flex w-full flex-grow items-center justify-start space-x-2 truncate sm:justify-start">
<span class="truncate text-lg font-bold"> <span class="truncate text-lg font-bold">
<span class="mr-2 whitespace-nowrap text-xs font-normal">{{ releaseTime(release.published_at) }}</span> <span class="mr-2 whitespace-nowrap text-xs font-normal">{{
releaseTime(release.published_at)
}}</span>
{{ release.tag_name }} {{ release.tag_name }}
</span> </span>
<span v-if="release.tag_name === latestRelease" class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap cursor-default bg-green-500 bg-opacity-80 border border-green-500 !text-green-100"> <span
v-if="release.tag_name === latestRelease"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap cursor-default bg-green-500 bg-opacity-80 border border-green-500 !text-green-100"
>
最新软件版本 最新软件版本
</span> </span>
<span v-if="release.tag_name === systemEnv.VERSION" class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap cursor-default bg-indigo-500 bg-opacity-80 border border-indigo-500 !text-indigo-100"> <span
v-if="release.tag_name === systemEnv.VERSION"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full whitespace-nowrap cursor-default bg-indigo-500 bg-opacity-80 border border-indigo-500 !text-indigo-100"
>
当前版本 当前版本
</span> </span>
</div> </div>

View File

@@ -252,362 +252,364 @@ onMounted(() => {
</script> </script>
<template> <template>
<VRow> <div>
<VCol cols="12"> <VRow>
<VCard title="个人信息"> <VCol cols="12">
<VCardText class="d-flex"> <VCard title="个人信息">
<!-- 👉 Avatar --> <VCardText class="d-flex">
<VAvatar <!-- 👉 Avatar -->
rounded="lg" <VAvatar
size="100" rounded="lg"
class="me-6" size="100"
:image="accountInfo.avatar" class="me-6"
/> :image="accountInfo.avatar"
/>
<!-- 👉 Upload Photo --> <!-- 👉 Upload Photo -->
<form class="d-flex flex-column justify-center gap-5"> <form class="d-flex flex-column justify-center gap-5">
<div class="d-flex flex-wrap gap-2"> <div class="d-flex flex-wrap gap-2">
<VBtn <VBtn
color="primary" color="primary"
@click="refInputEl?.click()" @click="refInputEl?.click()"
> >
<VIcon <VIcon
icon="mdi-cloud-upload-outline" icon="mdi-cloud-upload-outline"
/> />
<span class="d-none d-sm-block ms-2">上传头像</span> <span class="d-none d-sm-block ms-2">上传头像</span>
</VBtn>
<input
ref="refInputEl"
type="file"
name="file"
accept=".jpeg,.png,.jpg,GIF"
hidden
@input="changeAvatar"
>
<VBtn
type="reset"
color="error"
variant="tonal"
@click="resetAvatar"
>
<VIcon
icon="mdi-refresh"
/>
<span class="d-none d-sm-block ms-2">重置</span>
</VBtn>
<VBtn
:color="accountInfo.is_otp ? 'error' : 'info'"
variant="tonal"
@click.stop="accountInfo.is_otp ? disableOtp() : getOtpUri()"
>
<VIcon
icon="mdi-account-key"
/>
<span class="d-none d-sm-block ms-2">{{ accountInfo.is_otp ? "关闭验证" : "双重验证" }}</span>
</VBtn>
</div>
<p class="text-body-1 mb-0">
允许 JPGGIF PNG 格式 最大尺寸 800K
</p>
</form>
</VCardText>
<VDivider />
<VCardText>
<!-- 👉 Form -->
<VForm class="mt-6">
<VRow>
<!-- 👉 Name -->
<VCol
md="6"
cols="12"
>
<VTextField
v-model="accountInfo.name"
readonly
label="用户名"
/>
</VCol>
<!-- 👉 Email -->
<VCol
cols="12"
md="6"
>
<VTextField
v-model="accountInfo.email"
label="邮箱"
type="email"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<!-- 👉 new password -->
<VTextField
v-model="newPassword"
:type="isNewPasswordVisible ? 'text' : 'password'"
:append-inner-icon="isNewPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
label="新密码"
autocomplete=""
@click:append-inner="isNewPasswordVisible = !isNewPasswordVisible"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<!-- 👉 confirm password -->
<VTextField
v-model="confirmPassword"
:type="isConfirmPasswordVisible ? 'text' : 'password'"
:append-inner-icon="
isConfirmPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
"
label="确认新密码"
@click:append-inner="
isConfirmPasswordVisible = !isConfirmPasswordVisible
"
/>
</VCol>
<!-- 👉 Form Actions -->
<VCol
cols="12"
class="d-flex flex-wrap gap-4"
>
<VBtn @click="saveAccountInfo">
保存
</VBtn> </VBtn>
<input
ref="refInputEl"
type="file"
name="file"
accept=".jpeg,.png,.jpg,GIF"
hidden
@input="changeAvatar"
>
<VBtn
type="reset"
color="error"
variant="tonal"
@click="resetAvatar"
>
<VIcon
icon="mdi-refresh"
/>
<span class="d-none d-sm-block ms-2">重置</span>
</VBtn>
<VBtn
:color="accountInfo.is_otp ? 'error' : 'info'"
variant="tonal"
@click.stop="accountInfo.is_otp ? disableOtp() : getOtpUri()"
>
<VIcon
icon="mdi-account-key"
/>
<span class="d-none d-sm-block ms-2">{{ accountInfo.is_otp ? "关闭验证" : "双重验证" }}</span>
</VBtn>
</div>
<p class="text-body-1 mb-0">
允许 JPGGIF PNG 格式 最大尺寸 800K
</p>
</form>
</VCardText>
<VDivider />
<VCardText>
<!-- 👉 Form -->
<VForm class="mt-6">
<VRow>
<!-- 👉 Name -->
<VCol
md="6"
cols="12"
>
<VTextField
v-model="accountInfo.name"
readonly
label="用户名"
/>
</VCol>
<!-- 👉 Email -->
<VCol
cols="12"
md="6"
>
<VTextField
v-model="accountInfo.email"
label="邮箱"
type="email"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<!-- 👉 new password -->
<VTextField
v-model="newPassword"
:type="isNewPasswordVisible ? 'text' : 'password'"
:append-inner-icon="isNewPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
label="新密码"
autocomplete=""
@click:append-inner="isNewPasswordVisible = !isNewPasswordVisible"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<!-- 👉 confirm password -->
<VTextField
v-model="confirmPassword"
:type="isConfirmPasswordVisible ? 'text' : 'password'"
:append-inner-icon="
isConfirmPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
"
label="确认新密码"
@click:append-inner="
isConfirmPasswordVisible = !isConfirmPasswordVisible
"
/>
</VCol>
<!-- 👉 Form Actions -->
<VCol
cols="12"
class="d-flex flex-wrap gap-4"
>
<VBtn @click="saveAccountInfo">
保存
</VBtn>
</VCol>
</VRow>
</VForm>
</VCardText>
</VCard>
</VCol>
<VCol
v-if="accountInfo.is_superuser"
cols="12"
>
<!-- 👉 Accounts -->
<VCard title="所有用户">
<template #append>
<IconBtn @click.stop="addUserDialog = true">
<VIcon icon="mdi-plus" />
</IconBtn>
</template>
<VTable class="text-no-wrap">
<thead>
<tr>
<th scope="col">
用户名
</th>
<th scope="col">
邮箱
</th>
<th scope="col">
状态
</th>
<th scope="col">
管理员
</th>
<th
scope="col"
class="w-5"
/>
</tr>
</thead>
<tbody>
<tr
v-for="user in allUsers"
:key="user.name"
>
<td>
{{ user.name }}
</td>
<td>{{ user.email }}</td>
<td>
<VChip
v-if="user.is_active"
color="success"
text-color="white"
>
激活
</VChip>
<VChip
v-else
color="error"
text-color="white"
>
冻结
</VChip>
</td>
<td>{{ user.is_superuser ? "是" : "否" }}</td>
<td>
<IconBtn v-show="accountInfo.is_superuser && accountInfo.name !== user.name">
<VIcon icon="mdi-dots-vertical" />
<VMenu
activator="parent"
close-on-content-click
>
<VList>
<VListItem
variant="plain"
@click="deactivateUser(user)"
>
<template #prepend>
<VIcon icon="mdi-lock" />
</template>
<VListItemTitle>
{{
user.is_active ? "冻结" : "解冻"
}}
</VListItemTitle>
</VListItem>
<VListItem
variant="plain"
base-color="error"
@click="deleteUser(user)"
>
<template #prepend>
<VIcon icon="mdi-delete" />
</template>
<VListItemTitle>删除</VListItemTitle>
</VListItem>
</VList>
</VMenu>
</IconBtn>
</td>
</tr>
</tbody>
</VTable>
</VCard>
</VCol>
</VRow>
<!-- =弹窗 -->
<VDialog
v-model="addUserDialog"
max-width="50rem"
persistent
z-index="1010"
>
<!-- Dialog Content -->
<VCard title="新增用户">
<VCardText>
<VForm @submit.prevent="() => {}">
<VRow>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="userForm.name"
label="用户名"
:rules="[requiredValidator]"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="userForm.password"
label="密码"
:rules="[requiredValidator]"
:type="isPasswordVisible ? 'text' : 'password'"
:append-inner-icon="
isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
"
@click:append-inner="isPasswordVisible = !isPasswordVisible"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="userForm.email"
:rules="[requiredValidator]"
label="邮箱"
/>
</VCol> </VCol>
</VRow> </VRow>
</VForm> </VForm>
</VCardText> </VCardText>
<VCardActions>
<VBtn @click="addUserDialog = false">
取消
</VBtn>
<VSpacer />
<VBtn @click="addUser">
确定
</VBtn>
</VCardActions>
</VCard> </VCard>
</VCol> </VDialog>
<VCol <!-- 双重验证弹窗 -->
v-if="accountInfo.is_superuser" <VDialog
cols="12" v-model="otpDialog"
max-width="45rem"
persistent
z-index="1010"
> >
<!-- 👉 Accounts --> <!-- 开启双重验证弹窗内容 -->
<VCard title="所有用户"> <VCard>
<template #append> <DialogCloseBtn @click="otpDialog = false" />
<IconBtn @click.stop="addUserDialog = true"> <VCardText>
<VIcon icon="mdi-plus" /> <h4 class="text-h4 text-center mb-6 mt-5">
</IconBtn> 登录双重验证
</template> </h4><h5 class="text-h5 font-weight-medium mb-2">
<VTable class="text-no-wrap"> 身份验证器
<thead> </h5>
<tr> <p class="mb-6">
<th scope="col"> 使用像Google AuthenticatorMicrosoft AuthenticatorAuthy或1Password这样的身份验证器应用程序扫描二维码它将为您生成一个6位数的代码供您在下方输入
用户名 </p>
</th> <div class="my-6">
<th scope="col"> <QrcodeVue class="mx-auto" :value="qrCode" :size="200" max-width="25rem" />
邮箱
</th>
<th scope="col">
状态
</th>
<th scope="col">
管理员
</th>
<th
scope="col"
class="w-5"
/>
</tr>
</thead>
<tbody>
<tr
v-for="user in allUsers"
:key="user.name"
>
<td>
{{ user.name }}
</td>
<td>{{ user.email }}</td>
<td>
<VChip
v-if="user.is_active"
color="success"
text-color="white"
>
激活
</VChip>
<VChip
v-else
color="error"
text-color="white"
>
冻结
</VChip>
</td>
<td>{{ user.is_superuser ? "是" : "否" }}</td>
<td>
<IconBtn v-show="accountInfo.is_superuser && accountInfo.name !== user.name">
<VIcon icon="mdi-dots-vertical" />
<VMenu
activator="parent"
close-on-content-click
>
<VList>
<VListItem
variant="plain"
@click="deactivateUser(user)"
>
<template #prepend>
<VIcon icon="mdi-lock" />
</template>
<VListItemTitle>
{{
user.is_active ? "冻结" : "解冻"
}}
</VListItemTitle>
</VListItem>
<VListItem
variant="plain"
base-color="error"
@click="deleteUser(user)"
>
<template #prepend>
<VIcon icon="mdi-delete" />
</template>
<VListItemTitle>删除</VListItemTitle>
</VListItem>
</VList>
</VMenu>
</IconBtn>
</td>
</tr>
</tbody>
</VTable>
</VCard>
</VCol>
</VRow>
<!-- =弹窗 -->
<VDialog
v-model="addUserDialog"
max-width="50rem"
persistent
z-index="1010"
>
<!-- Dialog Content -->
<VCard title="新增用户">
<VCardText>
<VForm @submit.prevent="() => {}">
<VRow>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="userForm.name"
label="用户名"
:rules="[requiredValidator]"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="userForm.password"
label="密码"
:rules="[requiredValidator]"
:type="isPasswordVisible ? 'text' : 'password'"
:append-inner-icon="
isPasswordVisible ? 'mdi-eye-off-outline' : 'mdi-eye-outline'
"
@click:append-inner="isPasswordVisible = !isPasswordVisible"
/>
</VCol>
<VCol
cols="12"
md="6"
>
<VTextField
v-model="userForm.email"
:rules="[requiredValidator]"
label="邮箱"
/>
</VCol>
</VRow>
</VForm>
</VCardText>
<VCardActions>
<VBtn @click="addUserDialog = false">
取消
</VBtn>
<VSpacer />
<VBtn @click="addUser">
确定
</VBtn>
</VCardActions>
</VCard>
</VDialog>
<!-- 双重验证弹窗 -->
<VDialog
v-model="otpDialog"
max-width="45rem"
persistent
z-index="1010"
>
<!-- 开启双重验证弹窗内容 -->
<VCard>
<DialogCloseBtn @click="otpDialog = false" />
<VCardText>
<h4 class="text-h4 text-center mb-6 mt-5">
登录双重验证
</h4><h5 class="text-h5 font-weight-medium mb-2">
身份验证器
</h5>
<p class="mb-6">
使用像Google AuthenticatorMicrosoft AuthenticatorAuthy或1Password这样的身份验证器应用程序扫描二维码它将为您生成一个6位数的代码供您在下方输入
</p>
<div class="my-6">
<QrcodeVue class="mx-auto" :value="qrCode" :size="200" max-width="25rem" />
</div>
<VAlert
:title="secret"
variant="tonal"
type="warning"
class="my-4"
text="如果您在使用二维码时遇到困难,请在您的应用程序中选择手动输入以上代码。"
>
<template #prepend />
</VAlert>
<VForm>
<VTextField
v-model="otpPassword"
type="text"
label="输入验证码以确认开启双重验证"
autocomplete=""
class="mb-8"
variant="outlined"
/>
<div class="d-flex justify-end flex-wrap gap-4">
<VBtn variant="outlined" color="secondary" @click="otpDialog = false">
取消
</VBtn>
<VBtn @click="judgeOtpPassword">
确定
<template #append>
<VIcon icon="mdi-check" />
</template>
</VBtn>
</div> </div>
</VForm> <VAlert
</VCardText> :title="secret"
</VCard> variant="tonal"
</VDialog> type="warning"
class="my-4"
text="如果您在使用二维码时遇到困难,请在您的应用程序中选择手动输入以上代码。"
>
<template #prepend />
</VAlert>
<VForm>
<VTextField
v-model="otpPassword"
type="text"
label="输入验证码以确认开启双重验证"
autocomplete=""
class="mb-8"
variant="outlined"
/>
<div class="d-flex justify-end flex-wrap gap-4">
<VBtn variant="outlined" color="secondary" @click="otpDialog = false">
取消
</VBtn>
<VBtn @click="judgeOtpPassword">
确定
<template #append>
<VIcon icon="mdi-check" />
</template>
</VBtn>
</div>
</VForm>
</VCardText>
</VCard>
</VDialog>
</div>
</template> </template>

View File

@@ -32,26 +32,22 @@ async function moduleTest(index: number) {
if (result.success) { if (result.success) {
target.state = 'success' target.state = 'success'
target.name = `${target.name} - 正常` target.name = `${target.name} - 正常`
} } else if (result.message?.includes('模块未加载')) {
else if (result.message?.includes('模块未加载')) {
target.state = '' target.state = ''
target.name = `${target.name} - 未启用` target.name = `${target.name} - 未启用`
} } else {
else {
target.state = 'error' target.state = 'error'
target.name = `${target.name} - 错误!` target.name = `${target.name} - 错误!`
target.errmsg = result.message target.errmsg = result.message
} }
} } catch (error) {
catch (error) {
console.error(error) console.error(error)
} }
} }
// 加载 // 加载
onMounted(async () => { onMounted(async () => {
// 逐个检查所有模块 // 逐个检查所有模块
for (let i = 0; i < modules.value.length; i++) for (let i = 0; i < modules.value.length; i++) await moduleTest(i)
await moduleTest(i)
}) })
</script> </script>
@@ -66,10 +62,7 @@ onMounted(async () => {
> >
{{ module.errmsg }} {{ module.errmsg }}
<template #append> <template #append>
<VProgressCircular <VProgressCircular v-if="module.loading" indeterminate />
v-if="module.loading"
indeterminate
/>
</template> </template>
</VAlert> </VAlert>
</template> </template>