Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

chromesetting
杨树明 5 years ago
commit e1869554ef

@ -41,7 +41,9 @@ json.top do
json.old_url @old_domain json.old_url @old_domain
# 云上实验室管理权限 # 云上实验室管理权限
json.laboratory_user current_laboratory.laboratory_users.exists?(user_id: @user&.id) || @user&.admin_or_business? laboratory_user = current_laboratory.laboratory_users.exists?(user_id: @user&.id) || @user&.admin_or_business?
json.laboratory_user laboratory_user
json.laboratory_admin_url laboratory_user ? "/cooperative" : nil
end end
json.down do json.down do

@ -45,11 +45,13 @@ class College extends Component {
align: 'center', align: 'center',
className: "edu-txt-center font-14 maxnamewidth340", className: "edu-txt-center font-14 maxnamewidth340",
render: (text, record) => ( render: (text, record) => (
<span className="maxnamewidth340"> <a className="maxnamewidth340" title={record.teachers} style={{
color:'#05101A'
}}>
{ {
record.teachers record.teachers
} }
</span> </a >
) )
}, },
{ {

@ -7,7 +7,7 @@
background-color: rgba(18,28,36,1); background-color: rgba(18,28,36,1);
color: #fff; color: #fff;
height: 56px; height: 56px;
padding: 0 30px; padding: 0 20px;
.flex_strict{ .flex_strict{
flex: 1; flex: 1;
} }

@ -4,11 +4,11 @@
* @Github: * @Github:
* @Date: 2019-11-21 09:19:38 * @Date: 2019-11-21 09:19:38
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 17:54:28 * @LastEditTime: 2019-12-20 09:23:07
*/ */
import './index.scss'; import './index.scss';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Collapse, Icon, Input, Form, Button } from 'antd'; import { Collapse, Icon, Input, Form } from 'antd';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import actions from '../../../../../redux/actions'; import actions from '../../../../../redux/actions';
import { CNotificationHOC} from 'educoder'; import { CNotificationHOC} from 'educoder';
@ -18,14 +18,14 @@ const FormItem = Form.Item;
const AddTestDemo = (props) => { const AddTestDemo = (props) => {
const { const {
key, key,
onSubmitTest, // onSubmitTest,
onDeleteTest, onDeleteTest,
testCase, testCase,
testCaseValidate, testCaseValidate,
isOpen isOpen
} = props; } = props;
const [isEditor, setIsEditor] = useState(false); // 是否是编辑 // const [isEditor, setIsEditor] = useState(false); // 是否是编辑
// 删除操作 // 删除操作
const handleDeletePanel = (e) => { const handleDeletePanel = (e) => {
@ -73,54 +73,54 @@ const AddTestDemo = (props) => {
) )
// 取消操作 // 取消操作
const handleReset = (e) => { // const handleReset = (e) => {
e.preventDefault(); // e.preventDefault();
props.form.resetFields(); // props.form.resetFields();
} // }
// 保存 // 保存
const handleSubmit = (e) => { // const handleSubmit = (e) => {
e.preventDefault(); // e.preventDefault();
props.form.validateFields((err, values) => { // props.form.validateFields((err, values) => {
if (err) { // if (err) {
return; // return;
} // }
console.log('提交表单: ', values); // console.log('提交表单: ', values);
onSubmitTest(values); // onSubmitTest(values);
}); // });
} // }
// 编辑后保存 // 编辑后保存
const handleEditorOrSave = (e) => { // const handleEditorOrSave = (e) => {
if (!isEditor) { // if (!isEditor) {
setIsEditor(true); // setIsEditor(true);
} else { // } else {
// TODO 调用修改测试用例接口 // // TODO 调用修改测试用例接口
setIsEditor(false); // 保存后 设置 false // setIsEditor(false); // 保存后 设置 false
} // }
} // }
// 渲染提交按钮 // 渲染提交按钮
const renderSubmitBtn = () => { // const renderSubmitBtn = () => {
const { identifier, testCase, loading } = props; // const { identifier, testCase, loading } = props;
// console.log('========', identifier); // // console.log('========', identifier);
// 1. 新增时,不显示按钮 // // 1. 新增时,不显示按钮
if (identifier) { // if (identifier) {
if (testCase.isAdd) { // if (testCase.isAdd) {
return ( // return (
<FormItem style={{ textAlign: 'right' }}> // <FormItem style={{ textAlign: 'right' }}>
<Button style={{ marginRight: '20px' }} onClick={handleReset}>取消</Button> // <Button style={{ marginRight: '20px' }} onClick={handleReset}>取消</Button>
<Button type="primary" onClick={handleSubmit}>保存</Button> // <Button type="primary" onClick={handleSubmit}>保存</Button>
</FormItem> // </FormItem>
); // );
} else { // } else {
return ( // return (
<FormItem style={{ textAlign: 'right' }}> // <FormItem style={{ textAlign: 'right' }}>
<Button onClick={handleEditorOrSave} loading={loading}>{isEditor ? '保存' : (loading ? '保存' : '编辑')}</Button> // <Button onClick={handleEditorOrSave} loading={loading}>{isEditor ? '保存' : (loading ? '保存' : '编辑')}</Button>
</FormItem> // </FormItem>
); // );
} // }
} // }
} // }
/** /**
* 文本输入框可编辑的情况 * 文本输入框可编辑的情况
@ -128,9 +128,9 @@ const AddTestDemo = (props) => {
* 2. isAdd false isEditor 为true * 2. isAdd false isEditor 为true
* @param {*} testCase * @param {*} testCase
*/ */
const isDisabled = (testCase) => { // const isDisabled = (testCase) => {
return !testCase.isAdd && !isEditor; // return !testCase.isAdd && !isEditor;
}; // };
// const {input = {}, output = {}} = (testCasesValidate[index] = {}); // const {input = {}, output = {}} = (testCasesValidate[index] = {});
const activePane = { const activePane = {
@ -158,7 +158,8 @@ const AddTestDemo = (props) => {
rows={5} rows={5}
value={testCase.input} value={testCase.input}
onChange={handleInputChange} onChange={handleInputChange}
disabled={isDisabled(testCase)}/> // disabled={isDisabled(testCase)}
/>
</FormItem> </FormItem>
<FormItem <FormItem
label={<span className={'label_text'}>输出</span>} label={<span className={'label_text'}>输出</span>}
@ -170,9 +171,10 @@ const AddTestDemo = (props) => {
rows={5} rows={5}
value={testCase.output} value={testCase.output}
onChange={handleOutputChange} onChange={handleOutputChange}
disabled={isDisabled(testCase)}/> // disabled={isDisabled(testCase)}
/>
</FormItem> </FormItem>
{renderSubmitBtn()} {/* {renderSubmitBtn()} */}
</Form> </Form>
</Panel> </Panel>
</Collapse> </Collapse>

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 10:35:40 * @Date: 2019-11-20 10:35:40
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 17:23:10 * @LastEditTime: 2019-12-19 20:16:32
*/ */
import './index.scss'; import './index.scss';
// import 'katex/dist/katex.css'; // import 'katex/dist/katex.css';
@ -311,7 +311,7 @@ class EditTab extends React.Component {
<div style={{ marginTop: '15px'}}> <div style={{ marginTop: '15px'}}>
<QuillForEditor <QuillForEditor
style={{ height: '200px', 'overflowY': 'auto' }} style={{ height: '200px', 'overflowY': 'auto' }}
placeholder="init content" placeholder="请输入描述信息"
onContentChange={handleContentChange} onContentChange={handleContentChange}
options={quillConfig} options={quillConfig}
value={ojForm.description} value={ojForm.description}

@ -48,7 +48,7 @@
.test_demo_title, .test_demo_title,
.test_demo_ctx, .test_demo_ctx,
.editor_form{ .editor_form{
margin: 0 30px; margin: 0 20px;
.ant-form-explain{ .ant-form-explain{
margin-top: 5px; margin-top: 5px;
@ -68,7 +68,7 @@
top: 43px; top: 43px;
left: -30px; left: -30px;
right: -30px; right: -30px;
padding: 0 30px; padding: 0 20px;
// background: gold; // background: gold;
background: rgb(249,249,249); background: rgb(249,249,249);
z-index: 1000; z-index: 1000;
@ -77,5 +77,9 @@
.collapse_area{ .collapse_area{
margin-bottom: 20px; margin-bottom: 20px;
.ant-form-item{
margin-bottom: 0px;
}
} }
} }

@ -17,7 +17,7 @@
} }
.code-title, .code-title,
.pane_control_opts{ .pane_control_opts{
padding: 0 30px; padding: 0 20px;
} }
.code-title{ .code-title{

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-04 08:36:21 * @Date: 2019-12-04 08:36:21
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-10 18:55:02 * @LastEditTime: 2019-12-20 10:38:00
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -79,7 +79,7 @@ function RecordDetail (props) {
</div> </div>
<div className="detail_ctx_status"> <div className="detail_ctx_status">
<span className="status_label"> <span className="status_label">
状态: <span className="status_label_error">{reviewResult[detail.status]}</span> 状态: <span className={detail.status === 0 ? 'status_label_success' : 'status_label_error'}>{reviewResult[detail.status]}</span>
</span> </span>
<span className="status_label"> <span className="status_label">
提交时间: <span className="status_label_sub"> 提交时间: <span className="status_label_sub">
@ -89,6 +89,7 @@ function RecordDetail (props) {
<span className="status_label"> <span className="status_label">
语言: <span className="status_label_sub">C</span> 语言: <span className="status_label_sub">C</span>
</span> </span>
{/* <span className> */}
</div> </div>
<div className="result_error_area"> <div className="result_error_area">
<ErrorResult detail={detail}/> <ErrorResult detail={detail}/>

@ -2,7 +2,7 @@
.record_detail_area{ .record_detail_area{
.record_detail_ctx{ .record_detail_ctx{
padding: 0 30px; padding: 0 20px;
.detail_ctx_header{ .detail_ctx_header{
position: relative; position: relative;
height: 56px; height: 56px;

@ -88,7 +88,7 @@
.add_editor_list_area{ .add_editor_list_area{
background: #fff; background: #fff;
padding: 0 30px; padding: 0 20px;
margin: 0; margin: 0;
.add_editor_item{ .add_editor_item{
display: inline-block; display: inline-block;

@ -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-05 10:38:49 * @LastEditTime: 2019-12-20 09:35:00
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
@ -79,6 +79,9 @@ const CommitRecord = (props) => {
const [pagination, setPagination] = useState(paginationConfig); const [pagination, setPagination] = useState(paginationConfig);
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
let clipboard;
// const [recordDetail, setRecordDetail] = useState({}); // const [recordDetail, setRecordDetail] = useState({});
const [renderCtx, setRenderCtx] = useState(() => { const [renderCtx, setRenderCtx] = useState(() => {
return function () { return function () {
@ -89,14 +92,14 @@ const CommitRecord = (props) => {
const renderRecordDetail = () => { const renderRecordDetail = () => {
const { const {
id, id,
error_line, // error_line,
error_msg, // error_msg,
execute_memory, // execute_memory,
execute_time, // execute_time,
input, // input,
output, // output,
status, status,
expected_output // expected_output
} = commitRecordDetail; } = commitRecordDetail;
if (Object.keys(commitRecordDetail).length > 0) { if (Object.keys(commitRecordDetail).length > 0) {
console.log('当前状态====》》》', status); console.log('当前状态====》》》', status);
@ -146,9 +149,12 @@ const CommitRecord = (props) => {
setRenderCtx(() => (renderRecordDetail)) setRenderCtx(() => (renderRecordDetail))
}, [commitRecordDetail]); }, [commitRecordDetail]);
// 复制功能 // 复制功能
useEffect(() => { useEffect(() => {
if (!clipboard) {
clipboard = new ClipboardJS('.copy_error');
}
if (commitRecordDetail.status !== 0) { if (commitRecordDetail.status !== 0) {
const clipboard = new ClipboardJS('.copy_error');
clipboard.on('success', (e) => { clipboard.on('success', (e) => {
message.success('复制成功'); message.success('复制成功');
e.clearSelection(); e.clearSelection();

@ -1,6 +1,6 @@
.commit_record_area{ .commit_record_area{
// padding: 20px 30px; // padding: 20px 30px;
padding: 0 30px; padding: 0 20px;
.record_header{ .record_header{
display: flex; display: flex;
// justify-content: space-between; // justify-content: space-between;

@ -16,7 +16,7 @@
box-sizing: border-box; box-sizing: border-box;
border-top: 1px solid rgba(244,244,244,1); border-top: 1px solid rgba(244,244,244,1);
// background: pink; // background: pink;
padding: 0 30px; padding: 0 20px;
// background-color: rgba(250,250,250,1); // background-color: rgba(250,250,250,1);
background: #fff; background: #fff;
@ -32,7 +32,7 @@
} }
.commit_record_area{ .commit_record_area{
padding: 0 30px; padding: 0 20px;
// height: calc(100vh - 178px); // height: calc(100vh - 178px);
// overflow-y: auto; // overflow-y: auto;
} }
@ -40,6 +40,7 @@
.task_desc_area{ .task_desc_area{
height: calc(100vh - 242px); height: calc(100vh - 242px);
overflow-y: auto;
padding: 0 0 0 15px; padding: 0 0 0 15px;
} }
.desc_area_header{ .desc_area_header{
@ -47,7 +48,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
height: 64px; height: 64px;
padding: 0 30px; padding: 0 20px;
.header_flex{ .header_flex{
font-size: 14px; font-size: 14px;
.flex_label{ .flex_label{

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 09:49:30 * @Date: 2019-11-27 09:49:30
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 09:22:52 * @LastEditTime: 2019-12-20 09:39:35
*/ */
import '../index.scss'; import '../index.scss';
import React from 'react'; import React from 'react';

@ -1218,7 +1218,7 @@ submittojoinclass=(value)=>{
} }
{ {
this.props.Headertop && this.props.Headertop.laboratory_user && this.props.Headertop && this.props.Headertop.laboratory_user &&
<li><a href="/cooperative">后台管理</a></li> <li><a href={this.props.Headertop.laboratory_admin_url}>后台管理</a></li>
} }
<li><a href={`/account/profile`}>账号管理</a></li> <li><a href={`/account/profile`}>账号管理</a></li>

@ -461,7 +461,7 @@ class TPMDataset extends Component {
const uploadProps = { const uploadProps = {
width: 600, width: 600,
fileList, fileList,
multiple: false, multiple: true,
//multiple 是否支持多选 查重的时候不能多选 不然弹许多框出来 //multiple 是否支持多选 查重的时候不能多选 不然弹许多框出来
// https://github.com/ant-design/ant-design/issues/15505 // https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。

@ -6,7 +6,7 @@
line-height: 44px; line-height: 44px;
// background-color: #EEEEEE; // background-color: #EEEEEE;
background: #fff; background: #fff;
padding: 0 30px; padding: 0 20px;
font-size: 16px; font-size: 16px;
// box-size: border-box; // box-size: border-box;
box-sizing: border-box; box-sizing: border-box;

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-27 13:42:11 * @Date: 2019-11-27 13:42:11
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-19 15:11:56 * @LastEditTime: 2019-12-20 10:25:42
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -171,29 +171,8 @@ export const updateCode = (identifier, inputValue, type) => {
} }
} }
/** // 代码评测
* @description 调试代码 export const codeEvaluate = (dispatch, identifier, type, time_limit) => {
* @param {*} identifier
* @param {*} inputValue 输入值: 自定义 | 系统返回的
* @param {*} type 测评类型 debug | submit
*/
export const debuggerCode = (identifier,value, type) => {
return (dispatch, getState) => {
// 调用之前 先保存 code
// TODO
// console.log(identifier, value);
const {hack: {time_limit = 0}} = getState().ojForUserReducer;
if (!type || type === 'debug') {
dispatch({ // 加载中...
type: types.TEST_CODE_STATUS,
payload: 'loading'
});
}
fetchDebuggerCode(identifier, value).then(res => {
// console.log('调用调试代码成功并返回结果: ', res);
const { status } = res;
if (status === 200) {
// 调试代码成功后,调用轮循接口, 注意: 代码执行的时间要小于设置的时间限制 // 调试代码成功后,调用轮循接口, 注意: 代码执行的时间要小于设置的时间限制
const intervalTime = 500; const intervalTime = 500;
let count = 1; let count = 1;
@ -203,13 +182,6 @@ export const debuggerCode = (identifier,value, type) => {
* @param {*} count 执行次数 * @param {*} count 执行次数
* @param {*} timer 定时器 * @param {*} timer 定时器
*/ */
if (res.data.status === 401) {
dispatch({ // 改变 loading 值
type: types.LOADING_STATUS,
payload: false
});
return;
};
function getCodeSubmit (intervalTime, finalTime, count, timer){ function getCodeSubmit (intervalTime, finalTime, count, timer){
const excuteTime = (count++) * intervalTime; // 当前执行时间 const excuteTime = (count++) * intervalTime; // 当前执行时间
fetchCodeSubmit(identifier, { mode: type }).then(res => { fetchCodeSubmit(identifier, { mode: type }).then(res => {
@ -286,6 +258,40 @@ export const debuggerCode = (identifier,value, type) => {
getCodeSubmit(intervalTime, time_limit, count++, timer); getCodeSubmit(intervalTime, time_limit, count++, timer);
}, intervalTime); }, intervalTime);
} }
/**
* @description 调试代码
* @param {*} identifier
* @param {*} inputValue 输入值: 自定义 | 系统返回的
* @param {*} type 测评类型 debug | submit
*/
export const debuggerCode = (identifier,value, type) => {
return (dispatch, getState) => {
// 调用之前 先保存 code
// TODO
// console.log(identifier, value);
const {hack: {time_limit = 0}} = getState().ojForUserReducer;
if (!type || type === 'debug') {
dispatch({ // 加载中...
type: types.TEST_CODE_STATUS,
payload: 'loading'
});
}
fetchDebuggerCode(identifier, value).then(res => {
// console.log('调用调试代码成功并返回结果: ', res);
const { status } = res;
if (status === 200) {
if (res.data.status === 401) {
dispatch({ // 改变 loading 值
type: types.LOADING_STATUS,
payload: false
});
return;
};
// 测评
codeEvaluate(dispatch, identifier, type, time_limit);
}
}).catch(() => { }).catch(() => {
dispatch({ dispatch({
type: types.TEST_CODE_STATUS, type: types.TEST_CODE_STATUS,
@ -362,7 +368,8 @@ export const changeUserCodeTab = (key) => {
*/ */
export const submitUserCode = (identifier, inputValue, type) => { export const submitUserCode = (identifier, inputValue, type) => {
return (dispatch, getState) => { return (dispatch, getState) => {
const { userCode, isUpdateCode } = getState().ojForUserReducer; const { userCode, isUpdateCode, hack: {time_limit = 0} } = getState().ojForUserReducer;
function userCodeSubmit () { function userCodeSubmit () {
fetchUserCodeSubmit(identifier).then(res => { fetchUserCodeSubmit(identifier).then(res => {
// console.log('用户提交代码成功======》》》》》', res); // console.log('用户提交代码成功======》》》》》', res);
@ -374,12 +381,8 @@ export const submitUserCode = (identifier, inputValue, type) => {
}); });
return; return;
}; };
// 将编辑代码清空 // 测评
dispatch({ codeEvaluate(dispatch, identifier, type, time_limit);
type: types.SAVE_EDITOR_CODE,
payload: ''
});
dispatch(debuggerCode(identifier, inputValue, type || 'submit'));
} }
}).catch(() => { }).catch(() => {
dispatch({ dispatch({

@ -4,11 +4,10 @@
* @Github: * @Github:
* @Date: 2019-11-20 10:55:38 * @Date: 2019-11-20 10:55:38
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-17 14:10:37 * @LastEditTime: 2019-12-20 10:10:53
*/ */
import axios from 'axios'; import axios from 'axios';
import { func } from 'prop-types';
export async function fetchOJList (params) { export async function fetchOJList (params) {
console.log('传递的参数: ', params); console.log('传递的参数: ', params);

Loading…
Cancel
Save