diff --git a/public/react/package.json b/public/react/package.json index 7b00881d5..19b8286d9 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -3,6 +3,8 @@ "version": "0.1.0", "private": true, "dependencies": { + "@novnc/novnc": "^1.1.0", + "@flatten/array": "^1.1.7", "@icedesign/base": "^0.2.5", "antd": "^3.6.5", diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index c272df699..d5d8715f5 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -417,7 +417,7 @@ pop_box_new(htmlvalue, 480, 182); */ let user = resData.user; user.username = resData.user.name; - // user.user_url = resData.user_url; + user.user_url = `/user/${resData.user.login}`; // user.image_url = resData.image_url; user.is_teacher = resData.is_teacher; resData.user = user; diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index c33b6a5ce..3dcdb1c18 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -442,16 +442,21 @@ class CoursesIndex extends Component{ {/* 资源列表页 */} - () + (props) => () } > () + (props) => () } > + () + } + > {/*课堂讨论*/} {/* 毕设选题列表 */} - () + (props) => () }> @@ -554,9 +559,9 @@ class CoursesIndex extends Component{ {/* 毕设任务列表 https://www.trustie.net/issues/19981 */} - () + (props) => () } > @@ -591,16 +596,29 @@ class CoursesIndex extends Component{ (props) => () } > + + {/* 普通作业 */} + () + } + > + {/* 分组作业 */} + () + } + > {/* 普通作业 */} - () } > {/* 分组作业 */} - () } diff --git a/public/react/src/modules/courses/ListPageIndex.js b/public/react/src/modules/courses/ListPageIndex.js index 12237e177..1f8bf6b29 100644 --- a/public/react/src/modules/courses/ListPageIndex.js +++ b/public/react/src/modules/courses/ListPageIndex.js @@ -56,6 +56,14 @@ const ShixunHomework= Loadable({ loading: Loading, }) +const GraduationTopics= Loadable({ + loader: () => import('./graduation/topics'), + loading: Loading, +}) +const GraduationTasks= Loadable({ + loader: () => import('./graduation/tasks'), + loading: Loading, +}) class ListPageIndex extends Component{ constructor(props) { super(props) @@ -169,12 +177,34 @@ class ListPageIndex extends Component{ } > + + () + } + > + () + } + > + + () + }> + () + } + > + {/* 默认 */} () } > - + diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 1cae3d559..6476ef2bb 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -573,7 +573,7 @@ class Fileslists extends Component{ return( -
+ {/*发送*/} @@ -647,7 +647,6 @@ class Fileslists extends Component{ has_course_groups={this.state.has_course_groups} />:""} - - -
+ ) } } diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index e8afa5329..9f3d8dda0 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -14,7 +14,7 @@ import { WordsBtn } from 'educoder' import Modals from '../../modals/Modals' import NoneData from "../coursesPublic/NoneData" import Titlesearchsection from '../common/titleSearch/TitleSearchSection'; - +import { RouteHOC } from './common' import axios from 'axios'; import _ from 'lodash' @@ -71,6 +71,13 @@ class commonWork extends Component{ sureDelClasses(){ } + componentDidUpdate(prevProps, prevState) { + debugger; + if (prevProps.match.path != this.props.match.path) { + this.componentDidMount() + } + } + componentDidMount(){ this.setState({ @@ -429,4 +436,4 @@ class commonWork extends Component{ ) } } -export default commonWork; \ No newline at end of file +export default RouteHOC() (commonWork); \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 8bb95e330..3176602bd 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -9,7 +9,7 @@ import '../css/Courses.css'; import Modals from "../../modals/Modals"; import AddStudentModal from '../members/modal/AddStudentModal' import AddTeacherModal from '../members/modal/AddTeacherModal' - +import Trialapplication from "../../login/Trialapplication"; // 点击按钮复制功能 // function jsCopy(){ @@ -43,34 +43,46 @@ class CoursesBanner extends Component { metype: 0, modalsBottomval: "", antIcon:false, - coursedata:undefined + coursedata:undefined, + user_phone_binded:false, + isRenders:false, + showTrial:false, } } - - componentDidMount() { - this.onloadupdatabanner() - } - 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() - } - }) - } + this.onloadupdatabanner() + this.setState({ + user_phone_binded :this.props.user_phone_binded, + }) + } + 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; + if(result.data.status === 407){ + this.setState({ + isRenders:true, + coursedata: data, + showTrial:false, + }) + }else{ + this.setState({ + coursedata: data, + showTrial:true, + }) + } + }else{ + this.onloadupdatabanner() + } + }) + } showeditmenu = () => { this.setState({ show: true, @@ -323,265 +335,271 @@ class CoursesBanner extends Component { } render() { - let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon} = this.state; + let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,user_phone_binded} = this.state; return ( +
+ - coursedata === undefined || coursedata.status===401?
:
+ { + coursedata === undefined || coursedata.status===401?
:
{Addcoursestypes === true ? this.tojoinclass(2)} + Addcoursestype={Addcoursestypes} + hideAddcoursestype={() => this.tojoinclass(2)} /> : ""} - -
-
+
- { - coursedata===undefined || coursedata.status===401 || coursedata.status===407?"": - - {coursedata.name} - + { + coursedata===undefined || coursedata.status===401 || coursedata.status===407?"": + + {coursedata.name} + - } - {/*私有:私有课堂,非课堂成员不能访问 + } + {/*私有:私有课堂,非课堂成员不能访问 公开:公开课堂,非课堂成员可以访问*/} - + + typelist={coursedata.course_end === true ? ["已结束"] : coursedata.is_public === true ? ["公开"] : ["私有"]} + typesylename={"mt10"} tipval={coursedata.is_public === true?"":"私有课堂,非课堂成员不能访问"}/> +
+ +
+
+ + + 头像 + + + + +
+

{coursedata.teacher_school}

+
+
-
-
- - - 头像 - - - - -
-

{coursedata.teacher_school}

-
- -
- - -
- {coursedata.switch_to_student === true ? - - this.switchidentity(1)} - > 切换为学生 - - :""} - - {coursedata.switch_to_teacher === true ? - - this.switchidentity(2)} - > 切换为老师 - :""} - - - {coursedata.switch_to_assistant === true ? - - this.switchidentity(3)} - > 切换为助教 - :""} - - - {coursedata.course_identity === 6&&coursedata.educoder_teacher===false? - this.tojoinclass(1)}>加入课堂: ""} - - {coursedata.course_identity === 6&&coursedata.educoder_teacher===true? - this.tojoinclass(1)}>加入课堂: ""} - - {coursedata.course_identity === 6&&coursedata.educoder_teacher===true? - this.ActionPoll(5)}> 复制课堂 : ""} - - {this.props.isStudent()? this.exitclass()} - > 退出课堂 :""} - -
- - -
- +
+ {coursedata.switch_to_student === true ? + + this.switchidentity(1)} + > 切换为学生 + + :""} + + {coursedata.switch_to_teacher === true ? + + this.switchidentity(2)} + > 切换为老师 + :""} - {this.props.isAdmin()?
+ + +
+ + + + {this.props.isAdmin()? - } trigger="hover"> - - + } + + + {coursedata.is_public === true?coursedata.course_identity <3? +
this.ActionPoll(2)}>设为私有
: "" : ""} + + {coursedata.is_public === false?coursedata.course_identity <3? +
this.ActionPoll(3)}>设为公开
: "": ""} + + {coursedata.course_identity <3?
this.ActionPoll(4)}> + {coursedata.code_halt === true ?"启用邀请码":"停用邀请码"} +
:""} + +
设置
+ +
this.ActionPoll(5)}>复制 +
+ + {coursedata.is_admin===true?coursedata.course_identity <3?
this.ActionPoll(1)}>删除
+ :"":""} + + } trigger="hover"> + +
- + - :""} + :""} -
+
-
+
-
+
+ } +
+ ) } } diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index 0893a5e23..ce9c00a21 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -240,11 +240,15 @@ class ExerciseReviewAndAnswer extends Component{ ) } // 调分 - showSetScore=(key,flag)=>{ + showSetScore=(key,flag,setId)=>{ this.setState( (prevState) => ({ exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}}) - }) + }),()=>{ + if (setId && (flag == undefined || flag==false)) { + $("html").animate({ scrollTop: $("#Anchor_"+setId).offset().top - 150 }) + } + } ) this.setState({ score:undefined @@ -502,6 +506,18 @@ class ExerciseReviewAndAnswer extends Component{ console.log(data&&data.exercise.user_name) return(
+

this.showSetScore(key,item.setScore)}>调分:"" + this.showSetScore(key,item.setScore,item.q_position+"_"+item.question_type)}>调分:"" } { // 简答题,未评分的显示未批 @@ -767,11 +783,10 @@ class ExerciseReviewAndAnswer extends Component{
} - { // 调分输入部分 isAdmin && ((item.setScore && item.question_type == 3) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4))? -
+
*调分:
  • @@ -783,8 +798,7 @@ class ExerciseReviewAndAnswer extends Component{ value={score} step={0.1} precision={1} - className={ setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip" : "edu-txt-center winput-115-40 fl mt3"} - style={{height:"30px",width:"115px"}} + className={ setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"} onChange={this.inputScore} > diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 4317950f2..64cfaee64 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.course_groups.length > 0) { + if (response.data.poll_types.groups_count > 0) { // console.log("77771111111"); //分班大于0显示分班 //7ge @@ -2272,7 +2272,8 @@ class Studentshavecompletedthelist extends Component { } else { //已经评论 - if (response.data.course_groups.length > 0) { + // response.data.course_groups.length + if (response.data.poll_types.groups_count > 0) { //显示分班 //8ge this.setState({ @@ -2545,7 +2546,7 @@ class Studentshavecompletedthelist extends Component { //包括主观题 if (indexi === exercise_users.length) { console.log("2548包含主观题不包含分班"); - if (response.data.course_groups.length > 0){ + if (response.data.poll_types.groups_count> 0){ this.setState({ data: datalist, teacherlist: teacherlist, @@ -2836,7 +2837,7 @@ class Studentshavecompletedthelist extends Component { } } else { console.log("2699包含主观题包含分班"); - if (response.data.course_groups.length > 0) { + if (response.data.poll_types.groups_count> 0) { this.setState({ data: datalist, teacherlist: teacherlist, diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index 1c72433b6..7421170d6 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -86,6 +86,19 @@ class GraduationTasksSubmitnew extends Component{ let {fileList,selectmemberslist,workslist}=this.state; + if(fileList.length === 0){ + this.setState({ + Modalstype:true, + Modalstopval:'请上传附件!', + Loadtype:true, + ModalCancel:this.cancelAttachment + }) + + + return + } + + let userids=[]; for(var list of selectmemberslist){ @@ -433,6 +446,8 @@ render(){ let graduation_id=workslist===undefined?"":workslist.graduation_id; let task_id=workslist===undefined?"":workslist.task_id; + + return( @@ -637,7 +652,7 @@ render(){
    - + 取消
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js index 7807e7265..47f38746c 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js @@ -163,8 +163,8 @@ class GraduationTasksappraise extends Component{

    - {/* {datalist&&datalist.course_name}*/} - {/*>*/} + {datalist&&datalist.course_name} + > {datalist&&datalist.graduation_name} > 任务详情 @@ -182,23 +182,22 @@ class GraduationTasksappraise extends Component{ ` } -

    -

    {datalist&&datalist.task_name}

    +
    +

    {datalist&&datalist.task_name}

    - 返回 + 返回 {this.props.isStudent()? datalist&&datalist.task_status===2? - 补交附件:"" + 补交附件:"" :""}
    -
    +
    内容 @@ -251,7 +250,7 @@ class GraduationTasksappraise extends Component{ {firelistdata===undefined?"":firelistdata.length===0?"":firelistdata.revise_attachments.length===0?"":
    -
    +
    补交附件
    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 52c12d069..9c2515c88 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -619,17 +619,17 @@ class GraduationTaskssettinglist extends Component{ title: '序号', dataIndex: 'number', key: 'number', - + className:'edu-txt-center' }, { title: '姓名', dataIndex: 'name', key: 'name', - + className:'edu-txt-center' }, { title: '学号', dataIndex: 'stduynumber', key: 'stduynumber', - + className:'edu-txt-center', render: (text, record) => ( {record.stduynumber} @@ -639,7 +639,7 @@ class GraduationTaskssettinglist extends Component{ title: '分班', key: 'classroom', dataIndex: 'classroom', - + className:'edu-txt-center', render: (text, record) => ( {record.classroom==="未分班"?"--":record.classroom} @@ -648,7 +648,8 @@ class GraduationTaskssettinglist extends Component{ }, { title: '分组', key: 'grouping', - dataIndex: 'grouping', + dataIndex: 'grouping', + className:'edu-txt-center', render: (text, record) => ( {record.grouping} @@ -657,7 +658,7 @@ class GraduationTaskssettinglist extends Component{ title: '关联项目', dataIndex: 'associationitems', key: 'associationitems', - + className:'edu-txt-center', render: (text, record) => (
    @@ -669,7 +670,7 @@ class GraduationTaskssettinglist extends Component{ title: '提交状态', dataIndex: 'submitstate', key: 'submitstate', - + className:'edu-txt-center', render: (text, record) => ( {record.submitstate} @@ -679,7 +680,7 @@ class GraduationTaskssettinglist extends Component{ title: '更新时间', dataIndex: 'turnovertime', key: 'turnovertime', - + className:'edu-txt-center', render: (text, record) => ( @@ -691,11 +692,11 @@ class GraduationTaskssettinglist extends Component{ title: '教师评分', key: 'teacherrating', dataIndex: 'teacherrating', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":parseInt(record.teacherrating)} + 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":record.teacherrating} ), @@ -703,11 +704,11 @@ class GraduationTaskssettinglist extends Component{ title: '交叉评分', key: 'crossrating', dataIndex: 'crossrating', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":parseInt(record.crossrating)} + 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":record.crossrating} ), @@ -715,18 +716,19 @@ class GraduationTaskssettinglist extends Component{ title: '最终成绩', key: 'finalscore', dataIndex: 'finalscore', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":parseInt(record.finalscore)} + 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":record.finalscore} ), }, { title: '操作', key: 'operation', - dataIndex: 'operation', + dataIndex: 'operation', + className:'edu-txt-center', render: operation => (
    {this.props.isAdmin()?operation.map((tag,key) => { @@ -770,17 +772,17 @@ class GraduationTaskssettinglist extends Component{ title: '序号', dataIndex: 'number', key: 'number', - + className:'edu-txt-center', }, { title: '姓名', dataIndex: 'name', key: 'name', - + className:'edu-txt-center', }, { title: '学号', dataIndex: 'stduynumber', key: 'stduynumber', - + className:'edu-txt-center', render: (text, record) => ( {record.stduynumber} @@ -789,7 +791,8 @@ class GraduationTaskssettinglist extends Component{ },{ title: '分组', key: 'grouping', - dataIndex: 'grouping', + dataIndex: 'grouping', + className:'edu-txt-center', render: (text, record) => ( {record.grouping} @@ -798,7 +801,7 @@ class GraduationTaskssettinglist extends Component{ title: '关联项目', dataIndex: 'associationitems', key: 'associationitems', - + className:'edu-txt-center', render: (text, record) => (
    @@ -810,7 +813,7 @@ class GraduationTaskssettinglist extends Component{ title: '提交状态', dataIndex: 'submitstate', key: 'submitstate', - + className:'edu-txt-center', render: (text, record) => ( {record.submitstate} @@ -820,7 +823,7 @@ class GraduationTaskssettinglist extends Component{ title: '更新时间', dataIndex: 'turnovertime', key: 'turnovertime', - + className:'edu-txt-center', render: (text, record) => ( @@ -832,11 +835,11 @@ class GraduationTaskssettinglist extends Component{ title: '教师评分', key: 'teacherrating', dataIndex: 'teacherrating', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":parseInt(record.teacherrating)} + 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":record.teacherrating} ), @@ -844,11 +847,11 @@ class GraduationTaskssettinglist extends Component{ title: '交叉评分', key: 'crossrating', dataIndex: 'crossrating', - className:'none', + className:'none edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":parseInt(record.crossrating)} + 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":record.crossrating} ), @@ -856,11 +859,11 @@ class GraduationTaskssettinglist extends Component{ title: '最终成绩', key: 'finalscore', dataIndex: 'finalscore', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":parseInt(record.finalscore)} + 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":record.finalscore} ), @@ -868,6 +871,7 @@ class GraduationTaskssettinglist extends Component{ title: '操作', key: 'operation', dataIndex: 'operation', + className:'edu-txt-center', render: operation => (
    {this.props.isAdmin()?operation.map((tag,key) => { @@ -916,17 +920,17 @@ class GraduationTaskssettinglist extends Component{ title: '序号', dataIndex: 'number', key: 'number', - + className:'edu-txt-center', }, { title: '姓名', dataIndex: 'name', key: 'name', - + className:'edu-txt-center', }, { title: '学号', dataIndex: 'stduynumber', key: 'stduynumber', - + className:'edu-txt-center', render: (text, record) => ( {record.stduynumber} @@ -936,7 +940,7 @@ class GraduationTaskssettinglist extends Component{ title: '分班', key: 'classroom', dataIndex: 'classroom', - + className:'edu-txt-center', render: (text, record) => ( {record.classroom==="未分班"?"--":record.classroom} @@ -946,6 +950,7 @@ class GraduationTaskssettinglist extends Component{ title: '分组', key: 'grouping', dataIndex: 'grouping', + className:'edu-txt-center', render: (text, record) => ( {record.grouping} @@ -954,7 +959,7 @@ class GraduationTaskssettinglist extends Component{ title: '关联项目', dataIndex: 'associationitems', key: 'associationitems', - + className:'edu-txt-center', render: (text, record) => (
    @@ -967,7 +972,7 @@ class GraduationTaskssettinglist extends Component{ title: '提交状态', dataIndex: 'submitstate', key: 'submitstate', - + className:'edu-txt-center', render: (text, record) => ( {record.submitstate} @@ -977,7 +982,7 @@ class GraduationTaskssettinglist extends Component{ title: '更新时间', dataIndex: 'turnovertime', key: 'turnovertime', - + className:'edu-txt-center', render: (text, record) => ( @@ -989,11 +994,11 @@ class GraduationTaskssettinglist extends Component{ title: '教师评分', key: 'teacherrating', dataIndex: 'teacherrating', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":parseInt(record.teacherrating)} + 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":record.teacherrating} ), @@ -1001,11 +1006,11 @@ class GraduationTaskssettinglist extends Component{ title: '交叉评分', key: 'crossrating', dataIndex: 'crossrating', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":parseInt(record.crossrating)} + 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":record.crossrating} ), @@ -1013,11 +1018,11 @@ class GraduationTaskssettinglist extends Component{ title: '最终成绩', key: 'finalscore', dataIndex: 'finalscore', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":parseInt(record.finalscore)} + 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":record.finalscore} ), @@ -1025,6 +1030,7 @@ class GraduationTaskssettinglist extends Component{ title: '操作', key: 'operation', dataIndex: 'operation', + className:'edu-txt-center', render: operation => (
    {this.props.isAdmin()?operation.map((tag,key) => { @@ -1068,17 +1074,17 @@ class GraduationTaskssettinglist extends Component{ title: '序号', dataIndex: 'number', key: 'number', - + className:'edu-txt-center', }, { title: '姓名', dataIndex: 'name', key: 'name', - + className:'edu-txt-center', }, { title: '学号', dataIndex: 'stduynumber', key: 'stduynumber', - + className:'edu-txt-center', render: (text, record) => ( {record.stduynumber} @@ -1088,6 +1094,7 @@ class GraduationTaskssettinglist extends Component{ title: '分组', key: 'grouping', dataIndex: 'grouping', + className:'edu-txt-center', render: (text, record) => ( {record.grouping} @@ -1096,7 +1103,7 @@ class GraduationTaskssettinglist extends Component{ title: '关联项目', dataIndex: 'associationitems', key: 'associationitems', - + className:'edu-txt-center', render: (text, record) => (
    @@ -1110,7 +1117,7 @@ class GraduationTaskssettinglist extends Component{ title: '提交状态', dataIndex: 'submitstate', key: 'submitstate', - + className:'edu-txt-center', render: (text, record) => ( {record.submitstate} @@ -1120,7 +1127,7 @@ class GraduationTaskssettinglist extends Component{ title: '更新时间', dataIndex: 'turnovertime', key: 'turnovertime', - + className:'edu-txt-center', render: (text, record) => ( @@ -1132,11 +1139,11 @@ class GraduationTaskssettinglist extends Component{ title: '教师评分', key: 'teacherrating', dataIndex: 'teacherrating', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":parseInt(record.teacherrating)} + 90?'#DD1717':parseInt(record.teacherrating)>60&&parseInt(record.teacherrating)<90?"#FF6800":'#747A7F'}}>{record.teacherrating==="--"||record.teacherrating==="未批阅"?"--":record.teacherrating} ), @@ -1144,11 +1151,11 @@ class GraduationTaskssettinglist extends Component{ title: '交叉评分', key: 'crossrating', dataIndex: 'crossrating', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":parseInt(record.crossrating)} + 90?'#DD1717':parseInt(record.crossrating)>60&&parseInt(record.crossrating)<90?"#FF6800":'#747A7F'}}>{record.crossrating==="--"||record.crossrating==="未批阅"?"--":record.crossrating} ), @@ -1156,11 +1163,11 @@ class GraduationTaskssettinglist extends Component{ title: '最终成绩', key: 'finalscore', dataIndex: 'finalscore', - + className:'edu-txt-center', render: (text, record) => ( - 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":parseInt(record.finalscore)} + 90?'#DD1717':parseInt(record.finalscore)>60&&parseInt(record.finalscore)<90?"#FF6800":'#747A7F'}}>{record.finalscore==="--"?"--":record.finalscore} ), @@ -1168,6 +1175,7 @@ class GraduationTaskssettinglist extends Component{ title: '操作', key: 'operation', dataIndex: 'operation', + className:'edu-txt-center', render: operation => (
    {this.props.isAdmin()?operation.map((tag,key) => { @@ -1357,13 +1365,12 @@ class GraduationTaskssettinglist extends Component{ 任务详情

    -
    -

    {taskslistdata.task_name}

    +
    +

    {taskslistdata.task_name}

    - 返回 + 返回
    @@ -1446,7 +1453,7 @@ class GraduationTaskssettinglist extends Component{ {taskslistdata.search_assistants && taskslistdata.search_assistants.teacher_comment && taskslistdata.search_assistants.teacher_comment.map((item,key)=>{ return( - {item.name} + {item.name} ({item.count}) diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index 29610eb93..c044c1711 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -591,7 +591,7 @@ class GraduationTasks extends Component{ // console.log(this.props.isCourseidentity()===isNotMember) // console.log(category_id) return( - + {/*提示*/} - + ) } } diff --git a/public/react/src/modules/courses/graduation/topics/index.js b/public/react/src/modules/courses/graduation/topics/index.js index aaba86e9e..391bcac18 100644 --- a/public/react/src/modules/courses/graduation/topics/index.js +++ b/public/react/src/modules/courses/graduation/topics/index.js @@ -341,7 +341,7 @@ onBoardsNew=()=>{ // let {course_identity}=this.props.coursedata const isAdmin =this.props.isAdmin(); return( - + {
    -
    + ) } } diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index 509bf56c1..ac9d22119 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -5,6 +5,7 @@ import CourseLayoutcomponent from '../common/CourseLayoutComponent' import Titlesearchsection from '../common/titleSearch/TitleSearchSection' import ColorCountText from '../common/titleSearch/ColorCountText' +import update from 'immutability-helper' import { WordsBtn, ConditionToolTip, on, off } from 'educoder' import axios from 'axios' @@ -28,6 +29,7 @@ const pageSize = 20; function buildColumns(that) { const isAdmin = that.props.isAdmin() const isAdminOrCreator = that.props.isAdminOrCreator(); + const isAdminOrTeacher = that.props.isAdminOrTeacher() const { course_groups } = that.state const columns = [{ title: '', @@ -55,7 +57,8 @@ function buildColumns(that) { title: '角色', dataIndex: 'role', key: 'role', - }, { + }] + that.course_groups && that.course_groups.length && columns.push({ title: 管理权限, width: 230, key: 'course_groups', @@ -70,7 +73,7 @@ function buildColumns(that) { const noGroups = (!course_groups || course_groups.length == 0); return ( - + { arg_course_groups.length == 0 ? '不限' : arg_course_groups.map(item => item.name).join(', ') } { isAdmin && @@ -83,7 +86,7 @@ function buildColumns(that) {

    ): '' } - that.joinCourseGroup(checkedValues, item)} + that.joinCourseGroup(checkedValues, item, index)} value={arg_course_groups.map(item => item.id)} disabled={!isAdminOrCreator} > @@ -108,7 +111,7 @@ function buildColumns(that) {
    ) } , - }]; + }); if (that.hasGraduationModule()) { columns.push({ title: '答辩组', @@ -121,7 +124,7 @@ function buildColumns(that) { ), }) } - if (isAdminOrCreator) { + if (isAdminOrTeacher) { columns.push({ title: '操作', key: 'action', @@ -136,11 +139,12 @@ function buildColumns(that) { } else { return ( - that.onDelete(record)} style={'grey'}>删除 - + {record.role != ROLE_ADMIN && that.onDelete(record)} style={'grey'}>删除} + {(record.role == ROLE_TEACHER || record.role == ROLE_TEACHER_ASSISTANT || isAdminOrCreator) && record.role != ROLE_ADMIN + && } { record.role == ROLE_TEACHER ? that.changeToAssistant(record)}>变更为助教 : '' } { record.role == ROLE_TEACHER_ASSISTANT ? that.changeToTeacher(record)}>变更为教师 : '' } - { record.role == ROLE_ADMIN ? that.showChangeAdminModal(record)}>更换管理员 : '' } + { record.role == ROLE_ADMIN && isAdminOrCreator ? that.showChangeAdminModal(record)}>更换管理员 : '' } ) } @@ -237,8 +241,13 @@ class studentsList extends Component{ }) .then((response) => { if (response.data.course_groups && response.data.course_groups.length) { + let course_groups_map = {} + response.data.course_groups.forEach(item => { + course_groups_map[item.id] = item.name + }) this.setState({ course_groups: response.data.course_groups, + course_groups_map }) } else { } @@ -247,7 +256,7 @@ class studentsList extends Component{ console.log(error); }); } - joinCourseGroup = (ids, item) => { + joinCourseGroup = (ids, item, index) => { console.log('join ', ids, item) const courseId = this.props.match.params.coursesId @@ -262,7 +271,12 @@ class studentsList extends Component{ .then((response) => { if (response.data.status == 0) { this.props.showNotification('修改成功') - this.fetchAll() + const newArray = ids.map((item) => {return {id: item, name: this.state.course_groups_map[item]}}); + this.setState( + (prevState) => ({ + teachers : update(prevState.teachers, {[ this.state.page == 1 ? index - this.state.application_list.length : index]: { course_groups: {$set: newArray }}}) + })) + // this.fetchAll() } else { } }) @@ -560,7 +574,7 @@ class studentsList extends Component{
    • this.onSortTypeChange(ORDER_BY_NAME)} >姓名排序
    • this.onSortTypeChange(ORDER_BY_DATE)} style={{width: '125px'}}>加入时间排序
    • -
    • this.onSortTypeChange(ORDER_BY_GRADUATION_GROUP)} >答辩组排序
    • + {this.hasGraduationModule() &&
    • this.onSortTypeChange(ORDER_BY_GRADUATION_GROUP)} >答辩组排序
    • }
  • } diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js index 9f9291b61..3a7cd6aec 100644 --- a/public/react/src/modules/courses/poll/Poll.js +++ b/public/react/src/modules/courses/poll/Poll.js @@ -13,6 +13,7 @@ import '../css/members.css'; import '../css/busyWork.css'; import Modals from '../../modals/Modals'; import axios from 'axios'; +import moment from 'moment'; const Search = Input.Search; diff --git a/public/react/src/modules/courses/poll/PollDetailTabFirst.js b/public/react/src/modules/courses/poll/PollDetailTabFirst.js index 6a5be2e8d..ceca9b291 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabFirst.js +++ b/public/react/src/modules/courses/poll/PollDetailTabFirst.js @@ -181,7 +181,12 @@ class PollDetailTabFirst extends Component{ title: '学号', dataIndex: 'StudentNo', key: 'StudentNo', - className:"edu-txt-center" + className:"edu-txt-center", + render:(StudentNo,item,index)=>{ + return( + item.StudentNo ? {item.StudentNo} : "--" + ) + } }, { title: '分班', key: 'classes', diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 94341d7e2..3c3f47c87 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -60,21 +60,27 @@ class EducoderLogin extends Component { if( props.match.url === "/changepassword" ){ this.state = { showbool: false, + logini:3, } }else { if(props.match.url === "/login"){ this.state = { showbool: true, - loginstatus:true + loginstatus:true, + logini:1, + } }else if(props.match.url === "/register"){ this.state = { showbool: true, loginstatus:false, + logini:2, } }else{ this.state = { showbool: true, + logini:1, + } } @@ -86,6 +92,14 @@ class EducoderLogin extends Component { } + Setlogins=(i)=>{ + console.log("96ye"); + console.log(i) + this.setState({ + logini:i + }) + + } Setshowbool = () => { if (this.state.showbool === true) { @@ -102,7 +116,7 @@ class EducoderLogin extends Component { render() { - let {showbool} = this.state; + let {showbool,loginstatus,logini} = this.state; return (
    + id="game_left_contents" style={{ width: '40%'}}> {/* style={{width: '694px'}} */} {/* 左侧任务说明等功能的区域 */} @@ -82,6 +86,10 @@ class MainContent extends Component {
    */} + {/* { showIframeContent && vnc_url ? */} +
    diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index 7595f933d..daa4b65b6 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -237,6 +237,10 @@ class MainContentContainer extends Component { // arg_path 点击文件目录树时,传入的点击节点对应的path fetchRepositoryCode( props, arg_path, type, isRetry) { const { challenge, showSnackbar, game, shixun, myshixun, hide_code } = props ? props : this.props; + if (shixun.vnc == true) { + // vnc模式下不需要加载代码 + return true; + } if ( // true || hide_code) { // 隐藏code的实训 diff --git a/public/react/src/modules/page/VNCDisplay.js b/public/react/src/modules/page/VNCDisplay.js new file mode 100644 index 000000000..b8840fe02 --- /dev/null +++ b/public/react/src/modules/page/VNCDisplay.js @@ -0,0 +1,154 @@ +// import React, { Component } from 'react'; + +// import RFB from '@novnc/novnc/lib/rfb.js'; + +// const $ = window.$; +// // const showIframeContent = window.location.search.indexOf('vnc=1') != -1; +// class VNCDisplay extends Component { +// componentDidMount() { +// console.log(RFB) + +// let rfb; +// let desktopName; +// // When this function is called we have +// // successfully connected to a server +// function connectedToServer(e) { +// status("Connected to " + desktopName); +// } +// // This function is called when we are disconnected +// function disconnectedFromServer(e) { +// if (e.detail.clean) { +// status("Disconnected"); +// } else { +// status("Something went wrong, connection is closed"); +// } +// } +// // When this function is called, the server requires +// // credentials to authenticate +// function credentialsAreRequired(e) { +// const password = prompt("Password Required:"); +// rfb.sendCredentials({ password: password }); +// } +// // When this function is called we have received +// // a desktop name from the server +// function updateDesktopName(e) { +// desktopName = e.detail.name; +// } +// // Since most operating systems will catch Ctrl+Alt+Del +// // before they get a chance to be intercepted by the browser, +// // we provide a way to emulate this key sequence. +// function sendCtrlAltDel() { +// rfb.sendCtrlAltDel(); +// return false; +// } +// // Show a status text in the top bar +// function status(text) { +// document.getElementById('status').textContent = text; +// } +// // This function extracts the value of one variable from the +// // query string. If the variable isn't defined in the URL +// // it returns the default value instead. +// function readQueryVariable(name, defaultValue) { +// // A URL with a query parameter can look like this: +// // https://www.example.com?myqueryparam=myvalue +// // +// // Note that we use location.href instead of location.search +// // because Firefox < 53 has a bug w.r.t location.search +// const re = new RegExp('.*[?&]' + name + '=([^&#]*)'), +// match = document.location.href.match(re); +// if (typeof defaultValue === 'undefined') { defaultValue = null; } +// if (match) { +// // We have to decode the URL since want the cleartext value +// return decodeURIComponent(match[1]); +// } +// return defaultValue; +// } +// document.getElementById('sendCtrlAltDelButton') +// .onclick = sendCtrlAltDel; +// // Read parameters specified in the URL query string +// // By default, use the host and port of server that served this file + +// // const host = readQueryVariable('host', window.location.hostname); +// // let port = readQueryVariable('port', window.location.port); +// // const password = readQueryVariable('password', ''); + +// const { vnc_url } = this.props; +// // http://117.50.12.63:43149/vnc_lite.html?password=headless +// let _ar1 = vnc_url.split('/'); +// let ipAndPort = _ar1[2].split(':') +// let passwordAr = _ar1[3].split('password=') +// const host = ipAndPort[0] +// let port = ipAndPort[1] +// const password = passwordAr[1].split('&')[0] + +// const path = readQueryVariable('path', 'websockify'); +// // | | | | | | +// // | | | Connect | | | +// // v v v v v v +// status("Connecting"); +// // Build the websocket URL used to connect +// let url; +// if (vnc_url.indexOf("https:") != -1) { +// url = 'wss'; +// } else { +// url = 'ws'; +// } +// url += '://' + host; +// if(port) { +// url += ':' + port; +// } +// url += '/' + path; +// // Creating a new RFB object will start a new connection +// rfb = new RFB(document.getElementById('screen'), url, +// { credentials: { password: password } }); +// // Add listeners to important events from the RFB module +// rfb.addEventListener("connect", connectedToServer); +// rfb.addEventListener("disconnect", disconnectedFromServer); +// rfb.addEventListener("credentialsrequired", credentialsAreRequired); +// rfb.addEventListener("desktopname", updateDesktopName); +// // Set parameters that can be changed on an active connection +// rfb.viewOnly = readQueryVariable('view_only', false); +// rfb.scaleViewport = readQueryVariable('scale', false); +// } + +// render() { +// const { challenge, vnc_url } = this.props + + +// return ( +//
    +// +//
    +//
    Loading
    +//
    Send CtrlAltDel
    +//
    +//
    +//
    +// ); +// } +// } + +// export default VNCDisplay; 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); diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 7723af4fc..77d2e13bb 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -213,6 +213,13 @@ export function TPMIndexHOC(WrappedComponent) { return this.state.coursedata&&this.state.coursedata.course_identity === 6 } + // setTrialapplication = ()=>{ + // this.setState({ + // isRenders:true + // }) + // + // } + /** 课堂权限相关方法,暂时写这里了 ----------------------------------------END @@ -281,13 +288,13 @@ export function TPMIndexHOC(WrappedComponent) { } return (
    - { - user_phone_binded === undefined? - "" - : - + {/*{*/} + {/* user_phone_binded === undefined?*/} + {/* ""*/} + {/* :*/} + {/* */} - } + {/*}*/} { - 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) { - if (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); - - - }).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'}}> - { - Phonenumberisnotco && Phonenumberisnotco != "" ? -

    - {Phonenumberisnotco} -

    - :
    - } - - - - -
    - - - { - getverificationcodes === undefined ? - - : getverificationcodes === true ? - - : - - } - - -
    - - -
    -
    - -
    - ); - } -} - -export default (LoginRegisterComponent); +import React, {Component} from 'react'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +import {getImageUrl, DragValidator} from 'educoder'; +import {Tabs, Input, Checkbox, Button, notification} from 'antd'; +import axios from 'axios'; +import './common.css' + +const TabPane = Tabs.TabPane +const loginInputsyl = { + "width": " 100%", + "height": "40px", +} + +//父组件 EducoderLogin.js +class LoginRegisterComponent extends Component { + constructor(props) { + super(props) + this.state = { + login: "", + password: "", + passwords: "", + seconds: 60, + codes: "", + getverificationcodes: true, + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + s: 'text', + classpass: "text", + readonlyInput: true, + } + } + + + openNotification = (messge) => { + 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 ? + + : + + } + + +
    + + +
    +
    + +
    + ); + } +} + +export default (LoginRegisterComponent); diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 800453b36..5627890ee 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -10,8 +10,12 @@ import axios from 'axios'; import './common.css' const { TabPane } = Tabs; const loginInputsyl = { - "width": " 100%", - "height": "40px", +"width":"434px", +"height": "462px", +"-webkit-box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", +"box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", +"border-radius": "6px", +"background": "#fff" } //父组件EducoderLogin.js @@ -135,6 +139,7 @@ class LoginRegisterComponent extends Component { ; StudyMakeMoney = () => { // 调用父组件方法 this.props.Setshowbool(); + // this.props.Setlogins(3); this.setState({ login: "", password: "", @@ -356,11 +361,11 @@ class LoginRegisterComponent extends Component { } }).then((result) => { //验证有问题{"status":1,"message":"success"} - console.log(result); + // console.log(result); }).catch((error) => { - console.log(error); + // console.log(error); // this.setState({ // login:"", // logins:"", @@ -369,7 +374,6 @@ class LoginRegisterComponent extends Component { } //短信验证 SMSverification = () => { - var url = `/accounts/get_verification_code.json`; axios.get((url), { params: { @@ -378,7 +382,8 @@ class LoginRegisterComponent extends Component { } }).then((result) => { //验证有问题{"status":1,"message":"success"} - console.log(result); + // console.log(result); + this.openNotification("验证码已发送,请注意查收!",2); }).catch((error) => { @@ -407,8 +412,8 @@ class LoginRegisterComponent extends Component { //倒计时 getverificationcode = () => { - if (this.state.Phonenumberisnotcobool === false) { - if (this.state.logins.length === 0) { + if (this.state.Phonenumberisnotcobool === false ||this.state.Phonenumberisnotcobool === undefined) { + if (this.state.logins&&this.state.logins.length === 0) { this.openNotification("请输入手机号或邮箱",2); return }else { @@ -503,6 +508,17 @@ class LoginRegisterComponent extends Component { this.setState({ tab:e.key }) + console.log(e.key); + if(e.key === 0){ + this.setState({ + Phonenumberisnotcos:undefined + }) + }else{ + this.setState({ + Phonenumberisnotco:undefined + }) + + } // this.props.history.push(`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/student_exercise_list?tab=`+e.key) @@ -532,7 +548,7 @@ class LoginRegisterComponent extends Component { // console.log(activeKey); return ( -
    +
    @@ -576,63 +592,64 @@ class LoginRegisterComponent extends Component { + className="font-14 color-grey-9 loginInput" + onBlur={(e) => this.inputOnBlur(e, 1)} + style={{marginTop: '30px', height: '38px'}}> { Phonenumberisnotco && Phonenumberisnotco != "" ?

    - {Phonenumberisnotco} + {Phonenumberisnotco}

    - :
    + :
    } - -
    +
    下次自动登录 - 找回密码 + 找回密码
    -
    } { parseInt(tab[0])==1 &&
    - this.inputOnBlur(e, 2)} - style={{marginTop: '30px'}}> + style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}> { Phonenumberisnotcos && Phonenumberisnotcos != "" ? -

    - - {Phonenumberisnotcos} +

    + {Phonenumberisnotcos}

    - :
    + :
    } -
    - + { getverificationcodes === undefined ? - : getverificationcodes === true ? - + : - } @@ -656,8 +673,9 @@ class LoginRegisterComponent extends Component { {/* style={{height: '0', width: '0', border: 'none', display: "none"}}/>*/} {/**/} - 我已阅读并同意服务协议条款 - + >我已阅读并同意服务协议条款 +
    diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 81198b45c..941217750 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -130,14 +130,15 @@ class Infos extends Component{ let url=`/users/attendance.json` axios.post(url).then((result)=>{ if(result){ - this.setState( - (prevState) => ({ - data : update(prevState.data, {attendance_signed: {$set: true} }) - }) - ) - this.setState({ - next_gold:result.data.next_gold - }) + // this.setState( + // (prevState) => ({ + // data : update(prevState.data, {attendance_signed: {$set: true} }) + // }) + // ) + // this.setState({ + // next_gold:result.data.next_gold + // }) + this.getInfo(this.props.match.params.username); } }).catch((error)=>{ console.log(error); @@ -245,6 +246,9 @@ class Infos extends Component{