save image for TWA

This commit is contained in:
Timi
2026-09-22 15:41:12 +08:00
parent ac4d65808a
commit 5465fb7b27
15 changed files with 880 additions and 3 deletions
+2
View File
@@ -244,6 +244,7 @@ import { getAttachmentReadURL } from "@/utils/attachment";
import { normalizeBodyAreaValue } from "@/utils/customer";
import { corePermissionCodes, gaoRoleCodes, permissionCodes } from "@/utils/permission";
import { compressUploadImage } from "@/utils/imageCompression";
import { saveCapturedFilesFromInput } from "@/utils/twaBridge";
defineOptions({
name: "CustomerEdit"
@@ -638,6 +639,7 @@ async function handlePhotoSelected(event: Event): Promise<void> {
if (!file) {
return;
}
saveCapturedFilesFromInput(input, [file]);
isPhotoUploading.value = true;
try {
const compressedFile = await compressUploadImage(file);
@@ -3,6 +3,7 @@ import { AttachmentAPI, type Attachment } from "timi-web-api";
import type { PhotoItem } from "@/types/Photo";
import { getAttachmentReadURL } from "@/utils/attachment";
import { compressUploadImageList } from "@/utils/imageCompression";
import { saveCapturedFilesFromInput } from "@/utils/twaBridge";
export function useEventRecordPhoto() {
const recordPhotoInputRef = ref<HTMLInputElement>();
@@ -38,6 +39,7 @@ export function useEventRecordPhoto() {
if (!fileList.length) {
return;
}
saveCapturedFilesFromInput(input, fileList);
isPhotoUploading.value = true;
try {
const compressedFileList = await compressUploadImageList(fileList);
+2
View File
@@ -183,6 +183,7 @@ import { resolveSelectedOptionGroupList, validateEventOptionSelection } from "@/
import { permissionCodes } from "@/utils/permission";
import { getEventRecordPhotoURL, hasPhotoAttachment } from "@/utils/eventRecord";
import { compressUploadImageList } from "@/utils/imageCompression";
import { saveCapturedFilesFromInput } from "@/utils/twaBridge";
import { Storage, Time } from "timi-web";
import { type Attachment, AttachmentAPI } from "timi-web-api";
import EventSelector from "@/components/EventSelector.vue";
@@ -437,6 +438,7 @@ async function handleRecordPhotoSelected(event: Event): Promise<void> {
if (!fileList.length) {
return;
}
saveCapturedFilesFromInput(input, fileList);
recordPhotoUploading.value = true;
try {
const compressedFileList = await compressUploadImageList(fileList);
+2
View File
@@ -226,6 +226,7 @@ import { emitListDataChanged, listDataEventKeys } from "@/utils/listDataEvents";
import { formatProductAmount, getProductStatusText, getProductTypeText, normalizeProductQuantity, parseProductAmount } from "@/utils/product";
import { Message } from "@/utils/message";
import { permissionCodes } from "@/utils/permission";
import { saveCapturedFilesFromInput } from "@/utils/twaBridge";
type PickerValue = string | number;
@@ -647,6 +648,7 @@ async function handleAttachmentSelected(event: Event): Promise<void> {
if (!file) {
return;
}
saveCapturedFilesFromInput(input, [file]);
isAttachmentUploading.value = true;
try {
const tempFile = (await AttachmentAPI.upload(await compressUploadImage(file)))[0];
+2
View File
@@ -91,6 +91,7 @@ import { compressUploadImage, compressUploadImageList } from "@/utils/imageCompr
import { getAttachmentReadURL } from "@/utils/attachment";
import { Message } from "@/utils/message";
import { permissionCodes } from "@/utils/permission";
import { saveCapturedFilesFromInput } from "@/utils/twaBridge";
defineOptions({
name: "StoreDiaryEdit"
@@ -180,6 +181,7 @@ async function handlePhotoSelected(event: Event): Promise<void> {
if (!fileList.length) {
return;
}
saveCapturedFilesFromInput(input, fileList);
isPhotoUploading.value = true;
try {
+1 -1
View File
@@ -38,7 +38,7 @@
v-if="canManageStoreDiary"
class="action"
title="门店日记"
note="记录门店经营和护理过程"
note="记录门店经营日常"
arrow
hover
@click="goStoreDiaryManagement"