diff --git a/src/mixins/page/index.js b/src/mixins/page/index.js index e2e91a6..3266d2d 100644 --- a/src/mixins/page/index.js +++ b/src/mixins/page/index.js @@ -3,6 +3,7 @@ import Util from '@/libs/util' export default { data() { return { + site: this.$store.state.content.site, id: this.$route.query.id, preview: this.$route.query.preview, modules: [], @@ -13,18 +14,37 @@ export default { this.getInfo() }, methods: { - // banner打开链接 + // 打开链接 openLink(item) { const { link } = item + if (link.linkName === '无') return false + console.log("🚀 ~ file: index.js ~ line 19 ~ openLink ~ link", link) let href = link.linkAddress - if (link.connectionType !== 2) { - + const type = link.connectionType + if (type === 1) { + if (link.articleId) { // 文章 + href = '/article?id=' + link.articleId + } else { // 栏目 + href = '/column?id=' + link.columnId[link.columnId.length - 1] + } + href = this.$router.resolve(href + '&siteId=' + (this.$route.query.siteId || this.site)).href + } else if (type === 3) { + if (link.otherArticleId) { // 文章 + href = '/article?id=' + link.otherArticleId + } else { // 栏目 + href = '/column?id=' + link.otherColumnId[link.otherColumnId.length - 1] + } + href = this.$router.resolve(href + '&siteId=' + link.site).href } if (link.isOpen) { window.open(href) } else { location.href = href } + }, + // 跳转文章页面 + toArtice(item) { + this.$router.push(`/article?id=${item.id}&site=${this.$route.query.siteId || this.site}`) } } }; \ No newline at end of file diff --git a/src/pages/about/index.vue b/src/pages/about/index.vue index 097b014..256597c 100644 --- a/src/pages/about/index.vue +++ b/src/pages/about/index.vue @@ -3,7 +3,7 @@ @@ -119,17 +119,17 @@

{{ modules[17].form.title }}

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