commit 6a5396d38a8efd100fde107ddf1c3996d4fe9838
Author: funjia <13429193897@163.com>
Date: Sat Jul 19 18:25:04 2025 +0800
first commit
diff --git a/1.html b/1.html
new file mode 100644
index 0000000..d0ae073
--- /dev/null
+++ b/1.html
@@ -0,0 +1,306 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/2.html b/2.html
new file mode 100644
index 0000000..e3b627e
--- /dev/null
+++ b/2.html
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/afterSales.css b/afterSales.css
new file mode 100644
index 0000000..ee23a69
--- /dev/null
+++ b/afterSales.css
@@ -0,0 +1,79 @@
+.page {
+ /* border: 1px solid #000; */
+ width: 194mm;
+ height: 279.4mm;
+ display: grid;
+ grid-template-columns: repeat(4, 48.5mm);
+ grid-template-rows: repeat(11, 25.4mm);
+ gap: 0;
+}
+
+.print-area {
+ /* border: 0.1mm dashed #87CEFA; */
+ display: flex;
+ justify-content: center;
+ align-content: flex-start;
+ margin: 0.25mm;
+}
+
+.border {
+ border: 0.1mm dashed #87CEFA;
+}
+
+.print-area:nth-child(41),
+.print-area:nth-child(42),
+.print-area:nth-child(43),
+.print-area:nth-child(44) {
+ padding-bottom: 4mm;
+}
+
+.print-area:nth-child(41) .qrcode,
+.print-area:nth-child(42) .qrcode,
+.print-area:nth-child(43) .qrcode,
+.print-area:nth-child(44) .qrcode {
+ height: calc(100% - 5mm);
+}
+
+.item {
+ height: 100%;
+ width: 100%;
+ display: flex;
+ flex-wrap: wrap;
+}
+
+.tag {
+ color: red;
+ font-size: 0.8cm;
+}
+
+.reason,.time{
+ font-size:4mm;
+}
+
+/*Styling below is used just for positioning the items inside the label. */
+
+.left-content {
+ width: 24mm;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: center;
+ height: inherit;
+ font-size: 3mm;
+ line-height: 3mm;
+ color: #87CEFA;
+}
+
+.right-content {
+ display: grid;
+ font-size: 4mm;
+ align-items: center;
+ justify-content: center;
+ height: 100%;
+ width: auto;
+}
+
+.qrcode {
+ height: calc(100% - 6mm);
+ margin: 0;
+}
\ No newline at end of file
diff --git a/afterSales.html b/afterSales.html
new file mode 100644
index 0000000..7b201fd
--- /dev/null
+++ b/afterSales.html
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/afterSales.js b/afterSales.js
new file mode 100644
index 0000000..bcf6352
--- /dev/null
+++ b/afterSales.js
@@ -0,0 +1,55 @@
+// var html = template('tpl-user', { data: Array.from({ length: 44 }) });
+window.onload = () => {
+ var html = template('tpl-after-sales', { data: Array.from({ length: 44 }) });
+ document.getElementById("page").innerHTML = html;
+}
+
+const exportPDF = () => {
+ // 使用html2canvas捕获div内容
+ html2canvas(document.getElementById("page"), {
+ scale: 2, // 提高分辨率
+ useCORS: true,
+ allowTaint: true,
+ logging: false,
+
+ }).then(canvas => {
+ // 创建PDF
+ const imgData = canvas.toDataURL('image/png', 1);
+
+ const link = document.createElement('a');
+ link.download = `canvas-export.png`;
+ link.href = imgData;
+ link.click();
+ return;
+
+
+
+ const pdf = new jspdf.jsPDF({
+ orientation: 'portrait',
+ unit: 'mm',
+ // format: 'a4'
+ format: [279.4, 194]
+ });
+
+ // const imgWidth = pdf.internal.pageSize.getWidth();
+ // const imgHeight = (canvas.height * imgWidth) / canvas.width;
+
+ // 添加图片到PDF
+ // pdf.addImage(imgData, 'JPEG', 0, 0, 194, 279.4);
+ pdf.addImage(imgData, 'JPEG', 0, 0, 194, 279.4);
+ // console.log(imgWidth, imgHeight);
+ // 保存PDF
+ pdf.save(`1.pdf`);
+
+ // 恢复按钮状态
+ // this.textContent = btnText;
+ // this.disabled = false;
+ }).catch(error => {
+ console.error('导出PDF失败:', error);
+ alert('导出PDF时出错,请重试。');
+
+ // 恢复按钮状态
+ // this.textContent = btnText;
+ // this.disabled = false;
+ });
+}
\ No newline at end of file
diff --git a/assets/qrcode.png b/assets/qrcode.png
new file mode 100644
index 0000000..1b3dcee
Binary files /dev/null and b/assets/qrcode.png differ
diff --git a/printTag.css b/printTag.css
new file mode 100644
index 0000000..f647d25
--- /dev/null
+++ b/printTag.css
@@ -0,0 +1,65 @@
+.page {
+ /* border: 1px solid #000; */
+ width: 194mm;
+ height: 279.4mm;
+ display: grid;
+ grid-template-columns: repeat(4, 48.5mm);
+ grid-template-rows: repeat(11, 25.4mm);
+ gap: 0;
+ }
+
+ .print-area {
+ border: 0.1mm dashed #87CEFA;
+ display: flex;
+ justify-content: center;
+ align-content: flex-start;
+ margin: 0.25mm;
+ }
+
+ .print-area:nth-child(41),
+ .print-area:nth-child(42),
+ .print-area:nth-child(43),
+ .print-area:nth-child(44) {
+ padding-bottom: 4mm;
+ }
+
+ .print-area:nth-child(41) .qrcode,
+ .print-area:nth-child(42) .qrcode,
+ .print-area:nth-child(43) .qrcode,
+ .print-area:nth-child(44) .qrcode {
+ height: calc(100% - 5mm);
+ }
+
+ .item {
+ height: 100%;
+ width: 100%;
+ display: flex;
+ }
+
+ /*Styling below is used just for positioning the items inside the label. */
+
+ .left-content {
+ width: 24mm;
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: center;
+ height: inherit;
+ font-size: 3mm;
+ line-height: 3mm;
+ color: #87CEFA;
+ }
+
+ .right-content {
+ display: grid;
+ font-size: 4mm;
+ align-items: center;
+ justify-content: center;
+ height: 100%;
+ width: auto;
+ }
+
+ .qrcode {
+ height: calc(100% - 6mm);
+ margin: 0;
+ }
\ No newline at end of file
diff --git a/printTag.js b/printTag.js
new file mode 100644
index 0000000..bcf6352
--- /dev/null
+++ b/printTag.js
@@ -0,0 +1,55 @@
+// var html = template('tpl-user', { data: Array.from({ length: 44 }) });
+window.onload = () => {
+ var html = template('tpl-after-sales', { data: Array.from({ length: 44 }) });
+ document.getElementById("page").innerHTML = html;
+}
+
+const exportPDF = () => {
+ // 使用html2canvas捕获div内容
+ html2canvas(document.getElementById("page"), {
+ scale: 2, // 提高分辨率
+ useCORS: true,
+ allowTaint: true,
+ logging: false,
+
+ }).then(canvas => {
+ // 创建PDF
+ const imgData = canvas.toDataURL('image/png', 1);
+
+ const link = document.createElement('a');
+ link.download = `canvas-export.png`;
+ link.href = imgData;
+ link.click();
+ return;
+
+
+
+ const pdf = new jspdf.jsPDF({
+ orientation: 'portrait',
+ unit: 'mm',
+ // format: 'a4'
+ format: [279.4, 194]
+ });
+
+ // const imgWidth = pdf.internal.pageSize.getWidth();
+ // const imgHeight = (canvas.height * imgWidth) / canvas.width;
+
+ // 添加图片到PDF
+ // pdf.addImage(imgData, 'JPEG', 0, 0, 194, 279.4);
+ pdf.addImage(imgData, 'JPEG', 0, 0, 194, 279.4);
+ // console.log(imgWidth, imgHeight);
+ // 保存PDF
+ pdf.save(`1.pdf`);
+
+ // 恢复按钮状态
+ // this.textContent = btnText;
+ // this.disabled = false;
+ }).catch(error => {
+ console.error('导出PDF失败:', error);
+ alert('导出PDF时出错,请重试。');
+
+ // 恢复按钮状态
+ // this.textContent = btnText;
+ // this.disabled = false;
+ });
+}
\ No newline at end of file