From 7bd8ad9634d960d18e34bf947b2f93037fb939ec Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 28 Jul 2022 22:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A3=E4=BC=A0=E8=A7=86=E9=A2=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/data/project.js | 18 ++++++++++++++---- .../quanju/containers/footer/build/index.js | 4 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/api/app/lib/controllers/data/project.js b/api/app/lib/controllers/data/project.js index 7fb0b2a6..b1dec293 100644 --- a/api/app/lib/controllers/data/project.js +++ b/api/app/lib/controllers/data/project.js @@ -3,14 +3,24 @@ async function projectGet (ctx) { try { const models = ctx.fs.dc.models; - const { type } = ctx.query; + const { type, entryName } = ctx.query; - const projectRes = await models.Project.findAll({ + let findOption = { where: { - type + }, order: [['id', 'DESC']] - }) + } + if (type) { + findOption.where.type = type + } + if (entryName) { + findOption.where.entryName = { + $like: `%${entryName}%` + } + } + + const projectRes = await models.Project.findAll(findOption) ctx.status = 200; ctx.body = projectRes diff --git a/web/client/src/sections/quanju/containers/footer/build/index.js b/web/client/src/sections/quanju/containers/footer/build/index.js index 679eb3da..fcf232fc 100644 --- a/web/client/src/sections/quanju/containers/footer/build/index.js +++ b/web/client/src/sections/quanju/containers/footer/build/index.js @@ -48,7 +48,7 @@ const Build = (props) => { const res = await dispatch(getxuanchuan()); // setdata(alltype.filter(item=>item.name!=='null')) - setxuandata(res.payload.data) + setxuandata(res.payload.data || []) console.log(res.payload.data,'宣传栏数据') } @@ -200,7 +200,7 @@ const Build = (props) => { }} customize={true}>
{/* */} - +

全面建设好农村公路,切实发挥先行官作用