Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_tpm_ui
杨树林 5 years ago
commit 0deff97559

@ -603,7 +603,7 @@ class ApplicationController < ActionController::Base
end
def paginate(relation)
limit = params[:limit].to_i.zero? ? 20 : params[:limit].to_i
limit = (params[:limit].to_i.zero? || params[:limit].to_i > 20) ? 20 : params[:limit].to_i
page = params[:page].to_i.zero? ? 1 : params[:page].to_i
offset = (page - 1) * limit

@ -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)

@ -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,6 +786,7 @@ class ShixunsController < ApplicationController
commit_id = commit["id"]
cloud_bridge = edu_setting('cloud_bridge')
myshixun_identifier = generate_identifier Myshixun, 10
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,
@ -797,10 +798,10 @@ class ShixunsController < ApplicationController
params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
interface_post uri, params, 83, "服务器出现问题,请重置环境"
end
end
rescue => e
uid_logger_error(e.message)
tip_exception(e.message)
tip_exception("服务器出现问题,请重置环境")
end
end
end

@ -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

@ -226,7 +226,8 @@ module TidingDecorator
end
def discuss_content
I18n.t(locale_format(parent_container_type, container.parent_id.present?)) % message_content_helper(container.content)
I18n.t(locale_format(parent_container_type, container.parent_id.present?)) %
(parent_container_type == 'Hack' ? container.content : message_content_helper(container.content))
end
def grade_content

@ -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

@ -727,7 +727,7 @@ class App extends Component {
(props) => (<RecordDetail {...this.props} {...props} {...this.state} />)
}
/>
<Route path="/myproblems/:id"
<Route path="/myproblems/:id/:tab?"
render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
} />

@ -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}

@ -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 (
<div className='quill_editor_for_react_area' style={wrapStyle}>

@ -120,7 +120,6 @@ const testMaps = {
2: '数据结构与算法'
}
}
class DeveloperHome extends React.PureComponent {
/**
* 表格列

@ -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,

@ -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 18:01:48
*/
import './index.scss';
import React, { useState, useRef, useEffect } from 'react';
@ -86,6 +86,7 @@ function MyMonacoEditor (props, ref) {
// TODO 需要优化 节流
const val = editorRef.current.getValue();
// setEditCode(val);
// console.log('编辑器代码====>>>>', val);
onCodeChange(val);
// 值一变化保存当前代码值
// saveUserInputCode(val);

@ -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(

@ -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 17:14:04
*/
import './index.scss';
import React, { useState, useEffect } from 'react';
@ -116,6 +116,7 @@ const CommitRecord = (props) => {
执行结果: <span className={classes}>{reviewResult[status]}</span>
</p>
<p
id="copyError"
onClick={clickCopyErrInfo}
className={showErrorCopy} data-clipboard-target="#errcode">
<span>
@ -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 = () => {

@ -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: (<Comment />)
};
console.log('======>>>>>>>', props);
useEffect(() => {
setDefaultActiveKey(userCodeTab);
}, [userCodeTab])

@ -475,7 +475,11 @@ class MessagSub extends Component {
// }
}
case "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) {
return window.open(`/problems/${item.extra}/edit`);
}
default :
return
}

@ -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 16:52:30
*/
import types from "../actions/actionTypes";
import { Base64 } from 'js-base64';

Loading…
Cancel
Save