课程指引+消息列表

This commit is contained in:
2024-05-24 16:44:14 +08:00
parent b9deb6ed29
commit 20eebd5f8c
5 changed files with 999 additions and 126 deletions

View File

@@ -24,7 +24,9 @@
<!-- <el-input v-model="dataForm.content" placeholder="内容"></el-input> -->
<!-- <el-button @click="handlereset">取消</el-button> -->
<el-button type="primary" @click="dataFormSubmit()" style="float: right;">保存</el-button>
<el-button type="primary" @click="dataFormSubmit()" style="float: right;"
>保存</el-button
>
</div>
</template>
@@ -62,7 +64,7 @@ const toolbarOptions = [
["link", "image"] // 上传图片、上传视频
];
export default {
props:['dataInfo'],
props: ["dataInfo", "type"],
data() {
return {
baseUrl: global.baseUrl,
@@ -90,7 +92,7 @@ export default {
}
}
},
placeholder: "请输入"+this.dataInfo.label
placeholder: "请输入" + this.dataInfo.label
},
visible: false,
props: {
@@ -107,12 +109,9 @@ export default {
dialogImageUrl: "",
dialogVisible: false,
dataForm: {
courseId: 0,
catalogueId: 0,
title: "",
imgUrl: "",
content: "",
sort: 1
},
splitsTypeList: [],
dataRule: {}
@@ -152,61 +151,37 @@ export default {
onEditorReady(quill) {
// console.log('editor ready!', quill)
},
init(row, catalogue_id, courseid) {
console.log("row21", row);
this.dataForm = row ? JSON.parse(JSON.stringify(row)) : {};
this.dataForm.courseId = courseid ? courseid : "";
this.dataForm.catalogueId = catalogue_id ? catalogue_id : "";
this.visible = true;
if (this.dataForm.imgUrl && this.dataForm.imgUrl != "") {
var img = {
name: "",
url: this.dataForm.imgUrl
};
var attr = [];
attr.push(img);
this.fileList = attr;
} else {
this.fileList = [];
}
init(content) {
console.log("row21", content);
this.dataForm.content=content
},
getContent(){
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl(
`${
!this.dataForm.id
? "/master/course/addCourseCatalogueChapter"
: "/master/course/editCourseCatalogueChapter"
}`
),
method: "post",
data: this.$http.adornData({
id: this.dataForm.id || undefined,
courseId: this.dataForm.courseId || undefined,
catalogueId: this.dataForm.catalogueId || undefined,
title: this.dataForm.title,
imgUrl: this.dataForm.imgUrl,
content: this.dataForm.content,
sort: this.dataForm.sort
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.visible = false;
this.$emit("refreshDataList");
}
});
} else {
this.$message.error(data.msg);
this.$http({
url: this.$http.adornUrl("/master/course/editCourseRecord"),
method: "post",
data: this.$http.adornData({
type: this.type,
recordType: this.dataInfo.id, //0 buy_record , 1 use_record , 2 study_record, 3 vip_record
content: this.dataForm.content
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.visible = false;
this.$emit("refreshDataList");
}
});
} else {
this.$message.error(data.msg);
}
});
},

View File

@@ -1,11 +1,18 @@
<template>
<div class="mod-config" style="height: calc(100vh - 180px)">
<el-tabs tab-position="left" style="height: 100%;">
<el-tab-pane :label="v.label" v-for="(v, i) in setList" :key="i" style="height: 100%;">
<add-or-update
:dataInfo="v"
style="height: calc(100vh - 180px)"
ref="addOrUpdate"
<el-tabs tab-position="left" style="height: 100%;" v-model="currentTab"@tab-click="handleClick">
<el-tab-pane
:label="v.label"
v-for="(v, i) in setList"
:key="i"
style="height: 100%;"
>
<add-or-update
:dataInfo="v"
:type="type"
style="height: calc(100vh - 180px)"
:ref="`addOrUpdate${v.id}`"
@refreshDataList="getDataList"
></add-or-update>
</el-tab-pane>
@@ -20,11 +27,13 @@ import AddOrUpdate from "./chapter-add-or-update";
export default {
data() {
return {
currentTab: 0,
type: 0,
setList: [
{ label: "购买须知", id: 1 },
{ label: "使用须知", id: 2 },
{ label: "学习次序", id: 3 },
{ label: "超V用户", id: 4 }
{ label: "购买须知", id: 0 },
{ label: "使用须知", id: 1 },
{ label: "学习次序", id: 2 },
{ label: "超V用户", id: 3 }
],
dataForm: {
key: ""
@@ -60,33 +69,53 @@ export default {
this.getDataList();
},
methods: {
handleClick(tab, event) {
this.getDataList()
},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl(
"/master/course/getCourseCatalogueChapterList"
),
method: "post",
data: this.$http.adornData({
id: this.catalogue_id,
page: this.pageIndex,
limit: this.pageSize
// "type": this.query.type||0, //类型0全部1医学2国学
// "categoryId": this.query.categoryId, //医学类型id当type为1时为必填项;为0时代表全部
// "sociologyId": this.query.sociologyId, //国学类型id,当type为2时为必填项为0代表全部
// "keywords": this.query.keywords //关键字
this.$http
.request({
url: this.$http.adornUrl(`/master/course/getCourseRecord`),
method: "POST",
data: {
type: this.type
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
}).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;
});
.then(({ data }) => {
var that=this
console.log("data at line 86:", data);
if (data && data.code === 0) { console.log('that.currentTab at line 91:', that.currentTab)
var content=''
switch (that.currentTab) {
case "0":
content=data.result.buyRecord
break;
case "1":
content=data.result.useRecord
break;
case "2":
content=data.result.studyRecord
break;
case "3":
content=data.result.vipRecord
break;
}
that.$nextTick(()=>{
that.$refs[`addOrUpdate${that.currentTab}`][0].init(content);
})
}
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
@@ -244,7 +273,7 @@ export default {
-webkit-box-orient: vertical;
}
::v-deep .mod-config .el-tabs .el-tabs__content {
::v-deep .mod-config .el-tabs .el-tabs__content {
height: 100% !important;
}
</style>

View File

@@ -1,11 +1,18 @@
<template>
<div class="mod-config" style="height: calc(100vh - 180px)">
<el-tabs tab-position="left" style="height: 100%;">
<el-tab-pane :label="v.label" v-for="(v, i) in setList" :key="i" style="height: 100%;">
<add-or-update
:dataInfo="v"
style="height: calc(100vh - 180px)"
ref="addOrUpdate"
<el-tabs tab-position="left" style="height: 100%;" v-model="currentTab"@tab-click="handleClick">
<el-tab-pane
:label="v.label"
v-for="(v, i) in setList"
:key="i"
style="height: 100%;"
>
<add-or-update
:dataInfo="v"
:type="type"
style="height: calc(100vh - 180px)"
:ref="`addOrUpdate${v.id}`"
@refreshDataList="getDataList"
></add-or-update>
</el-tab-pane>
@@ -20,11 +27,14 @@ import AddOrUpdate from "./chapter-add-or-update";
export default {
data() {
return {
content: '',
currentTab: 0,
type: 1,
setList: [
{ label: "购买须知", id: 1 },
{ label: "使用须知", id: 2 },
{ label: "学习次序", id: 3 },
{ label: "超V用户", id: 4 }
{ label: "购买须知", id: 0 },
{ label: "使用须知", id: 1 },
{ label: "学习次序", id: 2 },
{ label: "超V用户", id: 3 }
],
dataForm: {
key: ""
@@ -60,33 +70,55 @@ export default {
this.getDataList();
},
methods: {
handleClick(tab, event) {
this.getDataList()
},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl(
"/master/course/getCourseCatalogueChapterList"
),
method: "post",
data: this.$http.adornData({
id: this.catalogue_id,
page: this.pageIndex,
limit: this.pageSize
// "type": this.query.type||0, //类型0全部1医学2国学
// "categoryId": this.query.categoryId, //医学类型id当type为1时为必填项;为0时代表全部
// "sociologyId": this.query.sociologyId, //国学类型id,当type为2时为必填项为0代表全部
// "keywords": this.query.keywords //关键字
this.$http
.request({
url: this.$http.adornUrl(`/master/course/getCourseRecord`),
method: "POST",
data: {
type: this.type
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
}).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;
});
.then(({ data }) => {
var that=this
console.log("data at line 86:", data);
if (data && data.code === 0) { console.log('that.currentTab at line 91:', that.currentTab)
var content=''
switch (that.currentTab) {
case "0":
content=data.result.buyRecord
break;
case "1":
content=data.result.useRecord
break;
case "2":
content=data.result.studyRecord
break;
case "3":
content=data.result.vipRecord
break;
}
that.$nextTick(()=>{
this.content=content
that.$refs[`addOrUpdate${that.currentTab}`][0].init(content);
})
}
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
@@ -244,7 +276,7 @@ export default {
-webkit-box-orient: vertical;
}
::v-deep .mod-config .el-tabs .el-tabs__content {
::v-deep .mod-config .el-tabs .el-tabs__content {
height: 100% !important;
}
</style>