diff --git a/src/api/index.js b/src/api/index.js index ec26d56..cc5a51b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -10,4 +10,6 @@ export default { findColumn: `iasf/sysColumn/findById`, queryClassif: `iasf/content/classification/allTheQuery`, queryLabel: `iasf/content/label/queryAllArticleSubjectTags`, + getsTheSubColumn: `iasf/sysColumn/getsTheSubColumn`, + getTheFullArticleByColumn: `iasf/sysColumn/getTheFullArticleByColumn`, } \ No newline at end of file diff --git a/src/layouts/footer/index.vue b/src/layouts/footer/index.vue index 015ecf9..f3054f4 100644 --- a/src/layouts/footer/index.vue +++ b/src/layouts/footer/index.vue @@ -21,7 +21,6 @@ + + \ No newline at end of file diff --git a/src/pages/article/index.vue b/src/pages/article/index.vue index 4c8c531..84b912a 100644 --- a/src/pages/article/index.vue +++ b/src/pages/article/index.vue @@ -1,14 +1,14 @@ @@ -116,7 +116,7 @@ export default { // state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing const json = JSON.parse(this.preview ? data : - data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) + data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) this.modules = json console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json) } diff --git a/src/pages/column/index.vue b/src/pages/column/index.vue index 9956391..f3b4487 100644 --- a/src/pages/column/index.vue +++ b/src/pages/column/index.vue @@ -7,10 +7,12 @@
-
+ +
所属分类: - + +
主题: - +
+ +
+
+ 类型: + + + + + +
+
-
    -
  • {{ item.columnName }}
  • +
      +
    • {{ all.columnName }}
    • +
      -
    • +
    • -

      新闻类型

      +

      {{ item.classificationName }}

      {{ item.title }}
      - {{ item.releaseTime }} | 建设进展 + + {{ item.updateTime }} {{ item.labelName && ' | ' + item.labelName }} +
    • @@ -59,7 +88,7 @@
- +

热点内容

    @@ -99,18 +128,22 @@ export default { id: this.$route.query.id, site: this.$store.state.content.site, columnId: '', - info: { - columnName: '', - columnBanner: '' - }, + info: {}, searchTimer: null, + lableId: [], form: { + classificationId: '', title: '' }, classifications: [], labels: [], columns: [], + all: null, + infoColumns: [], curColumn: 0, + showNav: false, + showNavIds: [10, 11, 12, 16], // 显示侧导航的模板id + isFilter: false, page: 1, pageSize: 10, total: 0, @@ -125,33 +158,37 @@ export default { watch: { '$route'() { this.id = this.$route.query.id - this.getInfo() + this.init() }, 'form.title': function(val) { clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.initData() + this.filter() }, 500) } }, mounted() { - this.getInfo() - this.getColumn() - this.getNews() - this.getArticle([this.id]) - this.getClassification() - this.getLabel() + this.init() }, methods: { + init() { + this.getLeftColumn() + this.getInfo() + this.getColumn() + this.getNews() + this.getLabel() + }, // 获取栏目详情 getInfo() { this.$post(`${this.api.findColumn}?id=${this.id}`).then(({ data }) => { this.info = data + this.showNav = this.showNavIds.includes(data.listStyleId) + this.getClassification() }).catch(res => {}) }, // 获取所属分类 getClassification() { - this.$post(`${this.api.queryClassif}?siteId=${this.$route.query.siteId || this.site}`).then(({ data }) => { + this.$post(`${this.api.getTheFullArticleByColumn}?id=${this.id}`).then(({ data }) => { this.classifications = data }).catch(err => {}) }, @@ -161,16 +198,32 @@ export default { this.labels = data }).catch(err => {}) }, - // 资讯 + // 左边栏目 + getLeftColumn() { + this.$post(`${this.api.getsTheSubColumn}?id=${this.id}`).then(({ data }) => { + if (data.length > 1 && !data.find(e => e.listStyleId !== data[0].listStyleId)) { + this.all = data[0] + this.getArticle(data.map(e => e.id)) + } else { + this.all = null + this.getArticle([data[data.length > 1 ? 1 : 0].id]) + data = data.slice(1) + } + this.curColumn = 0 + this.columns = data + console.log("🚀 ~ file: index.vue ~ line 212 ~ this.$post ~ columns", columns) + }).catch(err => {}) + }, + // 右边资讯 getColumn() { - this.$post(this.api.listWithTree, { + this.$post(this.api.listWithTreeMenuVisible, { siteId: this.$route.query.siteId || this.$store.state.content.site, columnName: '', templateId: '', typeId : '', - isSort: 0 + isSort: 1 }).then(({ data }) => { - this.columns = data + this.infoColumns = data }).catch(err => {}) }, // 最新资讯 @@ -183,32 +236,48 @@ export default { this.news = data.records }).catch(res => {}) }, - // 查询文章列表 - toArticle(i) { + // 点击栏目回调 + toArticle(i, all) { this.curColumn = i - this.initData() + this.page = 1 + this.getArticle(all ? this.columns.map(e => e.id) : [this.columns[i].id]) }, // 查询文章列表 getArticle(columnIds) { - this.$post(this.api.queryArticle, { - siteId: this.$route.query.siteId || this.$store.state.content.site, + this.$post(this.api.newlyPublishedArticles, { + siteId: this.$route.query.siteId || this.site, columnIds, pageNum: this.page, pageSize: this.pageSize, + labelId: this.lableId.join(), ...this.form }).then(({ data }) => { - this.articles = data.records + const list = data.records + list.map(e => { + e.mainBody = e.mainBody.replace(//g , '') // 去掉正文里的图片 + }) + this.articles = list this.total = +data.total }).catch(res => {}) }, - initData() { + // 筛选 + filter() { this.page = 1 - this.getArticle([this.columns[this.curColumn].id]) + this.isFilter = !!(this.form.classificationId || this.form.title || this.lableId.length) + const id = (this.isFilter || this.all) ? + this.columns.map(e => e.id) : + [this.columns[0].id] + this.curColumn = 0 + this.getArticle(id) }, currentChange(val) { this.page = val - this.getData() + // this.getData() }, + // 跳转文章页面 + toArtice(item) { + this.$router.push(`/article?id=${item.id}&site=${this.$route.query.siteId || this.site}`) + } } }; @@ -241,6 +310,7 @@ export default { display: flex; align-items: center; padding: 30px; + margin-bottom: 20px; background-color: #fff; .item { display: inline-flex; @@ -288,16 +358,16 @@ export default { } .contents { display: flex; - margin-top: 20px; } .columns { width: 174px; margin-right: 12px; + overflow: auto; li { display: flex; align-items: center; height: 48px; - padding-left: 24px; + padding-left: 40px; margin-bottom: 1px; font-size: 16px; color: #666; @@ -318,6 +388,9 @@ export default { &.active { border-right-color: #083A93; } + &.all { + padding-left: 24px; + } } } .articles { @@ -327,17 +400,19 @@ export default { align-items: center; margin-bottom: 20px; background-color: #fff; + cursor: pointer; } .texts { max-width: 620px; padding-left: 30px; } .type { + margin-bottom: 15px; font-size: 18px; color: #333; } h6 { - margin: 15px 0; + margin-bottom: 15px; font-size: 24px; color: #000; line-height: 38px; @@ -347,6 +422,10 @@ export default { font-size: 16px; color: #666; } + .des { + margin-top: 15px; + @include mul-ellipsis(2); + } img { width: 417px; height: 244px; diff --git a/src/pages/edu/index.vue b/src/pages/edu/index.vue index fcb30e8..a001d12 100644 --- a/src/pages/edu/index.vue +++ b/src/pages/edu/index.vue @@ -5,7 +5,7 @@
    - +
    @@ -71,7 +71,7 @@ export default { // state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing const json = JSON.parse(this.preview ? data : - data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) + data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) this.modules = json console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json) } diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index 03cd8b6..9936ae4 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -39,7 +39,7 @@

    {{ modules[4].form.des }}

    • - +
      {{ item.columnName }}
      @@ -135,14 +135,14 @@ export default { // state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing const json = JSON.parse(this.preview ? data : - data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) + data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) this.modules = json console.log("🚀 ~ file: index.vue ~ line 138 ~ this.$post ~ this.modules", this.modules) // 获取文章列表 const { column, site, articleNum } = json[5].form if (column.length) { - this.$post(this.api.queryArticle, { + this.$post(this.api.newlyPublishedArticles, { siteId: site, columnIds: [column[column.length - 1]], pageNum: 1, @@ -304,6 +304,7 @@ export default { color: #fff; } .des { + display: block; padding: 38px 60px; margin-top: 84px; font-size: 30px; @@ -312,6 +313,7 @@ export default { text-align: center; background: rgba(111, 69, 36, .56); border-radius: 17px; + overflow: visible; } } \ No newline at end of file diff --git a/src/pages/news/index.vue b/src/pages/news/index.vue index b3ac72a..bcb16b0 100644 --- a/src/pages/news/index.vue +++ b/src/pages/news/index.vue @@ -5,7 +5,7 @@
      - +
      @@ -154,7 +154,7 @@ export default { // state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing const json = JSON.parse(this.preview ? data : - data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) + data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) console.log("🚀 ~ file: index.vue ~ line 138 ~ this.$post ~ this.modules", json) // 获取文章列表 @@ -208,7 +208,46 @@ export default { }, // tab回调 tabChange(i) { - this.curColumn = i + const { column } = this.modules[1].list[i] + if (column && column.length) { + const id = column[column.length - 1] + // 查询栏目详情 + this.$post(`${this.api.findColumn}?id=${id}`).then(({ data }) => { + const { typeId } = data + // 跳转链接 + if (typeId === 2) { + let href = data.linkAddress + const cType = data.connectionType + if (cType !== 2) { // 非站外链接 + const ids = href.split('-') // 栏目文章是用-分割的,栏目是必选,文章不是必选。选择了文章则跳转到文章页,否则跳转到栏目页 + // 站点id:站内链接取当前站点,其他站点链接取siteSelection + const site = cType === 1 ? + (this.$route.query.siteId || this.site) : + data.siteSelection + if (ids[1]) { // 文章 + href = '/article?id=' + ids[1] + } else { // 栏目 + const columnIds = ids[0].split(',') + href = '/column?id=' + columnIds[columnIds.length - 1] + } + href = this.$router.resolve(href + '&siteId=' + site).href + } + // 是否新窗口打开 + if (data.isOpen) { + window.open(href) + } else { + location.href = href + } + } else if (typeId === 3) { + // 长页栏目直接获取path + this.$router.push(`/${data.path}?id=${id}`).catch(err => {}) + } else { + this.curColumn = i + } + }).catch(err => {}) + } else { + this.curColumn = i + } } } }; diff --git a/src/pages/newsPress/index.vue b/src/pages/newsPress/index.vue index 79a80c0..d72c495 100644 --- a/src/pages/newsPress/index.vue +++ b/src/pages/newsPress/index.vue @@ -5,7 +5,7 @@
      - +
      @@ -54,7 +54,7 @@ export default { // state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing const json = JSON.parse(this.preview ? data : - data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) + data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) this.modules = json console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json) } diff --git a/src/pages/newsProcurement/index.vue b/src/pages/newsProcurement/index.vue index 79a80c0..d72c495 100644 --- a/src/pages/newsProcurement/index.vue +++ b/src/pages/newsProcurement/index.vue @@ -5,7 +5,7 @@
      - +
      @@ -54,7 +54,7 @@ export default { // state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing const json = JSON.parse(this.preview ? data : - data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) + data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) this.modules = json console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json) } diff --git a/src/pages/research/index.vue b/src/pages/research/index.vue index 4d269ed..cf825c5 100644 --- a/src/pages/research/index.vue +++ b/src/pages/research/index.vue @@ -5,7 +5,7 @@
      - +
      @@ -80,7 +80,7 @@ export default { // state:已发布(1)则取theEditedJson,草稿(0)则取jsonBeforeEditing const json = JSON.parse(this.preview ? data : - data[0][data[0].state ? 'theEditedJson' : 'jsonBeforeEditing']) + data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing']) this.modules = json console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json) } diff --git a/src/router/modules/article.js b/src/router/modules/article.js index 2559cbb..469f19f 100644 --- a/src/router/modules/article.js +++ b/src/router/modules/article.js @@ -9,6 +9,12 @@ export default { path: `/${name}`, component: () => import(`@/pages/${name}`), meta: { title: '' } + }, + { + name, + path: `/${name}/activity`, + component: () => import(`@/pages/${name}/activity`), + meta: { title: '' } } ] }; diff --git a/src/styles/common.scss b/src/styles/common.scss index 5c94d53..428d235 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -9,6 +9,10 @@ font-family: SFProDisplay-Bold; src: url('font/SF-Pro-Display-Bold.otf'); } +@font-face { + font-family: toppan; + src: url('font/toppan.otf'); +} [v-cloak] { display: none; @@ -76,4 +80,17 @@ color: #fff !important; background-color: $--color-primary !important; } +} +.el-menu--popup { + min-width: 128px; + margin-top: 0; + text-align: center; + .el-menu-item { + height: 50px !important; + line-height: 50px !important; + } + span { + font-size: 18px; + color: #333; + } } \ No newline at end of file diff --git a/src/styles/font/toppan.otf b/src/styles/font/toppan.otf new file mode 100644 index 0000000..d216723 Binary files /dev/null and b/src/styles/font/toppan.otf differ