mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 00:36:41 +08:00
feat 过滤规则测试
This commit is contained in:
@@ -407,7 +407,6 @@ onMounted(() => {
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="nameTestResult?.media_info?.poster_path"
|
v-if="nameTestResult?.media_info?.poster_path"
|
||||||
class="ma-auto"
|
|
||||||
>
|
>
|
||||||
<VImg
|
<VImg
|
||||||
width="10rem"
|
width="10rem"
|
||||||
@@ -424,7 +423,7 @@ onMounted(() => {
|
|||||||
</VImg>
|
</VImg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-start">
|
<div class="text-start grow">
|
||||||
<VCardItem class="pb-1">
|
<VCardItem class="pb-1">
|
||||||
<VCardTitle>
|
<VCardTitle>
|
||||||
{{ nameTestResult?.media_info?.title || nameTestResult?.meta_info?.name }}
|
{{ nameTestResult?.media_info?.title || nameTestResult?.meta_info?.name }}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import NameTestView from '@/views/system/NameTestView.vue'
|
import NameTestView from '@/views/system/NameTestView.vue'
|
||||||
import NetTestView from '@/views/system/NetTestView.vue'
|
import NetTestView from '@/views/system/NetTestView.vue'
|
||||||
import LoggingView from '@/views/system/LoggingView.vue'
|
import LoggingView from '@/views/system/LoggingView.vue'
|
||||||
|
import RuleTestView from '@/views/system/RuleTestView.vue'
|
||||||
|
|
||||||
// App捷径
|
// App捷径
|
||||||
const appsMenu = ref(false)
|
const appsMenu = ref(false)
|
||||||
@@ -14,6 +15,9 @@ const netTestDialog = ref(false)
|
|||||||
|
|
||||||
// 实时日志弹窗
|
// 实时日志弹窗
|
||||||
const loggingDialog = ref(false)
|
const loggingDialog = ref(false)
|
||||||
|
|
||||||
|
// 过滤规则弹窗
|
||||||
|
const ruleTestDialog = ref(false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -112,6 +116,27 @@ const loggingDialog = ref(false)
|
|||||||
<span class="text-sm">系统实时日志</span>
|
<span class="text-sm">系统实时日志</span>
|
||||||
</VListItem>
|
</VListItem>
|
||||||
</VCol>
|
</VCol>
|
||||||
|
<VCol
|
||||||
|
cols="6"
|
||||||
|
class="text-center cursor-pointer pa-0 shortcut-icon border-e"
|
||||||
|
@click="() => {}"
|
||||||
|
>
|
||||||
|
<VListItem
|
||||||
|
class="pa-4"
|
||||||
|
@click="ruleTestDialog = true"
|
||||||
|
>
|
||||||
|
<VAvatar
|
||||||
|
size="48"
|
||||||
|
variant="tonal"
|
||||||
|
>
|
||||||
|
<VIcon icon="mdi-filter-cog-outline" />
|
||||||
|
</VAvatar>
|
||||||
|
<h6 class="text-base font-weight-medium mt-2 mb-0">
|
||||||
|
规则
|
||||||
|
</h6>
|
||||||
|
<span class="text-sm">过滤规则测试</span>
|
||||||
|
</VListItem>
|
||||||
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
</div>
|
</div>
|
||||||
</VCard>
|
</VCard>
|
||||||
@@ -153,4 +178,17 @@ const loggingDialog = ref(false)
|
|||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
</VDialog>
|
</VDialog>
|
||||||
|
<!-- 规则测试弹窗 -->
|
||||||
|
<VDialog
|
||||||
|
v-model="ruleTestDialog"
|
||||||
|
max-width="800"
|
||||||
|
scrollable
|
||||||
|
>
|
||||||
|
<VCard title="过滤规则测试">
|
||||||
|
<DialogCloseBtn @click="ruleTestDialog = false" />
|
||||||
|
<VCardText>
|
||||||
|
<RuleTestView />
|
||||||
|
</VCardText>
|
||||||
|
</VCard>
|
||||||
|
</VDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
import { requiredValidator } from '@/@validators'
|
||||||
|
import api from '@/api'
|
||||||
|
|
||||||
|
// 识别结果
|
||||||
|
const ruleTestResult = ref('')
|
||||||
|
|
||||||
|
// 名称识别表单
|
||||||
|
const ruleTestForm = reactive({
|
||||||
|
title: '',
|
||||||
|
subtitle: '',
|
||||||
|
ruletype: '1',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 识别按钮状态
|
||||||
|
const ruleTestLoading = ref(false)
|
||||||
|
|
||||||
|
// 识别按钮文本
|
||||||
|
const ruleTestText = ref('测试')
|
||||||
|
|
||||||
|
// 是否显示结果
|
||||||
|
const showResult = ref(false)
|
||||||
|
|
||||||
|
// 调用API识别
|
||||||
|
async function ruleTest() {
|
||||||
|
if (!ruleTestForm.title)
|
||||||
|
return
|
||||||
|
|
||||||
|
try {
|
||||||
|
ruleTestLoading.value = true
|
||||||
|
ruleTestText.value = '正在测试...'
|
||||||
|
showResult.value = false
|
||||||
|
const result: { [key: string]: any } = await api.get('system/ruletest', {
|
||||||
|
params: {
|
||||||
|
title: ruleTestForm.title,
|
||||||
|
subtitle: ruleTestForm.subtitle,
|
||||||
|
ruletype: ruleTestForm.ruletype,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (result.success)
|
||||||
|
ruleTestResult.value = `优先级:${result.data.priority}`
|
||||||
|
|
||||||
|
else
|
||||||
|
ruleTestResult.value = '未命中任何优先级规则!'
|
||||||
|
|
||||||
|
ruleTestLoading.value = false
|
||||||
|
ruleTestText.value = '重新测试'
|
||||||
|
showResult.value = true
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VForm @submit.prevent="() => {}">
|
||||||
|
<VRow class="pt-2">
|
||||||
|
<VCol cols="12" md="8">
|
||||||
|
<VTextField
|
||||||
|
v-model="ruleTestForm.title"
|
||||||
|
label="标题"
|
||||||
|
:rules="[requiredValidator]"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12" md="4">
|
||||||
|
<VSelect
|
||||||
|
v-model="ruleTestForm.ruletype"
|
||||||
|
label="规则类型"
|
||||||
|
:items="[{
|
||||||
|
title: '默认规则',
|
||||||
|
value: '1',
|
||||||
|
}, {
|
||||||
|
title: '洗版规则',
|
||||||
|
value: '2',
|
||||||
|
}]"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
<VCol cols="12">
|
||||||
|
<VTextarea
|
||||||
|
v-model="ruleTestForm.subtitle"
|
||||||
|
label="副标题"
|
||||||
|
rows="2"
|
||||||
|
auto-grow
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
|
<VRow>
|
||||||
|
<VCol
|
||||||
|
cols="12"
|
||||||
|
class="text-center"
|
||||||
|
>
|
||||||
|
<VBtn
|
||||||
|
:disabled="ruleTestLoading"
|
||||||
|
@click="ruleTest"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon icon="mdi-filter-check-outline" />
|
||||||
|
</template>
|
||||||
|
{{ ruleTestText }}
|
||||||
|
</VBtn>
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
|
</VForm>
|
||||||
|
<VExpandTransition>
|
||||||
|
<div v-show="showResult">
|
||||||
|
<VCol>
|
||||||
|
<VAlert
|
||||||
|
icon="mdi-alert-circle-outline"
|
||||||
|
>
|
||||||
|
{{ ruleTestResult }}
|
||||||
|
</VAlert>
|
||||||
|
</VCol>
|
||||||
|
</div>
|
||||||
|
</VExpandTransition>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user