update 修改添加订阅搜索方式,修正方法名称
This commit is contained in:
parent
2045da6ebe
commit
3edb0a645c
@ -8,8 +8,7 @@ const router = new Router({
|
||||
|
||||
router.get("/search",async (ctx)=>{
|
||||
let name = ctx.query.name
|
||||
let info = await serach(name)
|
||||
ctx.body = info
|
||||
ctx.body = await serach(name)
|
||||
})
|
||||
|
||||
// router.get("/getinfo",async (ctx)=>{
|
||||
@ -18,10 +17,9 @@ router.get("/search",async (ctx)=>{
|
||||
// ctx.body = info
|
||||
// })
|
||||
|
||||
router.get("/serchVideo",async (ctx)=>{
|
||||
router.get("/searchVideo",async (ctx)=>{
|
||||
let name = ctx.query.name
|
||||
let info = await serach(name)
|
||||
ctx.body = info
|
||||
ctx.body = await serach(name)
|
||||
|
||||
})
|
||||
|
||||
@ -31,8 +29,7 @@ router.get("/getVideoInfo",async (ctx)=>{
|
||||
ctx.body = "请传递id"
|
||||
return
|
||||
}
|
||||
let info = await gen_douban(id)
|
||||
ctx.body = info
|
||||
ctx.body = await gen_douban(id)
|
||||
|
||||
})
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
const axios = require("axios")
|
||||
const puppeteer = require("puppeteer")
|
||||
const cheerio = require("cheerio"); // HTML页面解析
|
||||
async function serach(name) {
|
||||
async function search(name) {
|
||||
const list = await axios.get(`https://movie.douban.com/j/subject_suggest?q=${name}`, {
|
||||
proxy: false,
|
||||
})
|
||||
@ -212,6 +212,6 @@ async function gen_douban(sid) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
serach,
|
||||
serach: search,
|
||||
gen_douban
|
||||
}
|
@ -7,8 +7,8 @@ export async function getVideoInfo(id){
|
||||
})
|
||||
}
|
||||
|
||||
export async function serchVideo(name){
|
||||
return await base.get("/videoInfo/serchVideo",{
|
||||
export async function searchVideo(name){
|
||||
return await base.get("/videoInfo/searchVideo",{
|
||||
params:{
|
||||
name
|
||||
}
|
||||
|
@ -1,28 +1,41 @@
|
||||
<template>
|
||||
<el-menu
|
||||
:default-active="activeIndex"
|
||||
class="el-menu-demo"
|
||||
mode="horizontal"
|
||||
@select="handleSelect"
|
||||
:ellipsis="false"
|
||||
>
|
||||
<h3 style="width: 180px">WEB-DL发布工具</h3>
|
||||
<el-menu-item index="1">首页</el-menu-item>
|
||||
<el-sub-menu index="2">
|
||||
<template #title>设置</template>
|
||||
<el-menu-item index="2-1">item one</el-menu-item>
|
||||
</el-sub-menu>
|
||||
<el-avatar style="position: absolute;right:0" :size="50" src="https://www.konfan.cn/img/favicon.png" />
|
||||
<h3 style="width: 180px">WEB-DL发布工具</h3>
|
||||
|
||||
<el-menu-item-group>
|
||||
<el-input
|
||||
style="min-width: auto"
|
||||
v-model="searchInput"
|
||||
placeholder="搜索资源"
|
||||
:prefix-icon="Search"
|
||||
@keydown.enter="search"
|
||||
/>
|
||||
</el-menu-item-group>
|
||||
|
||||
|
||||
|
||||
</el-menu>
|
||||
<div class="h-6" />
|
||||
<div class="h-6"/>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import {ref} from 'vue'
|
||||
import {Search} from "@element-plus/icons-vue";
|
||||
import {useRouter} from 'vue-router'
|
||||
|
||||
const activeIndex = ref('1')
|
||||
const activeIndex2 = ref('1')
|
||||
const handleSelect = (key: string, keyPath: string[]) => {
|
||||
console.log(key, keyPath)
|
||||
const router = useRouter()
|
||||
const searchInput = ref('')
|
||||
|
||||
function search() {
|
||||
router.push({
|
||||
path: '/addSubscribe',
|
||||
query: {'name': searchInput.value}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -8,16 +8,23 @@ import {
|
||||
CollectionTag,
|
||||
VideoCamera,
|
||||
VideoPlay,
|
||||
SwitchButton
|
||||
SwitchButton, House
|
||||
} from "@element-plus/icons-vue";
|
||||
import {router} from "../router/index.js";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<el-scrollbar>
|
||||
<el-menu v-model="sel" :router="true">
|
||||
<el-sub-menu index="1">
|
||||
<el-menu-item index="1">
|
||||
<el-icon>
|
||||
<el-icon>
|
||||
<House/>
|
||||
</el-icon>
|
||||
</el-icon>
|
||||
<span>首页</span>
|
||||
</el-menu-item>
|
||||
<el-sub-menu index="2">
|
||||
<template #title>
|
||||
<el-icon>
|
||||
<CollectionTag/>
|
||||
@ -25,12 +32,6 @@ import {router} from "../router/index.js";
|
||||
订阅管理
|
||||
</template>
|
||||
<el-menu-item-group>
|
||||
<el-menu-item index="/addSubscribe">
|
||||
<el-icon>
|
||||
<VideoCamera/>
|
||||
</el-icon>
|
||||
添加订阅
|
||||
</el-menu-item>
|
||||
<el-menu-item index="/subscribe">
|
||||
<el-icon>
|
||||
<VideoCamera/>
|
||||
@ -87,7 +88,7 @@ import {router} from "../router/index.js";
|
||||
<script>
|
||||
|
||||
import axios from "axios";
|
||||
import { ref } from "vue";
|
||||
import {ref} from "vue";
|
||||
|
||||
const sel = ref('')
|
||||
|
||||
|
@ -1,99 +1,100 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
||||
<el-form-item label="名称">
|
||||
<el-input v-model="formInline.name" placeholder="Approved by" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="onSubmit">搜索</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="list">
|
||||
<div class="item" v-for="i in list">
|
||||
<el-card :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" @click="getinfo(i.id)">详情</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<div>
|
||||
<div class="list">
|
||||
<div class="item" v-for="i in list">
|
||||
<el-card :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" @click="getInfo(i.id)">详情</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="dialogFormVisible" title="详情">
|
||||
<textarea style="width: 95%;height: 400px;" v-model="info"></textarea>
|
||||
<template #footer>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="dialogFormVisible" title="详情">
|
||||
<textarea style="width: 95%;height: 400px;" v-model="info"></textarea>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">Cancel</el-button>
|
||||
<el-button type="primary" @click="dialogFormVisible = false">
|
||||
Confirm
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { getVideoInfo, serchVideo } from '../../api/Video.js'
|
||||
import {ref} from 'vue';
|
||||
import {getVideoInfo, searchVideo} from '../../api/Video.js'
|
||||
import {onBeforeRouteUpdate, useRoute} from "vue-router";
|
||||
|
||||
const formInline = ref({
|
||||
name: ""
|
||||
})
|
||||
let list = ref([])
|
||||
const info = ref("")
|
||||
async function onSubmit() {
|
||||
let res = await serchVideo(formInline.value.name)
|
||||
list.value = res.data.data
|
||||
const route = useRoute()
|
||||
|
||||
async function onSubmit(name) {
|
||||
let res = await searchVideo(name)
|
||||
list.value = res.data.data
|
||||
}
|
||||
|
||||
|
||||
onSubmit(route.query.name)
|
||||
onBeforeRouteUpdate(next => {
|
||||
onSubmit(next.query.name)
|
||||
})
|
||||
|
||||
|
||||
let vid = "";
|
||||
const dialogFormVisible = ref(false)
|
||||
async function getinfo(id) {
|
||||
vid = id
|
||||
let res = await getVideoInfo(id)
|
||||
info.value = res.data.format
|
||||
dialogFormVisible.value = true
|
||||
|
||||
async function getInfo(id) {
|
||||
vid = id
|
||||
let res = await getVideoInfo(id)
|
||||
info.value = res.data.format
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
</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>
|
Loading…
Reference in New Issue
Block a user