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

保存签名照片

上级 1da6ceaf
......@@ -31,6 +31,7 @@
</template>
<script>
import { createFolder, copyImage } from "@/utils/plus.js";
export default {
components: {},
data() {
......@@ -118,6 +119,10 @@ export default {
fileType: 'jpg', // 不使用png是因为预览的时候黑底,字也是黑色,导致看不见图片签字
success: async (res) => {
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,
......@@ -128,14 +133,14 @@ export default {
// 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) => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论