From a019b597610c1f101b1bb1a355cdd1c91827104b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 22 Jun 2019 11:35:22 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 34 +++++--- .../tasks/GraduationTaskssettinglist.js | 85 ++++++++++++++----- 2 files changed, 85 insertions(+), 34 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 43e44c500..8bb95e330 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -49,20 +49,28 @@ class CoursesBanner extends Component { componentDidMount() { - this.updatabanner() + this.onloadupdatabanner() } - updatabanner=()=>{ - let courseId = this.props.match.params.coursesId; - let url = "/courses/" + courseId + "/top_banner.json" - axios.get(url).then((result) => { - if( result!=undefined){ - let data = result.data; - this.setState({ - coursedata: data - }) - } - }) - } + + onloadupdatabanner=()=>{ + this.updatabanner() + } + + updatabanner=()=>{ + let courseId = this.props.match.params.coursesId; + let url = "/courses/" + courseId + "/top_banner.json" + axios.get(url).then((result) => { + if( result!=undefined){ + let data = result.data; + this.setState({ + coursedata: data + }) + }else{ + this.onloadupdatabanner() + } + }) + } + showeditmenu = () => { this.setState({ show: true, diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index c842d02f2..3971cab0f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -17,8 +17,6 @@ const CheckboxGroup = Checkbox.Group; const Search = Input.Search; const qs = require('qs'); - - class GraduationTaskssettinglist extends Component{ constructor(props){ @@ -1538,8 +1536,10 @@ class GraduationTaskssettinglist extends Component{
- {this.props.isAdmin()?{taskslistdata&&taskslistdata.work_count}个检索结果({taskslistdata&&taskslistdata.work_count} 学生) :""} - {this.props.isAdmin()?
+ {this.props.isAdmin()===true? + {taskslistdata&&taskslistdata.work_count} + 个检索结果({taskslistdata&&taskslistdata.work_count} 学生) :""} + {this.props.isAdmin()===true?

{order==="updated_at"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}排序 @@ -1555,6 +1555,24 @@ class GraduationTaskssettinglist extends Component{

:""}
+ {this.props.isStudent()===true? +
+ + {taskslistdata&&taskslistdata.commit_count} + 已交 + + {taskslistdata&&taskslistdata.uncommit_count} + 未交 + + + {taskslistdata&&taskslistdata.left_time.status} : + + {taskslistdata&&taskslistdata.left_time.time} + + +
+ :""} +
{ @@ -1774,24 +1792,49 @@ class GraduationTaskssettinglist extends Component{
-
- {taskslistdata&&taskslistdata.work_count}个检索结果({taskslistdata&&taskslistdata.work_count} 学生) - -
-

- {order==="updated_at"?"时间":order==="work_score"?"成绩":order==="student_id"?"学号":""}排序

-
    -
  • this.funorder("updated_at")} className={order==="updated_at"?"none":""}>时间 -
  • -
  • this.funorder("work_score" )} className={order==="work_score"?"none":""}>成绩 -
  • -
  • this.funorder("student_id" )} className={order==="student_id"?"none":""}>学号 -
  • -
-
-
+ {this.props.isAdmin()===true? +
+ + {taskslistdata&&taskslistdata.work_count} + 个检索结果({taskslistdata&&taskslistdata.work_count} 学生) + +
+

+ {order==="updated_at"?"时间":order==="work_score"?"成绩":order==="student_id"?"学号":""}排序

+
    +
  • this.funorder("updated_at")} className={order==="updated_at"?"none":""}>时间 +
  • +
  • this.funorder("work_score" )} className={order==="work_score"?"none":""}>成绩 +
  • +
  • this.funorder("student_id" )} className={order==="student_id"?"none":""}>学号 +
  • +
+
+
+ :""} + + + {this.props.isStudent()===true? +
+ + {taskslistdata&&taskslistdata.commit_count} + 已交 + + {taskslistdata&&taskslistdata.uncommit_count} + 未交 + + + {taskslistdata&&taskslistdata.left_time.status} : + + {taskslistdata&&taskslistdata.left_time.time} + + +
+ :""} + +
From adfdb8e35731c1b0751beb76efcc456fa627fded Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 17:20:38 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/graduation/tasks/GraduationTasksSubmitnew.js | 2 +- public/react/src/modules/tpm/NewHeader.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index a9ea6d002..fd0e265c5 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -627,7 +627,7 @@ render(){
- + 取消
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index ecbc8570b..2d1451d6b 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -330,14 +330,15 @@ class NewHeader extends Component { }) } educoderlogin=()=>{ - //登出账号 + //退出账号 var url = `/accounts/logout.json`; axios.get((url)).then((result) => { if(result!==undefined){ - this.setState({ - isRender:true - }) + // this.setState({ + // isRender:true + // }) + window.location.href = "/"; } }).catch((error) => { console.log(error); From 9ab9cc7ce27a4879b716fdb2d0dadf32bde471ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 22 Jun 2019 17:30:37 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/GraduationTasksSubmitedit.js | 48 ++++++++-- .../tasks/GraduationTasksSubmitnew.js | 53 ++++++++--- .../tasks/GraduationTaskssettinglist.js | 2 +- .../modules/user/LoginRegisterComponent.js | 3 +- public/react/src/modules/user/common.css | 94 ++++++++++--------- 5 files changed, 128 insertions(+), 72 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index ec1cf4e48..cad289855 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -1,5 +1,5 @@ import React,{Component} from "React"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin} from "antd"; +import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd"; import {Link} from 'react-router-dom'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; import { WordsBtn,getUrl } from 'educoder'; @@ -571,7 +571,7 @@ class GraduationTasksSubmitedit extends Component{
成员要求:2~5人
- + -
+
- {memberslist&&memberslist.members.map((item,key)=>{ + {memberslist===undefined?"":memberslist.members.length===0?
+
+ +

未找到包含{search}的学生

+
+
:memberslist&&memberslist.members.map((item,key)=>{ return(
- -
{item.user_name}
-
{item.group_name}
-
{item.student_id}
-
{item.commit_status===true?已提交 :""}
+ { + return parseInt(task_status[key])===item.user_id?true:false + }) + } + disabled={item.commit_status===true?true:false} className="fl "> + +
{item.user_name}
+
+
{item.group_name}
+
{item.student_id}
+
{item.commit_status===false?已提交 :""}
) })} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index e1284832c..1c72433b6 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -2,7 +2,7 @@ import React,{Component} from "React"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd"; import {Link} from 'react-router-dom'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUrl } from 'educoder'; +import { WordsBtn,getUrl,getImageUrl} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; const Search = Input.Search; @@ -354,7 +354,6 @@ class GraduationTasksSubmitnew extends Component{ let newlist =memberslist.members; let newcheckedValues=checkedValues; let selects=[]; - selects.push(selectobjct) for(var i=0; i成员要求:2~5人
@@ -548,17 +558,31 @@ render(){
- {memberslist&&memberslist.members.map((item,key)=>{ + {memberslist===undefined?"":memberslist.members.length===0? +
+
+ +

未找到包含{search}的学生

+
+
:memberslist&&memberslist.members.map((item,key)=>{ + return(
- -
{item.user_name}
-
{item.group_name}
-
{item.student_id}
-
{item.commit_status===true?已提交 :""}
+ { + return parseInt(task_status[key])===item.user_id?true:false + }) + } + disabled={item.commit_status===true?true:false} className="fl "> + +
{item.user_name}
+
+
{item.group_name}
+
{item.student_id}
+
{item.commit_status===true?已提交 :""}
) })} @@ -584,12 +608,13 @@ render(){ height: '30px', display:item.user_name===undefined?"none":"" }}> - -
{item.user_name}
+ +
{item.user_name}
-
{item.group_name}
-
{item.student_id}
- {key>0?
this.delecttask_status(item.user_id)}>
:""} +
{item.group_name}
+
{item.student_id}
+ {key>0?
this.delecttask_status(item.user_id)}>
:""} +
) })} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 3971cab0f..52c12d069 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -92,7 +92,7 @@ class GraduationTaskssettinglist extends Component{ for (var i = 0; i < worklists.length; i++) { datalist.push({ name: worklists[i].name, - number: (parseInt(page)-1)*parseInt(limit)+(i+1), + number: (parseInt(pages)-1)*parseInt(limit)+(i+1), stduynumber: worklists[i].student_id, classroom: worklists[i].class_grouping_name, grouping: result.data.have_grouping === true ? worklists[i].grouping_name : null, diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 846000984..800453b36 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -576,6 +576,7 @@ class LoginRegisterComponent extends Component { { @@ -605,7 +606,7 @@ class LoginRegisterComponent extends Component { { parseInt(tab[0])==1 &&
- Date: Sat, 22 Jun 2019 17:41:20 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=AE=9E=E8=AE=AD-imag?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/GraduationTaskssettinglist.js | 32 +++++++++++-------- .../src/modules/user/usersInfo/InfosShixun.js | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 752d61d33..5907674b5 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -1279,6 +1279,9 @@ class GraduationTaskssettinglist extends Component{ text-overflow: ellipsis; white-space: nowrap; } + .ant-table-tbody > tr:last-child > td{ + border:none!important; + } ` } @@ -1545,21 +1548,22 @@ class GraduationTaskssettinglist extends Component{
- {this.props.isAdmin()?{taskslistdata&&taskslistdata.work_count}个检索结果({taskslistdata&&taskslistdata.work_count} 学生) :""} - {this.props.isAdmin()?
-

- - {order==="updated_at"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}排序 -

-
    -
  • this.funorder("updated_at")}>更新时间 -
  • -
  • this.funorder("work_score" )}>最终成绩 -
  • -
  • this.funorder("student_id" )}>学生学号 + {this.props.isAdmin()?{taskslistdata&&taskslistdata.work_count}个检索结果({taskslistdata&&taskslistdata.work_count} 学生) :""} + { + this.props.isAdmin() ? +
    +
  • + {order==="updated_at"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}排序 + +
  • -
-
:""} +
+ :"" + }
diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index d6835098a..2a1210faf 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -171,7 +171,7 @@ class InfosShixun extends Component{ item.tag &&
{item.tag}
} - Shixun6 + Shixun6

From e3e5db246c3716893c767fe96e607ae1fed07348 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 17:47:54 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 1 + .../exercise/Studentshavecompletedthelist.js | 8 +- public/react/src/modules/login/LoginDialog.js | 1175 +++++++++-------- public/react/src/modules/tpm/NewHeader.js | 25 +- 4 files changed, 607 insertions(+), 602 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 94a1f5e44..bd3bb68fa 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -114,6 +114,7 @@ export function initAxiosInterceptors(props) { notification.open({ message:"提示", description: response.data.message || '服务器异常,请联系管理员。', + }); // notification['error']({ // message:"提示", diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 64cfaee64..7d0a0b54e 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -2030,7 +2030,7 @@ class Studentshavecompletedthelist extends Component { //===0 不包括主观题 if (indexi === exercise_users.length) { //都没评论 不显示评论 - if (response.data.poll_types.groups_count > 0) { + if (response.data.exercise_types.groups_count > 0) { // console.log("77771111111"); //分班大于0显示分班 //7ge @@ -2273,7 +2273,7 @@ class Studentshavecompletedthelist extends Component { } else { //已经评论 // response.data.course_groups.length - if (response.data.poll_types.groups_count > 0) { + if (response.data.exercise_types.groups_count > 0) { //显示分班 //8ge this.setState({ @@ -2546,7 +2546,7 @@ class Studentshavecompletedthelist extends Component { //包括主观题 if (indexi === exercise_users.length) { console.log("2548包含主观题不包含分班"); - if (response.data.poll_types.groups_count> 0){ + if (response.data.exercise_types.groups_count> 0){ this.setState({ data: datalist, teacherlist: teacherlist, @@ -2837,7 +2837,7 @@ class Studentshavecompletedthelist extends Component { } } else { console.log("2699包含主观题包含分班"); - if (response.data.poll_types.groups_count> 0) { + if (response.data.exercise_types.groups_count> 0) { this.setState({ data: datalist, teacherlist: teacherlist, diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 28198216c..1dcfd1386 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -1,587 +1,588 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import Dialog, { - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, -} from 'material-ui/Dialog'; - - -import axios from 'axios'; - -import './LoginDialog.css'; -import { broadcastChannelPostMessage } from 'educoder' - -const $ = window.$; -var wait = 60; -function time(btn){ - if (wait==0) { - $(btn).addClass("btn_orange_bg"); - btn.removeAttribute("disabled"); - btn.innerHTML = "获取验证码"; - wait = 60; - return; - }else{ - $(btn).removeClass("btn_orange_bg"); - btn.setAttribute("disabled", "disabled"); - btn.innerHTML = wait + "s后重试"; - wait--; - } - setTimeout(function(){ - time(btn); - },1000); -} -function get_login_verification_code(btn) { - if($(btn).attr("disabled")) { - return false; - } else { - if (/^1\d{10}$/.test($("#pass_name_input").val()) || /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($("#pass_name_input").val())){ - if(!window.IsPC() || $('#quick-drag .drag_text').html() == "验证通过") { - $("#passlogin_error_notice").hide(); - btn.setAttribute("disabled", "disabled"); - var val = ''; - var type = 6; - if(/^1\d{10}$/.test($("#pass_name_input").val())){ - type = 6; - } else if(/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($("#pass_name_input").val())){ - type = 7; - } - $.get( - 'https://www.educoder.net/account/get_verification_code', - { value: $('#pass_name_input').val().trim(), - type: type}, - function (data) { - if (data.status == "2") { - if(type == 6){ - $("#pass_name_input").next().find("p").html("该手机号尚未注册,你可以去注册").show(); - } else{ - $("#pass_name_input").next().find("p").html("该邮箱尚未绑定,你可以登录后去绑定").show(); - } - } else { - $("#pass_name_input").next().find("p").hide(); - if(type == 6){ - $("#send_code_notice").html(data.msg).show(); - } else{ - var uurl = window.gotoEmail(data.link); - $("#send_code_notice").html("验证码已经发送到您的邮箱,去查收").show(); - } - time(btn); - } - }); - } else{ - $("#passlogin_error_notice").show(); - } - } - } -} - - -class LoginDialog extends Component { - constructor(props) { - super(props) - this.state = { - open: true, - login:0, - speedy:1, - regular:0, - loginValue:'', - passValue:'', - isGoing:true, - isGoingValue:1, - disabled:true, - bottonclass:'log-botton mt5', - dialogBox:'dialogBox', - shortcutValue:'', - shortcutnum:1, - disabledType:true, - gaincode:'gain-code', - authCodeType:true, - authCodeclass:'log-botton mt5', - isRender: false, - - }; - } - enter=(num) =>{ - this.setState({login:num,speedy:1,dialogBox:'dialogBox'}); - } - - register=(num) =>{ - this.setState({login:1,speedy:num,dialogBox:'dialogBox2'}); - } - - loginChange = () =>{ - let reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/; - let reg1 = /^1\d{10}$/; - let reg2=/^[a-zA-z]\w{3,14}$/; - let value=this.refs.loginPassText.value; - let valuenum= value.length; - if(valuenum>0){ - if(!reg.test(value)&&!reg1.test(value)&&!reg2.test(value)){ - this.setState({regular:1}) - return - }else{ - this.setState({loginValue:value}) - this.setState({regular:0}) - } - }else{ - this.setState({loginValue:value}) - } - } - - passwordChange = () =>{ - let value =this.refs.passwordText.value; - - let valuenum= value.length; - this.setState({disabled:false}) - this.setState({bottonclass:'log-botton mt5 edu-back-blue'}) - if(valuenum==0){ - this.setState({bottonclass:'log-botton mt5'}) - this.setState({disabled:true}) - } - this.setState({passValue:value}) - } - - handleInputChange =(event)=> { - const target = event.target; - const value = target.type === 'checkbox' ? target.checked : target.value; - const name = target.name; - - this.setState({[name]:value}) - - if(value===true){ - this.setState({isGoingValue:1}) - }else{ - this.setState({isGoingValue:0}) - } - - } - - // 快捷注册 - shortcutIdChange=()=>{ - let reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/; - let reg1 = /^1\d{10}$/; - let reg2=/^[a-zA-z]\w{3,14}$/; - let value=this.refs.shortcutText.value; - let valuenum= value.length; - if(valuenum>0){ - if(!reg.test(value)&&!reg1.test(value)&&!reg2.test(value)){ - this.setState({shortcutnum:0}) - this.setState({disabledType:true}) - this.setState({gaincode : 'gain-code'}) - return - }else{ - this.setState({gaincode : 'gain-code edu-back-blue'}) - this.setState({shortcutValue:value}) - this.setState({shortcutnum:1}) - this.setState({disabledType:false}) - } - - - }else{ - this.setState({shortcutValue:value}) - - } - - } - authCodeChange=()=>{ - - let value=this.refs.authCodeText.value; - let valuenum= value.length; - if(valuenum>3){ - this.setState({authCodeType:false}) - this.setState({authCodeclass:'log-botton mt5 edu-back-blue'}) - }else if(valuenum==0){ - this.setState({authCodeType:true}) - this.setState({authCodeclass:'log-botton mt5'}) - } - } - get_login_verification_code=()=>{ - get_login_verification_code($('#get_verification_code')[0]) - } - dragWrapper=() =>{ - const $ = window.$ - $.fn.drag = function(options) { - - var x, drag = this, isMove = false, defaults = { - }; - var options = $.extend(defaults, options); - var handler = drag.find('.handler'); - var drag_bg = drag.find('.drag_bg'); - var text = drag.find('.drag_text'); - var maxWidth = 100 - //鼠标按下时候的x轴的位置 - handler.mousedown(function(e) { - isMove = true; - x = e.pageX - parseInt(handler.css('left'), 10); - maxWidth = drag.width() - handler.width() - 2; //能滑动的最大间距 - }); - $(document).mousemove(function(e) { - var _x = e.pageX - x;// _x = e.pageX - (e.pageX - parseInt(handler.css('left'), 10)) = x - if (isMove) { - - if (_x > 0 && _x <= maxWidth) { - handler.css({'left': _x}); - drag_bg.css({'width': _x}); - } else if (_x > maxWidth) { //鼠标指针移动距离达到最大时清空事件 - dragOk(); - } - } - }).mouseup(function(e) { - isMove = false; - var _x = e.pageX - x; - if (_x < maxWidth) { //鼠标松开时,如果没有达到最大距离位置,滑块就返回初始位置 - handler.css({'left': 0}); - drag_bg.css({'width': 0}); - } - }); - - //清空事件 - function dragOk() { - handler.removeClass('handler_bg').addClass('handler_ok_bg'); - text.removeClass('slidetounlock').text('验证通过').css({'color':'#fff'}); //modify - // drag.css({'color': '#fff !important'}); - - handler.css({'left': maxWidth}); // add - drag_bg.css({'width': maxWidth}); // add - - handler.unbind('mousedown'); - $(document).unbind('mousemove'); - $(document).unbind('mouseup'); - - } - } - - setTimeout(()=>{ - $('#quick-drag').drag(); - }, 4000) - } - - componentWillReceiveProps(nextProps) { - - this.setState({ - isRender:nextProps.isRender - }) - // console.log(nextProps.isRender); - - } - - componentDidMount() { - - if(this.props.isRender!=undefined){ - this.setState({ - isRender:this.props.isRender - }) - } - - // $(document).on("showLoginDialog", (e, args)=>{ - // this.setState({ - // isRender: true - // }) - // }) - - this.dragWrapper(); - - axios.interceptors.response.use((response) => { - if(response!=undefined) - if (response&&response.data.status === 401) { - this.setState({ - isRender: true - }) - } - return response; - }, (error) => { - // // if (error.response && error.response.data.error === '401 Unauthorized') { - // // this.back_url = window.location.href; - // // this.setState({ - // // isRender: true - // // }) - // // // TODO 这里如果样式变了会出现css不加载的情况 - // // const $ = window.$; - // // const isCssLoaded = window.getComputedStyle($('.log_nav li.active')[0], null) - // // .getPropertyValue('border-bottom') - // // == "2px solid rgb(69, 155, 229)" - // // if (!isCssLoaded) { - // // const isPort3007 = window.location.port == 3007; - // // let _url_origin = isPort3007 ? 'http://localhost:3000' : '' - // // - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) ); - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) ); - // // } - // // } - // // return Promise.reject(error); - }); - } - handleDialogClose() { - this.setState({ - isRender: false - }) - window.location.href="/"; - } - - loginEDU=()=>{ - let {loginValue,passValue,regular,isGoingValue}=this.state; - if(regular===1){ - return - } - let newloginValue=loginValue.replace(/(^\s*)|(\s*$)/g, ""); - let newpassValue=passValue.replace(/(^\s*)|(\s*$)/g, ""); - - let url='/accounts/login.json' - axios.post(url, { - login:newloginValue, - password:newpassValue, - autologin:isGoingValue - } - ).then((response) => { - if(response===undefined){ - return - } - if(response.status===200){ - if (response.data.status === 402) { - window.location.href = response.data.url; - }else{ - broadcastChannelPostMessage('refreshPage') - this.setState({ - isRender:false - }) - window.location.reload(); - } - } - - }).catch((error) => { - console.log(error) - }) - } - onKeydowns=(e)=>{ - let {disabled}=this.state; - if( disabled===false&& e.keyCode === 13){ - this.loginEDU() - console.log(1) - } - } - render() { - let{open,login,speedy,loginValue,regular,isGoing,isGoingValue,disabled,bottonclass, - dialogBox,shortcutnum,disabledType,gaincode,authCodeType,authCodeclass, isRender}=this.state; - - if (isRender === undefined) { - isRender = false - } - - return ( -

this.handleDialogClose()} - > -
-
{this.handleDialogClose()}}> - -
- -
-
    -
  • {this.enter(0)}}>登录
  • - {/*
  • {this.register(0)}}>快捷登录
  • */} -
- - -
-
- -
- - -
- - - - -

请输入有效的手机号/邮箱号/用户名

- -
- - -
-

- 请输入密码 -

-
-
- - - {/**/} - -
- 登录 -
- -

- - - - - - - - 忘记密码 - 注册 - - -

- -
-
- - {/*快捷登录*/} - - - -
-
- -
- - ); - } - -} - -export default LoginDialog ; - - -// onkeypress="user_login_keypress(event);" - -// onkeypress="user_login_keypress(event);" - - -{/*
-
-
-

-
-
} - - - -{/*第三方账号登录*/} - -{/*
-

第三方账号登录

-
- - - -
-
} - -// -// {/*
*/} -// {/*
*/} -// {/*
*/} -// {/**/} -// {/**/} -// {/*
*/} -// {/**/} -// {/**/} -// {/**/} -// {/*
*/} -// {/*

请输入有效的手机号/邮箱号*/} -// {/*

*/} -// {/*
*/} -// -// {/*
*/} -// {/*/!*drag*/ }*/} -// {/*
*/} -// {/*
*/} -// {/*
*/} -// {/*请按住滑块,拖动到最右边*/} -// {/*
*/} -// {/*
*/} -// {/*
*/} -// {/*
*/} -// {/*

请先拖动滑块完成验证

*/} -// {/*
*/} -// {/*
*/} -// -// {/*

*/} -// {/**/} -// {/**/} -// {/**/} -// {/*

*/} -// -// {/*
*/} -// {/*

*/} -// {/*请输入验证码*/} -// {/*

*/} -// {/*
*/} -// -// {/**/} -// -// {/*

*/} -// -// {/**/} -// {/**/} -// {/**/} -// {/**/} -// -// {/**/} -// {/*忘记密码*/} -// {/*注册*/} -// {/**/} -// -// {/*

*/} -// {/**/} -// {/*
*/} +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import Dialog, { + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, +} from 'material-ui/Dialog'; + + +import axios from 'axios'; + +import './LoginDialog.css'; +import { broadcastChannelPostMessage } from 'educoder' + +const $ = window.$; +var wait = 60; +function time(btn){ + if (wait==0) { + $(btn).addClass("btn_orange_bg"); + btn.removeAttribute("disabled"); + btn.innerHTML = "获取验证码"; + wait = 60; + return; + }else{ + $(btn).removeClass("btn_orange_bg"); + btn.setAttribute("disabled", "disabled"); + btn.innerHTML = wait + "s后重试"; + wait--; + } + setTimeout(function(){ + time(btn); + },1000); +} +function get_login_verification_code(btn) { + if($(btn).attr("disabled")) { + return false; + } else { + if (/^1\d{10}$/.test($("#pass_name_input").val()) || /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($("#pass_name_input").val())){ + if(!window.IsPC() || $('#quick-drag .drag_text').html() == "验证通过") { + $("#passlogin_error_notice").hide(); + btn.setAttribute("disabled", "disabled"); + var val = ''; + var type = 6; + if(/^1\d{10}$/.test($("#pass_name_input").val())){ + type = 6; + } else if(/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test($("#pass_name_input").val())){ + type = 7; + } + $.get( + 'https://www.educoder.net/account/get_verification_code', + { value: $('#pass_name_input').val().trim(), + type: type}, + function (data) { + if (data.status == "2") { + if(type == 6){ + $("#pass_name_input").next().find("p").html("该手机号尚未注册,你可以去注册").show(); + } else{ + $("#pass_name_input").next().find("p").html("该邮箱尚未绑定,你可以登录后去绑定").show(); + } + } else { + $("#pass_name_input").next().find("p").hide(); + if(type == 6){ + $("#send_code_notice").html(data.msg).show(); + } else{ + var uurl = window.gotoEmail(data.link); + $("#send_code_notice").html("验证码已经发送到您的邮箱,去查收").show(); + } + time(btn); + } + }); + } else{ + $("#passlogin_error_notice").show(); + } + } + } +} + + +class LoginDialog extends Component { + constructor(props) { + super(props) + this.state = { + open: true, + login:0, + speedy:1, + regular:0, + loginValue:'', + passValue:'', + isGoing:true, + isGoingValue:1, + disabled:true, + bottonclass:'log-botton mt5', + dialogBox:'dialogBox', + shortcutValue:'', + shortcutnum:1, + disabledType:true, + gaincode:'gain-code', + authCodeType:true, + authCodeclass:'log-botton mt5', + isRender: false, + + }; + } + enter=(num) =>{ + this.setState({login:num,speedy:1,dialogBox:'dialogBox'}); + } + + register=(num) =>{ + this.setState({login:1,speedy:num,dialogBox:'dialogBox2'}); + } + + loginChange = () =>{ + let reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/; + let reg1 = /^1\d{10}$/; + let reg2=/^[a-zA-z]\w{3,14}$/; + let value=this.refs.loginPassText.value; + let valuenum= value.length; + if(valuenum>0){ + if(!reg.test(value)&&!reg1.test(value)&&!reg2.test(value)){ + this.setState({regular:1}) + return + }else{ + this.setState({loginValue:value}) + this.setState({regular:0}) + } + }else{ + this.setState({loginValue:value}) + } + } + + passwordChange = () =>{ + let value =this.refs.passwordText.value; + + let valuenum= value.length; + this.setState({disabled:false}) + this.setState({bottonclass:'log-botton mt5 edu-back-blue'}) + if(valuenum==0){ + this.setState({bottonclass:'log-botton mt5'}) + this.setState({disabled:true}) + } + this.setState({passValue:value}) + } + + handleInputChange =(event)=> { + const target = event.target; + const value = target.type === 'checkbox' ? target.checked : target.value; + const name = target.name; + + this.setState({[name]:value}) + + if(value===true){ + this.setState({isGoingValue:1}) + }else{ + this.setState({isGoingValue:0}) + } + + } + + // 快捷注册 + shortcutIdChange=()=>{ + let reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/; + let reg1 = /^1\d{10}$/; + let reg2=/^[a-zA-z]\w{3,14}$/; + let value=this.refs.shortcutText.value; + let valuenum= value.length; + if(valuenum>0){ + if(!reg.test(value)&&!reg1.test(value)&&!reg2.test(value)){ + this.setState({shortcutnum:0}) + this.setState({disabledType:true}) + this.setState({gaincode : 'gain-code'}) + return + }else{ + this.setState({gaincode : 'gain-code edu-back-blue'}) + this.setState({shortcutValue:value}) + this.setState({shortcutnum:1}) + this.setState({disabledType:false}) + } + + + }else{ + this.setState({shortcutValue:value}) + + } + + } + authCodeChange=()=>{ + + let value=this.refs.authCodeText.value; + let valuenum= value.length; + if(valuenum>3){ + this.setState({authCodeType:false}) + this.setState({authCodeclass:'log-botton mt5 edu-back-blue'}) + }else if(valuenum==0){ + this.setState({authCodeType:true}) + this.setState({authCodeclass:'log-botton mt5'}) + } + } + get_login_verification_code=()=>{ + get_login_verification_code($('#get_verification_code')[0]) + } + dragWrapper=() =>{ + const $ = window.$ + $.fn.drag = function(options) { + + var x, drag = this, isMove = false, defaults = { + }; + var options = $.extend(defaults, options); + var handler = drag.find('.handler'); + var drag_bg = drag.find('.drag_bg'); + var text = drag.find('.drag_text'); + var maxWidth = 100 + //鼠标按下时候的x轴的位置 + handler.mousedown(function(e) { + isMove = true; + x = e.pageX - parseInt(handler.css('left'), 10); + maxWidth = drag.width() - handler.width() - 2; //能滑动的最大间距 + }); + $(document).mousemove(function(e) { + var _x = e.pageX - x;// _x = e.pageX - (e.pageX - parseInt(handler.css('left'), 10)) = x + if (isMove) { + + if (_x > 0 && _x <= maxWidth) { + handler.css({'left': _x}); + drag_bg.css({'width': _x}); + } else if (_x > maxWidth) { //鼠标指针移动距离达到最大时清空事件 + dragOk(); + } + } + }).mouseup(function(e) { + isMove = false; + var _x = e.pageX - x; + if (_x < maxWidth) { //鼠标松开时,如果没有达到最大距离位置,滑块就返回初始位置 + handler.css({'left': 0}); + drag_bg.css({'width': 0}); + } + }); + + //清空事件 + function dragOk() { + handler.removeClass('handler_bg').addClass('handler_ok_bg'); + text.removeClass('slidetounlock').text('验证通过').css({'color':'#fff'}); //modify + // drag.css({'color': '#fff !important'}); + + handler.css({'left': maxWidth}); // add + drag_bg.css({'width': maxWidth}); // add + + handler.unbind('mousedown'); + $(document).unbind('mousemove'); + $(document).unbind('mouseup'); + + } + } + + setTimeout(()=>{ + $('#quick-drag').drag(); + }, 4000) + } + + componentWillReceiveProps(nextProps) { + + this.setState({ + isRender:nextProps.isRender + }) + // console.log(nextProps.isRender); + + } + + componentDidMount() { + + if(this.props.isRender!=undefined){ + this.setState({ + isRender:this.props.isRender + }) + } + + // $(document).on("showLoginDialog", (e, args)=>{ + // this.setState({ + // isRender: true + // }) + // }) + + this.dragWrapper(); + + axios.interceptors.response.use((response) => { + if(response!=undefined) + if (response&&response.data.status === 401) { + this.setState({ + isRender: true + }) + } + return response; + }, (error) => { + // // if (error.response && error.response.data.error === '401 Unauthorized') { + // // this.back_url = window.location.href; + // // this.setState({ + // // isRender: true + // // }) + // // // TODO 这里如果样式变了会出现css不加载的情况 + // // const $ = window.$; + // // const isCssLoaded = window.getComputedStyle($('.log_nav li.active')[0], null) + // // .getPropertyValue('border-bottom') + // // == "2px solid rgb(69, 155, 229)" + // // if (!isCssLoaded) { + // // const isPort3007 = window.location.port == 3007; + // // let _url_origin = isPort3007 ? 'http://localhost:3000' : '' + // // + // // $('head').append( $('') + // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) ); + // // $('head').append( $('') + // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) ); + // // } + // // } + // // return Promise.reject(error); + }); + } + handleDialogClose() { + this.setState({ + isRender: false + }) + window.location.href="/"; + } + + loginEDU=()=>{ + let {loginValue,passValue,regular,isGoingValue}=this.state; + if(regular===1){ + return + } + let newloginValue=loginValue.replace(/(^\s*)|(\s*$)/g, ""); + let newpassValue=passValue.replace(/(^\s*)|(\s*$)/g, ""); + + let url='/accounts/login.json' + axios.post(url, { + login:newloginValue, + password:newpassValue, + autologin:isGoingValue + } + ).then((response) => { + if(response===undefined){ + return + } + if(response.status===200){ + if (response.data.status === 402) { + window.location.href = response.data.url; + }else{ + broadcastChannelPostMessage('refreshPage') + this.setState({ + isRender:false + }) + window.location.reload(); + } + } + + }).catch((error) => { + console.log("356"); + console.log(error) + }) + } + onKeydowns=(e)=>{ + let {disabled}=this.state; + if( disabled===false&& e.keyCode === 13){ + this.loginEDU() + console.log(1) + } + } + render() { + let{open,login,speedy,loginValue,regular,isGoing,isGoingValue,disabled,bottonclass, + dialogBox,shortcutnum,disabledType,gaincode,authCodeType,authCodeclass, isRender}=this.state; + + if (isRender === undefined) { + isRender = false + } + + return ( + this.handleDialogClose()} + > +
+
{this.handleDialogClose()}}> + +
+ +
+
    +
  • {this.enter(0)}}>登录
  • + {/*
  • {this.register(0)}}>快捷登录
  • */} +
+ + +
+
+ +
+ + +
+ + + + +

请输入有效的手机号/邮箱号/用户名

+ +
+ + +
+

+ 请输入密码 +

+
+
+ + + {/**/} + +
+ 登录 +
+ +

+ + + + + + + + 忘记密码 + 注册 + + +

+ +
+
+ + {/*快捷登录*/} + + + +
+
+ +
+ + ); + } + +} + +export default LoginDialog ; + + +// onkeypress="user_login_keypress(event);" + +// onkeypress="user_login_keypress(event);" + + +{/*
+
+
+

+
+
} + + + +{/*第三方账号登录*/} + +{/*
+

第三方账号登录

+
+ + + +
+
} + +// +// {/*
*/} +// {/*
*/} +// {/*
*/} +// {/**/} +// {/**/} +// {/*
*/} +// {/**/} +// {/**/} +// {/**/} +// {/*
*/} +// {/*

请输入有效的手机号/邮箱号*/} +// {/*

*/} +// {/*
*/} +// +// {/*
*/} +// {/*/!*drag*/ }*/} +// {/*
*/} +// {/*
*/} +// {/*
*/} +// {/*请按住滑块,拖动到最右边*/} +// {/*
*/} +// {/*
*/} +// {/*
*/} +// {/*
*/} +// {/*

请先拖动滑块完成验证

*/} +// {/*
*/} +// {/*
*/} +// +// {/*

*/} +// {/**/} +// {/**/} +// {/**/} +// {/*

*/} +// +// {/*
*/} +// {/*

*/} +// {/*请输入验证码*/} +// {/*

*/} +// {/*
*/} +// +// {/**/} +// +// {/*

*/} +// +// {/**/} +// {/**/} +// {/**/} +// {/**/} +// +// {/**/} +// {/*忘记密码*/} +// {/*注册*/} +// {/**/} +// +// {/*

*/} +// {/**/} +// {/*
*/} diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 2d1451d6b..da73b6282 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -331,18 +331,21 @@ class NewHeader extends Component { } educoderlogin=()=>{ //退出账号 - var url = `/accounts/logout.json`; - - axios.get((url)).then((result) => { - if(result!==undefined){ - // this.setState({ - // isRender:true - // }) - window.location.href = "/"; - } - }).catch((error) => { - console.log(error); + this.setState({ + isRender:true }) + // var url = `/accounts/logout.json`; + // + // axios.get((url)).then((result) => { + // if(result!==undefined){ + // // this.setState({ + // // isRender:true + // // }) + // window.location.href = "/"; + // } + // }).catch((error) => { + // console.log(error); + // }) } onKeywordSearch = () => { From 0f544ac5d98d956ba29a9db003caa56735c0703a Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 17:49:33 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index da73b6282..bdb6b2a09 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -331,21 +331,21 @@ class NewHeader extends Component { } educoderlogin=()=>{ //退出账号 - this.setState({ - isRender:true - }) - // var url = `/accounts/logout.json`; - // - // axios.get((url)).then((result) => { - // if(result!==undefined){ - // // this.setState({ - // // isRender:true - // // }) - // window.location.href = "/"; - // } - // }).catch((error) => { - // console.log(error); + // this.setState({ + // isRender:true // }) + var url = `/accounts/logout.json`; + + axios.get((url)).then((result) => { + if(result!==undefined){ + // this.setState({ + // isRender:true + // }) + window.location.href = "/"; + } + }).catch((error) => { + console.log(error); + }) } onKeywordSearch = () => { From 1f9c6b833b705c2369aa64314964782b25d88f8b Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 18:13:20 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/login/EducoderLogin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 3c3f47c87..df5b5f8b8 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -177,7 +177,8 @@ class EducoderLogin extends Component { "align-items": "center", "width": "100%", }}> -
© 2019 EduCoder湘ICP备17009477号Trustie & IntelliDE inside.
+
© 2019 EduCoder 湘ICP备17009477号 Trustie & IntelliDE inside
+
From 7472189ee9677e002d8d6561d9065dcf2dfb3b33 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sat, 22 Jun 2019 18:17:55 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/usersInfo/Infos.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 941217750..58c0b3c4e 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -247,9 +247,8 @@ class Infos extends Component{
{ - data && is_current == false && data.identity =="学生" ?"" : {data && data.identity} + data && is_current == false && data.identity =="学生" ? "" : {data && data.identity} } - {data && data.identity} @@ -300,8 +299,8 @@ class Infos extends Component{ data && data.can_apply_trial == false ? data.attendance_signed ? - 已签到 - 明日签到 +{next_gold} 金币 + 已签到 +

明日签到 +{next_gold} 金币

:
签到 From 90c935f68c8d1e80e25591504060bc4a7dc3415c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 22 Jun 2019 18:39:39 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tasks/GraduationTasksSubmitedit.js | 10 +- .../src/modules/user/FindPasswordComponent.js | 66 +++++++------ .../modules/user/LoginRegisterComponent.js | 96 ++++++++++++------- public/react/src/modules/user/common.css | 6 +- 4 files changed, 112 insertions(+), 66 deletions(-) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index cad289855..97eebc59e 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -650,10 +650,12 @@ class GraduationTasksSubmitedit extends Component{ height: '30px', display:item.user_name===undefined?"none":"" }}> -
{item.user_name}
-
{item.group_name}
-
{item.student_id}
- {key>0?
this.delecttask_status(item.user_id)}>
:""} + +
{item.user_name}
+
+
{item.group_name}
+
{item.student_id}
+ {key>0?
this.delecttask_status(item.user_id)}>
:""}
) })} diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js index 8dea3e521..ae2b427d8 100644 --- a/public/react/src/modules/user/FindPasswordComponent.js +++ b/public/react/src/modules/user/FindPasswordComponent.js @@ -329,8 +329,17 @@ class LoginRegisterComponent extends Component { color: #05101A; line-height: 69px; } + .loginInputzhuche{ + width: 100%; + background-color: #fff!important; + height: 45px !important; + padding: 5px; + + } `} + +
找回密码 @@ -340,32 +349,33 @@ class LoginRegisterComponent extends Component { { ` .ant-input { - font-family: "Monospaced Number", "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; - -webkit-box-sizing: border-box; - box-sizing: border-box; - margin: 0; - padding: 0; - list-style: none; - position: relative; - display: inline-block; - padding: 4px 11px; - width: 100%; - height: 38px; - font-size: 14px; - line-height: 1.5; - color: rgba(0, 0, 0, 0.65); - background-color: #fff; - background-image: none; - border: 1px solid #d9d9d9; - border-radius: 4px; - -webkit-transition: all .3s; - -o-transition: all .3s; - transition: all .3s; -} - ` + font-family: "Monospaced Number", "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; + -webkit-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + padding: 0; + list-style: none; + position: relative; + display: inline-block; + padding: 4px 11px; + width: 100%; + height: 38px; + font-size: 14px; + line-height: 1.5; + color: rgba(0, 0, 0, 0.65); + background-color: #fff; + background-image: none; + border: 1px solid #d9d9d9; + border-radius: 4px; + -webkit-transition: all .3s; + -o-transition: all .3s; + transition: all .3s; + } + ` } this.inputOnBlur(e)} onChange={this.loginInputonChange} style={{marginTop: '10px',height: "38px"}}> { @@ -381,16 +391,18 @@ class LoginRegisterComponent extends Component { dragOkCallback={this.dragOkCallback} >
- 重新发送{seconds}s : getverificationcodes === true ? : } diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 5627890ee..587d77375 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -563,36 +563,45 @@ class LoginRegisterComponent extends Component { + this.inputOnBlur(e, 1)} style={{marginTop: '30px', height: '38px'}}> @@ -606,7 +615,7 @@ class LoginRegisterComponent extends Component { @@ -621,10 +630,33 @@ class LoginRegisterComponent extends Component { size={"large"}>登录
} + + { parseInt(tab[0])==1 &&
-
- { getverificationcodes === undefined ? - : getverificationcodes === true ? - : - } @@ -673,13 +705,13 @@ class LoginRegisterComponent extends Component { {/* style={{height: '0', width: '0', border: 'none', display: "none"}}/>*/} {/**/} - this.Showandhide(key)}> + this.Showandhide(key)}> }> Date: Sat, 22 Jun 2019 18:54:03 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 5 +- public/react/src/index.css | 3 + .../courses/coursesPublic/Startshixuntask.js | 330 ++++---- public/react/src/modules/page/tpiPage.css | 751 +++++++++--------- public/react/src/modules/tpm/NewHeader.js | 28 +- 5 files changed, 565 insertions(+), 552 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index bd3bb68fa..aa99f16f5 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -4,6 +4,7 @@ import axios from 'axios'; import { requestProxy } from "./indexEduplus2RequestProxy"; import { broadcastChannelOnmessage } from 'educoder' import { notification } from 'antd'; +import './index.css' broadcastChannelOnmessage('refreshPage', () => { window.location.reload() }) @@ -114,7 +115,9 @@ export function initAxiosInterceptors(props) { notification.open({ message:"提示", description: response.data.message || '服务器异常,请联系管理员。', - + style: { + zIndex: 99999999 + }, }); // notification['error']({ // message:"提示", diff --git a/public/react/src/index.css b/public/react/src/index.css index 6249aa94a..5b7639ce3 100644 --- a/public/react/src/index.css +++ b/public/react/src/index.css @@ -33,4 +33,7 @@ body { } .anticon anticon-paper-clip{ color: #29bd8b !important; +} +.notificationmystyle{ + z-index: 99999999; } \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js index 064ec645a..3a7b7408c 100644 --- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js +++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js @@ -1,163 +1,169 @@ -import React,{ Component } from "react"; -import { WordsBtn } from 'educoder'; -import {Tooltip,message,Modal} from 'antd'; -import {Link} from 'react-router-dom'; -import axios from 'axios'; -import Modals from '../../modals/Modals'; - - - -class Startshixuntask extends Component{ - constructor(props){ - super(props); - this.state = { - startbtn:false - } - - } - - componentDidMount() { - - } - - taskoperationId=(list)=>{ - this.setState({ - startbtn:true, - }) - let url= list+".json"; - axios.get(url).then((response) => { - - if(response.status===200){ - if(response.data.status===-2){ - - this.setState({ - startbtn:false, - shixunsreplace:true, - hidestartshixunsreplacevalue:response.data.message+".json" - }) - }else if(response.data.status===-1){ - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessage:response.data.message, - startshixunCombattype:true, - startbtn:false - }) - }else{ - - if(response.data.status!=401&&response.data.status!=403){ - window.location.href = "/tasks/"+response.data.game_identifier; - } - - } - } - }).catch((error) => { - this.setState({ - startbtn:false - }) - }); - - } - - hidestartshixunsreplace=(url)=>{ - axios.get(url).then((response) => { - if(response.status===200){ - - this.setState({ - shixunsreplace:false - }) - message.success('重置成功,正在进入实训!'); - let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - this.props.history.push(path); - - }} - ).catch((error) => { - this.setState({ - startbtn:false, - shixunsreplace:false - }) - }); - - } - - hidestartshixunCombattype=()=>{ - this.setState({ - startshixunCombattype:false - }) - } - - render(){ - let { - Modalstype, - Modalstopval, - Modalsbottomval, - cardsModalcancel, - cardsModalsavetype, - loadtype, - shixunsreplace, - hidestartshixunsreplacevalue, - startshixunCombattype, - shixunsmessage, - startbtn - } = this.state; - - return( - - - - - -
-

实训已经更新了,正在为您重置!

-
-
- - -
-

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 -

-
-
- {/*取消*/} - 知道啦 -
- {/*

*/} - {/*知道了*/} - {/*

*/} -
- - {this.props.isStudent? - - {this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?this.taskoperationId( this.props.data.task_operation[1])}> - {this.props.data.task_operation[0]} - :"开启中":""} - :"" - } - - - ) - } -} +import React,{ Component } from "react"; +import { WordsBtn } from 'educoder'; +import {Tooltip,message,Modal,Spin} from 'antd'; +import {Link} from 'react-router-dom'; +import axios from 'axios'; +import Modals from '../../modals/Modals'; + + +class Startshixuntask extends Component{ + constructor(props){ + super(props); + this.state = { + startbtn:false, + isSpin:false, + } + + } + + componentDidMount() { + + } + + taskoperationId=(list)=>{ + this.setState({ + startbtn:true, + }) + let url= list+".json"; + axios.get(url).then((response) => { + + if(response.status===200){ + if(response.data.status===-2){ + + this.setState({ + startbtn:false, + shixunsreplace:true, + hidestartshixunsreplacevalue:response.data.message+".json" + }) + }else if(response.data.status===-1){ + console.log(response) + }else if(response.data.status===-3){ + this.setState({ + shixunsmessage:response.data.message, + startshixunCombattype:true, + startbtn:false + }) + }else{ + + if(response.data.status!=401&&response.data.status!=403){ + window.location.href = "/tasks/"+response.data.game_identifier; + } + + } + } + }).catch((error) => { + this.setState({ + startbtn:false + }) + }); + + } + + hidestartshixunsreplace=(url)=>{ + this.setState({ + isSpin:true + }) + axios.get(url).then((response) => { + if(response.status===200){ + + this.setState({ + shixunsreplace:false, + isSpin:false, + }) + message.success('重置成功,正在进入实训!'); + let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + this.props.history.push(path); + + }} + ).catch((error) => { + this.setState({ + startbtn:false, + shixunsreplace:false + }) + }); + + } + + hidestartshixunCombattype=()=>{ + this.setState({ + startshixunCombattype:false + }) + } + + render(){ + let { + Modalstype, + Modalstopval, + Modalsbottomval, + cardsModalcancel, + cardsModalsavetype, + loadtype, + shixunsreplace, + hidestartshixunsreplacevalue, + startshixunCombattype, + shixunsmessage, + startbtn + } = this.state; + + return( + + + + + +
+

实训已经更新了,正在为您重置!

+
+
+ + +
+

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 +

+
+
+ {/*取消*/} + 知道啦 +
+ {/*

*/} + {/*知道了*/} + {/*

*/} +
+ + {this.props.isStudent? + + {this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?this.taskoperationId( this.props.data.task_operation[1])}> + {this.props.data.task_operation[0]} + :"开启中":""} + :"" + } + + + ) + } +} export default Startshixuntask; \ No newline at end of file diff --git a/public/react/src/modules/page/tpiPage.css b/public/react/src/modules/page/tpiPage.css index e803ca51f..34274907e 100644 --- a/public/react/src/modules/page/tpiPage.css +++ b/public/react/src/modules/page/tpiPage.css @@ -1,375 +1,376 @@ - -.page--header { - z-index: 1399 !important; -} - -/* 左右分隔条 */ -.b-label { - background: #111c24; -} -.b-label>.resize-helper { - height: 30px; - position: relative; - margin-top: -20px; - margin-left: -17px; - left: 50%; - top: 50%; - z-index: 50; -} -.b-label>.resize-helper button{ - width: 24px; - height: 24px; - min-height: 24px; - opacity: 0.7; -} -.b-label>.resize-helper button:hover { - opacity: 1; -} - -.b-label>.resize-helper button path { - color: #666666; - fill: currentColor; -} - -/* 所有i都加上动画 */ -#game_right_contents i { - transition: transform .3s ease; -} - - -/* */ -.h-center { - height: 3px; - background: rgb(17, 28, 36); - border-top: 1px solid rgb(25, 82, 123); -} - - -/* */ -/* codemirror初始化的时候高度没100% */ -#codetab_con_1 { - /*display: flex;*/ -} -.CodeMirror{ - /*height: -webkit-fill-available !important;*/ - line-height: 1.2; - - /*height: auto !important; - flex: 1 1 auto;*/ -} - -/* LeftView markdown */ -#game_show_content #tab_con_1 .editormd-preview, #game_show_content #tab_con_2 .editormd-preview - ,#game_show_content #tab_con_3 .editormd-preview - ,#game_show_content #tab_con_5 .editormd-preview { - width: 100% !important; - height: 100% !important; -} - -/* tab 样式覆盖 */ -#blacktab_nav { - background-color: #111C24; - border-bottom: 1px solid #222C34; -} -.blacktab_hover { - -} -.blacktab_hover a:after { - content: ''; - position: absolute; - left: 50%; - margin-left: -10px; - top: auto; - bottom: 0; - right: auto; - height: 2px; - width: 20px; - background-color: #29BD8B; -} - -button.buttonHoverColor:hover a { - color: #FF7500!important; -} - -/*--------------------------------------------------- Header Start */ -.leftNavDrawer { - z-index: 8000 !important; -} -.leftNavDrawer>div:nth-child(2) { - /*left:80px !important;*/ - z-index: 8000 !important; - top: 54px; - overflow: hidden; -} -.leftNavDrawer .MuiDrawer-paper-2 { - width: 500px; -} - -.leftNavDrawer .page--over { - left: 0px; - position: static; -} -.leftNavDrawer .col-width-3 { - position: static; - width: 400px; - border: none; -} - - -#myshixun_top { - display: flex; - height: 54px; -} -.headerLeft { - flex: 0 0 400px; -} - #user_grade a { - color: white; - } - .-header-right { - right: inherit; - margin-left: 24px; - display: inline-block; - top: 10px; - height: 32px; - padding: 3px 15px - } - .userInfo { - display: inline-block; - top: 4px; - position: relative; - margin-left: 10px; - } - .userInfo img { - border-radius: 18px; - vertical-align: bottom; - } - .userInfo .userInfoName { - margin-left: 12px; - color: #fff; - font-size: 16px; - } - #user_grade { - margin-top: -1px; - } -.headerCenter { - flex: 1 1 auto; - text-align: center; - flex-direction: column; -} - .headerCenter h2 { - max-width: none; - width: 100%; - font-size: 16px; - flex: 0 0 24px; - } - .headerCenter .timeRecord { - font-size: 13px; - color: #CCCCCC; - width: 100px; - margin: auto; - } -.headerRight { - flex: 0 0 400px; -} - .headerRight a { - color: #1A3F5F; - font-size: 16px; - } - .headerRight .exitBtn { - color: #1a3f5f !important; - } - .headerRight a:hover { - color: #4CACFF !important; - } - .headerRight i { - font-size: 24px !important; - margin-right: 8px; - margin-top: 12px; - vertical-align: -4px; - } - - -/*--------------------------------------------------- Header End */ -/* picture_display 样式,language_display处理*/ -.photo_display { - padding-top: 54px; - padding-left: 0px; -} -.with33{ width: 33%;} -.with49{ width: 49%;} -.mr1precent{margin-right: 1%;} -.mr03precent{margin-right: 0.3%;} -/*TPI输出TXT文件显示*/ -.output-txt{padding: 10px;box-shadow:1px 6px 24px rgba(17,28,36,0.2);min-height: 500px;width: 100%;box-sizing: border-box;outline: none;} - -/* -------------------------------------- m design 控件样式修改*/ -.rootSnackbar { - top: 60px !important; - z-index: 99999999 !important; -} -.rootSnackbar>div>div { - margin: 0 auto; -} - -/* Dialog */ -#alert-dialog-title>h2 { - text-align: center; -} - #alert-dialog-title { - border-bottom: 1px solid #eee; - margin-bottom: 18px; - } -body>div[role=dialog]>div[role=document]>div:nth-child(3) { - justify-content: center; -} -body>div[role=dialog]>div { - /* tpi dialog按钮改成平铺的大按钮 */ - /* padding-bottom: 10px; */ -} -/* tpi 窗口宽度*/ -body>div[role=dialog] div[role=document] { - min-width: 400px; -} -#alert-dialog-title + div { - text-align: center; -} - -body>div>div[role=tooltip] { - font-size: 12px; -} - -/* -------------------------------------- m design 控件样式修改 END*/ - -/*rc-tree样式*/ -.repoFilesDrawer .rc-tree li span.rc-tree-checkbox, .rc-tree li span.rc-tree-iconEle, .rc-tree li span.rc-tree-switcher { - background-image:url('../../images/component/rc-tree.png'); -} -.rc-tree li span.rc-tree-node-selected .rc-tree-iconEle { - background-image:url('../../images/component/selectFile.png'); - background-position: 0; - margin-bottom: 4px; -} -.repoFilesDrawer .rc-tree li span.rc-tree-icon_loading { - margin-right: 2px; - vertical-align: top; - background: url(data:image/gif;base64,R0lGODlhEAAQAKIGAMLY8YSx5HOm4Mjc88/g9Ofw+v///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAGACwAAAAAEAAQAAADMGi6RbUwGjKIXCAA016PgRBElAVlG/RdLOO0X9nK61W39qvqiwz5Ls/rRqrggsdkAgAh+QQFCgAGACwCAAAABwAFAAADD2hqELAmiFBIYY4MAutdCQAh+QQFCgAGACwGAAAABwAFAAADD1hU1kaDOKMYCGAGEeYFCQAh+QQFCgAGACwKAAIABQAHAAADEFhUZjSkKdZqBQG0IELDQAIAIfkEBQoABgAsCgAGAAUABwAAAxBoVlRKgyjmlAIBqCDCzUoCACH5BAUKAAYALAYACgAHAAUAAAMPaGpFtYYMAgJgLogA610JACH5BAUKAAYALAIACgAHAAUAAAMPCAHWFiI4o1ghZZJB5i0JACH5BAUKAAYALAAABgAFAAcAAAMQCAFmIaEp1motpDQySMNFAgA7) no-repeat scroll 0 0 transparent; -} - -/*去除选中的颜色*/ -.repoFilesDrawer .rc-tree-node-selected { - background-color: #4CACFF; - border: 1px solid #4CACFF; - opacity: 1; - height: 26px !important; -} -.repoFilesDrawer .rc-tree-node-selected span.rc-tree-title { - color: #fff; -} - -/* - - Name: Railscasts - Author: Ryan Bates (http://railscasts.com) - - CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) - Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) - -*/ - -.cm-s-railscasts.CodeMirror {background: #2b2b2b;color: #f4f1ed;line-height: 21px;} -.cm-s-railscasts div.CodeMirror-selected {background: #214283 !important;} -.cm-s-railscasts .CodeMirror-gutters {/*background: #2b2b2b; */border-right: 0px;} -.cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;} -.cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;} - -.cm-s-railscasts span.cm-comment {color: #bc9458;} -.cm-s-railscasts span.cm-atom {color: #b6b3eb;} -.cm-s-railscasts span.cm-number {color: #b6b3eb;} - -.cm-s-railscasts span.cm-property, .cm-s-railscasts span.cm-attribute {color: #a5c261;} -.cm-s-railscasts span.cm-keyword {color: #da4939;} -.cm-s-railscasts span.cm-string {color: #ffc66d;} - -.cm-s-railscasts span.cm-variable {color: #a5c261;} -.cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;} -.cm-s-railscasts span.cm-def {color: #cc7833;} -/*.cm-s-railscasts span.cm-error {background: #da4939; color: #d4cfc9;}*/ -.cm-s-railscasts span.cm-bracket {color: #f4f1ed;} -.cm-s-railscasts span.cm-tag {color: #da4939;} -.cm-s-railscasts span.cm-link {color: #b6b3eb;} - -.cm-s-railscasts .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} -.cm-s-railscasts .CodeMirror-activeline-background { background: #303040; } - - - - -/* evaluateView*/ - -.CodeMirror-lines{padding: 0px!important;} -.cm-s-blackboard.CodeMirror {background: #0C1021; color: #F8F8F8; } -.cm-s-blackboard div.CodeMirror-selected { background: #253B76; } -.cm-s-blackboard .CodeMirror-line::selection, .cm-s-blackboard .CodeMirror-line > span::selection, .cm-s-blackboard .CodeMirror-line > span > span::selection { background: rgba(37, 59, 118, .99); } -.cm-s-blackboard .CodeMirror-line::-moz-selection, .cm-s-blackboard .CodeMirror-line > span::-moz-selection, .cm-s-blackboard .CodeMirror-line > span > span::-moz-selection { background: rgba(37, 59, 118, .99); } -.cm-s-blackboard .CodeMirror-gutters { background: #585858; border-right: 0; } -.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; } -.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; } -.cm-s-blackboard .CodeMirror-linenumber { color: #888;/*background: #585858;*/ } -.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7; } - -.cm-s-blackboard .cm-keyword { color: #FBDE2D; } -.cm-s-blackboard .cm-atom { color: #D8FA3C; } -.cm-s-blackboard .cm-number { color: #D8FA3C; } -.cm-s-blackboard .cm-def { color: #8DA6CE; } -.cm-s-blackboard .cm-variable { color: #FF6400; } -.cm-s-blackboard .cm-operator { color: #FBDE2D; } -.cm-s-blackboard .cm-comment { color: #AEAEAE; } -.cm-s-blackboard .cm-string { color: #61CE3C; } -.cm-s-blackboard .cm-string-2 { color: #61CE3C; } -.cm-s-blackboard .cm-meta { color: #D8FA3C; } -.cm-s-blackboard .cm-builtin { color: #8DA6CE; } -.cm-s-blackboard .cm-tag { color: #8DA6CE; } -.cm-s-blackboard .cm-attribute { color: #8DA6CE; } -.cm-s-blackboard .cm-header { color: #FF6400; } -.cm-s-blackboard .cm-hr { color: #AEAEAE; } -.cm-s-blackboard .cm-link { color: #8DA6CE; } -.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } - -.cm-s-blackboard .CodeMirror-activeline-background { background: #3C3636; } -.cm-s-blackboard .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; } - -.cm-s-railscasts span.cm-error { - color: #bc9458; -} - -/* 弹框 */ -.popupAll{width: 100%;height: 100%;position: fixed;z-index: 99998;background-color: rgba(5,16,26,0.6);left: 0;top:0;} -.task-popup{ width: 30%;background: #fff; border:1px solid #e8e8e8; border-radius:10px; -webkit-box-shadow:0 0 10px #ccc; -moz-box-shadow:0 0 10px #ccc; box-shadow:0 0 10px #ccc;} -.task-popup-text-center{ text-align: center; color: #333;} -.task-popup-title{ border-bottom: 1px solid #eee; padding:0px 15px;text-align: center;box-sizing: border-box;line-height: 70px;height: 70px; border-radius: 10px 10px 0px 0px;font-size: 16px; } -.task-popup-content{ padding:15px;} -/*注释这个地方是因为会影响到实训哪块合作者删除的样式*/ -/*.task-popup-submit{ margin:0px auto 15px; width: 120px;}*/ -.task-popup-sure{ margin:0px auto 15px; width: 54px;} -.task-popup-right-sure{margin:0px auto 15px;text-align: center} -.task-popup-OK{ margin:15px auto; text-align: center} -.task-popup-bggrey{ background:#fff; color:#333;} -a.task-btn-orange{background: #4CACFF; color:#fff!important;} -a:hover.task-btn-orange{background: #4CACFF; color:#fff!important;} - - -/* 代码区域样式 */ -#games_repository_contents .readRepoFailed { - color: #fff; - width: 100%; - text-align: center; - margin-top: 120px; -} - #games_repository_contents .readRepoFailed .retry { - color:#4CACFF; - } - - - - + +.page--header { + z-index: 1399 !important; +} + +/* 左右分隔条 */ +.b-label { + background: #111c24; +} +.b-label>.resize-helper { + height: 30px; + position: relative; + margin-top: -20px; + margin-left: -17px; + left: 50%; + top: 50%; + z-index: 50; +} +.b-label>.resize-helper button{ + width: 24px; + height: 24px; + min-height: 24px; + opacity: 0.7; +} +.b-label>.resize-helper button:hover { + opacity: 1; +} + +.b-label>.resize-helper button path { + color: #666666; + fill: currentColor; +} + +/* 所有i都加上动画 */ +#game_right_contents i { + transition: transform .3s ease; +} + + +/* */ +.h-center { + height: 3px; + background: rgb(17, 28, 36); + border-top: 1px solid rgb(25, 82, 123); +} + + +/* */ +/* codemirror初始化的时候高度没100% */ +#codetab_con_1 { + /*display: flex;*/ +} +.CodeMirror{ + /*height: -webkit-fill-available !important;*/ + line-height: 1.2; + + /*height: auto !important; + flex: 1 1 auto;*/ +} + +/* LeftView markdown */ +#game_show_content #tab_con_1 .editormd-preview, #game_show_content #tab_con_2 .editormd-preview + ,#game_show_content #tab_con_3 .editormd-preview + ,#game_show_content #tab_con_5 .editormd-preview { + width: 100% !important; + height: 100% !important; +} + +/* tab 样式覆盖 */ +#blacktab_nav { + background-color: #111C24; + border-bottom: 1px solid #222C34; +} +.blacktab_hover { + +} +.blacktab_hover a:after { + content: ''; + position: absolute; + left: 50%; + margin-left: -10px; + top: auto; + bottom: 0; + right: auto; + height: 2px; + width: 20px; + background-color: #29BD8B; +} + +button.buttonHoverColor:hover a { + color: #FF7500!important; +} + +/*--------------------------------------------------- Header Start */ +.leftNavDrawer { + z-index: 8000 !important; +} +.leftNavDrawer>div:nth-child(2) { + /*left:80px !important;*/ + z-index: 8000 !important; + top: 54px; + overflow: hidden; +} +.leftNavDrawer .MuiDrawer-paper-2 { + width: 500px; +} + +.leftNavDrawer .page--over { + left: 0px; + position: static; +} +.leftNavDrawer .col-width-3 { + position: static; + width: 400px; + border: none; +} + + +#myshixun_top { + display: flex; + height: 54px; +} +.headerLeft { + flex: 0 0 400px; +} + #user_grade a { + color: white; + } + .-header-right { + right: inherit; + margin-left: 24px; + display: inline-block; + top: 10px; + height: 32px; + padding: 3px 15px + } + .userInfo { + display: inline-block; + top: 4px; + position: relative; + margin-left: 10px; + } + .userInfo img { + border-radius: 18px; + vertical-align: bottom; + } + .userInfo .userInfoName { + margin-left: 12px; + color: #fff; + font-size: 16px; + } + #user_grade { + margin-top: -1px; + } +.headerCenter { + flex: 1 1 auto; + text-align: center; + flex-direction: column; +} + .headerCenter h2 { + max-width: none; + width: 100%; + font-size: 16px; + flex: 0 0 24px; + } + .headerCenter .timeRecord { + font-size: 13px; + color: #CCCCCC; + width: 100px; + margin: auto; + } +.headerRight { + flex: 0 0 400px; +} + .headerRight a { + color: #1A3F5F; + font-size: 16px; + } + .headerRight .exitBtn { + color: #1a3f5f !important; + } + .headerRight a:hover { + color: #4CACFF !important; + } + .headerRight i { + font-size: 24px !important; + margin-right: 8px; + margin-top: 12px; + vertical-align: -4px; + } + + +/*--------------------------------------------------- Header End */ +/* picture_display 样式,language_display处理*/ +.photo_display { + padding-top: 54px; + padding-left: 0px; +} +.with33{ width: 33%;} +.with49{ width: 49%;} +.mr1precent{margin-right: 1%;} +.mr03precent{margin-right: 0.3%;} +/*TPI输出TXT文件显示*/ +.output-txt{padding: 10px;box-shadow:1px 6px 24px rgba(17,28,36,0.2);min-height: 500px;width: 100%;box-sizing: border-box;outline: none;} + +/* -------------------------------------- m design 控件样式修改*/ +.rootSnackbar { + top: 60px !important; + z-index: 99999999 !important; +} +.rootSnackbar>div>div { + margin: 0 auto; +} + + +/* Dialog */ +#alert-dialog-title>h2 { + text-align: center; +} + #alert-dialog-title { + border-bottom: 1px solid #eee; + margin-bottom: 18px; + } +body>div[role=dialog]>div[role=document]>div:nth-child(3) { + justify-content: center; +} +body>div[role=dialog]>div { + /* tpi dialog按钮改成平铺的大按钮 */ + /* padding-bottom: 10px; */ +} +/* tpi 窗口宽度*/ +body>div[role=dialog] div[role=document] { + min-width: 400px; +} +#alert-dialog-title + div { + text-align: center; +} + +body>div>div[role=tooltip] { + font-size: 12px; +} + +/* -------------------------------------- m design 控件样式修改 END*/ + +/*rc-tree样式*/ +.repoFilesDrawer .rc-tree li span.rc-tree-checkbox, .rc-tree li span.rc-tree-iconEle, .rc-tree li span.rc-tree-switcher { + background-image:url('../../images/component/rc-tree.png'); +} +.rc-tree li span.rc-tree-node-selected .rc-tree-iconEle { + background-image:url('../../images/component/selectFile.png'); + background-position: 0; + margin-bottom: 4px; +} +.repoFilesDrawer .rc-tree li span.rc-tree-icon_loading { + margin-right: 2px; + vertical-align: top; + background: url(data:image/gif;base64,R0lGODlhEAAQAKIGAMLY8YSx5HOm4Mjc88/g9Ofw+v///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAGACwAAAAAEAAQAAADMGi6RbUwGjKIXCAA016PgRBElAVlG/RdLOO0X9nK61W39qvqiwz5Ls/rRqrggsdkAgAh+QQFCgAGACwCAAAABwAFAAADD2hqELAmiFBIYY4MAutdCQAh+QQFCgAGACwGAAAABwAFAAADD1hU1kaDOKMYCGAGEeYFCQAh+QQFCgAGACwKAAIABQAHAAADEFhUZjSkKdZqBQG0IELDQAIAIfkEBQoABgAsCgAGAAUABwAAAxBoVlRKgyjmlAIBqCDCzUoCACH5BAUKAAYALAYACgAHAAUAAAMPaGpFtYYMAgJgLogA610JACH5BAUKAAYALAIACgAHAAUAAAMPCAHWFiI4o1ghZZJB5i0JACH5BAUKAAYALAAABgAFAAcAAAMQCAFmIaEp1motpDQySMNFAgA7) no-repeat scroll 0 0 transparent; +} + +/*去除选中的颜色*/ +.repoFilesDrawer .rc-tree-node-selected { + background-color: #4CACFF; + border: 1px solid #4CACFF; + opacity: 1; + height: 26px !important; +} +.repoFilesDrawer .rc-tree-node-selected span.rc-tree-title { + color: #fff; +} + +/* + + Name: Railscasts + Author: Ryan Bates (http://railscasts.com) + + CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) + Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) + +*/ + +.cm-s-railscasts.CodeMirror {background: #2b2b2b;color: #f4f1ed;line-height: 21px;} +.cm-s-railscasts div.CodeMirror-selected {background: #214283 !important;} +.cm-s-railscasts .CodeMirror-gutters {/*background: #2b2b2b; */border-right: 0px;} +.cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;} +.cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;} + +.cm-s-railscasts span.cm-comment {color: #bc9458;} +.cm-s-railscasts span.cm-atom {color: #b6b3eb;} +.cm-s-railscasts span.cm-number {color: #b6b3eb;} + +.cm-s-railscasts span.cm-property, .cm-s-railscasts span.cm-attribute {color: #a5c261;} +.cm-s-railscasts span.cm-keyword {color: #da4939;} +.cm-s-railscasts span.cm-string {color: #ffc66d;} + +.cm-s-railscasts span.cm-variable {color: #a5c261;} +.cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;} +.cm-s-railscasts span.cm-def {color: #cc7833;} +/*.cm-s-railscasts span.cm-error {background: #da4939; color: #d4cfc9;}*/ +.cm-s-railscasts span.cm-bracket {color: #f4f1ed;} +.cm-s-railscasts span.cm-tag {color: #da4939;} +.cm-s-railscasts span.cm-link {color: #b6b3eb;} + +.cm-s-railscasts .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} +.cm-s-railscasts .CodeMirror-activeline-background { background: #303040; } + + + + +/* evaluateView*/ + +.CodeMirror-lines{padding: 0px!important;} +.cm-s-blackboard.CodeMirror {background: #0C1021; color: #F8F8F8; } +.cm-s-blackboard div.CodeMirror-selected { background: #253B76; } +.cm-s-blackboard .CodeMirror-line::selection, .cm-s-blackboard .CodeMirror-line > span::selection, .cm-s-blackboard .CodeMirror-line > span > span::selection { background: rgba(37, 59, 118, .99); } +.cm-s-blackboard .CodeMirror-line::-moz-selection, .cm-s-blackboard .CodeMirror-line > span::-moz-selection, .cm-s-blackboard .CodeMirror-line > span > span::-moz-selection { background: rgba(37, 59, 118, .99); } +.cm-s-blackboard .CodeMirror-gutters { background: #585858; border-right: 0; } +.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; } +.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; } +.cm-s-blackboard .CodeMirror-linenumber { color: #888;/*background: #585858;*/ } +.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7; } + +.cm-s-blackboard .cm-keyword { color: #FBDE2D; } +.cm-s-blackboard .cm-atom { color: #D8FA3C; } +.cm-s-blackboard .cm-number { color: #D8FA3C; } +.cm-s-blackboard .cm-def { color: #8DA6CE; } +.cm-s-blackboard .cm-variable { color: #FF6400; } +.cm-s-blackboard .cm-operator { color: #FBDE2D; } +.cm-s-blackboard .cm-comment { color: #AEAEAE; } +.cm-s-blackboard .cm-string { color: #61CE3C; } +.cm-s-blackboard .cm-string-2 { color: #61CE3C; } +.cm-s-blackboard .cm-meta { color: #D8FA3C; } +.cm-s-blackboard .cm-builtin { color: #8DA6CE; } +.cm-s-blackboard .cm-tag { color: #8DA6CE; } +.cm-s-blackboard .cm-attribute { color: #8DA6CE; } +.cm-s-blackboard .cm-header { color: #FF6400; } +.cm-s-blackboard .cm-hr { color: #AEAEAE; } +.cm-s-blackboard .cm-link { color: #8DA6CE; } +.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } + +.cm-s-blackboard .CodeMirror-activeline-background { background: #3C3636; } +.cm-s-blackboard .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; } + +.cm-s-railscasts span.cm-error { + color: #bc9458; +} + +/* 弹框 */ +.popupAll{width: 100%;height: 100%;position: fixed;z-index: 99998;background-color: rgba(5,16,26,0.6);left: 0;top:0;} +.task-popup{ width: 30%;background: #fff; border:1px solid #e8e8e8; border-radius:10px; -webkit-box-shadow:0 0 10px #ccc; -moz-box-shadow:0 0 10px #ccc; box-shadow:0 0 10px #ccc;} +.task-popup-text-center{ text-align: center; color: #333;} +.task-popup-title{ border-bottom: 1px solid #eee; padding:0px 15px;text-align: center;box-sizing: border-box;line-height: 70px;height: 70px; border-radius: 10px 10px 0px 0px;font-size: 16px; } +.task-popup-content{ padding:15px;} +/*注释这个地方是因为会影响到实训哪块合作者删除的样式*/ +/*.task-popup-submit{ margin:0px auto 15px; width: 120px;}*/ +.task-popup-sure{ margin:0px auto 15px; width: 54px;} +.task-popup-right-sure{margin:0px auto 15px;text-align: center} +.task-popup-OK{ margin:15px auto; text-align: center} +.task-popup-bggrey{ background:#fff; color:#333;} +a.task-btn-orange{background: #4CACFF; color:#fff!important;} +a:hover.task-btn-orange{background: #4CACFF; color:#fff!important;} + + +/* 代码区域样式 */ +#games_repository_contents .readRepoFailed { + color: #fff; + width: 100%; + text-align: center; + margin-top: 120px; +} + #games_repository_contents .readRepoFailed .retry { + color:#4CACFF; + } + + + + diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index bdb6b2a09..5498866cd 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -331,21 +331,21 @@ class NewHeader extends Component { } educoderlogin=()=>{ //退出账号 - // this.setState({ - // isRender:true - // }) - var url = `/accounts/logout.json`; - - axios.get((url)).then((result) => { - if(result!==undefined){ - // this.setState({ - // isRender:true - // }) - window.location.href = "/"; - } - }).catch((error) => { - console.log(error); + this.setState({ + isRender:true }) + // var url = `/accounts/logout.json`; + + // axios.get((url)).then((result) => { + // if(result!==undefined){ + // // this.setState({ + // // isRender:true + // // }) + // window.location.href = "/"; + // } + // }).catch((error) => { + // console.log(error); + // }) } onKeywordSearch = () => { From 3ec184008bfd80654c54a07720b8d2442d107412 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 18:56:29 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/Startshixuntask.js | 4 +- public/react/src/modules/tpm/TPMBanner.js | 1842 +++++++++-------- 2 files changed, 927 insertions(+), 919 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js index 3a7b7408c..b994e9005 100644 --- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js +++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js @@ -124,15 +124,15 @@ class Startshixuntask extends Component{ footer={null} keyboard={false} > +

实训已经更新了,正在为您重置!

+
{ - var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 - var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 - var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 - var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; - if(isIE) { - var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); - reIE.test(userAgent); - var fIEVersion = parseFloat(RegExp["$1"]); - if(fIEVersion == 7) { - return 7; - } else if(fIEVersion == 8) { - return 8; - } else if(fIEVersion == 9) { - return 9; - } else if(fIEVersion == 10) { - return 10; - } else { - return 6;//IE版本<=7 - } - } else if(isEdge) { - return 'edge';//edge - } else if(isIE11) { - return 11; //IE11 - }else{ - return -1;//不是ie浏览器 - } - } - componentDidMount() { - let thiisie=this.IEVersion(); - if(thiisie!=-1){ - this.setState({ - isIE:true - }) - }else{ - this.setState({ - isIE:false - }) - } - } - /* - * Fork - * */ - copyForkvisible = () => { - let {shixunsDetails} = this.props; - if (shixunsDetails.can_fork === null) { - this.setState({ - Forkvisible: true - }) - } else { - this.setState({ - Forkvisible: false, - Forkauthentication: true, - can_fork: shixunsDetails.can_fork.can_fork, - certi_url: shixunsDetails.can_fork.certi_url, - }) - } - - } - - hideForkvisible = () => { - this.setState({ - Forkvisible: false, - Forkauthentication:false - }) - } - - addForkvisible = () => { - this.setState({ - Forkvisibletype: true, - }) - let id = this.props.match.params.shixunId; - let url = "/shixuns/" + id + "/copy.json"; - axios.post(url).then((response) => { - if(response.data.status===401){ - - }else{ - this.setState({ - Forkvisible: false, - Forkauthentication: false, - // Forkvisibletype:false - }) - window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; - } - - }).catch((error) => { - console.log(error) - }); - - } - /* - * 发送至按钮 - * */ - Senttothe=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json"; - this.setState({ - Senttothetype:true - }) - - axios.get(url, { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list - }) - }).catch((error) => { - console.log(error) - }); - } - - SenttotheSearch=(value)=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+value; - axios.get(url, { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pages:1, - Searchvalue:value - }) - }).catch((error) => { - console.log(error) - }); - } - - onChangeSenttothevcalue=(e)=>{ - this.setState({ - Senttothevcalue:e.target.value - }) - } - onChangesendeSenttothe=(pageNumber)=>{ - let{Searchvalue}=this.state; - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue; - axios.get(url, { - params: { - page:pageNumber, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pagenum: pageNumber, - pages: pageNumber - }) - }).catch((error) => { - console.log(error) - }); - } - sendeSenttothevcalue=()=>{ - let {Senttothevcalue}=this.state; - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/send_to_course.json"; - axios.post(url,{ - course_id:Senttothevcalue - }).then((response) => { - this.props.showSnackbar(response.data.message); - this.setState({ - Senttothetype:false, - Searchvalue:"", - pages:1 - }) - window.location.href = response.data.url; - - }).catch((error) => { - console.log(error) - }); - - } - - hideSenttothevcalue=()=>{ - this.setState({ - Senttothetype:false, - Searchvalue:"", - pages:1 - }) - - - } - - /* - * 撤销发布按钮 - * */ - cancel_publish=()=>{ - - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/cancel_publish.json"; - axios.get(url).then((response) => { - this.props.showSnackbar(response.data.message); - window.location.reload() - }).catch((error) => { - console.log(error) - }); - } - - - /* - * 申请发布按钮 - * */ - applyrelease=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/publish.json"; - axios.get(url).then((response) => { - let evaluation_set_position - if(response.data.evaluation_set_position===null){ - evaluation_set_position=[] - }else{ - evaluation_set_position=response.data.evaluation_set_position - } - this.setState({ - Issuevisible:true, - tag_position:response.data.tag_position, - evaluation_set_position:evaluation_set_position, - publishboxstatus:response.data.status, - }) - }).catch((error) => { - console.log(error) - }); - }; - - hiddenIssuevisible=(val)=>{ - this.setState({ - Issuevisible:false - }) - if(val===0||val===1){ - window.location.reload() - } - - } - - //重置按钮 - // resetshixunCombat=(id)=>{ - // let zrl="/myshixuns/"+id+"/reset_my_game.json"; - // axios.get(zrl).then((response) => { - // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; - // message.success('重置成功'); - // }).catch((error) => { - // console.log(error) - // }); - // } - - hidestartshixunsreplace=(url)=>{ - axios.get(url).then((response) => { - if(response.status===200){ - let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - this.props.history.push(path); - this.setState({ - shixunsreplace:false - }) - message.success('重置成功,正在进入实训!'); - this.startshixunCombat(); - }} - ).catch((error) => { - this.setState({ - startbtn:false, - shixunsreplace:false - }) - }); - - } - //开始实战按钮 - startshixunCombat=()=>{ - let {shixunsDetails} = this.props - if( shixunsDetails.status>1){ - this.setState({ - startbtn:true, - hidestartshixunsreplacevalue:"" - }) - }else{ - this.setState({ - hidestartshixunsreplacevalue:"" - }) - } - - - let id = this.props.match.params.shixunId; - let url="/shixuns/"+id+"/shixun_exec.json"; - axios.get(url).then((response) => { - if(response.status===200){ - if(response.data.status===-2){ - // this.resetshixunCombat(response.data.message); - this.setState({ - startbtn:false, - shixunsreplace:true, - hidestartshixunsreplacevalue:response.data.message+".json" - }) - }else if(response.data.status===-1){ - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessage:response.data.message, - startshixunCombattype:true, - startbtn:false - }) - }else{ - // let path="/tasks/"+response.data.game_identifier; - // this.props.history.push(path); - - - // this.context.router.history.push(path); - if(response.data.status!=401){ - window.location.href = "/tasks/"+response.data.game_identifier; - } - - } - } - }).catch((error) => { - this.setState({ - startbtn:false - }) - }); - } - - tocertification=()=>{ - let{certi_url}=this.state; - this.setState({ - Forkauthentication:false - }) - window.location.href=certi_url; - } - - SenttotheValue=(e)=>{ - this.setState({ - Searchvalue:e.target.value - }) - } - - hidestartshixunCombattype=()=>{ - this.setState({ - startshixunCombattype:false - }) - } - - - - render() { - let { - Forkvisible, - Senttothetype, - Senttothevcalue, - evaluation_set_position, - Forkauthentication, - can_fork, - certi_url, - tag_position, - courses_count, - course_list, - Issuevisible, - publishboxstatus, - showradios, - startbtn, - Searchvalue, - startshixunCombattype, - shixunsmessage, - pages, - shixunsreplace, - hidestartshixunsreplacevalue, - Forkvisibletype, - isIE} = this.state; - let {shixunsDetails, shixunId, star_info, star_infos} = this.props; - let challengeBtnTipText = ''; - let challengeBtnText = '模拟实战'; - // let star_info=[] - // if (shixunsDetails.status === 0) { - // - // } else if (shixunsDetails.status === 1) { - // - // } else if (shixunsDetails.status === 2) { - // challengeBtnTipText = '开始学习并完成实战任务' - // - // } - if(shixunsDetails!=undefined){ - if (shixunsDetails.status === 0 ) { - challengeBtnText = '继续实战' - } else if (shixunsDetails.status === 1) { - challengeBtnText = '查看实战' - } else if (shixunsDetails.status === 3) { - challengeBtnText = '继续实战' - }else{ - challengeBtnText = "开始实战" - } - } - - - // let list=shixunsDetails.task_operation; - // if(list!=undefined){ - // if (shixunsDetails.status === 0 ) { - // for(var i=0; i{ - $("#ratePanel").show(); - this.setState({ - showradios:true - }) - },()=>{ - $("#ratePanel").hide(); - this.setState({ - showradios:false - }) - }) - - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - }; - - - return ( - - shixunsDetails===undefined?"": -
-
- -
-

- {shixunsDetails.name} - { - shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : - - - - } - -

-
-
    -
  • - 学习人数 - {shixunsDetails.stu_num} -
  • - {/*
  • */} - {/*经验值*/} - {/*{shixunsDetails.experience}*/} - {/*
  • */} -
  • - 难度系数 - {shixunsDetails.diffcult} - -
  • -
- -
- -
- -
-
-
- -
-
-
- {star_infos[0]}分 - 总评分 -
- {showradios === true ? - - : ""} -
-
-
-
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[1]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[2]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[3]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[4]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[5]}% -
-
-
-
-
- -
- - { - startbtn === false ? - - - {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} - - - : "" - } - - -
-

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 -

-
-
- {/*取消*/} - 知道啦 -
- {/*

*/} - {/*知道了*/} - {/*

*/} -
- - -
-

实训已经更新了,正在为您重置!

-
- -
- - - - - - { - startbtn === true ? - 开启中 : "" - } - - {/*{*/} - {/*shixunsDetails.status=== 3 && shixunsDetails.task_operation[0]==="开始实战"?*/} - {/*{shixunsDetails.task_operation===undefined?"":shixunsDetails.task_operation[0]}:""*/} - {/*}*/} - - {shixunsDetails.status === 0 && this.props.identity < 4 ? - 申请发布 : "" - } - - - { - publishboxstatus === 0 ?
-

- 发布申请已提交,请等待管理员的审核
-

-
: publishboxstatus === 1 ? -
-

- 发布申请已提交,请等待管理员的审核
- • 我们将在1-2个工作日内完成审核 -

-
: publishboxstatus === 2 ?
-

- 第 - { - evaluation_set_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关评测设置尚未完成,无法申请发布 -

-
: publishboxstatus === 3 ? -
-

- 每一个关卡至少需要一个技能标签
- 第 - { - tag_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关尚未设置技能标签,请补充 -

-
: -
-

- 尚未创建任务的实训,不能申请发布 -

-
- } - - -
- - {shixunsDetails.status === 1 && this.props.identity < 4 ? - 撤销发布 : "" - } - - { - - - 发送至 - - - } - - -
-
- -
- 选择的实训将会发送到指定课堂 -
- -
- this.SenttotheSearch(value)} - style={{width: '100%'}} - /> -
- -
12?"cdefault mb20":"cdefault mb50"}> -
-
    - - { - course_list === undefined ? "" : course_list.map((item, key) => { - return ( - {item.name} - ) - }) - } - -
-
-
- -
- 12 ? "block" : "none"}} - showQuickJumper defaultCurrent={1} current={pages} pageSize={12} - total={courses_count} onChange={this.onChangesendeSenttothe}/> - - 确定 - - 取消 -
- -
-
-
- - {shixunsDetails.status === 3 && - 已关闭 - } - -
- - - Fork - - - - - {Forkvisibletype===true? - - : -
-

复制将在后台执行
平台将为你创建一个新的同名实训和内容,请问是否继续?

-
-
- 取消 - 确定 -
-
- } - - -
- - -

{can_fork}
请问是否前往进行认证?

-
-
- - -
-
- {!!shixunsDetails.fork_num && - - {shixunsDetails.fork_num} - - } - -
- -
- -
- -
-
正在等待管理员的审核。在审核通过前,可以随时撤销发布
-
- - ); - } -} - -export default TPMBanner; - +import React, { Component } from 'react'; + +import { Redirect } from 'react-router'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +import PropTypes from 'prop-types'; + +import {Modal,Input,Radio,Pagination,message,Spin,Icon,Tooltip} from 'antd'; + +import 'antd/lib/pagination/style/index.css'; + +import axios from 'axios'; + +// import { Rating,Progress } from '@icedesign/base'; + +import Rating from '@icedesign/base/lib/rating'; + +import Progress from '@icedesign/base/lib/progress'; + +// 引入业务组件样式 +import '@icedesign/base/lib/rating/style.js'; + +import '@icedesign/base/lib/progress/style.js'; + +import './shixuns/css/TPMBanner.css'; + +let $ = window.$; + +const Search = Input.Search; + +const RadioGroup = Radio.Group; + +class TPMBanner extends Component { + constructor(props) { + super(props) + this.state={ + Forkvisible: false, + Senttothetype:false, + Senttothevcalue:1, + courses_count:1, + course_list:[], + pagenum:1, + publishbox:"", + publishboxstatus:0, + pages:1, + Issuevisible:false, + evaluation_set_position:[], + tag_position:[], + Forkauthentication:false, + can_fork:undefined, + certi_url:undefined, + showradios:false, + startbtn:false, + Searchvalue:"", + startshixunCombattype:false, + shixunsmessage:"", + shixunsreplace:false, + hidestartshixunsreplacevalue:"", + isIE:false, + Forkvisibletype: false, + isSpin:false, + } + } + + // star_info:[0, 0, 0, 0, 0, 0], + // star_infos:[0, 0, 0, 0, 0, 0], + // shixunsDetails:{}, + // shixunId: undefined, + // componentWillReceiveProps(newProps, newContext){ + // this.setState({ + // shixunsDetails: newProps.shixunsDetails + // }); + // } + + IEVersion=()=>{ + var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 + var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 + var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 + var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; + if(isIE) { + var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); + reIE.test(userAgent); + var fIEVersion = parseFloat(RegExp["$1"]); + if(fIEVersion == 7) { + return 7; + } else if(fIEVersion == 8) { + return 8; + } else if(fIEVersion == 9) { + return 9; + } else if(fIEVersion == 10) { + return 10; + } else { + return 6;//IE版本<=7 + } + } else if(isEdge) { + return 'edge';//edge + } else if(isIE11) { + return 11; //IE11 + }else{ + return -1;//不是ie浏览器 + } + } + componentDidMount() { + let thiisie=this.IEVersion(); + if(thiisie!=-1){ + this.setState({ + isIE:true + }) + }else{ + this.setState({ + isIE:false + }) + } + } + /* + * Fork + * */ + copyForkvisible = () => { + let {shixunsDetails} = this.props; + if (shixunsDetails.can_fork === null) { + this.setState({ + Forkvisible: true + }) + } else { + this.setState({ + Forkvisible: false, + Forkauthentication: true, + can_fork: shixunsDetails.can_fork.can_fork, + certi_url: shixunsDetails.can_fork.certi_url, + }) + } + + } + + hideForkvisible = () => { + this.setState({ + Forkvisible: false, + Forkauthentication:false + }) + } + + addForkvisible = () => { + this.setState({ + Forkvisibletype: true, + }) + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/copy.json"; + axios.post(url).then((response) => { + if(response.data.status===401){ + + }else{ + this.setState({ + Forkvisible: false, + Forkauthentication: false, + // Forkvisibletype:false + }) + window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; + } + + }).catch((error) => { + console.log(error) + }); + + } + /* + * 发送至按钮 + * */ + Senttothe=()=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/search_user_courses.json"; + this.setState({ + Senttothetype:true + }) + + axios.get(url, { + params: { + page:1, + limit:10 + }}).then((response) => { + this.setState({ + courses_count:response.data.courses_count, + course_list:response.data.course_list + }) + }).catch((error) => { + console.log(error) + }); + } + + SenttotheSearch=(value)=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/search_user_courses.json?search="+value; + axios.get(url, { + params: { + page:1, + limit:10 + }}).then((response) => { + this.setState({ + courses_count:response.data.courses_count, + course_list:response.data.course_list, + pages:1, + Searchvalue:value + }) + }).catch((error) => { + console.log(error) + }); + } + + onChangeSenttothevcalue=(e)=>{ + this.setState({ + Senttothevcalue:e.target.value + }) + } + onChangesendeSenttothe=(pageNumber)=>{ + let{Searchvalue}=this.state; + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue; + axios.get(url, { + params: { + page:pageNumber, + limit:10 + }}).then((response) => { + this.setState({ + courses_count:response.data.courses_count, + course_list:response.data.course_list, + pagenum: pageNumber, + pages: pageNumber + }) + }).catch((error) => { + console.log(error) + }); + } + sendeSenttothevcalue=()=>{ + let {Senttothevcalue}=this.state; + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/send_to_course.json"; + axios.post(url,{ + course_id:Senttothevcalue + }).then((response) => { + this.props.showSnackbar(response.data.message); + this.setState({ + Senttothetype:false, + Searchvalue:"", + pages:1 + }) + window.location.href = response.data.url; + + }).catch((error) => { + console.log(error) + }); + + } + + hideSenttothevcalue=()=>{ + this.setState({ + Senttothetype:false, + Searchvalue:"", + pages:1 + }) + + + } + + /* + * 撤销发布按钮 + * */ + cancel_publish=()=>{ + + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/cancel_publish.json"; + axios.get(url).then((response) => { + this.props.showSnackbar(response.data.message); + window.location.reload() + }).catch((error) => { + console.log(error) + }); + } + + + /* + * 申请发布按钮 + * */ + applyrelease=()=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/publish.json"; + axios.get(url).then((response) => { + let evaluation_set_position + if(response.data.evaluation_set_position===null){ + evaluation_set_position=[] + }else{ + evaluation_set_position=response.data.evaluation_set_position + } + this.setState({ + Issuevisible:true, + tag_position:response.data.tag_position, + evaluation_set_position:evaluation_set_position, + publishboxstatus:response.data.status, + }) + }).catch((error) => { + console.log(error) + }); + }; + + hiddenIssuevisible=(val)=>{ + this.setState({ + Issuevisible:false + }) + if(val===0||val===1){ + window.location.reload() + } + + } + + //重置按钮 + // resetshixunCombat=(id)=>{ + // let zrl="/myshixuns/"+id+"/reset_my_game.json"; + // axios.get(zrl).then((response) => { + // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; + // message.success('重置成功'); + // }).catch((error) => { + // console.log(error) + // }); + // } + + hidestartshixunsreplace=(url)=>{ + this.setState({ + isSpin:true, + }) + axios.get(url).then((response) => { + if(response.status===200){ + let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + this.props.history.push(path); + this.setState({ + shixunsreplace:false, + isSpin:false, + }) + message.success('重置成功,正在进入实训!'); + this.startshixunCombat(); + }} + ).catch((error) => { + this.setState({ + startbtn:false, + shixunsreplace:false + }) + }); + + } + //开始实战按钮 + startshixunCombat=()=>{ + let {shixunsDetails} = this.props + if( shixunsDetails.status>1){ + this.setState({ + startbtn:true, + hidestartshixunsreplacevalue:"" + }) + }else{ + this.setState({ + hidestartshixunsreplacevalue:"" + }) + } + + + let id = this.props.match.params.shixunId; + let url="/shixuns/"+id+"/shixun_exec.json"; + axios.get(url).then((response) => { + if(response.status===200){ + if(response.data.status===-2){ + // this.resetshixunCombat(response.data.message); + this.setState({ + startbtn:false, + shixunsreplace:true, + hidestartshixunsreplacevalue:response.data.message+".json" + }) + }else if(response.data.status===-1){ + console.log(response) + }else if(response.data.status===-3){ + this.setState({ + shixunsmessage:response.data.message, + startshixunCombattype:true, + startbtn:false + }) + }else{ + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); + + + // this.context.router.history.push(path); + if(response.data.status!=401){ + window.location.href = "/tasks/"+response.data.game_identifier; + } + + } + } + }).catch((error) => { + this.setState({ + startbtn:false + }) + }); + } + + tocertification=()=>{ + let{certi_url}=this.state; + this.setState({ + Forkauthentication:false + }) + window.location.href=certi_url; + } + + SenttotheValue=(e)=>{ + this.setState({ + Searchvalue:e.target.value + }) + } + + hidestartshixunCombattype=()=>{ + this.setState({ + startshixunCombattype:false + }) + } + + + + render() { + let { + Forkvisible, + Senttothetype, + Senttothevcalue, + evaluation_set_position, + Forkauthentication, + can_fork, + certi_url, + tag_position, + courses_count, + course_list, + Issuevisible, + publishboxstatus, + showradios, + startbtn, + Searchvalue, + startshixunCombattype, + shixunsmessage, + pages, + shixunsreplace, + hidestartshixunsreplacevalue, + Forkvisibletype, + isIE} = this.state; + let {shixunsDetails, shixunId, star_info, star_infos} = this.props; + let challengeBtnTipText = ''; + let challengeBtnText = '模拟实战'; + // let star_info=[] + // if (shixunsDetails.status === 0) { + // + // } else if (shixunsDetails.status === 1) { + // + // } else if (shixunsDetails.status === 2) { + // challengeBtnTipText = '开始学习并完成实战任务' + // + // } + if(shixunsDetails!=undefined){ + if (shixunsDetails.status === 0 ) { + challengeBtnText = '继续实战' + } else if (shixunsDetails.status === 1) { + challengeBtnText = '查看实战' + } else if (shixunsDetails.status === 3) { + challengeBtnText = '继续实战' + }else{ + challengeBtnText = "开始实战" + } + } + + + // let list=shixunsDetails.task_operation; + // if(list!=undefined){ + // if (shixunsDetails.status === 0 ) { + // for(var i=0; i{ + $("#ratePanel").show(); + this.setState({ + showradios:true + }) + },()=>{ + $("#ratePanel").hide(); + this.setState({ + showradios:false + }) + }) + + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + }; + + + return ( + + shixunsDetails===undefined?"": +
+
+ +
+

+ {shixunsDetails.name} + { + shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : + + + + } + +

+
+
    +
  • + 学习人数 + {shixunsDetails.stu_num} +
  • + {/*
  • */} + {/*经验值*/} + {/*{shixunsDetails.experience}*/} + {/*
  • */} +
  • + 难度系数 + {shixunsDetails.diffcult} + +
  • +
+ +
+ +
+ +
+
+
+ +
+
+
+ {star_infos[0]}分 + 总评分 +
+ {showradios === true ? + + : ""} +
+
+
+
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[1]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[2]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[3]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[4]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[5]}% +
+
+
+
+
+ +
+ + { + startbtn === false ? + + + {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} + + + : "" + } + + +
+

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 +

+
+
+ {/*取消*/} + 知道啦 +
+ {/*

*/} + {/*知道了*/} + {/*

*/} +
+ + + + +
+

实训已经更新了,正在为您重置!

+
+ +
+
+ + + + + + { + startbtn === true ? + 开启中 : "" + } + + {/*{*/} + {/*shixunsDetails.status=== 3 && shixunsDetails.task_operation[0]==="开始实战"?*/} + {/*{shixunsDetails.task_operation===undefined?"":shixunsDetails.task_operation[0]}:""*/} + {/*}*/} + + {shixunsDetails.status === 0 && this.props.identity < 4 ? + 申请发布 : "" + } + + + { + publishboxstatus === 0 ?
+

+ 发布申请已提交,请等待管理员的审核
+

+
: publishboxstatus === 1 ? +
+

+ 发布申请已提交,请等待管理员的审核
+ • 我们将在1-2个工作日内完成审核 +

+
: publishboxstatus === 2 ?
+

+ 第 + { + evaluation_set_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关评测设置尚未完成,无法申请发布 +

+
: publishboxstatus === 3 ? +
+

+ 每一个关卡至少需要一个技能标签
+ 第 + { + tag_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关尚未设置技能标签,请补充 +

+
: +
+

+ 尚未创建任务的实训,不能申请发布 +

+
+ } + + +
+ + {shixunsDetails.status === 1 && this.props.identity < 4 ? + 撤销发布 : "" + } + + { + + + 发送至 + + + } + + +
+
+ +
+ 选择的实训将会发送到指定课堂 +
+ +
+ this.SenttotheSearch(value)} + style={{width: '100%'}} + /> +
+ +
12?"cdefault mb20":"cdefault mb50"}> +
+
    + + { + course_list === undefined ? "" : course_list.map((item, key) => { + return ( + {item.name} + ) + }) + } + +
+
+
+ +
+ 12 ? "block" : "none"}} + showQuickJumper defaultCurrent={1} current={pages} pageSize={12} + total={courses_count} onChange={this.onChangesendeSenttothe}/> + + 确定 + + 取消 +
+ +
+
+
+ + {shixunsDetails.status === 3 && + 已关闭 + } + +
+ + + Fork + + + + + {Forkvisibletype===true? + + : +
+

复制将在后台执行
平台将为你创建一个新的同名实训和内容,请问是否继续?

+
+
+ 取消 + 确定 +
+
+ } + + +
+ + +

{can_fork}
请问是否前往进行认证?

+
+
+ + +
+
+ {!!shixunsDetails.fork_num && + + {shixunsDetails.fork_num} + + } + +
+ +
+ +
+ +
+
正在等待管理员的审核。在审核通过前,可以随时撤销发布
+
+ + ); + } +} + +export default TPMBanner; + From 83efdf9abe1e2d61fc4c1f4725c4e6ace82692bc Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 18:57:16 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/coursesPublic/Startshixuntask.js | 3 ++- public/react/src/modules/tpm/TPMBanner.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js index b994e9005..3f256fbcc 100644 --- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js +++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js @@ -78,7 +78,8 @@ class Startshixuntask extends Component{ ).catch((error) => { this.setState({ startbtn:false, - shixunsreplace:false + shixunsreplace:false, + isSpin:false, }) }); diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 1106b7a3f..78feed436 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -340,7 +340,8 @@ class TPMBanner extends Component { ).catch((error) => { this.setState({ startbtn:false, - shixunsreplace:false + shixunsreplace:false, + isSpin:false }) }); From a2f621701441be69a22d57ff7b0411ddac763cf4 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 19:03:31 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMBanner.js | 30 +++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 78feed436..14ddcc579 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -328,8 +328,8 @@ class TPMBanner extends Component { }) axios.get(url).then((response) => { if(response.status===200){ - let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - this.props.history.push(path); + // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + // this.props.history.push(path); this.setState({ shixunsreplace:false, isSpin:false, @@ -346,6 +346,32 @@ class TPMBanner extends Component { }); } + + + shixunexec=(url)=>{ + this.setState({ + isSpin:true, + }) + axios.get(url).then((response) => { + if(response.status===200){ + // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + // this.props.history.push(path); + this.setState({ + shixunsreplace:false, + isSpin:false, + }) + message.success('重置成功,正在进入实训!'); + this.startshixunCombat(); + }} + ).catch((error) => { + this.setState({ + startbtn:false, + shixunsreplace:false, + isSpin:false + }) + }); + + } //开始实战按钮 startshixunCombat=()=>{ let {shixunsDetails} = this.props From c71bb0a58ad818e57e546880711242eecbdc2691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 22 Jun 2019 19:03:55 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/context/TPIContextProvider.js | 1734 ++++++++-------- .../courses/coursesPublic/Startshixuntask.js | 324 +-- .../shixunHomework/ShixunhomeWorkItem.js | 2 +- public/react/src/modules/tpm/TPMBanner.js | 1834 ++++++++--------- .../tpm/shixunchild/Challenges/Challenges.js | 2 +- 5 files changed, 1948 insertions(+), 1948 deletions(-) diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index d5d8715f5..881a596e1 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -1,867 +1,867 @@ -import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; - -import axios from 'axios'; -import Snackbar from 'material-ui/Snackbar'; -import Fade from 'material-ui/transitions/Fade'; - -import update from 'immutability-helper' - -import Dialog, { - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, -} from 'material-ui/Dialog'; - -import Button from 'material-ui/Button'; - -import EvaluateSuccessEffectDisplay from './EvaluateSuccessEffectDisplay' - -import _ from 'lodash' - -/* - 若干js库 - http://inorganik.github.io/countUp.js/ - -*/ -/* - 切下一关需要更新: - LeftViewContainer state.gameAnswer -*/ - -import TPIContext from './TPIContext' -import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER - , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from 'educoder' -import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles'; -import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil' - -const styles = MUIDialogStyleUtil.getTwoButtonStyle() - -// 主题自定义 -const theme = createMuiTheme({ - palette: { - primary: { - main: '#4CACFF', - contrastText: 'rgba(255, 255, 255, 0.87)' - }, - secondary: { main: '#4CACFF' }, // This is just green.A700 as hex. - }, -}); - -const testSetsExpandedArrayInitVal = [false, false, false, false, false, - false, false, false, false, false, - false, false, false, false, false, - false, false, false, false, false] -window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider? -class TPIContextProvider extends Component { - constructor(props) { - super(props) - this.onRunCodeTestFinish = this.onRunCodeTestFinish.bind(this) - this.onRunChooseTestFinish = this.onRunChooseTestFinish.bind(this) - this.testSetUnlock = this.testSetUnlock.bind(this) - - this.onTestSetHeaderClick = this.onTestSetHeaderClick.bind(this) - - this.onShowPrevStage = this.onShowPrevStage.bind(this) - this.onShowNextStage = this.onShowNextStage.bind(this) - - this.readGameAnswer = this.readGameAnswer.bind(this) - this.praisePlus = this.praisePlus.bind(this) - - this.onGamePassed = this.onGamePassed.bind(this) - - this.onPathChange = this.onPathChange.bind(this) - - this.showSnackbar = this.showSnackbar.bind(this) - this.showDialog = this.showDialog.bind(this) - - this.onShowUpdateDialog = this.onShowUpdateDialog.bind(this) - this.updateDialogClose = this.updateDialogClose.bind(this) - - // this.showEffectDisplay(); - - this.state = { - loading: true, // 正在加载数据 - gDialogOpen: false, - currentGamePassed: false, // 当前game评测通过 - currentPassedGameGainGold: 0, // 当前通过的game获得的金币数 - currentPassedGameGainExperience: 0, // 当前通过的game获得的经验数 - - user: {}, - challenge: {}, - shixun_name: '', - hide_code: false, - - showUpdateDialog: false, - - testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), - } - } - - showEffectDisplay = (data) => { - const dom = document.getElementById('picture_display'); - window.$(dom).show(); - ReactDOM.render(, dom); - } - - onShowUpdateDialog() { - this.setState({showUpdateDialog: true}) - } - // updateNowSuccess true 立即更新成功 - // TODO updateDialogClose方法名不对, 改为updateDialogCallback - updateDialogClose(nextUpdateSuccess, updateNowSuccess) { - const { myshixun } = this.state; - if (nextUpdateSuccess) { - myshixun.system_tip = true; - } - let { tpm_cases_modified, tpm_modified, tpm_script_modified } = this.state; - if (updateNowSuccess) { - tpm_cases_modified = false; - tpm_modified = false; - tpm_script_modified = false; - } - this.setState({ - myshixun, - tpm_cases_modified, - tpm_modified, - tpm_script_modified, - showUpdateDialog: false - }) - } - - componentWillUnmount() { - this.costTimeInterval && window.clearInterval(this.costTimeInterval) - } - componentDidMount() { - - // TODO 登录状态的判断? - // request - // var shixunId = this.props.match.params.shixunId; - var stageId = this.props.match.params.stageId; - - window.__fetchAllFlag = false; - this.fetchAll(stageId); - - this.costTimeInterval = window.setInterval(()=> { - const { game } = this.state; - if (!game || game.status === 2) { // 已完成的任务不需要计时 - return; - } - if (game.cost_time || game.cost_time === 0) { - // game.cost_time += 1; - this.setState({ - game: update(game, {cost_time: { $set: (game.cost_time+1) }}) - }) - } - }, 1000) - - // 页面离开时存下用户的任务耗时 - - window.$(window).unload( ()=>{ - this._updateCostTime(); - }); - } - // force 评测通过后,异步执行该方法,强制同步costTime到服务端 - _updateCostTime(async = false, force) { - const { game, loading } = this.state; - // TODO 还有一种情况,通关后cost_time计时停止,没法通过这个判断 - if (!force && (loading || !game || game.status === 2)) { - return; // 已完成的任务不需要处理 - } - let testPath = '' - if (window.location.port == 3007) { - testPath = 'https://testeduplus2.educoder.net' - } - // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` - var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` - window.$.ajax({ - type: 'get', - url: url, - async: async, //IMPORTANT, the call will be synchronous - data: { - time: game.cost_time - } - }).done((data) => { - console.log('complete'); - }); - } - - onGamePassed(passed) { - const { game } = this.state - // 随便给个分,以免重新评测时又出现评星组件(注意:目前game.star没有显示在界面上,如果有则不能这么做) - // game.star = 6; - this.setState({ - game: update(game, {star: { $set: 6 }}), - currentGamePassed: !!passed - }) - } - onTestSetHeaderClick(index) { - // let { testSetsExpandedArray } = this.state; - let testSetsExpandedArray; - // 一次只打开一个 - if (this.state.testSetsExpandedArray[index] === false) { - testSetsExpandedArray = testSetsExpandedArrayInitVal.slice(0); - } else { - testSetsExpandedArray = this.state.testSetsExpandedArray.slice(0); - } - testSetsExpandedArray[index] = !testSetsExpandedArray[index]; - this.setState({ - testSetsExpandedArray, - }) - } - - onShowPrevStage() { - - } - onShowNextStage() { - window.__fetchAllFlag = false; - console.log('onShowNextStage.........') - // this.fetchAll('vznhx7mctwfq') - } - - componentWillReceiveProps(newProps, oldProps) { - var newStageId = newProps.match.params.stageId; - if (!this.props || newStageId !== this.props.match.params.stageId) { - window.__fetchAllFlag = false; - this.fetchAll(newStageId) - } - } - - - // praise_tread/praise_plus?obj_id=569&obj_type=Challenge&horizontal=true&game_praise=true - /* - TODO 旧的接口在未登录时的返回值 - //获取登录页面地址 -var signinPath = '/'; -var htmlvalue = '

提示

'+ - '

您还没有登录,请登录后再执行此操作,谢谢!

'; -pop_box_new(htmlvalue, 480, 182); - */ - praisePlus() { - const { challenge, game } = this.state; - let praise = true; - const url = `/tasks/${game.identifier}/plus_or_cancel_praise.json` - // const url = `/praise_tread/praise_plus?obj_id=${challenge.id}&obj_type=Challenge&horizontal=${praise}&game_praise=true` - axios.post(url) - .then((response) => { - - if (response.data) { - const { praise_count, praise } = response.data; - // challenge.praise_count = praise_tread_count; - // challenge.user_praise = praise; - this.setState({ challenge: update(challenge, - { - praise_count: { $set: praise_count }, - user_praise: { $set: praise }, - }) - }) - } - - }) - .catch(function (error) { - console.log(error); - }); - } - - onPathChange(index) { - let { challenge } = this.state; - // challenge = Object.assign({}, challenge) - // challenge.pathIndex = index; - this.setState({ - challenge: update(challenge, {pathIndex: { $set: index }}), - }) - // TODO load new path content - } - - updateChallengePath = (path) => { - const challenge = this.state.challenge; - if (challenge.path === path) { - return; - } - const { myshixun } = this.state; - // myshixun.system_tip = false; - - - challenge.path = path; - const newChallenge = this.handleChallengePath(challenge); - this.setState({ challenge: newChallenge, - myshixun: update(myshixun, {system_tip: { $set: false }}), - }) - } - - handleChallengePath(challenge) { - if (challenge.path && typeof challenge.path === "string") { // 多path的处理 - let path = challenge.path.split(';'); - _.remove(path, (item)=> !item) - if (path.length > 1) { - challenge.path = path; - challenge.multiPath = true; - } else { - challenge.path = challenge.path.replace(';', '').trim() // 多path 改为单path 出现了 aaa.java;的情况 - challenge.multiPath = false; - } - } - challenge.pathIndex = 0; - return challenge; - } - - newResData2OldResData(newResData) { - newResData.latest_output = newResData.last_compile_output - // newResData.power - newResData.record = newResData.record_onsume_time - - // 老版用的hide_code - newResData.hide_code = newResData.shixun.hide_code; - - newResData.image_url = newResData.user.image_url - newResData.grade = newResData.user.grade - newResData.user_url = newResData.user.user_url - newResData.username = newResData.user.name - - newResData.output_sets = {} - // newResData.output_sets.had_test_count = newResData.test_sets_count - newResData.output_sets.test_sets = newResData.test_sets // JSON.stringify() - newResData.output_sets.test_sets_count = newResData.test_sets_count - // newResData.output_sets.had_passed_testsests_error_count = newResData.sets_error_count - newResData.output_sets.had_passed_testsests_error_count = newResData.test_sets_count - - newResData.sets_error_count - // allowed_hidden_testset - // sets_error_count - // test_sets_count - // test_sets - // had_passed_testsests_error_count - // test_sets - // test_sets - - return newResData - } - // 将若干数据重新组织一下 - _handleResponseData(resData_arg) { - const resData = this.newResData2OldResData(Object.assign({}, resData_arg)) - let challenge = resData.challenge; - challenge.isHtml = false; - challenge.isWeb = false; - challenge.isAndroid = false; - challenge.showLanguagePictrue = false; - challenge.hasAnswer = resData.has_answer; - - let output_sets = resData.output_sets; - if (resData.st === 0) { // 代码题 - challenge = this.handleChallengePath(challenge) - - const mirror_name = (resData.mirror_name && resData.mirror_name.join) - ? resData.mirror_name.join(';') : (resData.mirror_name || ''); - if (mirror_name.indexOf('Html') !== -1) { - challenge.isHtml = true; - challenge.showLanguagePictrue = true; - } else if (mirror_name.indexOf('Web') !== -1 || mirror_name.indexOf('JFinal') !== -1) { - challenge.isWeb = true; - } else if (mirror_name.indexOf('Android') !== -1) { - challenge.isAndroid = true; - } - - if (output_sets && output_sets.test_sets && typeof output_sets.test_sets == 'string') { - const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]"); - output_sets.test_sets_array = test_sets_array; - } else { - output_sets.test_sets_array = output_sets.test_sets - } - - } else { // 选择题 - // 选择题题干markdown初始化 - const $ = window.$ - window.setTimeout(()=>{ - var lens = $("#choiceRepositoryView textarea").length; - - for(var i = 1; i <= lens; i++){ - window.editormd.markdownToHTML("choose_subject_" + i, { - htmlDecode: "style,script,iframe", // you can filter tags decode - taskList: true, - tex: true, // 数学公式 - // flowChart: true, // 默认不解析 - // sequenceDiagram: true // 默认不解析 - }); - } - }, 400) - } - challenge.user_praise = resData.user_praise; - challenge.praise_count = resData.praise_count; - challenge.showWebDisplayButton = false; - resData.challenge = challenge; - - // 将一些属性写到game上 - let game = resData.game; - game.prev_game = resData.prev_game; - game.next_game = resData.next_game; - resData.game = game; - - const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData; - if (myshixun.system_tip) { - // system_tip为true的时候 不弹框提示用户更新 - resData.showUpdateDialog = false - } else { - let needUpdateScript = (tpm_modified || tpm_script_modified) && challenge.st === 0; - resData.showUpdateDialog = needUpdateScript || tpm_cases_modified - } - - /** - email: "721773699@qq.com" - grade: 213996 - identity: 1 - image_url: "avatars/User/1" - login: "innov" - name: "Coder" - user_url: "/users/innov" - */ - let user = resData.user; - user.username = resData.user.name; - user.user_url = `/user/${resData.user.login}`; - // user.image_url = resData.image_url; - user.is_teacher = resData.is_teacher; - resData.user = user; - this._handleUserAuthor(resData) - // TODO 测试 - // resData.power = 0; - - this.setState({ - ...resData, - - currentGamePassed: false, - loading: false, - testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), - }) - - window.document.title = resData.shixun.name - - window.__myshixun = resData.myshixun; // tpi_html_show需要用到 - } - _handleUserAuthor(resData) { - // tpi tpm权限控制 - // const EDU_ADMIN = 1 // 超级管理员 - // const EDU_SHIXUN_MANAGER = 2 // 实训管理员 - // const EDU_SHIXUN_MEMBER = 3 // 实训成员 - // const EDU_CERTIFICATION_TEACHER = 4 // 平台认证的老师 - // const EDU_GAME_MANAGER = 5 // TPI的创建者 - // const EDU_TEACHER = 6 // 平台老师,但是未认证 - // const EDU_NORMAL = 7 // 普通用户 - - // myshixun_manager power is_teacher - resData.power = 0 - resData.myshixun_manager = false - resData.is_teacher = false - - if (resData.user.identity === EDU_ADMIN) { - resData.power = 1 - resData.myshixun_manager = true - } else if (resData.user.identity === EDU_SHIXUN_MANAGER) { - resData.power = 1 - resData.myshixun_manager = true - } else if (resData.user.identity === EDU_SHIXUN_MEMBER) { - resData.power = 1 - resData.myshixun_manager = true - } else if (resData.user.identity === EDU_CERTIFICATION_TEACHER) { - resData.power = 1 - resData.is_teacher = true - - } else if (resData.user.identity === EDU_TEACHER) { - resData.is_teacher = true - } else if (resData.user.identity === EDU_NORMAL) { - - } - return resData - } - - fetchAll(stageId) { - - if (window.__fetchAllFlag == true ) { - console.log('TPIContextProvider call fetchAll repeatly!') - return; - } - // 切换关卡的时候,同步costTime - this._updateCostTime(true); - - if (!stageId) { - // stageId = 'zl6kx8f7vfpo'; - // http://localhost:3000/myshixuns/so5w6iap97/stages/zl6kx8f7vfpo - } - - // var url = `/api/v1/games/${stageId}` - var url = `/tasks/${stageId}.json` - - // {"status":1,"message":"undefined method `authenticate!' for #"} - window.__fetchAllFlag = true; - - - this.setState({ - loading: true, - currentGamePassed: false, // 切换game时重置passed字段 - }) - - axios.get(url, { - // https://stackoverflow.com/questions/48861290/the-value-of-the-access-control-allow-origin-header-in-the-response-must-not-b - // withCredentials: true, - }) - .then((response) => { - // {"status":1,"message":"Unauthorized. \u7528\u6237\u8ba4\u8bc1\u5931\u8d25."} - - if (response.data.status == 403) { - window.location.href = "/403"; - return; - } - if (response.data.status == 404) { - window.location.href = '/myshixuns/not_found' - return; - } - - this._handleResponseData(response.data) - - }) - .catch(function (error) { - console.log(error); - }); - - } - - readGameAnswer(resData) { - // game.final_score = resData.final_score; - if (resData.final_score) { - var game = this.state.game; - this.setState({ - game: update(game, {final_score: { $set: resData.final_score }}), - grade: resData.grade - }) - } else { - this.setState({ - grade: resData.grade - }) - } - - } - closeTaskResultLayer() { - this.setState({ - currentGamePassed: false - }) - } - onRunChooseTestFinish(response) { - const { test_sets, challenge_chooses_count, choose_correct_num, grade, experience, gold, had_submmit, next_game } = response; - response.had_submmit = true; // 是否已提交 - const { game } = this.state; - let currentGamePassed = false - if (challenge_chooses_count === choose_correct_num) { - game.status = 2; - game.next_game = next_game; - - currentGamePassed = true; - - - this._updateCostTime(true, true); - } - this.setState({ - choose_test_cases: response, - grade: grade, - - game, - next_game, - currentGamePassed: currentGamePassed, - currentPassedGameGainGold: gold, - currentPassedGameGainExperience: experience, - }) - } - language_display(data) { - const { game, tomcat_url } = this.state; - const $ = window.$; - const challenge = Object.assign({}, this.state.challenge) - if(challenge.isWeb && data.port != -1) { - // var $result = $("#php_display"); - challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮 - const path = challenge.web_route || challenge.path - const webDisplayUrl = `${tomcat_url}:${data.port}/${path}` - challenge.webDisplayUrl = webDisplayUrl - challenge.showLanguagePictrue = true; // 评测通过弹出层是否出现查看效果按钮 - } - // else if(challenge.isAndroid && data.picture != 0){ - // // https://www.educoder.net/shixuns/qrcode?game_id=218589&_=1525571882782 - // $.ajax({ - // url: `/shixuns/qrcode?game_id=${game.id}`, - // dataType: 'script' - // }); - // challenge.showLanguagePictrue = true; - // } - else if(data.picture != 0){ - // 对应服务端erb文件为 _picture_display.html.erb - // $.ajax({ - // url: "/users/picture_show?game_id="+data.picture, - // cache: false, - // dataType: 'script' - // }); - - /** - { - "type": "image", - "orignal_picture": [], - "user_picture": [], - "answer_picture": [] - } - */ - const url = `/tasks/${game.identifier}/picture_display.json` - axios.get(url) - .then((response) => { - // response.data.type qrcode_str - this.showEffectDisplay(response.data) - }) - - challenge.showLanguagePictrue = true; - } - this.setState({ - challenge - }) - } - onRunCodeTestFinish(response) { - console.log('onRunCodeTestFinish', response) - const { test_sets, test_sets_count, test_sets_hidden_count, test_sets_public_count - , had_test_count, had_passed_testsests_error_count, had_passed_testsests_hidden_count - , had_passed_testsests_public_count, final_score, gold, experience, latest_output, status - , had_done, score, tag_count, power, record, next_game, grade, picture, - sets_error_count, last_compile_output, record_consume_time} = response; - - const { game } = this.state; - - const currentGamePassed = this.props.game !== 2 && status === 2 - - currentGamePassed && this.language_display(response); - - // 评测通过了,立即同步costTime - currentGamePassed && this._updateCostTime(true, true); - - if (currentGamePassed) { - game.status = 2; - game.next_game = next_game; - - } else { - this.showDialog({ - contentText:
-
评测未通过
-
详情请参见“测试结果”
-
, - isSingleButton: true - }) - } - - const output_sets = { - "test_sets": test_sets, - "test_sets_array": test_sets, - "had_test_count": had_test_count || test_sets_count, - "test_sets_count": test_sets_count, - // "had_passed_testsests_error_count": had_passed_testsests_error_count, - "had_passed_testsests_error_count": test_sets_count - sets_error_count, - "test_sets_hidden_count": test_sets_hidden_count, - "test_sets_public_count": test_sets_public_count, - "had_passed_testsests_hidden_count": had_passed_testsests_hidden_count, - "had_passed_testsests_public_count": had_passed_testsests_public_count - }; - // if (output_sets && output_sets.test_sets) { - // const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]"); - // output_sets.test_sets_array = test_sets_array; - // } - - - this.setState({ - testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态 - currentGamePassed, - currentPassedGameGainGold: gold, - currentPassedGameGainExperience: experience, - - output_sets, - game, - next_game, - - latest_output: last_compile_output, - record: record_consume_time, - grade, - had_done, - - }) - } - resetTestSetsExpandedArray = () => { - this.setState({ - testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态 - }) - } - - testSetUnlock() { - const { game } = this.state; - const url = `/v1/games/${game.identifier}/check_test_sets.json` - axios.get(url, { - withCredentials: true, - }) - .then((response) => { - // TODO status -2 重复操作,直接解锁 - if (response.data.test_sets == -1) { - console.error('testSetUnlock失败!') - this.showSnackbar(response.data.message) - return; - } else { - // 被扣除的金币,是负数 - const deltaScore = response.data.score; - // output_sets - let { output_sets } = this.state; - output_sets = Object.assign({}, output_sets); - const test_sets_array = JSON.parse("[" + response.data.test_sets + "]"); - output_sets.test_sets_array = test_sets_array; - this.setState({ - output_sets: output_sets, - grade: this.state.grade + deltaScore, - game : update(game, {test_sets_view: { $set: true }}), - testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0) - }) - this.handleGdialogClose(); - } - - }) - .catch(function (error) { - console.log(error); - }); - } - - handleSnackbarClose() { - this.setState({ - snackbarOpen: false, - snackbarVertical: '', - snackbarHorizontal: '', - }) - } - // 全局的snackbar this.props.showSnackbar调用即可 - showSnackbar(text, vertical, horizontal) { - this.setState({ - snackbarOpen: true, - snackbarText: text, - snackbarVertical: vertical, - snackbarHorizontal: horizontal, - }) - } - - /* - TODO 写成HOC组件,更好复用 - 全局的Dialog this.props.showDialog调用即可 - @param contentText dialog显示的提示文本 - @param callback 确定按钮回调方法 - @param moreButtonsRender 除了“确定”、“取消”按钮外的其他按钮 - @param okButtonText “确定”按钮显示文本,如 继续查看 - */ - showDialog(params) { - const { contentText, callback, moreButtonsRender, okButtonText, isSingleButton } = params; - - this.dialogOkCallback = callback; - this.moreButtonsRender = moreButtonsRender - this.okButtonText = okButtonText; - this.isSingleButton = isSingleButton; - this.setState({ - gDialogOpen: true, - gDialogContentText: contentText - }) - } - onGdialogOkBtnClick() { - - this.dialogOkCallback && this.dialogOkCallback(); - // this.setState({ - // gDialogOpen: true - // }) - } - handleGdialogClose = () => { - this.setState({ - gDialogOpen: false - }) - } - render() { - const { classes } = this.props; - return ( - this.closeTaskResultLayer(), - - onPathChange: this.onPathChange, - updateChallengePath: this.updateChallengePath, - - showSnackbar: this.showSnackbar, - showDialog: this.showDialog, - handleGdialogClose: () => this.handleGdialogClose(), - - onShowUpdateDialog: this.onShowUpdateDialog, - updateDialogClose: this.updateDialogClose, - - match: this.props.match - }} - > - this.handleGdialogClose()} - > - {"提示"} - - - {this.state.gDialogContentText} - - - - { this.isSingleButton ?
- 知道啦 -
: - - - - } - {this.moreButtonsRender && this.moreButtonsRender()} -
-
- - this.handleSnackbarClose()} - transition={Fade} - SnackbarContentProps={{ - 'aria-describedby': 'message-id', - }} - resumeHideDuration={2000} - message={{this.state.snackbarText}} - /> - {this.props.children} -
- ) - } -} - -export default withStyles(styles) (TPIContextProvider); - - - +import React, { Component } from 'react'; +import ReactDOM from 'react-dom'; + +import axios from 'axios'; +import Snackbar from 'material-ui/Snackbar'; +import Fade from 'material-ui/transitions/Fade'; + +import update from 'immutability-helper' + +import Dialog, { + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, +} from 'material-ui/Dialog'; + +import Button from 'material-ui/Button'; + +import EvaluateSuccessEffectDisplay from './EvaluateSuccessEffectDisplay' + +import _ from 'lodash' + +/* + 若干js库 + http://inorganik.github.io/countUp.js/ + +*/ +/* + 切下一关需要更新: + LeftViewContainer state.gameAnswer +*/ + +import TPIContext from './TPIContext' +import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER + , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from 'educoder' +import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles'; +import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil' + +const styles = MUIDialogStyleUtil.getTwoButtonStyle() + +// 主题自定义 +const theme = createMuiTheme({ + palette: { + primary: { + main: '#4CACFF', + contrastText: 'rgba(255, 255, 255, 0.87)' + }, + secondary: { main: '#4CACFF' }, // This is just green.A700 as hex. + }, +}); + +const testSetsExpandedArrayInitVal = [false, false, false, false, false, + false, false, false, false, false, + false, false, false, false, false, + false, false, false, false, false] +window.__fetchAllFlag = false; // 是否调用过fetchAll TODO 如何多次使用provider? +class TPIContextProvider extends Component { + constructor(props) { + super(props) + this.onRunCodeTestFinish = this.onRunCodeTestFinish.bind(this) + this.onRunChooseTestFinish = this.onRunChooseTestFinish.bind(this) + this.testSetUnlock = this.testSetUnlock.bind(this) + + this.onTestSetHeaderClick = this.onTestSetHeaderClick.bind(this) + + this.onShowPrevStage = this.onShowPrevStage.bind(this) + this.onShowNextStage = this.onShowNextStage.bind(this) + + this.readGameAnswer = this.readGameAnswer.bind(this) + this.praisePlus = this.praisePlus.bind(this) + + this.onGamePassed = this.onGamePassed.bind(this) + + this.onPathChange = this.onPathChange.bind(this) + + this.showSnackbar = this.showSnackbar.bind(this) + this.showDialog = this.showDialog.bind(this) + + this.onShowUpdateDialog = this.onShowUpdateDialog.bind(this) + this.updateDialogClose = this.updateDialogClose.bind(this) + + // this.showEffectDisplay(); + + this.state = { + loading: true, // 正在加载数据 + gDialogOpen: false, + currentGamePassed: false, // 当前game评测通过 + currentPassedGameGainGold: 0, // 当前通过的game获得的金币数 + currentPassedGameGainExperience: 0, // 当前通过的game获得的经验数 + + user: {}, + challenge: {}, + shixun_name: '', + hide_code: false, + + showUpdateDialog: false, + + testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), + } + } + + showEffectDisplay = (data) => { + const dom = document.getElementById('picture_display'); + window.$(dom).show(); + ReactDOM.render(, dom); + } + + onShowUpdateDialog() { + this.setState({showUpdateDialog: true}) + } + // updateNowSuccess true 立即更新成功 + // TODO updateDialogClose方法名不对, 改为updateDialogCallback + updateDialogClose(nextUpdateSuccess, updateNowSuccess) { + const { myshixun } = this.state; + if (nextUpdateSuccess) { + myshixun.system_tip = true; + } + let { tpm_cases_modified, tpm_modified, tpm_script_modified } = this.state; + if (updateNowSuccess) { + tpm_cases_modified = false; + tpm_modified = false; + tpm_script_modified = false; + } + this.setState({ + myshixun, + tpm_cases_modified, + tpm_modified, + tpm_script_modified, + showUpdateDialog: false + }) + } + + componentWillUnmount() { + this.costTimeInterval && window.clearInterval(this.costTimeInterval) + } + componentDidMount() { + + // TODO 登录状态的判断? + // request + // var shixunId = this.props.match.params.shixunId; + var stageId = this.props.match.params.stageId; + + window.__fetchAllFlag = false; + this.fetchAll(stageId); + + this.costTimeInterval = window.setInterval(()=> { + const { game } = this.state; + if (!game || game.status === 2) { // 已完成的任务不需要计时 + return; + } + if (game.cost_time || game.cost_time === 0) { + // game.cost_time += 1; + this.setState({ + game: update(game, {cost_time: { $set: (game.cost_time+1) }}) + }) + } + }, 1000) + + // 页面离开时存下用户的任务耗时 + + window.$(window).unload( ()=>{ + this._updateCostTime(); + }); + } + // force 评测通过后,异步执行该方法,强制同步costTime到服务端 + _updateCostTime(async = false, force) { + const { game, loading } = this.state; + // TODO 还有一种情况,通关后cost_time计时停止,没法通过这个判断 + if (!force && (loading || !game || game.status === 2)) { + return; // 已完成的任务不需要处理 + } + let testPath = '' + if (window.location.port == 3007) { + testPath = 'https://testeduplus2.educoder.net' + } + // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` + var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` + window.$.ajax({ + type: 'get', + url: url, + async: async, //IMPORTANT, the call will be synchronous + data: { + time: game.cost_time + } + }).done((data) => { + console.log('complete'); + }); + } + + onGamePassed(passed) { + const { game } = this.state + // 随便给个分,以免重新评测时又出现评星组件(注意:目前game.star没有显示在界面上,如果有则不能这么做) + // game.star = 6; + this.setState({ + game: update(game, {star: { $set: 6 }}), + currentGamePassed: !!passed + }) + } + onTestSetHeaderClick(index) { + // let { testSetsExpandedArray } = this.state; + let testSetsExpandedArray; + // 一次只打开一个 + if (this.state.testSetsExpandedArray[index] === false) { + testSetsExpandedArray = testSetsExpandedArrayInitVal.slice(0); + } else { + testSetsExpandedArray = this.state.testSetsExpandedArray.slice(0); + } + testSetsExpandedArray[index] = !testSetsExpandedArray[index]; + this.setState({ + testSetsExpandedArray, + }) + } + + onShowPrevStage() { + + } + onShowNextStage() { + window.__fetchAllFlag = false; + console.log('onShowNextStage.........') + // this.fetchAll('vznhx7mctwfq') + } + + componentWillReceiveProps(newProps, oldProps) { + var newStageId = newProps.match.params.stageId; + if (!this.props || newStageId !== this.props.match.params.stageId) { + window.__fetchAllFlag = false; + this.fetchAll(newStageId) + } + } + + + // praise_tread/praise_plus?obj_id=569&obj_type=Challenge&horizontal=true&game_praise=true + /* + TODO 旧的接口在未登录时的返回值 + //获取登录页面地址 +var signinPath = '/'; +var htmlvalue = '

提示

'+ + '

您还没有登录,请登录后再执行此操作,谢谢!

'; +pop_box_new(htmlvalue, 480, 182); + */ + praisePlus() { + const { challenge, game } = this.state; + let praise = true; + const url = `/tasks/${game.identifier}/plus_or_cancel_praise.json` + // const url = `/praise_tread/praise_plus?obj_id=${challenge.id}&obj_type=Challenge&horizontal=${praise}&game_praise=true` + axios.post(url) + .then((response) => { + + if (response.data) { + const { praise_count, praise } = response.data; + // challenge.praise_count = praise_tread_count; + // challenge.user_praise = praise; + this.setState({ challenge: update(challenge, + { + praise_count: { $set: praise_count }, + user_praise: { $set: praise }, + }) + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } + + onPathChange(index) { + let { challenge } = this.state; + // challenge = Object.assign({}, challenge) + // challenge.pathIndex = index; + this.setState({ + challenge: update(challenge, {pathIndex: { $set: index }}), + }) + // TODO load new path content + } + + updateChallengePath = (path) => { + const challenge = this.state.challenge; + if (challenge.path === path) { + return; + } + const { myshixun } = this.state; + // myshixun.system_tip = false; + + + challenge.path = path; + const newChallenge = this.handleChallengePath(challenge); + this.setState({ challenge: newChallenge, + myshixun: update(myshixun, {system_tip: { $set: false }}), + }) + } + + handleChallengePath(challenge) { + if (challenge.path && typeof challenge.path === "string") { // 多path的处理 + let path = challenge.path.split(';'); + _.remove(path, (item)=> !item) + if (path.length > 1) { + challenge.path = path; + challenge.multiPath = true; + } else { + challenge.path = challenge.path.replace(';', '').trim() // 多path 改为单path 出现了 aaa.java;的情况 + challenge.multiPath = false; + } + } + challenge.pathIndex = 0; + return challenge; + } + + newResData2OldResData(newResData) { + newResData.latest_output = newResData.last_compile_output + // newResData.power + newResData.record = newResData.record_onsume_time + + // 老版用的hide_code + newResData.hide_code = newResData.shixun.hide_code; + + newResData.image_url = newResData.user.image_url + newResData.grade = newResData.user.grade + newResData.user_url = newResData.user.user_url + newResData.username = newResData.user.name + + newResData.output_sets = {} + // newResData.output_sets.had_test_count = newResData.test_sets_count + newResData.output_sets.test_sets = newResData.test_sets // JSON.stringify() + newResData.output_sets.test_sets_count = newResData.test_sets_count + // newResData.output_sets.had_passed_testsests_error_count = newResData.sets_error_count + newResData.output_sets.had_passed_testsests_error_count = newResData.test_sets_count + - newResData.sets_error_count + // allowed_hidden_testset + // sets_error_count + // test_sets_count + // test_sets + // had_passed_testsests_error_count + // test_sets + // test_sets + + return newResData + } + // 将若干数据重新组织一下 + _handleResponseData(resData_arg) { + const resData = this.newResData2OldResData(Object.assign({}, resData_arg)) + let challenge = resData.challenge; + challenge.isHtml = false; + challenge.isWeb = false; + challenge.isAndroid = false; + challenge.showLanguagePictrue = false; + challenge.hasAnswer = resData.has_answer; + + let output_sets = resData.output_sets; + if (resData.st === 0) { // 代码题 + challenge = this.handleChallengePath(challenge) + + const mirror_name = (resData.mirror_name && resData.mirror_name.join) + ? resData.mirror_name.join(';') : (resData.mirror_name || ''); + if (mirror_name.indexOf('Html') !== -1) { + challenge.isHtml = true; + challenge.showLanguagePictrue = true; + } else if (mirror_name.indexOf('Web') !== -1 || mirror_name.indexOf('JFinal') !== -1) { + challenge.isWeb = true; + } else if (mirror_name.indexOf('Android') !== -1) { + challenge.isAndroid = true; + } + + if (output_sets && output_sets.test_sets && typeof output_sets.test_sets == 'string') { + const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]"); + output_sets.test_sets_array = test_sets_array; + } else { + output_sets.test_sets_array = output_sets.test_sets + } + + } else { // 选择题 + // 选择题题干markdown初始化 + const $ = window.$ + window.setTimeout(()=>{ + var lens = $("#choiceRepositoryView textarea").length; + + for(var i = 1; i <= lens; i++){ + window.editormd.markdownToHTML("choose_subject_" + i, { + htmlDecode: "style,script,iframe", // you can filter tags decode + taskList: true, + tex: true, // 数学公式 + // flowChart: true, // 默认不解析 + // sequenceDiagram: true // 默认不解析 + }); + } + }, 400) + } + challenge.user_praise = resData.user_praise; + challenge.praise_count = resData.praise_count; + challenge.showWebDisplayButton = false; + resData.challenge = challenge; + + // 将一些属性写到game上 + let game = resData.game; + game.prev_game = resData.prev_game; + game.next_game = resData.next_game; + resData.game = game; + + const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData; + if (myshixun.system_tip) { + // system_tip为true的时候 不弹框提示用户更新 + resData.showUpdateDialog = false + } else { + let needUpdateScript = (tpm_modified || tpm_script_modified) && challenge.st === 0; + resData.showUpdateDialog = needUpdateScript || tpm_cases_modified + } + + /** + email: "721773699@qq.com" + grade: 213996 + identity: 1 + image_url: "avatars/User/1" + login: "innov" + name: "Coder" + user_url: "/users/innov" + */ + let user = resData.user; + user.username = resData.user.name; + user.user_url = `/user/${resData.user.login}`; + // user.image_url = resData.image_url; + user.is_teacher = resData.is_teacher; + resData.user = user; + this._handleUserAuthor(resData) + // TODO 测试 + // resData.power = 0; + + this.setState({ + ...resData, + + currentGamePassed: false, + loading: false, + testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), + }) + + window.document.title = resData.shixun.name + + window.__myshixun = resData.myshixun; // tpi_html_show需要用到 + } + _handleUserAuthor(resData) { + // tpi tpm权限控制 + // const EDU_ADMIN = 1 // 超级管理员 + // const EDU_SHIXUN_MANAGER = 2 // 实训管理员 + // const EDU_SHIXUN_MEMBER = 3 // 实训成员 + // const EDU_CERTIFICATION_TEACHER = 4 // 平台认证的老师 + // const EDU_GAME_MANAGER = 5 // TPI的创建者 + // const EDU_TEACHER = 6 // 平台老师,但是未认证 + // const EDU_NORMAL = 7 // 普通用户 + + // myshixun_manager power is_teacher + resData.power = 0 + resData.myshixun_manager = false + resData.is_teacher = false + + if (resData.user.identity === EDU_ADMIN) { + resData.power = 1 + resData.myshixun_manager = true + } else if (resData.user.identity === EDU_SHIXUN_MANAGER) { + resData.power = 1 + resData.myshixun_manager = true + } else if (resData.user.identity === EDU_SHIXUN_MEMBER) { + resData.power = 1 + resData.myshixun_manager = true + } else if (resData.user.identity === EDU_CERTIFICATION_TEACHER) { + resData.power = 1 + resData.is_teacher = true + + } else if (resData.user.identity === EDU_TEACHER) { + resData.is_teacher = true + } else if (resData.user.identity === EDU_NORMAL) { + + } + return resData + } + + fetchAll(stageId) { + + if (window.__fetchAllFlag == true ) { + console.log('TPIContextProvider call fetchAll repeatly!') + return; + } + // 切换关卡的时候,同步costTime + this._updateCostTime(true); + + if (!stageId) { + // stageId = 'zl6kx8f7vfpo'; + // http://localhost:3000/myshixuns/so5w6iap97/stages/zl6kx8f7vfpo + } + + // var url = `/api/v1/games/${stageId}` + var url = `/tasks/${stageId}.json` + + // {"status":1,"message":"undefined method `authenticate!' for #"} + window.__fetchAllFlag = true; + + + this.setState({ + loading: true, + currentGamePassed: false, // 切换game时重置passed字段 + }) + + axios.get(url, { + // https://stackoverflow.com/questions/48861290/the-value-of-the-access-control-allow-origin-header-in-the-response-must-not-b + // withCredentials: true, + }) + .then((response) => { + // {"status":1,"message":"Unauthorized. \u7528\u6237\u8ba4\u8bc1\u5931\u8d25."} + + if (response.data.status == 403) { + window.location.href = "/403"; + return; + } + if (response.data.status == 404) { + window.location.href = '/myshixuns/not_found' + return; + } + + this._handleResponseData(response.data) + + }) + .catch(function (error) { + console.log(error); + }); + + } + + readGameAnswer(resData) { + // game.final_score = resData.final_score; + if (resData.final_score) { + var game = this.state.game; + this.setState({ + game: update(game, {final_score: { $set: resData.final_score }}), + grade: resData.grade + }) + } else { + this.setState({ + grade: resData.grade + }) + } + + } + closeTaskResultLayer() { + this.setState({ + currentGamePassed: false + }) + } + onRunChooseTestFinish(response) { + const { test_sets, challenge_chooses_count, choose_correct_num, grade, experience, gold, had_submmit, next_game } = response; + response.had_submmit = true; // 是否已提交 + const { game } = this.state; + let currentGamePassed = false + if (challenge_chooses_count === choose_correct_num) { + game.status = 2; + game.next_game = next_game; + + currentGamePassed = true; + + + this._updateCostTime(true, true); + } + this.setState({ + choose_test_cases: response, + grade: grade, + + game, + next_game, + currentGamePassed: currentGamePassed, + currentPassedGameGainGold: gold, + currentPassedGameGainExperience: experience, + }) + } + language_display(data) { + const { game, tomcat_url } = this.state; + const $ = window.$; + const challenge = Object.assign({}, this.state.challenge) + if(challenge.isWeb && data.port != -1) { + // var $result = $("#php_display"); + challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮 + const path = challenge.web_route || challenge.path + const webDisplayUrl = `${tomcat_url}:${data.port}/${path}` + challenge.webDisplayUrl = webDisplayUrl + challenge.showLanguagePictrue = true; // 评测通过弹出层是否出现查看效果按钮 + } + // else if(challenge.isAndroid && data.picture != 0){ + // // https://www.educoder.net/shixuns/qrcode?game_id=218589&_=1525571882782 + // $.ajax({ + // url: `/shixuns/qrcode?game_id=${game.id}`, + // dataType: 'script' + // }); + // challenge.showLanguagePictrue = true; + // } + else if(data.picture != 0){ + // 对应服务端erb文件为 _picture_display.html.erb + // $.ajax({ + // url: "/users/picture_show?game_id="+data.picture, + // cache: false, + // dataType: 'script' + // }); + + /** + { + "type": "image", + "orignal_picture": [], + "user_picture": [], + "answer_picture": [] + } + */ + const url = `/tasks/${game.identifier}/picture_display.json` + axios.get(url) + .then((response) => { + // response.data.type qrcode_str + this.showEffectDisplay(response.data) + }) + + challenge.showLanguagePictrue = true; + } + this.setState({ + challenge + }) + } + onRunCodeTestFinish(response) { + console.log('onRunCodeTestFinish', response) + const { test_sets, test_sets_count, test_sets_hidden_count, test_sets_public_count + , had_test_count, had_passed_testsests_error_count, had_passed_testsests_hidden_count + , had_passed_testsests_public_count, final_score, gold, experience, latest_output, status + , had_done, score, tag_count, power, record, next_game, grade, picture, + sets_error_count, last_compile_output, record_consume_time} = response; + + const { game } = this.state; + + const currentGamePassed = this.props.game !== 2 && status === 2 + + currentGamePassed && this.language_display(response); + + // 评测通过了,立即同步costTime + currentGamePassed && this._updateCostTime(true, true); + + if (currentGamePassed) { + game.status = 2; + game.next_game = next_game; + + } else { + this.showDialog({ + contentText:
+
评测未通过
+
详情请参见“测试结果”
+
, + isSingleButton: true + }) + } + + const output_sets = { + "test_sets": test_sets, + "test_sets_array": test_sets, + "had_test_count": had_test_count || test_sets_count, + "test_sets_count": test_sets_count, + // "had_passed_testsests_error_count": had_passed_testsests_error_count, + "had_passed_testsests_error_count": test_sets_count - sets_error_count, + "test_sets_hidden_count": test_sets_hidden_count, + "test_sets_public_count": test_sets_public_count, + "had_passed_testsests_hidden_count": had_passed_testsests_hidden_count, + "had_passed_testsests_public_count": had_passed_testsests_public_count + }; + // if (output_sets && output_sets.test_sets) { + // const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]"); + // output_sets.test_sets_array = test_sets_array; + // } + + + this.setState({ + testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态 + currentGamePassed, + currentPassedGameGainGold: gold, + currentPassedGameGainExperience: experience, + + output_sets, + game, + next_game, + + latest_output: last_compile_output, + record: record_consume_time, + grade, + had_done, + + }) + } + resetTestSetsExpandedArray = () => { + this.setState({ + testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态 + }) + } + + testSetUnlock() { + const { game } = this.state; + const url = `/v1/games/${game.identifier}/check_test_sets.json` + axios.get(url, { + withCredentials: true, + }) + .then((response) => { + // TODO status -2 重复操作,直接解锁 + if (response.data.test_sets == -1) { + console.error('testSetUnlock失败!') + this.showSnackbar(response.data.message) + return; + } else { + // 被扣除的金币,是负数 + const deltaScore = response.data.score; + // output_sets + let { output_sets } = this.state; + output_sets = Object.assign({}, output_sets); + const test_sets_array = JSON.parse("[" + response.data.test_sets + "]"); + output_sets.test_sets_array = test_sets_array; + this.setState({ + output_sets: output_sets, + grade: this.state.grade + deltaScore, + game : update(game, {test_sets_view: { $set: true }}), + testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0) + }) + this.handleGdialogClose(); + } + + }) + .catch(function (error) { + console.log(error); + }); + } + + handleSnackbarClose() { + this.setState({ + snackbarOpen: false, + snackbarVertical: '', + snackbarHorizontal: '', + }) + } + // 全局的snackbar this.props.showSnackbar调用即可 + showSnackbar(text, vertical, horizontal) { + this.setState({ + snackbarOpen: true, + snackbarText: text, + snackbarVertical: vertical, + snackbarHorizontal: horizontal, + }) + } + + /* + TODO 写成HOC组件,更好复用 + 全局的Dialog this.props.showDialog调用即可 + @param contentText dialog显示的提示文本 + @param callback 确定按钮回调方法 + @param moreButtonsRender 除了“确定”、“取消”按钮外的其他按钮 + @param okButtonText “确定”按钮显示文本,如 继续查看 + */ + showDialog(params) { + const { contentText, callback, moreButtonsRender, okButtonText, isSingleButton } = params; + + this.dialogOkCallback = callback; + this.moreButtonsRender = moreButtonsRender + this.okButtonText = okButtonText; + this.isSingleButton = isSingleButton; + this.setState({ + gDialogOpen: true, + gDialogContentText: contentText + }) + } + onGdialogOkBtnClick() { + + this.dialogOkCallback && this.dialogOkCallback(); + // this.setState({ + // gDialogOpen: true + // }) + } + handleGdialogClose = () => { + this.setState({ + gDialogOpen: false + }) + } + render() { + const { classes } = this.props; + return ( + this.closeTaskResultLayer(), + + onPathChange: this.onPathChange, + updateChallengePath: this.updateChallengePath, + + showSnackbar: this.showSnackbar, + showDialog: this.showDialog, + handleGdialogClose: () => this.handleGdialogClose(), + + onShowUpdateDialog: this.onShowUpdateDialog, + updateDialogClose: this.updateDialogClose, + + match: this.props.match + }} + > + this.handleGdialogClose()} + > + {"提示"} + + + {this.state.gDialogContentText} + + + + { this.isSingleButton ?
+ 知道啦 +
: + + + + } + {this.moreButtonsRender && this.moreButtonsRender()} +
+
+ + this.handleSnackbarClose()} + transition={Fade} + SnackbarContentProps={{ + 'aria-describedby': 'message-id', + }} + resumeHideDuration={2000} + message={{this.state.snackbarText}} + /> + {this.props.children} +
+ ) + } +} + +export default withStyles(styles) (TPIContextProvider); + + + diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js index 064ec645a..9a9a98f8f 100644 --- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js +++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js @@ -1,163 +1,163 @@ -import React,{ Component } from "react"; -import { WordsBtn } from 'educoder'; -import {Tooltip,message,Modal} from 'antd'; -import {Link} from 'react-router-dom'; -import axios from 'axios'; -import Modals from '../../modals/Modals'; - - - -class Startshixuntask extends Component{ - constructor(props){ - super(props); - this.state = { - startbtn:false - } - - } - - componentDidMount() { - - } - - taskoperationId=(list)=>{ - this.setState({ - startbtn:true, - }) - let url= list+".json"; - axios.get(url).then((response) => { - - if(response.status===200){ - if(response.data.status===-2){ - - this.setState({ - startbtn:false, - shixunsreplace:true, - hidestartshixunsreplacevalue:response.data.message+".json" - }) - }else if(response.data.status===-1){ - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessage:response.data.message, - startshixunCombattype:true, - startbtn:false - }) - }else{ - - if(response.data.status!=401&&response.data.status!=403){ - window.location.href = "/tasks/"+response.data.game_identifier; - } - - } - } - }).catch((error) => { - this.setState({ - startbtn:false - }) - }); - - } - - hidestartshixunsreplace=(url)=>{ - axios.get(url).then((response) => { - if(response.status===200){ - - this.setState({ - shixunsreplace:false - }) - message.success('重置成功,正在进入实训!'); - let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - this.props.history.push(path); - - }} - ).catch((error) => { - this.setState({ - startbtn:false, - shixunsreplace:false - }) - }); - - } - - hidestartshixunCombattype=()=>{ - this.setState({ - startshixunCombattype:false - }) - } - - render(){ - let { - Modalstype, - Modalstopval, - Modalsbottomval, - cardsModalcancel, - cardsModalsavetype, - loadtype, - shixunsreplace, - hidestartshixunsreplacevalue, - startshixunCombattype, - shixunsmessage, - startbtn - } = this.state; - - return( - - - - - -
-

实训已经更新了,正在为您重置!

-
-
-
- -
-

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 -

-
-
- {/*取消*/} - 知道啦 -
- {/*

*/} - {/*知道了*/} - {/*

*/} -
- - {this.props.isStudent? - - {this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?this.taskoperationId( this.props.data.task_operation[1])}> - {this.props.data.task_operation[0]} - :"开启中":""} - :"" - } - - - ) - } -} +import React,{ Component } from "react"; +import { WordsBtn } from 'educoder'; +import {Tooltip,message,Modal} from 'antd'; +import {Link} from 'react-router-dom'; +import axios from 'axios'; +import Modals from '../../modals/Modals'; + + + +class Startshixuntask extends Component{ + constructor(props){ + super(props); + this.state = { + startbtn:false + } + + } + + componentDidMount() { + + } + + taskoperationId=(list)=>{ + this.setState({ + startbtn:true, + }) + let url= list+".json"; + axios.get(url).then((response) => { + + if(response.status===200){ + if(response.data.status===-2){ + + this.setState({ + startbtn:false, + shixunsreplace:true, + hidestartshixunsreplacevalue:response.data.message+".json" + }) + }else if(response.data.status===-1){ + console.log(response) + }else if(response.data.status===-3){ + this.setState({ + shixunsmessage:response.data.message, + startshixunCombattype:true, + startbtn:false + }) + }else{ + + if(response.data.status!=401&&response.data.status!=403){ + window.location.href = "/tasks/"+response.data.game_identifier; + } + + } + } + }).catch((error) => { + this.setState({ + startbtn:false + }) + }); + + } + + hidestartshixunsreplace=(url)=>{ + axios.get(url).then((response) => { + if(response.status===200){ + + this.setState({ + shixunsreplace:false + }) + message.success('重置成功,正在进入实训!'); + let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + this.props.history.push(path); + + }} + ).catch((error) => { + this.setState({ + startbtn:false, + shixunsreplace:false + }) + }); + + } + + hidestartshixunCombattype=()=>{ + this.setState({ + startshixunCombattype:false + }) + } + + render(){ + let { + Modalstype, + Modalstopval, + Modalsbottomval, + cardsModalcancel, + cardsModalsavetype, + loadtype, + shixunsreplace, + hidestartshixunsreplacevalue, + startshixunCombattype, + shixunsmessage, + startbtn + } = this.state; + + return( + + + + + +
+

实训已经更新了,正在为您重置!

+
+
+ + +
+

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 +

+
+
+ {/*取消*/} + 知道啦 +
+ {/*

*/} + {/*知道了*/} + {/*

*/} +
+ + {this.props.isStudent? + + {this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?this.taskoperationId( this.props.data.task_operation[1])}> + {this.props.data.task_operation[0]} + :"开启中":""} + :"" + } + + + ) + } +} export default Startshixuntask; \ No newline at end of file diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js index 8ad70753f..272ac6418 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js @@ -210,7 +210,7 @@ class ShixunhomeWorkItem extends Component{
this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了! + onClick={() => this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了
{ - var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 - var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 - var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 - var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; - if(isIE) { - var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); - reIE.test(userAgent); - var fIEVersion = parseFloat(RegExp["$1"]); - if(fIEVersion == 7) { - return 7; - } else if(fIEVersion == 8) { - return 8; - } else if(fIEVersion == 9) { - return 9; - } else if(fIEVersion == 10) { - return 10; - } else { - return 6;//IE版本<=7 - } - } else if(isEdge) { - return 'edge';//edge - } else if(isIE11) { - return 11; //IE11 - }else{ - return -1;//不是ie浏览器 - } - } - componentDidMount() { - let thiisie=this.IEVersion(); - if(thiisie!=-1){ - this.setState({ - isIE:true - }) - }else{ - this.setState({ - isIE:false - }) - } - } - /* - * Fork - * */ - copyForkvisible = () => { - let {shixunsDetails} = this.props; - if (shixunsDetails.can_fork === null) { - this.setState({ - Forkvisible: true - }) - } else { - this.setState({ - Forkvisible: false, - Forkauthentication: true, - can_fork: shixunsDetails.can_fork.can_fork, - certi_url: shixunsDetails.can_fork.certi_url, - }) - } - - } - - hideForkvisible = () => { - this.setState({ - Forkvisible: false, - Forkauthentication:false - }) - } - - addForkvisible = () => { - this.setState({ - Forkvisibletype: true, - }) - let id = this.props.match.params.shixunId; - let url = "/shixuns/" + id + "/copy.json"; - axios.post(url).then((response) => { - if(response.data.status===401){ - - }else{ - this.setState({ - Forkvisible: false, - Forkauthentication: false, - // Forkvisibletype:false - }) - window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; - } - - }).catch((error) => { - console.log(error) - }); - - } - /* - * 发送至按钮 - * */ - Senttothe=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json"; - this.setState({ - Senttothetype:true - }) - - axios.get(url, { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list - }) - }).catch((error) => { - console.log(error) - }); - } - - SenttotheSearch=(value)=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+value; - axios.get(url, { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pages:1, - Searchvalue:value - }) - }).catch((error) => { - console.log(error) - }); - } - - onChangeSenttothevcalue=(e)=>{ - this.setState({ - Senttothevcalue:e.target.value - }) - } - onChangesendeSenttothe=(pageNumber)=>{ - let{Searchvalue}=this.state; - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue; - axios.get(url, { - params: { - page:pageNumber, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pagenum: pageNumber, - pages: pageNumber - }) - }).catch((error) => { - console.log(error) - }); - } - sendeSenttothevcalue=()=>{ - let {Senttothevcalue}=this.state; - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/send_to_course.json"; - axios.post(url,{ - course_id:Senttothevcalue - }).then((response) => { - this.props.showSnackbar(response.data.message); - this.setState({ - Senttothetype:false, - Searchvalue:"", - pages:1 - }) - window.location.href = response.data.url; - - }).catch((error) => { - console.log(error) - }); - - } - - hideSenttothevcalue=()=>{ - this.setState({ - Senttothetype:false, - Searchvalue:"", - pages:1 - }) - - - } - - /* - * 撤销发布按钮 - * */ - cancel_publish=()=>{ - - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/cancel_publish.json"; - axios.get(url).then((response) => { - this.props.showSnackbar(response.data.message); - window.location.reload() - }).catch((error) => { - console.log(error) - }); - } - - - /* - * 申请发布按钮 - * */ - applyrelease=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/publish.json"; - axios.get(url).then((response) => { - let evaluation_set_position - if(response.data.evaluation_set_position===null){ - evaluation_set_position=[] - }else{ - evaluation_set_position=response.data.evaluation_set_position - } - this.setState({ - Issuevisible:true, - tag_position:response.data.tag_position, - evaluation_set_position:evaluation_set_position, - publishboxstatus:response.data.status, - }) - }).catch((error) => { - console.log(error) - }); - }; - - hiddenIssuevisible=(val)=>{ - this.setState({ - Issuevisible:false - }) - if(val===0||val===1){ - window.location.reload() - } - - } - - //重置按钮 - // resetshixunCombat=(id)=>{ - // let zrl="/myshixuns/"+id+"/reset_my_game.json"; - // axios.get(zrl).then((response) => { - // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; - // message.success('重置成功'); - // }).catch((error) => { - // console.log(error) - // }); - // } - - hidestartshixunsreplace=(url)=>{ - axios.get(url).then((response) => { - if(response.status===200){ - let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - this.props.history.push(path); - this.setState({ - shixunsreplace:false - }) - message.success('重置成功,正在进入实训!'); - this.startshixunCombat(); - }} - ).catch((error) => { - this.setState({ - startbtn:false, - shixunsreplace:false - }) - }); - - } - //开始实战按钮 - startshixunCombat=()=>{ - let {shixunsDetails} = this.props - if( shixunsDetails.status>1){ - this.setState({ - startbtn:true, - hidestartshixunsreplacevalue:"" - }) - }else{ - this.setState({ - hidestartshixunsreplacevalue:"" - }) - } - - - let id = this.props.match.params.shixunId; - let url="/shixuns/"+id+"/shixun_exec.json"; - axios.get(url).then((response) => { - if(response.status===200){ - if(response.data.status===-2){ - // this.resetshixunCombat(response.data.message); - this.setState({ - startbtn:false, - shixunsreplace:true, - hidestartshixunsreplacevalue:response.data.message+".json" - }) - }else if(response.data.status===-1){ - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessage:response.data.message, - startshixunCombattype:true, - startbtn:false - }) - }else{ - // let path="/tasks/"+response.data.game_identifier; - // this.props.history.push(path); - - - // this.context.router.history.push(path); - if(response.data.status!=401){ - window.location.href = "/tasks/"+response.data.game_identifier; - } - - } - } - }).catch((error) => { - this.setState({ - startbtn:false - }) - }); - } - - tocertification=()=>{ - let{certi_url}=this.state; - this.setState({ - Forkauthentication:false - }) - window.location.href=certi_url; - } - - SenttotheValue=(e)=>{ - this.setState({ - Searchvalue:e.target.value - }) - } - - hidestartshixunCombattype=()=>{ - this.setState({ - startshixunCombattype:false - }) - } - - - - render() { - let { - Forkvisible, - Senttothetype, - Senttothevcalue, - evaluation_set_position, - Forkauthentication, - can_fork, - certi_url, - tag_position, - courses_count, - course_list, - Issuevisible, - publishboxstatus, - showradios, - startbtn, - Searchvalue, - startshixunCombattype, - shixunsmessage, - pages, - shixunsreplace, - hidestartshixunsreplacevalue, - Forkvisibletype, - isIE} = this.state; - let {shixunsDetails, shixunId, star_info, star_infos} = this.props; - let challengeBtnTipText = ''; - let challengeBtnText = '模拟实战'; - // let star_info=[] - // if (shixunsDetails.status === 0) { - // - // } else if (shixunsDetails.status === 1) { - // - // } else if (shixunsDetails.status === 2) { - // challengeBtnTipText = '开始学习并完成实战任务' - // - // } - if(shixunsDetails!=undefined){ - if (shixunsDetails.status === 0 ) { - challengeBtnText = '继续实战' - } else if (shixunsDetails.status === 1) { - challengeBtnText = '查看实战' - } else if (shixunsDetails.status === 3) { - challengeBtnText = '继续实战' - }else{ - challengeBtnText = "开始实战" - } - } - - - // let list=shixunsDetails.task_operation; - // if(list!=undefined){ - // if (shixunsDetails.status === 0 ) { - // for(var i=0; i{ - $("#ratePanel").show(); - this.setState({ - showradios:true - }) - },()=>{ - $("#ratePanel").hide(); - this.setState({ - showradios:false - }) - }) - - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - }; - - - return ( - - shixunsDetails===undefined?"": -
-
- -
-

- {shixunsDetails.name} - { - shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : - - - - } - -

-
-
    -
  • - 学习人数 - {shixunsDetails.stu_num} -
  • - {/*
  • */} - {/*经验值*/} - {/*{shixunsDetails.experience}*/} - {/*
  • */} -
  • - 难度系数 - {shixunsDetails.diffcult} - -
  • -
- -
- -
- -
-
-
- -
-
-
- {star_infos[0]}分 - 总评分 -
- {showradios === true ? - - : ""} -
-
-
-
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[1]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[2]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[3]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[4]}% -
-
-
- {showradios === true ? - - : ""} -
- - {star_infos[5]}% -
-
-
-
-
- -
- - { - startbtn === false ? - - - {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} - - - : "" - } - - -
-

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 -

-
-
- {/*取消*/} - 知道啦 -
- {/*

*/} - {/*知道了*/} - {/*

*/} -
- - -
-

实训已经更新了,正在为您重置!

-
- -
- - - - - - { - startbtn === true ? - 开启中 : "" - } - - {/*{*/} - {/*shixunsDetails.status=== 3 && shixunsDetails.task_operation[0]==="开始实战"?*/} - {/*{shixunsDetails.task_operation===undefined?"":shixunsDetails.task_operation[0]}:""*/} - {/*}*/} - - {shixunsDetails.status === 0 && this.props.identity < 4 ? - 申请发布 : "" - } - - - { - publishboxstatus === 0 ?
-

- 发布申请已提交,请等待管理员的审核
-

-
: publishboxstatus === 1 ? -
-

- 发布申请已提交,请等待管理员的审核
- • 我们将在1-2个工作日内完成审核 -

-
: publishboxstatus === 2 ?
-

- 第 - { - evaluation_set_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关评测设置尚未完成,无法申请发布 -

-
: publishboxstatus === 3 ? -
-

- 每一个关卡至少需要一个技能标签
- 第 - { - tag_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关尚未设置技能标签,请补充 -

-
: -
-

- 尚未创建任务的实训,不能申请发布 -

-
- } - - -
- - {shixunsDetails.status === 1 && this.props.identity < 4 ? - 撤销发布 : "" - } - - { - - - 发送至 - - - } - - -
-
- -
- 选择的实训将会发送到指定课堂 -
- -
- this.SenttotheSearch(value)} - style={{width: '100%'}} - /> -
- -
12?"cdefault mb20":"cdefault mb50"}> -
-
    - - { - course_list === undefined ? "" : course_list.map((item, key) => { - return ( - {item.name} - ) - }) - } - -
-
-
- -
- 12 ? "block" : "none"}} - showQuickJumper defaultCurrent={1} current={pages} pageSize={12} - total={courses_count} onChange={this.onChangesendeSenttothe}/> - - 确定 - - 取消 -
- -
-
-
- - {shixunsDetails.status === 3 && - 已关闭 - } - -
- - - Fork - - - - - {Forkvisibletype===true? - - : -
-

复制将在后台执行
平台将为你创建一个新的同名实训和内容,请问是否继续?

-
-
- 取消 - 确定 -
-
- } - - -
- - -

{can_fork}
请问是否前往进行认证?

-
-
- - -
-
- {!!shixunsDetails.fork_num && - - {shixunsDetails.fork_num} - - } - -
- -
- -
- -
-
正在等待管理员的审核。在审核通过前,可以随时撤销发布
-
- - ); - } -} - -export default TPMBanner; - +import React, { Component } from 'react'; + +import { Redirect } from 'react-router'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +import PropTypes from 'prop-types'; + +import {Modal,Input,Radio,Pagination,message,Spin,Icon,Tooltip} from 'antd'; + +import 'antd/lib/pagination/style/index.css'; + +import axios from 'axios'; + +// import { Rating,Progress } from '@icedesign/base'; + +import Rating from '@icedesign/base/lib/rating'; + +import Progress from '@icedesign/base/lib/progress'; + +// 引入业务组件样式 +import '@icedesign/base/lib/rating/style.js'; + +import '@icedesign/base/lib/progress/style.js'; + +import './shixuns/css/TPMBanner.css'; + +let $ = window.$; + +const Search = Input.Search; + +const RadioGroup = Radio.Group; + +class TPMBanner extends Component { + constructor(props) { + super(props) + this.state={ + Forkvisible: false, + Senttothetype:false, + Senttothevcalue:1, + courses_count:1, + course_list:[], + pagenum:1, + publishbox:"", + publishboxstatus:0, + pages:1, + Issuevisible:false, + evaluation_set_position:[], + tag_position:[], + Forkauthentication:false, + can_fork:undefined, + certi_url:undefined, + showradios:false, + startbtn:false, + Searchvalue:"", + startshixunCombattype:false, + shixunsmessage:"", + shixunsreplace:false, + hidestartshixunsreplacevalue:"", + isIE:false, + Forkvisibletype: false, + } + } + + // star_info:[0, 0, 0, 0, 0, 0], + // star_infos:[0, 0, 0, 0, 0, 0], + // shixunsDetails:{}, + // shixunId: undefined, + // componentWillReceiveProps(newProps, newContext){ + // this.setState({ + // shixunsDetails: newProps.shixunsDetails + // }); + // } + + IEVersion=()=>{ + var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 + var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 + var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 + var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; + if(isIE) { + var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); + reIE.test(userAgent); + var fIEVersion = parseFloat(RegExp["$1"]); + if(fIEVersion == 7) { + return 7; + } else if(fIEVersion == 8) { + return 8; + } else if(fIEVersion == 9) { + return 9; + } else if(fIEVersion == 10) { + return 10; + } else { + return 6;//IE版本<=7 + } + } else if(isEdge) { + return 'edge';//edge + } else if(isIE11) { + return 11; //IE11 + }else{ + return -1;//不是ie浏览器 + } + } + componentDidMount() { + let thiisie=this.IEVersion(); + if(thiisie!=-1){ + this.setState({ + isIE:true + }) + }else{ + this.setState({ + isIE:false + }) + } + } + /* + * Fork + * */ + copyForkvisible = () => { + let {shixunsDetails} = this.props; + if (shixunsDetails.can_fork === null) { + this.setState({ + Forkvisible: true + }) + } else { + this.setState({ + Forkvisible: false, + Forkauthentication: true, + can_fork: shixunsDetails.can_fork.can_fork, + certi_url: shixunsDetails.can_fork.certi_url, + }) + } + + } + + hideForkvisible = () => { + this.setState({ + Forkvisible: false, + Forkauthentication:false + }) + } + + addForkvisible = () => { + this.setState({ + Forkvisibletype: true, + }) + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/copy.json"; + axios.post(url).then((response) => { + if(response.data.status===401){ + + }else{ + this.setState({ + Forkvisible: false, + Forkauthentication: false, + // Forkvisibletype:false + }) + window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; + } + + }).catch((error) => { + console.log(error) + }); + + } + /* + * 发送至按钮 + * */ + Senttothe=()=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/search_user_courses.json"; + this.setState({ + Senttothetype:true + }) + + axios.get(url, { + params: { + page:1, + limit:10 + }}).then((response) => { + this.setState({ + courses_count:response.data.courses_count, + course_list:response.data.course_list + }) + }).catch((error) => { + console.log(error) + }); + } + + SenttotheSearch=(value)=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/search_user_courses.json?search="+value; + axios.get(url, { + params: { + page:1, + limit:10 + }}).then((response) => { + this.setState({ + courses_count:response.data.courses_count, + course_list:response.data.course_list, + pages:1, + Searchvalue:value + }) + }).catch((error) => { + console.log(error) + }); + } + + onChangeSenttothevcalue=(e)=>{ + this.setState({ + Senttothevcalue:e.target.value + }) + } + onChangesendeSenttothe=(pageNumber)=>{ + let{Searchvalue}=this.state; + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue; + axios.get(url, { + params: { + page:pageNumber, + limit:10 + }}).then((response) => { + this.setState({ + courses_count:response.data.courses_count, + course_list:response.data.course_list, + pagenum: pageNumber, + pages: pageNumber + }) + }).catch((error) => { + console.log(error) + }); + } + sendeSenttothevcalue=()=>{ + let {Senttothevcalue}=this.state; + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/send_to_course.json"; + axios.post(url,{ + course_id:Senttothevcalue + }).then((response) => { + this.props.showSnackbar(response.data.message); + this.setState({ + Senttothetype:false, + Searchvalue:"", + pages:1 + }) + window.location.href = response.data.url; + + }).catch((error) => { + console.log(error) + }); + + } + + hideSenttothevcalue=()=>{ + this.setState({ + Senttothetype:false, + Searchvalue:"", + pages:1 + }) + + + } + + /* + * 撤销发布按钮 + * */ + cancel_publish=()=>{ + + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/cancel_publish.json"; + axios.get(url).then((response) => { + this.props.showSnackbar(response.data.message); + window.location.reload() + }).catch((error) => { + console.log(error) + }); + } + + + /* + * 申请发布按钮 + * */ + applyrelease=()=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/" + id +"/publish.json"; + axios.get(url).then((response) => { + let evaluation_set_position + if(response.data.evaluation_set_position===null){ + evaluation_set_position=[] + }else{ + evaluation_set_position=response.data.evaluation_set_position + } + this.setState({ + Issuevisible:true, + tag_position:response.data.tag_position, + evaluation_set_position:evaluation_set_position, + publishboxstatus:response.data.status, + }) + }).catch((error) => { + console.log(error) + }); + }; + + hiddenIssuevisible=(val)=>{ + this.setState({ + Issuevisible:false + }) + if(val===0||val===1){ + window.location.reload() + } + + } + + //重置按钮 + // resetshixunCombat=(id)=>{ + // let zrl="/myshixuns/"+id+"/reset_my_game.json"; + // axios.get(zrl).then((response) => { + // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; + // message.success('重置成功'); + // }).catch((error) => { + // console.log(error) + // }); + // } + + hidestartshixunsreplace=(url)=>{ + axios.get(url).then((response) => { + if(response.status===200){ + // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + // this.props.history.push(path); + this.setState({ + shixunsreplace:false + }) + message.success('重置成功,正在进入实训!'); + this.startshixunCombat(); + }} + ).catch((error) => { + this.setState({ + startbtn:false, + shixunsreplace:false + }) + }); + + } + //开始实战按钮 + startshixunCombat=()=>{ + let {shixunsDetails} = this.props + if( shixunsDetails.status>1){ + this.setState({ + startbtn:true, + hidestartshixunsreplacevalue:"" + }) + }else{ + this.setState({ + hidestartshixunsreplacevalue:"" + }) + } + + + let id = this.props.match.params.shixunId; + let url="/shixuns/"+id+"/shixun_exec.json"; + axios.get(url).then((response) => { + if(response.status===200){ + if(response.data.status===-2){ + // this.resetshixunCombat(response.data.message); + this.setState({ + startbtn:false, + shixunsreplace:true, + hidestartshixunsreplacevalue:response.data.message+".json" + }) + }else if(response.data.status===-1){ + console.log(response) + }else if(response.data.status===-3){ + this.setState({ + shixunsmessage:response.data.message, + startshixunCombattype:true, + startbtn:false + }) + }else{ + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); + + + // this.context.router.history.push(path); + if(response.data.status!=401){ + window.location.href = "/tasks/"+response.data.game_identifier; + } + + } + } + }).catch((error) => { + this.setState({ + startbtn:false + }) + }); + } + + tocertification=()=>{ + let{certi_url}=this.state; + this.setState({ + Forkauthentication:false + }) + window.location.href=certi_url; + } + + SenttotheValue=(e)=>{ + this.setState({ + Searchvalue:e.target.value + }) + } + + hidestartshixunCombattype=()=>{ + this.setState({ + startshixunCombattype:false + }) + } + + + + render() { + let { + Forkvisible, + Senttothetype, + Senttothevcalue, + evaluation_set_position, + Forkauthentication, + can_fork, + certi_url, + tag_position, + courses_count, + course_list, + Issuevisible, + publishboxstatus, + showradios, + startbtn, + Searchvalue, + startshixunCombattype, + shixunsmessage, + pages, + shixunsreplace, + hidestartshixunsreplacevalue, + Forkvisibletype, + isIE} = this.state; + let {shixunsDetails, shixunId, star_info, star_infos} = this.props; + let challengeBtnTipText = ''; + let challengeBtnText = '模拟实战'; + // let star_info=[] + // if (shixunsDetails.status === 0) { + // + // } else if (shixunsDetails.status === 1) { + // + // } else if (shixunsDetails.status === 2) { + // challengeBtnTipText = '开始学习并完成实战任务' + // + // } + if(shixunsDetails!=undefined){ + if (shixunsDetails.status === 0 ) { + challengeBtnText = '继续实战' + } else if (shixunsDetails.status === 1) { + challengeBtnText = '查看实战' + } else if (shixunsDetails.status === 3) { + challengeBtnText = '继续实战' + }else{ + challengeBtnText = "开始实战" + } + } + + + // let list=shixunsDetails.task_operation; + // if(list!=undefined){ + // if (shixunsDetails.status === 0 ) { + // for(var i=0; i{ + $("#ratePanel").show(); + this.setState({ + showradios:true + }) + },()=>{ + $("#ratePanel").hide(); + this.setState({ + showradios:false + }) + }) + + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + }; + + + return ( + + shixunsDetails===undefined?"": +
+
+ +
+

+ {shixunsDetails.name} + { + shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : + + + + } + +

+
+
    +
  • + 学习人数 + {shixunsDetails.stu_num} +
  • + {/*
  • */} + {/*经验值*/} + {/*{shixunsDetails.experience}*/} + {/*
  • */} +
  • + 难度系数 + {shixunsDetails.diffcult} + +
  • +
+ +
+ +
+ +
+
+
+ +
+
+
+ {star_infos[0]}分 + 总评分 +
+ {showradios === true ? + + : ""} +
+
+
+
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[1]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[2]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[3]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[4]}% +
+
+
+ {showradios === true ? + + : ""} +
+ + {star_infos[5]}% +
+
+
+
+
+ +
+ + { + startbtn === false ? + + + {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} + + + : "" + } + + +
+

本实训的开启时间:{shixunsmessage}
开启时间之前不能挑战 +

+
+
+ {/*取消*/} + 知道啦 +
+ {/*

*/} + {/*知道了*/} + {/*

*/} +
+ + +
+

实训已经更新了,正在为您重置!

+
+ +
+ + + + + + { + startbtn === true ? + 开启中 : "" + } + + {/*{*/} + {/*shixunsDetails.status=== 3 && shixunsDetails.task_operation[0]==="开始实战"?*/} + {/*{shixunsDetails.task_operation===undefined?"":shixunsDetails.task_operation[0]}:""*/} + {/*}*/} + + {shixunsDetails.status === 0 && this.props.identity < 4 ? + 申请发布 : "" + } + + + { + publishboxstatus === 0 ?
+

+ 发布申请已提交,请等待管理员的审核
+

+
: publishboxstatus === 1 ? +
+

+ 发布申请已提交,请等待管理员的审核
+ • 我们将在1-2个工作日内完成审核 +

+
: publishboxstatus === 2 ?
+

+ 第 + { + evaluation_set_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关评测设置尚未完成,无法申请发布 +

+
: publishboxstatus === 3 ? +
+

+ 每一个关卡至少需要一个技能标签
+ 第 + { + tag_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关尚未设置技能标签,请补充 +

+
: +
+

+ 尚未创建任务的实训,不能申请发布 +

+
+ } + + +
+ + {shixunsDetails.status === 1 && this.props.identity < 4 ? + 撤销发布 : "" + } + + { + + + 发送至 + + + } + + +
+
+ +
+ 选择的实训将会发送到指定课堂 +
+ +
+ this.SenttotheSearch(value)} + style={{width: '100%'}} + /> +
+ +
12?"cdefault mb20":"cdefault mb50"}> +
+
    + + { + course_list === undefined ? "" : course_list.map((item, key) => { + return ( + {item.name} + ) + }) + } + +
+
+
+ +
+ 12 ? "block" : "none"}} + showQuickJumper defaultCurrent={1} current={pages} pageSize={12} + total={courses_count} onChange={this.onChangesendeSenttothe}/> + + 确定 + + 取消 +
+ +
+
+
+ + {shixunsDetails.status === 3 && + 已关闭 + } + +
+ + + Fork + + + + + {Forkvisibletype===true? + + : +
+

复制将在后台执行
平台将为你创建一个新的同名实训和内容,请问是否继续?

+
+
+ 取消 + 确定 +
+
+ } + + +
+ + +

{can_fork}
请问是否前往进行认证?

+
+
+ + +
+
+ {!!shixunsDetails.fork_num && + + {shixunsDetails.fork_num} + + } + +
+ +
+ +
+ +
+
正在等待管理员的审核。在审核通过前,可以随时撤销发布
+
+ + ); + } +} + +export default TPMBanner; + diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index 38584c793..73dcb0b49 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -529,7 +529,7 @@ class Challenges extends Component {

实训已经更新了,正在为您重置!

From 7e7f2b034b821c058be2e28a27da9fccd2042b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 22 Jun 2019 19:06:59 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMBanner.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 67d0296f5..f6355ec51 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -330,12 +330,16 @@ class TPMBanner extends Component { if(response.status===200){ // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; // this.props.history.push(path); + if(response.data.status===-2){ + this.shixunexec(response.data.message) + } + this.setState({ shixunsreplace:false, isSpin:false, }) - message.success('重置成功,正在进入实训!'); - this.startshixunCombat(); + // message.success('重置成功,正在进入实训!'); + // this.startshixunCombat(); }} ).catch((error) => { this.setState({ From 1a9984fb4b12fc7b3d2d2f4aefafcf1a11213637 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 19:21:47 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/login/EducoderLogin.js | 6 +- .../src/modules/user/FindPasswordComponent.js | 762 +++++++++--------- .../modules/user/LoginRegisterComponent.js | 6 +- 3 files changed, 387 insertions(+), 387 deletions(-) diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index df5b5f8b8..91e8fac3d 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -149,7 +149,7 @@ class EducoderLogin extends Component { "align-items": "center", "width": "100%", }}> -
+
@@ -163,7 +163,7 @@ class EducoderLogin extends Component { "align-items": "center", "width": "100%", }}> -
+
@@ -171,7 +171,7 @@ class EducoderLogin extends Component {
} -
{ - notification.open({ - message: "提示", - description: - messge, - onClick: () => { - console.log('Notification Clicked!'); - }, - }); - }; - StudyMakeMoney = () => { // 调用父组件方法 - this.props.Setshowbool(); - - } - - // 点击表单后,改变type - changeType = () => { - this.setState({classpass: 'password'}); - } - changeTypey = () => { - - } - //倒计时 - getverificationcode = () => { - if (this.state.Phonenumberisnotcobool === false ||this.state.Phonenumberisnotcobool === undefined) { - if (this.state.login&&this.state.login.length === 0) { - this.openNotification("请输入手机号或邮箱"); - return - } else { - this.openNotification("请输入正确的手机号或邮箱"); - } - return; - } - if (this.state.getverificationcodes === true) { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - }) - } - }); - }, 1000) - this.SMSverification(); - } else { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - - }) - } - }); - }, 1000) - this.SMSverification(); - } - } - //短信验证 - SMSverification = () => { - var url = `/accounts/get_verification_code.json`; - axios.get((url), { - params: { - login: this.state.login, - type: 2, - } - }).then((result) => { - //验证有问题{"status":1,"message":"success"} - console.log(result); - - - }).catch((error) => { - console.log(error); - - }) - } - - cancelReadOnly = () => { - this.setState({ - readonlyInput: false, - }) - } - //找回密码 - Retrievepassword = () => { - if (this.state.Phonenumberisnotcobool === false) { - if (this.state.login.length === 0) { - this.openNotification("请输入手机号或邮箱"); - return - } - this.openNotification("请输入正确的手机号或邮箱"); - return; - } - - if (this.state.login === undefined || this.state.login == "") { - this.openNotification(`请输入登录手机号码或邮箱`); - return - } else if (this.state.password === undefined || this.state.password == "") { - this.openNotification(`请输入密码`); - return - } else if (this.state.passwords === undefined || this.state.passwords == "") { - this.openNotification(`请输入密码`); - return - } else if (this.state.password !== this.state.passwords) { - this.openNotification(`两次密码不相同`); - return - } else if (this.state.codes === undefined || this.state.codes == "") { - this.openNotification(`请输入验证码`); - return - } - var url = "/accounts/reset_password.json"; - axios.post(url, { - login: this.state.login, - code: this.state.codes, - new_password: this.state.password, - new_password_confirmation: this.state.passwords, - }).then((result) => { - // console.log(result); - //登录成功,会生成session - this.openNotification("找回密码成功,请重新登入。"); - window.location.href = "/login" - }).catch((error) => { - - }) - - - } - openNotification = (messge) => { - notification.open({ - message: "提示", - description: - messge, - onClick: () => { - console.log('Notification Clicked!'); - }, - }); - }; - loginInputonChange = (e) => { - // console.log(e.target.value); - this.setState({ - login: e.target.value, - }) - - - } - loginInputonChanges = (e) => { - // console.log(e.target.value); - this.setState({ - password: e.target.value, - }) - - - } - loginInputonChangess = (e) => { - // console.log(e.target.value); - this.setState({ - passwords: e.target.value, - }) - - - } - //获取code - codesonChange = (e) => { - this.setState({ - codes: e.target.value - }) - } - inputOnBlur = (e) => { - this.isCorrectname(e.target.value); - // this.Emailphonenumberverification(e.target.value, id); - } - isCorrectname = (value) => { - console.log(value.length); - if (value.length === 0) { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - }) - return; - } - // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; - // var email = $("#add_email.tianjia_email").val(); - var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; - - // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 - var stringdata = undefined; - if (!regph.test(value)) { - stringdata = "手机号格式不正确"; - this.setState({ - Phonenumberisnotco: stringdata, - Phonenumberisnotcobool: false, - }) - } else { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: true, - }) - return - } - - if (!regemail.test(value)) { - if ((value.indexOf("@") != -1) === true) { - stringdata = "邮箱格式不正确"; - } else { - stringdata = "手机号格式不正确"; - - } - this.setState({ - Phonenumberisnotco: stringdata, - Phonenumberisnotcobool: false, - }) - - this.Emailphonenumberverification(value) - return - } else { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: true, - }) - return - } - } - //邮箱手机号验证 - Emailphonenumberverification = (value) => { - var url = `/accounts/valid_email_and_phone.json`; - axios.get((url), { - params: { - login: value, - type: 2, - } - }).then((result) => { - //验证有问题{"status":1,"message":"success"} - // console.log(result); - this.openNotification("验证码已发送,请注意查收!",2); - - - }).catch((error) => { - console.log(error); - // this.setState({ - // login:"", - // logins:"", - // }) - }) - } - - render() { - const { - activeKey, - // 登录 - autoLogin, - // 注册 - readAgreement, dragOk, - login, - password, - passwords, - classpass, - seconds, - getverificationcodes, - Phonenumberisnotco, - readonlyInput, - codes, - } = this.state - // height: 346px; - return ( - -
- - - - -
-
- 找回密码 -
-
- - this.inputOnBlur(e)} - onChange={this.loginInputonChange} style={{marginTop: '10px',height: "38px"}}> - { - Phonenumberisnotco && Phonenumberisnotco != "" ? -

- {Phonenumberisnotco} -

- :
- } - - - - -
- - - { - getverificationcodes === undefined ? - - : getverificationcodes === true ? - - : - - } - - -
- - -
-
- -
- ); - } + } + + this.inputOnBlur(e)} + onChange={this.loginInputonChange} style={{marginTop: '10px', height: "38px"}}> + { + Phonenumberisnotco && Phonenumberisnotco != "" ? +

+ {Phonenumberisnotco} +

+ :
+ } + + + + +
+ + + { + getverificationcodes === undefined ? + + : getverificationcodes === true ? + + : + + } + + +
+ + +
+
+ +
+ ); + } } export default (LoginRegisterComponent); diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 587d77375..addd0e81b 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -548,13 +548,13 @@ class LoginRegisterComponent extends Component { // console.log(activeKey); return ( -
+
- 登录 - 注册 + 登录 + 注册 { From 66e4a5522b36fe33f428c7c613e2346ce3e3ba17 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 19:37:46 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/user/LoginRegisterComponent.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index addd0e81b..030103ea2 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -212,8 +212,8 @@ class LoginRegisterComponent extends Component { Phonenumberisnotcos: undefined, Phonenumberisnotcobool: true, }) + this.Emailphonenumberverification(value, id) } - this.Emailphonenumberverification(value, id) return } @@ -222,8 +222,11 @@ class LoginRegisterComponent extends Component { stringdata = "邮箱格式不正确"; } else { stringdata = "手机号格式不正确"; - - } + if (!regph.test(value)) { + // 这里先判断是不是手机号然后在判断是不是邮箱然后又判断是不是手机号,如果不是手机号就是账号 + stringdata=undefined; + } + } if (id === 1) { this.setState({ Phonenumberisnotco: stringdata, @@ -234,8 +237,8 @@ class LoginRegisterComponent extends Component { Phonenumberisnotcos: stringdata, Phonenumberisnotcobool: false, }) + this.Emailphonenumberverification(value, id) } - this.Emailphonenumberverification(value, id) return } else { if (id === 1) { @@ -248,8 +251,8 @@ class LoginRegisterComponent extends Component { Phonenumberisnotcos: undefined, Phonenumberisnotcobool: true, }) + this.Emailphonenumberverification(value, id) } - this.Emailphonenumberverification(value, id) return } } From 97189e671faa0a4ff38258d7212bbed8c92c40b1 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 19:41:20 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/coursesDetail/CoursesBanner.js | 2 +- public/react/src/modules/user/LoginRegisterComponent.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 3176602bd..cf28a498e 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -53,7 +53,7 @@ class CoursesBanner extends Component { this.onloadupdatabanner() this.setState({ - user_phone_binded :this.props.user_phone_binded, + user_phone_binded :this.props.current_user.user_phone_binded, }) } onloadupdatabanner=()=>{ diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 030103ea2..c5a2175a9 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -222,10 +222,10 @@ class LoginRegisterComponent extends Component { stringdata = "邮箱格式不正确"; } else { stringdata = "手机号格式不正确"; - if (!regph.test(value)) { - // 这里先判断是不是手机号然后在判断是不是邮箱然后又判断是不是手机号,如果不是手机号就是账号 - stringdata=undefined; - } + // if (!regph.test(value)) { + // // 这里先判断是不是手机号然后在判断是不是邮箱然后又判断是不是手机号,如果不是手机号就是账号 + // stringdata=undefined; + // } } if (id === 1) { this.setState({ From a4675215deda263f0a6c2bca8689ae57a7cfc846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 22 Jun 2019 19:44:06 +0800 Subject: [PATCH 19/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/login/Trialapplication.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 9285bd1f0..77abca50c 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -12,7 +12,7 @@ import {broadcastChannelPostMessage} from 'educoder' import {Tabs, Input, Checkbox, Button, notification, Menu} from 'antd'; -//试用申请页面 +//试用申请 class Trialapplication extends Component { // isRender控制弹出窗口显示 constructor(props) { From ddf72a55507fb020f99bcef7b20b227886efae1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 22 Jun 2019 19:45:11 +0800 Subject: [PATCH 20/23] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E5=AE=9E=E8=AE=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 2 +- public/react/src/modules/tpm/TPMBanner.js | 49 ++++++----------------- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index aa99f16f5..05a4463cd 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -31,7 +31,7 @@ export function initAxiosInterceptors(props) { // proxy = "http://testbdweb.trustie.net" // proxy = "http://testbdweb.educoder.net" proxy = "https://testeduplus2.educoder.net" - + // proxy="http://47.96.87.25:48080" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index f6355ec51..51d4cee9f 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -330,14 +330,13 @@ class TPMBanner extends Component { if(response.status===200){ // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; // this.props.history.push(path); - if(response.data.status===-2){ - this.shixunexec(response.data.message) - } + message.success('重置成功,正在进入实训!'); + this.startshixunCombat(response.data.shixun_identifier); + this.setState({ + shixunsreplace:false, + isSpin:false, + }) - this.setState({ - shixunsreplace:false, - isSpin:false, - }) // message.success('重置成功,正在进入实训!'); // this.startshixunCombat(); }} @@ -352,32 +351,8 @@ class TPMBanner extends Component { } - shixunexec=(url)=>{ - this.setState({ - isSpin:true, - }) - axios.get(url).then((response) => { - if(response.status===200){ - // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - // this.props.history.push(path); - this.setState({ - shixunsreplace:false, - isSpin:false, - }) - message.success('重置成功,正在进入实训!'); - this.startshixunCombat(); - }} - ).catch((error) => { - this.setState({ - startbtn:false, - shixunsreplace:false, - isSpin:false - }) - }); - - } //开始实战按钮 - startshixunCombat=()=>{ + startshixunCombat=(id)=>{ let {shixunsDetails} = this.props if( shixunsDetails.status>1){ this.setState({ @@ -391,7 +366,6 @@ class TPMBanner extends Component { } - let id = this.props.match.params.shixunId; let url="/shixuns/"+id+"/shixun_exec.json"; axios.get(url).then((response) => { if(response.status===200){ @@ -402,6 +376,7 @@ class TPMBanner extends Component { shixunsreplace:true, hidestartshixunsreplacevalue:response.data.message+".json" }) + // this.shixunexec(response.data.message+".json") }else if(response.data.status===-1){ console.log(response) }else if(response.data.status===-3){ @@ -541,7 +516,7 @@ class TPMBanner extends Component { lineHeight: '30px', }; - + const antIcon = ; return ( shixunsDetails===undefined?"": @@ -661,7 +636,7 @@ class TPMBanner extends Component { shixunsDetails.task_operation[0] === "查看实战" ? "查看我的实战光辉历史" : shixunsDetails.task_operation[0] === "模拟实战" ? "模拟完成实战任务" : shixunsDetails.task_operation[0] === "开启挑战" ? "开始学习并完成实战任务" : "" }> - this.startshixunCombat(this.props.match.params.shixunId)} className="fr user_default_btn task-btn-orange font-18" id="shixun_operation" data-remote="true" > @@ -698,13 +673,15 @@ class TPMBanner extends Component { closable={false} footer={null} > +

实训已经更新了,正在为您重置!

this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了! + onClick={() => this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了
+ Date: Sat, 22 Jun 2019 20:04:52 +0800 Subject: [PATCH 21/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 5498866cd..bdb6b2a09 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -331,21 +331,21 @@ class NewHeader extends Component { } educoderlogin=()=>{ //退出账号 - this.setState({ - isRender:true - }) - // var url = `/accounts/logout.json`; - - // axios.get((url)).then((result) => { - // if(result!==undefined){ - // // this.setState({ - // // isRender:true - // // }) - // window.location.href = "/"; - // } - // }).catch((error) => { - // console.log(error); + // this.setState({ + // isRender:true // }) + var url = `/accounts/logout.json`; + + axios.get((url)).then((result) => { + if(result!==undefined){ + // this.setState({ + // isRender:true + // }) + window.location.href = "/"; + } + }).catch((error) => { + console.log(error); + }) } onKeywordSearch = () => { From fb6c09f7df290038f689e11bda5b4c6ac615b2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 22 Jun 2019 20:10:49 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/coursesDetail/CoursesBanner.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index cf28a498e..9a35a0f81 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -52,9 +52,17 @@ class CoursesBanner extends Component { componentDidMount() { this.onloadupdatabanner() - this.setState({ - user_phone_binded :this.props.current_user.user_phone_binded, - }) + try { + if(this.props.current_user!==undefined){ + this.setState({ + user_phone_binded :this.props.current_user.user_phone_binded, + }) + } + }catch (e) { + console.log("CoursesBanner 60") + console.log(e) + } + } onloadupdatabanner=()=>{ this.updatabanner() From 6f4566e03bd11359b1534f5ff82e05f7359521fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 22 Jun 2019 23:08:50 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 11 +++++- public/react/src/modules/tpm/NewHeader.js | 35 ++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 9a35a0f81..4e3f6a42d 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -344,7 +344,16 @@ class CoursesBanner extends Component { render() { let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,user_phone_binded} = this.state; - + try { + if(this.props.current_user!==undefined){ + this.setState({ + user_phone_binded :this.props.current_user.user_phone_binded, + }) + } + }catch (e) { + console.log("CoursesBanner 354") + console.log(e) + } return (
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index bdb6b2a09..17061f530 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -330,6 +330,24 @@ class NewHeader extends Component { }) } educoderlogin=()=>{ + //退出账号 + this.setState({ + isRender:true + }) + // var url = `/accounts/logout.json`; + // + // axios.get((url)).then((result) => { + // if(result!==undefined){ + // // this.setState({ + // // isRender:true + // // }) + // window.location.href = "/"; + // } + // }).catch((error) => { + // console.log(error); + // }) + } + educoderloginysl=()=>{ //退出账号 // this.setState({ // isRender:true @@ -337,17 +355,16 @@ class NewHeader extends Component { var url = `/accounts/logout.json`; axios.get((url)).then((result) => { - if(result!==undefined){ - // this.setState({ - // isRender:true - // }) - window.location.href = "/"; - } + if(result!==undefined){ + // this.setState({ + // isRender:true + // }) + window.location.href = "/"; + } }).catch((error) => { - console.log(error); + console.log(error); }) } - onKeywordSearch = () => { header_search(this) } @@ -729,7 +746,7 @@ submittojoinclass=(value)=>{
  • {/*退出*/} {/*this.educoderlogin()}>退出*/} - this.educoderlogin()}>退出 + this.educoderloginysl()}>退出