产品课程联调

master
yujialong 5 months ago
parent c9d0d17779
commit 179f12a8a7
  1. 3
      src/api/index.js
  2. 19
      src/components/breadcrumb/index.vue
  3. 6
      src/mixins/page/index.js
  4. 12
      src/pages/course/index.vue
  5. 103
      src/pages/index/list/index.vue
  6. 71
      src/pages/index/show/index.vue

@ -28,7 +28,8 @@ export default {
listMarketing: `/nakadai/nakadai/mall/marketing/promotion/pagingQueryList`,
courseProduct: `/iasf/productDetails/courseProduct`,
categoryList: `/iasf/categoryService/Category/list`,
productDetailsFind: `/iasf/productDetails/findById`,
foregroundPreview: `/iasf/productDetails/foregroundPreview`,
productDetailsPreview: `/iasf/productDetails/articlePreview`,
courseDiscipline: `/iasf/subject/courseDiscipline`,
courseProfessionalClass: `/iasf/subject/courseProfessionalClass`,
courseProfessional: `/iasf/subject/courseProfessional`,

@ -3,15 +3,11 @@
<div class="breadcrumb">
<el-breadcrumb separator=">">
<template v-for="(item, i) in data">
<el-breadcrumb-item
v-if="i != data.length - 1"
:key="i"
<el-breadcrumb-item v-if="i != data.length - 1" :key="i"
:to="{ path: item.path || '/column', query: item.query }">
{{ item.name | i18nName($i18n)}}
{{ item.name | i18nName($i18n) }}
</el-breadcrumb-item>
<el-breadcrumb-item
v-else
:key="i">
<el-breadcrumb-item v-else :key="i">
{{ item.name }}
</el-breadcrumb-item>
</template>
@ -22,7 +18,7 @@
<script>
export default {
props: ['data'],
data() {
data () {
return {
};
@ -31,7 +27,7 @@ export default {
},
filters: {
i18nName(name,type) {
i18nName (name, type) {
switch (name) {
case '专利':
return type.t('column.patent')
@ -52,11 +48,14 @@ export default {
<style lang="scss" scoped>
.breadcrumb {
margin: 4px 0 16px;
/deep/.el-breadcrumb__item {
.is-link, .el-breadcrumb__separator {
.is-link,
.el-breadcrumb__separator {
font-weight: 400;
color: $main-color;
}
&:last-child {
.is-link {
color: #0B1D30;

@ -109,8 +109,12 @@ export default {
href = this.$router.resolve(href + '&siteId=' + site).href
}
this.toHref(item.isOpen, href)
} else if (item.listStyleId === 73) { // 长页模板为产品中心的,该栏目下的文章全部跳产品详情页
this.$router.push(`/index/show?id=${item.id}`)
} else {
this.$router.push(`/article?articleId=${item.id}&siteId=${this.site}&id=${this.id}&columnName=${form.columnTitle === 2 ? form.columnTitleCustom : form.columnName}&path=${this.$route.path.replace('/', '')}`)
let href = `/article?articleId=${item.id}&siteId=${this.site}&id=${this.id}`
if (form) href += `&columnName=${form.columnTitle === 2 ? form.columnTitleCustom : form.columnName}&path=${this.$route.path.replace('/', '')}`
this.$router.push(href)
}
},
// 关联栏目的查看全部跳转

@ -43,7 +43,7 @@
<!-- <div class="course-bg"></div> -->
<template v-if="list.length">
<ul>
<li v-for="(item, index) in list" :key="index" @click="toDetail(item.id)">
<li v-for="(item, index) in list" :key="index" @click="toDetail(item)">
<img :src="item.coverImageUrl" alt="" />
<div class="title">{{ item.name }}</div>
<div class="desc" v-html="item.introduction"></div>
@ -81,11 +81,12 @@
</template>
<script>
import mixins from '@/mixins/page'
import { Loading } from "element-ui";
export default {
mixins: [mixins],
data () {
return {
id: +this.$route.query.id,
info: {},
columnBanner: '',
columns: [],
@ -237,8 +238,10 @@ export default {
//
this.$router.replace(`/${(typeId === 1 || typeId === 4) && to.templateId === 12 ? 'course' : 'column'}?id=${to.id}&siteId=${this.site}`).catch(() => { })
},
toDetail (id) {
this.$router.push(`/course/details?id=${id}`);
//
toDetail (item) {
item.listStyleId = 73 // id
this.toArtice(item)
}
}
};
@ -405,6 +408,7 @@ export default {
dl {
display: flex;
flex-wrap: wrap;
align-items: center;
padding: 12px 0;

@ -124,7 +124,7 @@
<div class="courses">
<template v-if="list.length">
<ul>
<li v-for="(item, i) in list" :key="i" @click="toDetail(item.id)">
<li v-for="(item, i) in list" :key="i" @click="toDetail(item)">
<img :src="item.coverImageUrl" alt="" />
<div class="texts">
<el-tooltip effect="dark" :visible-arrow="false" :content="item.name" placement="bottom">
@ -132,18 +132,16 @@
</el-tooltip>
<div class="desc" v-html="item.introduction"></div>
<div class="tags">
<el-tooltip v-if="item.tagsName" class="item" effect="dark" :visible-arrow="false"
:content="item.tagsName" placement="bottom">
<el-tooltip v-if="item.tag" class="item" effect="dark" :visible-arrow="false" :content="item.tag"
placement="bottom">
<div>
<el-tag v-for="(tag, i) in item.tagsName.split(',')" :key="i" class="tag">{{ tag }}</el-tag>
<el-tag v-for="(tag, i) in item.tag.split(',')" :key="i" class="tag">{{ tag }}</el-tag>
</div>
</el-tooltip>
</div>
<div :class="['metas']">
<el-tag v-if="item.typeName" effect="dark">
{{ item.typeName }}
</el-tag>
<div v-if="item.isCourse" class="meta">{{ item.totalBrowsing }}人看过</div>
<div class="metas">
<el-tag v-if="item.isTop" effect="dark" size="small">官方精选</el-tag>
<div class="meta">{{ item.totalBrowsing }}人看过</div>
</div>
</div>
</li>
@ -188,6 +186,7 @@ export default {
},
],
form: {
categoryId: '',
subjectCategoryId: '',
professionalCategoryId: '',
majorId: '',
@ -197,9 +196,6 @@ export default {
timeOrdering: '',
classificationTagId: '',
},
categoryId: '',
professionalCategoryId: '',
professionalId: '',
category: [],
professionalClasses: [],
professionals: [],
@ -240,6 +236,11 @@ export default {
};
},
watch: {
$route () {
this.id = this.$route.query.id
this.getBanner()
this.initData()
},
'form.keyWord': function (val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
@ -254,7 +255,8 @@ export default {
this.getClass()
this.initData()
},
methods: {//
methods: {
//
initAnimate () {
ScrollReveal().reveal('.animate', {
reset: true, // true, n
@ -332,36 +334,39 @@ export default {
data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing'])
this.modules = json
this.$nextTick(this.initAnimate)
console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json)
}
}).catch(err => { })
},
//
getData () {
async getData () {
try {
this.loadIns = Loading.service()
this.$post(this.api.courseProduct, {
const { data } = await this.$post(this.api.courseProduct, {
...this.form,
siteId: this.site,
pageNum: this.page,
pageSize: this.pageSize,
columnId: +this.id,
}).then(({ data }) => {
this.list = data.records
})
const list = data.records
list && list.forEach(e => {
//
if (!e.introduction) {
const el = document.createElement('div')
el.innerHTML = e.detailedDescription
e.introduction = el.innerText
}
})
this.list = list
this.total = +data.total
} finally {
this.loadIns.close()
}).catch(res => {
this.loadIns.close()
})
}
},
initData () {
this.page = 1;
this.getData();
},
//
toPart (i) {
this.active = i
// document.querySelector(`#part${i}`).scrollIntoView()
},
//
async getLabel () {
@ -407,47 +412,6 @@ export default {
this.form.majorId = item.professionalId
this.initData()
},
//
// async getSubject () {
// //
// this.$get(this.api.subjectCategoryCited).then(({ list }) => {
// list = list.filter(e => e.disciplineId != 1)
// list.map((e, i) => {
// e.id = e.disciplineId
// e.name = e.disciplineName
// //
// e.professionalClasses.map(e => {
// e.id = e.professionalClassId
// e.name = e.professionalClassName
// //
// e.professionals.map(e => {
// e.id = e.professionalId
// e.name = e.professionalName
// })
// e.children = e.professionals
// })
// e.children = e.professionalClasses
// })
// this.category = list
// }).catch(err => { })
// },
//
categoryClick (item, i) {
const { id, children } = item
this[i === 1 ? 'categoryId' : i === 2 ? 'professionalCategoryId' : 'professionalId'] = id
//
if (i === 1) {
this.professionalCategoryId = ''
this.professionalId = ''
if (children) this.professionalClasses = children
this.professionals = []
} else if (i === 2) { //
this.professionalId = ''
if (children) this.professionals = children
}
this.initData()
},
//
async getClass () {
const { data } = await this.$post(`${this.api.categoryList}?siteId=${this.site}&type=1`)
@ -482,8 +446,9 @@ export default {
this.getData();
},
//
toDetail (id) {
this.$router.push(`/index/show?id=${id}`);
toDetail (item) {
item.listStyleId = 73 // id
this.toArtice(item)
}
}
};

@ -2,6 +2,9 @@
<div class="wrap">
<div class="inner">
<Breadcrumb ref="breadcrumb" :data.sync="routes" />
<div v-loading="loading">
<!-- 非富文本详情页 -->
<template v-if="form.articleTemplate !== 72">
<div class="top">
<el-image class="pic" :src="form.coverImageUrl" :preview-src-list="[form.coverImageUrl]" />
<div class="right fadeInRight" id="fields">
@ -20,9 +23,9 @@
</div>
</el-tooltip>
</div>
<div v-if="form.applicationScenario" class="field">
<div v-if="form.applicableScenarios" class="field">
<img src="@/assets/images/product/2.png" alt=""> 适用场景
<div class="text">{{ form.applicationScenario }}</div>
<div class="text">{{ form.applicableScenarios }}</div>
</div>
<div v-if="form.matchingCourse" class="field">
<img src="@/assets/images/product/3.png" alt=""> 匹配课程
@ -33,9 +36,9 @@
</div>
</el-tooltip>
</div>
<div v-if="form.courseHours" class="field">
<div v-if="form.estimatedHours" class="field">
<img src="@/assets/images/product/4.png" alt=""> 预计课时
<div class="text">{{ form.courseHours }}</div>
<div class="text">{{ form.estimatedHours }}</div>
</div>
<div v-if="form.typeName" class="field">
<img src="@/assets/images/product/5.png" alt=""> 产品类型
@ -58,41 +61,39 @@
<div class="products">
<h6 class="fadeInUp">热门产品推荐</h6>
<ul class="product fadeInDown">
<li v-for="(item, i) in hots" :key="i" @click="toDetail(item.mallId)">
<li v-for="(item, i) in hots" :key="i" @click="toDetail(item.id)">
<img :src="item.coverImageUrl" alt="" />
<div class="texts">
<div class="title">{{ item.name }}</div>
<div :class="['desc', { 'not-tag': !item.tagsName }]" v-html="item.productIntroduction"></div>
<div v-if="item.tagsName" class="tags">
<el-tag v-for="(tag, i) in item.tagsName.split(',')" :key="i" class="tag">{{ tag }}</el-tag>
<div :class="['desc', { 'not-tag': !item.tag }]" v-html="item.introduction"></div>
<div v-if="item.tag" class="tags">
<el-tag v-for="(tag, i) in item.tag.split(',')" :key="i" class="tag">{{ tag }}</el-tag>
</div>
<div class="metas">
<div class="meta">{{ item.learningCount }}人看过</div>
<div class="meta">{{ item.totalBrowsing }}人看过</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</template>
<!-- 富文本详情只需展示详情字段 -->
<div v-else class="des" v-html="form.detailedDescription"></div>
</div>
<el-dialog title="" :visible.sync="qrcodeVisible" width="500px" center :top="qrcodeTop" custom-class="qrcode-dia">
<div>
<img width="100%" src="@/assets/images/occupationlab.png" alt="">
</div>
</el-dialog>
</div>
</template>
<script>
import Util from "@/libs/util"
import Setting from "@/setting"
import Breadcrumb from '@/components/breadcrumb'
import ScrollReveal from 'scrollreveal'
export default {
data () {
return {
id: this.$route.query.id,
loading: false,
routes: {},
curTab: 0,
tabs: [
@ -111,24 +112,43 @@ export default {
},
hots: [],
height: '',
qrcodeVisible: false,
qrcodeTop: '100px'
};
},
computed: {
site () {
return this.$route.query.siteId || this.$store.state.content.site
}
},
components: {
Breadcrumb,
},
mounted () {
const height = (window.innerHeight - 758) / 2
this.qrcodeTop = (height > 0 ? height : 0) + 'px'
this.getData()
this.getHot()
},
methods: {
//
async getData () {
const { data } = await this.$post(`${this.api.productDetailsFind}?id=${this.id}`)
this.loading = true
try {
const { data } = await this.$post(`${this.api.foregroundPreview}?id=${this.id}`)
this.form = data
this.routes = [
{
name: data.columnName,
path: '/column',
query: {
id: data.columnId,
siteId: data.siteId
}
},
{
name: data.name
}
]
this.getHot()
} finally {
this.loading = false
}
},
//
initAnimate () {
@ -224,13 +244,16 @@ export default {
const { data } = await this.$post(this.api.courseProduct, {
pageNum: 1,
pageSize: 2,
columnId: +this.id,
columnId: this.form.columnId,
sortFiltering: 2,
siteId: this.site,
keyWord: '',
})
this.hots = data.records
},
//
toDetail (id) {
this.$router.push(`/index/show?id=${id}`)
this.$router.push(`/index/show?id=${id}`).catch(() => { })
this.id = id
this.getData()
},

Loading…
Cancel
Save