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}>