yujialong 5 months ago
parent fe1bfc28d8
commit 95773d1d73
  1. 3
      src/App.vue
  2. 3
      src/api/index.js
  3. 2
      src/layouts/footer/index.vue
  4. 12
      src/layouts/header/index.vue
  5. 14
      src/layouts/home/index.vue
  6. 2
      src/layouts/navbar/index.vue
  7. 7
      src/mixins/article/index.js
  8. 20
      src/mixins/page/index.js
  9. 11
      src/pages/article/index.vue
  10. 4
      src/pages/course/index.vue
  11. 8
      src/pages/home/index.vue
  12. 4
      src/pages/index/list/index.vue
  13. 6
      src/store/modules/content.js

@ -55,6 +55,7 @@ export default {
}, 500)
},
mounted () {
console.log(33, this.$route)
window.onbeforeunload = function () {
sessionStorage.removeItem('navPageSize')
}
@ -82,7 +83,7 @@ export default {
}
}
},
setNav(num) {
setNav (num) {
this.$store.commit('updateModelType', true)
this.$store.dispatch('updateNavSumA', num)
sessionStorage.setItem('navPageSize', num)

@ -29,12 +29,13 @@ export default {
listMarketing: `/nakadai/nakadai/mall/marketing/promotion/pagingQueryList`,
courseProduct: `/iasf/productDetails/courseProduct`,
categoryList: `/iasf/categoryService/Category/list`,
foregroundPreview: `/iasf/productDetails/foregroundPreview`,
findCourse: `/iasf/productDetails/findById`,
productDetailsPreview: `/iasf/productDetails/articlePreview`,
courseDiscipline: `/iasf/subject/courseDiscipline`,
courseProfessionalClass: `/iasf/subject/courseProfessionalClass`,
courseProfessional: `/iasf/subject/courseProfessional`,
hasBeenCitedInTheArticle: `/iasf/categoryService/Category/hasBeenCitedInTheArticle`,
// 产品中心
productCategoryList: `${host}/nakadai/productClassification/productCategoryList`,
productTypeList: `${host}/nakadai/productType/productTypeList`,

@ -477,7 +477,7 @@ export default {
width: 100%;
height: 100%;
background: url(../../assets/images/footer-bg1.jpg) 0 0/cover no-repeat;
opacity: .3;
opacity: .2;
}
.inner {

@ -12,7 +12,7 @@
@showMoreBtns="updateBtnsType"></navbar>
<!-- 导航最右侧工具栏 -->
<div class="tools">
<div v-for="(item, i) in tools" :key="i" class="item" @click="toolClick(item)">
<div v-for="(item, i) in tools.slice(0, 5)" :key="i" class="item" @click="toolClick(item)">
<img v-if="item.icon" :src="item.icon" alt="" class="icon">
<span v-if="item.buttonText" class="text">{{ item.buttonText }}</span>
</div>
@ -32,8 +32,14 @@
<div v-else class="mobile-tools">
<!-- 导航最右侧工具栏 -->
<div class="tools">
<template v-if="tools.length < 3">
<div v-for="(item, i) in tools" :key="i" class="item" @click="toolClick(item)">
<img v-if="item.icon" :src="item.icon" alt="" class="icon">
<span v-if="item.buttonText" class="text">{{ item.buttonText }}</span>
</div>
</template>
<!-- 如果图标超过5个则显示省略号 -->
<el-popover placement="bottom" width="297" trigger="click" popper-class="tool-more">
<el-popover v-else placement="bottom" width="297" trigger="click" popper-class="tool-more">
<ul class="more-wrap">
<li v-for="(item, i) in tools" :key="i" class="item" @click="toolClick(item)">
<img v-if="item.icon" :src="item.icon" alt="" class="icon">
@ -218,7 +224,7 @@ $height: 90px;
&:not(.channel) {
background-color: #fff;
border-bottom: 1px solid #f7f7f7;
border-bottom: 1px solid #f3f3f3;
}
&.estate {

@ -44,6 +44,20 @@ export default {
siteId: +this.$route.query.siteId || this.$store.state.content.site
}).then(({ data }) => {
if (data.length) {
// favicon
if (data[0].iconUrl) {
const link = document.createElement('link')
link.rel = 'icon'
const name = data[0].iconSuffix.split('.').pop()
// typ
link.type = name === 'png' ? 'image/png' :
name === 'ico' ? 'image/x-icon' :
name === 'svg' ? 'image/svg+xml'
: 'image/jpeg'
link.href = data[0].iconUrl
document.head.appendChild(link)
}
document.querySelector('meta[name="keywords"]').setAttribute('content', data[0].keyword)
document.querySelector('meta[name="description"]').setAttribute('content', data[0].description)
document.querySelector('title').innerHTML = data[0].title

@ -157,7 +157,7 @@ export default {
</script>
<style lang="scss" scoped>
$height: 90px;
$height: 89px;
.moreBtns {
font-size: 1rem;

@ -16,7 +16,7 @@ export default {
},
methods: {
// 点击栏目回调
columnTo (to) {
async columnTo (to) {
const { typeId, menuVisible } = to
// 跳转链接
if (typeId === 2) {
@ -31,7 +31,10 @@ export default {
to.siteSelection
if (ids[1]) { // 文章
const columnIds = ids[0].split(',')
href = `/article?articleId=${ids[1]}&id=${columnIds[columnIds.length - 1]}`
const columnId = columnIds[columnIds.length - 1]
// 查询文章所属的栏目是否是产品课程
const { data } = await this.$post(`${this.api.findColumn}?id=${columnId}`)
href = `/${data.templateId === 12 || data.listStyleId === 73 ? 'index/show' : 'article'}?articleId=${ids[1]}&id=${columnId}`
} else { // 栏目
const columnIds = ids[0].split(',')
href = '/column?id=' + columnIds[columnIds.length - 1]

@ -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}`)
},
// 判断是否有添加链接

@ -156,12 +156,11 @@ export default {
}
},
//
getColumnInfo () {
this.columnId && this.$post(`${this.api.findColumn}?id=${this.columnId}`)
.then(({ data }) => {
if (data.detailStyleId == 69) this.isParty = 1
})
.catch((res) => { });
async getColumnInfo () {
if (this.columnId) {
const { data } = await this.$post(`${this.api.findColumn}?id=${this.columnId}`)
if (data.detailStyleId == 69) this.isParty = 1
}
},
// banner
getBanner (data) {

@ -240,12 +240,12 @@ export default {
},
//
async getCategory () {
const { data } = await this.$post(`${this.api.categoryList}?siteId=${this.site}&type=0`)
const { data } = await this.$post(`${this.api.hasBeenCitedInTheArticle}?siteId=${this.site}&type=0`)
this.categories = data
},
//
async getClassification () {
const { data } = await this.$post(`${this.api.categoryList}?siteId=${this.site}&type=1`)
const { data } = await this.$post(`${this.api.hasBeenCitedInTheArticle}?siteId=${this.site}&type=1`)
this.classifications = data
},
//

@ -170,6 +170,14 @@ export default {
if (column.length) {
this.$post(`${this.api.queryArticlesByColumnType}?columnId=${column[column.length - 1]}`).then(({ data }) => {
this.articles = Util.removeTag(data.slice(0, articleNum || 6))
this.$nextTick(() => {
const { scrollTop } = this.$store.state.content
if (scrollTop) {
document.documentElement.scrollTop = scrollTop
this.$store.commit('content/setScrollTop', 0)
}
})
}).catch(err => { })
}
}

@ -372,7 +372,7 @@ export default {
//
async getLabel () {
const { data } = await this.$post(`${this.api.categoryList}?siteId=${this.site}&type=0`)
const { data } = await this.$post(`${this.api.hasBeenCitedInTheArticle}?siteId=${this.site}&type=0`)
this.labels = data
},
@ -417,7 +417,7 @@ export default {
},
//
async getClass () {
const { data } = await this.$post(`${this.api.categoryList}?siteId=${this.site}&type=1`)
const { data } = await this.$post(`${this.api.hasBeenCitedInTheArticle}?siteId=${this.site}&type=1`)
this.types = data
},
// tab

@ -7,7 +7,8 @@ export default {
namespaced: true,
state: {
site: 1,
keyword: ''
keyword: '',
scrollTop: 0,
},
getters: {
site: state => {
@ -21,6 +22,9 @@ export default {
setKeyword: (state, keyword) => {
state.keyword = keyword
},
setScrollTop: (state, val) => {
state.scrollTop = val
},
},
actions: {

Loading…
Cancel
Save