|
|
|
@ -267,7 +267,6 @@ |
|
|
|
* @param {Object} e {html,text} 内容的html文本,和text文本 |
|
|
|
*/ |
|
|
|
inputOver(e) { |
|
|
|
// 可以在此处获取到编辑器已编辑的内容 |
|
|
|
|
|
|
|
this.productIntro = e |
|
|
|
}, |
|
|
|
@ -276,7 +275,6 @@ |
|
|
|
* @param {Object} e {html,text} 内容的html文本,和text文本 |
|
|
|
*/ |
|
|
|
overMax(e) { |
|
|
|
// 若设置了最大字数限制,可在此处触发超出限制的回调 |
|
|
|
|
|
|
|
}, |
|
|
|
/** |
|
|
|
@ -286,9 +284,7 @@ |
|
|
|
* @tutorial 相关api https://uniapp.dcloud.net.cn/api/media/editor-context.html |
|
|
|
*/ |
|
|
|
initEditor(editor) { |
|
|
|
this.editorIns = editor // 保存编辑器实例 |
|
|
|
// 保存编辑器实例后,可以在此处获取后端数据,并赋值给编辑器初始化内容 |
|
|
|
|
|
|
|
this.editorIns = editor |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 直接运行示例工程插入图片无法正常显示的看这里 |
|
|
|
@ -308,7 +304,7 @@ |
|
|
|
// 注意微信小程序的图片路径是在tempFilePath字段中 |
|
|
|
editorCtx.insertImage({ |
|
|
|
src: tempFiles[0].tempFilePath, |
|
|
|
width: '80%', // 默认不建议铺满宽度100%,预留一点空隙以便用户编辑 |
|
|
|
width: '80%', |
|
|
|
success: function() {} |
|
|
|
}) |
|
|
|
// #endif |
|
|
|
@ -316,35 +312,10 @@ |
|
|
|
// #ifndef MP-WEIXIN |
|
|
|
editorCtx.insertImage({ |
|
|
|
src: tempFiles[0].path, |
|
|
|
width: '80%', // 默认不建议铺满宽度100%,预留一点空隙以便用户编辑 |
|
|
|
width: '80%', |
|
|
|
success: function() {} |
|
|
|
}) |
|
|
|
// #endif |
|
|
|
|
|
|
|
/** |
|
|
|
* 使用 uniCloud.uploadFile 上传图片的示例方法(可适用多选上传) |
|
|
|
* 正式开发环境中,请将上面 本地临时插入图片预览 注释后,模仿以下写法 |
|
|
|
*/ |
|
|
|
// tempFiles.forEach(async (item) => { |
|
|
|
// uni.showLoading({ |
|
|
|
// title: '上传中请稍后', |
|
|
|
// mask: true |
|
|
|
// }) |
|
|
|
// let upfile = await uniCloud.uploadFile({ |
|
|
|
// filePath: item.path, |
|
|
|
// // 同名会导致报错 policy_does_not_allow_file_overwrite |
|
|
|
// // cloudPath可由 想要存储的文件夹/文件名 拼接,若不拼文件夹名则默认存储在cloudstorage文件夹中 |
|
|
|
// cloudPath: `cloudstorage/${item.name}`, |
|
|
|
// cloudPathAsRealPath: true |
|
|
|
// }) |
|
|
|
// editorCtx.insertImage({ |
|
|
|
// src: upfile.fileID, |
|
|
|
// width: '80%', // 默认不建议铺满宽度100%,预留一点空隙以便用户编辑 |
|
|
|
// success: function () { |
|
|
|
// uni.hideLoading() |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// }) |
|
|
|
}, |
|
|
|
//跳转分类页 |
|
|
|
goGategoryLow() { |
|
|
|
@ -369,7 +340,6 @@ |
|
|
|
this.typeItem = res.result[0] |
|
|
|
this.formData.categoryId = this.typeItem.id |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
@ -386,7 +356,7 @@ |
|
|
|
// this.$refs.form.validate((valid) => { |
|
|
|
// if (valid) { |
|
|
|
if (this.modalType == 0) { |
|
|
|
// 添加 避免编辑后传入id等数据 记得删除 |
|
|
|
|
|
|
|
delete this.formData.id; |
|
|
|
if(this.formData.isMoreBuy != 1){ |
|
|
|
this.formData.isMoreBuy = 0 |
|
|
|
@ -454,7 +424,7 @@ |
|
|
|
}, |
|
|
|
guigeSubmit(){ |
|
|
|
if(this.modalclassType == 'shuxing'){ |
|
|
|
// 保存当前分类的canbuy值 |
|
|
|
|
|
|
|
if(this.typeToAttrName){ |
|
|
|
this.canbuyMap[this.typeToAttrName] = parseInt(this.currentCanbuy) || 1 |
|
|
|
} |
|
|
|
@ -462,7 +432,7 @@ |
|
|
|
let parentName = this.attrValueArr[i].parentName |
|
|
|
let canbuyVal = parseInt(this.canbuyMap[parentName]) || 1 |
|
|
|
if(this.formData.attributeList1.size == 0){ |
|
|
|
//set has get |
|
|
|
|
|
|
|
let data = { |
|
|
|
title:[], |
|
|
|
canbuy: canbuyVal |
|
|
|
@ -545,7 +515,7 @@ |
|
|
|
}, |
|
|
|
edit(v) { |
|
|
|
this.modalType = 1; |
|
|
|
// 转换null为"" |
|
|
|
|
|
|
|
for (let attr in v) { |
|
|
|
if (v[attr] == null) { |
|
|
|
v[attr] = ""; |
|
|
|
@ -556,7 +526,6 @@ |
|
|
|
|
|
|
|
this.formData = data; |
|
|
|
|
|
|
|
// 解析attributeList(商品属性),兼容string和已解析的对象 |
|
|
|
let attrObj = this.formData.attributeList |
|
|
|
if (typeof attrObj === 'string' && attrObj !== '') { |
|
|
|
attrObj = JSON.parse(attrObj) |
|
|
|
@ -566,7 +535,6 @@ |
|
|
|
} |
|
|
|
this.formData.attributeList1 = new Map(Object.entries(attrObj)); |
|
|
|
|
|
|
|
// 解析attributeListPrice(商品规格价格),兼容string和已解析的数组 |
|
|
|
let priceArr = this.formData.attributeListPrice |
|
|
|
if (typeof priceArr === 'string' && priceArr !== '') { |
|
|
|
priceArr = JSON.parse(priceArr) |
|
|
|
@ -576,7 +544,6 @@ |
|
|
|
} |
|
|
|
this.formData.attributeListPrice = priceArr |
|
|
|
|
|
|
|
// 初始化canbuyMap,历史数据没有canbuy字段的默认为1 |
|
|
|
this.canbuyMap = {} |
|
|
|
this.attrValueArr = [] |
|
|
|
this.formData.attributeList1.forEach((value, key) => { |
|
|
|
@ -589,9 +556,8 @@ |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
// 深拷贝attributeListPrice作为specValueArr,避免引用问题 |
|
|
|
this.specValueArr = JSON.parse(JSON.stringify(this.formData.attributeListPrice)) |
|
|
|
|
|
|
|
this.specValueArr = JSON.parse(JSON.stringify(this.formData.attributeListPrice)) |
|
|
|
|
|
|
|
this.formData.sellTime = this.formData.sellBeginTime != '' ? 1 : 0 |
|
|
|
this.modalVisible = true; |
|
|
|
@ -610,7 +576,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
//guige |
|
|
|
|
|
|
|
if(this.categorySonData[index].checked == true){ |
|
|
|
this.specValueArr.push(this.categorySonData[index]) |
|
|
|
}else{ |
|
|
|
@ -625,7 +591,7 @@ |
|
|
|
}, |
|
|
|
//点击左侧菜单切换 |
|
|
|
clickLeftBtn(index) { |
|
|
|
// 切换前保存当前分类的canbuy |
|
|
|
|
|
|
|
if(this.typeToAttrName){ |
|
|
|
this.canbuyMap[this.typeToAttrName] = parseInt(this.currentCanbuy) || 1 |
|
|
|
} |
|
|
|
@ -638,7 +604,7 @@ |
|
|
|
} |
|
|
|
this.categoryIndex = index |
|
|
|
this.typeToAttrName = this.categoryData[this.categoryIndex].title |
|
|
|
// 恢复该分类之前设置的canbuy值 |
|
|
|
|
|
|
|
this.currentCanbuy = this.canbuyMap[this.typeToAttrName] || 1 |
|
|
|
this.getCateGorySon(this.categoryData[this.categoryIndex].id) |
|
|
|
}, |
|
|
|
@ -674,7 +640,7 @@ |
|
|
|
that.categoryData[i].parentId = false |
|
|
|
} |
|
|
|
} |
|
|
|
//如果是选择属性,需要拿一个分类名,保存成parent |
|
|
|
|
|
|
|
that.typeToAttrName = res.result[that.categoryIndex].title |
|
|
|
// 恢复该分类之前设置的canbuy值 |
|
|
|
that.currentCanbuy = that.canbuyMap[that.typeToAttrName] || 1 |
|
|
|
|