| | |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label febs-form-item-require">商品详情:</label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <textarea id="goodsDetailsUpdate" lay-verify="content" name="goodsDetails" class="layui-textarea"></textarea>--> |
| | | <!--<!– <div style="border: 1px solid #ccc;">–>--> |
| | | <!--<!– <div id="toolbar-container-good-update" style="border-bottom: 1px solid #ccc;"></div>–>--> |
| | | <!--<!– <div id="editor-container-good-update" style="height: 300px;"></div>–>--> |
| | | <!--<!– </div>–>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">商品详情:</label> |
| | | <div class="layui-input-block"> |
| | | <textarea id="goodsDetailsUpdate" lay-verify="content" name="goodsDetails" class="layui-textarea"></textarea> |
| | | <!-- <div style="border: 1px solid #ccc;">--> |
| | | <!-- <div id="toolbar-container-good-update" style="border-bottom: 1px solid #ccc;"></div>--> |
| | | <!-- <div id="editor-container-good-update" style="height: 300px;"></div>--> |
| | | <!-- </div>--> |
| | | <!-- <textarea id="goodsDetailEditAdd" lay-verify="content" name = "goodsDetails" class="layui-textarea"></textarea>--> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="toolbar-container" class="toolbar"></div> |
| | | <div id="text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | elem: '#febs-form-group-date' |
| | | }); |
| | | |
| | | layedit.set({ //设置图片接口 |
| | | uploadImage: { |
| | | url: 'admin/goods/uploadFileBase64', //接口url |
| | | type: 'post', |
| | | } |
| | | }); |
| | | |
| | | //创建一个编辑器 |
| | | var indexUpdate = layedit.build('goodsDetailsUpdate',{ |
| | | height: 300 |
| | | }); |
| | | form.verify({ |
| | | //content富文本域中的lay-verify值 |
| | | content: function(value) { |
| | | return layedit.sync(indexUpdate); |
| | | } |
| | | }); |
| | | // layedit.set({ //设置图片接口 |
| | | // uploadImage: { |
| | | // url: 'admin/goods/uploadFileBase64', //接口url |
| | | // type: 'post', |
| | | // } |
| | | // }); |
| | | // |
| | | // //创建一个编辑器 |
| | | // var indexUpdate = layedit.build('goodsDetailsUpdate',{ |
| | | // height: 300 |
| | | // }); |
| | | // form.verify({ |
| | | // //content富文本域中的lay-verify值 |
| | | // content: function(value) { |
| | | // return layedit.sync(indexUpdate); |
| | | // } |
| | | // }); |
| | | |
| | | formSelects.render(); |
| | | const E = window.wangEditor; |
| | | const editor = new E('#toolbar-container', '#text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | // var E = window.wangEditor; |
| | | // const editorConfig = { MENU_CONF: {} }; |
| | |
| | | reloadTable(skus); |
| | | } |
| | | |
| | | layedit.setContent(indexUpdate,goodsInfo.goodsDetails, false); |
| | | editor.txt.html(goodsInfo.goodsDetails); |
| | | // layedit.setContent(indexUpdate,, false); |
| | | } |
| | | |
| | | form.on('submit(goods-update-form-submit)', function (data) { |
| | |
| | | data.field.categoryId = category.getValue('valueStr'); |
| | | data.field.carriageRuleId = carriageRule.getValue('valueStr'); |
| | | // data.field.goodsDetails = editor.getHtml(); |
| | | data.field.goodsDetails = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url': ctx + 'admin/goods/updateMallGoods', |
| | | 'type': 'post', |