zhuyiyi 3 meses atrás
pai
commit
e9f79ac015

+ 4 - 55
src/main/java/lingtao/net/bean/Information.java

@@ -13,61 +13,6 @@ import lombok.Data;
 @Data
 public class Information {
 
-	public Integer getId() {
-		return id;
-	}
-
-	public void setId(Integer id) {
-		this.id = id;
-	}
-
-	public String getContent() {
-		return content;
-	}
-
-	public void setContent(String content) {
-		this.content = content;
-	}
-
-	public String getType() {
-		return type;
-	}
-
-	public void setType(String type) {
-		this.type = type;
-	}
-
-	public String getCreateBy() {
-		return createBy;
-	}
-
-	public void setCreateBy(String createBy) {
-		this.createBy = createBy;
-	}
-
-	public Date getCreateDate() {
-		return createDate;
-	}
-
-	public void setCreateDate(Date createDate) {
-		this.createDate = createDate;
-	}
-
-	public String getUpdateBy() {
-		return updateBy;
-	}
-
-	public void setUpdateBy(String updateBy) {
-		this.updateBy = updateBy;
-	}
-
-	public Date getUpdateDate() {
-		return updateDate;
-	}
-
-	public void setUpdateDate(Date updateDate) {
-		this.updateDate = updateDate;
-	}
 
 	private Integer id;
 
@@ -82,4 +27,8 @@ public class Information {
 	private String updateBy;
 
 	private Date updateDate;
+	/**
+	 * 附件
+	 */
+	private String attachment;
 }

+ 93 - 76
src/main/java/lingtao/net/service/ProductService.java

@@ -790,77 +790,64 @@ public class ProductService {
                         return priceList;
                     }
                     int min = getNum(length, width);
-                    if ("1".equals(dto.getKind()) && "2".equals(dto.getKindValue())) {
-                        double l1 = Math.ceil(length / 21);
-                        double w1 = Math.ceil(width / 28.5);
-                        double l2 = Math.ceil(width / 21);
-                        double w2 = Math.ceil(length / 28.5);
-                        //min = (int) Math.min(l1 * w1, l2 * w2);
+                    String[] kind_list = {"3", "4", "5", "7"};
+                    priceList = getHekaPrice(min, dto, priceList, count);
 
-                        int[][] prices = {
-                                {245, 580, 798, 1100, 1425},
-                                {420, 965, 1315, 1850, 2400},
-                                {780, 1768, 2390, 3255, 4350},
-                                {1120, 2572, 3450, 4726, 6330},
-                                {1465, 3336, 4480, 6138, 8190},
-                                {1810, 4100, 5510, 7550, 10050},
-                                {2149, 4872, 6538, 8892, 11860},
-                                {2488, 5644, 7566, 10234, 13670},
-                                {2827, 6416, 8594, 11576, 15480},
-                                {3166, 7188, 9622, 12918, 17290},
-                                {3505, 7960, 10650, 14260, 19100}
+                    if (Arrays.asList(kind_list).contains(dto.getKind()) && "2".equals(dto.getKindValue2())) {
+                        if (dto.getCraft() != null && Arrays.asList(dto.getCraft()).contains("模切")) {
+                            priceList = getOtherHekaPrice(dto, width, length);
+                            for (int i = 0; i < dto.getCraft().length; i++) {
+                                if ("模切".equals(dto.getCraft()[i])) {
+                                    dto.getCraft()[i] = "";
+                                }
+                                if ("双面覆哑膜".equals(dto.getCraft()[i])) {
+                                    dto.getCraft()[i] = "";
+                                }
+                            }
+                        }
+                    }
+                    double moqiePrice = 0;
+
+                    //腰封价格加上模板费
+                    if ("1".equals(dto.getKind())) {
+                        double[][] CATEGORIES = {
+                                {105, 140},    // 第一档
+                                {140, 210},    // 第二档
+                                {210, 285},    // 第三档
+                                {285, 420},    // 第四档选项1
+                                {210, 570},    // 第四档选项2
+                                {420, 580},    // 第五档选项1
+                                {285, 840},    // 第五档选项2
+                                {580, 880}     // 第六档
                         };
-                        int[][] other_prices = {
-                                {335, 218, 302, 325, 1425},
-                                {545, 350, 535, 550, 2400},
-                                {988, 622, 865, 1095, 4350},
-                                {1452, 878, 1276, 1604, 6330},
-                                {1871, 1144, 1658, 2052, 8190},
-                                {2290, 1410, 2040, 2500, 10050},
-                                {2723, 1666, 2354, 2968, 11860},
-                                {3156, 1922, 2668, 3436, 13670},
-                                {3589, 2178, 2982, 3904, 15480},
-                                {4022, 2434, 3296, 4372, 17290},
-                                {4455, 2690, 3610, 4840, 19100}
+                        int[] CATEGORY_PRICE = {
+                                80, 90, 100, 130, 130, 170, 170, 330
                         };
-                        int[] count_list = {500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000};
-                        area = width * length;
-                        for (int i = 0; i < count_list.length; i++) {
-                            int item_count = count_list[i];
-                            if (count > item_count) {
-                                continue;
-                            }
-                            if (priceList.size() > 2) {
+                        int mu_price = 330;
+                        double min_width = Math.min(width * 10 + 4, length * 10 + 4);
+                        double max_width = Math.max(width * 10 + 4, length * 10 + 4);
+                        for (int i = 0; i < CATEGORIES.length; i++) {
+                            double categoryMin = CATEGORIES[i][0];
+                            double categoryMax = CATEGORIES[i][1];
+
+                            // 比较尺寸(考虑浮点数精度问题)
+                            if (min_width < categoryMin && max_width <= categoryMax) {
+                                mu_price = CATEGORY_PRICE[i];
                                 break;
                             }
-                            int count_index = Arrays.binarySearch(count_list, item_count);
-                            int[] prices_list = prices[count_index];
-                            int[] other_prices_list = other_prices[count_index];
-
-                            double price = 0;
-                            if (min >= 6) {
-                                price = Math.ceil(prices_list[0] * min + (prices_list[0] * area / (598.5 * min)));
-                            } else {
-                                price = Math.ceil(prices_list[min - 1] + (other_prices_list[min - 1] * area / (598.5 * min)));
-                            }
-                            double carft_price = 0;
-                            if (craft_list.contains("模切")) {
-                                carft_price += Math.max(item_count * 0.06, 100);
-                            }
-                            if (craft_list.contains("糊成品")) {
-                                carft_price += item_count * 0.1;
-                            }
-                            if (craft_list.contains("糊半成品")) {
-                                carft_price += item_count * 0.15;
+                        }
+                        if (dto.getCraft() != null && Arrays.asList(dto.getCraft()).contains("模切")) {
+                            for (int i = 0; i < dto.getCraft().length; i++) {
+                                if ("模切".equals(dto.getCraft()[i])) {
+                                    dto.getCraft()[i] = "";
+                                }
                             }
-                            Product product = new Product();
-                            product.setCount(item_count);
-                            product.setPrice(Math.ceil((price + carft_price) * number));
-//                            priceList.add(product);
+                            moqiePrice = 0.06;
+                        }
+                        for (Product product : priceList) {
+                            product.setPrice(product.getPrice() + mu_price);
                         }
-//                        return priceList;
                     }
-                    priceList = getHekaPrice(min, dto, priceList, count);
                     //四个位拼多多价格调整
                     if (role.indexOf("1045") > -1 && min == 4) {
                         for (Product product : priceList) {
@@ -916,6 +903,9 @@ public class ProductService {
                         if (craft_list.contains("配弹力绳捆")) {
                             carft_price += 10 * Math.ceil(product.getCount() * 20.0 / 5000);
                         }
+                        if (craft_list.contains("配棉绳")) {
+                            carft_price += Math.max(Math.ceil(product.getCount() * 0.015), 15);
+                        }
                         if (craft_list.contains("opp袋")) {
                             double carft_base_price = 0;
                             if ("8*5".equals(dto.getToothpick_size())) {
@@ -938,7 +928,8 @@ public class ProductService {
                             }
                             carft_price += carft_base_price * Math.ceil(product.getCount() / 1000.0);
                         }
-                        product.setPrice(Math.floor((product.getPrice() + carft_price) * number));
+                        //腰封的模切费单独计算
+                        product.setPrice(Math.ceil((product.getPrice() + carft_price) * number + Math.max(Math.ceil(moqiePrice * product.getCount() * number), moqiePrice > 0 ? 55 : 0)));
                         product.setWeight(df.format(number * length / 100 * width / 100 * product.getCount() * 0.3 * 0.86));
                     }
 
@@ -1056,13 +1047,16 @@ public class ProductService {
                         getCraft(product1, priceList, length * 10, width * 10, min);
                         for (Product product : priceList) {
                             if ("击凸".equals(dto.getAotu()) || "压凹".equals(dto.getAotu())) {
-                                product.setPrice(Math.floor(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153)));
+                                product.setPrice(Math.ceil(product.getPrice() + (product.getPrice() * 0.09 > 153 ? product.getPrice() * 0.09 : 153)));
                             }
                             if (craft.contains("弹力绳")) {
-                                product.setPrice(Math.floor(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
+                                product.setPrice(Math.ceil(product.getPrice() + Math.max(10, product.getCount() * 0.1)));
                             }
                             if (craft.contains("弹力绳捆")) {
-                                product.setPrice(Math.floor(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10));
+                                product.setPrice(Math.ceil(product.getPrice() + Math.ceil(product.getCount() * 20.0 / 5000) * 10));
+                            }
+                            if (craft.contains("配棉绳")) {
+                                product.setPrice(Math.ceil(product.getPrice() + Math.max(Math.ceil(product.getCount() * 0.015), 15)));
                             }
                         }
                         // 根据款数重新算价格/计算重量
@@ -3033,10 +3027,13 @@ public class ProductService {
                         }
                     }
                 } else {
-                    if (count <= 10000)
+                    if (count <= 10000) {
                         priceList = productMapper.getThanPrice(dto);
-                    else
+                    } else {
+
                         priceList = productMapper.thanThousandPrice(dto);
+                    }
+
                     // 数据库中是(成本价),需要*利润
                     for (Product product : priceList) {
                         if (product.getCount() <= 1000) {
@@ -3407,10 +3404,11 @@ public class ProductService {
                         dto.setKind1Value("2");
                     }
 
-                    if (count <= 10000)
+                    if (count <= 10000) {
                         priceList = productMapper.getThanPrice(dto);
-                    else
+                    } else {
                         priceList = productMapper.notePaperPrice(dto);
+                    }
                 }
 
                 if (priceList.size() >= 4) {
@@ -3560,10 +3558,11 @@ public class ProductService {
                 return priceList;
             // 透明PVC名片
             case "21":
-                if (count <= 10000)
+                if (count <= 10000) {
                     priceList = productMapper.getThanPrice(dto);
-                else
+                } else {
                     priceList = productMapper.thanThousandPrice(dto);
+                }
 
                 if (priceList.size() >= 4) {
                     priceList = priceList.subList(0, 4);
@@ -3793,10 +3792,11 @@ public class ProductService {
                     int min = getNum(length, width);
                     // 根据位数算价格(最多4个位)
                     dto.setKind2Value(String.valueOf(min));
-                    if (count <= 10000)
+                    if (count <= 10000) {
                         priceList = productMapper.getThanPrice(dto);
-                    else
+                    } else {
                         priceList = productMapper.thanThousandPrice(dto);
+                    }
                     // 产品价格倍数
                     for (Product product : priceList) {
                         product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple()));
@@ -3848,8 +3848,9 @@ public class ProductService {
                 }
 
 
-                if (count <= 10000)
+                if (count <= 10000) {
                     priceList = productMapper.getThanPrice(dto);
+                }
                 // 加工艺的价格 --有覆膜,带尺寸过去(毫米)
                 /*getCraft(dto, priceList, null, null, 0);*/
                 // 根据款数重新算价格
@@ -4683,6 +4684,22 @@ public class ProductService {
         return null;
     }
 
+    private List<Product> getOtherHekaPrice(Product dto, double length, double width) {
+        int[][] prices = {
+                {79, 79, 79, 79, 79, 79, 79, 79, 79, 91, 92, 92, 95, 96, 135, 139, 152, 186, 340, 345, 435, 450},
+                {97, 97, 97, 97, 97, 97, 97, 97, 97, 114, 115, 116, 118, 125, 162, 162, 185, 194, 358, 363, 459, 465},
+                {153, 153, 153, 153, 153, 153, 153, 153, 153, 169, 171, 172, 175, 180, 251, 256, 286, 291, 480, 490, 620, 635},
+                {250, 250, 250, 250, 250, 250, 250, 250, 250, 266, 273, 275, 278, 280, 360, 370, 429, 442, 640, 655, 825, 877},
+                {370, 370, 370, 370, 370, 370, 370, 370, 370, 371, 372, 373, 375, 378, 500, 515, 545, 632, 800, 886, 1030, 1240},
+                {510, 510, 510, 510, 510, 510, 510, 510, 510, 589, 600, 605, 610, 615, 800, 820, 932, 1022, 1160, 1458, 1488, 2000},
+                {945, 945, 945, 945, 945, 945, 945, 945, 945, 1030, 1040, 1045, 1050, 1055, 1440, 1460, 1798, 2202, 2400, 2950, 3012, 4000},
+        };
+        int[] count_list = {200, 500, 1000, 2000, 3000, 5000, 10000};
+        double[] areas = {4, 16, 25, 30, 35, 36, 40, 45, 48.60, 49, 54, 64, 81, 97.20, 100, 145.80, 172.8, 194.4, 224, 288, 294, 400};
+        //款数在外面处理
+        return getAreaCenterPrice(count_list, dto.getCount(), length * width, prices, areas, 1);
+    }
+
     private List<Product> getPETPrice(Product dto, double length, double width) {
         int[][] prices = new int[][]{
                 {136, 163, 177, 190, 197, 227, 257, 303, 333, 407, 430},

+ 5 - 2
src/main/resources/mapper/InformationMapper.xml

@@ -29,9 +29,9 @@
 	<insert id="addInformation" parameterType="Information">
 		insert into
 			tbl_information
-		(content,type,createBy,createDate)
+		(content,type,createBy,createDate,attachment)
 		values
-		(#{content},#{type},#{createBy},now())
+		(#{content},#{type},#{createBy},now(),#{attachment})
 	</insert>
 
 	<update id="updateInformationById" parameterType="Information">
@@ -49,6 +49,9 @@
 			<if test="updateDate != null">
 				updateDate = now(),
 			</if>
+			<if test="attachment != null">
+				attachment = #{attachment,jdbcType=VARCHAR},
+			</if>
 		</set>
 		where id = #{id,jdbcType=INTEGER}
 	</update>

+ 163 - 141
src/main/webapp/js/information.js

@@ -1,145 +1,167 @@
-layui.use([ 'element', 'table', 'laydate', 'form' ], function() {
-	var $ = layui.jquery;
-	var table = layui.table;
-	var laydate = layui.laydate;
-	var element = layui.element;
-	var form = layui.form;
+layui.use(['element', 'table', 'laydate', 'form'], function () {
+    var $ = layui.jquery;
+    var table = layui.table;
+    var laydate = layui.laydate;
+    var element = layui.element;
+    var form = layui.form;
 
-	// 生成表格
-	table.render({
-		elem 	: '#informationTable',
-		url 	: '../../../getInformations', 
-		toolbar : '#toolbarDemo',
-		title 	: '用户表',// 导出文件名
-		id 		: 'informationTableAll',
-		// 开启分页
-		// page	: true,
-		page 	: {
-			layout : [ 'count', 'prev', 'page', 'next', 'skip', 'limit' ]
-		},
-		limits	: [10,30,50,80,100,999],
-		/*request : {
-			'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize
-		},*/
-		where:{
-			content:''
-		},
-		cellMinWidth : 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增
-		cols : [ [ {
-			type : 'numbers',
-			title : '序号',
-			width : 50,
-			fixed : "left"
-		},{
-			field : 'content',
-			title : '内容',
-		},{
-			field : 'type',
-			align : 'center',
-			width : 150,
-			title : '类型'
-		},{
-			field : 'createBy',
-			align : 'center',
-			width : 150,
-			title : '创建人'
-		},{
-			field : 'createDate',
-			title : '创建时间',
-			width : 220,
-			align : 'center',
-			templet : function(d) {
-				return d.createDate != null ?layui.util.toDateString(d.createDate, "yyyy-MM-dd HH:mm:ss") : "";
-			} 
-		},{
-			fixed : 'right',
-			title : '操作',
-			align : 'center',
-			width : 150,
-			toolbar : '#barDemo'
-		} ] ],
-		parseData : function(res) { //将原始数据解析成 table 组件所规定的数据
-			return {
-				"code" 	: 0, //解析接口状态
-				"msg" 	: "", //解析提示文本
-				"count"	: res.data.list.total,//解析数据长度
-				"data" 	: res.data.list.list//解析数据列表
-			};
-		}
-	});
+    // 生成表格
+    table.render({
+        elem: '#informationTable',
+        url: '../../../getInformations',
+        toolbar: '#toolbarDemo',
+        title: '用户表',// 导出文件名
+        id: 'informationTableAll',
+        // 开启分页
+        // page	: true,
+        page: {
+            layout: ['count', 'prev', 'page', 'next', 'skip', 'limit']
+        },
+        limits: [10, 30, 50, 80, 100, 999],
+        /*request : {
+            'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize
+        },*/
+        where: {
+            content: ''
+        },
+        cellMinWidth: 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增
+        cols: [[{
+            type: 'numbers',
+            title: '序号',
+            width: 50,
+            fixed: "left"
+        }, {
+            field: 'content',
+            title: '内容',
+        }, {
+            field: 'type',
+            align: 'center',
+            width: 150,
+            title: '类型'
+        }, {
+            field: 'createBy',
+            align: 'center',
+            width: 150,
+            title: '创建人'
+        }, {
+            field: 'createDate',
+            title: '创建时间',
+            width: 220,
+            align: 'center',
+            templet: function (d) {
+                return d.createDate != null ? layui.util.toDateString(d.createDate, "yyyy-MM-dd HH:mm:ss") : "";
+            }
+        }, {
+            fixed: 'right',
+            title: '操作',
+            align: 'center',
+            width: 150,
+            toolbar: '#barDemo'
+        }]],
+        parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
+            return {
+                "code": 0, //解析接口状态
+                "msg": "", //解析提示文本
+                "count": res.data.list.total,//解析数据长度
+                "data": res.data.list.list//解析数据列表
+            };
+        }
+    });
 
-	//点击查询按钮,重载表格
-	$('#searchBtn').on('click', function() {
-		table.reload('informationTableAll', {
-			method : 'get',
-			where : {
-				content : $("#content").val()
-			},
-			page : {
-				curr : 1
-			}
-		});
-		return false;
-	});
-	
-	// 监听头部工作栏的 新增
-	table.on('toolbar(informationTable)', function(obj) {
-		var checkStatus = table.checkStatus(obj.config.id);
-		switch (obj.event) {
-		case 'add':
-			layer.open({
-				type : 2,
-				title : "添加问题",
-				fix: false, //不固定
-	    		maxmin: true,
-	    		skin:'layui-layer-molv',
-				area : [ '45%', '70%' ],
-				content : './addInformation.jsp',
-			});
-			break;
-		}
-		;
-	});
+    //点击查询按钮,重载表格
+    $('#searchBtn').on('click', function () {
+        table.reload('informationTableAll', {
+            method: 'get',
+            where: {
+                content: $("#content").val()
+            },
+            page: {
+                curr: 1
+            }
+        });
+        return false;
+    });
 
-	// 监听 修改
-	table.on('tool(informationTable)', function(obj) {
-		var data1 = obj.data;
-		if (obj.event === 'edit') {
-			layer.open({
-				type : 2,
-				title : "修改问题",
-				area : [ '45%', '70%' ],
-				skin:'layui-layer-molv',
-				content : './updateInformation.jsp',
-				success : function(layero, index) {
-					var body = layer.getChildFrame('body', index);
-					var iframeWin = window[layero.find('iframe')[0]['name']]; // 得到iframe页的窗口对象
-					body.find('#id').val(data1.id);
-					body.find('#contentUpdate').val(data1.content);
-					body.find('#type').val(data1.type);
-					layui.form.render();
-				}
-			});
-		}else if(obj.event === 'del'){
-	      	layer.confirm('确定要删除该数据么?',{icon:3,title:"提示"}, function(index){
-	    	  	$.ajax({
-	    			url:"../../../deleteInformation",
-	    		  	data:{'id': data1.id},
-	    			type:"post",
-	    			//dataType:"json",
-	    		  	success:function (data) {
-	    			 	if (data.code == 200) {
-	    			 		layer.msg('删除成功!',{icon:6,offset:"auto",time:1000});//提示框
-					  	}else{
-						    layer.msg('删除失败!',{icon:5,offset:"auto",time:1000});//提示框
-					  	}
-	    			 	setTimeout(function(){
-	    			 		location.reload();//重新加载页面
-						}, 1100);
-	    		 	}  
-	    	 	});  
-	            return false; 
-	     	});
-	    }
-	})
+    // 监听头部工作栏的 新增
+    table.on('toolbar(informationTable)', function (obj) {
+        var checkStatus = table.checkStatus(obj.config.id);
+        switch (obj.event) {
+            case 'add':
+                layer.open({
+                    type: 2,
+                    title: "添加问题",
+                    fix: false, //不固定
+                    maxmin: true,
+                    skin: 'layui-layer-molv',
+                    area: ['45%', '70%'],
+                    content: './addInformation.jsp',
+                });
+                break;
+        }
+        ;
+    });
+
+    function previewImage(textImage) {
+
+
+    }
+
+    // 监听 修改
+    table.on('tool(informationTable)', function (obj) {
+        var data1 = obj.data;
+        console.log(data1)
+        if (obj.event === 'edit') {
+            layer.open({
+                type: 2,
+                title: "修改问题",
+                area: ['45%', '70%'],
+                skin: 'layui-layer-molv',
+                content: './updateInformation.jsp',
+                success: function (layero, index) {
+                    var body = layer.getChildFrame('body', index);
+                    var iframeWin = window[layero.find('iframe')[0]['name']]; // 得到iframe页的窗口对象
+                    body.find('#id').val(data1.id);
+                    body.find('#contentUpdate').val(data1.content);
+                    body.find('#type').val(data1.type);
+
+                    body.find('#images').val(data1.attachment);
+                    let textImage = data1.attachment;
+                    if (textImage) {
+
+                        let textImageList = textImage == "" ? [] : textImage.split(",");
+                        let html = "";
+                        textImageList.forEach((item, index) => {
+                            if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
+                                html += "<video src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
+                            } else if (item != "") {
+                                html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
+                            }
+                        })
+                        body.find("#preview").empty().append(html);
+                    }
+                    layui.form.render();
+                }
+            });
+        } else if (obj.event === 'del') {
+            layer.confirm('确定要删除该数据么?', {icon: 3, title: "提示"}, function (index) {
+                $.ajax({
+                    url: "../../../deleteInformation",
+                    data: {'id': data1.id},
+                    type: "post",
+                    //dataType:"json",
+                    success: function (data) {
+                        if (data.code == 200) {
+                            layer.msg('删除成功!', {icon: 6, offset: "auto", time: 1000});//提示框
+                        } else {
+                            layer.msg('删除失败!', {icon: 5, offset: "auto", time: 1000});//提示框
+                        }
+                        setTimeout(function () {
+                            location.reload();//重新加载页面
+                        }, 1100);
+                    }
+                });
+                return false;
+            });
+        }
+    })
 });

+ 16 - 6
src/main/webapp/views/product/coupon.jsp

@@ -767,6 +767,8 @@
                                 <option value="12*6">12*6CM</option>
                             </select>
                         </div>
+                        <input type="checkbox" class="peijian" name="craft" lay-filter="z4PeiJian" value="配棉绳"
+                               title="配棉绳">
                     </div>
                 </form>
             </div>
@@ -948,7 +950,7 @@
 
             }
 
-            function z3Vice(val, type) {
+            function z3Vice(val, type = 0) {
                 $(".z3_vice input").prop("checked", false);
                 $(".z3_vice .z_16").hide();
                 $(".z3_vice .z_19").hide();
@@ -1780,7 +1782,7 @@
 
                 // 5.11:选中少数量的时候隐藏所有的【烫金】工艺
                 // 12.31恢复少数量 【烫金】工艺
-                if (couponKind == '少数量' && (data.value == '积分卡' || data.value == '抽奖卡' || data.value == '刮刮卡')) {
+                if (couponKind == '少数量' && (data.value == '积分卡' || data.value == '抽奖卡' || data.value == '刮刮卡' || data.value == '异形卡片')) {
                     $(".tj").hide();
                     // 禁用没用,下面有放开
                     //$(".tj").find(":input").attr("disabled", true);
@@ -2022,6 +2024,10 @@
                     } else {
 
                     }
+                    $(".guaguaSize").hide();
+                    $(".guaguaSize").find("select").attr("disabled", true);
+                    $(".guaguaSize1").hide();
+                    $(".guaguaSize1").find("select").attr("disabled", true);
                     if (kind == 13 || kind == "刮刮卡") {
                         $(".guaguaSize").show();
                         $(".guaguaSize select[name='size1']").attr("disabled", false);
@@ -2059,12 +2065,16 @@
 
                     $(".lessCountHideCraft").find(".specialCraft").prop('checked', false);
                     $("#size").show();
+                    $(".guaguaSize").hide();
+                    $(".guaguaSize").find("select").attr("disabled", true);
+                    $(".guaguaSize1").hide();
+                    $(".guaguaSize1").find("select").attr("disabled", true);
                     if (kind == 13 || kind == "刮刮卡") {
                         $(".guaguaSize1").show();
-                        $(".guaguaSize1 select[name='size1']").attr("disabled", false);
+                        $(".guaguaSize1 select").attr("disabled", false);
                     } else {
                         $(".guaguaSize1").hide();
-                        $(".guaguaSize1 select[name='size1']").attr("disabled", true);
+                        $(".guaguaSize1 select").attr("disabled", true);
                     }
                 }
                 $(".kindValue2 input[value='10']").prop("disabled", true).prop("checked", false);
@@ -3101,13 +3111,13 @@
                                 return false;
                             }
                         } else if (kind == 3 || kind == 4 || kind == 5 || kind == 7) {
-                            if (min >= 6 && !(kindValue2 == 10 && kind == 3)) {
+                            /*if (min >= 6 && !(kindValue2 == 10 && kind == 3)) {
                                 if ($('input[class = mq]:checked').val() == "模切") {
                                     layer.msg("超过6位异形模切卡片请以[ 腰封 - 异形模切]报价!", {offset: ['300px', '300px']}, function () {
                                     });
                                     return false;
                                 }
-                            }
+                            }*/
                         } else {
                             //吊牌300克
                             if (kindValue3 == 2) {

+ 4 - 1
src/main/webapp/views/product/leiTag.jsp

@@ -73,6 +73,9 @@
                     裁切工艺:
                     <input type="checkbox" name="craft" lay-filter="ui_craft" value="直角裁切" title="直角裁切" checked>
                     <input type="checkbox" name="craft" lay-filter="ui_craft" value="异形模切" title="异形模切">
+                </div>
+                <div class="layui-input-block" style="display:inline-block;">
+                    特殊工艺:
                     <input type="checkbox" name="craft" lay-filter="ui_craft" value="满底烫镭射银" title="满底烫镭射银">
                     <div class="layui-inline shuangmian " style="width: 110px;display: none">
                         <select class="select" name="craftShua">
@@ -143,7 +146,7 @@
         var remark = " ";
         const carft_list1 = ["单面", "双面"];
 
-        const carft_list2 = ["直角裁切", "异形模切", "满底烫镭射银"];
+        const carft_list2 = ["直角裁切", "异形模切"];
 
         // 清空轮播图
         $("#carousel").empty();

+ 2 - 0
src/main/webapp/views/product/tagClothes.jsp

@@ -175,6 +175,8 @@
                                     <option value="红色绳子">红色绳子</option>
                                 </select>
                             </div>
+                            <input type="checkbox" class="miansheng" name="craft" lay-filter="ui_lius" value="配棉绳"
+                                   title="配棉绳">
                             <input type="checkbox" class="tshengz" name="craft" lay-filter="ui_lius" value="弹力绳"
                                    title="弹力绳(15cm)">
                             <input type="checkbox" class="tshengz" name="craft" lay-filter="ui_lius" value="弹力绳捆"

+ 211 - 118
src/main/webapp/views/system/customerTrain/knowledge/showCustomerKnowledgeContent.jsp

@@ -1,129 +1,222 @@
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-	pageEncoding="UTF-8"%>
+         pageEncoding="UTF-8" %>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <!DOCTYPE html>
 <html>
 <head>
-<meta charset="UTF-8">
- <%@include file="/views/common.jsp"%>
+    <meta charset="UTF-8">
+    <title>产品知识列表</title>
+    <%@include file="/views/common.jsp" %>
+    <style type="text/css">
+        .layui-table-cell {
+            height: 32px;
+            line-height: 32px;
+        }
+
+        .layui-table td, .layui-table th, .layui-table-header, .layui-table-page, .layui-table-tool, .layui-table-total, .layui-table-view {
+            border-color: #6666;
+            font-size: 16px;
+        }
+
+        .ztree * {
+            font-size: 20px;
+        }
+
+        .edge .layui-edge {
+            right: 35px;
+        }
+    </style>
 </head>
-<style>
-	.price-layout-page{
-		background:#eeeeee;
-		padding:18px;
-	}
-	.edge .layui-edge{
-		right:30px;
-	}
-	.layui-form-radio, .layui-form-radio *{
-		vertical-align:baseline;
-	}
-</style>
-<script id="trainContent" type="text/html">
-	{{# layui.each(d.list, function(index, item){  }}
-		<ul class="layui-timeline">
-			<li class="layui-timeline-item">
-				<i class="layui-icon layui-timeline-axis"></i>
-				<div class="layui-timeline-content layui-text">
-					<p>
-						{{item.content}}
-					</p>
-				</div>
-			</li>
-		</ul>
-	{{# });  }}
+
+<script type="text/html" id="toolbarDemo">
+    <div class="layui-btn-container demoTable">
+        <button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon layui-icon-add-circle-fine"
+                                                                  style="font-size:20px;font-weight:bold"></i> 新增内容
+        </button>
+    </div>
 </script>
-<body class="price-layout-page">
-	<form class="layui-form" action="" id="form">
-		<input type="hidden" id="type" name="type" value="产品知识">
-		<label class="layui-form-label"></label>
-		<div class="layui-form-item" id="myRadio"></div>
-	</form>
-	<div class="layui-col-md12" style="padding: 7px;">
-		<div style="background: white; padding: 7px;">
-			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
-			  	<legend style="color:red;"><h1>产品知识:</h1></legend>
-			</fieldset>
-			<!-- 渲染到这 -->
-			<div id="view"></div>
-		</div>
-	</div>
-</body>
-<script>
-	layui.use(['form', 'laytpl', 'layer'], function(){ //独立版的layer无需执行这一句
-		var  $ = layui.jquery, 
-        form = layui.form, 
-        layer = layui.layer, 
-        laytpl = layui.laytpl;
-		form.render();
-		
-		//一访问页面就调用
-		$.ajax({
-			url:"/quote_price/getCustomerTrainProTypes",
-			type : "GET",
-			async: false, // 同步
-			data:{
-				type:$("#type").val()
-			},
-			dataType : "json",
-			success : function(proTypeResult) {
-				var proTypeData = proTypeResult.list
+<script type="text/html" id="barDemo">
+    <a class="layui-btn layui-btn-xs" lay-event="view">
+        <i class="layui-icon layui-icon-view" style="color:white;font-size:20px"></i>查看
+    </a>
+
+</script>
+<body>
+<br>
+<form class="layui-form" action="">
+    <div class="layui-inline">
+        <label class="layui-form-label">内容</label>
+        <div class="layui-input-inline">
+            <input type="text" id="content" name="content" placeholder="请输入内容" autocomplete="off" class="layui-input">
+        </div>
+    </div>
+    <div class="layui-inline">
+        <div class="layui-input-inline">
+            <button class="layui-btn" id="searchBtn" lay-submit lay-filter="formDemo" style="margin-left: 15px">
+                <i class="layui-icon layui-icon-search"></i> 查询
+            </button>
+            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
+        </div>
+    </div>
+</form>
+<table class="layui-hide" id="informationTable" lay-filter="informationTable"></table>
+<script type="text/javascript">
+    function viewImage(item) {
+        let html = "<div style='width: 100%;height: 100%;display: flex;align-items: center;justify-content: center'>";
+        if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
+            html += "<video src='" + item + "' class='layui-upload-img' controls style='width: 400px;height: 400px;margin-right: 5px;'/>";
+        } else if (item != "") {
+            html += "<img src='" + item + "' class='layui-upload-img' style='width: 400px;height: 400px;margin-right: 5px;'/>";
+        }
+        html += "</div>";
+        layer.open({
+            type: 1,
+            title: false,
+            closeBtn: 0,
+            offset: 'auto',
+            area: ['400px', '400px'],
+            skin: 'layui-layer-nobg', //没有背景色
+            shadeClose: true,
+            content: html
+        });
+    }
+
+    layui.use(['element', 'table', 'laydate', 'form'], function () {
+        var $ = layui.jquery;
+        var table = layui.table;
+        var laydate = layui.laydate;
+        var element = layui.element;
+        var form = layui.form;
+
+        // 生成表格
+        table.render({
+            elem: '#informationTable',
+            url: '../../../../getInformations',
+            toolbar: '#toolbarDemo',
+            title: '用户表',// 导出文件名
+            id: 'informationTableAll',
+            // 开启分页
+            // page	: true,
+            page: {
+                layout: ['count', 'prev', 'page', 'next', 'skip', 'limit']
+            },
+            limits: [10, 30, 50, 80, 100, 999],
+            /*request : {
+                'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize
+            },*/
+            where: {
+                content: ''
+            },
+            cellMinWidth: 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增
+            cols: [[{
+                type: 'numbers',
+                title: '序号',
+                width: 50,
+                fixed: "left"
+            }, {
+                field: 'content',
+                title: '内容',
+            }, {
+                field: 'content',
+                title: '图片视频',
+                templet: function (d) {
+                    let html = "<div style='width: 100%;height: 100%;display: flex;align-items: center;justify-content: center'>";
+                    if (d.attachment) {
+                        let list = d.attachment.split(",");
+                        for (let i = 0; i < list.length; i++) {
+                            let item = list[i];
+                            if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
+                                html += "<video src='" + item + "' class='layui-upload-img'  style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
+                            } else if (item != "") {
+                                html += "<img src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
+                            }
+                        }
+                    }
+                    html += "</div>";
+                    return html;
+                }
+            }, {
+                field: 'createBy',
+                align: 'center',
+                width: 150,
+                title: '创建人'
+            }, {
+                field: 'createDate',
+                title: '创建时间',
+                width: 220,
+                align: 'center',
+                templet: function (d) {
+                    return d.createDate != null ? layui.util.toDateString(d.createDate, "yyyy-MM-dd HH:mm:ss") : "";
+                }
+            }, {
+                fixed: 'right',
+                title: '操作',
+                align: 'center',
+                width: 150,
+                toolbar: '#barDemo'
+            }]],
+            parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
+                return {
+                    "code": 0, //解析接口状态
+                    "msg": "", //解析提示文本
+                    "count": res.data.list.total,//解析数据长度
+                    "data": res.data.list.list//解析数据列表
+                };
+            }
+        });
+
+        //点击查询按钮,重载表格
+        $('#searchBtn').on('click', function () {
+            table.reload('informationTableAll', {
+                method: 'get',
+                where: {
+                    content: $("#content").val()
+                },
+                page: {
+                    curr: 1
+                }
+            });
+            return false;
+        });
+
+
+        table.on('tool(informationTable)', function (obj) {
+            console.log(obj)
+            let data = obj.data;
+            if (obj.event === 'view') {
+                // 在此处输入 layer 的任意代码
+                let html = '<div style="display: flex;flex-direction: column;justify-content: center;align-items: center;gap: 10px"><div>' + data.content + '</div>';
+                if (data.attachment) {
+                    html += '<div style="display: flex;justify-content: center;align-items: center;gap: 10px">';
+                    let list = data.attachment.split(",");
+                    for (let i = 0; i < list.length; i++) {
+                        let item = list[i];
+                        if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
+                            html += "<video src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
+                        } else if (item != "") {
+                            html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
+                        }
+                    }
+                    html += '</div>';
+                }
+                html += '</div>';
+                console.log(html)
+                layer.open({
+                    type: 1, // page 层类型
+                    area: ['500px', '300px'],
+                    title: '查看',
+                    shade: 0.6, // 遮罩透明度
+                    shadeClose: true, // 点击遮罩区域,关闭弹层
+                    maxmin: true, // 允许全屏最小化
+                    anim: 0, // 0-6 的动画形式,-1 不开启
+                    content: html
+                });
+            }
+        })
+
+    });
 
-				for(var proTypeItem in proTypeData){
-				    var str="<label class='layui-form-label'>"+ proTypeData[proTypeItem].proType +":</label>"
-					$("#myRadio").append(str);
-					$.ajax({
-						url:"/quote_price/getCustomerTrainKindLabelsByProType",
-						type : "GET",
-						dataType : "json",
-						async: false, // 同步
-						data:{
-							proType	:proTypeData[proTypeItem].proType,
-							type	:$("#type").val(),
-							needPage:"0"
-						},
-						success : function(kindResult) {
-							var kindData = kindResult.list
-							for(var kindItem in kindData){
-							    var kindStr="<input type='radio' name='kind' lay-filter='kind' value="+ JSON.stringify(proTypeData[proTypeItem].proType+ '+' +kindData[kindItem].kindLabel)+ " title="+ JSON.stringify(kindData[kindItem].kindLabel)+">"
-								$("#myRadio").append(kindStr)
-							}
-							$("#myRadio").append("</br>")
-						}
-					});
-				}
-				$("#form")[0].reset();
-			}
-		});
-		
-		form.on('radio(kind)', function(kindData) {
-			// 传过来的数据是proType+kind拼接的
-			var data = kindData.value.split("+");
-			//获取后台数据后渲染
-	        $.ajax({
-	        	url: "/quote_price/getCustomerTrainContents",
-	            datatype: "json",
-	          	// data:$("form").serialize(),
-	            data:{
-	            	proType	:data[0],
-	            	kind	:data[1],
-	            	type	:$("#type").val()
-	            },
-	            type: "GET",
-	            async: false,//关闭异步,否则popover组件无法渲染出值
-	            context: document.body,
-	            success: function (data) {
-	                var getTpl = document.getElementById('trainContent').innerHTML,
-	                    view = document.getElementById('view');
-	                laytpl(getTpl).render(data, function (html) {
-	                    view.innerHTML = html;
-	                });
-	                form.render();
-	            }
-	        })
-			return false;
-		})
-	});
 </script>
 
+</body>
 </html>

+ 185 - 68
src/main/webapp/views/system/information/addInformation.jsp

@@ -1,81 +1,198 @@
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
+         pageEncoding="UTF-8" %>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <!DOCTYPE html>
 <html>
 <head>
-<meta charset="UTF-8">
-<title>添加产品须知</title>
-<%@include file="/views/common.jsp"%>
-<style>
-.layui-input,.layui-input-inline{
-	width:350px
-}
-</style>
+    <meta charset="UTF-8">
+    <title>添加产品须知</title>
+    <%@include file="/views/common.jsp" %>
+    <style>
+        .layui-input, .layui-input-inline {
+            width: 350px
+        }
+    </style>
 </head>
 <body>
-	<div class="layui-input-block layui-form" lay-filter="addUser"
-		style="margin-top: 30px">
-		<form class="layui-form " action="">
-			<div class="layui-form-item">
-				<label class="layui-form-label">内容</label>
-				<div class="layui-input-inline">
-					<input type="text" name="content" placeholder="请输入内容" class="layui-input" lay-verify="required">
-				</div>
-			</div>
-			<div class="layui-form-item">
-				<label class="layui-form-label">类型</label>
-				<div class="layui-input-inline">
-					<input type="text" name="type" placeholder="请输入类型" class="layui-input" lay-verify="required">
-				</div>
-			</div>
+<div class="layui-input-block layui-form" lay-filter="addUser"
+     style="margin-top: 30px">
+    <form class="layui-form " action="">
+        <div class="layui-form-item">
+            <label class="layui-form-label">内容</label>
+            <div class="layui-input-inline">
+                <textarea type="text" name="content" placeholder="请输入内容" class="layui-textarea"
+                          lay-verify="required"></textarea>
+            </div>
+        </div>
 
-			<div class="layui-form-item">
-				<div class="layui-input-block">
-					<button class="layui-btn" lay-submit="" lay-filter="enadd">确认添加</button>
-					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
-				</div>
-			</div>
-		</form>
-	</div>
+        <input type="hidden" name="type" placeholder="请输入类型" class="layui-input" value="1">
+        <div class="layui-form-item">
+            <label class="layui-form-label">图片或视频</label>
+            <div class="layui-input-inline">
+                <button type="button" class="layui-btn" id="uploaderImage">上传</button>
+                <input type="file" id="upload" style="display: none"/>
+                <input name="attachment" type="hidden" id="images"/>
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label" style="color: #FF5722">点击图片可以删除</label>
+            <div class="layui-input-inline" id="preview" style="display: flex;"></div>
+        </div>
+        <div class="layui-form-item">
+            <div class="layui-input-block">
+                <button class="layui-btn" lay-submit="" lay-filter="enadd">确认添加</button>
+                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
+            </div>
+        </div>
+    </form>
+</div>
+<script src="${path}/js/alioss.js"></script>
 <script>
-		
-		layui.use([ 'form', 'layer'],function() {
-			var $ = layui.$,
-			 form = layui.form, 
-			layer = layui.layer;
+    function delImage(index) {
+        layer.confirm('是否确认删除该图片', {
+            btn: ['确定', '关闭'] //按钮
+        }, function (layIndex) {
+            let textImage = $("#images").val();
+            let list = textImage == "" ? [] : textImage.split(",");
+            list.splice(index, 1);
+            $("#images").val(list.join(","));
+            previewImage($("#images").val());
+            layer.close(layIndex);
+        }, function () {
+        });
 
-			//监听提交
-			form.on('submit(enadd)', function(data) {
-				$.ajax({
-					url : '${path}/addInformation',
-					dataType : 'json',
-					data : $(data.form).serialize(),
-					type : 'post',
-					success : function(data) {
-						if (data.code == 200) {
-							layer.msg('录入成功!', {
-								icon : 6,
-								offset : "auto",
-								time : 2000
-							});//提示框
-						} else {
-							layer.msg('录入失败!', {
-								icon : 5,
-								offset : "auto",
-								time : 2000
-							});//提示框
-						}
-						setTimeout(function(){
-							var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
-							parent.layer.close(index);//关闭弹出层
-							parent.layui.table.reload("informationTableAll"); //重新加载页面表格
-						}, 2100);
-					}
-				})
-				return false;
-			});
-		})
+    }
+
+    $("#images").val("");
+    $("#preview").empty();
+    const client = new OSS({
+        // yourregion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
+        region: "oss-cn-fuzhou",
+        // 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
+        accessKeyId: "LTAI5tE7wuNkeT9jZ42bQnyr",
+        accessKeySecret: "NnutvWhKl4HbQFSad3HosYbCkEkbjN",
+        // 填写存储空间名称。
+        bucket: "dfdiyfile",
+        endpoint: "https://oss-cn-fuzhou.aliyuncs.com",
+    });
+
+    function previewImage(textImage) {
+        let textImageList = textImage == "" ? [] : textImage.split(",");
+        let html = "";
+        textImageList.forEach((item, index) => {
+            if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
+                html += "<video src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
+            } else if (item != "") {
+                html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
+            }
+        })
+        $("#preview").empty().append(html);
+
+    }
+
+
+    async function putObject(file) {
+        try {
+            let fileDir = dateFtt("yyyyMMdd", new Date())
+            let name = "priceImages/" + fileDir + "/" + guid() + getSuff(file.name);
+            // 填写Object完整路径。Object完整路径中不能包含Bucket名称。
+            // 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。
+            // data对象可以自定义为file对象、Blob数据或者OSS Buffer。
+            const options = {
+                headers: {"Content-Type": "text/plain"},
+            };
+            let index = layer.load();
+            const result = await client.put(name, file, options);
+            layer.close(index);
+            let textImage = $("#images").val();
+            let list = textImage == "" ? [] : textImage.split(",");
+            list.push(result.url);
+            $("#images").val(list.join(","));
+            previewImage($("#images").val());
+        } catch (e) {
+            console.log(e);
+        }
+    }
+
+    document.getElementById('uploaderImage').addEventListener('click', function (e) {
+        document.getElementById('upload').click();
+    });
+    document.getElementById('upload').addEventListener('change', function (e) {
+        const file = e.target?.files[0];
+        putObject(file);
+        document.getElementById('upload').value = "";
+    });
+
+    function dateFtt(fmt, date) {
+        var o = {
+            "M+": date.getMonth() + 1,                 //月份
+            "d+": date.getDate(),                    //日
+            "h+": date.getHours(),                   //小时
+            "m+": date.getMinutes(),                 //分
+            "s+": date.getSeconds(),                 //秒
+            "q+": Math.floor((date.getMonth() + 3) / 3), //季度
+            "S": date.getMilliseconds()             //毫秒
+        };
+        if (/(y+)/.test(fmt)) {
+            fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
+        }
+        for (var k in o) {
+            if (new RegExp("(" + k + ")").test(fmt))
+                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+
+        }
+        return fmt;
+
+    }
+
+    function getSuff(name) {
+        return name.substring(name.lastIndexOf("."));
+    }
+
+    function guid() {
+        return "xxxxxxxx-xxxx-4xxx-yxxx".replace(/[xy]/g, function (c) {
+            var r = (Math.random() * 16) | 0,
+                v = c == "x" ? r : (r & 0x3) | 0x8;
+            return v.toString(16);
+        });
+    }
+
+    layui.use(['form', 'layer'], function () {
+        var $ = layui.$,
+            form = layui.form,
+            layer = layui.layer;
+
+        //监听提交
+        form.on('submit(enadd)', function (data) {
+            $.ajax({
+                url: '${path}/addInformation',
+                dataType: 'json',
+                data: $(data.form).serialize(),
+                type: 'post',
+                success: function (data) {
+                    if (data.code == 200) {
+                        layer.msg('录入成功!', {
+                            icon: 6,
+                            offset: "auto",
+                            time: 2000
+                        });//提示框
+                    } else {
+                        layer.msg('录入失败!', {
+                            icon: 5,
+                            offset: "auto",
+                            time: 2000
+                        });//提示框
+                    }
+                    setTimeout(function () {
+                        var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
+                        parent.layer.close(index);//关闭弹出层
+                        parent.layui.table.reload("informationTableAll"); //重新加载页面表格
+                    }, 2100);
+                }
+            })
+            return false;
+        });
+    })
 </script>
 </body>
 </html>

+ 2 - 3
src/main/webapp/views/system/information/information.jsp

@@ -32,7 +32,7 @@
 </script>
 <script type="text/html" id="barDemo">
   	<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"style="color:white;font-size:20px"></i>编辑</a>
-	<a class="layui-btn layui-btn-xs layui-btn-danger"" lay-event="del"><i class="layui-icon layui-icon-delete" ></i>删除</a>
+	<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del"><i class="layui-icon layui-icon-delete" ></i>删除</a>
 </script>
 <body>
 	<br>
@@ -46,8 +46,7 @@
 		</div>
 		<div class="layui-inline">
 			<div class="layui-input-inline">
-				<button class="layui-btn" id="searchBtn" lay-submit
-					lay-filter="formDemo" style="margin-left: 15px">
+				<button class="layui-btn" id="searchBtn" lay-submit lay-filter="formDemo" style="margin-left: 15px">
 					<i class="layui-icon layui-icon-search"></i> 查询
 				</button>
 				<button type="reset" class="layui-btn layui-btn-primary">重置</button>

+ 184 - 67
src/main/webapp/views/system/information/updateInformation.jsp

@@ -1,75 +1,192 @@
 <%@ page language="java" contentType="text/html; charset=UTF-8"
-    pageEncoding="UTF-8"%>
-    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+         pageEncoding="UTF-8" %>
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <!DOCTYPE html>
 <html>
 <head>
-<meta charset="UTF-8">
-<title>修改产品须知</title>
-<%@include file="/views/common.jsp"%>
-<style>
-.layui-input,.layui-input-inline{
-	width:350px
-}
-</style>
+    <meta charset="UTF-8">
+    <title>修改产品须知</title>
+    <%@include file="/views/common.jsp" %>
+    <style>
+        .layui-input, .layui-input-inline {
+            width: 350px
+        }
+    </style>
 </head>
 <body>
-	<div class="layui-input-block layui-form" lay-filter="addUser"
-		style="margin-top: 30px">
-		<form class="layui-form " action="">
-			<input type="hidden" name="id" id="id">
-			<div class="layui-form-item">
-				<label class="layui-form-label">内容</label>
-				<div class="layui-input-inline">
-					<input type="text" name="content" placeholder="请输入内容" class="layui-input" id="contentUpdate">
-				</div>
-			</div>
-			<div class="layui-form-item">
-				<label class="layui-form-label">类型</label>
-				<div class="layui-input-inline">
-					<input type="text" name="type" placeholder="请输入类型" class="layui-input" id="type">
-				</div>
-			</div>
-
-
-			<div class="layui-form-item">
-				<div class="layui-input-block">
-					<button class="layui-btn" lay-submit="" lay-filter="enadd">确认修改</button>
-				</div>
-			</div>
-		</form>
-	</div>
-	<script type="text/javascript">
-		layui.use([ 'table', 'laydate', 'form','layer' ], function() {
-			var $ = layui.jquery;
-			var table = layui.table;
-			var laydate = layui.laydate;
-			var form = layui.form;
-			var layer = layui.layer;
-			
-			form.on('submit(enadd)',function(data){
-				$.ajax({
-					url:'${path}/updateInformation',
-					dataType : 'json',
-					data:$(data.form).serialize(),
-					type : 'post',
-					success:function(data){
-						if (data.code == 200) {
-							layer.msg('修改成功!',{icon:6,offset:"auto",time:2000});//提示框
-						}else  {
-							layer.msg('修改失败!',{icon:5,offset:"auto",time:2000});//提示框
-						}
-						setTimeout(function(){
-							var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
-							parent.layer.close(index);//关闭弹出层
-							parent.layui.table.reload("informationTableAll"); //重新加载页面表格
-						}, 2100);
-					}
-				})
-				return false;
-			});
-			
-		})
-	</script>
+<div class="layui-input-block layui-form" lay-filter="addUser"
+     style="margin-top: 30px">
+    <form class="layui-form " action="">
+        <input type="hidden" name="id" id="id">
+        <div class="layui-form-item">
+            <label class="layui-form-label">内容</label>
+            <div class="layui-input-inline">
+                <textarea type="text" name="content" placeholder="请输入内容" class="layui-textarea"
+                          id="contentUpdate"></textarea>
+            </div>
+        </div>
+        <input type="hidden" name="type" placeholder="请输入类型" class="layui-input" id="type" value="=1">
+        <div class="layui-form-item">
+            <label class="layui-form-label">图片或视频</label>
+            <div class="layui-input-inline">
+                <button type="button" class="layui-btn" id="uploaderImage">上传</button>
+                <input type="file" id="upload" style="display: none"/>
+                <input name="attachment" type="hidden" id="images"/>
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label" style="color: #FF5722">点击图片可以删除</label>
+            <div class="layui-input-inline" id="preview" style="display: flex;"></div>
+        </div>
+
+        <div class="layui-form-item">
+            <div class="layui-input-block">
+                <button class="layui-btn" lay-submit="" lay-filter="enadd">确认修改</button>
+            </div>
+        </div>
+    </form>
+</div>
+<script src="${path}/js/alioss.js"></script>
+<script type="text/javascript">
+    function delImage(index) {
+        layer.confirm('是否确认删除该图片', {
+            btn: ['确定', '关闭'] //按钮
+        }, function (layIndex) {
+            let textImage = $("#images").val();
+            let list = textImage == "" ? [] : textImage.split(",");
+            list.splice(index, 1);
+            $("#images").val(list.join(","));
+            previewImage($("#images").val());
+            layer.close(layIndex);
+        }, function () {
+        });
+
+    }
+
+    $("#images").val("");
+    $("#preview").empty();
+    const client = new OSS({
+        // yourregion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
+        region: "oss-cn-fuzhou",
+        // 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
+        accessKeyId: "LTAI5tE7wuNkeT9jZ42bQnyr",
+        accessKeySecret: "NnutvWhKl4HbQFSad3HosYbCkEkbjN",
+        // 填写存储空间名称。
+        bucket: "dfdiyfile",
+        endpoint: "https://oss-cn-fuzhou.aliyuncs.com",
+    });
+
+    function previewImage(textImage) {
+        let textImageList = textImage == "" ? [] : textImage.split(",");
+        let html = "";
+        textImageList.forEach((item, index) => {
+            if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
+                html += "<video src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
+            } else if (item != "") {
+                html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
+            }
+        })
+        $("#preview").empty().append(html);
+
+    }
+
+
+    async function putObject(file) {
+        try {
+            let fileDir = dateFtt("yyyyMMdd", new Date())
+            let name = "priceImages/" + fileDir + "/" + guid() + getSuff(file.name);
+            // 填写Object完整路径。Object完整路径中不能包含Bucket名称。
+            // 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。
+            // data对象可以自定义为file对象、Blob数据或者OSS Buffer。
+            const options = {
+                headers: {"Content-Type": "text/plain"},
+            };
+            let index = layer.load();
+            const result = await client.put(name, file, options);
+            layer.close(index);
+            let textImage = $("#images").val();
+            let list = textImage == "" ? [] : textImage.split(",");
+            list.push(result.url);
+            $("#images").val(list.join(","));
+            previewImage($("#images").val());
+        } catch (e) {
+            console.log(e);
+        }
+    }
+
+    document.getElementById('uploaderImage').addEventListener('click', function (e) {
+        document.getElementById('upload').click();
+    });
+    document.getElementById('upload').addEventListener('change', function (e) {
+        const file = e.target?.files[0];
+        putObject(file);
+        document.getElementById('upload').value = "";
+    });
+
+    function dateFtt(fmt, date) {
+        var o = {
+            "M+": date.getMonth() + 1,                 //月份
+            "d+": date.getDate(),                    //日
+            "h+": date.getHours(),                   //小时
+            "m+": date.getMinutes(),                 //分
+            "s+": date.getSeconds(),                 //秒
+            "q+": Math.floor((date.getMonth() + 3) / 3), //季度
+            "S": date.getMilliseconds()             //毫秒
+        };
+        if (/(y+)/.test(fmt)) {
+            fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
+        }
+        for (var k in o) {
+            if (new RegExp("(" + k + ")").test(fmt))
+                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+
+        }
+        return fmt;
+
+    }
+
+    function getSuff(name) {
+        return name.substring(name.lastIndexOf("."));
+    }
+
+    function guid() {
+        return "xxxxxxxx-xxxx-4xxx-yxxx".replace(/[xy]/g, function (c) {
+            var r = (Math.random() * 16) | 0,
+                v = c == "x" ? r : (r & 0x3) | 0x8;
+            return v.toString(16);
+        });
+    }
+
+    layui.use(['table', 'laydate', 'form', 'layer'], function () {
+        var $ = layui.jquery;
+        var table = layui.table;
+        var laydate = layui.laydate;
+        var form = layui.form;
+        var layer = layui.layer;
+
+        form.on('submit(enadd)', function (data) {
+            $.ajax({
+                url: '${path}/updateInformation',
+                dataType: 'json',
+                data: $(data.form).serialize(),
+                type: 'post',
+                success: function (data) {
+                    if (data.code == 200) {
+                        layer.msg('修改成功!', {icon: 6, offset: "auto", time: 2000});//提示框
+                    } else {
+                        layer.msg('修改失败!', {icon: 5, offset: "auto", time: 2000});//提示框
+                    }
+                    setTimeout(function () {
+                        var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
+                        parent.layer.close(index);//关闭弹出层
+                        parent.layui.table.reload("informationTableAll"); //重新加载页面表格
+                    }, 2100);
+                }
+            })
+            return false;
+        });
+
+    })
+</script>
 </body>
 </html>