From 529ad9dd8d1876b57e852bc45b602ba3ccc8df2a Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 10 Apr 2024 17:19:08 +0800
Subject: [PATCH] 公告-首页公告调整

---
 src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html |  113 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 84 insertions(+), 29 deletions(-)

diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
index 64c7ea5..55605b8 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -103,11 +103,10 @@
                                             </div>
                                         </div>
 
-                                        <div class="layui-form-item febs-hide tc-set">
-                                            <label class="layui-form-label">静态倍数</label>
+                                        <div class="layui-form-item">
+                                            <label class="layui-form-label">推销员返积分比例(%)</label>
                                             <div class="layui-input-block">
-                                                <input type="text" name="staticMulti" placeholder="请输入静态倍数" autocomplete="off" class="layui-input">
-                                                <div class="layui-form-mid layui-word-aux">支付后,赠送(购买金额*静态倍数)的赠送积分</div>
+                                                <input type="text" name="staticMulti" placeholder="请输入推销员返积分比例" autocomplete="off" class="layui-input">
                                             </div>
                                         </div>
 
@@ -170,13 +169,24 @@
                                             </div>
                                         </div>
 
+<!--                                        <div class="layui-form-item">-->
+<!--                                            <label class="layui-form-label febs-form-item-require">商品详情:</label>-->
+<!--                                            <div class="layui-input-block">-->
+<!--                                                <textarea id="goodsDetailEditAdd" lay-verify="content" name = "goodsDetails" class="layui-textarea"></textarea>-->
+<!--&lt;!&ndash;                                                <div style="border: 1px solid #ccc;">&ndash;&gt;-->
+<!--&lt;!&ndash;                                                    <div id="toolbar-container-good-add" style="border-bottom: 1px solid #ccc;"></div>&ndash;&gt;-->
+<!--&lt;!&ndash;                                                    <div id="editor-container-good-add" style="height: 450px;"></div>&ndash;&gt;-->
+<!--&lt;!&ndash;                                                </div>&ndash;&gt;-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+
                                         <div class="layui-form-item">
                                             <label class="layui-form-label febs-form-item-require">商品详情:</label>
                                             <div class="layui-input-block">
-<!--                                                <textarea id="goodsDetailEdit" lay-verify="goodsDetails" name = "goodsDetails" class="layui-textarea"></textarea>-->
+<!--                                                <textarea id="goodsDetailEditAdd" lay-verify="content" name = "goodsDetails" class="layui-textarea"></textarea>-->
                                                 <div style="border: 1px solid #ccc;">
-                                                    <div id="toolbar-container-good-add" style="border-bottom: 1px solid #ccc;"></div>
-                                                    <div id="editor-container-good-add" style="height: 450px;"></div>
+                                                    <div id="toolbar-container" class="toolbar"></div>
+                                                    <div id="text-container" class="text" style="height: 450px;"></div>
                                                 </div>
                                             </div>
                                         </div>
@@ -366,31 +376,73 @@
             element = layui.element;
 
         form.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: {} };
-        editorConfig.MENU_CONF['uploadImage'] = {
-            server: '/admin/goods/uploadFileBase64',
-            fieldName : "file",
-            customInsert(res, insertFn) {
-                insertFn(res.data.src, res.data.title, '')
-            },
-        }
-
-        const editor = E.createEditor({
-            selector: '#editor-container-good-add',
-            config : editorConfig,
-            mode: 'default'
-        });
-
-        const toolbar = E.createToolbar({
-            editor,
-            selector: '#toolbar-container-good-add',
-            mode: 'default'
-        });
+        // 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, '')
+        //     },
+        // }
+        //
+        // const editor = E.createEditor({
+        //     selector: '#editor-container-good-add',
+        //     config : editorConfig,
+        //     mode: 'default'
+        // });
+        //
+        // const toolbar = E.createToolbar({
+        //     editor,
+        //     selector: '#toolbar-container-good-add',
+        //     mode: 'default'
+        // });
 
         laydate.render({
             elem: '#febs-form-group-date'
+        });
+        layedit.set({	//设置图片接口
+            uploadImage: {
+                url: 'admin/goods/uploadFileBase64', //接口url
+                type: 'post',
+            }
+        });
+        //创建一个编辑器
+        var indexAdd = layedit.build('goodsDetailEditAdd',{
+            height: 300
+        });
+        form.verify({
+            //content富文本域中的lay-verify值
+            content: function(value) {
+                return layedit.sync(indexAdd);
+            }
         });
 
         formSelects.render();
@@ -747,7 +799,10 @@
             data.field.addMallGoodsSkuDtos = tableSkuData;
             data.field.categoryId = category.getValue('valueStr');
             data.field.carriageRuleId = carriageRule.getValue('valueStr');
-            data.field.goodsDetails = editor.getHtml();
+            // let content = layedit.getContent();
+            // alert(content);
+            // data.field.goodsDetails = content;
+            data.field.goodsDetails = editor.txt.html();
             $.ajax({
                 'url':ctx + 'admin/goods/addMallGoods',
                 'type':'post',

--
Gitblit v1.9.1