diff --git a/public/react/src/common/components/comment/CommentForm.js b/public/react/src/common/components/comment/CommentForm.js index 484940807..3f1e16170 100644 --- a/public/react/src/common/components/comment/CommentForm.js +++ b/public/react/src/common/components/comment/CommentForm.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-17 17:32:55 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 16:50:43 + * @LastEditTime : 2020-01-06 18:42:09 */ import './index.scss'; import React, { useState } from 'react'; @@ -28,11 +28,12 @@ function CommentForm (props) { const [focus, setFocus] = useState(false); const options = [ - ['bold', 'italic', 'underline'], - [{header: [1,2,3,false]}], - ['blockquote', 'code-block'], - ['link', 'image'], - ['formula'] + // ['bold', 'italic', 'underline'], + // [{header: [1,2,3,false]}], + 'code-block', + 'link', + 'image', + 'formula' ]; // const { form: { getFieldDecorator } } = props; const [showQuill, setShowQuill] = useState(false); diff --git a/public/react/src/common/quillForEditor/index.scss b/public/react/src/common/quillForEditor/index.scss index eca8c4485..dd4eb0349 100644 --- a/public/react/src/common/quillForEditor/index.scss +++ b/public/react/src/common/quillForEditor/index.scss @@ -1,4 +1,6 @@ .quill_editor_for_react_area{ + // background: #fff; + // margin: 0 15px; .ql-editing{ left: 0 !important; } diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index 680229b2d..f443e4975 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,11 +4,11 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-03 18:56:36 + * @LastEditTime : 2020-01-07 15:04:51 */ import './index.scss'; import React, { useState, useEffect } from 'react'; -import { Select, notification } from 'antd'; +import { Select, notification, Modal, Form, Input, Button } from 'antd'; const { Option } = Select; @@ -17,7 +17,10 @@ function KnowLedge (props) { const { options = [], // 下拉选项 values = [], // 已选择的下拉项 - onChange // 获取选择的值 + onChange, // 获取选择的值 + form, + showAdd, // 显示新增图标 + addKnowledge // 调用新增知识点接口 } = props; useEffect(() => { @@ -38,9 +41,12 @@ function KnowLedge (props) { const [selectOptions, setSelectOptions] = useState(options); // 已选择的下拉项 const [selectValue, setSelectValue] = useState([]); + const [visible, setVisible] = useState(false); // const [value] = useState([]); + const { getFieldDecorator } = form; + const FormItem = Form.Item; // 渲染下拉选项 const renderOptions = (options = []) => { return options.map((opt, i) => ( @@ -114,15 +120,75 @@ function KnowLedge (props) { ) } + // 添加知识点 + const handleAddKnowledge = () => { + setVisible(true); + }; + + const handleResetForm = () => { + form.resetFields(); + setVisible(false); + } + + const handleSubmitForm = (e) => { + e.preventDefault(); + form.validateFieldsAndScroll((err, values) => { + if (err) { + return; + } + setVisible(false); + form.resetFields(); + // console.log(values); + addKnowledge && addKnowledge(values); + }) + } + + const _styles = { + display: showAdd ? 'inline-block' : 'none' + }; + return ( -