diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 43e44c500..e0333c333 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,13 +43,20 @@ class CoursesBanner extends Component { metype: 0, modalsBottomval: "", antIcon:false, - coursedata:undefined + coursedata:undefined, + user_phone_binded:false, + isRenders:false, + showTrial:false, } + console.log("CoursesBanner"); + console.log("48"); + console.log(props); } - - componentDidMount() { this.updatabanner() + this.setState({ + user_phone_binded :this.props.user_phone_binded, + }) } updatabanner=()=>{ let courseId = this.props.match.params.coursesId; @@ -57,9 +64,19 @@ class CoursesBanner extends Component { axios.get(url).then((result) => { if( result!=undefined){ let data = result.data; - this.setState({ - coursedata: data - }) + if(result.data.status === 407){ + this.setState({ + isRenders:true, + coursedata: data, + showTrial:false, + }) + }else{ + this.setState({ + coursedata: data, + showTrial:true, + + }) + } } }) } @@ -315,265 +332,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)} + > 切换为老师 + :""} + + + {coursedata.switch_to_assistant === true ? + + this.switchidentity(3)} + > 切换为助教 + :""} - {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/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 1f49804e5..a9ea6d002 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -85,7 +85,7 @@ class GraduationTasksSubmitnew extends Component{ handleSubmit=(e) => { let {fileList,selectmemberslist,workslist}=this.state; - + if(fileList.length === 0){ this.setState({ Modalstype:true, 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{
} diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index e9a801f74..9285bd1f0 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -71,7 +71,6 @@ class Trialapplication extends Component { this.setState({ isRenders: true }) - this.props.setTrialapplication(); } return response; }, (error) => { diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 9d8adb920..77d2e13bb 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -213,12 +213,12 @@ export function TPMIndexHOC(WrappedComponent) { return this.state.coursedata&&this.state.coursedata.course_identity === 6 } - setTrialapplication = ()=>{ - this.setState({ - isRenders:true - }) - - } + // setTrialapplication = ()=>{ + // this.setState({ + // isRenders:true + // }) + // + // } /** @@ -288,13 +288,13 @@ export function TPMIndexHOC(WrappedComponent) { } return (
- { - user_phone_binded === undefined? - "" - : - + {/*{*/} + {/* user_phone_binded === undefined?*/} + {/* ""*/} + {/* :*/} + {/* */} - } + {/*}*/} { //验证有问题{"status":1,"message":"success"} - console.log(result); + // console.log(result); + this.openNotification("验证码已发送,请注意查收!",2); }).catch((error) => { @@ -370,7 +371,7 @@ class LoginRegisterComponent extends Component { { Phonenumberisnotco && Phonenumberisnotco != "" ?

- {Phonenumberisnotco} + {Phonenumberisnotco}

:
} diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index d314effca..38ecbac45 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -361,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:"", @@ -374,7 +374,6 @@ class LoginRegisterComponent extends Component { } //短信验证 SMSverification = () => { - var url = `/accounts/get_verification_code.json`; axios.get((url), { params: { @@ -383,7 +382,8 @@ class LoginRegisterComponent extends Component { } }).then((result) => { //验证有问题{"status":1,"message":"success"} - console.log(result); + // console.log(result); + this.openNotification("验证码已发送,请注意查收!",2); }).catch((error) => { @@ -412,7 +412,6 @@ class LoginRegisterComponent extends Component { //倒计时 getverificationcode = () => { - debugger if (this.state.Phonenumberisnotcobool === false ||this.state.Phonenumberisnotcobool === undefined) { if (this.state.logins&&this.state.logins.length === 0) { this.openNotification("请输入手机号或邮箱",2); @@ -509,13 +508,17 @@ class LoginRegisterComponent extends Component { this.setState({ tab:e.key }) - // console.log(e.key); - // if(e.key === 0){ - // this.props.Setlogins(1); - // }else{ - // this.props.Setlogins(2); - // - // } + 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) @@ -590,12 +593,13 @@ class LoginRegisterComponent extends Component { onChange={this.loginInputonChange} name="username" className="font-14 color-grey-9" + onBlur={(e) => this.inputOnBlur(e, 1)} style={{marginTop: '30px', height: '38px'}}> { Phonenumberisnotco && Phonenumberisnotco != "" ?

- {Phonenumberisnotco} + {Phonenumberisnotco}

:
} @@ -629,9 +633,7 @@ class LoginRegisterComponent extends Component { { Phonenumberisnotcos && Phonenumberisnotcos != "" ?

- {/*{Phonenumberisnotcos}*/} - - 请输入手机号码 + {Phonenumberisnotcos}

: