This commit is contained in:
Theluyuan 2023-07-12 16:21:57 +08:00
parent 213130a207
commit a9428fe8ce
4 changed files with 97 additions and 78 deletions

Binary file not shown.

View File

@ -38,6 +38,7 @@ router.get("/getVideoInfo", async (ctx) => {
router.post("/addSubscribe", async (ctx) => {
// console.log(ctx.request.body)
let data = ctx.request.body
})
router.get("/getImdbName", async (ctx) => {

6
util/sql/video.js Normal file
View File

@ -0,0 +1,6 @@
const { run, getAll } = require("./base");
function addSub(info){
let sql = `insert into download(name,rename,skip,desc,url,subtitle,img) values(?,?,?,?,?,?)`
}

View File

@ -1,47 +1,51 @@
<template>
<el-empty v-if="list.length===0" description="没有搜索到内容"/>
<div>
<div class="list">
<div class="item" v-for="i in list">
<el-card @click="getInfo(i.id)" shadow="hover" :body-style="{ padding: '0px' }">
<img :src="i.img" class="image"/>
<div style="padding: 14px">
<span>{{ i.title }}({{ i.year }})</span>
<div class="bottom">
<time class="time">类型{{ i.type }}</time>
<el-button text class="button" >详情</el-button>
<el-empty v-if="list.length===0" description="没有搜索到内容"/>
<div>
<div class="list">
<div class="item" v-for="i in list">
<el-card @click="getInfo(i.id,i.img)" shadow="hover" :body-style="{ padding: '0px' }">
<img :src="i.img" class="image"/>
<div style="padding: 14px">
<span>{{ i.title }}({{ i.year }})</span>
<div class="bottom">
<time class="time">类型{{ i.type }}</time>
<el-button text class="button">详情</el-button>
</div>
</div>
</el-card>
</div>
</div>
</el-card>
</div>
</div>
<el-dialog v-model="dialogFormVisible" title="详情">
<textarea style="width: 95%;height: 400px;" v-model="info"></textarea>
<div style="display: flex;align-items: center;padding: 5px">
英文名:
<el-input style="width: 300px" v-model="enName"></el-input>
年份
<el-input style="width: 100px" v-model="year"></el-input>
第几季
<el-input style="width: 100px" v-model="season"></el-input>
开始集数
<el-input style="width: 100px" v-model="ep"></el-input>
</div>
<el-dialog v-model="dialogFormVisible" title="详情">
<textarea style="width: 95%;height: 400px;" v-model="info"></textarea>
<div style="display: flex;align-items: center;padding: 5px">
英文名:
<el-input style="width: 300px" v-model="enName"></el-input>
年份
<el-input style="width: 100px" v-model="year"></el-input>
第几季
<el-input style="width: 100px" v-model="season"></el-input>
开始集数
<el-input style="width: 100px" v-model="ep"></el-input>
</div>
<div style="display: flex;align-items: center;padding: 5px">
地址:
<el-input style="width: 80%" v-model="url"></el-input>
</div>
<template #footer>
</div>
<div style="display: flex;align-items: center;padding: 5px">
副标题:
<el-input style="width: 80%" v-model="subtitle"></el-input>
</div>
<div style="display: flex;align-items: center;padding: 5px">
地址:
<el-input style="width: 80%" v-model="url"></el-input>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogFormVisible = false">关闭</el-button>
<el-button type="primary" @click="addsubscribe">
订阅
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
@ -57,15 +61,17 @@ const year = ref("")
const ep = ref(1)
const season = ref(1)
const url = ref("")
const subtitle = ref("")
const img = ref("")
async function onSubmit(name) {
let res = await searchVideo(name)
list.value = res.data.data
let res = await searchVideo(name)
list.value = res.data.data
}
onSubmit(route.query.name)
onBeforeRouteUpdate(next => {
onSubmit(next.query.name)
onSubmit(next.query.name)
})
@ -73,70 +79,76 @@ let vid = "";
const dialogFormVisible = ref(false)
async function getInfo(id) {
const loadingInstance = ElLoading.service({fullscreen: true})
vid = id
let res = await getVideoInfo(id)
info.value = res.data.format
year.value = res.data.year
await subscribe(res.data.imdb_link)
dialogFormVisible.value = true
loadingInstance.close()
async function getInfo(id,i) {
const loadingInstance = ElLoading.service({fullscreen: true})
vid = id
img.value = i
let res = await getVideoInfo(id)
info.value = res.data.format
year.value = res.data.year
subtitle.value = res.data.trans_title.join(" / ")
await subscribe(res.data.imdb_link)
dialogFormVisible.value = true
loadingInstance.close()
}
const enName = ref("")
async function subscribe(url){
const res = await getImdbName(url)
enName.value = res.data
async function subscribe(url) {
const res = await getImdbName(url)
enName.value = res.data
}
async function addsubscribe() {
addSubscribe({
name: enName.value,
desc: info.value,
year:year.value,
season:season.value,
ep:ep.value,
url:url.value
})
addSubscribe({
name: enName.value,
desc: info.value,
year: year.value,
season: season.value,
ep: ep.value,
url: url.value,
img:img.value,
subtitle:subtitle.value
})
}
</script>
<style lang="scss" scoped>
.list {
display: flex;
flex-wrap: wrap;
display: flex;
flex-wrap: wrap;
.item {
width: 200px;
margin: 20px;
.item {
width: 200px;
margin: 20px;
& img {
height: 300px;
& img {
height: 300px;
}
}
}
}
.time {
font-size: 12px;
color: #999;
font-size: 12px;
color: #999;
}
.bottom {
margin-top: 13px;
line-height: 12px;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 13px;
line-height: 12px;
display: flex;
justify-content: space-between;
align-items: center;
}
.button {
padding: 0;
min-height: auto;
min-width: 40px;
padding: 0;
min-height: auto;
min-width: 40px;
}
.image {
width: 100%;
display: block;
width: 100%;
display: block;
}</style>