课程管理功能细化

This commit is contained in:
@fawn-nine
2024-06-11 16:03:10 +08:00
parent 2620d1bbbb
commit 83987414aa
4 changed files with 380 additions and 22 deletions

View File

@@ -66,7 +66,6 @@
:inactive-value="0"
active-text=""
inactive-text=""
>
</el-switch>
</el-form-item>
@@ -91,10 +90,44 @@
>
</quill-editor>
</el-form-item>
<!-- <el-form-item label="视频/音频ID" prop="sort">
<el-input v-model="dataForm.sort" placeholder="请输入视频/音频ID"></el-input>
</el-form-item>
<div><span>添加一项</span></div> --->
<!-- <el-form-item prop="sort" label-width="0"> -->
<div
class="flexbox videoBox"
v-for="(item, index) in video_audio_url"
:key="index"
>
<div style="width:120px">视频/音频ID</div>
<div style="width:300px; margin-right:10px; margin-left:10px">
<el-input
style=""
v-model="item.url"
placeholder="请输入视频/音频ID"
></el-input>
</div>
<div style="margin-right:10px; height:38px">
<el-form-item label="加密类型" prop="type">
<el-select
v-model="item.type"
filterable
placeholder="请选择类型"
>
<el-option
v-for="item in typeList"
:key="item.dictType"
:label="item.dictValue"
:value="item.dictType"
>
</el-option>
</el-select>
</el-form-item>
</div>
<el-button @click="delItem(index)" plain type="danger" size="mini">删除</el-button>
</div>
<!-- </el-form-item> -->
<div style="text-align:center">
<el-button @click="addItem">添加一条音/视频</el-button>
</div>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
@@ -171,6 +204,18 @@ export default {
dictType: "",
dictValue: ""
},
typeList: [
//类型0普通1加密
{
dictType: 0,
dictValue: "普通"
},
{
dictType: 1,
dictValue: "加密"
}
],
gushuList: [],
authorList: [],
restaurants: [],
@@ -187,8 +232,15 @@ export default {
title: "",
imgUrl: "",
content: "",
sort: 1
},
sort: 1,
// video_audio_url: [
// {url:'454545',type:0}
// ]
},
video_audio_url: [
{url:'454545',type:0}
],
obj:{ url: "" ,type:0},
splitsTypeList: [],
dataRule: {}
};
@@ -199,6 +251,16 @@ export default {
created() {},
mounted() {},
methods: {
delItem(index){
this.video_audio_url.splice(index, 1)
// console.log(this.video_audio_url,'删除后的')
},
addItem() {
var jj = {...this.obj}
this.video_audio_url.push({...jj});
console.log(this.video_audio_url,'this.dataForm.video_audio_url')
},
contentUploadSuccess(res, file) {
// console.log(res)
let quill = this.$refs.myQuillEditor.quill;
@@ -233,6 +295,11 @@ export default {
this.dataForm.courseId = courseid ? courseid : "";
this.dataForm.catalogueId = catalogue_id ? catalogue_id : "";
this.visible = true;
if(this.dataForm.video_audio_url && this.dataForm.video_audio_url.length > 0){
this.video_audio_url = {...this.dataForm.video_audio_url}
}else{
this.video_audio_url = []
}
if (this.dataForm.imgUrl && this.dataForm.imgUrl != "") {
var img = {
name: "",
@@ -267,6 +334,7 @@ export default {
content: this.dataForm.content,
sort: this.dataForm.sort,
isAudition: this.dataForm.isAudition,
video_audio_url:this.video_audio_url,
})
}).then(({ data }) => {
if (data && data.code === 0) {
@@ -345,3 +413,11 @@ export default {
}
};
</script>
<style lang="less" scoped>
.flexbox {
display: flex;
}
.videoBox { width: 100%;
margin-bottom: 15px; align-items: center;
}
</style>

View File

@@ -162,6 +162,10 @@
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
<move-course
v-if="drawerVisible"
ref="moveCourse" @mycloseDrawer="mycloseDrawer"
></move-course>
<price
v-if="priceVisible"
ref="priceUpdate"
@@ -171,6 +175,7 @@
</template>
<script>
import moveCourse from "./moveCourse.vue";
import AddOrUpdate from "./catalogue-add-or-update";
import price from "./catalogue-price";
export default {
@@ -185,6 +190,7 @@ export default {
sociologyId: "",
keywords: ""
},
drawerVisible:false,
dataList: [],
delFlag: false,
pageIndex: 1,
@@ -201,7 +207,8 @@ export default {
},
components: {
AddOrUpdate,
price
price,
moveCourse
},
activated() {
this.courseid = this.$route.query.id;
@@ -237,7 +244,12 @@ export default {
}
this.dataListLoading = false;
});
},
},
mycloseDrawer(val){
console.log('999999',val)
this.drawerVisible = false
this.getDataList()
},
migrate(item){
// 课程迁移
console.log(item)
@@ -246,15 +258,16 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.drawerVisible = true
this.$nextTick(() => {
this.$refs["moveCourse"].getDataList();
});
// this.$message({
// type: 'success',
// message: '删除成功!'
// });
}).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
})
},
// 每页数

View File

@@ -67,6 +67,18 @@
align="center"
label="课程名"
>
<template slot-scope="scope">
<div>
<span>{{ scope.row.title }}</span>
<el-tooltip placement="bottom" effect="light">
<div slot="content">多行信息<br />第二行信息多行信息<br />第二行信息多行信息<br />第二行信息多行信息第二行信息多行信息<br />第二行信息</div>
<i
class="el-icon-paperclip"
style=" color:#17B3A3; margin-left:15px"
></i>
</el-tooltip>
</div>
</template>
</el-table-column>
<!-- <el-table-column prop="authorName" header-align="center" align="center" label="作者姓名">
@@ -163,10 +175,7 @@
width="600"
>
<template slot-scope="scope">
<div
style=" "
v-if="scope.row.courseCatalogueEntityList.length == 0"
>
<div style=" " v-if="scope.row.courseCatalogueEntityList.length == 0">
该课程还未添加目录
</div>
<div
@@ -183,7 +192,6 @@
>
<div
style="width: 90px;float: left;font-weight: 800;border: 1px solid #bbbb; border-radius: 4px;line-height: 30px;"
>
<!-- <el-tag type="success" > -->
{{ v.title }}
@@ -198,10 +206,13 @@
}px);float: right;`
"
>
<div v-if="v.productList.length==0">
暂未关联商品
</div>
<div v-for="(item, i) in v.productList" v-if="v.productList.length>0">
<div v-if="v.productList.length == 0">
暂未关联商品
</div>
<div
v-for="(item, i) in v.productList"
v-if="v.productList.length > 0"
>
{{ item.productName }}
<span style="color: #ff5b36;"
>{{

View File

@@ -0,0 +1,258 @@
<template>
<el-drawer
ref="drawer"
title="课程迁移"
:visible.sync="drawerVisible"
direction="rtl"
:before-close="drawerHandleClose"
>
<!-- ------------------------- -->
<div style="padding:15px">
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<div style="display:flex;align-items:end">
<el-form-item label="课程名称">
<el-input
v-model="query.courseName"
placeholder="课程名称"
clearable
></el-input>
</el-form-item>
<el-form-item label="平台分类">
<el-cascader
clearable
:props="{
label: 'title',
value: 'id',
checkStrictly: true
}"
v-model="selectType"
:options="options"
>
</el-cascader>
</el-form-item>
<el-form-item label=" ">
<el-button
type="primary"
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
>
<!-- <el-button type="primary" @click="addOrUpdateHandle()"
>新增</el-button
> -->
</el-form-item>
</div>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column
prop="title"
header-align="center"
align="center"
label="课程名"
>
<template slot-scope="scope">
<div>
<span>{{ scope.row.title }}</span>
<!-- <el-tooltip placement="bottom" effect="light">
<div slot="content">多行信息<br />第二行信息多行信息<br />第二行信息多行信息<br />第二行信息多行信息第二行信息多行信息第二行信息</div>
<i
class="el-icon-paperclip"
style=" color:#17B3A3; margin-left:15px"
></i>
</el-tooltip> -->
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
style="padding: 30px 0; text-align: center;"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
<div style="text-align:center">
<el-button type="primary" @click="moveCourseBtn"> </el-button>
</div>
</div>
<!-- ----------------------------- -->
</el-drawer>
</template>
<script>
export default {
data() {
return {
drawerVisible: true,
selectType: [],
options: [
{
id: "all",
title: "全部",
children: undefined
},
{
id: 1,
title: "医学",
children: []
},
{
id: 2,
title: "国学",
children: []
}
],
dataForm: {
key: ""
},
multipleSelection: [],
query: {
type: "",
categoryId: "",
sociologyId: "",
courseName: ""
},
dataList: [],
delFlag: false,
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
urlList: {
medicalList: "/master/courseMedical/getCourseMedicalList", //医学
sociologyList: "/master/courseSociology/getCourseSociologyList" //国学
}
};
},
methods: {
init() {},
drawerHandleClose() {
this.$emit("mycloseDrawer", "drawer");
},
handleSelectionChange(val) {
if (val.length > 1) {
this.$message.error("只可以选择一门课程进行迁移哦~");
} else {
this.multipleSelection = val;
}
console.log(22, this.multipleSelection);
},
moveCourseBtn() {
if (this.multipleSelection.length == 0) {
this.$message.error("请选择您要迁移的目标课程!");
} else if (this.multipleSelection.length > 1) {
this.$message.error("只可以选择一门课程进行迁移哦~");
} else {
this.$confirm(
`即将迁移到 ${this.multipleSelection[0].title}课程内, 是否继续?'`,
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
// 走接口 并关闭
this.drawerHandleClose()
// this.$nextTick(() => {
// this.$refs["moveCourse"].getDataList();
// });
});
}
},
// checkSelectable(row){
// return row.auditStatus === '0'
// console.log(row,'row')
// },
// 获取数据列表
getDataList() {
var data = {
page: this.pageIndex,
limit: this.pageSize,
courseName: this.query.courseName //关键字
};
if (this.selectType.length == 0) {
data.type = 0;
data.medicalId = "";
data.sociologyId = "";
} else if (this.selectType.length >= 1) {
data.type = this.selectType[0] == "all" ? 0 : this.selectType[0];
if (this.selectType.length == 1) {
data.medicalId = "";
data.sociologyId = "";
}
if (this.selectType.length > 1) {
if (this.selectType[0] == 1) {
data.medicalId = this.selectType[this.selectType.length - 1];
data.sociologyId = "";
}
if (this.selectType[0] == 2) {
data.medicalId = "";
data.sociologyId = this.selectType[this.selectType.length - 1];
}
}
}
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/master/course/getCourseList"),
method: "post",
data: this.$http.adornData(data)
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.records;
this.totalPage = data.page.total;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val;
}
// 新增 / 修改
// addOrUpdateHandle(row) {
// this.addOrUpdateVisible = true;
// this.$nextTick(() => {
// this.$refs.addOrUpdate.init(row);
// });
// }
}
};
</script>
<style></style>