update image thumb

This commit is contained in:
Timi
2026-08-22 01:27:45 +08:00
parent e2af521996
commit 3b56de2430
16 changed files with 69 additions and 38 deletions
+5 -2
View File
@@ -19,6 +19,7 @@
<section v-if="record" class="photo-panel">
<photo-scroller
:model-value="recordPhotoList"
:photo-items="recordPhotoItemList"
:show-add="false"
:show-remove="false"
title="登记照片"
@@ -54,10 +55,12 @@ const record = ref<EventRecord>();
const isLoading = ref(false);
const canUpdateRecord = computed(() => userStore.hasPermissions(permissionCodes.eventRecord.update));
const recordPhotoList = computed(() => {
const recordPhotoItemList = computed(() => {
const url = getEventRecordPhotoURL(record.value);
return url ? [url] : [];
const thumbnailURL = getEventRecordPhotoURL(record.value, 64);
return thumbnailURL ? [{ url: thumbnailURL, previewUrl: url }] : [];
});
const recordPhotoList = computed(() => recordPhotoItemList.value.map(item => item.url));
function getNumberValueText(value: EventRecord): string {
return formatEventNumberValue(value.event, value.numberValue);
+11 -3
View File
@@ -112,7 +112,12 @@
</t-form-item>
<div class="photo-part">
<photo-scroller v-model="photoList" :loading="isPhotoUploading" @add="capturePhoto" />
<photo-scroller
v-model="photoList"
:photo-items="photoItemList"
:loading="isPhotoUploading"
@add="capturePhoto"
/>
</div>
</t-form>
<t-cell-group
@@ -200,6 +205,7 @@ import type { Customer } from "@/types/Customer";
import type { EventItem } from "@/types/EventItem";
import type { EventRecord } from "@/types/EventRecord";
import type { PointAction } from "@/types/Point";
import { getAttachmentReadURL } from "@/utils/attachment";
import { getEventRecordPhotoURL } from "@/utils/eventRecord";
import { getEventNumberValuePlaceholder, resolveEventNumberValue } from "@/utils/eventValue";
import { permissionCodes } from "@/utils/permission";
@@ -218,6 +224,7 @@ const navBarStore = useNavBarStore();
type EditablePhoto = {
attachment?: Partial<Attachment>;
previewUrl?: string;
tempFileId?: string;
url: string;
};
@@ -344,7 +351,7 @@ function getRecordEventName(record: EventRecord): string {
}
function getRecordPhotoURL(record: EventRecord): string {
return getEventRecordPhotoURL(record);
return getEventRecordPhotoURL(record, 64);
}
// ---------- 扫码 ----------
@@ -724,7 +731,8 @@ async function loadRecordForEdit(): Promise<void> {
.filter(item => !!item.id)
.map(item => ({
attachment: item,
url: AttachmentAPI.getReadURL(item.id || "")
previewUrl: getAttachmentReadURL(item.id || ""),
url: getAttachmentReadURL(item.id || "", 64)
}));
await loadRecentRecordList();
}
+1 -1
View File
@@ -450,7 +450,7 @@ function getRecordCustomerName(record: EventRecordListItemView): string {
}
function getRecordPhotoURL(record: EventRecordListItemView): string {
return getCustomerPhotoURL(record.customer);
return getCustomerPhotoURL(record.customer, 64);
}
function getRecordCustomerInitial(record: EventRecordListItemView): string {
+2 -2
View File
@@ -57,8 +57,8 @@
>
<template #left-icon>
<t-image
v-if="getCustomerPhotoURL(item.customer)"
:src="getCustomerPhotoURL(item.customer)"
v-if="getCustomerPhotoURL(item.customer, 64)"
:src="getCustomerPhotoURL(item.customer, 64)"
:alt="getCustomerName(item)"
fit="cover"
class="avatar"