课件详情报错显示不出来值
This commit is contained in:
parent
b3b9720595
commit
8e96e27efa
|
@ -16,9 +16,11 @@
|
||||||
</div>
|
</div>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item label="标签">
|
<a-descriptions-item label="标签">
|
||||||
|
<template v-if="detailData.courseTags && detailData.courseTags.length > 0">
|
||||||
<a-tag color="blue" v-for="(item, index) in detailData.courseTags" :key="index">
|
<a-tag color="blue" v-for="(item, index) in detailData.courseTags" :key="index">
|
||||||
{{ getDictLabelByKey('dictCourseTag', item.dictValue) }}
|
{{ getDictLabelByKey('dictCourseTag', item.dictValue) }}
|
||||||
</a-tag>
|
</a-tag>
|
||||||
|
</template>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
</a-descriptions>
|
</a-descriptions>
|
||||||
<div class="buttonGroup">
|
<div class="buttonGroup">
|
||||||
|
@ -28,72 +30,72 @@
|
||||||
</a-card>
|
</a-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import _ from 'lodash'
|
import _ from 'lodash';
|
||||||
import { getCourseDetails } from '@/api/course/course'
|
import { getCourseDetails } from '@/api/course/course';
|
||||||
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
import { dictionaryDropDown } from '@/api/sys/dictionaryItem';
|
||||||
export default {
|
export default {
|
||||||
name: 'Details',
|
name: 'Details',
|
||||||
components: {},
|
components: {},
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryParam: { id: this.$route.query.id },
|
queryParam: { id: this.$route.query.id },
|
||||||
detailData: {
|
detailData: {
|
||||||
imagePath: '', // 图片路径
|
imagePath: '', // 图片路径
|
||||||
coverPath: []
|
coverPath: [],
|
||||||
},
|
},
|
||||||
dictCourseType: [],
|
dictCourseType: [],
|
||||||
dictCourseTag: [],
|
dictCourseTag: [],
|
||||||
tags: [] // 用于存放标签
|
tags: [], // 用于存放标签
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
// 调用词典
|
// 调用词典
|
||||||
this.loadData()
|
this.loadData();
|
||||||
this.dictionaryDropDown()
|
this.dictionaryDropDown();
|
||||||
this.getTagName()
|
this.getTagName();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 加载数据
|
// 加载数据
|
||||||
loadData () {
|
loadData() {
|
||||||
const parameter = {}
|
const parameter = {};
|
||||||
getCourseDetails(Object.assign(parameter, this.queryParam)).then(res => {
|
getCourseDetails(Object.assign(parameter, this.queryParam)).then(res => {
|
||||||
this.detailData = res.data
|
this.detailData = res.data;
|
||||||
|
|
||||||
this.detailData.coverPath = JSON.parse(res.data.coverPath)
|
this.detailData.coverPath = JSON.parse(res.data.coverPath);
|
||||||
console.log('JSON:::::', this.detailData.coverPath)
|
console.log('JSON:::::', this.detailData.coverPath);
|
||||||
|
|
||||||
if (this.detailData.coverPath.length != 0) {
|
if (this.detailData.coverPath && this.detailData.coverPath.length != 0) {
|
||||||
this.detailData.imagePath = this.detailData.coverPath[0].url
|
this.detailData.imagePath = this.detailData.coverPath[0].url;
|
||||||
}
|
}
|
||||||
console.log('url', this.detailData.imagePath)
|
console.log('url', this.detailData.imagePath);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
close () {
|
close() {
|
||||||
this.$router.push({ path: '/course/CourseList/' + this.$route.query.type, query: {} })
|
this.$router.push({ path: '/course/CourseList/' + this.$route.query.type, query: {} });
|
||||||
},
|
},
|
||||||
edit (record) {
|
edit(record) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/course/CourseAdd',
|
path: '/course/CourseAdd',
|
||||||
query: { id: this.queryParam.id, type: this.$route.query.type }
|
query: { id: this.queryParam.id, type: this.$route.query.type },
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
getDictLabelByKey (name, value) {
|
getDictLabelByKey(name, value) {
|
||||||
let result = '-'
|
let result = '-';
|
||||||
const list = this[name]
|
const list = this[name];
|
||||||
if (Array.isArray(list)) {
|
if (Array.isArray(list)) {
|
||||||
const item = _.find(list, ['value', value])
|
const item = _.find(list, ['value', value]);
|
||||||
if (item) {
|
if (item) {
|
||||||
result = item.name
|
result = item.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result;
|
||||||
},
|
},
|
||||||
// 获取数据字典
|
// 获取数据字典
|
||||||
dictionaryDropDown () {
|
dictionaryDropDown() {
|
||||||
// 课程类别
|
// 课程类别
|
||||||
dictionaryDropDown({ dictionaryCode: '0006' }).then(res => {
|
dictionaryDropDown({ dictionaryCode: '0006' }).then(res => {
|
||||||
this.dictCourseType = res.data
|
this.dictCourseType = res.data;
|
||||||
|
|
||||||
// // 课程类别的value转换成字典name
|
// // 课程类别的value转换成字典name
|
||||||
// for (let i = 0; i < this.dictCourseType.length; i++) {
|
// for (let i = 0; i < this.dictCourseType.length; i++) {
|
||||||
|
@ -101,13 +103,13 @@ export default {
|
||||||
// this.detailData.courseTypeName = this.dictCourseType[i].name
|
// this.detailData.courseTypeName = this.dictCourseType[i].name
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
getTagName () {
|
getTagName() {
|
||||||
dictionaryDropDown({ dictionaryCode: '0008' }).then(res => {
|
dictionaryDropDown({ dictionaryCode: '0008' }).then(res => {
|
||||||
this.dictCourseTag = res.data
|
this.dictCourseTag = res.data;
|
||||||
|
|
||||||
console.log(this.dictCourseTag)
|
console.log(this.dictCourseTag);
|
||||||
|
|
||||||
// const tags = []
|
// const tags = []
|
||||||
// for (let i = 0; i < this.dictCourseTag.length; i++) {
|
// for (let i = 0; i < this.dictCourseTag.length; i++) {
|
||||||
|
@ -119,10 +121,10 @@ export default {
|
||||||
// }
|
// }
|
||||||
// console.log('tagagagaga', tags)
|
// console.log('tagagagaga', tags)
|
||||||
// this.detailData.tags = tags
|
// this.detailData.tags = tags
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in New Issue