From 0f1211f555a0cb5b481d977a1e8f0946f30fe15a Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Sat, 22 Jun 2019 15:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0=20?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=A1=86=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 477 +++++++++--------- .../src/modules/login/Trialapplication.js | 1 - public/react/src/modules/tpm/TPMIndexHOC.js | 24 +- 3 files changed, 262 insertions(+), 240 deletions(-) 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/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?*/} + {/* ""*/} + {/* :*/} + {/* */} - } + {/*}*/}