From c0c122e9cad66463a320ca8baff0956a7a3e5ba3 Mon Sep 17 00:00:00 2001 From: theluyuan <1162963624@qq.com> Date: Sun, 3 Sep 2023 21:10:55 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E8=AE=A2=E9=98=85=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/videoInfo.js | 2 +- util/sql/video.js | 4 +- view/src/api/Video.js | 8 ++- view/src/page/subscribe/subscribe.vue | 89 +++++++++++++++------------ 4 files changed, 59 insertions(+), 44 deletions(-) diff --git a/router/videoInfo.js b/router/videoInfo.js index ec799a4..57e9b50 100644 --- a/router/videoInfo.js +++ b/router/videoInfo.js @@ -53,7 +53,7 @@ router.post("/addSubscribe", async (ctx) => { * 获取订阅列表 */ router.get("/getSubscribe", async (ctx) => { - ctx.body = await getSub() + ctx.body = await getSub(ctx.query.state) }) /** diff --git a/util/sql/video.js b/util/sql/video.js index b38cfe0..90e76f2 100644 --- a/util/sql/video.js +++ b/util/sql/video.js @@ -13,8 +13,8 @@ async function addSub(info){ } // 获取所有订阅 (不包括已完成) -async function getSub(){ - let sql = `select * from VideoInfo where enable=1` +async function getSub(state){ + let sql = `select * from VideoInfo where enable=${state}` let list = await getAll(sql) return list } diff --git a/view/src/api/Video.js b/view/src/api/Video.js index 43445ba..cd3d85d 100644 --- a/view/src/api/Video.js +++ b/view/src/api/Video.js @@ -28,8 +28,12 @@ export async function addSubscribe(data) { return await base.post("/videoInfo/addSubscribe", data) } -export async function getSubscribe(){ - return await base.get("/videoInfo/getSubscribe") +export async function getSubscribe(state){ + return await base.get("/videoInfo/getSubscribe",{ + params:{ + state + } + }) } diff --git a/view/src/page/subscribe/subscribe.vue b/view/src/page/subscribe/subscribe.vue index 94d464a..602a761 100644 --- a/view/src/page/subscribe/subscribe.vue +++ b/view/src/page/subscribe/subscribe.vue @@ -1,12 +1,18 @@