mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix #92
This commit is contained in:
@@ -7,7 +7,7 @@ import type { Site, Subscribe } from '@/api/types'
|
|||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
subid: Number,
|
subid: Number,
|
||||||
default_config: Boolean,
|
default: Boolean,
|
||||||
type: String,
|
type: String,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -68,42 +68,41 @@ 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 {
|
else
|
||||||
subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
|
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,
|
subscribe_config_url,
|
||||||
subscribeForm.value)
|
subscribeForm.value)
|
||||||
if (result.success) {
|
if (result.success)
|
||||||
$toast.success(props.type + '订阅默认规则保存成功')
|
$toast.success(`${props.type}订阅默认规则保存成功`)
|
||||||
} else {
|
else
|
||||||
$toast.error(props.type + '订阅默认规则保存失败!')
|
$toast.error(`${props.type}订阅默认规则保存失败!`)
|
||||||
}
|
|
||||||
// 通知父组件刷新
|
// 通知父组件刷新
|
||||||
emit('default_config')
|
emit('save')
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户设置的默认订阅规则
|
// 查询用户设置的默认订阅规则
|
||||||
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 {
|
else
|
||||||
subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
|
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)
|
||||||
@@ -256,13 +255,12 @@ const effectOptions = ref([
|
|||||||
])
|
])
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (props.subid) {
|
getSiteList()
|
||||||
getSiteList()
|
if (props.subid)
|
||||||
getSubscribeInfo()
|
getSubscribeInfo()
|
||||||
}
|
|
||||||
if (props.default_config) {
|
if (props.default)
|
||||||
queryDefaultSubscribeConfig()
|
queryDefaultSubscribeConfig()
|
||||||
}
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -272,7 +270,7 @@ watchEffect(() => {
|
|||||||
max-width="60rem"
|
max-width="60rem"
|
||||||
>
|
>
|
||||||
<VCard
|
<VCard
|
||||||
:title="`${props.default_config ? `设置${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">
|
||||||
@@ -284,7 +282,7 @@ watchEffect(() => {
|
|||||||
md="8"
|
md="8"
|
||||||
>
|
>
|
||||||
<VTextField
|
<VTextField
|
||||||
v-if="!props.default_config"
|
v-if="!props.default"
|
||||||
v-model="subscribeForm.keyword"
|
v-model="subscribeForm.keyword"
|
||||||
label="搜索关键词"
|
label="搜索关键词"
|
||||||
hint="设定搜索关键词后,将使用此关键词搜索站点资源,否则自动使用themoviedb中的名称搜索"
|
hint="设定搜索关键词后,将使用此关键词搜索站点资源,否则自动使用themoviedb中的名称搜索"
|
||||||
@@ -419,13 +417,13 @@ watchEffect(() => {
|
|||||||
</VCardText>
|
</VCardText>
|
||||||
|
|
||||||
<VCardActions>
|
<VCardActions>
|
||||||
<VBtn v-if="!props.default_config" color="error" @click="removeSubscribe">
|
<VBtn v-if="!props.default" color="error" @click="removeSubscribe">
|
||||||
取消订阅
|
取消订阅
|
||||||
</VBtn>
|
</VBtn>
|
||||||
<VSpacer />
|
<VSpacer />
|
||||||
<VBtn
|
<VBtn
|
||||||
variant="tonal"
|
variant="tonal"
|
||||||
@click="`${props.default_config ? saveDefaultSubscribeConfig() : updateSubscribeInfo()}`"
|
@click="`${props.default ? saveDefaultSubscribeConfig() : updateSubscribeInfo()}`"
|
||||||
>
|
>
|
||||||
保存
|
保存
|
||||||
</VBtn>
|
</VBtn>
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ const isRefreshed = ref(false)
|
|||||||
// 数据列表
|
// 数据列表
|
||||||
const dataList = ref<Subscribe[]>([])
|
const dataList = ref<Subscribe[]>([])
|
||||||
|
|
||||||
// 定义触发的自定义事件
|
|
||||||
const emit = defineEmits(['default_config'])
|
|
||||||
|
|
||||||
// 弹窗
|
// 弹窗
|
||||||
const subscribeEditDialog = ref(false)
|
const subscribeEditDialog = ref(false)
|
||||||
|
|
||||||
@@ -97,14 +94,17 @@ const filteredDataList = computed(() => {
|
|||||||
</PullRefresh>
|
</PullRefresh>
|
||||||
<!-- 底部操作按钮 -->
|
<!-- 底部操作按钮 -->
|
||||||
<span class="fixed right-5 bottom-5">
|
<span class="fixed right-5 bottom-5">
|
||||||
<VBtn icon="mdi-view-dashboard-edit" class="me-2" color="primary" size="x-large" @click="subscribeEditDialog = true" />
|
<VTooltip text="设置默认订阅规则">
|
||||||
</span>
|
<template #activator="{ props }">
|
||||||
<!-- 订阅编辑弹窗 -->
|
<VBtn v-bind="props" icon="mdi-file-document-edit" class="me-2" color="primary" size="x-large" @click="subscribeEditDialog = true" />
|
||||||
|
</template>
|
||||||
|
</vtooltip></span>
|
||||||
|
<!-- 订阅编辑弹窗 -->
|
||||||
<SubscribeEditForm
|
<SubscribeEditForm
|
||||||
v-model="subscribeEditDialog"
|
v-model="subscribeEditDialog"
|
||||||
:default_config=true
|
:default="true"
|
||||||
:type=props.type
|
:type="props.type"
|
||||||
@default_config="() => { emit('default_config');subscribeEditDialog = false; }"
|
@save="subscribeEditDialog = false"
|
||||||
@close="subscribeEditDialog = false"
|
@close="subscribeEditDialog = false"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user