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" />
|
||||
|
||||
<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,22 +1,14 @@
|
||||
<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" />
|
||||
<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>
|
||||
<el-button text class="button" @click="getInfo(i.id)">详情</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
@ -37,21 +29,30 @@
|
||||
</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)
|
||||
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) {
|
||||
|
||||
async function getInfo(id) {
|
||||
vid = id
|
||||
let res = await getVideoInfo(id)
|
||||
info.value = res.data.format
|
||||
|
Loading…
Reference in New Issue
Block a user