新增在线查看PDF

This commit is contained in:
2025-09-05 14:41:05 +08:00
parent ce095f4b7f
commit 520466e7dd
5 changed files with 43 additions and 12 deletions
-1
View File
@@ -16,7 +16,6 @@ async function uploadFile(file) {
// 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。 // 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。
// data对象可以自定义为file对象、Blob数据或者OSS Buffer。 // data对象可以自定义为file对象、Blob数据或者OSS Buffer。
const options = { const options = {
headers: {"Content-Type": "text/plain"},
}; };
let index = layer.load(); let index = layer.load();
const result = await client.put(name, file, options); const result = await client.put(name, file, options);
+28 -10
View File
@@ -81,7 +81,7 @@
<input type="radio" lay-filter="kind" name="kind" value="11" title="圣诞卡"> <input type="radio" lay-filter="kind" name="kind" value="11" title="圣诞卡">
</span> </span>
<span class="lessCount" style="display:none"> <span class="lessCount" style="display:none">
<input type="radio" lay-filter="kind" name="kind" value="直角卡片" title="直角卡片"> <input type="radio" lay-filter="kind" name="kind" value="直角卡片" title="卡片">
<%-- <input type="radio" lay-filter="kind" name="kind" value="异形卡片" title="异形卡片">--%> <%-- <input type="radio" lay-filter="kind" name="kind" value="异形卡片" title="异形卡片">--%>
<input type="radio" lay-filter="kind" name="kind" value="腰封" title="腰封"> <input type="radio" lay-filter="kind" name="kind" value="腰封" title="腰封">
<input type="radio" lay-filter="kind" name="kind" value="贺卡" title="贺卡"> <input type="radio" lay-filter="kind" name="kind" value="贺卡" title="贺卡">
@@ -531,11 +531,14 @@
<div class="layui-input-block value7"> <div class="layui-input-block value7">
<input type="checkbox" name="craft" class="mq" lay-filter="switchMQ" value="模切" <input type="checkbox" name="craft" class="mq" lay-filter="switchMQ" value="模切"
title="异形模切"> title="异形模切">
<input type="checkbox" name="craft" class="mq" lay-filter="switchMQ" value="直角裁切"
title="直角裁切" checked>
<span class="ui_fm_l"> <span class="ui_fm_l">
<input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面覆膜" <input type="checkbox" name="craft" class="ui_fm" lay-filter="ui_yf_fm" value="双面覆膜"
title="双面覆膜"/> title="双面覆膜"/>
</span> </span>
<span class="yhydx"> <span class="yhydx">
<input type="checkbox" name="craft" class="layui-input" lay-filter="ui_yf_fm" value="压痕" <input type="checkbox" name="craft" class="layui-input" lay-filter="ui_yf_fm" value="压痕"
title="压痕"> title="压痕">
<div class="layui-inline yhselect" style="width:60px; display:none"> <div class="layui-inline yhselect" style="width:60px; display:none">
@@ -1310,6 +1313,7 @@
layer.msg('[裁切- 模切 - 圆角]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5}); layer.msg('[裁切- 模切 - 圆角]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
return false; return false;
} }
if (data.value == "模切") { if (data.value == "模切") {
if ($(data.elem).is(":checked")) { if ($(data.elem).is(":checked")) {
$("#z4_craft .nomq").prop("checked", false).prop("disabled", true); $("#z4_craft .nomq").prop("checked", false).prop("disabled", true);
@@ -1518,6 +1522,10 @@
$("#craftForm")[0].reset(); $("#craftForm")[0].reset();
$(".yhselect").hide(); $(".yhselect").hide();
$(".ydxselect").hide(); $(".ydxselect").hide();
$(".yhydx").hide();
$(".yhydx").find(":input").attr("disabled", true);
$('input[class = mq]').prop('checked', false);
$('input[class = mq][value=直角裁切]').prop('checked', true);
if (data.value == 0 || data.value == 1) { if (data.value == 0 || data.value == 1) {
$("#kindValueForm")[0].reset(); $("#kindValueForm")[0].reset();
$(".kindValue").show(); $(".kindValue").show();
@@ -1549,6 +1557,7 @@
$(".switchCount").find(":input").attr("disabled", false); $(".switchCount").find(":input").attr("disabled", false);
$(".ui_fm_l").show(); $(".ui_fm_l").show();
$('.ui_fm_l').find(":input").attr("disabled", false); $('.ui_fm_l').find(":input").attr("disabled", false);
form.on('radio(kindValue)', function (kindValueData) { form.on('radio(kindValue)', function (kindValueData) {
kindValue = kindValueData.value kindValue = kindValueData.value
$(".ui_fm_l").show(); $(".ui_fm_l").show();
@@ -1585,20 +1594,20 @@
$('.fm').hide(); $('.fm').hide();
$('.fm').prop('checked', false); $('.fm').prop('checked', false);
} }
$('input[class = mq]').prop('checked', false);
$('input[class = mq][value=直角裁切]').prop('checked', true);
// 吊旗、腰封--300克铜版纸的时候勾选模切,且不能取消 // 吊旗、腰封--300克铜版纸的时候勾选模切,且不能取消
if (data.value == 0) { if (data.value == 0) {
$('input[class = mq]').prop('checked', true);
form.on('checkbox(switchMQ)', function (switchData) { form.on('checkbox(switchMQ)', function (switchData) {
// 吊旗/吊牌的模切 // 吊旗/吊牌的模切
if (!switchData.elem.checked) { if (!switchData.elem.checked) {
layer.msg('吊旗不能取消 [ 模切 ] 工艺!', {offset: ['300px', '300px']}, function () { layer.msg('吊旗不能取消 [ 模切 ] 工艺!', {offset: ['300px', '300px']}, function () {
}); });
$('input[class = mq]').prop('checked', true);
form.render('checkbox'); form.render('checkbox');
} else { } else {
kindValueData.value = 1; kindValueData.value = 1;
} }
if (switchData.elem.checked) { if (switchData.elem.checked) {
$(".disab").attr("disabled", true); $(".disab").attr("disabled", true);
$('input[class = disab]').prop('checked', false); $('input[class = disab]').prop('checked', false);
@@ -1617,6 +1626,12 @@
if (kindValueData.value == 2) { if (kindValueData.value == 2) {
//$('input[class = mq]').prop('checked', true); //$('input[class = mq]').prop('checked', true);
form.on('checkbox(switchMQ)', function (switchData) { form.on('checkbox(switchMQ)', function (switchData) {
if ($(".mq:checked").length > 1) {
$(switchData.elem).next().attr("class", "layui-unselect layui-form-checkbox");
$(switchData.elem).prop("checked", false);
layer.msg('[裁切- 模切]不能同时选择!', {offset: ['300px', '300px']}, {icon: 5});
return false;
}
if (kindValueData.value == 2) { if (kindValueData.value == 2) {
// 吊旗/吊牌的模切 // 吊旗/吊牌的模切
if (!switchData.elem.checked) { if (!switchData.elem.checked) {
@@ -1630,7 +1645,6 @@
} }
}) })
} else { } else {
$('input[class = mq]').prop('checked', false);
} }
} }
form.render(); form.render();
@@ -1787,7 +1801,6 @@
$("#craft").show(); $("#craft").show();
$(".craft").show(); $(".craft").show();
$(".craft").find(":input").attr("disabled", false); $(".craft").find(":input").attr("disabled", false);
$('input[class = mq]').prop('checked', false);
$(".kindValue5").hide(); $(".kindValue5").hide();
$(".kindValue5").attr("disabled", true); $(".kindValue5").attr("disabled", true);
$(".ui_shk_size").hide(); $(".ui_shk_size").hide();
@@ -1867,7 +1880,6 @@
if (data.value == 7) { if (data.value == 7) {
$(".value7").find(":input").attr("checked", false); $(".value7").find(":input").attr("checked", false);
$(".damaHide").hide(); $(".damaHide").hide();
$('input[class = mq]').prop('checked', true);
$('input[class = cjkDisab]').prop('checked', false); $('input[class = cjkDisab]').prop('checked', false);
$(".cjkDisab").attr("disabled", true); $(".cjkDisab").attr("disabled", true);
// 打码勾选--编码类型说明显示 // 打码勾选--编码类型说明显示
@@ -2953,6 +2965,14 @@
layer.msg("[ 卡片 ]尺寸小于4*4 cm请以 [ 插卡 - 异形插牌 ] 报价!",{offset:['300px','300px']},function(){}); layer.msg("[ 卡片 ]尺寸小于4*4 cm请以 [ 插卡 - 异形插牌 ] 报价!",{offset:['300px','300px']},function(){});
return false; return false;
} */ } */
if (couponKind != "少数量" && (kind == 1 || kind == 3 || kind == 4 || kind == 5 || kind == 7 || kind == 13)) {
if ($(".mq:checked").length == 0) {
layer.msg("请选择裁切类型", {offset: ['300px', '300px']}, function () {
});
return false;
}
}
var kindData = { var kindData = {
0: "吊旗", 0: "吊旗",
1: "腰封", 1: "腰封",
@@ -2967,7 +2987,7 @@
10: "吸管套", 10: "吸管套",
11: "圣诞卡", 11: "圣诞卡",
13: "刮刮卡", 13: "刮刮卡",
"直角卡片": "直角卡片", "直角卡片": "卡片",
"异形卡片": "异形卡片", "异形卡片": "异形卡片",
"腰封": "腰封", "腰封": "腰封",
"贺卡": "贺卡", "贺卡": "贺卡",
@@ -3412,7 +3432,6 @@
if (kind == 8) { if (kind == 8) {
arr.push("模切") arr.push("模切")
} else { } else {
arr.push("直角裁切")
} }
} }
} else { } else {
@@ -3420,7 +3439,6 @@
if (kind == 8) { if (kind == 8) {
arr.push("模切") arr.push("模切")
} else { } else {
arr.push("直角裁切")
} }
} }
@@ -72,6 +72,8 @@
textImageList.forEach((item, index) => { textImageList.forEach((item, index) => {
if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) { 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 + "\")'/>"; html += "<video src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
} else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
html += "<img src='https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/priceImages/20250905/PDF.png' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} else if (item != "") { } else if (item != "") {
html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>"; html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
} }
@@ -73,6 +73,9 @@
let html = "<div style='width: 100%;height: 100%;display: flex;align-items: center;justify-content: center'>"; 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)) { 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;'/>"; html += "<video src='" + item + "' class='layui-upload-img' controls style='width: 400px;height: 400px;margin-right: 5px;'/>";
} else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
let pdfUrl = "/js/pdf/web/viewer.html?file=" + item.replace("https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/", "http://imagediy.lingtao8.com/");
html += "<iframe src='" + pdfUrl + "' style='width: 400px;height: 400px;margin-right: 5px;'/>";
} else if (item != "") { } else if (item != "") {
html += "<img src='" + item + "' class='layui-upload-img' style='width: 400px;height: 400px;margin-right: 5px;'/>"; html += "<img src='" + item + "' class='layui-upload-img' style='width: 400px;height: 400px;margin-right: 5px;'/>";
} }
@@ -137,6 +140,8 @@
let item = list[i]; let item = list[i];
if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) { 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 + "\")'/>"; html += "<video src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
html += "<img src='https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/priceImages/20250905/PDF.png' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} else if (item != "") { } else if (item != "") {
html += "<img src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>"; html += "<img src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} }
@@ -229,6 +234,8 @@
textImageList.forEach((item, index) => { textImageList.forEach((item, index) => {
if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) { 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 + "\")'/>"; html += "<video src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
} else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
html += "<img src='https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/priceImages/20250905/PDF.png' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} else if (item != "") { } else if (item != "") {
html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>"; html += "<img src='" + item + "' class='layui-upload-img' style='width: 50px;height: 50px;margin-right: 5px;' onclick='delImage(\"" + index + "\")'/>";
} }
@@ -61,6 +61,9 @@
let html = "<div style='width: 100%;height: 100%;display: flex;align-items: center;justify-content: center'>"; 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)) { 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;'/>"; html += "<video src='" + item + "' class='layui-upload-img' controls style='width: 400px;height: 400px;margin-right: 5px;'/>";
} else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
let pdfUrl = "/js/pdf/web/viewer.html?file=" + item.replace("https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/", "http://imagediy.lingtao8.com/");
html += "<iframe src='" + pdfUrl + "' style='width: 400px;height: 400px;margin-right: 5px;'/>";
} else if (item != "") { } else if (item != "") {
html += "<img src='" + item + "' class='layui-upload-img' style='width: 400px;height: 400px;margin-right: 5px;'/>"; html += "<img src='" + item + "' class='layui-upload-img' style='width: 400px;height: 400px;margin-right: 5px;'/>";
} }
@@ -109,7 +112,7 @@
title: '序号', title: '序号',
width: 50, width: 50,
fixed: "left" fixed: "left"
},{ }, {
field: 'content', field: 'content',
title: '内容', title: '内容',
}, { }, {
@@ -123,6 +126,8 @@
let item = list[i]; let item = list[i];
if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) { 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 + "\")'/>"; html += "<video src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
html += "<img src='https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/priceImages/20250905/PDF.png' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} else if (item != "") { } else if (item != "") {
html += "<img src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>"; html += "<img src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
} }