이 커밋은 다음에 포함됨:
2025-08-23 09:40:45 +08:00
부모 f5c2d30424
커밋 e9f79ac015
11개의 변경된 파일871개의 추가작업 그리고 539개의 파일을 삭제
+4 -55
파일 보기
@@ -13,61 +13,6 @@ import lombok.Data;
@Data @Data
public class Information { 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; private Integer id;
@@ -82,4 +27,8 @@ public class Information {
private String updateBy; private String updateBy;
private Date updateDate; private Date updateDate;
/**
* 附件
*/
private String attachment;
} }
+95 -78
파일 보기
@@ -790,77 +790,64 @@ public class ProductService {
return priceList; return priceList;
} }
int min = getNum(length, width); int min = getNum(length, width);
if ("1".equals(dto.getKind()) && "2".equals(dto.getKindValue())) { String[] kind_list = {"3", "4", "5", "7"};
double l1 = Math.ceil(length / 21); priceList = getHekaPrice(min, dto, priceList, count);
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);
int[][] prices = { if (Arrays.asList(kind_list).contains(dto.getKind()) && "2".equals(dto.getKindValue2())) {
{245, 580, 798, 1100, 1425}, if (dto.getCraft() != null && Arrays.asList(dto.getCraft()).contains("模切")) {
{420, 965, 1315, 1850, 2400}, priceList = getOtherHekaPrice(dto, width, length);
{780, 1768, 2390, 3255, 4350}, for (int i = 0; i < dto.getCraft().length; i++) {
{1120, 2572, 3450, 4726, 6330}, if ("模切".equals(dto.getCraft()[i])) {
{1465, 3336, 4480, 6138, 8190}, dto.getCraft()[i] = "";
{1810, 4100, 5510, 7550, 10050}, }
{2149, 4872, 6538, 8892, 11860}, if ("双面覆哑膜".equals(dto.getCraft()[i])) {
{2488, 5644, 7566, 10234, 13670}, dto.getCraft()[i] = "";
{2827, 6416, 8594, 11576, 15480}, }
{3166, 7188, 9622, 12918, 17290},
{3505, 7960, 10650, 14260, 19100}
};
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[] 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) { }
}
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[] CATEGORY_PRICE = {
80, 90, 100, 130, 130, 170, 170, 330
};
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; 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;
}
Product product = new Product();
product.setCount(item_count);
product.setPrice(Math.ceil((price + carft_price) * number));
// priceList.add(product);
} }
// return priceList; 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] = "";
}
}
moqiePrice = 0.06;
}
for (Product product : priceList) {
product.setPrice(product.getPrice() + mu_price);
}
} }
priceList = getHekaPrice(min, dto, priceList, count);
//四个位拼多多价格调整 //四个位拼多多价格调整
if (role.indexOf("1045") > -1 && min == 4) { if (role.indexOf("1045") > -1 && min == 4) {
for (Product product : priceList) { for (Product product : priceList) {
@@ -916,6 +903,9 @@ public class ProductService {
if (craft_list.contains("配弹力绳捆")) { if (craft_list.contains("配弹力绳捆")) {
carft_price += 10 * Math.ceil(product.getCount() * 20.0 / 5000); 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袋")) { if (craft_list.contains("opp袋")) {
double carft_base_price = 0; double carft_base_price = 0;
if ("8*5".equals(dto.getToothpick_size())) { 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); 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)); 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); getCraft(product1, priceList, length * 10, width * 10, min);
for (Product product : priceList) { for (Product product : priceList) {
if ("击凸".equals(dto.getAotu()) || "压凹".equals(dto.getAotu())) { 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("弹力绳")) { 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("弹力绳捆")) { 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 { } else {
if (count <= 10000) if (count <= 10000) {
priceList = productMapper.getThanPrice(dto); priceList = productMapper.getThanPrice(dto);
else } else {
priceList = productMapper.thanThousandPrice(dto); priceList = productMapper.thanThousandPrice(dto);
}
// 数据库中是成本价需要*利润 // 数据库中是成本价需要*利润
for (Product product : priceList) { for (Product product : priceList) {
if (product.getCount() <= 1000) { if (product.getCount() <= 1000) {
@@ -3407,10 +3404,11 @@ public class ProductService {
dto.setKind1Value("2"); dto.setKind1Value("2");
} }
if (count <= 10000) if (count <= 10000) {
priceList = productMapper.getThanPrice(dto); priceList = productMapper.getThanPrice(dto);
else } else {
priceList = productMapper.notePaperPrice(dto); priceList = productMapper.notePaperPrice(dto);
}
} }
if (priceList.size() >= 4) { if (priceList.size() >= 4) {
@@ -3560,10 +3558,11 @@ public class ProductService {
return priceList; return priceList;
// 透明PVC名片 // 透明PVC名片
case "21": case "21":
if (count <= 10000) if (count <= 10000) {
priceList = productMapper.getThanPrice(dto); priceList = productMapper.getThanPrice(dto);
else } else {
priceList = productMapper.thanThousandPrice(dto); priceList = productMapper.thanThousandPrice(dto);
}
if (priceList.size() >= 4) { if (priceList.size() >= 4) {
priceList = priceList.subList(0, 4); priceList = priceList.subList(0, 4);
@@ -3793,10 +3792,11 @@ public class ProductService {
int min = getNum(length, width); int min = getNum(length, width);
// 根据位数算价格最多4个位 // 根据位数算价格最多4个位
dto.setKind2Value(String.valueOf(min)); dto.setKind2Value(String.valueOf(min));
if (count <= 10000) if (count <= 10000) {
priceList = productMapper.getThanPrice(dto); priceList = productMapper.getThanPrice(dto);
else } else {
priceList = productMapper.thanThousandPrice(dto); priceList = productMapper.thanThousandPrice(dto);
}
// 产品价格倍数 // 产品价格倍数
for (Product product : priceList) { for (Product product : priceList) {
product.setPrice(Math.ceil(product.getPrice() * product.getPriceMultiple())); 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); priceList = productMapper.getThanPrice(dto);
}
// 加工艺的价格 --有覆膜带尺寸过去毫米 // 加工艺的价格 --有覆膜带尺寸过去毫米
/*getCraft(dto, priceList, null, null, 0);*/ /*getCraft(dto, priceList, null, null, 0);*/
// 根据款数重新算价格 // 根据款数重新算价格
@@ -4683,6 +4684,22 @@ public class ProductService {
return null; 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) { private List<Product> getPETPrice(Product dto, double length, double width) {
int[][] prices = new int[][]{ int[][] prices = new int[][]{
{136, 163, 177, 190, 197, 227, 257, 303, 333, 407, 430}, {136, 163, 177, 190, 197, 227, 257, 303, 333, 407, 430},
+5 -2
파일 보기
@@ -29,9 +29,9 @@
<insert id="addInformation" parameterType="Information"> <insert id="addInformation" parameterType="Information">
insert into insert into
tbl_information tbl_information
(content,type,createBy,createDate) (content,type,createBy,createDate,attachment)
values values
(#{content},#{type},#{createBy},now()) (#{content},#{type},#{createBy},now(),#{attachment})
</insert> </insert>
<update id="updateInformationById" parameterType="Information"> <update id="updateInformationById" parameterType="Information">
@@ -49,6 +49,9 @@
<if test="updateDate != null"> <if test="updateDate != null">
updateDate = now(), updateDate = now(),
</if> </if>
<if test="attachment != null">
attachment = #{attachment,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
+163 -141
파일 보기
@@ -1,145 +1,167 @@
layui.use([ 'element', 'table', 'laydate', 'form' ], function() { layui.use(['element', 'table', 'laydate', 'form'], function () {
var $ = layui.jquery; var $ = layui.jquery;
var table = layui.table; var table = layui.table;
var laydate = layui.laydate; var laydate = layui.laydate;
var element = layui.element; var element = layui.element;
var form = layui.form; var form = layui.form;
// 生成表格 // 生成表格
table.render({ table.render({
elem : '#informationTable', elem: '#informationTable',
url : '../../../getInformations', url: '../../../getInformations',
toolbar : '#toolbarDemo', toolbar: '#toolbarDemo',
title : '用户表',// 导出文件名 title: '用户表',// 导出文件名
id : 'informationTableAll', id: 'informationTableAll',
// 开启分页 // 开启分页
// page : true, // page : true,
page : { page: {
layout : [ 'count', 'prev', 'page', 'next', 'skip', 'limit' ] layout: ['count', 'prev', 'page', 'next', 'skip', 'limit']
}, },
limits : [10,30,50,80,100,999], limits: [10, 30, 50, 80, 100, 999],
/*request : { /*request : {
'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize 'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize
},*/ },*/
where:{ where: {
content:'' content: ''
}, },
cellMinWidth : 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增 cellMinWidth: 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增
cols : [ [ { cols: [[{
type : 'numbers', type: 'numbers',
title : '序号', title: '序号',
width : 50, width: 50,
fixed : "left" fixed: "left"
},{ }, {
field : 'content', field: 'content',
title : '内容', title: '内容',
},{ }, {
field : 'type', field: 'type',
align : 'center', align: 'center',
width : 150, width: 150,
title : '类型' title: '类型'
},{ }, {
field : 'createBy', field: 'createBy',
align : 'center', align: 'center',
width : 150, width: 150,
title : '创建人' title: '创建人'
},{ }, {
field : 'createDate', field: 'createDate',
title : '创建时间', title: '创建时间',
width : 220, width: 220,
align : 'center', align: 'center',
templet : function(d) { templet: function (d) {
return d.createDate != null ?layui.util.toDateString(d.createDate, "yyyy-MM-dd HH:mm:ss") : ""; return d.createDate != null ? layui.util.toDateString(d.createDate, "yyyy-MM-dd HH:mm:ss") : "";
} }
},{ }, {
fixed : 'right', fixed: 'right',
title : '操作', title: '操作',
align : 'center', align: 'center',
width : 150, width: 150,
toolbar : '#barDemo' toolbar: '#barDemo'
} ] ], }]],
parseData : function(res) { //将原始数据解析成 table 组件所规定的数据 parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
return { return {
"code" : 0, //解析接口状态 "code": 0, //解析接口状态
"msg" : "", //解析提示文本 "msg": "", //解析提示文本
"count" : res.data.list.total,//解析数据长度 "count": res.data.list.total,//解析数据长度
"data" : res.data.list.list//解析数据列表 "data": res.data.list.list//解析数据列表
}; };
} }
}); });
//点击查询按钮,重载表格 //点击查询按钮,重载表格
$('#searchBtn').on('click', function() { $('#searchBtn').on('click', function () {
table.reload('informationTableAll', { table.reload('informationTableAll', {
method : 'get', method: 'get',
where : { where: {
content : $("#content").val() content: $("#content").val()
}, },
page : { page: {
curr : 1 curr: 1
} }
}); });
return false; 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;
}
;
});
// 监听 修改 // 监听头部工作栏的 新增
table.on('tool(informationTable)', function(obj) { table.on('toolbar(informationTable)', function (obj) {
var data1 = obj.data; var checkStatus = table.checkStatus(obj.config.id);
if (obj.event === 'edit') { switch (obj.event) {
layer.open({ case 'add':
type : 2, layer.open({
title : "修改问题", type: 2,
area : [ '45%', '70%' ], title: "添加问题",
skin:'layui-layer-molv', fix: false, //不固定
content : './updateInformation.jsp', maxmin: true,
success : function(layero, index) { skin: 'layui-layer-molv',
var body = layer.getChildFrame('body', index); area: ['45%', '70%'],
var iframeWin = window[layero.find('iframe')[0]['name']]; // 得到iframe页的窗口对象 content: './addInformation.jsp',
body.find('#id').val(data1.id); });
body.find('#contentUpdate').val(data1.content); break;
body.find('#type').val(data1.type); }
layui.form.render(); ;
} });
});
}else if(obj.event === 'del'){ function previewImage(textImage) {
layer.confirm('确定要删除该数据么?',{icon:3,title:"提示"}, function(index){
$.ajax({
url:"../../../deleteInformation", }
data:{'id': data1.id},
type:"post", // 监听 修改
//dataType:"json", table.on('tool(informationTable)', function (obj) {
success:function (data) { var data1 = obj.data;
if (data.code == 200) { console.log(data1)
layer.msg('删除成功!',{icon:6,offset:"auto",time:1000});//提示框 if (obj.event === 'edit') {
}else{ layer.open({
layer.msg('删除失败!',{icon:5,offset:"auto",time:1000});//提示框 type: 2,
} title: "修改问题",
setTimeout(function(){ area: ['45%', '70%'],
location.reload();//重新加载页面 skin: 'layui-layer-molv',
}, 1100); content: './updateInformation.jsp',
} success: function (layero, index) {
}); var body = layer.getChildFrame('body', index);
return false; 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
파일 보기
@@ -767,6 +767,8 @@
<option value="12*6">12*6CM</option> <option value="12*6">12*6CM</option>
</select> </select>
</div> </div>
<input type="checkbox" class="peijian" name="craft" lay-filter="z4PeiJian" value="配棉绳"
title="配棉绳">
</div> </div>
</form> </form>
</div> </div>
@@ -948,7 +950,7 @@
} }
function z3Vice(val, type) { function z3Vice(val, type = 0) {
$(".z3_vice input").prop("checked", false); $(".z3_vice input").prop("checked", false);
$(".z3_vice .z_16").hide(); $(".z3_vice .z_16").hide();
$(".z3_vice .z_19").hide(); $(".z3_vice .z_19").hide();
@@ -1780,7 +1782,7 @@
// 5.11:选中少数量的时候隐藏所有的【烫金】工艺 // 5.11:选中少数量的时候隐藏所有的【烫金】工艺
// 12.31恢复少数量 【烫金】工艺 // 12.31恢复少数量 【烫金】工艺
if (couponKind == '少数量' && (data.value == '积分卡' || data.value == '抽奖卡' || data.value == '刮刮卡')) { if (couponKind == '少数量' && (data.value == '积分卡' || data.value == '抽奖卡' || data.value == '刮刮卡' || data.value == '异形卡片')) {
$(".tj").hide(); $(".tj").hide();
// 禁用没用,下面有放开 // 禁用没用,下面有放开
//$(".tj").find(":input").attr("disabled", true); //$(".tj").find(":input").attr("disabled", true);
@@ -2022,6 +2024,10 @@
} else { } else {
} }
$(".guaguaSize").hide();
$(".guaguaSize").find("select").attr("disabled", true);
$(".guaguaSize1").hide();
$(".guaguaSize1").find("select").attr("disabled", true);
if (kind == 13 || kind == "刮刮卡") { if (kind == 13 || kind == "刮刮卡") {
$(".guaguaSize").show(); $(".guaguaSize").show();
$(".guaguaSize select[name='size1']").attr("disabled", false); $(".guaguaSize select[name='size1']").attr("disabled", false);
@@ -2059,12 +2065,16 @@
$(".lessCountHideCraft").find(".specialCraft").prop('checked', false); $(".lessCountHideCraft").find(".specialCraft").prop('checked', false);
$("#size").show(); $("#size").show();
$(".guaguaSize").hide();
$(".guaguaSize").find("select").attr("disabled", true);
$(".guaguaSize1").hide();
$(".guaguaSize1").find("select").attr("disabled", true);
if (kind == 13 || kind == "刮刮卡") { if (kind == 13 || kind == "刮刮卡") {
$(".guaguaSize1").show(); $(".guaguaSize1").show();
$(".guaguaSize1 select[name='size1']").attr("disabled", false); $(".guaguaSize1 select").attr("disabled", false);
} else { } else {
$(".guaguaSize1").hide(); $(".guaguaSize1").hide();
$(".guaguaSize1 select[name='size1']").attr("disabled", true); $(".guaguaSize1 select").attr("disabled", true);
} }
} }
$(".kindValue2 input[value='10']").prop("disabled", true).prop("checked", false); $(".kindValue2 input[value='10']").prop("disabled", true).prop("checked", false);
@@ -3101,13 +3111,13 @@
return false; return false;
} }
} else if (kind == 3 || kind == 4 || kind == 5 || kind == 7) { } 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() == "模切") { if ($('input[class = mq]:checked').val() == "模切") {
layer.msg("超过6位异形模切卡片请以[ 腰封 - 异形模切]报价!", {offset: ['300px', '300px']}, function () { layer.msg("超过6位异形模切卡片请以[ 腰封 - 异形模切]报价!", {offset: ['300px', '300px']}, function () {
}); });
return false; return false;
} }
} }*/
} else { } else {
//吊牌300克 //吊牌300克
if (kindValue3 == 2) { if (kindValue3 == 2) {
+4 -1
파일 보기
@@ -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="直角裁切" checked>
<input type="checkbox" name="craft" lay-filter="ui_craft" value="异形模切" title="异形模切"> <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="满底烫镭射银"> <input type="checkbox" name="craft" lay-filter="ui_craft" value="满底烫镭射银" title="满底烫镭射银">
<div class="layui-inline shuangmian " style="width: 110px;display: none"> <div class="layui-inline shuangmian " style="width: 110px;display: none">
<select class="select" name="craftShua"> <select class="select" name="craftShua">
@@ -143,7 +146,7 @@
var remark = " "; var remark = " ";
const carft_list1 = ["单面", "双面"]; const carft_list1 = ["单面", "双面"];
const carft_list2 = ["直角裁切", "异形模切", "满底烫镭射银"]; const carft_list2 = ["直角裁切", "异形模切"];
// 清空轮播图 // 清空轮播图
$("#carousel").empty(); $("#carousel").empty();
+2
파일 보기
@@ -175,6 +175,8 @@
<option value="红色绳子">红色绳子</option> <option value="红色绳子">红色绳子</option>
</select> </select>
</div> </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="弹力绳" <input type="checkbox" class="tshengz" name="craft" lay-filter="ui_lius" value="弹力绳"
title="弹力绳(15cm"> title="弹力绳(15cm">
<input type="checkbox" class="tshengz" name="craft" lay-filter="ui_lius" value="弹力绳捆" <input type="checkbox" class="tshengz" name="craft" lay-filter="ui_lius" value="弹力绳捆"
+213 -120
파일 보기
@@ -1,129 +1,222 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ 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" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<%@include file="/views/common.jsp"%> <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> </head>
<style>
.price-layout-page{ <script type="text/html" id="toolbarDemo">
background:#eeeeee; <div class="layui-btn-container demoTable">
padding:18px; <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> 新增内容
.edge .layui-edge{ </button>
right:30px; </div>
}
.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> </script>
<body class="price-layout-page"> <script type="text/html" id="barDemo">
<form class="layui-form" action="" id="form"> <a class="layui-btn layui-btn-xs" lay-event="view">
<input type="hidden" id="type" name="type" value="产品知识"> <i class="layui-icon layui-icon-view" style="color:white;font-size:20px"></i>查看
<label class="layui-form-label"></label> </a>
<div class="layui-form-item" id="myRadio"></div>
</form> </script>
<div class="layui-col-md12" style="padding: 7px;"> <body>
<div style="background: white; padding: 7px;"> <br>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"> <form class="layui-form" action="">
<legend style="color:red;"><h1>产品知识:</h1></legend> <div class="layui-inline">
</fieldset> <label class="layui-form-label">内容</label>
<!-- 渲染到这 --> <div class="layui-input-inline">
<div id="view"></div> <input type="text" id="content" name="content" placeholder="请输入内容" autocomplete="off" class="layui-input">
</div> </div>
</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
});
}
})
});
</script>
</body> </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
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>
</html> </html>
+185 -68
파일 보기
@@ -1,81 +1,198 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ 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" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>添加产品须知</title> <title>添加产品须知</title>
<%@include file="/views/common.jsp"%> <%@include file="/views/common.jsp" %>
<style> <style>
.layui-input,.layui-input-inline{ .layui-input, .layui-input-inline {
width:350px width: 350px
} }
</style> </style>
</head> </head>
<body> <body>
<div class="layui-input-block layui-form" lay-filter="addUser" <div class="layui-input-block layui-form" lay-filter="addUser"
style="margin-top: 30px"> style="margin-top: 30px">
<form class="layui-form " action=""> <form class="layui-form " action="">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">内容</label> <label class="layui-form-label">内容</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="content" placeholder="请输入内容" class="layui-input" lay-verify="required"> <textarea type="text" name="content" placeholder="请输入内容" class="layui-textarea"
</div> lay-verify="required"></textarea>
</div> </div>
<div class="layui-form-item"> </div>
<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-form-item"> <input type="hidden" name="type" placeholder="请输入类型" class="layui-input" value="1">
<div class="layui-input-block"> <div class="layui-form-item">
<button class="layui-btn" lay-submit="" lay-filter="enadd">确认添加</button> <label class="layui-form-label">图片或视频</label>
<button type="reset" class="layui-btn layui-btn-primary">重置</button> <div class="layui-input-inline">
</div> <button type="button" class="layui-btn" id="uploaderImage">上传</button>
</div> <input type="file" id="upload" style="display: none"/>
</form> <input name="attachment" type="hidden" id="images"/>
</div> </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> <script>
function delImage(index) {
layui.use([ 'form', 'layer'],function() { layer.confirm('是否确认删除该图片', {
var $ = layui.$, btn: ['确定', '关闭'] //按钮
form = layui.form, }, function (layIndex) {
layer = layui.layer; 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({ $("#images").val("");
url : '${path}/addInformation', $("#preview").empty();
dataType : 'json', const client = new OSS({
data : $(data.form).serialize(), // yourregion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
type : 'post', region: "oss-cn-fuzhou",
success : function(data) { // 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
if (data.code == 200) { accessKeyId: "LTAI5tE7wuNkeT9jZ42bQnyr",
layer.msg('录入成功!', { accessKeySecret: "NnutvWhKl4HbQFSad3HosYbCkEkbjN",
icon : 6, // 填写存储空间名称。
offset : "auto", bucket: "dfdiyfile",
time : 2000 endpoint: "https://oss-cn-fuzhou.aliyuncs.com",
});//提示框 });
} else {
layer.msg('录入失败!', { function previewImage(textImage) {
icon : 5, let textImageList = textImage == "" ? [] : textImage.split(",");
offset : "auto", let html = "";
time : 2000 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 + "\")'/>";
setTimeout(function(){ } else if (item != "") {
var index = parent.layer.getFrameIndex(window.name);//获取窗口索引 html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
parent.layer.close(index);//关闭弹出层 }
parent.layui.table.reload("informationTableAll"); //重新加载页面表格 })
}, 2100); $("#preview").empty().append(html);
}
}) }
return false;
});
}) 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> </script>
</body> </body>
</html> </html>
+2 -3
파일 보기
@@ -32,7 +32,7 @@
</script> </script>
<script type="text/html" id="barDemo"> <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" 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> </script>
<body> <body>
<br> <br>
@@ -46,8 +46,7 @@
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<div class="layui-input-inline"> <div class="layui-input-inline">
<button class="layui-btn" id="searchBtn" lay-submit <button class="layui-btn" id="searchBtn" lay-submit lay-filter="formDemo" style="margin-left: 15px">
lay-filter="formDemo" style="margin-left: 15px">
<i class="layui-icon layui-icon-search"></i> 查询 <i class="layui-icon layui-icon-search"></i> 查询
</button> </button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button> <button type="reset" class="layui-btn layui-btn-primary">重置</button>
+182 -65
파일 보기
@@ -1,75 +1,192 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ 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" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>修改产品须知</title> <title>修改产品须知</title>
<%@include file="/views/common.jsp"%> <%@include file="/views/common.jsp" %>
<style> <style>
.layui-input,.layui-input-inline{ .layui-input, .layui-input-inline {
width:350px width: 350px
} }
</style> </style>
</head> </head>
<body> <body>
<div class="layui-input-block layui-form" lay-filter="addUser" <div class="layui-input-block layui-form" lay-filter="addUser"
style="margin-top: 30px"> style="margin-top: 30px">
<form class="layui-form " action=""> <form class="layui-form " action="">
<input type="hidden" name="id" id="id"> <input type="hidden" name="id" id="id">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">内容</label> <label class="layui-form-label">内容</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" name="content" placeholder="请输入内容" class="layui-input" id="contentUpdate"> <textarea type="text" name="content" placeholder="请输入内容" class="layui-textarea"
</div> id="contentUpdate"></textarea>
</div> </div>
<div class="layui-form-item"> </div>
<label class="layui-form-label">类型</label> <input type="hidden" name="type" placeholder="请输入类型" class="layui-input" id="type" value="=1">
<div class="layui-input-inline"> <div class="layui-form-item">
<input type="text" name="type" placeholder="请输入类型" class="layui-input" id="type"> <label class="layui-form-label">图片或视频</label>
</div> <div class="layui-input-inline">
</div> <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);
}
<div class="layui-form-item"> async function putObject(file) {
<div class="layui-input-block"> try {
<button class="layui-btn" lay-submit="" lay-filter="enadd">确认修改</button> let fileDir = dateFtt("yyyyMMdd", new Date())
</div> let name = "priceImages/" + fileDir + "/" + guid() + getSuff(file.name);
</div> // 填写Object完整路径。Object完整路径中不能包含Bucket名称。
</form> // 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。
</div> // data对象可以自定义为file对象、Blob数据或者OSS Buffer。
<script type="text/javascript"> const options = {
layui.use([ 'table', 'laydate', 'form','layer' ], function() { headers: {"Content-Type": "text/plain"},
var $ = layui.jquery; };
var table = layui.table; let index = layer.load();
var laydate = layui.laydate; const result = await client.put(name, file, options);
var form = layui.form; layer.close(index);
var layer = layui.layer; let textImage = $("#images").val();
let list = textImage == "" ? [] : textImage.split(",");
form.on('submit(enadd)',function(data){ list.push(result.url);
$.ajax({ $("#images").val(list.join(","));
url:'${path}/updateInformation', previewImage($("#images").val());
dataType : 'json', } catch (e) {
data:$(data.form).serialize(), console.log(e);
type : 'post', }
success:function(data){ }
if (data.code == 200) {
layer.msg('修改成功!',{icon:6,offset:"auto",time:2000});//提示框 document.getElementById('uploaderImage').addEventListener('click', function (e) {
}else { document.getElementById('upload').click();
layer.msg('修改失败!',{icon:5,offset:"auto",time:2000});//提示框 });
} document.getElementById('upload').addEventListener('change', function (e) {
setTimeout(function(){ const file = e.target?.files[0];
var index = parent.layer.getFrameIndex(window.name);//获取窗口索引 putObject(file);
parent.layer.close(index);//关闭弹出层 document.getElementById('upload').value = "";
parent.layui.table.reload("informationTableAll"); //重新加载页面表格 });
}, 2100);
} function dateFtt(fmt, date) {
}) var o = {
return false; "M+": date.getMonth() + 1, //月份
}); "d+": date.getDate(), //日
"h+": date.getHours(), //小时
}) "m+": date.getMinutes(), //分
</script> "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> </body>
</html> </html>