|
@@ -6,8 +6,10 @@
|
|
<div>
|
|
<div>
|
|
<div class="home_titleHead">
|
|
<div class="home_titleHead">
|
|
<div class="ban">Banner管理</div>
|
|
<div class="ban">Banner管理</div>
|
|
- <el-button size="small" type="primary">添加图片</el-button>
|
|
|
|
- <!-- @click="dialogVisible = true" -->
|
|
|
|
|
|
+ <el-button size="small" type="primary" @click="dialogVisible = true"
|
|
|
|
+ >添加图片</el-button
|
|
|
|
+ >
|
|
|
|
+ <!-- -->
|
|
</div>
|
|
</div>
|
|
<el-table
|
|
<el-table
|
|
:data="tableData"
|
|
:data="tableData"
|
|
@@ -89,6 +91,7 @@
|
|
height="500"
|
|
height="500"
|
|
:cell-style="{ 'text-align': 'center' }"
|
|
:cell-style="{ 'text-align': 'center' }"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
|
+ v-loading="loading[item.id]"
|
|
>
|
|
>
|
|
<el-table-column prop="title" label="课程名称" min-width="25">
|
|
<el-table-column prop="title" label="课程名称" min-width="25">
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -330,64 +333,10 @@ export default {
|
|
linkInput: "",
|
|
linkInput: "",
|
|
checkList: [],
|
|
checkList: [],
|
|
courseList: [],
|
|
courseList: [],
|
|
- tableData: [
|
|
|
|
- {
|
|
|
|
- create_at: "2021-04-23T20:14:49.000Z",
|
|
|
|
- id: "f9010b15-a40b-11eb-80ad-005056b86db5",
|
|
|
|
- number: 0,
|
|
|
|
- poster:
|
|
|
|
- "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/组211619165665500.png",
|
|
|
|
- title: "麓城外国语小学-我是种植小能手-406胡智航",
|
|
|
|
- url: "5fbbdeb1-96a2-11eb-80ad-005056b86db5",
|
|
|
|
- userid: "0",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- zoneList: [
|
|
|
|
- {
|
|
|
|
- create_at: "2021-04-06T19:37:56.000Z",
|
|
|
|
- createuserid: "0",
|
|
|
|
- id: "1",
|
|
|
|
- name: "热门推荐",
|
|
|
|
- oid: null,
|
|
|
|
- order: 6,
|
|
|
|
- parentid: "1",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- create_at: "2021-04-06T19:37:56.000Z",
|
|
|
|
- createuserid: "0",
|
|
|
|
- id: "2",
|
|
|
|
- name: "PBL热门项目",
|
|
|
|
- oid: null,
|
|
|
|
- order: 6,
|
|
|
|
- parentid: "1",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- zoneClass: {
|
|
|
|
- 1: [
|
|
|
|
- {
|
|
|
|
- title: "印象中秋",
|
|
|
|
- brief: "印象中秋",
|
|
|
|
- vcount: "123",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: "深圳发展40周年",
|
|
|
|
- brief: "深圳发展40周年",
|
|
|
|
- vcount: "456",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- 2: [
|
|
|
|
- {
|
|
|
|
- title: "印象中秋",
|
|
|
|
- brief: "印象中秋",
|
|
|
|
- vcount: "123",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: "深圳发展40周年",
|
|
|
|
- brief: "深圳发展40周年",
|
|
|
|
- vcount: "456",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
|
|
+ tableData: [],
|
|
|
|
+ zoneList: [],
|
|
|
|
+ zoneClass: {},
|
|
|
|
+ loading: {},
|
|
page: {},
|
|
page: {},
|
|
total: {},
|
|
total: {},
|
|
pid: "",
|
|
pid: "",
|
|
@@ -527,6 +476,7 @@ export default {
|
|
this.zoneList = res.data[0];
|
|
this.zoneList = res.data[0];
|
|
this.zoneList.filter((element) => {
|
|
this.zoneList.filter((element) => {
|
|
this.page[element.id] = 1;
|
|
this.page[element.id] = 1;
|
|
|
|
+ this.loading[element.id] = true;
|
|
this.getZoneClass(element.id);
|
|
this.getZoneClass(element.id);
|
|
});
|
|
});
|
|
})
|
|
})
|
|
@@ -536,10 +486,12 @@ export default {
|
|
},
|
|
},
|
|
//获取专区下的课程
|
|
//获取专区下的课程
|
|
getZoneClass(zid) {
|
|
getZoneClass(zid) {
|
|
|
|
+ this.loading[zid] = true;
|
|
let params = { bid: zid, page: this.page[zid] };
|
|
let params = { bid: zid, page: this.page[zid] };
|
|
this.ajax
|
|
this.ajax
|
|
.get(this.$store.state.api + "getZoneClass", params)
|
|
.get(this.$store.state.api + "getZoneClass", params)
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
|
+ this.loading[zid] = false;
|
|
this.isListAjax = false;
|
|
this.isListAjax = false;
|
|
// this.zoneClass[zid] = res.data[0];
|
|
// this.zoneClass[zid] = res.data[0];
|
|
this.$set(this.zoneClass, zid, res.data[0]);
|
|
this.$set(this.zoneClass, zid, res.data[0]);
|
|
@@ -556,77 +508,79 @@ export default {
|
|
},
|
|
},
|
|
//添加课程专区
|
|
//添加课程专区
|
|
addZone() {
|
|
addZone() {
|
|
- // if (this.zoneName === "") {
|
|
|
|
- // this.$message.error("请填写添加课程专区名称");
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // if (this.time()) {
|
|
|
|
- // let params = [{ n: this.zoneName, cuid: "0" }];
|
|
|
|
- // this.ajax
|
|
|
|
- // .post(this.$store.state.api + "addZone", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: "添加成功",
|
|
|
|
- // type: "success",
|
|
|
|
- // });
|
|
|
|
- // this.zoneName = "";
|
|
|
|
- // this.dialogVisible4 = false;
|
|
|
|
- // this.init();
|
|
|
|
- // this.getZone();
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // this.$message.error("添加失败");
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
|
|
+ if (this.zoneName === "") {
|
|
|
|
+ this.$message.error("请填写添加课程专区名称");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (this.time()) {
|
|
|
|
+ let params = [
|
|
|
|
+ { n: this.zoneName, cuid: this.$store.state.userInfo.uid },
|
|
|
|
+ ];
|
|
|
|
+ this.ajax
|
|
|
|
+ .post(this.$store.state.api + "addZone", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "添加成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.zoneName = "";
|
|
|
|
+ this.dialogVisible4 = false;
|
|
|
|
+ this.init();
|
|
|
|
+ this.getZone();
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ this.$message.error("添加失败");
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
},
|
|
},
|
|
//获取专区下的课程数量
|
|
//获取专区下的课程数量
|
|
getZoneNum(zid) {
|
|
getZoneNum(zid) {
|
|
- // let params = { bid: zid };
|
|
|
|
- // this.ajax
|
|
|
|
- // .get(this.$store.state.api + "getZoneClassNum", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // if (res.data[0][0].num > 0) {
|
|
|
|
- // this.$message.error("请把专区底下的课程全部删除才可以删除专区");
|
|
|
|
- // } else {
|
|
|
|
- // this.deleteZone(zid);
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
|
|
+ let params = { bid: zid };
|
|
|
|
+ this.ajax
|
|
|
|
+ .get(this.$store.state.api + "getZoneClassNum", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ if (res.data[0][0].num > 0) {
|
|
|
|
+ this.$message.error("请把专区底下的课程全部删除才可以删除专区");
|
|
|
|
+ } else {
|
|
|
|
+ this.deleteZone(zid);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
},
|
|
},
|
|
//删除课程专区
|
|
//删除课程专区
|
|
deleteZone(zid) {
|
|
deleteZone(zid) {
|
|
- // let params = [{ id: zid }];
|
|
|
|
- // this.$confirm("确定删除此专区吗?", "提示", {
|
|
|
|
- // confirmButtonText: "确定",
|
|
|
|
- // cancelButtonText: "取消",
|
|
|
|
- // type: "warning",
|
|
|
|
- // })
|
|
|
|
- // .then(() => {
|
|
|
|
- // this.ajax
|
|
|
|
- // .post(this.$store.state.api + "deleteZone", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: "删除成功",
|
|
|
|
- // type: "success",
|
|
|
|
- // });
|
|
|
|
- // this.getZone();
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // this.$message.error("删除失败");
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
- // })
|
|
|
|
- // .catch(() => {});
|
|
|
|
|
|
+ let params = [{ id: zid }];
|
|
|
|
+ this.$confirm("确定删除此专区吗?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.ajax
|
|
|
|
+ .post(this.$store.state.api + "deleteZone", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "删除成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.getZone();
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ this.$message.error("删除失败");
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
},
|
|
},
|
|
//打开添加弹窗
|
|
//打开添加弹窗
|
|
addPop(zid) {
|
|
addPop(zid) {
|
|
- // this.init();
|
|
|
|
- // this.dialogVisible1 = true;
|
|
|
|
- // this.pid = zid;
|
|
|
|
- // this.Search();
|
|
|
|
|
|
+ this.init();
|
|
|
|
+ this.dialogVisible1 = true;
|
|
|
|
+ this.pid = zid;
|
|
|
|
+ this.Search();
|
|
},
|
|
},
|
|
//打开添加弹窗
|
|
//打开添加弹窗
|
|
addBannerUrlPop() {
|
|
addBannerUrlPop() {
|
|
@@ -725,59 +679,64 @@ export default {
|
|
},
|
|
},
|
|
//删除课程专区
|
|
//删除课程专区
|
|
deleteZoneCourse(id, zid) {
|
|
deleteZoneCourse(id, zid) {
|
|
- // let params = [{ id: id }];
|
|
|
|
- // this.$confirm("确定把此课程从次专区删除吗?", "提示", {
|
|
|
|
- // confirmButtonText: "确定",
|
|
|
|
- // cancelButtonText: "取消",
|
|
|
|
- // type: "warning",
|
|
|
|
- // })
|
|
|
|
- // .then(() => {
|
|
|
|
- // this.ajax
|
|
|
|
- // .post(this.$store.state.api + "deleteZoneCourse", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: "删除成功",
|
|
|
|
- // type: "success",
|
|
|
|
- // });
|
|
|
|
- // this.getZoneClass(zid);
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // this.$message.error("删除失败");
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
- // })
|
|
|
|
- // .catch(() => {});
|
|
|
|
|
|
+ let params = [{ id: id }];
|
|
|
|
+ this.$confirm("确定把此课程从次专区删除吗?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.ajax
|
|
|
|
+ .post(this.$store.state.api + "deleteZoneCourse", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "删除成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.getZoneClass(zid);
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ this.$message.error("删除失败");
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
},
|
|
},
|
|
//把课程添加进专区
|
|
//把课程添加进专区
|
|
addBanner() {
|
|
addBanner() {
|
|
- // var list = this.fileList;
|
|
|
|
- // if (list.length == 0) {
|
|
|
|
- // this.$message.error("请上传需要添加的banner");
|
|
|
|
- // return;
|
|
|
|
- // } else if (this.bannerCourse === "") {
|
|
|
|
- // this.$message.error("请填写选择banner的链接");
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // if (this.time()) {
|
|
|
|
- // let params = [
|
|
|
|
- // { p: list[0].url, url: this.bannerCourse.courseId, uid: "0", n: "0" },
|
|
|
|
- // ];
|
|
|
|
- // this.ajax
|
|
|
|
- // .post(this.$store.state.api + "addBanner", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: "添加成功",
|
|
|
|
- // type: "success",
|
|
|
|
- // });
|
|
|
|
- // this.dialogVisible = false;
|
|
|
|
- // this.init();
|
|
|
|
- // this.getBanner();
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // this.$message.error("添加失败");
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
|
|
+ var list = this.fileList;
|
|
|
|
+ if (list.length == 0) {
|
|
|
|
+ this.$message.error("请上传需要添加的banner");
|
|
|
|
+ return;
|
|
|
|
+ } else if (this.bannerCourse === "") {
|
|
|
|
+ this.$message.error("请填写选择banner的链接");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (this.time()) {
|
|
|
|
+ let params = [
|
|
|
|
+ //this.bannerCourse.courseId
|
|
|
|
+ {
|
|
|
|
+ p: list[0].url,
|
|
|
|
+ url: this.bannerCourse.courseId,
|
|
|
|
+ uid: this.$store.state.userInfo.uid,
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ this.ajax
|
|
|
|
+ .post(this.$store.state.api + "addBanner", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "添加成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
+ this.init();
|
|
|
|
+ this.getBanner();
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ this.$message.error("添加失败");
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
},
|
|
},
|
|
//获取banner
|
|
//获取banner
|
|
getBanner() {
|
|
getBanner() {
|
|
@@ -793,72 +752,72 @@ export default {
|
|
},
|
|
},
|
|
//删除banner
|
|
//删除banner
|
|
deleteBanner(id) {
|
|
deleteBanner(id) {
|
|
- // let params = [{ id: id }];
|
|
|
|
- // this.$confirm("确定删除此banner吗?", "提示", {
|
|
|
|
- // confirmButtonText: "确定",
|
|
|
|
- // cancelButtonText: "取消",
|
|
|
|
- // type: "warning",
|
|
|
|
- // })
|
|
|
|
- // .then(() => {
|
|
|
|
- // this.ajax
|
|
|
|
- // .post(this.$store.state.api + "deleteBanner", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: "删除成功",
|
|
|
|
- // type: "success",
|
|
|
|
- // });
|
|
|
|
- // this.getBanner();
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // this.$message.error("删除失败");
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
- // })
|
|
|
|
- // .catch(() => {});
|
|
|
|
|
|
+ let params = [{ id: id }];
|
|
|
|
+ this.$confirm("确定删除此banner吗?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.ajax
|
|
|
|
+ .post(this.$store.state.api + "deleteBanner", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "删除成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.getBanner();
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ this.$message.error("删除失败");
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {});
|
|
},
|
|
},
|
|
up(index) {
|
|
up(index) {
|
|
- // if (index == 0) {
|
|
|
|
- // this.$message.error("已经是最上面的一个,不可以再上移了");
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // let params = [
|
|
|
|
- // { aid: this.zoneList[index].id, bid: this.zoneList[index - 1].id },
|
|
|
|
- // ];
|
|
|
|
- // this.ajax
|
|
|
|
- // .post(this.$store.state.api + "zoneRank", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: "上移成功",
|
|
|
|
- // type: "success",
|
|
|
|
- // });
|
|
|
|
- // this.getZone();
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // this.$message.error("上移失败");
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
|
|
+ if (index == 0) {
|
|
|
|
+ this.$message.error("已经是最上面的一个,不可以再上移了");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let params = [
|
|
|
|
+ { aid: this.zoneList[index].id, bid: this.zoneList[index - 1].id },
|
|
|
|
+ ];
|
|
|
|
+ this.ajax
|
|
|
|
+ .post(this.$store.state.api + "zoneRank", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "上移成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.getZone();
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ this.$message.error("上移失败");
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
},
|
|
},
|
|
down(index) {
|
|
down(index) {
|
|
- // if (index == this.zoneList.length - 1) {
|
|
|
|
- // this.$message.error("已经是最下面的一个,不可以再下移了");
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
- // let params = [
|
|
|
|
- // { aid: this.zoneList[index].id, bid: this.zoneList[index + 1].id },
|
|
|
|
- // ];
|
|
|
|
- // this.ajax
|
|
|
|
- // .post(this.$store.state.api + "zoneRank", params)
|
|
|
|
- // .then((res) => {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: "下移成功",
|
|
|
|
- // type: "success",
|
|
|
|
- // });
|
|
|
|
- // this.getZone();
|
|
|
|
- // })
|
|
|
|
- // .catch((err) => {
|
|
|
|
- // this.$message.error("下移失败");
|
|
|
|
- // console.error(err);
|
|
|
|
- // });
|
|
|
|
|
|
+ if (index == this.zoneList.length - 1) {
|
|
|
|
+ this.$message.error("已经是最下面的一个,不可以再下移了");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let params = [
|
|
|
|
+ { aid: this.zoneList[index].id, bid: this.zoneList[index + 1].id },
|
|
|
|
+ ];
|
|
|
|
+ this.ajax
|
|
|
|
+ .post(this.$store.state.api + "zoneRank", params)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "下移成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ });
|
|
|
|
+ this.getZone();
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ this.$message.error("下移失败");
|
|
|
|
+ console.error(err);
|
|
|
|
+ });
|
|
},
|
|
},
|
|
//设置banner链接
|
|
//设置banner链接
|
|
setBannerUrl() {
|
|
setBannerUrl() {
|
|
@@ -871,8 +830,8 @@ export default {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- // this.getBanner();
|
|
|
|
- // this.getZone();
|
|
|
|
|
|
+ this.getBanner();
|
|
|
|
+ this.getZone();
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|