|
|
|
@ -61,7 +61,6 @@ export default function TPMIndexHOC(WrappedComponent) {
|
|
|
|
|
|
|
|
|
|
// header里面需要有user
|
|
|
|
|
initCommonState(user) {
|
|
|
|
|
// 更新头像后,需要改变参数,不然会被图片缓存影响到 --> 后台已加 ?t=${new Date().getTime()
|
|
|
|
|
const newUser = Object.assign({}, { ...user }, { image_url: `${user.image_url}` });
|
|
|
|
|
this.setState({
|
|
|
|
|
user: newUser,
|
|
|
|
@ -99,84 +98,6 @@ export default function TPMIndexHOC(WrappedComponent) {
|
|
|
|
|
.then((response) => {
|
|
|
|
|
const status = response.data.status;
|
|
|
|
|
if (status == 1) {
|
|
|
|
|
const new_author_info = Object.assign({}, creator)
|
|
|
|
|
this.setState({
|
|
|
|
|
watched: !watched
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keyupListener = (e) => {
|
|
|
|
|
if (e.key === "Escape") {
|
|
|
|
|
this.setState({ globalLoading: false })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
|
window.removeEventListener('keyup', this.keyupListener)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
// console.log("TPMIndexHOC========");
|
|
|
|
|
// console.log(this.props);
|
|
|
|
|
window.addEventListener('keyup', this.keyupListener)
|
|
|
|
|
|
|
|
|
|
if(this.props.match.path==="/"){
|
|
|
|
|
// document.title="创新源于实践";
|
|
|
|
|
}else if(this.props.match.path==="/403"){
|
|
|
|
|
document.title="你没有权限访问";
|
|
|
|
|
}else if(this.props.match.path==="/nopage"){
|
|
|
|
|
document.title="没有找到该页面";
|
|
|
|
|
}else if(this.props.match.path==="/shixuns"){
|
|
|
|
|
document.title="实训项目";
|
|
|
|
|
}else if(this.props.match.path==="/paths"){
|
|
|
|
|
document.title="实践课程";
|
|
|
|
|
}else if(this.props.match.path==="/classrooms"){
|
|
|
|
|
document.title="教学课堂";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if(this.props.match.path==="/"){
|
|
|
|
|
// document.title="EduCoder-IT实践教学平台_信息技术类精品课程网_大学生MOOC平台";
|
|
|
|
|
// }else if(this.props.match.path==="/403"){
|
|
|
|
|
// document.title="你没有权限访问";
|
|
|
|
|
// }else if(this.props.match.path==="/nopage"){
|
|
|
|
|
// document.title="没有找到该页面";
|
|
|
|
|
// }else if(this.props.match.path==="/shixuns"){
|
|
|
|
|
// document.title="EduCoder-IT实践教学平台_信息技术类精品课程网_大学生MOOC平台";
|
|
|
|
|
// }else if(this.props.match.path==="/paths"){
|
|
|
|
|
// document.title="实践课程_项目实战开发_web前端开发实训_web后端开发实战_人工智能技术-EduCoder";
|
|
|
|
|
// }else if(this.props.match.path==="/classrooms"){
|
|
|
|
|
// document.title="实训项目_php后端开发_app前端开发_java_python实训_C语言入门课程-EduCoder";
|
|
|
|
|
// }else if(this.props.match.path==="/competitions"){
|
|
|
|
|
// document.title="在线竞赛_计算机应用大赛_编程大赛_大学生设计大赛_全国高校绿色计算大赛-EduCoder";
|
|
|
|
|
// }else if(this.props.match.path==="/moop_cases"){
|
|
|
|
|
// document.title="教学案例-EduCoder";
|
|
|
|
|
// }else if(this.props.match.path==="/forums"){
|
|
|
|
|
// document.title="交流问答-EduCoder";
|
|
|
|
|
// }else if(this.props.match.path==="/forums"){
|
|
|
|
|
// document.title="交流问答-EduCoder";
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
$.ajaxSetup({
|
|
|
|
|
cache: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//帮助后台传参数
|
|
|
|
|
const query = this.props.location.search;
|
|
|
|
|
// const type = query.split('?chinaoocTimestamp=');
|
|
|
|
|
// console.log("Eduinforms12345");
|
|
|
|
|
// console.log(this.foo(query));
|
|
|
|
|
// console.log(JSON.stringify(this.foo(query)));
|
|
|
|
|
var dataqueryss={}
|
|
|
|
|
try {
|
|
|
|
|
var foqus=this.foo(query);
|
|
|
|
|
if(JSON.stringify(foqus) ==="{}"){
|
|
|
|
|
this.setState({
|
|
|
|
|
dataquerys:{},
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
watched: !watched
|
|
|
|
|
})
|
|
|
|
@ -235,38 +156,7 @@ export default function TPMIndexHOC(WrappedComponent) {
|
|
|
|
|
dataquerys: {},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//超管、运维、课堂管理0-2
|
|
|
|
|
isAdminOrCreator = () => {
|
|
|
|
|
return this.state.coursedata&&this.state.coursedata.course_identity < 3
|
|
|
|
|
}
|
|
|
|
|
//超管、运维、课堂管理、老师0-3
|
|
|
|
|
isAdminOrTeacher = () => {
|
|
|
|
|
return this.state.coursedata&&this.state.coursedata.course_identity < 4
|
|
|
|
|
}
|
|
|
|
|
// 助教===4
|
|
|
|
|
isAssistant=()=>{
|
|
|
|
|
return this.state.coursedata&&this.state.coursedata.course_identity ===4
|
|
|
|
|
}
|
|
|
|
|
// 超管、运维、课堂管理、老师、助教0-4
|
|
|
|
|
isAdmin = () => {
|
|
|
|
|
return this.state.coursedata&&this.state.coursedata.course_identity < 5
|
|
|
|
|
}
|
|
|
|
|
// 学生5
|
|
|
|
|
isStudent = () => {
|
|
|
|
|
return this.state.coursedata&&this.state.coursedata.course_identity === 5
|
|
|
|
|
}
|
|
|
|
|
// 超管、运维、课堂管理、老师、助教、学生0-5
|
|
|
|
|
isAdminOrStudent = () => {
|
|
|
|
|
return this.state.coursedata&&this.state.coursedata.course_identity <= 5
|
|
|
|
|
}
|
|
|
|
|
// 游客未登录/非课堂成员6>
|
|
|
|
|
isNotMember = () => {
|
|
|
|
|
return this.state.coursedata&&this.state.coursedata.course_identity >= 6
|
|
|
|
|
}
|
|
|
|
|
//课堂是否已结束
|
|
|
|
|
isCourseEnd = () => {
|
|
|
|
|
return this.state.current_user ? this.state.current_user.course_is_end : false
|
|
|
|
|
}
|
|
|
|
|
this.fetchUser(dataqueryss);
|
|
|
|
|
|
|
|
|
|
let url = `/users/get_navigation_info.json`;
|
|
|
|
|
axios.get(url, {
|
|
|
|
@ -431,12 +321,16 @@ 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]) {
|
|
|
|
|
if (type[1] == 'courses' && type[2]) {
|
|
|
|
|
courseId = parseInt(type[2])
|
|
|
|
|
// url += `?course_id=${courseId}`
|
|
|
|
|
}
|
|
|
|
@ -455,64 +349,6 @@ export default function TPMIndexHOC(WrappedComponent) {
|
|
|
|
|
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
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
fetchUsers = (yslurlobject) => {
|
|
|
|
|
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}`
|
|
|
|
|
}
|
|
|
|
|
} 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
|
|
|
|
@ -762,52 +598,7 @@ export default function TPMIndexHOC(WrappedComponent) {
|
|
|
|
|
MdifHasAnchorJustScorll: this.MdifHasAnchorJustScorll,
|
|
|
|
|
scrollToAnchor: this.scrollToAnchor
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
let{Headertop,Footerdown, isRender, AccountProfiletype,AccountPhoneemailtype}=this.state;
|
|
|
|
|
const common = {
|
|
|
|
|
isSuperAdmin:this.isSuperAdmin,
|
|
|
|
|
isAdminOrCreator:this.isAdminOrCreator,
|
|
|
|
|
isClassManagement:this.isClassManagement,
|
|
|
|
|
isCourseAdmin:this.isCourseAdmin,
|
|
|
|
|
|
|
|
|
|
isAdmin: this.isAdmin,
|
|
|
|
|
isAdminOrTeacher: this.isAdminOrTeacher,
|
|
|
|
|
isAssistant:this.isAssistant,
|
|
|
|
|
isStudent: this.isStudent,
|
|
|
|
|
isAdminOrStudent: this.isAdminOrStudent,
|
|
|
|
|
isNotMember: this.isNotMember,
|
|
|
|
|
isCourseEnd: this.isCourseEnd,
|
|
|
|
|
|
|
|
|
|
isUserid:this.state.coursedata&&this.state.coursedata.userid,
|
|
|
|
|
fetchUser: this.fetchUser,
|
|
|
|
|
|
|
|
|
|
showLoginDialog: this.showLoginDialog,
|
|
|
|
|
checkIfLogin: this.checkIfLogin,
|
|
|
|
|
showProfileCompleteDialog: this.showProfileCompleteDialog,
|
|
|
|
|
showhideAccountPhoneemailDialog:this.showhideAccountPhoneemailDialog,
|
|
|
|
|
checkIfProfileCompleted: this.checkIfProfileCompleted,
|
|
|
|
|
showaccountprofileDialog:this.showaccountprofileDialog,
|
|
|
|
|
checkIfProfessionalCertification: this.checkIfProfessionalCertification,
|
|
|
|
|
showProfessionalCertificationDialog: this.showProfessionalCertificationDialog,
|
|
|
|
|
|
|
|
|
|
ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url),
|
|
|
|
|
DownloadFileA:(title,url)=>this.DownloadFileA(title,url),
|
|
|
|
|
DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url),
|
|
|
|
|
|
|
|
|
|
slowDownload: this.slowDownload,
|
|
|
|
|
showGlobalLoading: this.showGlobalLoading,
|
|
|
|
|
hideGlobalLoading: this.hideGlobalLoading,
|
|
|
|
|
yslslowCheckresults:this.yslslowCheckresults,
|
|
|
|
|
yslslowCheckresultsNo:this.yslslowCheckresultsNo,
|
|
|
|
|
MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll,
|
|
|
|
|
scrollToAnchor:this.scrollToAnchor
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
// console.log("this.props.mygetHelmetapi");
|
|
|
|
|
// console.log(this.props.mygetHelmetapi);
|
|
|
|
|
// console.log("WrappedComponent");
|
|
|
|
|
// console.log(this.props);
|
|
|
|
|
// console.log(this.props.match.path);
|
|
|
|
|
var mypath = this.props && this.props.match && this.props.match.path;
|
|
|
|
|
return (
|
|
|
|
|
<div className="indexHOC">
|
|
|
|
@ -831,7 +622,7 @@ export default function TPMIndexHOC(WrappedComponent) {
|
|
|
|
|
{...this.dialogObj}
|
|
|
|
|
/> : ""}
|
|
|
|
|
{
|
|
|
|
|
mypath&&mypath==="/problemset"?
|
|
|
|
|
mypath && mypath === "/question" ?
|
|
|
|
|
""
|
|
|
|
|
:
|
|
|
|
|
<SiderBar
|
|
|
|
@ -911,3 +702,4 @@ export default function TPMIndexHOC(WrappedComponent) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|