From a9d97805211b0134e78867a6b12193cde724494e Mon Sep 17 00:00:00 2001
From: "@fawn-nine" <1271023382@qq.com>
Date: Mon, 17 Jun 2024 13:52:54 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=B7=BB=E5=8A=A0=E5=85=B3?=
=?UTF-8?q?=E8=81=94=E4=B9=A6=E7=B1=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/course/course-add-or-update.vue | 80 +++-
src/views/modules/course/courseList.vue | 48 ++-
src/views/modules/course/shopproductTable.vue | 361 ++++++++++++++++++
3 files changed, 483 insertions(+), 6 deletions(-)
create mode 100644 src/views/modules/course/shopproductTable.vue
diff --git a/src/views/modules/course/course-add-or-update.vue b/src/views/modules/course/course-add-or-update.vue
index 4cf78a3..235cf5b 100644
--- a/src/views/modules/course/course-add-or-update.vue
+++ b/src/views/modules/course/course-add-or-update.vue
@@ -45,6 +45,43 @@
+
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+ 删除
+
+
+
+
+ 添加关联书籍
{
+ console.log('获得列表',data)
+ if(data && data.length > 0){
+ this.relationProducts = this.relationProducts.concat(data)
+ }
+ })
},
methods: {
+ delPro(i){
+ console.log('i',i)
+ // this.$emit('delPro',i)
+ this.relationProducts.splice(i,1)
+ console.log('处理后的',this.relationProducts)
+ },
+ showProTable(){
+ this.$emit('showProTable',true)
+ },
contentUploadSuccess(res, file) {
// console.log(res)
let quill = this.$refs.myQuillEditor.quill;
@@ -319,6 +373,7 @@ export default {
init(row) {
console.log("11111", row);
if (row && row.id) {
+ this.courseId = row.id
this.$http
.request({
url: this.$http.adornUrl(this.urlList.info),
@@ -337,7 +392,11 @@ export default {
if (res && res.data.code === 0) {
var data = res.data.course;
console.log("data at line 357:", data);
-
+ if(res.data.shopProductList && res.data.shopProductList.length > 0){
+ this.relationProducts = res.data.shopProductList
+ }else{
+ this.relationProducts = []
+ }
if (data.image != "" && data.image != null) {
var img = {
name: "",
@@ -365,6 +424,15 @@ export default {
// this.$message.error("请选择图书类型");
// return
// }
+ let _relationProductIds = ''
+ if(this.relationProducts.length > 0){
+ let _list = [...this.relationProducts]
+ _list = _list.map(item => item.productId)
+ _relationProductIds = _list.join()
+ // console.log(_relationProductIds, _list,'_relationProductIds')
+ }
+ // console.log(_relationProductIds, _list,'_relationProductIds')
+
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.$http({
@@ -381,7 +449,8 @@ export default {
title: this.dataForm.title,
sort: this.dataForm.sort,
image: this.dataForm.image,
- content: this.dataForm.content
+ content: this.dataForm.content,
+ relationProductIds : _relationProductIds
})
}).then(({ data }) => {
if (data && data.code === 0) {
@@ -391,6 +460,8 @@ export default {
duration: 1500,
onClose: () => {
this.visible = false;
+ this.relationProductIds = []
+ this.relationProducts = []
this.$emit("refreshDataList");
}
});
@@ -429,6 +500,9 @@ export default {
},
handlereset() {
(this.fileList = []), (this.fileListNovel = []), (this.visible = false);
+ this.$emit('pclose')
+ this.relationProducts = []
+ this.courseId = undefined
},
handlePreview(file) {
console.log(file);
diff --git a/src/views/modules/course/courseList.vue b/src/views/modules/course/courseList.vue
index 33c7f01..7b9f2c8 100644
--- a/src/views/modules/course/courseList.vue
+++ b/src/views/modules/course/courseList.vue
@@ -339,8 +339,17 @@
+
+
\ No newline at end of file