Commit 081a800d by end

修复资讯新建bug

parent f7d999b5
No preview for this file type
......@@ -21,17 +21,23 @@ class Editor extends PureComponent {
};
}
componentDidMount() {
const { importContent,type } = this.props;
if(type==='look'){
const { importContent, type } = this.props;
console.log("importContent11111111", type);
if (type === 'look') {
this.setState({
readOnly:true,
readOnly: true,
editorState: BraftEditor.createEditorState(importContent)
})
}
if (importContent) {
} else if (type === 'edit' && importContent) {
this.setState({
editorState: BraftEditor.createEditorState(importContent), // 更新 editorState
});
} else {
this.setState({
editorState: BraftEditor.createEditorState(''),
})
}
this.props.gupfetch();
}
......@@ -265,9 +271,8 @@ class Editor extends PureComponent {
const fd = new FormData();
// 文件名时间戳
const time = new Date().getTime();
const fileName = `${param.id + time}.${
param.file.name.split(".")[param.file.name.split(".").length - 1]
}`;
const fileName = `${param.id + time}.${param.file.name.split(".")[param.file.name.split(".").length - 1]
}`;
// fd.append("name", param.file.name);
// fd.append("Filename", `${uploadParam.dir}/${fileName}`);
// fd.append("key", `${uploadParam.dir}/${fileName}`);
......
......@@ -613,6 +613,13 @@ class addEdit extends React.Component {
importContent={seeEdit && seeEdit.content}
type="look"
/>
) : type == "edit" ? (
<Editor
key={this.props.keyValue}
cbReceiver={this.getEditorHtml}
importContent={seeEdit && seeEdit.content}
type="edit"
/>
) : (
// <Input />
<Editor
......
......@@ -166,62 +166,6 @@ class TreeItem extends React.Component {
postEditNewsLists({ parentId: data.parentId, id: data.id, ...values });
}
this.setState({ visible: false });
// this.props.form.validateFields((errors, values) => {
// if (!!errors) {
// error = errors;
// // this.setState({
// // loading: false
// // })
// return error;
// } else {
// console.log(values);
// if (this.state.name === "新增分类") {
// let param = '';
// param = ({
// // 分类名称
// "name": this.state.editData.key,
// // 描述
// "description": this.state.editData.des,
// })
//
// this.props.onTrainKindSave(param, (code, msg) => {
// if (code === '1000') {
// message.success("分类保存成功");
// this.props.onTrainKind();
//
// } else if (code !== '1000') {
// message.error("分类保存失败" + msg);
// return;
// }
// })
// this.setState({visible: false});
// this.props.form.resetFields();
// }
// if (this.state.name === "编辑分类") {
// let param = '';
// param = ({
// // 项目id
// "id": data.id,
// // 分类名称
// "name": this.state.editData.key,
// // 描述
// "description": this.state.editData.des,
// })
//
// this.props.onTrainKindUpdate(param, (code, msg) => {
// if (code === '1000') {
// message.success("分类保存成功");
// this.props.onTrainKind();
// } else if (code !== '1000') {
// message.error("分类保存失败" + msg);
// return;
// }
// })
// setTimeout(() => {
// this.setState({visible: false});
// }, 1000);
// }
// }
});
}
......@@ -247,25 +191,7 @@ class TreeItem extends React.Component {
reRrainlist(e) {
const { data, parentID } = this.props;
//6364 为了初始状态 不添加分类直接在新闻上添加内容
// if (data.id != parentID[1].id) {
this.props.onTableList({ typeId: data.id, pageNo: 1, pageSize: 20 });
// }
//
// if (data.key === '项目分类') {
// this.props.reRrainlist({
// pageNo: 1,
// pageSize: 10,
// })
// // this.props.tpClassifiId('ALL');
// } else {
// // this.props.reRrainlist({
// // pageNo:1,
// // pageSize:10,
// // tpClassificationId : id,
// // })
// // this.props.tpClassifiId(id);
// }
}
render() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment