新增课程

This commit is contained in:
2024-09-11 16:35:18 +08:00
parent 36d56ea657
commit 01d12aba72

View File

@@ -357,6 +357,10 @@ export default {
// { required: true, message: '排序不能为空', trigger: 'blur' }
// ]
},
urlList:{
edit:'/master/shopProduct/editProductDetail',
add:'/master/shopProduct/addProduct',
},
// 富文本编辑器配置
editorOption: {
modules: {
@@ -402,6 +406,7 @@ export default {
if (op.insert && typeof op.insert !== "string") {
// 如果粘贴了图片,这里会是一个对象
if (op.insert.image) {
if (op.insert.image.includes(";base64")) {
let file = that.dataURLtoFile(
op.insert.image,
@@ -476,10 +481,24 @@ export default {
// .catch(err => {
// console.log(err);
// });
}else{
console.log('op.insert.image at line 407:', op.insert.image)
// 获取光标所在位置
var quill = that.$refs.myQuillEditor.quill;
var length = this.quillEditorIndex;
console.log("length at line 397:", length);
// 插入图片res为服务器返回的图片链接地址
quill.insertEmbed(length, "image", op.insert.image);
// 调整光标到最后
quill.setSelection(length + 1);
this.uploadLoading = false;
}
}
}
});
delta.ops = ops; // 不加会报错
return delta;
},
@@ -686,7 +705,7 @@ export default {
this.$http
.request({
url: this.$http.adornUrl("/master/shopProduct/editProductDetail"),
url: this.$http.adornUrl(this.dataForm.productId?this.urlList.edit:this.urlList.add),
method: "POST",
data: {
...this.dataForm,
@@ -699,43 +718,7 @@ export default {
}
})
// this.$http({
// url: this.$http.adornUrl(
// `/master/shopProduct/editProductDetail/${
// !this.dataForm.productId ? "save" : "update"
// }`
// ),
// method: "post",
// // data: this.$http.adornData({
// // productId: this.dataForm.productId || undefined,
// // productName: this.dataForm.productName,
// // price: this.dataForm.price,
// // weight: this.dataForm.weight,
// // publishStatus: this.dataForm.publishStatus,
// // productPid: this.dataForm.poids[this.dataForm.poids.length - 1],
// // productImages: this.dataForm.productImages,
// // productImageList: this.dataForm.productImageList,
// // createTime: this.dataForm.createTime,
// // updateTime: this.dataForm.updateTime,
// // delFlag: this.dataForm.delFlag,
// // sort: this.dataForm.sort,
// // goodsType: this.dataForm.goodsType,
// // productDetails: this.dataForm.productDetails,
// // author: this.dataForm.author,
// // publisher: this.dataForm.publisher,
// // pubDate: this.dataForm.pubDate,
// // shoproudLabels: this.dataForm.tags,
// // // 'format': this.dataForm.format, // 开本
// // isFreeMail: this.dataForm.isFreeMail,
// // isNew: this.dataForm.isNew,
// // // 'pageNum': this.dataForm.pageNum,
// // // 'quality': this.dataForm.quality, // 内文用纸
// // productStock: this.dataForm.productStock, // 库存
// // activityPrice: this.dataForm.hDprice,
// // bookids: this.bookidsd // 关联的图书[12,13,45]
// // // 'bookidsimages': this.dataForm.Books // 关联的图书对象
// // })
// })
.then(({ data }) => {
if (data && data.code === 0) {