file-lst
This commit is contained in:
parent
16791483c8
commit
39bf18035f
|
|
@ -7,6 +7,6 @@ import { initialize } from '../features';
|
|||
declare global {
|
||||
const OakPage: MakeOakPage<EntityDict, GeneralRuntimeContext<EntityDict>, typeof aspectDict, ReturnType<typeof initialize>>;
|
||||
const OakComponent: MakeOakComponent<EntityDict, GeneralRuntimeContext<EntityDict>, typeof aspectDict, ReturnType<typeof initialize>>;
|
||||
const generateNewId: () => Promise<string>;
|
||||
const generateNewId: (options?: { timestamp?: boolean }) => Promise<string>;
|
||||
}
|
||||
export {}
|
||||
|
|
@ -2,8 +2,8 @@ import { OpSchema as ExtraFile } from 'oak-app-domain/ExtraFile/Schema';
|
|||
|
||||
export function composeFileUrl(extraFile: Pick<ExtraFile, 'type' | 'bucket' | 'filename' | 'origin' | 'extra1'>) {
|
||||
const { type, bucket, filename, origin, extra1 } = extraFile;
|
||||
if (origin === 'unknown') {
|
||||
// 未知第三方源
|
||||
if (extra1) {
|
||||
// 有extra1就用extra1
|
||||
return extra1!;
|
||||
}
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
"node_modules",
|
||||
"**/*.spec.ts",
|
||||
"test",
|
||||
"scripts",
|
||||
"wechatMp"
|
||||
"scripts",/*
|
||||
"wechatMp" */
|
||||
]
|
||||
}
|
||||
|
|
@ -36,15 +36,14 @@ Component({
|
|||
sourceType,
|
||||
});
|
||||
if (errMsg !== 'chooseMedia:ok') {
|
||||
this.setData({
|
||||
oakError: {
|
||||
level: 'warning',
|
||||
msg: errMsg,
|
||||
},
|
||||
this.triggerEvent('error', {
|
||||
level: 'warning',
|
||||
msg: errMsg,
|
||||
});
|
||||
}
|
||||
else {
|
||||
const { globalData: { features } } = getApp();
|
||||
this.triggerEvent('add', tempFiles);
|
||||
/* const { globalData: { features } } = getApp();
|
||||
const { oakFullpath } = this.data;
|
||||
for (const file of tempFiles) {
|
||||
await features.runningNode.addNode({
|
||||
|
|
@ -52,16 +51,14 @@ Component({
|
|||
fileCarrier: new WechatMpFileCarrier(file),
|
||||
updateData: oakUpdateData,
|
||||
});
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
catch (err: any) {
|
||||
if (err.errMsg !== 'chooseMedia:fail cancel') {
|
||||
this.setData({
|
||||
oakError: {
|
||||
level: 'error',
|
||||
msg: err.errMsg,
|
||||
},
|
||||
this.triggerEvent('error', {
|
||||
level: 'error',
|
||||
msg: err.errMsg,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import assert from 'assert';
|
||||
import { EntityDict } from 'oak-app-domain';
|
||||
import { WechatMpFileCarrier } from 'oak-frontend-base';
|
||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||
OakComponent({
|
||||
entity: 'extraFile',
|
||||
formData: async (_rows, _features) => {
|
||||
return {
|
||||
src: composeFileUrl(_rows[0]!),
|
||||
}
|
||||
}
|
||||
}, {
|
||||
methods: {
|
||||
},
|
||||
lifetimes: {
|
||||
}
|
||||
});
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import assert from 'assert';
|
||||
import { EntityDict } from 'oak-app-domain';
|
||||
import { WechatMpFileCarrier } from 'oak-frontend-base';
|
||||
import { composeFileUrl } from '../../../../src/utils/extraFile';
|
||||
OakComponent({
|
||||
entity: 'extraFile',
|
||||
formData: async (_rows, _features, _fileCarrier) => {
|
||||
if (_fileCarrier) {
|
||||
const file = (<WechatMpFileCarrier<EntityDict, 'extraFile'>>_fileCarrier).getFile();
|
||||
return {
|
||||
src: file.tempFilePath || file.thumbTempFilePath,
|
||||
};
|
||||
}
|
||||
else {
|
||||
assert(_rows);
|
||||
return {
|
||||
src: composeFileUrl(_rows[0]!),
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
methods: {
|
||||
}
|
||||
});
|
||||
Loading…
Reference in New Issue