课程指引+消息列表

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

@@ -0,0 +1,459 @@
<template>
<el-dialog
width="1260px"
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible"
@close="handlereset"
style="height: auto;"
>
<div style="margin-bottom: 60px;">
<el-form
style="height: auto;"
class="addFormBox"
:model="dataForm"
:rules="dataRule"
ref="dataForm"
label-width="80px"
>
<el-form-item label="消息标题" prop="title">
<el-input v-model="dataForm.title" placeholder="消息标题"></el-input>
</el-form-item>
<el-col :span="24">
<el-col :span="8"
><el-form-item label="链接方式" prop="type">
<el-select
@change="changeType"
v-model="dataForm.type"
size="small"
placeholder="请选择链接方式"
>
<el-option
v-for="item in linkList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<!-- <el-radio-group v-model="dataForm.type">
<el-radio
v-for="item in linkList"
:key="item.value"
:label="item.label"
:value="item.value"
>{{ item.label }}</el-radio
>
</el-radio-group> -->
</el-form-item></el-col
>
<el-col :span="12">
<el-form-item label="发布APP" prop="splits">
<el-checkbox
v-model="dataForm[item.valueName]"
v-for="(item, i) in APPList"
:key="i"
:true-label="1"
:false-label="0"
>{{ item.label }}</el-checkbox
>
</el-form-item></el-col
>
</el-col>
<el-col :span="24" v-if="dataForm.type == 0">
<el-form-item label="链接地址" prop="url">
<el-input
v-model="dataForm.url"
placeholder="链接地址"
:rows="3"
></el-input>
</el-form-item>
</el-col>
<el-col :span="24" v-if="dataForm.type == 1">
<div style="height: auto;margin-bottom: 80px;">
<el-form-item label="内容" prop="url">
<el-upload
class="chapter-avatar-uploader"
:action="baseUrl + '/oss/fileoss'"
accept=".jpeg,.jpg,.gif,.png"
:show-file-list="false"
:on-success="contentUploadSuccess"
>
</el-upload>
<quill-editor
v-model="dataForm.content"
ref="myQuillEditor"
style="height: 400px;"
:options="editorOption"
@blur="onEditorBlur($event)"
@focus="onEditorFocus($event)"
@ready="onEditorReady($event)"
class="chapter_editor"
>
</quill-editor>
</el-form-item>
</div>
</el-col>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import global from "../../common/common.vue"; //引入共用组间
import { quillEditor } from "vue-quill-editor";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
const toolbarOptions = [
["bold", "italic", "underline", "strike"], // 加粗,斜体,下划线,删除线
["blockquote", "code-block"], //引用,代码块
[{ header: 1 }, { header: 2 }], // 几级标题
[{ list: "ordered" }, { list: "bullet" }], // 有序列表,无序列表
[{ script: "sub" }, { script: "super" }], // 下角标,上角标
[{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ direction: "rtl" }], // 文字输入方向
[{ size: ["small", false, "large", "huge"] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 颜色选择
[
{
font: [
"SimSun",
"SimHei",
"Microsoft-YaHei",
"KaiTi",
"FangSong",
"Arial"
]
}
], // 字体
[{ align: [] }], // 居中
["clean"], // 清除样式,
["link", "image"] // 上传图片、上传视频
];
export default {
data() {
return {
baseUrl: global.baseUrl,
visible: false,
// 富文本编辑器配置
editorOption: {
modules: {
history: {
delay: 1000,
maxStack: 50,
userOnly: false
},
toolbar: {
container: toolbarOptions,
handlers: {
image: function(value) {
if (value) {
// 调用element的图片上传组件
document
.querySelector(".chapter-avatar-uploader input")
.click();
} else {
this.quill.format("image", false);
}
}
}
}
},
placeholder: "请输入正文"
},
bookList: [
{
dictType: 0,
dictValue: "普通"
},
{
dictType: 1,
dictValue: "中医经典"
},
{
dictType: 2,
dictValue: "国学经典"
}
],
medicaldesBookTypeList: [
{
dictType: 1,
dictValue: "中医基础"
},
{
dictType: 2,
dictValue: "中医经典"
},
{
dictType: 3,
dictValue: "各家学说"
},
{
dictType: 4,
dictValue: "中医临床"
},
{
dictType: 5,
dictValue: "文学"
},
{
dictType: 6,
dictValue: "哲学"
}
],
props: {
dictType: "",
dictValue: ""
},
gushuList: [],
linkList: [{ label: "外链", value: 0 }, { label: "富文本", value: 1 }],
restaurants: [],
author: "",
publisherList: [],
fileList: [],
fileListNovel: [],
dialogImageUrl: "",
dialogVisible: false,
dataForm: {
type: 0,
title: "",
isBook: 0, //是否是疯子读书
isMedical: 0, //是否是吴门医述
isSociology: 0 //是否是众妙之门
},
APPList: [
{ label: "疯子读书", value: 2, valueName: "isBook" },
{ label: "吴门医述", value: 3, valueName: "isMedical" },
{ label: "众妙之门", value: 1, valueName: "isSociology" }
],
dataRule: {
title: [
{ required: true, message: "消息标题不能为空", trigger: "blur" }
]
},
urlList: {
info: "/master/message/getMessageById",
add: "/master/message/saveOrUpdateMessage"
}
};
},
components: {
quillEditor
},
created() {},
mounted() {
// this.restaurants = this.loadAll();
},
methods: {
changeType(e){
console.log('e at line 256:', e)
if(e==0){
this.dataForm.content=''
}else{
this.dataForm.url=''
}
},
contentUploadSuccess(res, file) {
// console.log(res)
let quill = this.$refs.myQuillEditor.quill;
// 如果上传成功
if (res) {
// 获取光标所在位置
let length = quill.getSelection().index;
// 插入图片res为服务器返回的图片链接地址
quill.insertEmbed(length, "image", res.url);
// 调整光标到最后
quill.setSelection(length + 1);
} else {
// 提示信息需引入Message
this.$message.error("图片插入失败!");
}
},
// 失去焦点事件
onEditorBlur(quill) {
// console.log('editor blur!', quill)
},
// 获得焦点事件
onEditorFocus(quill) {
//console.log('editor focus!', quill)
},
// 准备富文本编辑器
onEditorReady(quill) {
// console.log('editor ready!', quill)
},
init(row) {
console.log("11111", row);
if (row && row.id) {
this.$http
.request({
url: this.$http.adornUrl(`${this.urlList.info}?id=${row.id}`),
method: "POST",
data: {},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(res => {
console.log("result at line 452:", res);
if (res && res.data.code === 0) {
var data = res.data.result;
console.log("data at line 357:", data);
this.dataForm = { ...data };
}
});
} else {
this.dataForm = {
type: 0,
title: "",
isBook: 0, //是否是疯子读书
isMedical: 0, //是否是吴门医述
isSociology: 0 //是否是众妙之门
};
}
// this.dataForm.id = row.id || 0
// this.dataForm.title = row.title || ''
this.visible = true;
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
if (
this.dataForm.isBook == 0 &&
this.dataForm.isMedical == 0 &&
this.dataForm.isSociology == 0
) {
this.$message.error("请选择发布APP");
return;
}console.log('this.dataForm.type at line 332:', this.dataForm)
if (this.dataForm.type == 0 && (this.dataForm.url == ""||!this.dataForm.url)) {
this.$message.error("请输入链接地址");
return;
}
this.$http
.request({
url: this.$http.adornUrl(this.urlList.add),
method: "POST",
data: this.dataForm,
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.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);
}
});
}
});
},
handlePicSuccess(res, file) {
// console.log(res,'res')
if (res.msg == "success") {
this.dataForm.image = res.url;
this.fileList.push({
name: file.name,
url: res.url
});
// console.log(this.dataForm.image,'image')
this.$message.success("上传成功");
} else {
this.$message.error("上传失败");
}
},
handleRemove(file, fileList) {
this.dataForm.image = "";
this.fileList = [];
this.dataForm.noneBtnImg = fileList.length >= this.dataForm.limitCountImg;
},
handlePictureCardPreview(file) {
this.dataForm.image = file.url;
this.dialogVisible = true;
},
handleDownload(file) {
console.log(file);
},
handlereset() {
(this.fileList = []), (this.fileListNovel = []), (this.visible = false);
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(
`当前限制选择 3 个文件,本次选择了 ${
files.length
} 个文件,共选择了 ${files.length + fileList.length} 个文件`
);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemoveNovel(file) {
this.dataForm.novel = "";
},
handleNovelSuccess(file) {
this.dataForm.novel = file.url;
}
// querySearch(queryString, cb) {
// var restaurants = this.restaurants;
// var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
// // 调用 callback 返回建议列表的数据
// console.log(results)
// cb(results);
// },
// createFilter(queryString) {
// return (restaurant) => {
// return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
// };
// },
// handleSelect(item) {
// this.dataForm.authorId = item.id
// console.log(item);
// }
}
};
</script>
<style lang="scss" scoped>
::v-deep .isUpload {
.el-uploadfeng {
.el-upload--picture-card {
display: none !important;
}
}
}
/deep/ .addFormBox.el-form-item {
margin-bottom: 10px !important;
}
/deep/ .ql-container {
min-height: 400px !important ;
}
</style>

View File

@@ -0,0 +1,378 @@
<template>
<div class="mod-config" style="height: calc(100vh - 180px );">
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item label="消息标题">
<el-input
v-model="query.title"
placeholder="消息标题"
clearable
></el-input>
</el-form-item>
<el-form-item label="链接方式">
<el-select
v-model="query.type"
clearable
size="small"
placeholder="请选择"
>
<el-option
v-for="(item, i) in linkList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<!-- <el-checkbox v-model="query[item.valueName]" v-for="(item,i) in APPList" :key="i" :true-label="1" :false-label="0">{{ item.label }}</el-checkbox> -->
</el-form-item>
<el-form-item label="发布APP">
<el-select
v-model="selectQueryApp"
multiple
size="small"
placeholder="请选择"
>
<el-option
v-for="(item, i) in APPList"
:key="item.valueName"
:label="item.label"
:value="item.valueName"
>
</el-option>
</el-select>
<!-- <el-checkbox v-model="query[item.valueName]" v-for="(item,i) in APPList" :key="i" :true-label="1" :false-label="0">{{ item.label }}</el-checkbox> -->
</el-form-item>
<el-form-item>
<el-button
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
>
<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item>
</el-form>
<div style="height: calc(100% - 80px );">
<el-table
:data="dataList"
border
height="90%"
v-loading="dataListLoading"
style="width: 100%;"
>
<el-table-column
prop="title"
:show-overflow-tooltip="true"
header-align="center"
align="center"
label="消息标题"
>
</el-table-column
><el-table-column
prop="title"
header-align="center"
align="center"
label="发布APP"
>
<template slot-scope="scope">
<div>
<span v-if="scope.row.isBook == 1">疯子读书</span>
<span v-if="scope.row.isMedical == 1">吴门医述</span>
<span v-if="scope.row.isSociology == 1">众妙之门</span>
</div>
</template>
</el-table-column>
<el-table-column
prop="title"
width="120"
header-align="center"
align="center"
label="链接方式"
>
<template slot-scope="scope">
<div>
<span v-if="scope.row.type == 0">外链</span>
<span v-if="scope.row.type == 1">富文本</span>
</div>
</template>
</el-table-column>
<el-table-column
width="200"
prop="createTime"
header-align="center"
align="center"
label="创建日期"
>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="180"
label="操作"
>
<template slot-scope="scope">
<div>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row)"
>修改</el-button
>
<el-button
type="text"
size="small"
@click="deleteHandle(scope.row.id)"
>删除</el-button
>
</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: 10px 0; text-align: center;"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
</div>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from "./course-add-or-update";
export default {
data() {
return {
linkList: [{ label: "外链", value: 0 }, { label: "富文本", value: 1 }],
selectQueryApp: null,
APPList: [
{ label: "疯子读书", value: 2, valueName: "isBook" },
{ label: "吴门医述", value: 3, valueName: "isMedical" },
{ label: "众妙之门", value: 1, valueName: "isSociology" }
],
dataForm: {
key: ""
},
query: {
type: "",
categoryId: "",
sociologyId: "",
keywords: ""
},
dataList: [],
delFlag: false,
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
urlList: {
list: "/master/message/listByPage"
}
};
},
components: {
AddOrUpdate
},
activated() {
if (this.$route.query.upPageInde != null) {
this.pageIndex = this.$route.query.upPageIndex;
console.log(this.pageIndex);
}
this.getDataList();
},
methods: {
// 获取数据列表
getDataList() {
console.log("this.selectQueryApp at line 195:", this.selectQueryApp);
this.dataListLoading = true;
this.$http
.request({
url: this.$http.adornUrl(this.urlList.list),
method: "POST",
data: {
current: this.pageIndex,
limit: this.pageSize,
...this.query,
// type: "", //0本地信息1外链
isBook: this.selectQueryApp.includes("isBook") ? 1 : "", //是否是疯子读书
isMedical: this.selectQueryApp.includes("isMedical") ? 1 : "", //是否是吴门医述
isSociology: this.selectQueryApp.includes("isSociology") ? 1 : "" //是否是众妙之门
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json"
}
})
.then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.result.records;
this.totalPage = data.result.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);
});
},
// 删除
deleteHandle(id) {
this.$confirm(
`确定对[id=${id}]进行[${id ? "删除" : "删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/master/message/delMessage?id=" + id),
method: "post"
// data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
},
// 开关变化
SwitchChange(event) {
/*点击时他会自动把你绑定的值变更,直接去请求数据就可以了*/
var parms = {
delFlag: event.delFlag,
id: event.id
};
this.$http({
url: this.$http.adornUrl("/book/book/update"),
method: "post",
data: parms
})
.then(res => {
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
})
.catch(error => {
this.loading = false;
console.log(error);
});
console.log(event);
},
chapterHandle(id, row) {
if (row.novel == "") {
this.$alert("请上传电子书文件后在进行此操作", "提示", {
confirmButtonText: "好的"
});
return false;
}
this.$http({
url: this.$http.adornUrl("/book/book/getChapter"),
method: "get",
params: this.$http.adornParams({
id: id
})
}).then(res => {
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
},
contentHandle(id) {
this.$http({
url: this.$http.adornUrl("/book/bookchaptercontent/getBookVoices"),
method: "get",
params: this.$http.adornParams({
id: id
})
}).then(res => {
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
},
voicesHandle(id) {
//allVoices
this.$http({
// url: this.$http.adornUrl('/book/bookchaptercontent/allVoices'),
url: this.$http.adornUrl("/book/bookchaptercontent/AllVOices"),
method: "get",
params: this.$http.adornParams({
id: id
})
}).then(res => {
console.log("book/bookchaptercontent/AllVOices");
this.$message({
message: "成功",
type: "success"
});
this.loading = false;
this.getDataList();
});
}
}
};
</script>

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>