From 61d4bef11bb712be61323bef47515436e62292bb Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Wed, 27 May 2020 17:45:23 +0800
Subject: [PATCH] 2
---
SunshineIns/src/page/ArticleEidt.jsx | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/SunshineIns/src/page/ArticleEidt.jsx b/SunshineIns/src/page/ArticleEidt.jsx
index 51588eb..08efc4b 100644
--- a/SunshineIns/src/page/ArticleEidt.jsx
+++ b/SunshineIns/src/page/ArticleEidt.jsx
@@ -46,7 +46,7 @@
this.setState({
savedate: res,
selectedRow: res.companyList || [],
- fileList: res.attachments || [],
+ fileList: res.attachments ? res.attachments.map((item, index) => ({ uid: item.uid, id: item.uid, name: item.name, status: 'done', url: domain + `api/v1/attachment/downloadDisk/${item.uid}?online=false` })) : [],
cover: res.cover || [],
editorState: BraftEditor.createEditorState(res.content),
dateSource: res.channelList || []
@@ -89,6 +89,10 @@
const list = this.state.selectedRow.map(({ id }) => id);
const { savedate } = this.state;
savedate.list = list;
+ if (!savedate.title) {
+ message.warning("请输入信息标题");
+ return;
+ }
if (!savedate.channelIdd) {
message.warning("请选择信息分类");
return;
@@ -174,6 +178,17 @@
xhr.open('POST', serverURL, true)
xhr.send(fd)
}
+ handleEditorChange = (editorState) => {
+ this.setState({ editorState })
+ const htmlContent = editorState.toHTML()
+ console.log(htmlContent)
+ this.setState(({ savedate }) => ({
+ savedate: {
+ ...savedate,
+ content: htmlContent
+ }
+ }))
+ }
submitContent = () => {
// 在编辑器获得焦点时按下ctrl+s会执行此方法
@@ -187,9 +202,6 @@
}))
}
- handleEditorChange = (editorState) => {
- this.setState({ editorState })
- }
render() {
const { dateSource, show, visible, closeKey, selectedRow, savedate, fileList, editorState } = this.state;
@@ -272,7 +284,7 @@
<Col span={18} push={0} style={{ border: 'solid 1px rgba(0, 0, 0, 0.25)', borderRadius: '5PX' }} >
<BraftEditor
value={editorState}
- placeholder='请输入文章内容'
+ placeholder='请输入活动进程'
media={{
allowPasteImage: true, // 是否允许直接粘贴剪贴板图片(例如QQ截图等)到编辑器
image: true, // 开启图片插入功能
--
Gitblit v1.8.0