7 miesięcy temu
rodzic
commit
49044af181

+ 6 - 1
08.src/Xingxi/xingxi-admin/src/main/java/com/xingxi/web/controller/master/product/controller/ProdController.java

@@ -21,6 +21,7 @@ import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -167,7 +168,11 @@ public class ProdController extends BaseController {
     public String editTag(@PathVariable("id") Long id, ModelMap mMap) {
         ProdTagVo cond = new ProdTagVo();
         cond.setProdId(id);
-        List<ProdTagVo> prodTagVoList = prodTagVoService.selectProdTagVoList(cond);
+        List<ProdTagVo> prodTagVoList = new ArrayList<>();
+        List<ProdTagVo> resultList = prodTagVoService.selectProdTagVoList(cond);
+        if (resultList != null && resultList.size() > 0) {
+            prodTagVoList = resultList;
+        }
         mMap.put("prodTagVoList", prodTagVoList);
         return prefix + "/editTag";
     }

+ 1 - 0
08.src/Xingxi/xingxi-admin/src/main/java/com/xingxi/web/controller/master/product/domain/ProdTagVo.java

@@ -16,4 +16,5 @@ import lombok.ToString;
 @ToString
 public class ProdTagVo extends ProdTag {
     private static final long serialVersionUID = 1L;
+    private String tagName;
 }

+ 12 - 69
08.src/Xingxi/xingxi-admin/src/main/resources/templates/master/product/prod/editTag.html

@@ -1,80 +1,23 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
 <head>
-    <th:block th:include="include :: header('修改推荐商品')" />
-    <th:block th:include="include :: select2-css" />
-    <th:block th:include="include :: bootstrap-select-css" />
-    <th:block th:include="include :: summernote-css" />
+    <th:block th:include="include :: header('编辑商品标签')" />
 </head>
 <body class="white-bg">
-    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
-        <form class="form-horizontal m" id="form-prod-edit" th:object="${prodVo}">
-            <input name="id" th:field="*{id}" type="hidden">
-            <ul>
-                <li>
-                    <label>品牌名:</label>
-                    <input type="text" name="ipName"/>
-                </li>
-                <li>
-                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
-                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
-                </li>
-            </ul>
-        </form>
-    </div>
+    <form class="form-horizontal m" id="form-prodTag-edit">
+        <div class="wrapper wrapper-content animated fadeInRight">
+            <div class="row" id="ibox-container">
+            </div>
+        </div>
+    </form>
     <th:block th:include="include :: footer" />
-    <th:block th:include="include :: select2-js" />
-    <th:block th:include="include :: bootstrap-select-js" />
-    <th:block th:include="include :: summernote-js" />
     <script th:inline="javascript">
-        var prefix = ctx + "master/product/prod"
-        $(".summernote").summernote({
-            lang: 'zh-CN',
-            callbacks:{
-                onImageUpload: function (files) {
-                    var fileSize = 0;
-                    fileSize = files[0].size;
-                    fileSize=Math. round( fileSize/1024*100)/100;
-
-                    if(fileSize>2048){
-                        layer.msg('上传文件不得大于2M,请重新上传。', {time: 3000, icon:6});
-                        return false;
-                    }
-
-                    if (!/image\/\w+/.test(files[0].type)) {
-                        layer.msg('上传的不是图片文件,请重新上传。', {time: 3000, icon:6});
-                        return false;
-                    }
-
-                    var formData = new FormData();
-                    formData.append('imageFile', files[0]);
-                    $.ajax({
-                        url : ctx + "common/upload/file/image",
-                        type : 'POST',
-                        data : formData,
-                        processData : false,
-                        contentType : false,
-                        success : function(result) {
-                            $('.summernote').summernote('insertImage', result.imageUrl);
-                        },error:function(){
-                            $.modal.alertError("上传失败");
-                        }
-                    });
-                }
-            },
-            height: 600,
-            toolbar: [
-                ['style', ['fontname', 'bold', 'italic', 'underline', 'clear']],
-                ['font', ['strikethrough', 'superscript', 'subscript']],
-                ['fontsize', ['fontsize', 'undo', 'redo']],
-                ['color', ['color']],
-                ['para', ['ul', 'ol', 'paragraph']],
-                ['height', ['height']],
-                ['insert', ['picture', 'table']],
-                ['search', ['findnreplace', 'changecolor']]
-            ],
+        var prefix = ctx + "master/product/prod";
+        var prodTagVoList = [[${prodTagVoList}]];
+        prodTagVoList.forEach(item => {
+            var card = "<div class='col-sm-1'><div class='ibox'><div class='ibox-title'><i class='fa fa-remove pull-right'></i><h5>"+item.tagName+"</h5></div></div></div>";
+            $("#ibox-container").append(card);
         });
-        $('.summernote').summernote('code', [[${prodVo.description}]]);
 
         $("#form-prod-edit").validate({
             focusCleanup: true