update AIChart, customer followup, media selector
This commit is contained in:
@@ -21,6 +21,10 @@ function normalizeUploadImageFile(source: File, compressed: Blob): File {
|
||||
* 压缩上传图片,统一限制到 300 KB。
|
||||
*/
|
||||
export async function compressUploadImage(file: File): Promise<File> {
|
||||
if (!file.type.startsWith("image/")) {
|
||||
return file;
|
||||
}
|
||||
|
||||
const compressedFile = await imageCompression(file, {
|
||||
maxSizeMB: PHOTO_MAX_SIZE_MB,
|
||||
maxWidthOrHeight: PHOTO_MAX_WIDTH_OR_HEIGHT,
|
||||
|
||||
@@ -19,6 +19,13 @@ export const permissionCodes = {
|
||||
update: "GAO:CUSTOMER:UPDATE",
|
||||
delete: "GAO:CUSTOMER:DELETE"
|
||||
},
|
||||
customerFollowUpReminder: {
|
||||
create: "GAO:CUSTOMER_FOLLOW_UP_REMINDER:CREATE",
|
||||
read: "GAO:CUSTOMER_FOLLOW_UP_REMINDER:READ",
|
||||
update: "GAO:CUSTOMER_FOLLOW_UP_REMINDER:UPDATE",
|
||||
delete: "GAO:CUSTOMER_FOLLOW_UP_REMINDER:DELETE",
|
||||
complete: "GAO:CUSTOMER_FOLLOW_UP_REMINDER:COMPLETE"
|
||||
},
|
||||
event: {
|
||||
create: "GAO:EVENT:CREATE",
|
||||
read: "GAO:EVENT:READ",
|
||||
@@ -178,6 +185,11 @@ export const gaoStoreScopePermissionCodes = [
|
||||
permissionCodes.customer.export,
|
||||
permissionCodes.customer.update,
|
||||
permissionCodes.customer.delete,
|
||||
permissionCodes.customerFollowUpReminder.create,
|
||||
permissionCodes.customerFollowUpReminder.read,
|
||||
permissionCodes.customerFollowUpReminder.update,
|
||||
permissionCodes.customerFollowUpReminder.delete,
|
||||
permissionCodes.customerFollowUpReminder.complete,
|
||||
permissionCodes.storeDiary.create,
|
||||
permissionCodes.storeDiary.read,
|
||||
permissionCodes.storeDiary.update,
|
||||
|
||||
+13
-5
@@ -2,14 +2,22 @@ import { AttachmentAPI } from "timi-web-api";
|
||||
import type { PhotoItem } from "@/types/Photo";
|
||||
import { compressUploadImageList } from "@/utils/imageCompression";
|
||||
|
||||
/** 压缩并上传照片,返回可直接交给照片滚动组件展示的临时附件。 */
|
||||
/** 压缩图片、直传视频,返回可直接交给媒体选择组件展示的临时附件。 */
|
||||
export async function uploadPhotoList(fileList: File[]): Promise<PhotoItem[]> {
|
||||
const tempFileList = await AttachmentAPI.upload(await compressUploadImageList(fileList));
|
||||
return tempFileList
|
||||
.filter(item => !!item.id)
|
||||
.map(item => ({
|
||||
return tempFileList.flatMap((item, index) => {
|
||||
if (!item.id) {
|
||||
return [];
|
||||
}
|
||||
return [{
|
||||
attachment: {
|
||||
mimeType: fileList[index]?.type,
|
||||
name: fileList[index]?.name
|
||||
},
|
||||
tempFileId: item.id,
|
||||
attachType: "PHOTO",
|
||||
mimeType: fileList[index]?.type,
|
||||
url: AttachmentAPI.getTempReadURL(item.id || "")
|
||||
}));
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user