|
@@ -1,8 +1,21 @@
|
|
|
<template>
|
|
|
<div id="courseContent">
|
|
|
<div style="margin-bottom: 20px">
|
|
|
- <el-button @click="addCourse" size="small" v-if="!submitStatusInfo"
|
|
|
- >添加</el-button
|
|
|
+ <el-button
|
|
|
+ v-if="!submitStatusInfo"
|
|
|
+ @click="addCourse"
|
|
|
+ size="small"
|
|
|
+ :disabled="tableData.length > 0 && tableData[0].type > 0"
|
|
|
+ >添加课程</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="!submitStatusInfo"
|
|
|
+ @click="addMoreList"
|
|
|
+ size="small"
|
|
|
+ :disabled="
|
|
|
+ tableData.length > 0 && tableData[0].courseName ? true : false
|
|
|
+ "
|
|
|
+ >添加模块/章/节</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
@click="openAudition"
|
|
@@ -32,7 +45,7 @@
|
|
|
:default-sort="{ prop: 'sort', order: 'ascending' }"
|
|
|
>
|
|
|
<el-table-column
|
|
|
- v-for="(item, index) in tableSetVideo"
|
|
|
+ v-for="(item, index) in compayTypes(tableSetVideo)"
|
|
|
:width="item.width"
|
|
|
:key="index"
|
|
|
:label="item.label"
|
|
@@ -53,6 +66,15 @@
|
|
|
? "回放"
|
|
|
: "未知"
|
|
|
}}</span>
|
|
|
+ <span v-else-if="item.scope === 'type'">{{
|
|
|
+ scope.row[item.prop] === 1
|
|
|
+ ? "模块"
|
|
|
+ : scope.row[item.prop] === 2
|
|
|
+ ? "章"
|
|
|
+ : scope.row[item.prop] === 3
|
|
|
+ ? "节"
|
|
|
+ : "未知"
|
|
|
+ }}</span>
|
|
|
<span v-else-if="item.scope === 'busin'">
|
|
|
{{ scope.row[item.prop1] + " - " + scope.row[item.prop2] }}
|
|
|
</span>
|
|
@@ -98,6 +120,11 @@
|
|
|
@uploadArrays="uploadArrays"
|
|
|
/>
|
|
|
<course-check ref="courseCheck" @backData="backVideoData" />
|
|
|
+ <more-list-check
|
|
|
+ ref="moreListCheck"
|
|
|
+ @backData="backMoreListData"
|
|
|
+ :bfCourseId="bfCourseId"
|
|
|
+ />
|
|
|
<play-photo ref="playPhoto" @backData="backPlayPhotoData" />
|
|
|
<every-day-study-num ref="everyDayStudyNum" @backData="backEveryDaySet" />
|
|
|
<handout-view ref="handoutView" @backData="backHandoutView" />
|
|
@@ -107,6 +134,7 @@
|
|
|
<script>
|
|
|
import poppleSet from "../../poppleSet.vue";
|
|
|
import courseCheck from "./courseCheck.vue";
|
|
|
+import moreListCheck from "./moreListCheck.vue";
|
|
|
import playPhoto from "./playPhoto.vue";
|
|
|
import everyDayStudyNum from "./everyDayStudyNum.vue";
|
|
|
import handoutView from "./handoutView.vue";
|
|
@@ -115,6 +143,7 @@ export default {
|
|
|
components: {
|
|
|
poppleSet,
|
|
|
courseCheck,
|
|
|
+ moreListCheck,
|
|
|
playPhoto,
|
|
|
everyDayStudyNum,
|
|
|
handoutView,
|
|
@@ -124,34 +153,62 @@ export default {
|
|
|
return {
|
|
|
tableSetVideo: [
|
|
|
{ label: "排序", prop: "sort", scope: "inputs", width: "100" },
|
|
|
- { label: "课程编码", prop: "code", width: "140" },
|
|
|
- { label: "课程名称", prop: "courseName", width: "190" },
|
|
|
- { label: "科目", prop: "subjectName", width: "150" },
|
|
|
- { label: "专业", prop: "categoryName" },
|
|
|
- { label: "院校", prop: "schoolName", width: "150" },
|
|
|
- {
|
|
|
- label: "业务层次",
|
|
|
- prop1: "projectName",
|
|
|
- prop2: "businessName",
|
|
|
- scope: "busin",
|
|
|
- width: "350px",
|
|
|
- },
|
|
|
- { label: "教育类型", prop: "educationName", width: "160" },
|
|
|
+ { label: "编码", prop: "code", width: "140" },
|
|
|
+ { label: "课程名称", prop: "courseName", width: "300", type: 1 },
|
|
|
+ { label: "类型", prop: "type", width: "190", type: 2, scope: "type" },
|
|
|
+ { label: "名称", prop: "menuName", width: "300", type: 2 },
|
|
|
+ { label: "科目", prop: "subjectName", width: "150", type: 1 },
|
|
|
+ { label: "专业", prop: "categoryName", type: 1 },
|
|
|
+ { label: "院校", prop: "schoolName", width: "150", type: 1 },
|
|
|
+ // {
|
|
|
+ // label: "业务层次",
|
|
|
+ // prop1: "projectName",
|
|
|
+ // prop2: "businessName",
|
|
|
+ // scope: "busin",
|
|
|
+ // width: "350px",
|
|
|
+ // type: 1,
|
|
|
+ // },
|
|
|
+ // { label: "教育类型", prop: "educationName", width: "160", type: 1 },
|
|
|
{
|
|
|
label: "发布状态",
|
|
|
prop: "publishStatus",
|
|
|
scope: "Status",
|
|
|
- width: "120",
|
|
|
},
|
|
|
],
|
|
|
tableData: [],
|
|
|
auditionList: [], //试听数据
|
|
|
+ bfCourseId: 0,
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ tableData(val) {
|
|
|
+ if (val.length === 0) {
|
|
|
+ this.auditionList = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ compayTypes: function () {
|
|
|
+ return function (array) {
|
|
|
+ let ary = [];
|
|
|
+ ary = array.filter((item) => {
|
|
|
+ if (this.tableData.length > 0) {
|
|
|
+ if (this.tableData[0].type) {
|
|
|
+ return item.type !== 1;
|
|
|
+ } else {
|
|
|
+ return item.type !== 2;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return ary;
|
|
|
+ };
|
|
|
+ },
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.$bus.$on("sendBybus", () => {
|
|
|
this.tableData = [];
|
|
|
- this.auditionList = [];
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
@@ -160,6 +217,25 @@ export default {
|
|
|
*/
|
|
|
getBybusCoursetableData(id) {
|
|
|
this.$api.obtainCourseSgoodsId(id).then((res) => {
|
|
|
+ if (res.rows.length === 1 && res.rows[0].courseShow === 0) {
|
|
|
+ this.bfCourseId = res.rows[0].courseId;
|
|
|
+ this.getMoreList(res.rows[0].courseId);
|
|
|
+ this.auditionList.forEach((item) => {
|
|
|
+ item.courseId = res.rows[0].courseId;
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.tableData = res.rows;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取商品模块/章/节列表
|
|
|
+ */
|
|
|
+ getMoreList(id) {
|
|
|
+ this.$api.inquireCoursemenuListS({ courseId: id }).then((res) => {
|
|
|
+ res.rows.forEach((item) => {
|
|
|
+ item.name = item.menuName;
|
|
|
+ });
|
|
|
this.tableData = res.rows;
|
|
|
});
|
|
|
},
|
|
@@ -220,14 +296,71 @@ export default {
|
|
|
* 删除课程
|
|
|
*/
|
|
|
delCourse(item) {
|
|
|
- const FINDINDEX = this.tableData.findIndex((items) => {
|
|
|
- return items.courseId === item.courseId;
|
|
|
- });
|
|
|
- this.tableData.splice(FINDINDEX, 1);
|
|
|
- this.auditionList = this.auditionList.filter((items) => {
|
|
|
- return items.courseId !== item.courseId;
|
|
|
+ if (this.tableData[0].type) {
|
|
|
+ const FINDINDEX = this.tableData.findIndex((items) => {
|
|
|
+ return items.type === item.type && item.menuId === item.menuId;
|
|
|
+ });
|
|
|
+ this.tableData.splice(FINDINDEX, 1);
|
|
|
+ this.auditionList = this.auditionList.filter((items) => {
|
|
|
+ return items.TypeId !== item.TypeId;
|
|
|
+ });
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ } else {
|
|
|
+ const FINDINDEX = this.tableData.findIndex((items) => {
|
|
|
+ return items.courseId === item.courseId;
|
|
|
+ });
|
|
|
+ this.tableData.splice(FINDINDEX, 1);
|
|
|
+ this.auditionList = this.auditionList.filter((items) => {
|
|
|
+ return items.courseId !== item.courseId;
|
|
|
+ });
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 点击添加函数
|
|
|
+ */
|
|
|
+ addMoreList() {
|
|
|
+ //搜索条件
|
|
|
+ var data = {
|
|
|
+ businessId: this.listData.businessId,
|
|
|
+ subjectIds: this.listData.subjectIds.toString(),
|
|
|
+ status: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageNum: 1,
|
|
|
+ publishStatus: 1,
|
|
|
+ };
|
|
|
+ //已选模块/章/节
|
|
|
+ var aList = this.tableData.map((item) => {
|
|
|
+ return `${item.type}-${item.menuId}`;
|
|
|
});
|
|
|
- this.$message.success("删除成功");
|
|
|
+ //打开选择模块/章/节组件
|
|
|
+ this.$refs.moreListCheck.openBox(
|
|
|
+ data,
|
|
|
+ aList,
|
|
|
+ this.listData.educationTypeId
|
|
|
+ );
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 选择模块/章/节回调数据
|
|
|
+ */
|
|
|
+ backMoreListData(array) {
|
|
|
+ let copyData = JSON.parse(JSON.stringify(array));
|
|
|
+ if (this.tableData.length) {
|
|
|
+ let maxIndex = 0;
|
|
|
+ this.tableData.forEach((item) => {
|
|
|
+ if (item.sort > maxIndex) {
|
|
|
+ maxIndex = item.sort;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ copyData.forEach((item, index) => {
|
|
|
+ item.sort = maxIndex + index + 1;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ copyData.forEach((item, index) => {
|
|
|
+ item.sort = index + 1;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.tableData = this.tableData.concat(copyData);
|
|
|
},
|
|
|
/**
|
|
|
* 点击试听函数
|