diff --git a/src/api/index.js b/src/api/index.js index cbb01af..f0bb959 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -17,4 +17,5 @@ export default { hotContent: `iasf/sysContent/hotContent`, siteSearchArticles: `iasf/sysContent/siteSearchArticles`, oneLevelChecksThemAll: `iasf/sysColumn/oneLevelChecksThemAll`, + queryArticlesByColumnType: `iasf/sysColumn/queryArticlesByColumnType`, } \ No newline at end of file diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index fa3511a..3a28a91 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -127,13 +127,16 @@ $height: 90px; outline: none; } } -@media (max-width: 1500px) { +@media (max-width: 1660px) { .header { .logo { - left: 50px; + left: 10px; + } + .search { + margin-right: 20px; } .tools { - right: 50px + right: 30px } } } diff --git a/src/libs/util.js b/src/libs/util.js index dc8fd07..1f43ffd 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -163,10 +163,10 @@ const util = { duration }); }, - // 去掉html里的标签 + // 去掉html里的标签及空格 removeTag(list, prop = 'mainBody') { list.map(e => { - e.mainBody = e[prop].replace(/<[^>]+>/g , '') + e.mainBody = e[prop].replace(/(<[^>]+>)|(( )+)/g , '') }) return list } diff --git a/src/mixins/page/index.js b/src/mixins/page/index.js index 78709ba..79d75a1 100644 --- a/src/mixins/page/index.js +++ b/src/mixins/page/index.js @@ -18,7 +18,6 @@ export default { async openLink(item) { const { link } = item if (link.linkName === '无') return false - console.log("🚀 ~ file: index.js ~ line 19 ~ openLink ~ link", link) let href = link.linkAddress const type = link.connectionType if (type === 1) { // 站内链接 @@ -28,7 +27,7 @@ export default { if (data.data.isDisable) { return Util.errorMsg('该文章已禁用!') } else { - href = '/article?id=' + link.articleId + href = '/article?articleId=' + link.articleId + '&id=' + link.columnId[link.columnId.length - 1] } } else { // 栏目 href = '/column?id=' + link.columnId[link.columnId.length - 1] @@ -41,7 +40,7 @@ export default { if (data.data.isDisable) { return Util.errorMsg('该文章已禁用!') } else { - href = '/article?id=' + link.otherArticleId + href = '/article?articleId=' + link.otherArticleId + '&id=' + link.otherColumnId[link.otherColumnId.length - 1] } } else { // 栏目 href = '/column?id=' + link.otherColumnId[link.otherColumnId.length - 1] diff --git a/src/pages/application/index.vue b/src/pages/application/index.vue index 4bf55cd..aa85502 100644 --- a/src/pages/application/index.vue +++ b/src/pages/application/index.vue @@ -102,14 +102,8 @@ export default { // 获取文章列表 const { column, site, articleNum } = json[7].form if (column.length) { - this.$post(this.api.newlyPublishedArticles, { - siteId: site, - columnIds: [column[column.length - 1]], - pageNum: 1, - pageSize: articleNum || 6 - }).then(({ data }) => { - - this.articles = Util.removeTag(data.records) + this.$post(`${this.api.queryArticlesByColumnType}?columnId=${column[column.length - 1]}`).then(({ data }) => { + this.articles = Util.removeTag(data.slice(0, articleNum || 6)) }).catch(err => {}) } } diff --git a/src/pages/column/index.vue b/src/pages/column/index.vue index 7a768aa..444c791 100644 --- a/src/pages/column/index.vue +++ b/src/pages/column/index.vue @@ -198,7 +198,7 @@ export default { // 获取栏目详情 getInfo() { this.$post(`${this.api.findColumn}?id=${this.id}`).then(({ data }) => { - this.columnTo(data) + this.columnClick(data) if (data.typeId !== 3) this.loaded = true // 非长页,才展示页面 if (!data.columnBanner) data.columnBanner = require('@/assets/images/column-banner.png') this.info = data @@ -313,9 +313,9 @@ export default { } else if (typeId === 3) { // 长页栏目直接获取path this.$router.push(`/${to.path}?id=${to.id}`).catch(err => {}) - } else if (typeId === 1 || (typeId === 4 && !to.children.length)) { + } else if (left && (typeId === 1 || (typeId === 4 && !to.children.length))) { // 常规栏目跳转到column页 - this.$router.push(`/column?id=${to.id}&column=1`).catch(err => {}) + this.$router.push(`/column?id=${to.id + (left ? '&column=1' : '')}`).catch(err => {}) } }, // 查询文章列表 @@ -336,7 +336,7 @@ export default { this.articles = Util.removeTag(data.records) this.total = +data.total // 如果栏目那勾选了“只有一篇文章时,以详情方式展示”,并且只有一篇文章,则跳转到详情页 - this.total == 1 && this.info.showWithDetails && this.$router.push(`/article?articleId=${this.articles[0].id}&id=${this.articles[0].columnId}`) + // this.total == 1 && this.info.showWithDetails && this.$router.push(`/article?articleId=${this.articles[0].id}&id=${this.articles[0].columnId}`) }).catch(res => {}) }, // 递归获取栏目所有id diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index 8c99119..46d313a 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -142,13 +142,8 @@ export default { // 获取文章列表 const { column, site, articleNum } = json[5].form if (column.length) { - this.$post(this.api.newlyPublishedArticles, { - siteId: site, - columnIds: [column[column.length - 1]], - pageNum: 1, - pageSize: articleNum || 6 - }).then(({ data }) => { - this.articles = Util.removeTag(data.records) + this.$post(`${this.api.queryArticlesByColumnType}?columnId=${column[column.length - 1]}`).then(({ data }) => { + this.articles = Util.removeTag(data.slice(0, articleNum || 6)) }).catch(err => {}) } } diff --git a/src/pages/news/index.vue b/src/pages/news/index.vue index beea1d4..f525739 100644 --- a/src/pages/news/index.vue +++ b/src/pages/news/index.vue @@ -172,13 +172,8 @@ export default { const id = e.column[e.column.length - 1] e.id = id if (e.columnTitle === 2) e.columnName = e.columnTitleCustom - this.$post(this.api.newlyPublishedArticles, { - siteId: e.site, - columnIds: [id], - pageNum: 1, - pageSize: e.articleNum || 6 - }).then(({ data }) => { - this.$set(e, 'articles', Util.removeTag(data.records)) + this.$post(`${this.api.queryArticlesByColumnType}?columnId=${id}`).then(({ data }) => { + this.$set(e, 'articles', Util.removeTag(data.slice(0, e.articleNum || 6))) }).catch(err => {}) } else { this.$set(e, 'articles', []) @@ -188,24 +183,14 @@ export default { if (json[3].form.column.length) { const { column, site, articleNum } = json[3].form - this.$post(this.api.newlyPublishedArticles, { - siteId: site, - columnIds: [column[column.length - 1]], - pageNum: 1, - pageSize: articleNum || 6 - }).then(({ data }) => { - this.articles = Util.removeTag(data.records) + this.$post(`${this.api.queryArticlesByColumnType}?columnId=${column[column.length - 1]}`).then(({ data }) => { + this.articles = Util.removeTag(data.slice(0, articleNum || 6)) }).catch(err => {}) } if (json[5].form.column.length) { const { column, site, articleNum } = json[5].form - this.$post(this.api.newlyPublishedArticles, { - siteId: site, - columnIds: [column[column.length - 1]], - pageNum: 1, - pageSize: articleNum || 5 - }).then(({ data }) => { - this.articles1 = Util.removeTag(data.records) + this.$post(`${this.api.queryArticlesByColumnType}?columnId=${column[column.length - 1]}`).then(({ data }) => { + this.articles1 = Util.removeTag(data.slice(0, articleNum || 5)) }).catch(err => {}) }