Merge branches 'dev_aliyun' and 'dev_jupyter' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter

 Conflicts:
	public/react/src/AppConfig.js
	public/react/src/modules/tpm/NewHeader.js
dev_jupyter
杨树明 5 years ago
commit 3603d391e4

@ -216,6 +216,7 @@ class GraduationTasksController < ApplicationController
tip_exception(403, "无权限访问") unless current_user.admin_or_business? tip_exception(403, "无权限访问") unless current_user.admin_or_business?
_tasks_list _tasks_list
@work_list = @work_list.where("work_status > 0")
person_list = @work_list.map do |work| person_list = @work_list.map do |work|
o = { o = {
@ -225,7 +226,7 @@ class GraduationTasksController < ApplicationController
} }
attachment = work.attachments.last attachment = work.attachments.last
if attachment if attachment
o[:downloadUrl] = "https://#{edu_setting('host_name')}/"+download_url(attachment) o[:downloadUrl] = "#{edu_setting('host_name')}"+download_url(attachment)
end end
o o

@ -3,6 +3,7 @@ json.message "评测完成"
json.data do json.data do
json.(@result, :id, :status, :error_line, :error_msg, json.(@result, :id, :status, :error_line, :error_msg,
:input, :output, :execute_time, :execute_memory) :input, :output, :execute_time, :execute_memory)
json.passed @my_hack.passed
# 提交模式多了一个预计输出 # 提交模式多了一个预计输出
if @mode == "submit" if @mode == "submit"
json.expected_output @result.expected_output json.expected_output @result.expected_output

@ -8,6 +8,7 @@ json.hack do
json.submit_count @hack.submit_num json.submit_count @hack.submit_num
json.notes @my_hack.notes json.notes @my_hack.notes
json.modify_code @modify json.modify_code @modify
json.passed @my_hack.passed
json.comments_count @hack.discusses.count json.comments_count @hack.discusses.count
json.user_praise @hack.praise_treads.select{|pt| pt.user_id == current_user.id}.length > 0 json.user_praise @hack.praise_treads.select{|pt| pt.user_id == current_user.id}.length > 0
end end

@ -0,0 +1,5 @@
class MigrateZipPackColumn < ActiveRecord::Migration[5.2]
def change
change_column :zip_packs, :pack_size, :float
end
end

@ -100,22 +100,31 @@ export function getUploadActionUrl(path, goTest) {
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);
return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`; return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`;
} }
export function getUploadActionUrltwo(id) { export function getUploadActionUrltwo(id) {
Railsgettimes() Railsgettimes()
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);
return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
} }
export function getUploadActionUrlthree() { export function getUploadActionUrlthree() {
Railsgettimes() Railsgettimes()
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);
return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
} }
export function getUploadActionUrlOfAuth(id) { export function getUploadActionUrlOfAuth(id) {
Railsgettimes() Railsgettimes()
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);
return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
} }
export function getRandomNumber(type) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return type===true?`randomcode=${newtimestamp}&client_key=${anewopens}`:`?randomcode=${newtimestamp}&client_key=${anewopens}`
}
export function test(path) { export function test(path) {
return `${path}`; return `${path}`;
} }

@ -2,7 +2,7 @@
// export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil'; // export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil';
export { getImageUrl as getImageUrl, getUrl as getUrl, publicSearchs as publicSearchs,getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl export { getImageUrl as getImageUrl, getRandomNumber as getRandomNumber,getUrl as getUrl, publicSearchs as publicSearchs,getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
, getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth , getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool'; , getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool';
export { default as queryString } from './UrlTool2'; export { default as queryString } from './UrlTool2';

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getRandomNumber,queryString} from 'educoder';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import {Tooltip,Menu} from 'antd'; import {Tooltip,Menu} from 'antd';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
@ -62,7 +62,8 @@ class GraduationTaskDetail extends Component{
ModalCancel:undefined, ModalCancel:undefined,
ModalSave:undefined, ModalSave:undefined,
acrossVisible:undefined, acrossVisible:undefined,
OneSelftype:false OneSelftype:false,
taskdatas:undefined
} }
} }
componentDidMount(){ componentDidMount(){
@ -249,11 +250,13 @@ class GraduationTaskDetail extends Component{
visibles:true visibles:true
}) })
} }
Cancel=()=>{ Cancel=()=>{
this.setState({ this.setState({
visibles:false visibles:false
}) })
} }
// 取消关联 // 取消关联
cannelAssociation=()=>{ cannelAssociation=()=>{
this.setState({ this.setState({
@ -263,6 +266,7 @@ class GraduationTaskDetail extends Component{
ModalSave:this.savetassociton ModalSave:this.savetassociton
}) })
} }
savetassociton=()=>{ savetassociton=()=>{
this.cannerassocition(); this.cannerassocition();
let {questionslist}=this.state; let {questionslist}=this.state;
@ -277,6 +281,7 @@ class GraduationTaskDetail extends Component{
}) })
} }
cannerassocition=()=>{ cannerassocition=()=>{
this.setState({ this.setState({
Modalstype:false, Modalstype:false,
@ -287,6 +292,7 @@ class GraduationTaskDetail extends Component{
visibles:false visibles:false
}) })
} }
// 补交附件 // 补交附件
handaccessory=()=>{ handaccessory=()=>{
// let {taskslistdata}=this.state; // let {taskslistdata}=this.state;
@ -299,14 +305,40 @@ class GraduationTaskDetail extends Component{
avisible:true avisible:true
}) })
} }
Cancelvisible=()=>{ Cancelvisible=()=>{
this.setState({ this.setState({
avisible:false avisible:false
}) })
} }
CodeReview=()=>{
this.props.showNotification("正在导出中...");
const task_Id = this.props.match.params.task_Id;
window.open(`/api/graduation_tasks/${task_Id}/sonar?
${this.state.taskdatas.teacher_comment===undefined||this.state.taskdatas.teacher_comment===null?"":"teacher_comment="+this.state.taskdatas.teacher_comment}
${this.state.taskdatas.task_status===undefined||this.state.taskdatas.task_status===null?"":"&task_status="+this.state.taskdatas.task_status}
${this.state.taskdatas.course_group===undefined||this.state.taskdatas.course_group===null?"":"&course_group="+this.state.taskdatas.course_group}
${this.state.taskdatas.cross_comment===undefined||this.state.taskdatas.cross_comment===null?"":"&cross_comment="+this.state.taskdatas.cross_comment}
${this.state.taskdatas.search===undefined||this.state.taskdatas.search===null?"":"&search="+this.state.taskdatas.search+"&"}${getRandomNumber(true)}`)
}
getsonars=(teacher_comment,task_status,course_group,cross_comment,search)=>{
let data={
teacher_comment:teacher_comment,
task_status:task_status,
course_group:course_group,
cross_comment:cross_comment,
search:search
}
this.setState({
taskdatas:data
})
}
bindRef = ref => { this.child = ref } ; bindRef = ref => { this.child = ref } ;
render(){ render(){
let courseId=this.props.match.params.coursesId; let courseId=this.props.match.params.coursesId;
@ -512,13 +544,15 @@ class GraduationTaskDetail extends Component{
{ this.props.isAdmin() ? questionslist.status===0 ? <a className={"fr color-blue font-16 mr20"} onClick={() => { this.publish()} }>立即发布</a> : "" : "" } { this.props.isAdmin() ? questionslist.status===0 ? <a className={"fr color-blue font-16 mr20"} onClick={() => { this.publish()} }>立即发布</a> : "" : "" }
{ this.props.isAdmin() && questionslist.cross_comment ? <a className={"fr color-blue font-16"} onClick={this.openAcross}>交叉评阅设置</a> : "" } { this.props.isAdmin() && questionslist.cross_comment ? <a className={"fr color-blue font-16"} onClick={this.openAcross}>交叉评阅设置</a> : "" }
{ this.props.isAdmin() ? <a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+task_Id+"/edit"}>编辑任务</a> : "" } { this.props.isAdmin() ? <a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+task_Id+"/edit"}>编辑任务</a> : "" }
{/*{ this.props.user&&this.props.user.admin===true || this.props.user&&this.props.user.business===true ? <a className={"fr color-blue font-16"} onClick={()=>this.CodeReview()}>代码评测</a> : "" }*/}
</div> </div>
</div> </div>
<Switch {...this.props}> <Switch {...this.props}>
{/*//毕设任务列表*/} {/*//毕设任务列表*/}
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list" <Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list"
render={ render={
(props) => (<GraduationTaskslist {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`list`}/>) (props) => (<GraduationTaskslist getsonar={(teacher_comment,task_status,course_group,cross_comment,search)=>this.getsonars(teacher_comment,task_status,course_group,cross_comment,search)}{...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`list`}/>)
} }
></Route> ></Route>

@ -62,6 +62,8 @@ class GraduationTaskssettinglist extends Component{
let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state; let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state;
this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page); this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search)
try{ try{
this.props.triggerRef(this) this.props.triggerRef(this)
}catch(e){ }catch(e){
@ -88,6 +90,8 @@ class GraduationTaskssettinglist extends Component{
}) })
let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state; let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search} = this.state;
this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search)
} }
seacthdata=(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pages)=>{ seacthdata=(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pages)=>{
@ -244,8 +248,10 @@ class GraduationTaskssettinglist extends Component{
if(list.length===key){ if(list.length===key){
this.seacthdata(undefined, task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.seacthdata(undefined, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(undefined, task_status, course_group, cross_comment, search)
}else{ }else{
this.seacthdata(list[0], task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.seacthdata(list[0], task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(list[0], task_status, course_group, cross_comment, search)
} }
@ -262,7 +268,7 @@ class GraduationTaskssettinglist extends Component{
loadingstate:true loadingstate:true
}) })
this.seacthdata(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page); this.seacthdata(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, e.target.value===undefined||e.target.value===false?"":e.target.value, search)
} }
inputSearchValue=(e)=>{ inputSearchValue=(e)=>{
@ -287,7 +293,7 @@ class GraduationTaskssettinglist extends Component{
loadingstate:true loadingstate:true
}) })
this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page); this.seacthdata(teacher_comment, task_status, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search)
} }
funorder = (value, newb_order) => { funorder = (value, newb_order) => {
@ -299,7 +305,7 @@ class GraduationTaskssettinglist extends Component{
loadingstate: true loadingstate: true
}) })
this.seacthdata(teacher_comment, task_status, course_group, cross_comment, value, newb_order, search,this.state.page); this.seacthdata(teacher_comment, task_status, course_group, cross_comment, value, newb_order, search,this.state.page);
this.props.getsonar(teacher_comment, task_status, course_group, cross_comment, search)
} }
@ -320,6 +326,7 @@ class GraduationTaskssettinglist extends Component{
loadingstate:true loadingstate:true
}) })
this.seacthdata(teacher_comment, null, course_group, cross_comment, order, b_order, search,this.state.page); this.seacthdata(teacher_comment, null, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, null, course_group, cross_comment, search)
} }
// else if(checkedValues.length ===key){ // else if(checkedValues.length ===key){
// // 全部抖选中 自然就是查找全部 就是空 // // 全部抖选中 自然就是查找全部 就是空
@ -336,7 +343,7 @@ class GraduationTaskssettinglist extends Component{
loadingstate:true loadingstate:true
}) })
this.seacthdata(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page); this.seacthdata(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment, checkedValues===key?undefined:checkedValues, course_group, cross_comment, search)
} }
@ -355,6 +362,7 @@ class GraduationTaskssettinglist extends Component{
loadingstate:true loadingstate:true
}) })
this.seacthdata(teacher_comment, task_status, null, cross_comment, order, b_order, search,this.state.page); this.seacthdata(teacher_comment, task_status, null, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment,task_status, null, cross_comment, search)
} }
// else if(checkedValues.length ===key){ // else if(checkedValues.length ===key){
// // 全部抖选中 自然就是查找全部 就是空 // // 全部抖选中 自然就是查找全部 就是空
@ -372,6 +380,7 @@ class GraduationTaskssettinglist extends Component{
loadingstate:true loadingstate:true
}) })
this.seacthdata(teacher_comment, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page); this.seacthdata(teacher_comment, task_status, checkedValues===key?undefined:checkedValues, cross_comment, order, b_order, search,this.state.page);
this.props.getsonar(teacher_comment,task_status, checkedValues===key?undefined:checkedValues, cross_comment, search)
} }
@ -564,6 +573,7 @@ class GraduationTaskssettinglist extends Component{
// console.log(result) // console.log(result)
if(result.data.status===0){ if(result.data.status===0){
this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page); this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page);
this.props.getsonar(teacher_comment,task_status, course_group, cross_comment, search)
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
this.cancelmodel(); this.cancelmodel();
this.setState({ this.setState({
@ -681,7 +691,7 @@ class GraduationTaskssettinglist extends Component{
}) })
let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state; let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state;
this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pageNumber); this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pageNumber);
this.props.getsonar(teacher_comment,task_status, course_group, cross_comment, search)
} }
/// 确认是否下载 /// 确认是否下载

@ -139,7 +139,7 @@ class Contentpart extends Component {
} }
.ant-popover-inner-content { .xaxisreverseorder .ant-popover-inner-content {
padding:0px !important; padding:0px !important;
} }

@ -103,17 +103,12 @@ class Contentpart extends Component {
} }
.sortinxdirection .ant-input-lg { .sortinxdirection .ant-input-lg {
height: 41px;} height: 41px;}
.sortinxdirection .ant-popover{ .sortinxdirection .ant-popover{
top: 348px !important; top: 348px !important;
} }
.ant-popover-inner-content {
padding:0px !important;
}
` `
} }
</style> </style>

@ -1033,23 +1033,23 @@ submittojoinclass=(value)=>{
top: 63px !important; top: 63px !important;
} }
.ant-popover-inner-content { .questionbanks .ant-popover-inner-content {
padding:0px !important; padding:0px !important;
} }
` `
} }
</style> </style>
<li className={`pr `}> {/*<li className={`pr questionbanks`}>*/}
<Popover placement="bottom" content={contents} trigger="click" > {/* <Popover placement="bottom" content={contents} trigger="click" >*/}
<div className=" sortinxdirection mr10"> {/* <div className=" sortinxdirection mr10">*/}
<div style={{ {/* <div style={{*/}
color:"#fff" {/* color:"#fff"*/}
}}> {/* }}>*/}
题库 {/* 题库*/}
</div> {/* </div>*/}
</div> {/* </div>*/}
</Popover> {/* </Popover>*/}
</li> {/*</li>*/}
<li <li
style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.auth === null ? 'none' : 'block'}} style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.auth === null ? 'none' : 'block'}}

@ -465,6 +465,7 @@ class TPMBanner extends Component {
modalsMidval:"• 我们将在1-2个工作日内完成审核", modalsMidval:"• 我们将在1-2个工作日内完成审核",
ModalCancel: this.eopenpublicupdatadata, ModalCancel: this.eopenpublicupdatadata,
ModalSave: this.eopenpublicupdatadata, ModalSave: this.eopenpublicupdatadata,
Loadtype:true,
modalstyles:"848282" modalstyles:"848282"
}) })
} }

@ -64,6 +64,7 @@ const types = {
CHANGE_RECORD_PAGINATION_PAGE: 'CHANGE_RECORD_PAGINATION_PAGE', // 改变提交分页 CHANGE_RECORD_PAGINATION_PAGE: 'CHANGE_RECORD_PAGINATION_PAGE', // 改变提交分页
UPDATE_OJ_FOR_USER_COMMENT_COUNT: 'UPDATE_OJ_FOR_USER_COMMENT_COUNT', // 更新 hack 中的评论数, UPDATE_OJ_FOR_USER_COMMENT_COUNT: 'UPDATE_OJ_FOR_USER_COMMENT_COUNT', // 更新 hack 中的评论数,
UPDATE_NOTE_CONTENT: 'UPDATE_NOTE_CONTENT', // 更新笔记内容 UPDATE_NOTE_CONTENT: 'UPDATE_NOTE_CONTENT', // 更新笔记内容
UPDATE_HACK_PASSED: 'UPDATE_HACK_PASSED',
/*** jupyter */ /*** jupyter */
GET_JUPYTER_DATA_SETS: 'GET_JUPYTER_DATA_SETS', // jupyter 数据集 GET_JUPYTER_DATA_SETS: 'GET_JUPYTER_DATA_SETS', // jupyter 数据集
GET_JUPYTER_TPI_URL: 'GET_JUPYTER_TPI_URL', // 获取 jupyter url GET_JUPYTER_TPI_URL: 'GET_JUPYTER_TPI_URL', // 获取 jupyter url

@ -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 : 2020-01-07 16:21:53 * @LastEditTime : 2020-01-07 17:27:40
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -179,7 +179,7 @@ export const updateCode = (identifier, inputValue, type) => {
} }
// 代码评测 // 代码评测
export const codeEvaluate = (dispatch, identifier, type, time_limit) => { export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, score, passed) => {
// 调试代码成功后,调用轮循接口, 注意: 代码执行的时间要小于设置的时间限制 // 调试代码成功后,调用轮循接口, 注意: 代码执行的时间要小于设置的时间限制
const intervalTime = 500; const intervalTime = 500;
let count = 1; let count = 1;
@ -244,6 +244,18 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit) => {
// 重新调用一下提交记录接口 // 重新调用一下提交记录接口
dispatch(getUserCommitRecord(identifier)); dispatch(getUserCommitRecord(identifier));
dispatch(saveOpacityType(type)); dispatch(saveOpacityType(type));
// 首次通过时,提示评测通过并获得金币
// console.log('hack status ===>>', hackStatus);
if (hackStatus === 1 && !passed) {
dispatch({
type: types.UPDATE_HACK_PASSED,
payload: true
});
notification.success({
message: '提示',
description: `恭喜您获得金币奖励: ${score}`
});
}
} }
} }
}).catch(err => { // 评测异常时 }).catch(err => { // 评测异常时
@ -281,7 +293,7 @@ export const debuggerCode = (identifier,value, type) => {
// 调用之前 先保存 code // 调用之前 先保存 code
// TODO // TODO
// console.log(identifier, value); // console.log(identifier, value);
const {hack: {time_limit = 0}} = getState().ojForUserReducer; const { hack } = getState().ojForUserReducer;
if (!type || type === 'debug') { if (!type || type === 'debug') {
dispatch({ // 加载中... dispatch({ // 加载中...
type: types.TEST_CODE_STATUS, type: types.TEST_CODE_STATUS,
@ -301,7 +313,7 @@ export const debuggerCode = (identifier,value, type) => {
return; return;
}; };
// 测评 // 测评
codeEvaluate(dispatch, identifier, type, time_limit); codeEvaluate(dispatch, identifier, type, hack.time_limit);
} }
}).catch(() => { }).catch(() => {
dispatch({ dispatch({
@ -387,7 +399,7 @@ 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, hack: {time_limit = 0} } = getState().ojForUserReducer; const { userCode, isUpdateCode, hack} = getState().ojForUserReducer;
function userCodeSubmit () { function userCodeSubmit () {
fetchUserCodeSubmit(identifier).then(res => { fetchUserCodeSubmit(identifier).then(res => {
@ -401,7 +413,8 @@ export const submitUserCode = (identifier, inputValue, type) => {
return; return;
}; };
// 测评 // 测评
codeEvaluate(dispatch, identifier, type, time_limit); console.log('hack=====', hack);
codeEvaluate(dispatch, identifier, type, hack.time_limit, hack.status, hack.score, hack.passed);
} }
}).catch(() => { }).catch(() => {
dispatch({ dispatch({

@ -4,11 +4,7 @@
* @Github: * @Github:
* @Date: 2019-11-20 16:35:46 * @Date: 2019-11-20 16:35:46
* @LastEditors : tangjiang * @LastEditors : tangjiang
<<<<<<< HEAD * @LastEditTime : 2020-01-07 16:45:34
* @LastEditTime : 2020-01-07 15:27:22
=======
* @LastEditTime : 2020-01-03 17:39:32
>>>>>>> dev_aliyun
*/ */
import types from './actionTypes'; import types from './actionTypes';
import CONST from '../../constants'; import CONST from '../../constants';

@ -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 : 2020-01-02 14:24:09 * @LastEditTime : 2020-01-07 17:26:19
*/ */
import types from "../actions/actionTypes"; import types from "../actions/actionTypes";
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
@ -228,6 +228,13 @@ const ojForUserReducer = (state = initialState, action) => {
...state, ...state,
hack: _hack1 hack: _hack1
} }
// 修改 hack passed值
case types.UPDATE_HACK_PASSED:
const _hack2 = Object.assign({}, state.hack, {passed: action.payload });
return {
...state,
hack: _hack2
}
default: default:
return state; return state;
} }

Loading…
Cancel
Save