add 删除订阅

This commit is contained in:
2023-07-13 10:05:32 +08:00
parent 54e6932dc2
commit 41d16c43b0
5 changed files with 62 additions and 4 deletions

View File

@@ -31,4 +31,13 @@ export async function addSubscribe({name, rename, desc, year, season, ep, url, i
export async function getSubscribe(){
return await base.get("/videoInfo/getSubscribe")
}
export async function delSubscribe(id){
return await base.get("/videoInfo/delSubscribe",{
params:{
id
}
})
}

View File

@@ -7,7 +7,7 @@
<span>{{i.name}}</span>
<div class="bottom">
<time class="time">正在订阅{{i.skip}}/{{i.count}}</time>
<el-button text class="button">编辑</el-button>
<el-button text class="button" @click="del(i.id)">删除</el-button>
</div>
</div>
</el-card>
@@ -18,13 +18,47 @@
<script lang="ts" setup>
import {onMounted, ref} from "vue";
import {getSubscribe} from '../../api/Video.js'
import {delSubscribe, getSubscribe} from '../../api/Video.js'
import {ElMessage, ElMessageBox} from "element-plus";
const list = ref([])
onMounted(async ()=>{
const res = await getSubscribe()
list.value = res.data
})
function del(id){
ElMessageBox.confirm(
'确认删除?',
'Warning',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
del2(id)
})
.catch(() => {
})
}
async function del2(id){
let res = await delSubscribe(id)
if(res.data == "删除成功"){
ElMessage({
message: '删除成功',
type: 'success',
})
}else{
ElMessage({
message:"删除失败",
type:"error"
})
}
const res2 = await getSubscribe()
list.value = res2.data
}
</script>