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

video_transcode
caicai8 5 years ago
commit 48a5bd1b57

@ -1,7 +1,7 @@
class HackSet < ApplicationRecord class HackSet < ApplicationRecord
validates_length_of :input, maximum: 1000, message: "不能超过1000个字符" validates_length_of :input, maximum: 1000, message: "不能超过1000个字符"
validates_length_of :output, maximum: 1000, message: "不能超过1000个字符" validates_length_of :output, maximum: 1000, message: "不能超过1000个字符"
validates :input, presence: { message: "测试集输入不能为空" } #validates :input, presence: { message: "测试集输入不能为空" }
validates :output, presence: { message: "测试集输出不能为空" } validates :output, presence: { message: "测试集输出不能为空" }
validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同" validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同"
# 编程题测试集 # 编程题测试集

@ -221,7 +221,7 @@ function generateNewIndexJsp() {
// <script type="text/javascript" src="/js/js_min_all.js"></script> // <script type="text/javascript" src="/js/js_min_all.js"></script>
var result = data var result = data
.replace(jsMinAllRegex, code) .replace(jsMinAllRegex, code)
.replace(flvMinAllRegex) .replace(flvMinAllRegex,'')
// .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) // .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`)
// .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`)

@ -807,16 +807,16 @@ class App extends Component {
render={ render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />) (props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
} /> } />
<Route path="/question/edit/:id" <Route path="/problemset/edit/:id"
render={ render={
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />) (props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)
} /> } />
<Route path="/question/newitem" <Route path="/problemset/newitem"
render={ render={
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />) (props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)
} /> } />
<Route path="/question/:type" <Route path="/problemset/:type"
render={ render={
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />) (props) => (<Headplugselection {...this.props} {...props} {...this.state} />)
} /> } />
@ -835,7 +835,7 @@ class App extends Component {
(props) => (<Developer {...this.props} {...props} {...this.state} />) (props) => (<Developer {...this.props} {...props} {...this.state} />)
}/> }/>
<Route path="/question" <Route path="/problemset"
render={ render={
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />) (props) => (<Headplugselection {...this.props} {...props} {...this.state} />)
}/> }/>

@ -1,7 +1,7 @@
/* /*
* @Description: 新建或编辑任务 * @Description: 新建或编辑任务
* @Author: tangjiang * @Author: tangjiang
* @Date: 2019-11-15 16:38:34 * @Date: 2019-11-15 16:38:34
* @Last Modified by: tangjiang * @Last Modified by: tangjiang
* @Last Modified time: 2019-11-19 23:23:41 * @Last Modified time: 2019-11-19 23:23:41
*/ */
@ -20,7 +20,7 @@ import actions from '../../../redux/actions';
// import {ModalConfirm} from '../../../common/components/ModalConfirm'; // import {ModalConfirm} from '../../../common/components/ModalConfirm';
const NewOrEditTask = (props) => { const NewOrEditTask = (props) => {
const { const {
publishLoading, publishLoading,
handlePublish, handlePublish,
// testCases = [], // testCases = [],
@ -41,7 +41,7 @@ const NewOrEditTask = (props) => {
courseQuestions courseQuestions
// updateTestAndValidate, // updateTestAndValidate,
} = props; } = props;
// 表单提交 // 表单提交
const handleSubmitForm = () => { const handleSubmitForm = () => {
// 改变loading状态 // 改变loading状态
@ -53,7 +53,7 @@ const NewOrEditTask = (props) => {
props.handleFormSubmit(props); // 提交表单 props.handleFormSubmit(props); // 提交表单
} }
}; };
useEffect(() => { useEffect(() => {
// 获取用户信息 // 获取用户信息
getUserInfoForNew(); getUserInfoForNew();
@ -121,7 +121,7 @@ const NewOrEditTask = (props) => {
// 清空描述信息 // 清空描述信息
toStore('oj_description', ''); toStore('oj_description', '');
// props.history.push('/problems'); // props.history.push('/problems');
props.history.push(`/question?${props.searchParams}`); props.history.push(`/problemset?${props.searchParams}`);
} }
// 发布 // 发布
@ -163,8 +163,8 @@ const NewOrEditTask = (props) => {
onClick={handleClickCancel} onClick={handleClickCancel}
style={{ background: '#666666', color: '#fff', border: 'none' }} style={{ background: '#666666', color: '#fff', border: 'none' }}
>取消</Button> >取消</Button>
<Button <Button
type="primary" type="primary"
loading={submitLoading} loading={submitLoading}
onClick={handleSubmitForm} onClick={handleSubmitForm}
>保存</Button> >保存</Button>
@ -174,14 +174,14 @@ const NewOrEditTask = (props) => {
// 发布/模拟挑战 // 发布/模拟挑战
const renderPubOrFight = () => { const renderPubOrFight = () => {
const pubButton = isPublish const pubButton = isPublish
? (<Button ? (<Button
style={{ background: 'rgba(102,102,102,1)', border: 'none' }} style={{ background: 'rgba(102,102,102,1)', border: 'none' }}
type="primary" type="primary"
loading={publishLoading} loading={publishLoading}
onClick={handleClickCancelPublish} onClick={handleClickCancelPublish}
>撤销发布</Button>) >撤销发布</Button>)
: (<Button : (<Button
type="primary" type="primary"
loading={publishLoading} loading={publishLoading}
onClick={handleClickPublish} onClick={handleClickPublish}
>立即发布</Button>); >立即发布</Button>);
@ -191,13 +191,13 @@ const NewOrEditTask = (props) => {
) : ( ) : (
<Button type="primary" onClick={imitationChallenge}>模拟挑战</Button> <Button type="primary" onClick={imitationChallenge}>模拟挑战</Button>
); );
if (isPublish) { if (isPublish) {
return ( return (
<React.Fragment> <React.Fragment>
{pubButton} {pubButton}
<Button <Button
type="primary" type="primary"
loading={submitLoading} loading={submitLoading}
onClick={handleSubmitForm} onClick={handleSubmitForm}
>保存</Button> >保存</Button>
@ -207,8 +207,8 @@ const NewOrEditTask = (props) => {
} else { } else {
return ( return (
<React.Fragment> <React.Fragment>
<Button <Button
type="primary" type="primary"
loading={submitLoading} loading={submitLoading}
onClick={handleSubmitForm} onClick={handleSubmitForm}
>保存</Button> >保存</Button>
@ -217,7 +217,7 @@ const NewOrEditTask = (props) => {
</React.Fragment> </React.Fragment>
); );
} }
} }
// 渲染退出 // 渲染退出
@ -296,7 +296,7 @@ const mapDispatchToProps = (dispatch) => ({
clearOJFormStore: () => dispatch(actions.clearOJFormStore()), clearOJFormStore: () => dispatch(actions.clearOJFormStore()),
// 按钮状态 // 按钮状态
changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)), changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)),
// 发布按钮状态 // 发布按钮状态
changePublishLoadingStatus: (flag) => dispatch(actions.changePublishLoadingStatus(flag)), changePublishLoadingStatus: (flag) => dispatch(actions.changePublishLoadingStatus(flag)),
// 测试用例及验证 // 测试用例及验证
updateTestAndValidate: (obj) => dispatch(actions.updateTestAndValidate(obj)), updateTestAndValidate: (obj) => dispatch(actions.updateTestAndValidate(obj)),

@ -129,7 +129,7 @@ function StudentStudy (props) {
changeShowOrHideControl(false); changeShowOrHideControl(false);
props.saveEditorCodeForDetail(''); props.saveEditorCodeForDetail('');
// props.history.push('/problems'); // props.history.push('/problems');
props.history.push(`/question?${searchParams}`); props.history.push(`/problemset?${searchParams}`);
} }
return ( return (

@ -12,9 +12,13 @@ class Bottomsubmit extends Component {
cannelfun = () => { cannelfun = () => {
// window.location.href= // window.location.href=
if(this.props.Cohetepaperbool===true){ try {
this.props.setCohetepaperbool(false); if(this.props.Cohetepaperbool===true){
}else { this.props.setCohetepaperbool(false);
}else {
this.props.history.replace(this.props.url);
}
}catch (e) {
this.props.history.replace(this.props.url); this.props.history.replace(this.props.url);
} }

@ -236,7 +236,9 @@ class Paperreview extends Component {
.then((result) => { .then((result) => {
if (result.data.status === 0) { if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`); // this.props.showNotification(`组卷成功`);
this.props.history.replace('/paperlibrary'); // console.log(result.data.exam_id);
//本来调试卷库首页的
this.props.history.replace('/paperlibrary/see/'+result.data.exam_id);
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); //console.log(error);
@ -418,7 +420,7 @@ class Paperreview extends Component {
artificialtype==="artificial"? artificialtype==="artificial"?
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item >试题库</Breadcrumb.Item> <Breadcrumb.Item >试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshou"} href="/question">人工组卷</Breadcrumb.Item> <Breadcrumb.Item className={"xiaoshou"} href="/problemset">人工组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item> <Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
: :
@ -429,7 +431,7 @@ class Paperreview extends Component {
</Breadcrumb> </Breadcrumb>
: :
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item> <Breadcrumb.Item href="/problemset">试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshou"}>新增试卷</Breadcrumb.Item> <Breadcrumb.Item className={"xiaoshou"}>新增试卷</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
} }
@ -461,7 +463,8 @@ class Paperreview extends Component {
<Bottomsubmit {...this.props} {...this.state} bottomvalue={Cohetepaperbool===false?"保存组卷":"完成"} <Bottomsubmit {...this.props} {...this.state} bottomvalue={Cohetepaperbool===false?"保存组卷":"完成"}
setCohetepaperbool={(bool)=>this.setCohetepaperbool(bool)} setCohetepaperbool={(bool)=>this.setCohetepaperbool(bool)}
onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/question':'/paperlibrary'}></Bottomsubmit> Cohetepaperbool={this.state.Cohetepaperbool}
onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/problemset':'/paperlibrary'}></Bottomsubmit>
</div> </div>
) )

@ -463,7 +463,7 @@ class Paperreview_item extends Component {
} }
jixuxuantioncli = () => { jixuxuantioncli = () => {
this.props.history.replace("/question"); this.props.history.replace("/problemset");
} }
showparagraphs = (e,name) => { showparagraphs = (e,name) => {

@ -940,6 +940,15 @@ class Question extends Component {
return ( return (
<div className="newMain clearfix" ref={this.saveContainer}> <div className="newMain clearfix" ref={this.saveContainer}>
<style>{
`
.newHeaders{
position: fixed;
top: 0px;
z-index: 999 !important;
}
`
}</style>
{ {
mydisplay===true? mydisplay===true?
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.mydisplayHidedel} /> <Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.mydisplayHidedel} />
@ -966,11 +975,7 @@ class Question extends Component {
<style> <style>
{ {
` `
.newHeaders{
position: fixed;
top: 0px;
z-index: 999 !important;
}
.ant-drawer { .ant-drawer {
z-index: 800 !important; z-index: 800 !important;
} }
@ -988,13 +993,11 @@ class Question extends Component {
</style> </style>
:"" :""
} }
{
visible===true?
<div <div
style={{ style={{
marginTop: "81px" marginTop: "81px"
}}></div> }}></div>
:""}
{ {
modalsTypes===true? modalsTypes===true?
<QuestionModals {...this.props}{...this.state} modalsTypes={modalsTypes} modalCancels={() => this.modalCancels()} <QuestionModals {...this.props}{...this.state} modalsTypes={modalsTypes} modalCancels={() => this.modalCancels()}

@ -312,7 +312,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) { if (result.data.status == 0) {
// this.props.showNotification(`新增单选题成功`); // this.props.showNotification(`新增单选题成功`);
this.restricte=true; this.restricte=true;
this.props.history.replace('/question'); this.props.history.replace('/problemset');
} }
}).catch((error) => { }).catch((error) => {
@ -324,7 +324,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) { if (result.data.status == 0) {
// this.props.showNotification(`编辑单选题成功`); // this.props.showNotification(`编辑单选题成功`);
this.restricte=true; this.restricte=true;
this.props.history.replace('/question'); this.props.history.replace('/problemset');
} }
@ -392,7 +392,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) { if (result.data.status == 0) {
// this.props.showNotification(`新增多选题成功`); // this.props.showNotification(`新增多选题成功`);
this.restricte=true; this.restricte=true;
this.props.history.replace('/question'); this.props.history.replace('/problemset');
} }
@ -406,7 +406,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) { if (result.data.status == 0) {
// this.props.showNotification(`编辑多选题成功`); // this.props.showNotification(`编辑多选题成功`);
this.restricte=true; this.restricte=true;
this.props.history.replace('/question'); this.props.history.replace('/problemset');
} }
@ -461,7 +461,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) { if (result.data.status == 0) {
// this.props.showNotification(`新增判断题成功`); // this.props.showNotification(`新增判断题成功`);
this.restricte=true; this.restricte=true;
this.props.history.replace('/question'); this.props.history.replace('/problemset');
} }
}).catch((error) => { }).catch((error) => {
@ -474,7 +474,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) { if (result.data.status == 0) {
// this.props.showNotification(`编辑判断题成功`); // this.props.showNotification(`编辑判断题成功`);
this.restricte=true; this.restricte=true;
this.props.history.replace('/question'); this.props.history.replace('/problemset');
} }
}).catch((error) => { }).catch((error) => {
@ -561,7 +561,7 @@ class Questionitem_banks extends Component {
<div className="w1200mss"> <div className="w1200mss">
<div className="w100s mt30"> <div className="w100s mt30">
<Breadcrumb separator=">"> <Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item> <Breadcrumb.Item href="/problemset">试题库</Breadcrumb.Item>
<Breadcrumb.Item>{JSON.stringify(params) === "{}" ? "新增" : "编辑"}试题</Breadcrumb.Item> <Breadcrumb.Item>{JSON.stringify(params) === "{}" ? "新增" : "编辑"}试题</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
</div> </div>
@ -627,7 +627,7 @@ class Questionitem_banks extends Component {
"" ""
: :
<Bottomsubmit {...this.props} {...this.state} bottomvalue={item_type === "PROGRAM" ? "创建" : "保存"} <Bottomsubmit {...this.props} {...this.state} bottomvalue={item_type === "PROGRAM" ? "创建" : "保存"}
onSubmits={() => this.preservation()} url={'/question'}></Bottomsubmit> onSubmits={() => this.preservation()} url={'/problemset'}></Bottomsubmit>
} }
</div> </div>
) )

@ -201,7 +201,7 @@ class Contentpart extends Component {
} }
this.props.history.push("/question/newitem?pages="+this.props.pages+urls); this.props.history.push("/problemset/newitem?pages="+this.props.pages+urls);
} }
render() { render() {

@ -518,7 +518,7 @@ class Listjihe extends Component {
this.props.Isitapopup&&this.props.Isitapopup==="true"? this.props.Isitapopup&&this.props.Isitapopup==="true"?
"" ""
: :
<a onClick={()=>this.seturls(`/question/edit/${items.id}`)}> <a onClick={()=>this.seturls(`/problemset/edit/${items.id}`)}>
<p className="viewparsings xiaoshou mr25"> <p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i> <i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span> <span>编辑</span>

@ -117,7 +117,7 @@ class SiderBars extends Component {
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div> {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div>
{ {
mypath&&mypath==="/question"&&swsilan===true? mypath&&mypath==="/problemset"&&swsilan===true?
<Tooltip placement="left" title={"试题库"}> <Tooltip placement="left" title={"试题库"}>
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} > <div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >

@ -419,10 +419,10 @@
color: #4CACFF; color: #4CACFF;
} }
.xiaoshou{ .xiaoshou{
cursor:pointer; cursor:pointer !important;
} }
.xiaoshout{ .xiaoshout{
cursor:default; cursor:default !important;
} }
.mt40{ .mt40{
margin-top: 40px; margin-top: 40px;
@ -1129,7 +1129,7 @@
.typeGreen{ .typeGreen{
color:#15DB7A; color:#15DB7A;
border:1px solid #15DB7A; border:1px solid #15DB7A;
} }
.typeBlue{ .typeBlue{
color:#0CB9F1; color:#0CB9F1;
border:1px solid #0CB9F1; border:1px solid #0CB9F1;
@ -1137,8 +1137,8 @@
.typeRed{ .typeRed{
color:#FF5555; color:#FF5555;
border:1px solid #FF5555; border:1px solid #FF5555;
} }
.typeYellow{ .typeYellow{
color:#FFB538; color:#FFB538;
border:1px solid #FFB538; border:1px solid #FFB538;
} }

@ -73,7 +73,7 @@ class Contentpart extends Component {
} }
//跳转人工组卷 //跳转人工组卷
Mantegeneration=()=>{ Mantegeneration=()=>{
this.props.history.push('/question'); this.props.history.push('/problemset');
} }
@ -368,18 +368,24 @@ class Contentpart extends Component {
<div className="xaxisreverseorder" style={{ <div className="xaxisreverseorder" style={{
width:"50%" width:"50%"
}}> }}>
<a onClick={()=>this.xinzenw('/problemset')}>
<a onClick={()=>this.xinzenw('/Integeneration')}>
<div className="newbutoonss"> <div className="newbutoonss">
<p className="newbutoontess" >智能组卷</p>
</div>
</a>
<a onClick={()=>this.xinzenw('/question')}>
<div className="newbutoons mr39">
<p className="newbutoontess" >人工组卷</p> <p className="newbutoontess" >人工组卷</p>
</div> </div>
</a> </a>
{/*<a onClick={()=>this.xinzenw('/Integeneration')}>*/}
{/* <div className="newbutoonss">*/}
{/* <p className="newbutoontess" >智能组卷</p>*/}
{/* </div>*/}
{/*</a>*/}
{/*<a onClick={()=>this.xinzenw('/problemset')}>*/}
{/* <div className="newbutoons mr39">*/}
{/* <p className="newbutoontess" >人工组卷</p>*/}
{/* </div>*/}
{/*</a>*/}
</div> </div>
:"" :""
} }

@ -286,7 +286,7 @@ class Paperreview_item extends Component {
} }
jixuxuantioncli = () => { jixuxuantioncli = () => {
this.props.history.replace("/question"); this.props.history.replace("/problemset");
} }
showparagraphs = (e,name) => { showparagraphs = (e,name) => {

@ -361,7 +361,7 @@ class Paperlibraryseeid_itemss extends Component {
} }
jixuxuantioncli = () => { jixuxuantioncli = () => {
this.props.history.replace("/question"); this.props.history.replace("/problemset");
} }
showparagraphs = (e,name) => { showparagraphs = (e,name) => {

@ -26,7 +26,7 @@ class Seeoagertit extends Component {
onChange=(e)=> { onChange=(e)=> {
} }
jixuxuantioncli = () => { jixuxuantioncli = () => {
this.props.history.replace("/question"); this.props.history.replace("/problemset");
} }
render() { render() {

@ -400,13 +400,13 @@
color: #4CACFF; color: #4CACFF;
} }
.xiaoshou{ .xiaoshou{
cursor:pointer; cursor:pointer !important;
} }
.xiaoshout{ .xiaoshout{
cursor:default; cursor:default !important;
} }
.shubiao{ .shubiao{
cursor:default; cursor:default !important;
} }
.mt40{ .mt40{
margin-top: 40px; margin-top: 40px;

@ -769,7 +769,7 @@ export function TPMIndexHOC(WrappedComponent) {
{...this.dialogObj} {...this.dialogObj}
/>:""} />:""}
{ {
mypath&&mypath==="/question"? mypath&&mypath==="/problemset"?
"" ""
: :
<SiderBar <SiderBar

@ -1,17 +1,17 @@
/* /*
* @Description: * @Description:
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2019-11-27 13:42:11 * @Date: 2019-11-27 13:42:11
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-02-10 18:17:00 * @LastEditTime : 2020-02-10 18:17:00
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
import { import {
fetchStartProgram, fetchStartProgram,
fetchUserProgramDetail, fetchUserProgramDetail,
fetchDebuggerCode, fetchDebuggerCode,
fetchCodeSubmit, fetchCodeSubmit,
fetchUserCommitRecord, fetchUserCommitRecord,
fetchUserCommitRecordDetail, fetchUserCommitRecordDetail,
@ -50,7 +50,7 @@ export const startProgramQuestion = (id, props) => {
// console.log(path); // console.log(path);
// props.history.push(`/myproblems/${identifier}`); // props.history.push(`/myproblems/${identifier}`);
props.history.push({ props.history.push({
pathname: `/myproblems/${identifier}?${searchParams}`, pathname: `/myproblems/${identifier}.json?${searchParams}`,
}); });
} }
} }
@ -90,7 +90,7 @@ export const getUserProgramDetail = (identifier, type) => {
type: types.SAVE_USE_TEST_CASE_VALUE, type: types.SAVE_USE_TEST_CASE_VALUE,
payload: data.test_case || {} payload: data.test_case || {}
}); });
// 代码是否更新 // 代码是否更新
let _modify_code = false; let _modify_code = false;
if (data.hack) { if (data.hack) {
_modify_code = data.hack.modify_code; _modify_code = data.hack.modify_code;
@ -145,7 +145,7 @@ export const saveUserCodeForInterval = (identifier, code) => {
/** /**
* @description 保存或更新之前先更新代码 * @description 保存或更新之前先更新代码
* @param {*} identifier * @param {*} identifier
* @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} inputValue 输入值: 自定义 | 系统返回的
* @param {*} type 测评类型 debug | submit * @param {*} type 测评类型 debug | submit
*/ */
@ -157,7 +157,7 @@ export const updateCode = (identifier, inputValue, type) => {
fetchUpdateCode(identifier, { fetchUpdateCode(identifier, {
code: Base64.encode(userCode) code: Base64.encode(userCode)
}).then(res => { }).then(res => {
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// TODO 需要优化 // TODO 需要优化
if (res.data.status === 401) { if (res.data.status === 401) {
dispatch({ // 改变 loading 值 dispatch({ // 改变 loading 值
@ -187,7 +187,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
let count = 1; let count = 1;
/** /**
* @param {*} excuteTime 执行时间 * @param {*} excuteTime 执行时间
* @param {*} finalTime 总时间 * @param {*} finalTime 总时间
* @param {*} count 执行次数 * @param {*} count 执行次数
* @param {*} timer 定时器 * @param {*} timer 定时器
*/ */
@ -199,7 +199,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
if (+status === 0 || (excuteTime / 1000) > (finalTime + 1)) { if (+status === 0 || (excuteTime / 1000) > (finalTime + 1)) {
clearInterval(timer); // 清除定时器 clearInterval(timer); // 清除定时器
timer = null; timer = null;
let returnData = null; let returnData = null;
if (status === 1) { // 结果没有返回 if (status === 1) { // 结果没有返回
returnData = { returnData = {
error_line: -1, error_line: -1,
@ -221,7 +221,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
payload: { payload: {
type, type,
data: returnData data: returnData
} }
}); });
if (!type || type === 'debug') { if (!type || type === 'debug') {
dispatch({ // 改变 loading 值 dispatch({ // 改变 loading 值
@ -287,13 +287,13 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
/** /**
* @description 调试代码 * @description 调试代码
* @param {*} identifier * @param {*} identifier
* @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} inputValue 输入值: 自定义 | 系统返回的
* @param {*} type 测评类型 debug | submit * @param {*} type 测评类型 debug | submit
*/ */
export const debuggerCode = (identifier,value, type) => { export const debuggerCode = (identifier,value, type) => {
return (dispatch, getState) => { return (dispatch, getState) => {
// 调用之前 先保存 code // 调用之前 先保存 code
// TODO // TODO
// console.log(identifier, value); // console.log(identifier, value);
const { hack } = getState().ojForUserReducer; const { hack } = getState().ojForUserReducer;
@ -398,7 +398,7 @@ export const changeUserCodeTab = (key) => {
/** /**
* @description 用户提交代码 先调用保存代码接口再调提交接口成功后调用调试接口 * @description 用户提交代码 先调用保存代码接口再调提交接口成功后调用调试接口
* @param {*} identifier * @param {*} identifier
*/ */
export const submitUserCode = (identifier, inputValue, type) => { export const submitUserCode = (identifier, inputValue, type) => {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -430,7 +430,7 @@ export const submitUserCode = (identifier, inputValue, type) => {
fetchUpdateCode(identifier, { fetchUpdateCode(identifier, {
code: userCode code: userCode
}).then(res => { }).then(res => {
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// TODO 需要优化 // TODO 需要优化
if (res.data.status === 401) { if (res.data.status === 401) {
dispatch({ dispatch({
@ -495,7 +495,7 @@ export const saveOpacityType = (type) => {
type: types.CLICK_OPERATE_TYPE, type: types.CLICK_OPERATE_TYPE,
payload: type payload: type
} }
} }
export const clearOjForUserReducer = () => { export const clearOjForUserReducer = () => {

Loading…
Cancel
Save