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