|
|
|
@ -29,6 +29,10 @@ export default { |
|
|
|
|
data.menuVisible || this.getInfo() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 保存当前页面的滚动位置
|
|
|
|
|
saveScrollTop () { |
|
|
|
|
this.$store.commit('content/setScrollTop', document.documentElement.scrollTop || document.body.scrollTop) |
|
|
|
|
}, |
|
|
|
|
// 打开链接
|
|
|
|
|
async openLink (item) { |
|
|
|
|
const { link } = item |
|
|
|
@ -38,11 +42,11 @@ export default { |
|
|
|
|
if (type === 1) { // 站内链接
|
|
|
|
|
if (link.articleId) { // 文章
|
|
|
|
|
// 查询文章详情。禁用的文章要提示
|
|
|
|
|
const data = await this.$post(`${this.api.findArticle}?id=${link.articleId}`) |
|
|
|
|
const data = await this.$post(`${this.api[link.isProduct ? 'findCourse' : 'findArticle']}?id=${link.articleId}`) // 通过isProduct区分是产品课程还是普通文章
|
|
|
|
|
if (data.data.isDisable) { |
|
|
|
|
return Util.errorMsg('该文章已禁用!') |
|
|
|
|
} else { |
|
|
|
|
href = '/article?articleId=' + link.articleId |
|
|
|
|
href = `/${link.isProduct ? 'index/show' : 'article'}?articleId=${link.articleId}` |
|
|
|
|
} |
|
|
|
|
} else { // 栏目
|
|
|
|
|
href = '/column?id=' + link.columnId[link.columnId.length - 1] |
|
|
|
@ -52,11 +56,11 @@ export default { |
|
|
|
|
} else if (type === 3) { // 站外链接
|
|
|
|
|
if (link.otherArticleId) { // 文章
|
|
|
|
|
// 查询文章详情。禁用的文章要提示
|
|
|
|
|
const data = await this.$post(`${this.api.findArticle}?id=${link.otherArticleId}`) |
|
|
|
|
const data = await this.$post(`${this.api[link.isProduct ? 'findCourse' : 'findArticle']}?id=${link.otherArticleId}`) |
|
|
|
|
if (data.data.isDisable) { |
|
|
|
|
return Util.errorMsg('该文章已禁用!') |
|
|
|
|
} else { |
|
|
|
|
href = '/article?articleId=' + link.otherArticleId |
|
|
|
|
href = `/${link.isProduct ? 'index/show' : 'article'}?articleId=${link.otherArticleId}` |
|
|
|
|
} |
|
|
|
|
} else { // 栏目
|
|
|
|
|
href = '/column?id=' + link.otherColumnId[link.otherColumnId.length - 1] |
|
|
|
@ -64,6 +68,8 @@ export default { |
|
|
|
|
href += '&siteId=' + link.site |
|
|
|
|
if (!link.otherArticleId) href = this.$router.resolve(href).href |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.saveScrollTop() |
|
|
|
|
// 如果是站内/站外链接,并且选择的是文章,则要获取当前长页名称传到文章详情里,面包屑点返回的时候需要返回到当前长页
|
|
|
|
|
if ((type === 1 && link.articleId) || (type === 3 && link.otherArticleId)) { |
|
|
|
|
this.$post(`${this.api.findColumn}?id=${this.id}`).then(({ data }) => { |
|
|
|
@ -90,7 +96,8 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 跳转文章页面
|
|
|
|
|
toArtice (item, form) { |
|
|
|
|
async toArtice (item, form) { |
|
|
|
|
this.saveScrollTop() |
|
|
|
|
if (item.articleTemplate === 24) { // 链接
|
|
|
|
|
let href = item.linkAddress |
|
|
|
|
const cType = item.connectionType |
|
|
|
@ -109,7 +116,7 @@ export default { |
|
|
|
|
href = this.$router.resolve(href + '&siteId=' + site).href |
|
|
|
|
} |
|
|
|
|
this.toHref(item.isOpen, href) |
|
|
|
|
} else if (item.listStyleId === 73) { // 长页模板为产品中心的,该栏目下的文章全部跳产品详情页
|
|
|
|
|
} else if (item.listStyleId === 73 || item.listStyleId === 78) { // 长页模板为产品中心的,或者栏目模板为产品课程的,该栏目下的文章全部跳产品详情页
|
|
|
|
|
this.$router.push(`/index/show?articleId=${item.id}&siteId=${this.site}`) |
|
|
|
|
} else { |
|
|
|
|
let href = `/article?articleId=${item.id}&siteId=${this.site}&id=${this.id}` |
|
|
|
@ -119,6 +126,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 关联栏目的查看全部跳转
|
|
|
|
|
toAll (form) { |
|
|
|
|
this.saveScrollTop() |
|
|
|
|
this.$router.push(`/column?id=${form.column[form.column.length - 1]}&siteId=${form.site}`) |
|
|
|
|
}, |
|
|
|
|
// 判断是否有添加链接
|
|
|
|
|