mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-31 13:21:01 +08:00
fix #92
This commit is contained in:
@@ -7,7 +7,7 @@ import type { Site, Subscribe } from '@/api/types'
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
subid: Number,
|
||||
default_config: Boolean,
|
||||
default: Boolean,
|
||||
type: String,
|
||||
})
|
||||
|
||||
@@ -68,42 +68,41 @@ async function updateSubscribeInfo() {
|
||||
// 设置用户设置的默认订阅规则
|
||||
async function saveDefaultSubscribeConfig() {
|
||||
try {
|
||||
let subscribe_config_url = ""
|
||||
if (props.type == "电影") {
|
||||
subscribe_config_url = 'system/setting/DefaultMovieSubscribeConfig'
|
||||
} else {
|
||||
subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
|
||||
}
|
||||
const result: { [key: string]: any } = await api.post(
|
||||
subscribe_config_url,
|
||||
subscribeForm.value)
|
||||
if (result.success) {
|
||||
$toast.success(props.type + '订阅默认规则保存成功')
|
||||
} else {
|
||||
$toast.error(props.type + '订阅默认规则保存失败!')
|
||||
}
|
||||
// 通知父组件刷新
|
||||
emit('default_config')
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
let subscribe_config_url = ''
|
||||
if (props.type === '电影')
|
||||
subscribe_config_url = 'system/setting/DefaultMovieSubscribeConfig'
|
||||
else
|
||||
subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
|
||||
|
||||
const result: { [key: string]: any } = await api.post(
|
||||
subscribe_config_url,
|
||||
subscribeForm.value)
|
||||
if (result.success)
|
||||
$toast.success(`${props.type}订阅默认规则保存成功`)
|
||||
else
|
||||
$toast.error(`${props.type}订阅默认规则保存失败!`)
|
||||
|
||||
// 通知父组件刷新
|
||||
emit('save')
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 查询用户设置的默认订阅规则
|
||||
async function queryDefaultSubscribeConfig() {
|
||||
try {
|
||||
let subscribe_config_url = ""
|
||||
if (props.type == "电影") {
|
||||
let subscribe_config_url = ''
|
||||
if (props.type === '电影')
|
||||
subscribe_config_url = 'system/setting/DefaultMovieSubscribeConfig'
|
||||
} else {
|
||||
else
|
||||
subscribe_config_url = 'system/setting/DefaultTvSubscribeConfig'
|
||||
}
|
||||
|
||||
const result: { [key: string]: any } = await api.get(subscribe_config_url)
|
||||
|
||||
if (result.data.value) {
|
||||
if (result.data.value)
|
||||
subscribeForm.value = result.data?.value ?? ''
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error)
|
||||
@@ -256,13 +255,12 @@ const effectOptions = ref([
|
||||
])
|
||||
|
||||
watchEffect(() => {
|
||||
if (props.subid) {
|
||||
getSiteList()
|
||||
getSiteList()
|
||||
if (props.subid)
|
||||
getSubscribeInfo()
|
||||
}
|
||||
if (props.default_config) {
|
||||
|
||||
if (props.default)
|
||||
queryDefaultSubscribeConfig()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -272,7 +270,7 @@ watchEffect(() => {
|
||||
max-width="60rem"
|
||||
>
|
||||
<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"
|
||||
>
|
||||
<VCardText class="pt-2">
|
||||
@@ -284,7 +282,7 @@ watchEffect(() => {
|
||||
md="8"
|
||||
>
|
||||
<VTextField
|
||||
v-if="!props.default_config"
|
||||
v-if="!props.default"
|
||||
v-model="subscribeForm.keyword"
|
||||
label="搜索关键词"
|
||||
hint="设定搜索关键词后,将使用此关键词搜索站点资源,否则自动使用themoviedb中的名称搜索"
|
||||
@@ -419,13 +417,13 @@ watchEffect(() => {
|
||||
</VCardText>
|
||||
|
||||
<VCardActions>
|
||||
<VBtn v-if="!props.default_config" color="error" @click="removeSubscribe">
|
||||
<VBtn v-if="!props.default" color="error" @click="removeSubscribe">
|
||||
取消订阅
|
||||
</VBtn>
|
||||
<VSpacer />
|
||||
<VBtn
|
||||
variant="tonal"
|
||||
@click="`${props.default_config ? saveDefaultSubscribeConfig() : updateSubscribeInfo()}`"
|
||||
@click="`${props.default ? saveDefaultSubscribeConfig() : updateSubscribeInfo()}`"
|
||||
>
|
||||
保存
|
||||
</VBtn>
|
||||
|
||||
Reference in New Issue
Block a user