mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
feat:订阅弹窗开关
This commit is contained in:
@@ -16,6 +16,11 @@ const props = defineProps({
|
|||||||
height: String,
|
height: String,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 订阅规则
|
||||||
|
const subscribeRules = ref({
|
||||||
|
show_edit_dialog: false,
|
||||||
|
})
|
||||||
|
|
||||||
// 提示框
|
// 提示框
|
||||||
const $toast = useToast()
|
const $toast = useToast()
|
||||||
|
|
||||||
@@ -146,7 +151,7 @@ async function addSubscribe(season = 0) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 弹出订阅编辑弹窗
|
// 弹出订阅编辑弹窗
|
||||||
if (result.success && seasonsSelected.value.length <= 1) {
|
if (result.success && seasonsSelected.value.length <= 1 && subscribeRules.value.show_edit_dialog) {
|
||||||
subscribeId.value = result.data.id
|
subscribeId.value = result.data.id
|
||||||
subscribeEditDialog.value = true
|
subscribeEditDialog.value = true
|
||||||
}
|
}
|
||||||
@@ -302,6 +307,20 @@ async function getMediaSeasons() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询订阅弹窗规则
|
||||||
|
async function querySubscribeRules() {
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get(
|
||||||
|
'system/setting/DefaultFilterRules',
|
||||||
|
)
|
||||||
|
if (result.data?.value)
|
||||||
|
subscribeRules.value = result.data?.value
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 爱心订阅按钮响应
|
// 爱心订阅按钮响应
|
||||||
function handleSubscribe() {
|
function handleSubscribe() {
|
||||||
if (isSubscribed.value)
|
if (isSubscribed.value)
|
||||||
@@ -373,6 +392,7 @@ function handleSearch() {
|
|||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
handleCheckSubscribe()
|
handleCheckSubscribe()
|
||||||
handleCheckExists()
|
handleCheckExists()
|
||||||
|
querySubscribeRules()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 计算图片地址
|
// 计算图片地址
|
||||||
|
|||||||
@@ -46,6 +46,11 @@ const seasonsSubscribed = ref<{ [key: number]: boolean }>({})
|
|||||||
// 订阅编号
|
// 订阅编号
|
||||||
const subscribeId = ref<number>()
|
const subscribeId = ref<number>()
|
||||||
|
|
||||||
|
// 订阅规则
|
||||||
|
const subscribeRules = ref({
|
||||||
|
show_edit_dialog: false,
|
||||||
|
})
|
||||||
|
|
||||||
// 调用API查询详情
|
// 调用API查询详情
|
||||||
async function getMediaDetail() {
|
async function getMediaDetail() {
|
||||||
if (mediaProps.mediaid && mediaProps.type) {
|
if (mediaProps.mediaid && mediaProps.type) {
|
||||||
@@ -215,7 +220,7 @@ async function addSubscribe(season = 0) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 显示编辑弹窗
|
// 显示编辑弹窗
|
||||||
if (result.success) {
|
if (result.success && subscribeRules.value.show_edit_dialog) {
|
||||||
subscribeId.value = result.data.id
|
subscribeId.value = result.data.id
|
||||||
subscribeEditDialog.value = true
|
subscribeEditDialog.value = true
|
||||||
}
|
}
|
||||||
@@ -277,6 +282,20 @@ async function removeSubscribe(season: number) {
|
|||||||
doneNProgress()
|
doneNProgress()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询订阅弹窗规则
|
||||||
|
async function querySubscribeRules() {
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get(
|
||||||
|
'system/setting/DefaultFilterRules',
|
||||||
|
)
|
||||||
|
if (result.data?.value)
|
||||||
|
subscribeRules.value = result.data?.value
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 订阅按钮响应
|
// 订阅按钮响应
|
||||||
function handleSubscribe(season = 0) {
|
function handleSubscribe(season = 0) {
|
||||||
if (isSubscribed.value)
|
if (isSubscribed.value)
|
||||||
@@ -404,6 +423,7 @@ function handlePlay() {
|
|||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
getMediaDetail()
|
getMediaDetail()
|
||||||
|
querySubscribeRules()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ const defaultFilterRules = ref({
|
|||||||
exclude: '',
|
exclude: '',
|
||||||
movie_size: '',
|
movie_size: '',
|
||||||
tv_size: '',
|
tv_size: '',
|
||||||
|
show_edit_dialog: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 导入代码弹窗
|
// 导入代码弹窗
|
||||||
@@ -521,6 +522,12 @@ onMounted(() => {
|
|||||||
placeholder="0-10"
|
placeholder="0-10"
|
||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
|
<VCol cols="12" md="6">
|
||||||
|
<VSwitch
|
||||||
|
v-model="defaultFilterRules.show_edit_dialog"
|
||||||
|
label="订阅时编辑更多规则"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
</VForm>
|
</VForm>
|
||||||
</VCardText>
|
</VCardText>
|
||||||
|
|||||||
Reference in New Issue
Block a user