article upload
This commit is contained in:
parent
238caec56c
commit
b3b66c468f
|
|
@ -23,7 +23,7 @@ export default OakComponent({
|
|||
id: article?.id,
|
||||
content: article?.content,
|
||||
name: article?.name,
|
||||
articleMenuId: article?.articleMenuId
|
||||
articleMenuId: article?.articleMenuId,
|
||||
};
|
||||
},
|
||||
data: {
|
||||
|
|
@ -42,14 +42,14 @@ export default OakComponent({
|
|||
next.editor.setHtml(next.content);
|
||||
}
|
||||
},
|
||||
'oakId'(prev, next) {
|
||||
if(prev.oakId !== next.oakId) {
|
||||
oakId(prev, next) {
|
||||
if (prev.oakId !== next.oakId) {
|
||||
const { editor } = this.state;
|
||||
if (editor == null) return;
|
||||
editor.destroy();
|
||||
this.setEditor(null);
|
||||
if (editor == null) return;
|
||||
editor.destroy();
|
||||
this.setEditor(null);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
lifetimes: {
|
||||
async ready() {
|
||||
|
|
@ -62,7 +62,7 @@ export default OakComponent({
|
|||
const { editor } = this.state;
|
||||
editor?.setHtml('');
|
||||
this.update({
|
||||
content: ''
|
||||
content: '',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
@ -87,8 +87,11 @@ export default OakComponent({
|
|||
return result;
|
||||
},
|
||||
|
||||
uploadFile(extraFile: EntityDict['extraFile']['CreateSingle']['data']) {
|
||||
return this.features.extraFile.upload(extraFile);
|
||||
async uploadFile(
|
||||
extraFile: EntityDict['extraFile']['CreateSingle']['data']
|
||||
) {
|
||||
const result = await this.features.extraFile.upload(extraFile);
|
||||
return result;
|
||||
},
|
||||
|
||||
setEditor(editor: IDomEditor | null) {
|
||||
|
|
@ -110,7 +113,7 @@ export default OakComponent({
|
|||
this.state.html !== '<p><br></p>'
|
||||
) {
|
||||
await this.execute();
|
||||
if(this.props.changeIsEdit) {
|
||||
if (this.props.changeIsEdit) {
|
||||
this.props.changeIsEdit();
|
||||
}
|
||||
} else if (this.state.name && this.state.name.length > 0) {
|
||||
|
|
@ -118,7 +121,11 @@ export default OakComponent({
|
|||
content: '请填写文章内容!',
|
||||
type: 'warning',
|
||||
});
|
||||
} else if (this.state.content && this.state.content.length > 0 && this.state.html !== '<p><br></p>') {
|
||||
} else if (
|
||||
this.state.content &&
|
||||
this.state.content.length > 0 &&
|
||||
this.state.html !== '<p><br></p>'
|
||||
) {
|
||||
this.setMessage({
|
||||
content: '请填写文章标题!',
|
||||
type: 'warning',
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import { IToolbarConfig } from "@wangeditor/editor";
|
|||
import { EntityDict } from "./../../../oak-app-domain";
|
||||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import Style from "./web.module.less";
|
||||
import useFeatures from "../../../hooks/useFeatures";
|
||||
import {
|
||||
EyeOutlined,
|
||||
} from "@ant-design/icons";
|
||||
|
|
@ -98,8 +97,8 @@ export default function Render(
|
|||
gotoPreview,
|
||||
} = method;
|
||||
const { id, content, editor, origin1, oakFullpath, html, oakId, articleMenuId, changeIsEdit } = data;
|
||||
const features = useFeatures();
|
||||
const [articleId, setArticleId] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
if (id) {
|
||||
setArticleId(id);
|
||||
|
|
@ -169,8 +168,7 @@ export default function Render(
|
|||
|
||||
try {
|
||||
// 自己实现上传,并得到图片 url alt href
|
||||
const { url, bucket } =
|
||||
await features.extraFile.upload(extraFile);
|
||||
const { url, bucket } = await uploadFile(extraFile);
|
||||
extraFile.bucket = bucket;
|
||||
extraFile.extra1 = null;
|
||||
await addExtraFile(extraFile);
|
||||
|
|
@ -213,8 +211,7 @@ export default function Render(
|
|||
|
||||
try {
|
||||
// 自己实现上传,并得到图片 url alt href
|
||||
const { url, bucket } =
|
||||
await features.extraFile.upload(extraFile);
|
||||
const { url, bucket } = await uploadFile(extraFile);
|
||||
extraFile.bucket = bucket;
|
||||
extraFile.extra1 = null;
|
||||
await addExtraFile(extraFile);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import classNames from 'classnames';
|
|||
import Style from './web.module.less';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import useFeatures from '../../../hooks/useFeatures';
|
||||
|
||||
|
||||
export default function render(
|
||||
|
|
@ -27,7 +26,6 @@ export default function render(
|
|||
) {
|
||||
const { style, className, avatarUrl } = props.data;
|
||||
const { onPickByWeb } = props.methods;
|
||||
const features = useFeatures();
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import classNames from "classnames";
|
|||
import Style from "./web.module.less";
|
||||
import { WebComponentProps } from "oak-frontend-base";
|
||||
import { EntityDict } from "../../../oak-app-domain";
|
||||
import useFeatures from "../../../hooks/useFeatures";
|
||||
import { DndProvider, useDrag, useDrop } from "react-dnd";
|
||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||
import { TouchBackend } from "react-dnd-touch-backend";
|
||||
|
|
|
|||
Loading…
Reference in New Issue