提交 c84aa801 authored 作者: zs's avatar zs

保存签名照片

上级 1da6ceaf
......@@ -30,7 +30,8 @@
</view>
</template>
<script>
<script>
import { createFolder, copyImage } from "@/utils/plus.js";
export default {
components: {},
data() {
......@@ -117,7 +118,11 @@ export default {
canvasId: "signatureCanvas",
fileType: 'jpg', // 不使用png是因为预览的时候黑底,字也是黑色,导致看不见图片签字
success: async (res) => {
const tempFilePath = res.tempFilePath;
const tempFilePath = res.tempFilePath;
await createFolder("data/sign");
const fileName = tempFilePath.split("/").pop();
const targetPath = `_documents/data/sign/${fileName}`;
const savedPath = await copyImage(tempFilePath, targetPath);
// 存储照片到本地
// uni.saveImageToPhotosAlbum({
// filePath: tempFilePath,
......@@ -127,15 +132,15 @@ export default {
// fail: function (err) {
// console.error("保存图片到相册失败:", err);
// },
// });
const base64 = await this.convertFileToBase64(tempFilePath);
// });
// console.log("base64",base64)
// 这里可以将 tempFilePath 上传到服务器或进行其他处理
uni.showToast({
title: "签字已保存",
icon: "success",
});
this.$emit("confirm", base64);
this.$emit("confirm", savedPath);
this.close();
},
fail: (err) => {
......
......@@ -330,7 +330,7 @@ export default {
this.backValue = this.options.backValue || "";
this.isDisable = options.isDisable == 1 ? true : false;
this.uid = this.options.uid || "";
this.value = this.options.value || "1";
this.value = this.options.value || "1";
},
onShow() {
// 已经签名不触发更新,主要用于图片预览关闭后会触发onShow
......@@ -356,7 +356,7 @@ export default {
this.listData = this.listFormat(detailsInfo.originData);
this.detailsInfo = detailsInfo;
this.inspectionNumber = detailsInfo.inspectionNumber;
this.inspectionCode = `JFXJ${moment().format("yyyyMMDDHHmmss")}${
Math.floor(Math.random() * 900) + 100
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论