From 48b659deb5ca926eadd792ef92e1115190a53352 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 18 Dec 2023 15:36:47 +0800
Subject: [PATCH] 富文本改造
---
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html | 75 ++++++++++++++++++++++++-------------
1 files changed, 48 insertions(+), 27 deletions(-)
diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
index 71e0dda..1698083 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -196,11 +196,11 @@
<div class="layui-form-item">
<label class="layui-form-label febs-form-item-require">商品详情:</label>
<div class="layui-input-block">
-<!-- <textarea id="lay_edit" lay-verify="goodsDetails" 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="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>
@@ -410,17 +410,35 @@
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);
+ }
+ });
+
formSelects.render();
- var E = window.wangEditor;
- const editorConfig = { MENU_CONF: {} };
- editorConfig.MENU_CONF['uploadImage'] = {
- server: '/admin/goods/uploadFileBase64',
- fieldName : "file",
- customInsert(res, insertFn) {
- insertFn(res.data.src, res.data.title, '')
- },
- }
+ // var E = window.wangEditor;
+ // const editorConfig = { MENU_CONF: {} };
+ // editorConfig.MENU_CONF['uploadImage'] = {
+ // server: '/admin/goods/uploadFileBase64',
+ // fieldName : "file",
+ // customInsert(res, insertFn) {
+ // insertFn(res.data.src, res.data.title, '')
+ // },
+ // }
var category = xmSelect.render({
el: '#goods-category',
@@ -797,6 +815,7 @@
"carriageAmount": goodsInfo.carriageAmount,
"goodsWeight": goodsInfo.goodsWeight,
"orderNumber": goodsInfo.orderNumber,
+ "goodsDetails": goodsInfo.goodsDetails,
"thumbs": thumbs
});
@@ -842,23 +861,25 @@
imgSingleBind();
imgMultiBind();
- window.editor = E.createEditor({
- html: goodsInfo.goodsDetails,
- selector: '#editor-container-good-update',
- config : editorConfig,
- mode: 'default'
- });
-
- window.toolbar = E.createToolbar({
- editor,
- selector: '#toolbar-container-good-update',
- mode: 'default'
- });
+ // window.editor = E.createEditor({
+ // html: goodsInfo.goodsDetails,
+ // selector: '#editor-container-good-update',
+ // config : editorConfig,
+ // mode: 'default'
+ // });
+ //
+ // window.toolbar = E.createToolbar({
+ // editor,
+ // selector: '#toolbar-container-good-update',
+ // mode: 'default'
+ // });
if (skus) {
tableSkuData = skus;
reloadTable(skus);
}
+
+ layedit.setContent(indexUpdate,goodsInfo.goodsDetails, false);
}
form.on('submit(goods-update-form-submit)', function (data) {
@@ -875,7 +896,7 @@
data.field.delSkuId=delSku;
data.field.categoryId = category.getValue('valueStr');
data.field.carriageRuleId = carriageRule.getValue('valueStr');
- data.field.goodsDetails = editor.getHtml();
+ // data.field.goodsDetails = editor.getHtml();
$.ajax({
'url': ctx + 'admin/goods/updateMallGoods',
'type': 'post',
--
Gitblit v1.9.1