diff --git a/public/react/build.zip b/public/react/build.zip
new file mode 100644
index 000000000..bcc9974cf
Binary files /dev/null and b/public/react/build.zip differ
diff --git a/public/react/src/modules/developer/studentStudy/index.scss b/public/react/src/modules/developer/studentStudy/index.scss
index 68835f2ce..aaebee9af 100644
--- a/public/react/src/modules/developer/studentStudy/index.scss
+++ b/public/react/src/modules/developer/studentStudy/index.scss
@@ -1,6 +1,52 @@
@import '../split_pane_resizer.scss';
.split-pane-area{
height: calc(100vh - 65px);
+
+ .right_pane_code_wrap{
+ position: relative;
+
+ .editor_nodte_area,
+ .student_notes{
+ position: absolute;
+ z-index: 100;
+ }
+ .student_notes{
+ right: 0px;
+ top: 50%;
+ width: 36px;
+ height: 36px;
+ margin-top: -18px;
+ border-radius: 50%;
+ background: #5091FF;
+ color: #fff;
+ font-size: 18px;
+ text-align: center;
+ transform: translateX(18px);
+ cursor: pointer;
+ opacity: 0.5;
+ transition: all .3s;
+ &:hover{
+ opacity: 1;
+ transform: translateX(-10px);
+ }
+ }
+ .editor_nodte_area{
+ right: 10px;
+ top: 50%;
+ width: 450px;
+ height: 200px;
+ margin-top: -100px;
+ background: #fff;
+ border-radius: 5px;
+ padding: 14px 10px 0;
+ // opacity: ;
+ transform: translateX(500px);
+ transition: all .3s;
+ &.active{
+ transform: translateX(0px);
+ }
+ }
+ }
}
.right_pane_code_wrap{
diff --git a/public/react/src/modules/developer/studentStudy/rightpane/index.js b/public/react/src/modules/developer/studentStudy/rightpane/index.js
index 054997359..cf264c67b 100644
--- a/public/react/src/modules/developer/studentStudy/rightpane/index.js
+++ b/public/react/src/modules/developer/studentStudy/rightpane/index.js
@@ -3,15 +3,20 @@
* @Author: tangjiang
* @Github:
* @Date: 2019-11-27 14:59:51
- * @LastEditors: tangjiang
- * @LastEditTime: 2019-12-20 14:01:57
+ * @LastEditors : tangjiang
+ * @LastEditTime : 2019-12-26 17:56:51
*/
import React, { useState, useEffect } from 'react';
import {connect} from 'react-redux';
import MyMonacoEditor from '../../components/myMonacoEditor';
import ControlSetting from '../../components/controlSetting';
import actions from '../../../../redux/actions';
-
+// import QuillForEditor from '../../../../common/quillForEditor';
+// import TextArea from 'antd/lib/input/TextArea';
+import { Input, Form, Button } from 'antd';
+// import FormItem from 'antd/lib/form/FormItem';
+const { TextArea } = Input;
+const FormItem = Form.Item;
const RightPane = (props) => {
const {
@@ -20,6 +25,7 @@ const RightPane = (props) => {
submitUserCode,
input,
hack,
+ loading,
notice,
updateCode,
hadCodeUpdate,
@@ -27,12 +33,15 @@ const RightPane = (props) => {
updateNotice,
saveUserInputCode,
restoreInitialCode,
- saveOpacityType,
- saveUserCodeForInterval
+ // saveOpacityType,
+ saveUserCodeForInterval,
+ addNotes,
+ changeLoadingState
} = props;
const [editorCode, setEditorCode] = useState('');
-
+ const [noteClazz, setNoteClazz] = useState('editor_nodte_area');
+ const [noteCount] = useState(5000);
let initFlag = true;
useEffect(() => {
if (editor_code) {
@@ -86,6 +95,28 @@ const RightPane = (props) => {
updateNotice && updateNotice();
};
+ const handleClickNote = () => {
+ setNoteClazz('editor_nodte_area active');
+ }
+
+ const handleCancelNote = () => {
+ props.form.resetFields();
+ setNoteClazz('editor_nodte_area');
+ }
+
+ const handleSubmitNote = () => {
+ props.form.validateFields((err, values) => {
+ if (!err) {
+ changeLoadingState(true);
+ addNotes(identifier, values, function () {
+ setNoteClazz('editor_nodte_area');
+ props.form.resetFields();
+ });
+ }
+ });
+ }
+
+ const { getFieldDecorator } = props.form;
return (
{
onUpdateNotice={handleUpdateNotice}
onRestoreInitialCode={handleRestoreInitialCode}
/>
+
+
+
+ {/*
+
+
*/}
+
+
+
+
{
notice,
hadCodeUpdate
} = state.ojForUserReducer;
+ const {
+ loading
+ } = state.commonReducer;
// const { language, code } = hack;
return {
hack,
notice,
+ loading,
hadCodeUpdate,
editor_code,
input: userTestInput,
@@ -141,9 +210,12 @@ const mapDispatchToProps = (dispatch) => ({
// 恢复初始代码
restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)),
// saveOpacityType: (type) => dispatch(actions.saveOpacityType(type))
+ // 添加笔记
+ addNotes: (identifier, params, cb) => dispatch(actions.addNotes(identifier, params, cb)),
+ changeLoadingState: (flag) => dispatch(actions.changeLoadingState(flag))
});
export default connect(
mapStateToProps,
mapDispatchToProps
-)(RightPane);
\ No newline at end of file
+)(Form.create()(RightPane));
\ No newline at end of file
diff --git a/public/react/src/redux/actions/actionTypes.js b/public/react/src/redux/actions/actionTypes.js
index 2c83176b4..73e3ea0b2 100644
--- a/public/react/src/redux/actions/actionTypes.js
+++ b/public/react/src/redux/actions/actionTypes.js
@@ -56,7 +56,8 @@ const types = {
CLEAR_OJ_FOR_USER_REDUCER: 'CLEAR_OJ_FOR_USER_REDUCER', // 退出时清空 ojForUserReducer保存内容
ADD_OJ_LIKE_COUNT: 'ADD_OJ_LIKE_COUNT', // 增加点赞数
CHANGE_RECORD_PAGINATION_PAGE: 'CHANGE_RECORD_PAGINATION_PAGE', // 改变提交分页
- UPDATE_OJ_FOR_USER_COMMENT_COUNT: 'UPDATE_OJ_FOR_USER_COMMENT_COUNT', // 更新 hack 中的评论数
+ UPDATE_OJ_FOR_USER_COMMENT_COUNT: 'UPDATE_OJ_FOR_USER_COMMENT_COUNT', // 更新 hack 中的评论数,
+ UPDATE_NOTE_CONTENT: 'UPDATE_NOTE_CONTENT', // 更新笔记内容
/*** jupyter */
GET_JUPYTER_DATA_SETS: 'GET_JUPYTER_DATA_SETS', // jupyter 数据集
GET_JUPYTER_TPI_URL: 'GET_JUPYTER_TPI_URL', // 获取 jupyter url
diff --git a/public/react/src/redux/actions/index.js b/public/react/src/redux/actions/index.js
index 6086c2b32..988a0a469 100644
--- a/public/react/src/redux/actions/index.js
+++ b/public/react/src/redux/actions/index.js
@@ -50,7 +50,8 @@ import {
saveEditorCodeForDetail,
saveOpacityType,
clearOjForUserReducer,
- changeRecordPagination
+ changeRecordPagination,
+ addNotes
// isUpdateCodeCtx
} from './ojForUser';
@@ -137,6 +138,7 @@ export default {
saveOpacityType,
clearOjForUserReducer,
changeRecordPagination,
+ addNotes,
// jupyter
getJupyterTpiDataSet,
getJupyterTpiUrl,
diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js
index 783c41e6a..ee78d336e 100644
--- a/public/react/src/redux/actions/ojForUser.js
+++ b/public/react/src/redux/actions/ojForUser.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:42:11
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-25 14:27:58
+ * @LastEditTime : 2019-12-26 18:32:08
*/
import types from "./actionTypes";
import { Base64 } from 'js-base64';
@@ -17,7 +17,8 @@ import {
fetchUserCommitRecordDetail,
fetchUpdateCode,
fetchUserCodeSubmit,
- fetchRestoreInitialCode
+ fetchRestoreInitialCode,
+ fetchAddNotes
} from "../../services/ojService";
import { notification } from "antd";
@@ -488,3 +489,33 @@ export const changeRecordPagination = (page) => {
}
}
// 更新通知状态
+
+// 添加笔记
+export const addNotes = (identifier, params, cb) => {
+ return (dispatch) => {
+ fetchAddNotes(identifier, params).then(res => {
+ // console.log('添加笔记成功===>>', res);
+ dispatch({
+ type: types.LOADING_STATUS,
+ payload: false
+ });
+ const { data } = res;
+ if (data.status === 0) {
+ cb && cb();
+ notification.success({
+ message: '提示',
+ description: '添加笔记成功'
+ });
+ dispatch({
+ type: types.UPDATE_NOTE_CONTENT,
+ payload: params.notes
+ })
+ }
+ }).catch(() => {
+ dispatch({
+ type: types.LOADING_STATUS,
+ payload: false
+ });
+ })
+ }
+}
\ No newline at end of file
diff --git a/public/react/src/redux/reducers/ojForUserReducer.js b/public/react/src/redux/reducers/ojForUserReducer.js
index e42acefdf..eeaa3c6ca 100644
--- a/public/react/src/redux/reducers/ojForUserReducer.js
+++ b/public/react/src/redux/reducers/ojForUserReducer.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-27 13:41:48
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-26 13:39:41
+ * @LastEditTime : 2019-12-26 18:34:56
*/
import types from "../actions/actionTypes";
import { Base64 } from 'js-base64';
@@ -218,6 +218,13 @@ const ojForUserReducer = (state = initialState, action) => {
...state,
hack: Object.assign({}, state.hack, { comments_count: _comments_count })
}
+ // 修改笔记内容
+ case types.UPDATE_NOTE_CONTENT:
+ const _hack1 = Object.assign({}, state.hack, {notes: action.payload });
+ return {
+ ...state,
+ hack: _hack1
+ }
default:
return state;
}
diff --git a/public/react/src/services/ojService.js b/public/react/src/services/ojService.js
index 8831f8c11..a1a507b40 100644
--- a/public/react/src/services/ojService.js
+++ b/public/react/src/services/ojService.js
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 10:55:38
* @LastEditors : tangjiang
- * @LastEditTime : 2019-12-25 14:27:30
+ * @LastEditTime : 2019-12-26 17:37:38
*/
import axios from 'axios';
@@ -137,3 +137,9 @@ export async function fetchUploadImageUrl (id) {
const url = `/attachments/${id}`;
return axios.get(url);
}
+
+// 添加笔记
+export async function fetchAddNotes (identifier, params) {
+ const url = `/myproblems/${identifier}/add_notes.json`;
+ return axios.post(url, params);
+}
\ No newline at end of file