mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
feat:订阅重置
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useToast } from 'vue-toast-notification'
|
import { useToast } from 'vue-toast-notification'
|
||||||
|
import { useConfirm } from 'vuetify-use-dialog'
|
||||||
import SubscribeEditDialog from '../dialog/SubscribeEditDialog.vue'
|
import SubscribeEditDialog from '../dialog/SubscribeEditDialog.vue'
|
||||||
import { formatDateDifference } from '@/@core/utils/formatters'
|
import { formatDateDifference } from '@/@core/utils/formatters'
|
||||||
import { formatSeason } from '@/@core/utils/formatters'
|
import { formatSeason } from '@/@core/utils/formatters'
|
||||||
@@ -15,6 +16,9 @@ const props = defineProps({
|
|||||||
// 定义触发的自定义事件
|
// 定义触发的自定义事件
|
||||||
const emit = defineEmits(['remove', 'save'])
|
const emit = defineEmits(['remove', 'save'])
|
||||||
|
|
||||||
|
// 确认框
|
||||||
|
const createConfirm = useConfirm()
|
||||||
|
|
||||||
// 提示框
|
// 提示框
|
||||||
const $toast = useToast()
|
const $toast = useToast()
|
||||||
|
|
||||||
@@ -84,6 +88,25 @@ async function searchSubscribe() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置订阅
|
||||||
|
async function resetSubscribe() {
|
||||||
|
// 确认
|
||||||
|
try {
|
||||||
|
const isConfirmed = await createConfirm({
|
||||||
|
title: '确认',
|
||||||
|
content: `重置后 ${props.media?.name} 已下载记录将被清除,未入库的剧集将会重新下载,是否确认?`,
|
||||||
|
})
|
||||||
|
if (!isConfirmed) return
|
||||||
|
// 重置
|
||||||
|
const result: { [key: string]: any } = await api.get(`subscribe/reset/${props.media?.id}`)
|
||||||
|
// 提示
|
||||||
|
if (result.success) $toast.success(`${props.media?.name} 重置成功!`)
|
||||||
|
else $toast.error(`${props.media?.name} 重置失败:${result.message}`)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑订阅响应
|
// 编辑订阅响应
|
||||||
async function editSubscribeDialog() {
|
async function editSubscribeDialog() {
|
||||||
subscribeEditDialog.value = true
|
subscribeEditDialog.value = true
|
||||||
@@ -124,8 +147,18 @@ const dropdownItems = ref([
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '取消订阅',
|
title: '重置',
|
||||||
value: 4,
|
value: 4,
|
||||||
|
props: {
|
||||||
|
prependIcon: 'mdi-restore-alert',
|
||||||
|
click: resetSubscribe,
|
||||||
|
color: 'warning',
|
||||||
|
},
|
||||||
|
show: props.media?.type === '电视剧',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '取消订阅',
|
||||||
|
value: 5,
|
||||||
props: {
|
props: {
|
||||||
prependIcon: 'mdi-trash-can-outline',
|
prependIcon: 'mdi-trash-can-outline',
|
||||||
color: 'error',
|
color: 'error',
|
||||||
@@ -179,18 +212,19 @@ watch(
|
|||||||
<VIcon icon="mdi-dots-vertical" :color="getTextColor()" />
|
<VIcon icon="mdi-dots-vertical" :color="getTextColor()" />
|
||||||
<VMenu activator="parent" close-on-content-click>
|
<VMenu activator="parent" close-on-content-click>
|
||||||
<VList>
|
<VList>
|
||||||
<VListItem
|
<template v-for="(item, i) in dropdownItems" :key="i">
|
||||||
v-for="(item, i) in dropdownItems"
|
<VListItem
|
||||||
:key="i"
|
v-if="item.show !== false"
|
||||||
variant="plain"
|
variant="plain"
|
||||||
:base-color="item.props.color"
|
:base-color="item.props.color"
|
||||||
@click="item.props.click"
|
@click="item.props.click"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VIcon :icon="item.props.prependIcon" />
|
<VIcon :icon="item.props.prependIcon" />
|
||||||
</template>
|
</template>
|
||||||
<VListItemTitle v-text="item.title" />
|
<VListItemTitle v-text="item.title" />
|
||||||
</VListItem>
|
</VListItem>
|
||||||
|
</template>
|
||||||
</VList>
|
</VList>
|
||||||
</VMenu>
|
</VMenu>
|
||||||
</IconBtn>
|
</IconBtn>
|
||||||
|
|||||||
Reference in New Issue
Block a user