diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1a8ea567b..c0905e89c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -259,6 +259,7 @@ class ApplicationController < ActionController::Base # reacct静态资源加载不需要走这一步 return if params[:controller] == "main" # Find the current user + Rails.logger.info("current_laboratory is #{current_laboratory} domain is #{request.subdomain}") User.current = find_current_user uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous")) @@ -678,4 +679,5 @@ class ApplicationController < ActionController::Base HotSearchKeyword.add(keyword) end + end diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 976317107..641dcae2d 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -85,7 +85,7 @@ class HackUserLastestCodesController < ApplicationController testCase = ojEvaResult['testCase'] # 只有编译出错时,才正则匹配错误行数 error_line= - if params[:status] == "-4" + if ojEvaResult['status'] == "4" || ojEvaResult['status'] == "5" regular_match_error_line ojEvaResult['outPut'], @my_hack.hack.language end # debug 与submit 公用的参数 @@ -148,11 +148,12 @@ class HackUserLastestCodesController < ApplicationController # 正则错误行数 def regular_match_error_line content, language content = Base64.decode64(content).force_encoding("utf-8") + logger.info("######content: #{content}") case language when 'Java' content.scan(/.java.\d+/).map{|s| s.match(/\d+/)[0].to_i}.min when 'C', 'C++' - content.scan(/\d:\d+: error/).map{|s| s.match(/\d+/)[0]}.min + content.scan(/\d:\d+:/).map{|s| s.match(/\d+/)[0]}.min when 'Python' content.scan(/line \d+/).map{|s| s.match(/\d+/)[0].to_i}.min end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 3a60dcde5..89f65c61d 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1046,7 +1046,7 @@ class HomeworkCommonsController < ApplicationController course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) # 去掉不对当前用户的单位公开的实训,已发布的实训 - stage.shixuns.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun| + stage.shixuns.no_jupyter.where.not(shixuns: {id: none_shixun_ids}).unhidden.each do |shixun| homework = HomeworksService.new.create_homework shixun, @course, category, current_user @homework_ids << homework.id CreateStudentWorkJob.perform_later(homework.id) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index c871c3064..8a752106c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -772,7 +772,7 @@ class ShixunsController < ApplicationController # jupyter开启挑战 def jupyter_exec - begin + if is_shixun_opening? tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") end @@ -786,22 +786,23 @@ class ShixunsController < ApplicationController commit_id = commit["id"] cloud_bridge = edu_setting('cloud_bridge') myshixun_identifier = generate_identifier Myshixun, 10 - ActiveRecord::Base.transaction do - @myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, - modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, - onclick_time: Time.now, commit_id: commit_id) - # fork仓库 - project_fork(@myshixun, @repo_path, current_user.login) - rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) - uri = "#{cloud_bridge}/bridge/game/openGameInstance" - params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last} - interface_post uri, params, 83, "服务器出现问题,请重置环境" + begin + ActiveRecord::Base.transaction do + @myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, + modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, + onclick_time: Time.now, commit_id: commit_id) + # fork仓库 + project_fork(@myshixun, @repo_path, current_user.login) + rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) + uri = "#{cloud_bridge}/bridge/game/openGameInstance" + params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last} + interface_post uri, params, 83, "服务器出现问题,请重置环境" + end + rescue => e + uid_logger_error(e.message) + tip_exception("服务器出现问题,请重置环境") end end - rescue => e - uid_logger_error(e.message) - tip_exception(e.message) - end end def publish diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 0009ab2a6..2c1b5a810 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -255,7 +255,7 @@ class SubjectsController < ApplicationController CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework", course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) - stage.shixuns.where(id: params[:shixun_ids], status: 2).each do |shixun| + stage.shixuns.no_jupyter.where(id: params[:shixun_ids], status: 2).each do |shixun| homework = HomeworksService.new.create_homework shixun, @course, category, current_user homework_ids << homework.id end diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 9522c54da..d8a41ba6a 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -83,6 +83,7 @@ class Shixun < ApplicationRecord scope :publiced, lambda{ where(public: 2) } scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) } scope :find_by_ids,lambda{|k| where(id:k)} + scope :no_jupyter, -> { where(is_jupyter: false) } after_create :send_tiding #同步到trustie diff --git a/app/views/hack_user_lastest_codes/show.json.jbuilder b/app/views/hack_user_lastest_codes/show.json.jbuilder index a158d074f..04b066aa0 100644 --- a/app/views/hack_user_lastest_codes/show.json.jbuilder +++ b/app/views/hack_user_lastest_codes/show.json.jbuilder @@ -1,7 +1,8 @@ json.hack do json.(@hack, :id, :name, :difficult, :time_limit, :description, :score, :identifier, :status, :praises_count) json.language @hack.language - json.username @hack.user.real_name + json.username @hack.user&.real_name + json.user_path "/users/#{@hack.user&.login}" json.code @my_hack.code json.pass_count @hack.pass_num json.submit_count @hack.submit_num @@ -19,5 +20,4 @@ json.user do json.partial! 'users/user', user: current_user json.hack_manager @hack.manager?(current_user) json.admin current_user.admin_or_business? - end \ No newline at end of file diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 7bda233fe..66adaf482 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -3484,3 +3484,16 @@ a.singlepublishtwo{ text-align: justify; word-break: break-all; } + +.RightPaneDrawer .ant-drawer-content{ + background: #070f1a; + overflow: hidden !important; +} + +.deletebuttom{ + border: transparent; +} + +.RightPaneDrawer .jupyter_data_list{ + max-height: 340px; +} \ No newline at end of file diff --git a/public/react/src/App.js b/public/react/src/App.js index b045974df..268fb89d1 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -757,6 +757,7 @@ class App extends Component { (props) => () } /> () } /> diff --git a/public/react/src/common/components/comment/CommentForm.js b/public/react/src/common/components/comment/CommentForm.js index da4814a9e..484940807 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-26 18:43:21 + * @LastEditTime : 2019-12-27 16:50:43 */ import './index.scss'; import React, { useState } from 'react'; @@ -25,6 +25,7 @@ function CommentForm (props) { const { getFieldDecorator } = form; const [ctx, setCtx] = useState(''); + const [focus, setFocus] = useState(false); const options = [ ['bold', 'italic', 'underline'], @@ -38,6 +39,7 @@ function CommentForm (props) { // 点击输入框 const handleInputClick = (type) => { setShowQuill(true); + setFocus(true); } // 取消 const handleCancle = () => { @@ -116,6 +118,7 @@ function CommentForm (props) { overflow: showQuill ? 'none' : 'hidden', transition: 'all 0.3s' }} + autoFocus={focus} style={{ height: '150px' }} placeholder="说点儿什么~" options={options} diff --git a/public/react/src/common/components/comment/index.scss b/public/react/src/common/components/comment/index.scss index 87ea08557..84aa8ec03 100644 --- a/public/react/src/common/components/comment/index.scss +++ b/public/react/src/common/components/comment/index.scss @@ -41,12 +41,14 @@ $ml: 20px; } .item-desc{ flex: 1; - margin-left: $ml; + // margin-left: $ml; + margin-left: 5px; } .item-header{ font-size: $fz14; line-height: $lh14; color: #333; + margin-left: 15px; .item-time{ font-size: $fz12; line-height: $lh14; diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index 48c4224f3..cb214465c 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-18 08:49:30 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 10:36:11 + * @LastEditTime : 2019-12-27 16:49:25 */ import './index.scss'; import 'quill/dist/quill.core.css'; // 核心样式 @@ -26,6 +26,7 @@ Quill.register(ImageBlot); function QuillForEditor ({ placeholder, readOnly, + autoFocus, options, value, imgAttrs = {}, // 指定图片的宽高 @@ -172,6 +173,12 @@ function QuillForEditor ({ } }, [quill, handleOnChange]); + useEffect(() => { + if (autoFocus) { + quill.focus(); + } + }, [quill, autoFocus]); + // 返回结果 return (
diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 7e1870895..8a11b217c 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -721,22 +721,28 @@ class CoursesBanner extends Component { .ant-breadcrumb-separator{ color: rgba(255,255,255,0.3) !important; } - .ant-tooltip-inner{ - background: #FFFFFF !important; - opacity: 0.2 !important; + .pointer .ant-tooltip-inner{ + +background:rgba(204,204,204,0.2) !important; } - .ant-tooltip-arrow::before{ - background: #FFFFFF !important; - opacity: 0.2 !important; + .pointer .ant-tooltip-arrow::before{ + +background:rgba(204,204,204,0.2) !important; + } + .pointer .antsoancss{ + color: #fff; } `} - 0?true:false} + trigger.parentNode} visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false} placement="topLeft" - title={
{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?您有{coursedata.teacher_applies_count}条新的加入申请this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>
+																		 title={
+																			 {coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?
+																				 您有{coursedata.teacher_applies_count}条新的加入申请
+																					 this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>
 																			 
diff --git a/public/react/src/modules/developer/DeveloperHome.js b/public/react/src/modules/developer/DeveloperHome.js
index ae230677a..0a738e6d5 100644
--- a/public/react/src/modules/developer/DeveloperHome.js
+++ b/public/react/src/modules/developer/DeveloperHome.js
@@ -120,7 +120,6 @@ const testMaps = {
     2: '数据结构与算法'
   }
 }
-
 class DeveloperHome extends React.PureComponent {
   /**
    * 表格列
diff --git a/public/react/src/modules/developer/components/controlSetting/index.js b/public/react/src/modules/developer/components/controlSetting/index.js
index 5c970f00e..53b66a359 100644
--- a/public/react/src/modules/developer/components/controlSetting/index.js
+++ b/public/react/src/modules/developer/components/controlSetting/index.js
@@ -4,7 +4,7 @@
  * @Github: 
  * @Date: 2019-11-27 16:02:36
  * @LastEditors  : tangjiang
- * @LastEditTime : 2019-12-27 09:32:34
+ * @LastEditTime : 2019-12-27 18:05:50
  */
 import './index.scss';
 import React, { useState, useRef, useEffect } from 'react';
@@ -19,6 +19,7 @@ const ControlSetting = (props) => {
 
   const { 
     hack,
+    userCode,
     inputValue,
     loading,
     submitLoading,
@@ -58,7 +59,7 @@ const ControlSetting = (props) => {
 
   // 调试代码
   const handleTestCode = (e) => {
-    if (!hack.code) {
+    if (!userCode) {
       notification.warning({
         message: '提示',
         description: '代码块内容不能为空'
@@ -77,6 +78,13 @@ const ControlSetting = (props) => {
   // 提交
   const handleSubmit = (e) => {
     e.preventDefault();
+    if (!userCode) {
+      notification.warning({
+        message: '提示',
+        description: '代码块内容不能为空'
+      });
+      return;
+    }
     changeSubmitLoadingStatus(true);
     onSubmitForm && onSubmitForm();
   }
@@ -145,9 +153,10 @@ const ControlSetting = (props) => {
 const mapStateToProps = (state) => {
   const {commonReducer, ojForUserReducer} = state;
   const {loading, excuteState, submitLoading, showOrHideControl } = commonReducer;
-  const { commitTestRecordDetail, hack } = ojForUserReducer; 
+  const { commitTestRecordDetail, hack, userCode } = ojForUserReducer; 
   return {
     hack,
+    userCode,
     loading,
     submitLoading,
     excuteState,
diff --git a/public/react/src/modules/developer/components/errorResult/index.js b/public/react/src/modules/developer/components/errorResult/index.js
index f92ea1773..25e4068b2 100644
--- a/public/react/src/modules/developer/components/errorResult/index.js
+++ b/public/react/src/modules/developer/components/errorResult/index.js
@@ -4,7 +4,7 @@
  * @Github: 
  * @Date: 2019-12-03 15:20:55
  * @LastEditors  : tangjiang
- * @LastEditTime : 2019-12-25 11:41:42
+ * @LastEditTime : 2019-12-27 22:35:14
  */
 import './index.scss';
 import React from 'react';
diff --git a/public/react/src/modules/developer/components/myMonacoEditor/index.js b/public/react/src/modules/developer/components/myMonacoEditor/index.js
index 7c98d7c09..b37770328 100644
--- a/public/react/src/modules/developer/components/myMonacoEditor/index.js
+++ b/public/react/src/modules/developer/components/myMonacoEditor/index.js
@@ -4,7 +4,7 @@
  * @Github: 
  * @Date: 2019-11-27 15:02:52
  * @LastEditors  : tangjiang
- * @LastEditTime : 2019-12-27 10:32:25
+ * @LastEditTime : 2019-12-27 20:49:46
  */
 import './index.scss';
 import React, { useState, useRef, useEffect } from 'react';
@@ -23,7 +23,7 @@ const maps = {
   'c': 'main.c',
   'c++': 'main.cc',
   'java': 'main.java',
-  'pythone': 'main.py'
+  'python': 'main.py'
 };
 
 function MyMonacoEditor (props, ref) {
@@ -86,6 +86,7 @@ function MyMonacoEditor (props, ref) {
       // TODO 需要优化 节流
       const val = editorRef.current.getValue();
       // setEditCode(val);
+      // console.log('编辑器代码====>>>>', val);
       onCodeChange(val);
       // 值一变化保存当前代码值
       // saveUserInputCode(val);
diff --git a/public/react/src/modules/developer/components/myMonacoEditor/index2.js b/public/react/src/modules/developer/components/myMonacoEditor/index2.js
new file mode 100644
index 000000000..097fa2975
--- /dev/null
+++ b/public/react/src/modules/developer/components/myMonacoEditor/index2.js
@@ -0,0 +1,48 @@
+/*
+ * @Description: 
+ * @Author: tangjiang
+ * @Github: 
+ * @Date: 2019-12-27 19:18:09
+ * @LastEditors: tangjiang
+ * @LastEditTime: 2019-12-27 19:19:23
+ */
+import React, { useState } from 'react';
+import Editor from "@monaco-editor/react";
+
+function App() {
+  const [theme, setTheme] = useState("light");
+  const [language, setLanguage] = useState("javascript");
+  const [isEditorReady, setIsEditorReady] = useState(false);
+
+  function handleEditorDidMount() {
+    setIsEditorReady(true);
+  }
+
+  function toggleTheme() {
+    setTheme(theme === "light" ? "dark" : "light");
+  }
+
+  function toggleLanguage() {
+    setLanguage(language === "javascript" ? "python" : "javascript");
+  }
+
+  return (
+    
+      
+      
+      
+
+      
+    
+  );
+}
\ No newline at end of file
diff --git a/public/react/src/modules/developer/newOrEditTask/rightpane/index.js b/public/react/src/modules/developer/newOrEditTask/rightpane/index.js
index 16533c624..d42089d7f 100644
--- a/public/react/src/modules/developer/newOrEditTask/rightpane/index.js
+++ b/public/react/src/modules/developer/newOrEditTask/rightpane/index.js
@@ -4,10 +4,10 @@
  * @Github: 
  * @Date: 2019-12-01 10:18:35
  * @LastEditors  : tangjiang
- * @LastEditTime : 2019-12-27 10:17:07
+ * @LastEditTime : 2019-12-27 19:33:50
  */
 import './index.scss';
-import React from 'react';
+import React, { useState, useEffect } from 'react';
 import { connect } from 'react-redux';
 import MyMonacoEditor from '../../components/myMonacoEditor';
 // import ControlSetting from '../../components/controlSetting';
@@ -18,6 +18,7 @@ function RightPane (props, ref) {
   const {
     // identifier,
     code,
+    showCode,
     language,
     // onSubmitForm,
     saveOjFormCode
@@ -46,7 +47,7 @@ function RightPane (props, ref) {
     
{/* { - const { ojForm, testCases, code, identifier } = state.ojFormReducer; + const { ojForm, testCases, code, identifier, showCode } = state.ojFormReducer; return { code, + showCode, identifier, language: ojForm.language, input: (testCases[0] && testCases[0].input) || '', diff --git a/public/react/src/modules/developer/recordDetail/index.js b/public/react/src/modules/developer/recordDetail/index.js index 99a706f33..fd93b3f2a 100644 --- a/public/react/src/modules/developer/recordDetail/index.js +++ b/public/react/src/modules/developer/recordDetail/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-04 08:36:21 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 14:51:42 + * @LastEditTime : 2019-12-27 21:18:39 */ import './index.scss'; import React, { useState, useEffect } from 'react'; @@ -60,6 +60,14 @@ function RecordDetail (props) { props.history.push(`/myproblems/${identifier}`); } } + + const handleEditorCode = (identifier, code) => { + if (identifier) { + console.log(code); + saveEditorCodeForDetail(code); + props.history.push(`/myproblems/${identifier}`); + } + } return (
@@ -114,9 +122,10 @@ function RecordDetail (props) { style={{ visibility: identifier ? 'visible' : 'hidden'}} className={'header_btn'} type="primary" + onClick={() => handleEditorCode(identifier, detail.code)} > - {/* 编辑代码 */} - 编辑代码 + 编辑代码 + {/* 编辑代码 */}
diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index 391a6fbf4..2ef8c4ba9 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-23 10:53:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 10:25:14 + * @LastEditTime : 2019-12-27 16:22:47 */ import './index.scss'; import React, { useEffect, useState } from 'react'; @@ -30,6 +30,7 @@ function StudentStudy (props) { // hack_identifier, // user_program_identifier, restoreInitialCode, + changeUserCodeTab, changeShowOrHideControl } = props; @@ -39,13 +40,17 @@ function StudentStudy (props) { saveUserProgramIdentifier } = props; - let { id } = params; + let { id, tab } = params; useEffect(() => { // 保存当前的id saveUserProgramIdentifier(id); // startProgramQuestion(id); getUserProgramDetail(id); + + if (tab) { + changeUserCodeTab(tab); + } }, []); useEffect(() => { @@ -176,7 +181,8 @@ const mapDispatchToProps = (dispatch) => ({ // 恢复初始代码 restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)), changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag)), - clearOjForUserReducer: () => dispatch(actions.clearOjForUserReducer()) + clearOjForUserReducer: () => dispatch(actions.clearOjForUserReducer()), + changeUserCodeTab: (tab) => dispatch(actions.changeUserCodeTab(tab)) }); export default withRouter(connect( diff --git a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js index ac1b784c6..a25eec4b8 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 09:49:33 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 10:39:00 + * @LastEditTime : 2019-12-27 22:40:32 */ import './index.scss'; import React, { useState, useEffect } from 'react'; @@ -96,7 +96,7 @@ const CommitRecord = (props) => { const { id, // error_line, - // error_msg, + error_msg, // execute_memory, // execute_time, // input, @@ -116,13 +116,14 @@ const CommitRecord = (props) => { 执行结果: {reviewResult[status]}

复制错误信息

-

+

显示详情 @@ -158,7 +159,7 @@ const CommitRecord = (props) => { // 复制功能 let count = 0; useEffect(() => { - clipboard = new ClipboardJS('.copy_error'); + clipboard = new ClipboardJS('#copyError'); clipboard && clipboard.on('success', (e) => { e.clearSelection(); if (count > 0) return; @@ -166,8 +167,12 @@ const CommitRecord = (props) => { message.success('复制成功'); setTimeout(() => { message.destroy(); - }, 300); + }, 3000); }); + + return () => { + clipboard = null; + } }, []); const clickCopyErrInfo = () => { diff --git a/public/react/src/modules/developer/studentStudy/leftpane/index.js b/public/react/src/modules/developer/studentStudy/leftpane/index.js index 30eedea18..ac8d89321 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-23 11:33:41 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-25 17:10:30 + * @LastEditTime : 2019-12-27 16:03:04 // */ import './index.scss'; import React, { useState, useEffect, useMemo } from 'react'; @@ -28,7 +28,7 @@ const LeftPane = (props) => { comments_count, /* 评论数*/ user_praise // 用户是否点赞 } = hack; - const [defaultActiveKey, setDefaultActiveKey] = useState('comment'); + const [defaultActiveKey, setDefaultActiveKey] = useState('task'); const navItem = [ { @@ -51,6 +51,8 @@ const LeftPane = (props) => { comment: () }; + console.log('======>>>>>>>', props); + useEffect(() => { setDefaultActiveKey(userCodeTab); }, [userCodeTab]) diff --git a/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js b/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js index f99d59092..348f68d27 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/taskDescription/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 09:49:30 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-25 14:50:37 + * @LastEditTime : 2019-12-27 20:22:55 */ import '../index.scss'; import React from 'react'; @@ -18,7 +18,7 @@ const {tagBackground, diffText} = CONST; const TaskDescription = (props) => { - const { hack = {} } = props; + const { hack = {}, userInfo = {} } = props; const {language, difficult, time_limit, username, description} = hack; return (

@@ -37,7 +37,7 @@ const TaskDescription = (props) => {

出题者: - {username} + {username}

@@ -52,8 +52,10 @@ const TaskDescription = (props) => { const mapStateToProps = (state) => { const { hack } = state.ojForUserReducer; + const { userInfo } = state.userReducer; return { - hack + hack, + userInfo } } diff --git a/public/react/src/modules/developer/studentStudy/rightpane/index.js b/public/react/src/modules/developer/studentStudy/rightpane/index.js index 8f4ac2533..ed500fb3a 100644 --- a/public/react/src/modules/developer/studentStudy/rightpane/index.js +++ b/public/react/src/modules/developer/studentStudy/rightpane/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 14:59:51 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 10:28:41 + * @LastEditTime : 2019-12-27 19:23:46 */ import React, { useState, useEffect } from 'react'; import {connect} from 'react-redux'; @@ -45,13 +45,14 @@ const RightPane = (props) => { // const [code, setCode] = useState(editor_code || hack.code); // let initFlag = true; - useEffect(() => { - if (editor_code) { - setEditorCode(editor_code); - } else { - setEditorCode(hack.code); - } - }, [hack, editor_code]); + // useEffect(() => { + // if (editor_code) { + // setEditorCode(editor_code); + // } else { + // setEditorCode(hack.code); + // } + // }, [hack, editor_code]); + const handleSubmitForm = () => { // 提交时, 先调用提交接口,提交成功后,循环调用测评接口 @@ -119,7 +120,7 @@ const RightPane = (props) => { notice={notice} identifier={identifier} language={hack.language} - code={editorCode} + code={editor_code || hack.code} hadCodeUpdate={hadCodeUpdate} onCodeChange={handleCodeChange} onUpdateNotice={handleUpdateNotice} diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index 98036301e..3d42b7c98 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -475,7 +475,11 @@ class MessagSub extends Component { // } } case "Discuss": - return window.open(`/shixuns/${item.identifier}/shixun_discuss`); + if (item.parent_container_type === 'Hack' && item.extra) { + return window.open(`/myproblems/${item.extra}/comment`); + } else { + return window.open(`/shixuns/${item.identifier}/shixun_discuss`); + } case "Video": if (item.tiding_type === "Apply") { return window.open(`/admins/video_applies`); @@ -506,6 +510,10 @@ class MessagSub extends Component { //分组作业 return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}`); } + case 'Hack': + if (item.extra && item.parent_container_type !== 'HackDelete') { + return window.open(`/problems/${item.extra}/edit`); + } default : return } diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 5cf50c39a..86d0e9637 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -388,6 +388,7 @@ class TPMIndex extends Component { let url = window.location.href; let flag = url.indexOf("add_file")>-1; + return (
{/*头部*/} diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js index bd93fa4e5..f48314261 100644 --- a/public/react/src/modules/tpm/TPMsettings/Configuration.js +++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js @@ -164,7 +164,7 @@ export default class Shixuninformation extends Component { axios.post(url, { - scope_partment: list, + scope_partment:use_scope===0?undefined:list, shixun: { can_copy: can_copy, use_scope: use_scope, @@ -213,7 +213,6 @@ export default class Shixuninformation extends Component { if(scope_partment.length>0){ scope_partment.map((item, key) => { if (item === e) { - debugger scopetype = true } }) @@ -222,7 +221,6 @@ export default class Shixuninformation extends Component { if(oldscope_partment.length>0){ oldscope_partment.map((item, key) => { if (item === e) { - debugger scopetype = true } }) diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js index 31ab8064d..70fb5d306 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js +++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js @@ -18,6 +18,13 @@ const Option = Select.Option; const RadioGroup = Radio.Group; +function isNulltpm( str ){ + if ( str == "" ) return true; + var regu = "^[ ]+$"; + var re = new RegExp(regu); + return re.test(str); +} + export default class TPMchallengesnew extends Component { constructor(props) { super(props) @@ -195,7 +202,7 @@ export default class TPMchallengesnew extends Component { } CreatePracticesend = () => { - + const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim(); this.setState({ CreatePracticesendtype:true @@ -237,6 +244,25 @@ export default class TPMchallengesnew extends Component { } + if (exercise_editormdvalue === undefined||exercise_editormdvalue==""||exercise_editormdvalue===null) { + this.setState({ + tpmcourseMessageMDType:true, + CreatePracticesendtype:false + }) + this.props.scrollToAnchor("tpmcourseMessageMD"); + return + } + + if(isNulltpm(exercise_editormdvalue)){ + this.setState({ + tpmcourseMessageMDType:true, + CreatePracticesendtype:false + }) + this.props.scrollToAnchor("tpmcourseMessageMD"); + return + } + + if(shixunCreatePracticeGroup===undefined){ this.setState({ shixunCreatePracticeGrouptype:true, @@ -284,7 +310,8 @@ export default class TPMchallengesnew extends Component { // return // } - const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim(); + + let id = this.props.match.params.shixunId; let url = "/shixuns/" + id + "/challenges.json"; // exec_time:exec_time @@ -369,19 +396,13 @@ export default class TPMchallengesnew extends Component { } editPracticesend=()=>{ - this.setState({ editPracticesendtype:true }) - let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,checkpointId,exec_time} = this.state; - - const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim(); - let id = this.props.match.params.shixunId; - let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json"; - + const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim(); if (shixunCreatePractice === undefined||shixunCreatePractice=="") { this.setState({ @@ -408,6 +429,25 @@ export default class TPMchallengesnew extends Component { return } + if (exercise_editormdvalue === undefined||exercise_editormdvalue==""||exercise_editormdvalue===null) { + this.setState({ + tpmcourseMessageMDType:true, + editPracticesendtype:false + }) + this.props.scrollToAnchor("tpmcourseMessageMD"); + return + } + + if(isNulltpm(exercise_editormdvalue)){ + this.setState({ + tpmcourseMessageMDType:true, + editPracticesendtype:false + }) + this.props.scrollToAnchor("tpmcourseMessageMD"); + this.props.showNotification("过关任务,请勿输入空格"); + return + } + if(shixunCreatePracticeGroup===undefined){ this.setState({ shixunCreatePracticeGrouptype:true, @@ -591,7 +631,7 @@ export default class TPMchallengesnew extends Component {
-

*过关任务

+

*过关任务

+ + {this.state.tpmcourseMessageMDType===true?
必填项:不能为空
:""}
diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js index af80c8410..7ff0942cc 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js +++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js @@ -153,7 +153,7 @@ export default class TPMevaluation extends Component { addevaluationon=()=>{ let {evaluationlist,markvalue}=this.state; let newevaluationlist=evaluationlist; - newevaluationlist.push({hidden:0,input:"",output:"",score:0}); + newevaluationlist.push({hidden:0,input:"",output:"",score:0,match_rule:"full"}); newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); this.setevaluationlist(newevaluationlist); } diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 25f82ef94..dab3a1f5e 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -168,8 +168,7 @@ function JupyterTPI (props) { title: '更新通知', content: (
{stopposttpip(1)} -

该实训已更新,您选择更新后之前编写的实训代码将会丢失

-

如有需要请先使用【jupyter中-文件-下载】保存代码,再进行更新

+

该实训已更新,您选择更新后之前编写的实训代码将会丢失,如有需要请先使用【jupyter中-文件-下载】保存代码,再进行更新

{/*

还未完成评测的任务代码,请自行保存

*/}
), okText: '立即更新', @@ -188,6 +187,7 @@ function JupyterTPI (props) { // 重置实训 const handleClickResetTpi = () => { stopposttpip(1) + updataspinning(true) Modal.confirm({ title: '重置实训', content: ( @@ -206,6 +206,7 @@ function JupyterTPI (props) { }, onCancel() { stopposttpip(2) + updataspinning(false) }, }) } @@ -219,7 +220,6 @@ function JupyterTPI (props) { title: '重置环境', content: (

- 你在本文件中修改的内容将丢失,
是否确定重置环境?

), @@ -277,16 +277,22 @@ function JupyterTPI (props) { const firstDrawerWidth = ()=>{ return 260 }; - + let newPage=false // 分页处理 - const handleChangePage = (page) => { - - handlePageChange(page); + const handleChangePage = (e,page) => { + //滑动到底判断 + let newscrollTop=parseInt(e.currentTarget.scrollTop); + let allclientHeight=e.currentTarget.clientHeight+newscrollTop; + if(dataSets.length { if (dataSets.length > 0) { - console.log('数据集的个数: ', dataSets.length); + // console.log('数据集的个数: ', dataSets.length); const oList = dataSets.map((item, i) => { return (
  • @@ -310,7 +316,7 @@ function JupyterTPI (props) { }); const oUl = ( -
  • +
    diff --git a/public/react/src/modules/tpm/jupyter/index.scss b/public/react/src/modules/tpm/jupyter/index.scss index e6a95406a..2428b93fd 100644 --- a/public/react/src/modules/tpm/jupyter/index.scss +++ b/public/react/src/modules/tpm/jupyter/index.scss @@ -124,11 +124,17 @@ padding: 0px; } .ant-drawer-wrapper-body{ + overflow: hidden !important; padding-top: 60px; background: #070F1A; padding-bottom: 40px; } + .jupyter_data_list{ + height:500px; + overflow-y: auto; + } + .ant-pagination{ color:#fff !important; } @@ -231,4 +237,9 @@ line-height: 50px !important; white-space: nowrap; cursor: default; width: 181px; +} + +.height45lineheight45{ + height: 45px; + line-height: 45px !important; } \ No newline at end of file diff --git a/public/react/src/modules/tpm/jupyter/rightPane/index.js b/public/react/src/modules/tpm/jupyter/rightPane/index.js index da3a548d2..5cfa96260 100644 --- a/public/react/src/modules/tpm/jupyter/rightPane/index.js +++ b/public/react/src/modules/tpm/jupyter/rightPane/index.js @@ -26,7 +26,7 @@ function RightPane (props) { const loadInit = (
    - + {/**/}
    ); diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index b24d4dc2c..3fa98e88c 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -1,13 +1,14 @@ import React, { Component } from 'react'; import { Link } from "react-router-dom"; import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder' -import { Divider, Tooltip,Upload,Modal,Spin} from 'antd'; +import { Divider, Tooltip,Upload,Modal,Statistic} from 'antd'; import LoadingSpin from '../../../../common/LoadingSpin'; import 'antd/lib/pagination/style/index.css'; import '../shixunchildCss/Challenges.css'; import axios from 'axios'; +import {addjypertime} from "../../../../redux/actions/jupyter"; const $ = window.$; - +const { Countdown } = Statistic; class Challengesjupyter extends Component { constructor(props) { super(props) @@ -28,7 +29,8 @@ class Challengesjupyter extends Component { enlarge:false, fileList:[], shuaxin:false, - showtime:false + showtime:false, + jupytertime:Date.now() +3600 * 1000 } } @@ -103,14 +105,46 @@ class Challengesjupyter extends Component { } } + + gettimeinfo_with_tpm=(datas)=>{ + let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json` + axios.get(timeinfo_with_tpm, {params: datas}).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + if(response.data.status===0){ + if(response.data.useSeconds===null){ + this.handleClickResetTpi() + }else{ + let useSeconds=response.data.useSeconds; + let summain=3600 * 1000; + let sums= useSeconds * 1000; + let sum=summain-sums; + setTimeout(()=>{ + this.setState({ + jupytertime:Date.now() +sum + }) + },500); + } + }else{ + + } + } + }).catch((error) => { + + }); + } componentDidMount() { - var that=this; + let that=this; setTimeout(this.ChallengesList(), 1000); let id = this.props.match.params.shixunId; - let ChallengesURL = `/jupyters/get_info_with_tpm.json`; let datas={ identifier:id, } + + + let ChallengesURL = `/jupyters/get_info_with_tpm.json`; + axios.get(ChallengesURL, {params: datas}).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { setTimeout(() => { @@ -120,6 +154,7 @@ class Challengesjupyter extends Component { }, 600) }else{ if(response.data.status===0){ + this.gettimeinfo_with_tpm(datas) setTimeout(() => { this.setState({ jupyter_url:response.data.url, @@ -344,14 +379,20 @@ class Challengesjupyter extends Component { identifier:id }}).then((response) => { if(response.data.status===0){ - setTimeout(()=>{ this.setState({ jupyter_url :response.data.url, booljupyterurls:true, }) + },500); + this.props.showNotification('重置环境成功!'); + + setTimeout(()=>{ + this.setState({ + booljupyterurls:true, + }) },1000); - this.props.showNotification('重置实训成功!'); + } }); } @@ -363,7 +404,6 @@ class Challengesjupyter extends Component { title: '重置环境', content: (

    - 你在本文件中修改的内容将丢失,
    是否确定重置环境?

    ), @@ -377,6 +417,23 @@ class Challengesjupyter extends Component { }, }) } + + onFinish=()=>{ + let id=this.props.match.params.shixunId; + Modal.confirm({ + title: '倒计时截止', + content: ( +

    + 服务已中断,是否确认重置实验环境? +

    + ), + okText: '确定', + cancelText: '取消', + onOk () { + this.handleClickResetTpisync_code(id) + } + }) + } render() { let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state; let id = this.props.match.params.shixunId; @@ -427,7 +484,7 @@ class Challengesjupyter extends Component {
    + + {/*this.state.jupytertime*/} + + +

    简介 @@ -504,20 +572,7 @@ class Challengesjupyter extends Component { }

    }

    - { - booljupyterurls===true? - ( - this.state.jupyter_url === null? -
    - -

    加载实训失败,

    this.updatamakedowns()}>重新加载

    - -
    - :"" - ) - :"" - }
    {this.state.isopentitletype==="Less"?"":this.state.opentitletype===true?this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}> @@ -557,7 +612,49 @@ class Challengesjupyter extends Component { { this.state.jupyter_url === null || this.state.jupyter_url === undefined ? - "" + enlarge===true? +
    + +
    +
    +

    任务详情

    +

    (请将实训题目写在下方并保存)

    +
    +
    + { + enlarge===true? + this.onclki(false)}> + : + this.onclki(true)}> + } + + +
    +

    导入

    +
    +
    + + +
    + +
    +
    + + :"" : ( admin===true||business===true||mysidentity===true? @@ -640,15 +737,26 @@ class Challengesjupyter extends Component { this.state.jupyter_url===null || this.state.jupyter_url===undefined? ( booljupyterurls===false? - - :"" +
    + +
    + : +
    +
    + +

    加载实训失败,

    this.updatamakedowns()}>重新加载

    + +
    +
    ) : - +
    + scrolling="no" id="frame" + name="framename" width="100%" height="700" frameBorder="0" + > +
    + }
    @@ -664,3 +772,17 @@ class Challengesjupyter extends Component { } export default Challengesjupyter; +{/*{*/} +{/* booljupyterurls===true?*/} +{/* (*/} +{/* this.state.jupyter_url === null?*/} +{/*
    */} +{/* */} +{/*

    加载实训失败,

    this.updatamakedowns()}>重新加载

    */} + +{/*
    */} + +{/* :""*/} +{/* )*/} +{/* :""*/} +{/*}*/} diff --git a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css index f4f68cdba..d2bba2f84 100644 --- a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css +++ b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css @@ -214,6 +214,10 @@ right: 0px; } +.fangdatwoswidth{ + border-top: 1px solid #eeee; +} + .jupyterswidth{ width: 1140px; } diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js index b2d66d6e6..bb56ac6c8 100644 --- a/public/react/src/redux/actions/jupyter.js +++ b/public/react/src/redux/actions/jupyter.js @@ -248,10 +248,16 @@ export const timeinfo_with_tpi = (identifier, dispatch) => { if (res.status === 200) { if(res.data.status===0){ if(res.data.useSeconds===null){ - Modal.warning({ - title: '提示', - content: '因为这个实训pod不在了,无法获取倒计时,请联系系统管理人员', - }); + Modal.confirm({ + title: '重置环境', + content:" 是否确定重置环境?" , + okText: '确定', + cancelText: '取消', + onOk () { + reset_with_tpi(identifier, '重置成功'); + }, + onCancel() {} + }) }else{ let useSeconds=res.data.useSeconds; let summain=3600 * 1000; diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 9cd4e8228..118295802 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:35:46 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 14:18:02 + * @LastEditTime : 2019-12-27 22:19:15 */ import types from './actionTypes'; import CONST from '../../constants'; @@ -286,17 +286,28 @@ export const validateOjForm = (props, type, cb) => { } else if (type === 'challenge') { cb && cb(); } else { + const {identifier} = res.data; + // message.success(paramsObj['submitType'] === 'update' ? '更新成功' : '保存成功'); notification.success({ message: '提示', description: paramsObj['submitType'] === 'update' ? '更新成功' : '保存成功' }); - const {identifier} = res.data; // 保存成功后的identifier identifier && dispatch({ type: types.SAVE_OJ_FORM_ID, payload: identifier }); + + console.log(identifier , props.identifier); + if (identifier || props.identifier) { + dispatch(getOJFormById(identifier || props.identifier)); + } + // 保存成功后,调用编辑接口并改变路 + if (paramsObj['submitType'] === 'add' && identifier) { + + props.history.push(`/problems/${identifier}/edit`); + }; } // 保存或更新后,调用start接口 // linkToDev(dispatch, props); @@ -499,7 +510,7 @@ export const deleteTestCase = (obj) => { export const getOJFormById = (id) => { return (dispatch) => { fetchGetOjById(id).then(res => { - console.log('获取OJ表单信息成功: ', res); + // console.log('获取OJ表单信息成功: ', res); dispatch({ type: types.SAVE_EDIT_OJ_FORM_AND_TEST_CASE, payload: res.data diff --git a/public/react/src/redux/reducers/jupyterReducer.js b/public/react/src/redux/reducers/jupyterReducer.js index 75c9d374f..4b117b453 100644 --- a/public/react/src/redux/reducers/jupyterReducer.js +++ b/public/react/src/redux/reducers/jupyterReducer.js @@ -26,9 +26,13 @@ const JupyterReducer = (state = initState, action) => { switch (action.type) { case types.GET_JUPYTER_DATA_SETS: const { data_sets, data_sets_count,folder_name} = action.payload; + let newjupyter_data_set=state.jupyter_data_set; + data_sets.map((item,key)=>{ + newjupyter_data_set.push(item) + }) return { ...state, - jupyter_data_set: data_sets, + jupyter_data_set: newjupyter_data_set, jupyter_data_set_count: data_sets_count, jupyter_folder_name:folder_name, } diff --git a/public/react/src/redux/reducers/ojForUserReducer.js b/public/react/src/redux/reducers/ojForUserReducer.js index f78385049..721c3e2cc 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-27 09:18:02 + * @LastEditTime : 2019-12-27 21:28:28 */ import types from "../actions/actionTypes"; import { Base64 } from 'js-base64'; @@ -58,7 +58,8 @@ const ojForUserReducer = (state = initialState, action) => { ...state, hack: Object.assign({}, hack), test_case: Object.assign({}, test_case), - comment_identifier: hack.identifier + comment_identifier: hack.identifier, + userCode: tempCode } case types.COMMIT_RECORD_DETAIL: let result = action.payload.data; @@ -138,7 +139,8 @@ const ojForUserReducer = (state = initialState, action) => { console.log(curHack); return { ...state, - hack: Object.assign({}, state.hack, curHack) + hack: Object.assign({}, state.hack, curHack), + editor_code: curHack['code'] } case types.SAVE_HACK_IDENTIFIER: return { @@ -179,7 +181,7 @@ const ojForUserReducer = (state = initialState, action) => { commitTestRecordDetail: {}, // 调试代码执行结果 commitRecordDetail: {}, // 提交成功后记录提交的详情 commitRecord: [], // 提交记录 - userCode: '', // 保存当前用户输入的代码 + // userCode: '', // 保存当前用户输入的代码 isUpdateCode: false, // 是否更新了代码内容 userCodeTab: 'task', // 学员测评tab位置: task | record | comment userTestInput: '', // 用户自定义输入值 diff --git a/public/react/src/redux/reducers/ojFormReducer.js b/public/react/src/redux/reducers/ojFormReducer.js index b214eb3bc..952919aca 100644 --- a/public/react/src/redux/reducers/ojFormReducer.js +++ b/public/react/src/redux/reducers/ojFormReducer.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:40:32 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 10:35:06 + * @LastEditTime : 2019-12-27 20:00:26 */ import { Base64 } from 'js-base64'; import types from '../actions/actionTypes'; @@ -61,6 +61,7 @@ const init = { position: 1, // TODO 每次加载信息时同步指定positio值 score: 200, // 分值: 选择难易度后自动计算分值 200 | 500 | 1000 code: '', // 提交的代码 + showCode: '', // 编辑器显示的代码 identifier: '', // OJ表单id loading: false, // 僵尸loading标志 testCodeStatus: 'default', // 调试代码状态 default(默认值) | loading(加载中) | loaded(加载完成) | userCase(用户自定义测试用例) | finish(测试完成) @@ -216,7 +217,8 @@ const ojFormReducer = (state = initialState, action) => { testCases: curTestCases, testCasesValidate: curTcValidates, testCodeStatus: hack_sets.length > 0 ? 'userCase' : 'default', - isPublish: status + isPublish: status, + showCode: cbcode } case types.CHANGE_PUBLISH_VALUE: return { diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 4b663de87..d4b5633d7 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -3804,3 +3804,16 @@ a.singlepublishtwo{ text-align: justify; word-break: break-all; } + +.RightPaneDrawer .ant-drawer-content{ + background: #070f1a; + overflow: hidden !important; +} + +.deletebuttom{ + border: transparent; +} + +.RightPaneDrawer .jupyter_data_list{ + max-height: 340px; +} \ No newline at end of file diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index 9de4bfb1d..cbb6fb1f5 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -824,4 +824,17 @@ html>body #ajax-indicator { position: fixed; } .markdown-body { text-align: justify; word-break: break-all; +} + +.RightPaneDrawer .ant-drawer-content{ + background: #070f1a; + overflow: hidden !important; +} + +.deletebuttom{ + border: transparent; +} + +.RightPaneDrawer .jupyter_data_list{ + max-height: 340px; } \ No newline at end of file