diff --git a/mock/cfc/mock/upload/image.json b/mock/cfc/mock/upload/image.json index 3e4cf0ac8..968e00a88 100755 --- a/mock/cfc/mock/upload/image.json +++ b/mock/cfc/mock/upload/image.json @@ -1,11 +1,5 @@ { - "status": 0, - "msg": "ok", - "data": { - "value": - "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg", - "url": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg", - "filename": "dog.jpg" - } - } - \ No newline at end of file + "status": 0, + "msg": "ok", + "link": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg" +} diff --git a/src/renderers/Form/InputRichText.tsx b/src/renderers/Form/InputRichText.tsx index be906ce84..2a7d2f666 100644 --- a/src/renderers/Form/InputRichText.tsx +++ b/src/renderers/Form/InputRichText.tsx @@ -3,6 +3,7 @@ import {FormItem, FormControlProps, FormBaseControl} from './Item'; import cx from 'classnames'; import LazyComponent from '../../components/LazyComponent'; import {tokenize} from '../../utils/tpl-builtin'; +import {normalizeApi} from '../../utils/api'; /** * RichText @@ -189,7 +190,16 @@ export default class RichTextControl extends React.Component< const formData = new FormData(); formData.append('file', blobInfo.blob(), blobInfo.filename()); try { - const response = await fetcher(props.receiver, formData, { + const receiver = { + adaptor: (payload: object) => { + return { + ...payload, + data: payload + }; + }, + ...normalizeApi(props.receiver) + }; + const response = await fetcher(receiver, formData, { method: 'post' }); if (response.ok) {