diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index c79a509bc..ae447b758 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -400,7 +400,63 @@ export default function TPMIndexHOC(WrappedComponent) { }).catch((error) => { this.gettablogourlnull(); - }); + fetchUser = () => { + let url = `/users/get_user_info.json` + let courseId; + let query = this.props.location.pathname; + const type = query.split('/'); + if (type[1] == 'classrooms' && type[2]) { + courseId = parseInt(type[2]) + // url += `?course_id=${courseId}` + } + var datay={}; + if(JSON.stringify(this.state.dataquerys) ==="{}"){ + datay={ + course_id:isNaN(courseId)?undefined:courseId, + school:1 + } + }else{ + datay={ + course_id:isNaN(courseId)?undefined:courseId, + school:1, + chinaoocTimestamp:this.state.dataquerys.chinaoocTimestamp, + websiteName:this.state.dataquerys.websiteName, + chinaoocKey:this.state.dataquerys.chinaoocKey, + } + } + axios.get(url,{params: + datay + }, + { + // withCredentials: true + } + ).then((response) => { + /* + { + "username": "黄井泉", + "login": "Hjqreturn", + "user_id": 12, + "image_url": "avatar/User/12", + "admin": true, + "is_teacher": false, + "tidding_count": 0 + } + */ + if(response=== undefined){ + return + } + if (response.data) { + this.initCommonState(response.data) + this.setState({ + tpmLoading: false, + coursedata: { + course_identity: response.data.course_identity >= 0 ? response.data.course_identity : undefined, + course_public: response.data.course_public, + name: response.data.course_name, + userid:response.data.user_id + }, + + }) }