chromesetting
杨树明 5 years ago
parent 97a432fa6a
commit 3159d3fd1e

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

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

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

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

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

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

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

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

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

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

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

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

@ -59,7 +59,7 @@ class Challenges extends Component {
isopentitletype:"Less",
})
}
this.getjianjiesize()
}
}
}).catch((error) => {
@ -67,24 +67,21 @@ class Challenges extends Component {
});
}
componentDidMount() {
this.ChallengesList()
}
componentDidUpdate = (prevProps,prevState) => {
//防止陷入无限循环
if(prevState.ChallengesDataList!=this.state.ChallengesDataList){
getjianjiesize=()=>{
let {ChallengesDataList}=this.state;
let boxoffsetHeigh;
let box=document.getElementById("shixunchallengesid");
if(box){
boxoffsetHeigh=box.offsetHeight
if(boxoffsetHeigh<300){
if(boxoffsetHeigh<ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?160:300){
debugger
this.setState({
isopentitletype:"Less",
boxoffsetHeigh:boxoffsetHeigh
})
}else{
debugger
this.setState({
opentitletype:true,
isopentitletype:"greater",
@ -95,6 +92,17 @@ class Challenges extends Component {
}
}
componentDidMount() {
this.ChallengesList()
}
componentDidUpdate = (prevProps,prevState) => {
//防止陷入无限循环
if(prevState.ChallengesDataList!=this.state.ChallengesDataList){
this.getjianjiesize()
}
}
updatamakedown = (id) => {
setTimeout(() => {
@ -333,7 +341,7 @@ class Challenges extends Component {
opentitle=()=>{
this.setState({
opentitletype:!this.state.opentitletype,
isopentitletype:!this.state.opentitletype===false?"Less":"greater"
})
}
@ -415,7 +423,7 @@ class Challenges extends Component {
this.props.identity < 5?<a className="fr font-14 color-blue mr20" href="/forums/2943"
target="_blank">实训制作指南</a> : "":""}
</div>
{this.state.opentitletype===true?<style>
{ChallengesDataList === undefined || ChallengesDataList&&ChallengesDataList.description=== ""||ChallengesDataList&&ChallengesDataList.description===null||ChallengesDataList&&ChallengesDataList.description===undefined?this.state.opentitletype===true?<style>
{
`
#shixunchallengesid{
@ -424,7 +432,16 @@ class Challenges extends Component {
}
`
}
</style>:""}
</style>:"":<style>
{
`
#shixunchallengesid{
max-height: 160px;
overflow: hidden;
}
`
}
</style>}
<div>
<div className={"pd20"} id={"shixunchallengesid"}>
<style>
@ -454,7 +471,7 @@ class Challenges extends Component {
</div>
</div>
{this.state.isopentitletype==="Less"?"":this.state.opentitletype===true?<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}>
{this.state.isopentitletype==="Less"&&this.state.opentitletype===false?<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}>
<a className={"font-14 color-grey-9"}>阅读全文 <i className={"iconfont icon-jiantou9 font-14"}></i></a>
</Divider>:<Divider dashed={true} onClick={()=>this.opentitle()} className={"pointer Breadcrumbfont color-grey-9 "}>
<a className={"font-14 color-grey-9"}>收起全文 <i className={"iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu- font-14"}></i></a>

Loading…
Cancel
Save