diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index 3953f1f34..f224526e6 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -59,4 +59,6 @@ export function toPath(path) { } -// export default queryString \ No newline at end of file +export function getTaskUrlById(id) { + return `/tasks/${id}` +} diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 791b2c6d6..2afbca8d1 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -3,7 +3,8 @@ import { from } from '_array-flatten@2.1.2@array-flatten'; // export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil'; export { getImageUrl as getImageUrl, getUrl as getUrl, getUrl2 as getUrl2, setImagesUrl as setImagesUrl - , getUploadActionUrl as getUploadActionUrl, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth } from './UrlTool'; + , getUploadActionUrl as getUploadActionUrl, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth + , getTaskUrlById as getTaskUrlById } from './UrlTool'; export { default as queryString } from './UrlTool2'; export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC'; diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js index d97b58cca..b9aac1e6a 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js @@ -1,6 +1,6 @@ import React,{ Component } from "react"; import CoursesListType from '../coursesPublic/CoursesListType'; -import { WordsBtn } from 'educoder'; +import { WordsBtn, getTaskUrlById } from 'educoder'; import {Tooltip,message,Modal} from 'antd'; import {Link} from 'react-router-dom'; import axios from 'axios'; @@ -56,7 +56,7 @@ class ShixunhomeWorkItem extends Component{ startbtn:true, }) let url= list+".json"; - const w=window.open('about:blank'); + // const w=window.open('about:blank'); axios.get(url).then((response) => { if(response.status===200){ @@ -66,7 +66,7 @@ class ShixunhomeWorkItem extends Component{ shixunsreplace:true, hidestartshixunsreplacevalue:response.data.message+".json" }) - w.close() + // w.close() }else if(response.data.status===-1){ console.log(response) }else if(response.data.status===-3){ @@ -75,11 +75,15 @@ class ShixunhomeWorkItem extends Component{ startshixunCombattype:true, startbtn:false }) - w.close() + // w.close() }else{ - if(response.data.status!=401&&response.data.status!=403){ - w.location.href= "/tasks/"+response.data.game_identifier - } + this.setState({ + startbtn:false + }) + // if(response.data.status!=401&&response.data.status!=403){ + // w.location.href= "/tasks/"+response.data.game_identifier + // } + window.location.href = "/tasks/"+response.data.game_identifier } } @@ -87,7 +91,7 @@ class ShixunhomeWorkItem extends Component{ this.setState({ startbtn:false }) - w.close() + // w.close() }); @@ -389,9 +393,15 @@ class ShixunhomeWorkItem extends Component{ {this.props.isStudent===true?this.props.course_identity===5? - {startbtn===false?this.taskoperationId(discussMessage.task_operation[1])}> - {discussMessage.task_operation[0]} - :开启中} + {startbtn===false? + (discussMessage.task_operation[0] == '继续挑战' || discussMessage.task_operation[0] == '查看实战' ? + + {discussMessage.task_operation[0]} + + : + this.taskoperationId(discussMessage.task_operation[1])}> + {discussMessage.task_operation[0]} + ):开启中} :"":"" }