diff --git a/public/react/src/college/College.js b/public/react/src/college/College.js index 5f3459928..db66f36b7 100644 --- a/public/react/src/college/College.js +++ b/public/react/src/college/College.js @@ -1,15 +1,15 @@ -import React, {Component} from "react"; -import {SnackbarHOC,getImageUrl} from 'educoder'; -import axios from 'axios'; +import React, {Component} from "react" +import {SnackbarHOC,getImageUrl} from 'educoder' +import axios from 'axios' import { Spin, Table, Pagination, -} from "antd"; +} from "antd" import Colleagechart from './colleagechart/Colleagechart' import Colleagechartzu from './colleagechart/Colleagechartzu' -import {TPMIndexHOC} from "../modules/tpm/TPMIndexHOC"; -import NoneData from './../modules/courses/coursesPublic/NoneData'; +import TPMIndexHOC from "../modules/tpm/TPMIndexHOC" +import NoneData from './../modules/courses/coursesPublic/NoneData' import './colleagecss/colleage.css'; class College extends Component { @@ -1196,24 +1196,10 @@ class College extends Component { className="mysjysltable1" pagination={false} loading={studentsloading} - // onChange={this.TablePaginationsy} />} } - {/*
*/} - {/*
*/} - {/* */} - {/*
*/} - - {/*
*/} - -
后台已加 ?t=${new Date().getTime() - const newUser = Object.assign({}, {...user}, { image_url: `${user.image_url}`}); - this.setState({ - user: newUser, - current_user: newUser - }) - } - showShixun = () => { - const { shixunId } = this.props.match.params - const url = `/api/v1/shixuns/${shixunId}/show_shixun` - - this.setState({ tpmLoading: true }) - axios.get(url, - { - withCredentials: true - } - ).then((response) => { - if (response.data && response.data.shixun) { - this.initCommonState(response.data.current_user) - response.data.tpmLoading = false; - this.setState(response.data); - } - - }).catch((error) => { - console.log(error) - }) - } - aboutFocus = () => { - const { creator, watched } = this.state - /*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/ - - const focusUrl = `/api/v1/users/${creator.owner_id}/${watched ? 'unwatch' : 'watch'}?object_id=${creator.owner_id}&object_type=user` - - axios.get(focusUrl,{ - }) - .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{ + return class II extends React.Component { + constructor(props) { + super(props) + window.$('#root').css('position', 'relative') + + this.state = { + tpmLoading: true, + resLoading: true, + Headertop: undefined, + Footerdown: undefined, + coursedata: {}, + + isRender: false, + AccountProfiletype: false, + AccountPhoneemailtype: false, + globalLoading: false, + dataquerys: {}, + isloginCancel: undefined, + mygetHelmetapi: null, + } + } + + // header里面需要有user + initCommonState(user) { + const newUser = Object.assign({}, { ...user }, { image_url: `${user.image_url}` }); + this.setState({ + user: newUser, + current_user: newUser + }) + } + showShixun = () => { + const { shixunId } = this.props.match.params + const url = `/api/v1/shixuns/${shixunId}/show_shixun` + + this.setState({ tpmLoading: true }) + axios.get(url, + { + withCredentials: true + } + ).then((response) => { + if (response.data && response.data.shixun) { + this.initCommonState(response.data.current_user) + response.data.tpmLoading = false; + this.setState(response.data); + } + + }).catch((error) => { + console.log(error) + }) + } + aboutFocus = () => { + const { creator, watched } = this.state + /*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/ + + const focusUrl = `/api/v1/users/${creator.owner_id}/${watched ? 'unwatch' : 'watch'}?object_id=${creator.owner_id}&object_type=user` + + axios.get(focusUrl, { + }) + .then((response) => { + const status = response.data.status; + if (status == 1) { 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,78 +321,24 @@ 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 - }, - - }) - - } - - }).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}` + }); + + } + + fetchUser = () => { + let url = `/users/get_user_info.json` + let courseId; + let query = this.props.location.pathname; + const type = query.split('/'); + if (type[1] == 'courses' && 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 = { @@ -762,83 +598,38 @@ 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 ( -
- {isRender===true ? this.hideLoginDialog()} - {...this.props} - {...this.state} - /> : ""} - {/* AccountProfile 也用作职业认证 */} - {AccountProfiletype===true ? this.hideAccountProfile()} - {...this.props} - {...this.state} - {...this.dialogObj} - />:""} - {/*验证是否注册手机邮箱*/} - {AccountPhoneemailtype===true?this.hideAccountPhoneemailtype()} - {...this.props} - {...this.state} - {...this.dialogObj} - />:""} - { - mypath&&mypath==="/problemset"? - "" - : - - } + }; + var mypath = this.props && this.props.match && this.props.match.path; + return ( +
+ {isRender === true ? this.hideLoginDialog()} + {...this.props} + {...this.state} + /> : ""} + {/* AccountProfile 也用作职业认证 */} + {AccountProfiletype === true ? this.hideAccountProfile()} + {...this.props} + {...this.state} + {...this.dialogObj} + /> : ""} + {/*验证是否注册手机邮箱*/} + {AccountPhoneemailtype === true ? this.hideAccountPhoneemailtype()} + {...this.props} + {...this.state} + {...this.dialogObj} + /> : ""} + { + mypath && mypath === "/question" ? + "" + : + + } {/* 注释掉了1440 影响到了手机屏幕的展示 */} @@ -911,3 +702,4 @@ export default function TPMIndexHOC(WrappedComponent) { } } } + diff --git a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js index 5cfb33527..c67fa539f 100644 --- a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js +++ b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import axios from 'axios'; -import { TPMIndexHOC } from '../TPMIndexHOC'; +import TPMIndexHOC from '../TPMIndexHOC'; import { SnackbarHOC, getImageUrl } from 'educoder'; import ShixunCardList from './shixun-keyword-list'; import ShixunSearchBar from './shixun-search-bar';