add 添加订阅

This commit is contained in:
2023-07-12 20:41:05 +08:00
parent a9428fe8ce
commit 25e68ab1d0
5 changed files with 72 additions and 13 deletions

View File

@@ -25,6 +25,6 @@ export async function getImdbName(url) {
})
}
export async function addSubscribe({name, desc, year, season, ep, url}) {
return await base.post("/videoInfo/addSubscribe", {name, desc, year, season, ep, url})
export async function addSubscribe({name, rename, desc, year, season, ep, url, img, subtitle, time,skip,sid}) {
return await base.post("/videoInfo/addSubscribe", {name, rename, desc, year, season, ep, url, img, subtitle, time,skip,sid})
}

View File

@@ -36,6 +36,10 @@
地址:
<el-input style="width: 80%" v-model="url"></el-input>
</div>
<div style="display: flex;align-items: center;padding: 5px">
检查更新时间:
<el-time-picker v-model="time" placeholder="Arbitrary time"/>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogFormVisible = false">关闭</el-button>
@@ -52,7 +56,8 @@
import {ref} from 'vue';
import {addSubscribe, getImdbName, getVideoInfo, searchVideo} from '../../api/Video.js'
import {onBeforeRouteUpdate, useRoute} from "vue-router";
import {ElLoading} from "element-plus";
import {ElLoading, ElMessage} from "element-plus";
import dayjs from "dayjs";
let list = ref([])
const info = ref("")
@@ -63,6 +68,8 @@ const season = ref(1)
const url = ref("")
const subtitle = ref("")
const img = ref("")
const time = ref("")
const name = ref("")
async function onSubmit(name) {
let res = await searchVideo(name)
list.value = res.data.data
@@ -79,7 +86,7 @@ let vid = "";
const dialogFormVisible = ref(false)
async function getInfo(id,i) {
async function getInfo(id, i) {
const loadingInstance = ElLoading.service({fullscreen: true})
vid = id
img.value = i
@@ -87,7 +94,11 @@ async function getInfo(id,i) {
info.value = res.data.format
year.value = res.data.year
subtitle.value = res.data.trans_title.join(" / ")
await subscribe(res.data.imdb_link)
name.value = res.data.chinese_title
enName.value = ""
if(res.data.imdb_link){
await subscribe(res.data.imdb_link)
}
dialogFormVisible.value = true
loadingInstance.close()
}
@@ -100,16 +111,41 @@ async function subscribe(url) {
}
async function addsubscribe() {
addSubscribe({
name: enName.value,
let data = {
name: name.value,
rename: enName.value,
desc: info.value,
year: year.value,
season: season.value,
ep: ep.value,
url: url.value,
img:img.value,
subtitle:subtitle.value
})
img: img.value,
subtitle: subtitle.value,
time: dayjs(time.value).format("HH:mm:ss"),
skip:season.value,
sid:vid
}
for(let i in data){
if(!data[i]){
ElMessage({
message: '请完整填写内容!',
type: 'error',
})
return
}
}
let res = await addSubscribe(data)
if(res.data == "添加成功"){
ElMessage({
message: res.data,
type: 'success',
})
}else{
ElMessage({
message: res.data,
type: 'error',
})
}
}
</script>