update AIChart, customer followup, media selector

This commit is contained in:
Timi
2026-09-18 17:38:55 +08:00
parent c6b398fa98
commit 57c4275a23
57 changed files with 3866 additions and 2071 deletions
+34 -4
View File
@@ -19,7 +19,7 @@
/>
</t-form-item>
<section class="photo-wrapper" v-entrance-transition="140">
<photo-scroller
<media-selector
v-model="photoList"
v-model:photo-items="photoItemList"
title="附加照片"
@@ -28,15 +28,33 @@
:show-type-label="false"
:show-viewer-actions="false"
@add="openPhotoPicker"
@capture-photo="capturePhoto"
@capture-video="captureVideo"
/>
<input
ref="photoInputRef"
class="file-input"
type="file"
accept="image/*"
accept="*/*"
multiple
@change="handlePhotoSelected"
>
<input
ref="photoCameraInputRef"
class="file-input"
type="file"
accept="image/*"
capture="environment"
@change="handlePhotoSelected"
>
<input
ref="videoInputRef"
class="file-input"
type="file"
accept="video/*"
capture="environment"
@change="handlePhotoSelected"
>
</section>
<section class="editor-wrapper" v-entrance-transition="70">
<article-editor
@@ -63,7 +81,7 @@ import {
} from "timi-tdesign-mobile";
import { AttachmentAPI, type Attachment, useUserStore } from "timi-web-api";
import StoreDiaryAPI from "@/api/StoreDiaryAPI";
import PhotoScroller from "@/components/PhotoScroller.vue";
import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import { useNavBarStore } from "@/store/navBarStore";
import type { StoreDiary } from "@/types/StoreDiary";
@@ -132,6 +150,8 @@ function getCreateTitle(): string {
// ---------- 附加照片 ----------
const photoInputRef = ref<HTMLInputElement>();
const photoCameraInputRef = ref<HTMLInputElement>();
const videoInputRef = ref<HTMLInputElement>();
const photoItemList = ref<PhotoItem[]>([]);
const isPhotoUploading = ref(false);
const photoList = computed<string[]>({
@@ -146,6 +166,14 @@ function openPhotoPicker(): void {
photoInputRef.value?.click();
}
function capturePhoto(): void {
photoCameraInputRef.value?.click();
}
function captureVideo(): void {
videoInputRef.value?.click();
}
async function handlePhotoSelected(event: Event): Promise<void> {
const input = event.target as HTMLInputElement;
const fileList = Array.from(input.files || []);
@@ -156,11 +184,12 @@ async function handlePhotoSelected(event: Event): Promise<void> {
isPhotoUploading.value = true;
try {
const tempFileList = await AttachmentAPI.upload(await compressUploadImageList(fileList));
for (const tempFile of tempFileList) {
for (const [index, tempFile] of tempFileList.entries()) {
if (!tempFile.id) {
continue;
}
photoItemList.value.push({
mimeType: fileList[index]?.type,
tempFileId: tempFile.id,
attachType: "ADDITIONAL",
url: AttachmentAPI.getTempReadURL(tempFile.id)
@@ -182,6 +211,7 @@ function buildPhotoItemList(attachmentList?: StoreDiary["attachmentList"]): Phot
return [{
attachment: item as Partial<Attachment>,
attachType: "ADDITIONAL",
mimeType: typeof item.mimeType === "string" ? item.mimeType : undefined,
previewUrl: getAttachmentReadURL(item.id),
url: getAttachmentReadURL(item.id, 90)
}];