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

video_transcode
caicai8 5 years ago
commit 210e173893

@ -25,7 +25,7 @@ module GitHelper
decode_content =
if cd["encoding"] == 'GB18030' && cd['confidence'] > 0.8
content.encode('UTF-8', 'GBK', {:invalid => :replace, :undef => :replace, :replace => ' '})
elsif cd['encoding'].blank?
elsif cd['encoding'].blank? && !content.blank?
raise("ERROR_UTF8")
else
content.force_encoding('UTF-8')
@ -36,7 +36,7 @@ module GitHelper
rescue Exception => e
Rails.logger.error(e.message)
error_msg = e.message == "ERROR_UTF8" ? "文件无法预览" : "文档内容获取异常"
error_msg = e.message == "ERROR_UTF8" ? "文件编码异常请将文件编码设置为UTF-8" : "文档内容获取异常"
error_status = e.message == "ERROR_UTF8" ? -2 : -1
raise Educoder::TipException.new(error_status, error_msg)
end

@ -64,7 +64,7 @@ class HacksController < ApplicationController
render_ok({identifier: hack.identifier})
rescue => e
logger.error("########create_hack_error: #{e.message}")
render_error("创建失败: #{e.message}")
render_error("#{e.message}")
end
end
@ -96,7 +96,7 @@ class HacksController < ApplicationController
render_ok
rescue Exception => e
logger.error("####update_hack_error: #{e.message}")
render_error("更新失败: #{e.message}")
render_error("#{e.message}")
end
end

@ -2,7 +2,7 @@ desc "同步学院或者单位评测数"
namespace :sync_evaluate do
task outpus_count: :environment do
School.find_in_batches(batch_size: 500) do |school|
School.find_each do |school|
Parallel.each_with_index(school, in_processes: 5) do |s|
puts "school_id:#{s.id}"
evaluate_count = Game.find_by_sql("select sum(g.evaluate_count) as e_count from games g, user_extensions ue where

@ -22,7 +22,7 @@
<meta name=”Description” Content=”EduCoder实训项目为单个知识点关卡实践训练帮助学生巩固单一弱点强化学习。 >
<meta name=”Description” Content=”EduCoder实践教学平台各类大赛为进一步提高各类学生综合运用高级语言程序设计能力培养创新意识和实践探索精神发掘优秀软件人才。 >
<!-- <meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3, user-scalable=no">-->
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3">
<!-- <meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3">-->
<meta name="theme-color" content="#000000">
<!--<meta http-equiv="cache-control" content="no-cache,no-store, must-revalidate" />-->

@ -895,7 +895,7 @@ class College extends Component {
共建实训
</p>
<p className="yslstatistic-base-item-label">
报告
报告
</p>
<p className="yslstatistic-base-item-label">
学员实战时间

@ -77,7 +77,7 @@ function InitTabCtx (props, ref) {
const _handleTestCodeFormSubmit = (cb) => {
const {form} = props;
form.validateFields((err, values) => {
form.validateFieldsAndScroll((err, values) => {
if (!err) { // 表单验证通过时,调用测试接口
cb && cb(); // 调用回调函数,切换 tab
onDebuggerCode && onDebuggerCode(values);

@ -76,7 +76,7 @@ class InitTabCtx extends PureComponent {
handleTestCodeFormSubmit = (cb) => {
const {form, debuggerCode} = this.props;
console.log(debuggerCode);
form.validateFields((err, values) => {
form.validateFieldsAndScroll((err, values) => {
if (!err) { // 表单验证通过时,调用测试接口
cb && cb(); // 调用回调函数,切换 tab
console.log('表单值:', values);

@ -22,7 +22,7 @@ const SettingDrawer = (props) => {
return +fromStore('oj_fontSize') || 14;
});
const [theme, setTheme] = useState(() => {
return fromStore('oj_theme') || 'dark';
return fromStore('oj_theme') || 'vs-dark';
});
const { title, type = 'label', content = [] } = props;
@ -78,7 +78,8 @@ const SettingDrawer = (props) => {
>
{opt.text}
</option>
)});
)
});
renderResult = (
<div className={'setting_desc'} key={`sel_${index}`}>
<span className={'flex_item'}>{ctx.text}</span>

@ -1,13 +1,14 @@
.monaco_editor_area {
height: 100%;
background-color: rgba(7,15,25,1);
.code_title {
display: flex;
align-items: center;
background-color: rgba(18,28,36,1);
color: #fff;
height: 56px;
background-color: rgba(18, 28, 36, 1);
padding: 0 20px;
.flex_strict {
flex: 1;
}
@ -17,9 +18,11 @@
cursor: pointer;
margin-right: 20px;
}
.code-icon {
cursor: pointer;
}
.flex_strict,
.flex_normal,
.code-icon {
@ -27,23 +30,13 @@
}
}
// .margin,
// .margin-view-overlays,
// .current-line{
// width: 40px !important;
// }
// .monaco-editor .margin-view-overlays .line-numbers{
// text-align: center;
// }
// .monaco-scrollable-element{
// left: 40px !important;
// }
}
.setting_drawer {
.ant-drawer-close {
color: #ffffff;
}
.ant-drawer-content {
top: 120px;
bottom: 56px;
@ -51,6 +44,7 @@
// background: #333333;
background: rgba(7, 15, 25, 1);
color: #fff;
.setting_h2 {
color: #fff;
}
@ -62,6 +56,7 @@
// line-height: 24px;
margin-top: 4px;
}
select option {
background: gold;
color: #fff;
@ -76,21 +71,8 @@
animation-iteration-count: 3;
}
// .monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input,
// .monaco-editor .margin,
// .minimap slider-mouseover,
// .minimap-decorations-layer{
// background:rgba(3,19,40,1) !important;
// }
@keyframes blink {
50% {
color: #fff;
}
}
.monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input,
.monaco-editor .margin,
.minimap .minimap-decorations-layer{
background-color: transparent !important;
}

@ -150,7 +150,7 @@ const AddTestDemo = (props) => {
<Panel header={`测试用例${props.index + 1}`} extra={props.index===0?false:genExtra()} key="1">
<Form>
<FormItem
label={<span className={'label_text'}>输入</span>}
label={<span className={''}>输入</span>}
colon={ false }
>
<TextArea

@ -362,15 +362,11 @@ class EditTab extends React.Component {
values.forEach(v => {
_result.push(v.id);
});
// console.log('下拉选择的值:===>>>', _result);
// 保存选择的知识点
this.props.saveTagDisciplineId(_result);
}
// 新增知识点
const handleAddKnowledge = (values) => {
// console.log('调用了新增知识点并返回了结果: ', values);
// 获取课程id
const { sub_discipline_id } = this.props.ojForm;
const obj = Object.assign({}, values, { sub_discipline_id })
tagDisciplines(obj);
@ -398,14 +394,6 @@ class EditTab extends React.Component {
help={ojFormValidate.sub_discipline_id.errMsg}
colon={false}
>
{/* <Select onChange={this.handleChangeCategory} value={`${ojForm.category}`}>
{getOptions('category')}
</Select> */}
{/* <Cascader
options={courseQuestions}
expandTrigger="hover"
onChange={this.handleChangeCategory}
/> */}
{renderCourseQuestion(courseQuestions)}
</FormItem>

@ -90,7 +90,7 @@ function EditTab (props, ref) {
// 向外暴露的方法
useImperativeHandle(ref, () => ({
validateForm () {
props.form.validateFields((err, values) => {
props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
getFormData(() => {
return values;

@ -76,7 +76,7 @@ class InitTabCtx extends PureComponent {
handleTestCodeFormSubmit = (cb) => {
const {form, debuggerCode} = this.props;
// console.log(debuggerCode);
form.validateFields((err, values) => {
form.validateFieldsAndScroll((err, values) => {
if (!err) { // 表单验证通过时,调用测试接口
cb && cb(); // 调用回调函数,切换 tab
// console.log('表单值:', values);

@ -65,7 +65,6 @@ function RecordDetail (props) {
const handleEditorCode = (identifier, code) => {
if (identifier) {
console.log(code);
saveEditorCodeForDetail(code);
props.history.push(`/myproblems/${identifier}`);
}

@ -1,55 +1,68 @@
@import '../split_pane_resizer.scss';
.result_code_area .monaco-editor, .monaco-editor-background, .monaco-editor .inputarea.ime-input{
background-color: #f9f9f9!important;
}
.result_code_area .monaco-editor .line-numbers {
color: #999 !important;
}
.result_code_area .monaco-editor .current-line~.line-numbers {
color: #0b216f !important;
}
.result_code_area .minimap-decorations-layer {
background: rgba(225, 225, 225, 0.2) !important;
}
.result_code_area .monaco-editor .margin {
background-color: #eee !important;
}
.record_detail_area {
background: #fff;
.record_detail_ctx {
padding: 0 20px;
.detail_ctx_header {
position: relative;
height: 56px;
}
.header_h2 {
line-height: 56px;
}
.header_btn {
position: absolute;
right: 0;
top: 14px;
}
.detail_ctx_status {
height: 18px;
line-height: 18px;
.status_label {
color: rgba(153, 153, 153, 1);
margin-right: 40px;
}
.status_label_error {
color: #E51C24;
}
.status_label_success {
color: #28BD8B;
}
.status_label_sub {
color: #333333;
}
.pass_case {
float: right;
margin-right: 0;
}
.pass_case_span {
margin-right: 10px;
}
@ -59,6 +72,7 @@
// height: 500px;
height: calc(100vh - 360px);
}
.result_error_area {
margin-top: 15px;
background: rgba(250, 250, 250, 1);

@ -12,13 +12,10 @@ import { connect } from 'react-redux';
import SplitPane from 'react-split-pane';
import LeftPane from './leftpane';
import RightPane from './rightpane';
// import { Link } from 'react-router-dom';
// import { getImageUrl } from 'educoder'
// import RightPane from '../newOrEditTask/rightpane';
import { Icon } from 'antd';
import UserInfo from '../components/userInfo';
import actions from '../../../redux/actions';
import { fromStore, CNotificationHOC} from 'educoder';
import { CNotificationHOC } from 'educoder';
import { withRouter } from 'react-router';
function StudentStudy(props) {
@ -27,8 +24,6 @@ function StudentStudy (props) {
const {
hack,
userInfo,
// hack_identifier,
// user_program_identifier,
restoreInitialCode,
changeUserCodeTab,
changeShowOrHideControl,
@ -47,10 +42,6 @@ function StudentStudy (props) {
useEffect(() => {
// 保存当前的id
saveUserProgramIdentifier(id);
// startProgramQuestion(id);
// console.log("getUserProgramDetail(id)");
// console.log(id);
// console.log(id.charAt(id.length-1));
try {
if (id.charAt(id.length - 1) === "?") {
id = id.substring(0, id.length - 1);
@ -74,17 +65,14 @@ function StudentStudy (props) {
changeUserCodeTab(tab);
}
}, []);
useEffect(() => {
const { hack = {} } = props;
if (hack.modify_code && hasUpdate) { // 代码更改,提示是否需要更新代码
if (hack && hack.modify_code && hasUpdate) { // 代码更改,提示是否需要更新代码
setHasUpdate(false);
handleUpdateNotice();
}
}, [props, hasUpdate, setHasUpdate]);
}, [hack, hack.modify_code, hasUpdate]);
const handleUpdateNotice = () => {
console.log(props);
props.confirm({
title: '提示',
content: (
@ -97,22 +85,7 @@ function StudentStudy (props) {
restoreInitialCode(id, '更新成功');
}
})
// Modal.confirm({
// title: '提示',
// content: (
// <p>
// 代码文件有更新啦 <br />
// 还未提交的代码,请自行保存
// </p>
// ),
// okText: '立即更新',
// cancelText: '稍后再说',
// onOk () {
// restoreInitialCode(id, '更新成功');
// }
// });
}
// const _hack_id = hack_identifier || fromStore('hack_identifier');
// 处理编辑
const handleClickEditor = (identifier) => {
if (!identifier) return;

@ -40,24 +40,32 @@ const RightPane = (props) => {
const handleSubmitForm = () => {
// 提交时, 先调用提交接口,提交成功后,循环调用测评接口
// saveOpacityType('submit');
submitUserCode(identifier, submitInput, 'submit');
// // 提交时,先调用评测接口, 评测通过后才调用保存接口
// updateCode(identifier, submitInput, 'submit');
}
let timer = null; // 定时器
// 代码块内容变化时
const handleCodeChange = (value) => {
// console.log('编辑器代码 ======》》》》》》》》》++++++++++', value);
saveUserInputCode(value);
// setEditorCode(value);
if (!timer) {
timer = setInterval(function () {
clearInterval(timer);
timer = null;
saveUserCodeForInterval(identifier);
}, 10000);
}, 5000);
}
}
// 代码调试
const handleDebuggerCode = (value) => {
// 调用保存代码块接口,成功后,调用调试接口
// saveOpacityType('debug');
updateCode(identifier, value, 'debug');
}
// 恢复初始代码
@ -80,7 +88,7 @@ const RightPane = (props) => {
}
const handleSubmitNote = () => {
props.form.validateFields((err, values) => {
props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
changeLoadingState(true);
addNotes(identifier, values, function () {

@ -331,7 +331,7 @@ export default class Shixuninformation extends Component {
<Checkbox
checked={this.state.test_set_permission}
onChange={this.Checktest_set_permission}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许学员允许学员通过金币解锁查看隐藏测试集的内容</label>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许学员通过金币解锁查看隐藏测试集的内容</label>
</span>
</div>

@ -362,11 +362,11 @@ class Repository extends Component {
{commits===undefined?"":commits[0].time}
</acronym> {commits===undefined?"":commits[0].title}
</span>
<a href={`/shixuns/${match.params.shixunId}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}/${match.params.shixunId}/commits`}
<Link to={`/shixuns/${match.params.shixunId}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}/${match.params.shixunId}/commits`}
className="color-grey-8 fr font-16 mt3">
<i className="iconfont icon-tijiaojilu font-18 fl mr5"></i>
<span className="fl color-grey-8 ">提交记录</span>
</a>
</Link>
</div>}

@ -218,7 +218,7 @@ class RepositoryAddFile extends Component {
{
`
.padding20-30{
padding:20px 30px 5px 30px;
padding:20px 30px 60px 30px;
}
.formStyle .ant-form-item{
margin-bottom:0px !important;
@ -231,31 +231,20 @@ class RepositoryAddFile extends Component {
<p className="ant-form-item-label">
<div className={"font-20 color-black"}>新建文件</div>
</p>
<Form.Item label="提交信息">
{getFieldDecorator('message', {
rules: [{
required: true, message: '请输入提交信息',
},{
whitespace: true, message: '请勿输入空格'
}],
})(
<Input placeholder="必填描述主要修改内容相当于Git Commit message的Header" size="large" className="winput-300-35 fl "/>
)}
</Form.Item>
<div className={"mt50"}>
<Form.Item>
<div className={" mb50"}>
<Form.Item label="文件名称或文件路径">
{getFieldDecorator('path', {
rules: [{
required: true, message: '请输入提交信息',
required: true, message: '请输入文件名称或文件路径',
},{
whitespace: true, message: '请勿输入空格'
}],
})(
<span>
<span> </span><span><Input value={this.state.path} placeholder="文件名称或文件路径" className="fl" style={{ width: 200 }} size="large" onInput={(e)=>this.setinput(e)}/></span><span className={" ml10 fl"}>
提示1.输入文件名可以创建一个新文件2.输入新文件夹名/新文件名可以创建新文件夹和新文件</span>
<span> </span><span><Input value={this.state.path} placeholder="请输入文件名称或文件路径" className="fl" style={{ width: 240 }} size="large" onInput={(e)=>this.setinput(e)}/></span><span className={" ml10 fl"}>
提示1.输入文件名可以创建一个新文件2.输入新文件夹名/新文件名可以创建新文件夹和新文件step1/HelloWorld.java</span>
</span>
)}
</Form.Item>
@ -276,7 +265,18 @@ class RepositoryAddFile extends Component {
<div className="mt10 mb25 repoCMWrapper filecode">
<textarea className="" id="codemirror-file-edit" style={{display:'none'}} name="content"></textarea>
</div>
<Form.Item label="提交信息">
{getFieldDecorator('message', {
rules: [{
required: true, message: '请输入提交信息',
},{
whitespace: true, message: '请勿输入空格'
}],
})(
<Input placeholder="请输入本次提交的主要信息,合理的描述信息有利于代码历史记录的管理" size="large" className="winput-300-35 fl "/>
)}
</Form.Item>
{/*<Form.Item label="提交信息">*/}
{/* {getFieldDecorator('message', {*/}
{/* rules: [{required: true, message: "请输入提交信息"}],*/}

@ -266,23 +266,14 @@ class RepositoryAddFileupload_files extends Component {
<div className={"font-20 color-black"}>上传文件</div>
</p>
<Form.Item label="提交信息">
{getFieldDecorator('message', {
rules: [{
required: true, message: '请输入提交信息',
},{
whitespace: true, message: '请勿输入空格'
}],
})(
<Input placeholder="必填描述主要修改内容相当于Git Commit message的Header" onInput={this.FormInput} className="winput-300-35 fl"/>
)}
</Form.Item>
<div>
<p className="ant-form-item-label">
<div className={"color888 font-16"}>当前目录{this.state.filspath===""?"/":"/"+this.state.filspath} <span className={"color-blue pointer"} onClick={this.Selectfiledirectory}>选择文件目录</span></div>
</p>
</div>
{/*<div className="mt10 mb25 repoCMWrapper filecode">*/}
@ -308,7 +299,18 @@ class RepositoryAddFileupload_files extends Component {
{/* <textarea className="winput-100-130 fl"></textarea>*/}
{/* )}*/}
{/*</Form.Item>*/}
<Form.Item label="提交信息">
{getFieldDecorator('message', {
rules: [{
required: true, message: '请输入提交信息',
},{
whitespace: true, message: '请勿输入空格'
}],
})(
<Input placeholder="必填描述主要修改内容相当于Git Commit message的Header" onInput={this.FormInput} className="winput-300-35 fl"/>
)}
</Form.Item>
</div>
</Form>
</div>

@ -9,6 +9,7 @@ import UpgradeModals from '../../modals/UpgradeModals';
import GotoQQgroup from '../../../modal/GotoQQgroup'
import btnUrl from './btn-new.png'
const queryString = require('query-string');
class ShixunsIndex extends Component {
constructor(props) {
super(props)

@ -168,6 +168,39 @@ export const validateOjForm = (props, type, cb) => {
tcValidResult.push(tempObj);
});
try {
if(ojForm.sub_discipline_id.length===0){
hasSuccess = false;
notification['error']({
message: '提示',
description: '课程必须选择!'
});
}else if(ojForm.timeLimit===null){
hasSuccess = false;
notification['error']({
message: '提示',
description: '时间限制必须输入!'
});
} else if(ojForm.name.length===0){
hasSuccess = false;
notification['error']({
message: '提示',
description: '任务名称必须输入!'
});
}else if(ojForm.description.length===0){
hasSuccess = false;
notification['error']({
message: '提示',
description: '描述必须输入!'
});
}
}catch (e) {
}
// if (testCases.length === 0) {
// hasSuccess = false;
// notification['error']({

@ -137,6 +137,7 @@ const ojForUserReducer = (state = initialState, action) => {
} else {
curHack['code'] = '';
}
curHack['modify_code'] = false
return {
...state,
hack: Object.assign({}, state.hack, curHack),

Loading…
Cancel
Save