课程标签
This commit is contained in:
@@ -129,7 +129,7 @@ import debounce from "lodash/debounce"; //导入lodash中的debounce
|
||||
import commonTree from "./tags.vue";
|
||||
import commonTreeMarket from "./tags.vue";
|
||||
export default {
|
||||
props: ["currentType", "currentId"],
|
||||
props: ["currentType", "currentId","axiosType"],
|
||||
data() {
|
||||
return {
|
||||
productId: null,
|
||||
@@ -440,7 +440,8 @@ export default {
|
||||
type: "warning",
|
||||
}
|
||||
).then(() => {
|
||||
this.$http({
|
||||
if(this.axiosType=='raw'){
|
||||
this.$http({
|
||||
url: this.$http.adornUrl("/book/shopproduct/delete"),
|
||||
method: "post",
|
||||
data: this.$http.adornData(ids, false),
|
||||
@@ -458,6 +459,27 @@ export default {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
this.$http({
|
||||
url: this.$http.adornUrl("/book/shopproduct/delete"),
|
||||
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) {
|
||||
|
||||
@@ -166,7 +166,10 @@ export default {
|
||||
"isEdit",
|
||||
"currentId",
|
||||
"currentType",
|
||||
"isNoSearch"
|
||||
"isNoSearch",
|
||||
"isNoPaging",
|
||||
"axiosType",
|
||||
"otherInfo",
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
@@ -319,7 +322,30 @@ export default {
|
||||
|
||||
this.dataListLoading = true;
|
||||
|
||||
if (this.defaultForm.httpType == "raw") {
|
||||
if (this.axiosType == "raw") {
|
||||
this.$http
|
||||
.request({
|
||||
url: this.$http.adornUrl(`${this.urlList.getAssociatedGoodsList}`),
|
||||
method: "POST",
|
||||
data: {
|
||||
...form
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
.then(async ({ data }) => {
|
||||
console.log('data at line 338:', data)
|
||||
if (data && data.code === 0) {
|
||||
this.associatedGoodsList = [...data[this.otherInfo.httpDataValueName]];
|
||||
|
||||
this.dataListLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else if (this.defaultForm.httpType == "raw") {
|
||||
this.$http
|
||||
.request({
|
||||
url: this.$http.adornUrl(`${this.urlList.hasBindProductList}`),
|
||||
@@ -339,7 +365,9 @@ export default {
|
||||
this.dataListLoading = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
}
|
||||
|
||||
else {
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(`${this.urlList.getAssociatedGoodsList}`),
|
||||
method: "post",
|
||||
|
||||
@@ -113,12 +113,13 @@
|
||||
export default {
|
||||
props: [
|
||||
"defaultForm",
|
||||
"otherInfo",
|
||||
"marketIdKey",
|
||||
"currentType",
|
||||
"currentId",
|
||||
"title",
|
||||
"isNoModal",
|
||||
"urlList"
|
||||
"urlList",
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
@@ -245,7 +246,7 @@ export default {
|
||||
// }
|
||||
this.dataListLoading = true;
|
||||
this.clear();
|
||||
if (this.defaultForm.httpType == "raw") {
|
||||
if (this.defaultForm.httpType == "raw"||this.otherInfo.httpType == "raw") {
|
||||
form.page = this.pageIndex;
|
||||
this.$http
|
||||
.request({
|
||||
@@ -272,7 +273,11 @@ export default {
|
||||
// }, 200);
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
|
||||
else {
|
||||
form.current = this.pageIndex;
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(this.urlList.getNotToLabelList),
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
<template>
|
||||
<div class="tree_box">
|
||||
<div style="overflow: hidden" v-if="source == 'tags'">
|
||||
<p class="info_bg" style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
|
||||
|
||||
<p
|
||||
class="info_bg"
|
||||
style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis"
|
||||
>
|
||||
当前标签:<span style="color: #17b3a3; font-weight: 600">{{
|
||||
currentNode ? currentNode.data.title : ""
|
||||
}}</span>
|
||||
currentNode ? currentNode.data.title : ""
|
||||
}}</span>
|
||||
</p>
|
||||
<el-button type="primary" @click="addOrUpdateHandle()" style="float: right" size="mini">新增顶级标签</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="addOrUpdateHandle()"
|
||||
style="float: right"
|
||||
size="mini"
|
||||
>新增顶级标签</el-button
|
||||
>
|
||||
</div>
|
||||
<!-- <p v-if="source == 'shop'" class="select_box" style="">
|
||||
<el-checkbox
|
||||
@@ -26,24 +34,48 @@
|
||||
<!-- show-checkbox -->
|
||||
<!-- :allow-drop="allowDrop" -->
|
||||
<div class="custom-tree-container">
|
||||
<el-tree :highlight-current="true" class="filter-tree" node-key="id" :data="treeDataList" :props="defaultProps"
|
||||
default-expand-all :filter-node-method="filterNode" ref="tree" :draggable="true" @node-click="handleNodeClick"
|
||||
:expand-on-click-node="false">
|
||||
<el-tree
|
||||
:highlight-current="true"
|
||||
class="filter-tree"
|
||||
node-key="id"
|
||||
:data="treeDataList"
|
||||
:props="defaultProps"
|
||||
default-expand-all
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
:draggable="true"
|
||||
@node-click="handleNodeClick"
|
||||
:expand-on-click-node="false"
|
||||
>
|
||||
<!-- @click="handleClickNodes(node, data)" -->
|
||||
<span class="custom-tree-node" slot-scope="{ node, data }" @click="
|
||||
source == 'tags'
|
||||
? handleClickNodes(node, data, 'edit')
|
||||
: ''
|
||||
" :class="`${currentNode&¤tNode.data.id==data.id?'isSelect':''}`" style=" padding-left: 5px;
|
||||
box-sizing: border-box;">
|
||||
<span
|
||||
class="custom-tree-node"
|
||||
slot-scope="{ node, data }"
|
||||
@click="source == 'tags' ? handleClickNodes(node, data, 'edit') : ''"
|
||||
:class="
|
||||
`${currentNode && currentNode.data.id == data.id ? 'isSelect' : ''}`
|
||||
"
|
||||
style=" padding-left: 5px;
|
||||
box-sizing: border-box;"
|
||||
>
|
||||
<!-- @change="(e) => selectShop(data, e)" -->
|
||||
<span style="display: flex; align-items: center" ><el-checkbox @change=" selectShop(data)"
|
||||
:value="selectArr.includes(data.id)" v-if="data.isLast == 1 && source == 'shop'"
|
||||
style="margin-right: 10px"></el-checkbox>{{ node.label }}</span>
|
||||
<span style="display: flex; align-items: center"
|
||||
><el-checkbox
|
||||
@change="selectShop(data)"
|
||||
:value="selectArr.includes(data.id)"
|
||||
v-if="data.isLast == 1 && source == 'shop'"
|
||||
style="margin-right: 10px"
|
||||
></el-checkbox
|
||||
>{{ node.label }}</span
|
||||
>
|
||||
<span v-if="source == 'tags'">
|
||||
<!-- v-if="node.level <= 1" -->
|
||||
<el-button type="text" size="mini" @click.stop="handleClickNodes(node, data, 'addChildren')"
|
||||
v-if="data.isLast != 1">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click.stop="handleClickNodes(node, data, 'addChildren')"
|
||||
v-if="data.isLast != 1"
|
||||
>
|
||||
添加下级
|
||||
</el-button>
|
||||
<!-- <el-button
|
||||
@@ -55,7 +87,12 @@
|
||||
</el-button> -->
|
||||
|
||||
<!-- v-if="node.childNodes.length == 0" -->
|
||||
<el-button type="text" size="mini" @click.stop="remove(data)" style="color: rgb(235 92 92);">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click.stop="remove(data)"
|
||||
style="color: rgb(235 92 92);"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</span>
|
||||
@@ -69,7 +106,15 @@
|
||||
// import dialogComponent from './seckillprodrelation'
|
||||
import debounce from "lodash/debounce"; //导入lodash中的debounce
|
||||
export default {
|
||||
props: ["dataList", "urlList", "source", "productId", 'sourceType'],
|
||||
props: [
|
||||
"dataList",
|
||||
"urlList",
|
||||
"source",
|
||||
"productId",
|
||||
"sourceType",
|
||||
"axiosType",
|
||||
"axiosResultKey"
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
currentNode: null,
|
||||
@@ -78,8 +123,8 @@ export default {
|
||||
selectArr: [],
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "title",
|
||||
},
|
||||
label: "title"
|
||||
}
|
||||
};
|
||||
},
|
||||
components: {},
|
||||
@@ -91,13 +136,13 @@ export default {
|
||||
handler(newVal, oldVal) {
|
||||
// this.$emit('changeCurrentNode',this.currentNode)
|
||||
},
|
||||
|
||||
deep: true
|
||||
|
||||
deep: true
|
||||
},
|
||||
|
||||
|
||||
filterText(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
},
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
console.log("🚀 ~ activated ~ this.currentNode:", this.currentNode, "9999");
|
||||
@@ -128,17 +173,17 @@ export default {
|
||||
limit: 99999999,
|
||||
// productName: "",
|
||||
productId: this.productId,
|
||||
...form,
|
||||
...form
|
||||
// bookLabelId: bookLabelId,
|
||||
}),
|
||||
})
|
||||
}).then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
if (idType == "bookLabelId") {
|
||||
this.selectArr = data.result.records.map((e) => {
|
||||
this.selectArr = data.result.records.map(e => {
|
||||
return e.bookLabelId;
|
||||
});
|
||||
} else if (idType == "bookMarketId") {
|
||||
this.selectArr = data.result.records.map((e) => {
|
||||
this.selectArr = data.result.records.map(e => {
|
||||
return e.bookMarketId;
|
||||
});
|
||||
}
|
||||
@@ -179,7 +224,7 @@ export default {
|
||||
}
|
||||
this.$forceUpdate();
|
||||
},
|
||||
selectShop: debounce(async function (v, status) {
|
||||
selectShop: debounce(async function(v, status) {
|
||||
console.log("🚀 ~ selectShop ~ status:", status);
|
||||
|
||||
// if (this.selectArr.includes(v.id)) {
|
||||
@@ -209,25 +254,28 @@ export default {
|
||||
// this.$forceUpdate();
|
||||
// },
|
||||
async setCurrentNodeShow(id) {
|
||||
console.log("🚀 ~ setCurrentNodeShow ~ id222:", id, this.currentNode)
|
||||
console.log("🚀 ~ setCurrentNodeShow ~ id222:", id, this.currentNode);
|
||||
|
||||
var newNodeData = {}
|
||||
var newNodeData = {};
|
||||
if (id) {
|
||||
newNodeData = await this.$refs.tree.getNode(id);
|
||||
} else {
|
||||
newNodeData = {
|
||||
data: {}
|
||||
}
|
||||
};
|
||||
}
|
||||
this.currentNode = newNodeData;
|
||||
this.currentNode = newNodeData;
|
||||
this.$forceUpdate();
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tree.setCurrentKey(id);
|
||||
this.$refs.tree.setCheckedKeys([id]);
|
||||
})
|
||||
await this.$emit("handleClickNodes", newNodeData, newNodeData.data, "edit");
|
||||
|
||||
|
||||
});
|
||||
await this.$emit(
|
||||
"handleClickNodes",
|
||||
newNodeData,
|
||||
newNodeData.data,
|
||||
"edit"
|
||||
);
|
||||
},
|
||||
allowDrop(draggingNode, dropNode, type) {
|
||||
console.log(draggingNode.level, dropNode.level);
|
||||
@@ -242,7 +290,7 @@ export default {
|
||||
async correlationShop(bookLabelId) {
|
||||
var status;
|
||||
var productId = this.$refs.commonShop.multipleSelection.map(
|
||||
(e) => e.productId
|
||||
e => e.productId
|
||||
);
|
||||
console.log("🚀 ~ correlationShop ~ productId:", productId);
|
||||
await this.$http({
|
||||
@@ -250,8 +298,8 @@ export default {
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
productId: productId.toString(","),
|
||||
bookLabelId: bookLabelId,
|
||||
}),
|
||||
bookLabelId: bookLabelId
|
||||
})
|
||||
}).then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
status = true;
|
||||
@@ -263,23 +311,30 @@ export default {
|
||||
return status;
|
||||
},
|
||||
//新增修改
|
||||
dataFormSubmit: debounce(async function (formName) {
|
||||
dataFormSubmit: debounce(async function(formName) {
|
||||
// return false
|
||||
if (this.addForm.title == "") {
|
||||
this.$message.error("请输入标签名称");
|
||||
return false;
|
||||
}
|
||||
await this.$refs[formName].validate(async (valid) => {
|
||||
await this.$refs[formName].validate(async valid => {
|
||||
if (valid) {
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(`${this.urlList.add}`),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
...this.addForm,
|
||||
}),
|
||||
...this.addForm
|
||||
})
|
||||
}).then(async ({ data }) => {
|
||||
console.log('data at line 328:', data)
|
||||
if (data && data.code === 0) {
|
||||
var status = await this.correlationShop(data.result.id);
|
||||
if(this.axiosResultKey){
|
||||
|
||||
console.log('at line 331:',data[this.axiosResultKey] )
|
||||
}
|
||||
var status = await this.correlationShop(
|
||||
data[this.axiosResultKey ? this.axiosResultKey : "result"].id
|
||||
);
|
||||
if (status) {
|
||||
await this.getDataList();
|
||||
var newNodeData = await this.$refs.tree.getNode(data.result.id);
|
||||
@@ -305,7 +360,7 @@ export default {
|
||||
// this.addForm={}
|
||||
|
||||
// this.$emit("refreshDataList");
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -324,14 +379,19 @@ export default {
|
||||
this.isFresh = true;
|
||||
},
|
||||
async handleClickNodes(node, data, type) {
|
||||
console.log("🚀 ~ handleClickNodes11111 ~ node, data, type:", node, data, type)
|
||||
console.log(
|
||||
"🚀 ~ handleClickNodes11111 ~ node, data, type:",
|
||||
node,
|
||||
data,
|
||||
type
|
||||
);
|
||||
this.addForm = {};
|
||||
// console.log(this.$refs.tree.handleClickNodes(), "当前选中节点");
|
||||
console.log(node, data, "当前选中节点");
|
||||
this.currentNode = node;
|
||||
this.isFresh = false;
|
||||
this.isFresh = true;
|
||||
this.$forceUpdate()
|
||||
this.$forceUpdate();
|
||||
var form = {};
|
||||
|
||||
if (this.source == "shop") {
|
||||
@@ -351,7 +411,7 @@ export default {
|
||||
isLast: 0,
|
||||
pid: data.id,
|
||||
sort: 0,
|
||||
title: "",
|
||||
title: ""
|
||||
};
|
||||
break;
|
||||
}
|
||||
@@ -371,14 +431,13 @@ export default {
|
||||
}
|
||||
},
|
||||
addOrUpdateHandle() {
|
||||
|
||||
var addform = {
|
||||
children: [],
|
||||
delFlag: 0,
|
||||
isLast: 0,
|
||||
pid: 0,
|
||||
sort: 0,
|
||||
title: "",
|
||||
title: ""
|
||||
};
|
||||
this.handleClickNodes({ data: addform }, addform, "add");
|
||||
// if (!this.currentNode) {
|
||||
@@ -392,37 +451,74 @@ export default {
|
||||
this.$confirm(`是否删除标签【${data.title}】?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
if (this.axiosType == "raw") {
|
||||
this.$http
|
||||
.request({
|
||||
url: this.$http.adornUrl(this.urlList.delete),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: data.id
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
})
|
||||
.then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
that.$message({
|
||||
type: "success",
|
||||
message: "删除成功!"
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
that.$http({
|
||||
url: that.$http.adornUrl(`${that.urlList.delete}?id=` + data.id),
|
||||
method: "post",
|
||||
data: {},
|
||||
}).then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
that.$message({
|
||||
type: "success",
|
||||
message: "删除成功!",
|
||||
});
|
||||
that.currentNode = null;
|
||||
that.isFresh = false;
|
||||
that.addForm = {};
|
||||
that.$nextTick(() => {
|
||||
that.isFresh = true;
|
||||
});
|
||||
await that.addOrUpdateHandle();
|
||||
// this.expandedkey = [node.parent.data.catId]
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
return false
|
||||
|
||||
that
|
||||
.$http({
|
||||
url: that.$http.adornUrl(
|
||||
`${that.urlList.delete}?id=` + data.id
|
||||
),
|
||||
method: "post",
|
||||
data: {}
|
||||
})
|
||||
.then(async ({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
that.$message({
|
||||
type: "success",
|
||||
message: "删除成功!"
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
that.currentNode = null;
|
||||
that.isFresh = false;
|
||||
that.addForm = {};
|
||||
that.$nextTick(() => {
|
||||
that.isFresh = true;
|
||||
});
|
||||
await that.addOrUpdateHandle();
|
||||
// this.expandedkey = [node.parent.data.catId]
|
||||
});
|
||||
}
|
||||
|
||||
that.currentNode = null;
|
||||
that.isFresh = false;
|
||||
that.addForm = {};
|
||||
that.$nextTick(() => {
|
||||
that.isFresh = true;
|
||||
});
|
||||
await that.addOrUpdateHandle();
|
||||
// this.expandedkey = [node.parent.data.catId]
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
@@ -522,10 +618,10 @@ export default {
|
||||
const children = parent.data.nodes || parent.data;
|
||||
//若parent.data是对象,操作的是子级;如果是数组,操作的是最外层
|
||||
if (Array.isArray(parent.data)) {
|
||||
const parentIndex = parent.data.findIndex((d) => d.id === data.id);
|
||||
const parentIndex = parent.data.findIndex(d => d.id === data.id);
|
||||
parent.data.splice(parentIndex, 1);
|
||||
} else {
|
||||
const childIndex = children.findIndex((d) => d.id === data.id);
|
||||
const childIndex = children.findIndex(d => d.id === data.id);
|
||||
children.splice(childIndex, 1);
|
||||
}
|
||||
this.curNode = undefined;
|
||||
@@ -546,7 +642,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
let id = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
|
||||
let id = ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
||||
(
|
||||
c ^
|
||||
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
|
||||
@@ -558,7 +654,7 @@ export default {
|
||||
nodes: [],
|
||||
id: id,
|
||||
typeName: "模板组",
|
||||
temporaryData: "1", //用来区分临时数据
|
||||
temporaryData: "1" //用来区分临时数据
|
||||
};
|
||||
/* 如果模版深度最多两层,以下条件改成该部分注释
|
||||
this.curNode && this.curNode.depth == 1
|
||||
@@ -658,7 +754,7 @@ export default {
|
||||
this.isUpdateGroup = false;
|
||||
const parent = node.parent;
|
||||
const children = parent.data.nodes || parent.data;
|
||||
const index = children.findIndex((d) => d.id === data.id);
|
||||
const index = children.findIndex(d => d.id === data.id);
|
||||
let temp = data;
|
||||
temp.text = this.isactTitle;
|
||||
children.splice(index, 1, temp);
|
||||
@@ -678,7 +774,7 @@ export default {
|
||||
this.dataListLoading = true;
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl("/book/labelAndMarket/labelTree"),
|
||||
method: "get",
|
||||
method: "get"
|
||||
// params: this.$http.adornParams({
|
||||
// 'page': this.pageIndex,
|
||||
// 'limit': this.pageSize,
|
||||
@@ -710,7 +806,7 @@ export default {
|
||||
// 多选
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val;
|
||||
},
|
||||
}
|
||||
// // 新增 / 修改
|
||||
// addOrUpdateHandle(row) {
|
||||
// this.addOrUpdateVisible = true;
|
||||
@@ -718,26 +814,31 @@ export default {
|
||||
// this.$refs.addOrUpdate.init(row);
|
||||
// });
|
||||
// },
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
/deep/ .filter-tree .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
|
||||
/deep/
|
||||
.filter-tree
|
||||
.el-tree--highlight-current
|
||||
.el-tree-node.is-current
|
||||
> .el-tree-node__content {
|
||||
// 设置颜色
|
||||
// background-color: #baf !important;
|
||||
}
|
||||
|
||||
/deep/ .filter-tree .el-tree-node:focus>.el-tree-node__content {
|
||||
/deep/ .filter-tree .el-tree-node:focus > .el-tree-node__content {
|
||||
background-color: transparent !important;
|
||||
// color: #17b3a3 !important;
|
||||
}
|
||||
|
||||
/deep/.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
|
||||
/deep/.el-tree--highlight-current
|
||||
.el-tree-node.is-current
|
||||
> .el-tree-node__content {
|
||||
background-color: transparent !important;
|
||||
// color: #17b3a3 !important;
|
||||
}
|
||||
|
||||
|
||||
/deep/.filter-tree .el-tree-node__content .el-button {
|
||||
display: inline-block !important;
|
||||
}
|
||||
@@ -812,7 +913,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
|
||||
.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
|
||||
background-color: #eaebed;
|
||||
color: #4796ec;
|
||||
font-weight: bold;
|
||||
@@ -920,9 +1021,8 @@ p {
|
||||
.el-tree-node__content:active {
|
||||
background-color: unset;
|
||||
}
|
||||
.isSelect{
|
||||
|
||||
/* 自定义角度渐变 */
|
||||
background-image: linear-gradient(-45deg, #fff, #b0f3ec);
|
||||
.isSelect {
|
||||
/* 自定义角度渐变 */
|
||||
background-image: linear-gradient(-45deg, #fff, #b0f3ec);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<div class="mod-config">
|
||||
<commonTree
|
||||
source="tags"
|
||||
axiosType="raw"
|
||||
axiosResultKey="market"
|
||||
@changeCurrentNode="changeCurrentNode"
|
||||
ref="commonTree"
|
||||
:dataList="treeDataList"
|
||||
@@ -88,12 +90,17 @@
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- :isNoSearch="true" -->
|
||||
<commonShop
|
||||
:defaultForm="{
|
||||
title: '',
|
||||
marketId:addForm.id
|
||||
:otherInfo="{
|
||||
httpDataValueName: 'courseList'
|
||||
}"
|
||||
:defaultForm="{
|
||||
marketId: addForm.id
|
||||
}"
|
||||
axiosType="raw"
|
||||
getAssociatedGoodsListKey="marketId"
|
||||
:isNoPaging="true"
|
||||
getAssociatedGoodsListValue="result"
|
||||
:tableColumnList="tableColumnList"
|
||||
:currentId="addForm.id ? addForm.id : ''"
|
||||
@@ -106,7 +113,12 @@
|
||||
:style="`height: calc(100% - 50px); `"
|
||||
>
|
||||
<template slot="searchFormItem" slot-scope="slotProps">
|
||||
<el-form-item label="课程名称" prop="title" class="form_item" style="width: 240px;">
|
||||
<!-- <el-form-item
|
||||
label="课程名称"
|
||||
prop="title"
|
||||
class="form_item"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入课程名称"
|
||||
@@ -115,7 +127,7 @@
|
||||
clearable
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="商品类型" prop="goodsType" class="form_item">
|
||||
<el-select
|
||||
size="small"
|
||||
@@ -209,9 +221,14 @@
|
||||
</el-form> -->
|
||||
<commonShopTable
|
||||
title="课程"
|
||||
:otherInfo="{
|
||||
httpType:'raw',
|
||||
httpDataValueName:'records',
|
||||
httpDataTotalName:'total'
|
||||
}"
|
||||
:defaultForm="{
|
||||
title: '',
|
||||
marketId:addForm.id
|
||||
keywords: '',
|
||||
id: addForm.id
|
||||
}"
|
||||
:urlList="urlList"
|
||||
:tableColumnList="tableColumnList"
|
||||
@@ -222,12 +239,12 @@
|
||||
@submit="handleSubmitShopTable"
|
||||
>
|
||||
<template slot="searchFormItem" slot-scope="slotProps">
|
||||
<el-form-item label="课程名称" prop="title" class="form_item">
|
||||
<el-form-item label="课程名称" prop="keywords" class="form_item">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="请输入课程名称"
|
||||
style="width: 100%"
|
||||
v-model="slotProps.dataForm.title"
|
||||
v-model="slotProps.dataForm.keywords"
|
||||
clearable
|
||||
>
|
||||
</el-input>
|
||||
@@ -291,18 +308,19 @@ import commonTree from "@/views/components/commonBookTags/tags.vue";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
isEdit: false,
|
||||
checkAll: false,
|
||||
isIndeterminate: true,
|
||||
urlList: {
|
||||
treeList: "/master/courseMarket/marketTree",
|
||||
delete: "/master/courseMarket/delMarket",
|
||||
deleteShop: "/master/courseMarket/delToMarket",
|
||||
saveShop: "/master/courseMarket/saveToMarket",
|
||||
add: "/master/courseMarket/saveOrUpdateMarket",
|
||||
getAssociatedGoodsList: "/master/courseMarket/getCourseByMarketId",
|
||||
getNotToLabelList: "/master/courseMarket/getNotToMarketList"
|
||||
treeList: "/master/courseSociologyMarket/marketTree",
|
||||
delete: "/master/courseSociologyMarket/delMarket",
|
||||
deleteShop: "/master/courseSociologyMarket/delToMarket",
|
||||
saveShop: "/master/courseSociologyMarket/saveToMarket",
|
||||
add: "/master/courseSociologyMarket/addSociologyMarket",
|
||||
edit: "/master/courseSociologyMarket/editSociologyMarket",
|
||||
getAssociatedGoodsList:
|
||||
"/master/courseSociologyMarket/getCourseListByMarketId",
|
||||
CanBindProductList: "/master/courseSociologyMarket/getNotToMarketList"
|
||||
},
|
||||
addForm: {},
|
||||
isFresh: false,
|
||||
@@ -492,7 +510,9 @@ export default {
|
||||
await this.$refs[formName].validate(async valid => {
|
||||
if (valid) {
|
||||
await this.$http({
|
||||
url: this.$http.adornUrl(`${this.urlList.add}`),
|
||||
url: this.$http.adornUrl(
|
||||
this.addForm.id ? this.urlList.edit : this.urlList.add
|
||||
),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
...this.addForm
|
||||
@@ -503,7 +523,7 @@ export default {
|
||||
await this.getDataList();
|
||||
|
||||
this.$nextTick(async () => {
|
||||
this.$refs.commonTree.setCurrentNodeShow(data.result.id);
|
||||
this.$refs.commonTree.setCurrentNodeShow(data.market.id);
|
||||
|
||||
this.addForm = data.result;
|
||||
this.currentNode = { data: { ...data.result } };
|
||||
@@ -997,7 +1017,7 @@ export default {
|
||||
|
||||
.tree_content_box {
|
||||
height: calc(100% - 110px) !important;
|
||||
.shopFormBox{
|
||||
.shopFormBox {
|
||||
width: auto !important;
|
||||
}
|
||||
}
|
||||
@@ -296,11 +296,11 @@ export default {
|
||||
checkAll: false,
|
||||
isIndeterminate: true,
|
||||
urlList: {
|
||||
treeList: "/master/courseMarket/marketTree",
|
||||
treeList: "/master/courseMedicineMarket/marketTree",
|
||||
delete: "/master/courseMarket/delMarket",
|
||||
deleteShop: "/master/courseMarket/delToMarket",
|
||||
saveShop: "/master/courseMarket/saveToMarket",
|
||||
add: "/master/courseMarket/saveOrUpdateMarket",
|
||||
add: "/master/courseSociologyMarket/saveOrUpdateMarket",
|
||||
getAssociatedGoodsList: "/master/courseMarket/getCourseByMarketId",
|
||||
getNotToLabelList: "/master/courseMarket/getNotToMarketList"
|
||||
},
|
||||
|
||||
274
src/views/modules/courseSettings/chapter-add-or-update.vue
Normal file
274
src/views/modules/courseSettings/chapter-add-or-update.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"
|
||||
@close="handlereset">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="120px">
|
||||
<el-form-item label="课程说明名称" prop="title">
|
||||
<el-input v-model="dataForm.title" placeholder="章节名"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="插图" prop="imgUrl">
|
||||
<el-upload :action="baseUrl + '/oss/fileoss'" list-type="picture-card" :on-preview="handlePictureCardPreview"
|
||||
:file-list="fileList" :on-success="handlePicSuccess" :on-remove="handleRemove">
|
||||
<i class="el-icon-plus"></i>
|
||||
</el-upload>
|
||||
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
|
||||
<img width="100%" :src="dataForm.imgUrl" alt="">
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="内容" prop="content" class="custom-chapter-height">
|
||||
<!-- <el-input v-model="dataForm.content" placeholder="内容"></el-input> -->
|
||||
<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" :options="editorOption"
|
||||
@blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
|
||||
@ready="onEditorReady($event)" class="chapter_editor">
|
||||
</quill-editor>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="dataForm.sort" placeholder="排序"></el-input>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<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,
|
||||
// 富文本编辑器配置
|
||||
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: '请输入正文',
|
||||
},
|
||||
visible: false,
|
||||
props: {
|
||||
dictType: '',
|
||||
dictValue: ''
|
||||
},
|
||||
gushuList:[],
|
||||
authorList: [],
|
||||
restaurants: [],
|
||||
author: '',
|
||||
publisherList: [],
|
||||
fileList: [],
|
||||
fileListNovel: [],
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
dataForm: {
|
||||
"courseId": 0,
|
||||
"catalogueId": 0,
|
||||
"title": "",
|
||||
"imgUrl": "",
|
||||
"content": "",
|
||||
"sort": 1,
|
||||
},
|
||||
splitsTypeList: [],
|
||||
dataRule: {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
quillEditor
|
||||
},
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
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, 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 = []
|
||||
}
|
||||
|
||||
},
|
||||
// 表单提交
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handlePicSuccess(res, file) {
|
||||
if (res.msg == "success") {
|
||||
this.dataForm.imgUrl = res.url;
|
||||
this.$message.success("上传成功");
|
||||
} else {
|
||||
this.$message.error("上传失败");
|
||||
}
|
||||
},
|
||||
handleRemove(file) {
|
||||
this.dataForm.imgUrl = '';
|
||||
},
|
||||
handlePictureCardPreview(file) {
|
||||
this.dataForm.imgUrl = 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>
|
||||
351
src/views/modules/courseSettings/medicalCourseDescription.vue
Normal file
351
src/views/modules/courseSettings/medicalCourseDescription.vue
Normal file
@@ -0,0 +1,351 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form
|
||||
:inline="true"
|
||||
:model="dataForm"
|
||||
@keyup.enter.native="getDataList()"
|
||||
>
|
||||
<!-- <el-form-item label="课程目录章节名称">
|
||||
<el-input v-model="query.keywords" placeholder="课程目录章节名称" clearable></el-input>
|
||||
</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>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
style="width: 100%;"
|
||||
|
||||
>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="课程说明名称"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column
|
||||
prop="createTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="创建日期"
|
||||
>
|
||||
</el-table-column> -->
|
||||
<el-table-column header-align="center" align="center" label="图片">
|
||||
<template slot-scope="scope">
|
||||
<img
|
||||
v-if="scope.row.imgUrl != ''"
|
||||
:src="scope.row.imgUrl"
|
||||
width="70"
|
||||
height="100"
|
||||
class="tableImg"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="content"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="内容"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div class="hidden1">
|
||||
{{ scope.row.content }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="sort"
|
||||
width="100"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="排序"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="250"
|
||||
label="操作"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<router-link
|
||||
:to="{
|
||||
path: 'course-courseVideo',
|
||||
query: { id: scope.row.id, pageIndex }
|
||||
}"
|
||||
>
|
||||
<el-button type="text" size="small">视频管理</el-button>
|
||||
</router-link>
|
||||
<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: 30px 0; text-align: center;"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="getDataList"
|
||||
></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from "./chapter-add-or-update";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ""
|
||||
},
|
||||
query: {
|
||||
type: "",
|
||||
categoryId: "",
|
||||
sociologyId: "",
|
||||
keywords: ""
|
||||
},
|
||||
dataList: [],
|
||||
delFlag: false,
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
};
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated() {
|
||||
this.courseid = this.$route.query.courseid;
|
||||
this.catalogue_id = this.$route.query.id;
|
||||
console.log("111", this.courseid);
|
||||
console.log("222", this.catalogue_id);
|
||||
if (this.$route.query.upPageInde != null) {
|
||||
this.pageIndex = this.$route.query.upPageIndex;
|
||||
console.log(this.pageIndex);
|
||||
}
|
||||
this.getDataList();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
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 //关键字
|
||||
})
|
||||
}).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) {
|
||||
console.log("row1", row);
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(row, this.catalogue_id, this.courseid);
|
||||
});
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
// var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
// return item.id
|
||||
// })
|
||||
this.$confirm(
|
||||
`确定对[id=${id}]进行[${id ? "删除" : "批量删除"}]操作?`,
|
||||
"提示",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}
|
||||
).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl("/master/course/delCourseCatalogueChapter"),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
id: id
|
||||
})
|
||||
}).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>
|
||||
<style scoped lang="scss">
|
||||
.hidden1 {
|
||||
text-overflow: ellipsis;
|
||||
// white-space: nowrap;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
|
||||
-webkit-line-clamp:1;
|
||||
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,351 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form
|
||||
:inline="true"
|
||||
:model="dataForm"
|
||||
@keyup.enter.native="getDataList()"
|
||||
>
|
||||
<!-- <el-form-item label="课程目录章节名称">
|
||||
<el-input v-model="query.keywords" placeholder="课程目录章节名称" clearable></el-input>
|
||||
</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>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
style="width: 100%;"
|
||||
|
||||
>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="课程说明名称"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column
|
||||
prop="createTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="创建日期"
|
||||
>
|
||||
</el-table-column> -->
|
||||
<el-table-column header-align="center" align="center" label="图片">
|
||||
<template slot-scope="scope">
|
||||
<img
|
||||
v-if="scope.row.imgUrl != ''"
|
||||
:src="scope.row.imgUrl"
|
||||
width="70"
|
||||
height="100"
|
||||
class="tableImg"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="content"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="内容"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div class="hidden1">
|
||||
{{ scope.row.content }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="sort"
|
||||
width="100"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="排序"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="250"
|
||||
label="操作"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<router-link
|
||||
:to="{
|
||||
path: 'course-courseVideo',
|
||||
query: { id: scope.row.id, pageIndex }
|
||||
}"
|
||||
>
|
||||
<el-button type="text" size="small">视频管理</el-button>
|
||||
</router-link>
|
||||
<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: 30px 0; text-align: center;"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
>
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="getDataList"
|
||||
></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from "./chapter-add-or-update";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ""
|
||||
},
|
||||
query: {
|
||||
type: "",
|
||||
categoryId: "",
|
||||
sociologyId: "",
|
||||
keywords: ""
|
||||
},
|
||||
dataList: [],
|
||||
delFlag: false,
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
};
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated() {
|
||||
this.courseid = this.$route.query.courseid;
|
||||
this.catalogue_id = this.$route.query.id;
|
||||
console.log("111", this.courseid);
|
||||
console.log("222", this.catalogue_id);
|
||||
if (this.$route.query.upPageInde != null) {
|
||||
this.pageIndex = this.$route.query.upPageIndex;
|
||||
console.log(this.pageIndex);
|
||||
}
|
||||
this.getDataList();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
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 //关键字
|
||||
})
|
||||
}).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) {
|
||||
console.log("row1", row);
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(row, this.catalogue_id, this.courseid);
|
||||
});
|
||||
},
|
||||
// 删除
|
||||
deleteHandle(id) {
|
||||
// var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
// return item.id
|
||||
// })
|
||||
this.$confirm(
|
||||
`确定对[id=${id}]进行[${id ? "删除" : "批量删除"}]操作?`,
|
||||
"提示",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}
|
||||
).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl("/master/course/delCourseCatalogueChapter"),
|
||||
method: "post",
|
||||
data: this.$http.adornData({
|
||||
id: id
|
||||
})
|
||||
}).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>
|
||||
<style scoped lang="scss">
|
||||
.hidden1 {
|
||||
text-overflow: ellipsis;
|
||||
// white-space: nowrap;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
|
||||
-webkit-line-clamp:1;
|
||||
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user