feat:订阅弹窗开关

This commit is contained in:
jxxghp
2024-01-03 18:11:13 +08:00
parent 2a56e116cf
commit 6e2b12501f
3 changed files with 49 additions and 2 deletions

View File

@@ -16,6 +16,11 @@ const props = defineProps({
height: String,
})
// 订阅规则
const subscribeRules = ref({
show_edit_dialog: false,
})
// 提示框
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
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() {
if (isSubscribed.value)
@@ -373,6 +392,7 @@ function handleSearch() {
onBeforeMount(() => {
handleCheckSubscribe()
handleCheckExists()
querySubscribeRules()
})
// 计算图片地址

View File

@@ -46,6 +46,11 @@ const seasonsSubscribed = ref<{ [key: number]: boolean }>({})
// 订阅编号
const subscribeId = ref<number>()
// 订阅规则
const subscribeRules = ref({
show_edit_dialog: false,
})
// 调用API查询详情
async function getMediaDetail() {
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
subscribeEditDialog.value = true
}
@@ -277,6 +282,20 @@ async function removeSubscribe(season: number) {
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) {
if (isSubscribed.value)
@@ -404,6 +423,7 @@ function handlePlay() {
onBeforeMount(() => {
getMediaDetail()
querySubscribeRules()
})
</script>

View File

@@ -38,6 +38,7 @@ const defaultFilterRules = ref({
exclude: '',
movie_size: '',
tv_size: '',
show_edit_dialog: false,
})
// 导入代码弹窗
@@ -521,6 +522,12 @@ onMounted(() => {
placeholder="0-10"
/>
</VCol>
<VCol cols="12" md="6">
<VSwitch
v-model="defaultFilterRules.show_edit_dialog"
label="订阅时编辑更多规则"
/>
</VCol>
</VRow>
</VForm>
</VCardText>