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

video_transcode
杨树明 5 years ago
commit 1491d3089f

@ -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