diff --git a/lib/entities/ExtraFile.d.ts b/lib/entities/ExtraFile.d.ts index 8943645cc..8387b0ab5 100644 --- a/lib/entities/ExtraFile.d.ts +++ b/lib/entities/ExtraFile.d.ts @@ -1,6 +1,6 @@ import { String, Text } from 'oak-domain/lib/types/DataType'; -import { EntityShape } from 'oak-domain/lib/types/Entity'; -export interface Schema extends EntityShape { +import { FileCarrierEntityShape } from 'oak-domain/lib/types/Entity'; +export interface Schema extends FileCarrierEntityShape { origin: 'qiniu' | 'unknown'; type: 'image' | 'pdf' | 'video' | 'audio' | 'file'; bucket: String<16>; diff --git a/lib/utils/extraFile.d.ts b/lib/utils/extraFile.d.ts index 417cd8a5f..0c54ac062 100644 --- a/lib/utils/extraFile.d.ts +++ b/lib/utils/extraFile.d.ts @@ -1,3 +1,3 @@ import { OpSchema as ExtraFile } from 'oak-app-domain/ExtraFile/Schema'; -export declare function composeFileUrl(extraFile: ExtraFile): string; +export declare function composeFileUrl(extraFile: Pick): string; export declare function decomposeFileUrl(url: string): Pick; diff --git a/src/utils/extraFile.ts b/src/utils/extraFile.ts index aad4d27c3..c2df318bd 100644 --- a/src/utils/extraFile.ts +++ b/src/utils/extraFile.ts @@ -1,6 +1,6 @@ import { OpSchema as ExtraFile } from 'oak-app-domain/ExtraFile/Schema'; -export function composeFileUrl(extraFile: ExtraFile) { +export function composeFileUrl(extraFile: Pick) { const { type, bucket, filename, origin, extra1 } = extraFile; if (origin === 'unknown') { // 未知第三方源 diff --git a/tsconfig.json b/tsconfig.json index 991a93201..36ebcc2f7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -77,7 +77,7 @@ "node_modules", "**/*.spec.ts", "test", - "scripts",/* - "wechatMp" */ + "scripts", + "wechatMp" ] } \ No newline at end of file diff --git a/wechatMp/components/extraFile/upsert/index.json b/wechatMp/components/extraFile/upsert/index.json new file mode 100644 index 000000000..7a73a41bf --- /dev/null +++ b/wechatMp/components/extraFile/upsert/index.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/wechatMp/components/extraFile/upsert/index.less b/wechatMp/components/extraFile/upsert/index.less new file mode 100644 index 000000000..3c7738f92 --- /dev/null +++ b/wechatMp/components/extraFile/upsert/index.less @@ -0,0 +1,5 @@ +/** index.wxss **/ +.container { + display: block; +} + diff --git a/wechatMp/components/extraFile/upsert/index.ts b/wechatMp/components/extraFile/upsert/index.ts index c7c487162..e4272faf4 100644 --- a/wechatMp/components/extraFile/upsert/index.ts +++ b/wechatMp/components/extraFile/upsert/index.ts @@ -1,17 +1,22 @@ +import assert from 'assert'; import { WechatMpFileCarrier } from 'oak-frontend-base'; +import { composeFileUrl } from '../../../../src/utils/extraFile'; OakComponent({ entity: 'extraFile', formData: async (_rows, _features, _fileCarrier) => { - return { - name: 1, + if (_fileCarrier) { + return { + src: '11', + }; + } + else { + assert(_rows); + return { + src: composeFileUrl(_rows[0]!), + } } } }, { methods: { - async onFilePicked() { - const fileCarrier = new WechatMpFileCarrier(); - - this.setFileCarrier(fileCarrier); - } } }); \ No newline at end of file diff --git a/wechatMp/components/extraFile/upsert/index.wxml b/wechatMp/components/extraFile/upsert/index.wxml new file mode 100644 index 000000000..d6a6c04c3 --- /dev/null +++ b/wechatMp/components/extraFile/upsert/index.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/wechatMp/pages/token/me/index.ts b/wechatMp/pages/token/me/index.ts index bb8fbf4e8..9ff734e10 100644 --- a/wechatMp/pages/token/me/index.ts +++ b/wechatMp/pages/token/me/index.ts @@ -23,6 +23,7 @@ OakPage({ objectId: 1, filename: 1, extra1: 1, + type: 1, }, filter: { tag1: 'avatar', diff --git a/wechatMp/pages/user/manage/detail/index.ts b/wechatMp/pages/user/manage/detail/index.ts index b67c5ad3d..191943013 100644 --- a/wechatMp/pages/user/manage/detail/index.ts +++ b/wechatMp/pages/user/manage/detail/index.ts @@ -21,6 +21,7 @@ OakPage({ objectId: 1, filename: 1, extra1: 1, + type: 1, }, filter: { tag1: 'avatar', diff --git a/wechatMp/pages/user/manage/index.ts b/wechatMp/pages/user/manage/index.ts index b0fbd4131..acdffb56d 100644 --- a/wechatMp/pages/user/manage/index.ts +++ b/wechatMp/pages/user/manage/index.ts @@ -20,6 +20,7 @@ OakPage({ objectId: 1, filename: 1, extra1: 1, + type: 1, }, filter: { tag1: 'avatar',