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

dev_tpm_ui
cxt 5 years ago
commit bfdf72ee82

@ -772,7 +772,7 @@ class ShixunsController < ApplicationController
# jupyter开启挑战 # jupyter开启挑战
def jupyter_exec def jupyter_exec
begin
if is_shixun_opening? if is_shixun_opening?
tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}")
end end
@ -786,22 +786,23 @@ class ShixunsController < ApplicationController
commit_id = commit["id"] commit_id = commit["id"]
cloud_bridge = edu_setting('cloud_bridge') cloud_bridge = edu_setting('cloud_bridge')
myshixun_identifier = generate_identifier Myshixun, 10 myshixun_identifier = generate_identifier Myshixun, 10
ActiveRecord::Base.transaction do begin
@myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, ActiveRecord::Base.transaction do
modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, @myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier,
onclick_time: Time.now, commit_id: commit_id) modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
# fork仓库 onclick_time: Time.now, commit_id: commit_id)
project_fork(@myshixun, @repo_path, current_user.login) # fork仓库
rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) project_fork(@myshixun, @repo_path, current_user.login)
uri = "#{cloud_bridge}/bridge/game/openGameInstance" rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last} uri = "#{cloud_bridge}/bridge/game/openGameInstance"
interface_post uri, params, 83, "服务器出现问题,请重置环境" 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
end end
rescue => e
uid_logger_error(e.message)
tip_exception(e.message)
end
end end
def publish def publish

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

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-17 17:32:55 * @Date: 2019-12-17 17:32:55
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-26 18:43:21 * @LastEditTime : 2019-12-27 16:50:43
*/ */
import './index.scss'; import './index.scss';
import React, { useState } from 'react'; import React, { useState } from 'react';
@ -25,6 +25,7 @@ function CommentForm (props) {
const { getFieldDecorator } = form; const { getFieldDecorator } = form;
const [ctx, setCtx] = useState(''); const [ctx, setCtx] = useState('');
const [focus, setFocus] = useState(false);
const options = [ const options = [
['bold', 'italic', 'underline'], ['bold', 'italic', 'underline'],
@ -38,6 +39,7 @@ function CommentForm (props) {
// 点击输入框 // 点击输入框
const handleInputClick = (type) => { const handleInputClick = (type) => {
setShowQuill(true); setShowQuill(true);
setFocus(true);
} }
// 取消 // 取消
const handleCancle = () => { const handleCancle = () => {
@ -116,6 +118,7 @@ function CommentForm (props) {
overflow: showQuill ? 'none' : 'hidden', overflow: showQuill ? 'none' : 'hidden',
transition: 'all 0.3s' transition: 'all 0.3s'
}} }}
autoFocus={focus}
style={{ height: '150px' }} style={{ height: '150px' }}
placeholder="说点儿什么~" placeholder="说点儿什么~"
options={options} options={options}

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-18 08:49:30 * @Date: 2019-12-18 08:49:30
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 10:36:11 * @LastEditTime : 2019-12-27 16:49:25
*/ */
import './index.scss'; import './index.scss';
import 'quill/dist/quill.core.css'; // 核心样式 import 'quill/dist/quill.core.css'; // 核心样式
@ -26,6 +26,7 @@ Quill.register(ImageBlot);
function QuillForEditor ({ function QuillForEditor ({
placeholder, placeholder,
readOnly, readOnly,
autoFocus,
options, options,
value, value,
imgAttrs = {}, // 指定图片的宽高 imgAttrs = {}, // 指定图片的宽高
@ -172,6 +173,12 @@ function QuillForEditor ({
} }
}, [quill, handleOnChange]); }, [quill, handleOnChange]);
useEffect(() => {
if (autoFocus) {
quill.focus();
}
}, [quill, autoFocus]);
// 返回结果 // 返回结果
return ( return (
<div className='quill_editor_for_react_area' style={wrapStyle}> <div className='quill_editor_for_react_area' style={wrapStyle}>

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

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 16:02:36 * @Date: 2019-11-27 16:02:36
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 09:32:34 * @LastEditTime : 2019-12-27 18:05:50
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
@ -19,6 +19,7 @@ const ControlSetting = (props) => {
const { const {
hack, hack,
userCode,
inputValue, inputValue,
loading, loading,
submitLoading, submitLoading,
@ -58,7 +59,7 @@ const ControlSetting = (props) => {
// 调试代码 // 调试代码
const handleTestCode = (e) => { const handleTestCode = (e) => {
if (!hack.code) { if (!userCode) {
notification.warning({ notification.warning({
message: '提示', message: '提示',
description: '代码块内容不能为空' description: '代码块内容不能为空'
@ -77,6 +78,13 @@ const ControlSetting = (props) => {
// 提交 // 提交
const handleSubmit = (e) => { const handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
if (!userCode) {
notification.warning({
message: '提示',
description: '代码块内容不能为空'
});
return;
}
changeSubmitLoadingStatus(true); changeSubmitLoadingStatus(true);
onSubmitForm && onSubmitForm(); onSubmitForm && onSubmitForm();
} }
@ -145,9 +153,10 @@ const ControlSetting = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
const {commonReducer, ojForUserReducer} = state; const {commonReducer, ojForUserReducer} = state;
const {loading, excuteState, submitLoading, showOrHideControl } = commonReducer; const {loading, excuteState, submitLoading, showOrHideControl } = commonReducer;
const { commitTestRecordDetail, hack } = ojForUserReducer; const { commitTestRecordDetail, hack, userCode } = ojForUserReducer;
return { return {
hack, hack,
userCode,
loading, loading,
submitLoading, submitLoading,
excuteState, excuteState,

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 15:02:52 * @Date: 2019-11-27 15:02:52
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 10:32:25 * @LastEditTime : 2019-12-27 18:01:48
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useRef, useEffect } from 'react'; import React, { useState, useRef, useEffect } from 'react';
@ -86,6 +86,7 @@ function MyMonacoEditor (props, ref) {
// TODO 需要优化 节流 // TODO 需要优化 节流
const val = editorRef.current.getValue(); const val = editorRef.current.getValue();
// setEditCode(val); // setEditCode(val);
// console.log('编辑器代码====>>>>', val);
onCodeChange(val); onCodeChange(val);
// 值一变化保存当前代码值 // 值一变化保存当前代码值
// saveUserInputCode(val); // saveUserInputCode(val);

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-23 10:53:19 * @Date: 2019-11-23 10:53:19
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 10:25:14 * @LastEditTime : 2019-12-27 16:22:47
*/ */
import './index.scss'; import './index.scss';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
@ -30,6 +30,7 @@ function StudentStudy (props) {
// hack_identifier, // hack_identifier,
// user_program_identifier, // user_program_identifier,
restoreInitialCode, restoreInitialCode,
changeUserCodeTab,
changeShowOrHideControl changeShowOrHideControl
} = props; } = props;
@ -39,13 +40,17 @@ function StudentStudy (props) {
saveUserProgramIdentifier saveUserProgramIdentifier
} = props; } = props;
let { id } = params; let { id, tab } = params;
useEffect(() => { useEffect(() => {
// 保存当前的id // 保存当前的id
saveUserProgramIdentifier(id); saveUserProgramIdentifier(id);
// startProgramQuestion(id); // startProgramQuestion(id);
getUserProgramDetail(id); getUserProgramDetail(id);
if (tab) {
changeUserCodeTab(tab);
}
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -176,7 +181,8 @@ const mapDispatchToProps = (dispatch) => ({
// 恢复初始代码 // 恢复初始代码
restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)), restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)),
changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag)), changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag)),
clearOjForUserReducer: () => dispatch(actions.clearOjForUserReducer()) clearOjForUserReducer: () => dispatch(actions.clearOjForUserReducer()),
changeUserCodeTab: (tab) => dispatch(actions.changeUserCodeTab(tab))
}); });
export default withRouter(connect( export default withRouter(connect(

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 09:49:33 * @Date: 2019-11-27 09:49:33
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 10:39:00 * @LastEditTime : 2019-12-27 17:14:04
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -116,6 +116,7 @@ const CommitRecord = (props) => {
执行结果: <span className={classes}>{reviewResult[status]}</span> 执行结果: <span className={classes}>{reviewResult[status]}</span>
</p> </p>
<p <p
id="copyError"
onClick={clickCopyErrInfo} onClick={clickCopyErrInfo}
className={showErrorCopy} data-clipboard-target="#errcode"> className={showErrorCopy} data-clipboard-target="#errcode">
<span> <span>
@ -158,7 +159,7 @@ const CommitRecord = (props) => {
// 复制功能 // 复制功能
let count = 0; let count = 0;
useEffect(() => { useEffect(() => {
clipboard = new ClipboardJS('.copy_error'); clipboard = new ClipboardJS('#copyError');
clipboard && clipboard.on('success', (e) => { clipboard && clipboard.on('success', (e) => {
e.clearSelection(); e.clearSelection();
if (count > 0) return; if (count > 0) return;
@ -166,8 +167,12 @@ const CommitRecord = (props) => {
message.success('复制成功'); message.success('复制成功');
setTimeout(() => { setTimeout(() => {
message.destroy(); message.destroy();
}, 300); }, 3000);
}); });
return () => {
clipboard = null;
}
}, []); }, []);
const clickCopyErrInfo = () => { const clickCopyErrInfo = () => {

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-23 11:33:41 * @Date: 2019-11-23 11:33:41
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-25 17:10:30 * @LastEditTime : 2019-12-27 16:03:04
// */ // */
import './index.scss'; import './index.scss';
import React, { useState, useEffect, useMemo } from 'react'; import React, { useState, useEffect, useMemo } from 'react';
@ -28,7 +28,7 @@ const LeftPane = (props) => {
comments_count, /* 评论数*/ comments_count, /* 评论数*/
user_praise // 用户是否点赞 user_praise // 用户是否点赞
} = hack; } = hack;
const [defaultActiveKey, setDefaultActiveKey] = useState('comment'); const [defaultActiveKey, setDefaultActiveKey] = useState('task');
const navItem = [ const navItem = [
{ {
@ -51,6 +51,8 @@ const LeftPane = (props) => {
comment: (<Comment />) comment: (<Comment />)
}; };
console.log('======>>>>>>>', props);
useEffect(() => { useEffect(() => {
setDefaultActiveKey(userCodeTab); setDefaultActiveKey(userCodeTab);
}, [userCodeTab]) }, [userCodeTab])

@ -475,7 +475,11 @@ class MessagSub extends Component {
// } // }
} }
case "Discuss": 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": case "Video":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
return window.open(`/admins/video_applies`); 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}`); 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 : default :
return return
} }

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:41:48 * @Date: 2019-11-27 13:41:48
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 09:18:02 * @LastEditTime : 2019-12-27 16:52:30
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';

Loading…
Cancel
Save