merge Attachment metadata/ext
This commit is contained in:
@ -5,7 +5,7 @@ import IOSize, { Unit } from "../../../utils/IOSize";
|
||||
import Time from "../../../utils/Time";
|
||||
import Toolkit from "../../../utils/Toolkit";
|
||||
import { Location, MediaItemType } from "../../../types/UI";
|
||||
import { MediaAttachExt } from "../../../types/Attachment";
|
||||
import { PreviewImageMetadata } from "../../../types/Attachment";
|
||||
import { MomentApi } from "../../../api/MomentApi";
|
||||
import { JournalApi } from "../../../api/JournalApi";
|
||||
import { Network } from "../../../utils/Network";
|
||||
@ -134,12 +134,12 @@ Page({
|
||||
}
|
||||
this.setData({
|
||||
list: list.map((item: any) => {
|
||||
const ext = JSON.parse(item.ext) as MediaAttachExt;
|
||||
const metadata = (typeof item.metadata === "string" ? JSON.parse(item.metadata) : item.metadata) as PreviewImageMetadata;
|
||||
const thumbURL = `${config.url}/attachment/read/${item.mongoId}`;
|
||||
const sourceURL = `${config.url}/attachment/read/${ext.sourceMongoId}`;
|
||||
const sourceURL = `${config.url}/attachment/read/${metadata.sourceMongoId}`;
|
||||
return {
|
||||
id: item.id,
|
||||
type: ext.isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO,
|
||||
type: metadata.isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO,
|
||||
thumbURL,
|
||||
sourceURL,
|
||||
checked: false
|
||||
@ -259,12 +259,12 @@ Page({
|
||||
const list = await MomentApi.create(tempFileIds);
|
||||
wx.showToast({ title: "上传成功", icon: "success" });
|
||||
const added = list.map((item: any) => {
|
||||
const ext = JSON.parse(item.ext) as MediaAttachExt;
|
||||
const metadata = (typeof item.metadata === "string" ? JSON.parse(item.metadata) : item.metadata) as PreviewImageMetadata;
|
||||
const thumbURL = `${config.url}/attachment/read/${item.mongoId}`;
|
||||
const sourceURL = `${config.url}/attachment/read/${ext.sourceMongoId}`;
|
||||
const sourceURL = `${config.url}/attachment/read/${metadata.sourceMongoId}`;
|
||||
return {
|
||||
id: item.id,
|
||||
type: ext.isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO,
|
||||
type: metadata.isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO,
|
||||
thumbURL,
|
||||
sourceURL,
|
||||
checked: false
|
||||
|
||||
Reference in New Issue
Block a user