dev_aliyun2
harry 5 years ago
parent bcf912832e
commit 9f1393f745

@ -1,15 +1,15 @@
import React, {Component} from "react"; import React, {Component} from "react"
import {SnackbarHOC,getImageUrl} from 'educoder'; import {SnackbarHOC,getImageUrl} from 'educoder'
import axios from 'axios'; import axios from 'axios'
import { import {
Spin, Spin,
Table, Table,
Pagination, Pagination,
} from "antd"; } from "antd"
import Colleagechart from './colleagechart/Colleagechart' import Colleagechart from './colleagechart/Colleagechart'
import Colleagechartzu from './colleagechart/Colleagechartzu' import Colleagechartzu from './colleagechart/Colleagechartzu'
import {TPMIndexHOC} from "../modules/tpm/TPMIndexHOC"; import TPMIndexHOC from "../modules/tpm/TPMIndexHOC"
import NoneData from './../modules/courses/coursesPublic/NoneData'; import NoneData from './../modules/courses/coursesPublic/NoneData'
import './colleagecss/colleage.css'; import './colleagecss/colleage.css';
class College extends Component { class College extends Component {
@ -1196,24 +1196,10 @@ class College extends Component {
className="mysjysltable1" className="mysjysltable1"
pagination={false} pagination={false}
loading={studentsloading} loading={studentsloading}
// onChange={this.TablePaginationsy}
/>} />}
</div> </div>
</div> </div>
} }
{/*<div style={{*/}
{/* width:'100%',*/}
{/* padding:'40px'*/}
{/*}}>*/}
{/* <div className="edu-txt-center ">*/}
{/* <Pagination showQuickJumper current={pagess} onChange={this.paginationonChangess}*/}
{/* pageSize={limitss}*/}
{/* total={student_count}></Pagination>*/}
{/* </div>*/}
{/*</div>*/}
</div> </div>
<div className="" style={{ <div className="" style={{

@ -37,146 +37,67 @@ if (!window['indexHOCLoaded']) {
// TODO css加载完成后再打开页面行为和tpm其他页面一致 // TODO css加载完成后再打开页面行为和tpm其他页面一致
export default function TPMIndexHOC(WrappedComponent) { export default function TPMIndexHOC(WrappedComponent) {
// 这里如果extends WrappedComponent 会出现 WrappedComponent mount twice的问题 // 这里如果extends WrappedComponent 会出现 WrappedComponent mount twice的问题
return class II extends React.Component { return class II extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
window.$('#root').css('position', 'relative') window.$('#root').css('position', 'relative')
this.state = { this.state = {
tpmLoading: true, tpmLoading: true,
resLoading: true, resLoading: true,
Headertop:undefined, Headertop: undefined,
Footerdown:undefined, Footerdown: undefined,
coursedata: {}, coursedata: {},
isRender: false, isRender: false,
AccountProfiletype: false, AccountProfiletype: false,
AccountPhoneemailtype:false, AccountPhoneemailtype: false,
globalLoading: false, globalLoading: false,
dataquerys:{}, dataquerys: {},
isloginCancel:undefined, isloginCancel: undefined,
mygetHelmetapi: null, mygetHelmetapi: null,
} }
} }
// header里面需要有user // header里面需要有user
initCommonState(user) { initCommonState(user) {
// 更新头像后,需要改变参数,不然会被图片缓存影响到 --> 后台已加 ?t=${new Date().getTime() const newUser = Object.assign({}, { ...user }, { image_url: `${user.image_url}` });
const newUser = Object.assign({}, {...user}, { image_url: `${user.image_url}`}); this.setState({
this.setState({ user: newUser,
user: newUser, current_user: newUser
current_user: newUser })
}) }
} showShixun = () => {
showShixun = () => { const { shixunId } = this.props.match.params
const { shixunId } = this.props.match.params const url = `/api/v1/shixuns/${shixunId}/show_shixun`
const url = `/api/v1/shixuns/${shixunId}/show_shixun`
this.setState({ tpmLoading: true })
this.setState({ tpmLoading: true }) axios.get(url,
axios.get(url, {
{ withCredentials: true
withCredentials: true }
} ).then((response) => {
).then((response) => { if (response.data && response.data.shixun) {
if (response.data && response.data.shixun) { this.initCommonState(response.data.current_user)
this.initCommonState(response.data.current_user) response.data.tpmLoading = false;
response.data.tpmLoading = false; this.setState(response.data);
this.setState(response.data); }
}
}).catch((error) => {
}).catch((error) => { console.log(error)
console.log(error) })
}) }
} aboutFocus = () => {
aboutFocus = () => { const { creator, watched } = this.state
const { creator, watched } = this.state /*http://localhost:3000/api/v1/users/155/watch?object_id=156&object_type=user*/
/*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`
const focusUrl = `/api/v1/users/${creator.owner_id}/${watched ? 'unwatch' : 'watch'}?object_id=${creator.owner_id}&object_type=user`
axios.get(focusUrl, {
axios.get(focusUrl,{ })
}) .then((response) => {
.then((response) => { const status = response.data.status;
const status = response.data.status; if (status == 1) {
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({ this.setState({
watched: !watched watched: !watched
}) })
@ -235,38 +156,7 @@ export default function TPMIndexHOC(WrappedComponent) {
dataquerys: {}, dataquerys: {},
}) })
} }
//超管、运维、课堂管理0-2 this.fetchUser(dataqueryss);
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
}
let url = `/users/get_navigation_info.json`; let url = `/users/get_navigation_info.json`;
axios.get(url, { axios.get(url, {
@ -431,78 +321,24 @@ export default function TPMIndexHOC(WrappedComponent) {
}).catch((error) => { }).catch((error) => {
this.gettablogourlnull(); this.gettablogourlnull();
fetchUser = () => { });
let url = `/users/get_user_info.json`
let courseId; }
let query = this.props.location.pathname;
const type = query.split('/'); fetchUser = () => {
if (type[1] == 'classrooms' && type[2]) { let url = `/users/get_user_info.json`
courseId = parseInt(type[2]) let courseId;
// url += `?course_id=${courseId}` let query = this.props.location.pathname;
} const type = query.split('/');
var datay={}; if (type[1] == 'courses' && type[2]) {
if(JSON.stringify(this.state.dataquerys) ==="{}"){ courseId = parseInt(type[2])
datay={ // url += `?course_id=${courseId}`
course_id:isNaN(courseId)?undefined:courseId, }
school:1 var datay = {};
} if (JSON.stringify(this.state.dataquerys) === "{}") {
}else{ datay = {
datay={ course_id: isNaN(courseId) ? undefined : courseId,
course_id:isNaN(courseId)?undefined:courseId, school: 1
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}`
} }
} else { } else {
datay = { datay = {
@ -762,83 +598,38 @@ export default function TPMIndexHOC(WrappedComponent) {
MdifHasAnchorJustScorll: this.MdifHasAnchorJustScorll, MdifHasAnchorJustScorll: this.MdifHasAnchorJustScorll,
scrollToAnchor: this.scrollToAnchor scrollToAnchor: this.scrollToAnchor
render() { };
let{Headertop,Footerdown, isRender, AccountProfiletype,AccountPhoneemailtype}=this.state; var mypath = this.props && this.props.match && this.props.match.path;
const common = { return (
isSuperAdmin:this.isSuperAdmin, <div className="indexHOC">
isAdminOrCreator:this.isAdminOrCreator, {isRender === true ? <LoginDialog
isClassManagement:this.isClassManagement, Modifyloginvalue={() => this.hideLoginDialog()}
isCourseAdmin:this.isCourseAdmin, {...this.props}
{...this.state}
isAdmin: this.isAdmin, /> : ""}
isAdminOrTeacher: this.isAdminOrTeacher, {/* AccountProfile 也用作职业认证 */}
isAssistant:this.isAssistant, {AccountProfiletype === true ? <AccountProfile
isStudent: this.isStudent, hideAccountProfile={() => this.hideAccountProfile()}
isAdminOrStudent: this.isAdminOrStudent, {...this.props}
isNotMember: this.isNotMember, {...this.state}
isCourseEnd: this.isCourseEnd, {...this.dialogObj}
/> : ""}
isUserid:this.state.coursedata&&this.state.coursedata.userid, {/*验证是否注册手机邮箱*/}
fetchUser: this.fetchUser, {AccountPhoneemailtype === true ? <AccountPhoneemail
hideAccountProfile={() => this.hideAccountPhoneemailtype()}
showLoginDialog: this.showLoginDialog, {...this.props}
checkIfLogin: this.checkIfLogin, {...this.state}
showProfileCompleteDialog: this.showProfileCompleteDialog, {...this.dialogObj}
showhideAccountPhoneemailDialog:this.showhideAccountPhoneemailDialog, /> : ""}
checkIfProfileCompleted: this.checkIfProfileCompleted, {
showaccountprofileDialog:this.showaccountprofileDialog, mypath && mypath === "/question" ?
checkIfProfessionalCertification: this.checkIfProfessionalCertification, ""
showProfessionalCertificationDialog: this.showProfessionalCertificationDialog, :
<SiderBar
ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url), {...this.props}
DownloadFileA:(title,url)=>this.DownloadFileA(title,url), {...this.state}
DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url), Headertop={Headertop} />
}
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">
{isRender===true ? <LoginDialog
Modifyloginvalue={()=>this.hideLoginDialog()}
{...this.props}
{...this.state}
/> : ""}
{/* AccountProfile 也用作职业认证 */}
{AccountProfiletype===true ? <AccountProfile
hideAccountProfile={()=>this.hideAccountProfile()}
{...this.props}
{...this.state}
{...this.dialogObj}
/>:""}
{/*验证是否注册手机邮箱*/}
{AccountPhoneemailtype===true?<AccountPhoneemail
hideAccountProfile={()=>this.hideAccountPhoneemailtype()}
{...this.props}
{...this.state}
{...this.dialogObj}
/>:""}
{
mypath&&mypath==="/problemset"?
""
:
<SiderBar
{...this.props}
{...this.state}
Headertop={Headertop}/>
}
{/* 注释掉了1440 影响到了手机屏幕的展示 */} {/* 注释掉了1440 影响到了手机屏幕的展示 */}
@ -911,3 +702,4 @@ export default function TPMIndexHOC(WrappedComponent) {
} }
} }
} }

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import axios from 'axios'; import axios from 'axios';
import { TPMIndexHOC } from '../TPMIndexHOC'; import TPMIndexHOC from '../TPMIndexHOC';
import { SnackbarHOC, getImageUrl } from 'educoder'; import { SnackbarHOC, getImageUrl } from 'educoder';
import ShixunCardList from './shixun-keyword-list'; import ShixunCardList from './shixun-keyword-list';
import ShixunSearchBar from './shixun-search-bar'; import ShixunSearchBar from './shixun-search-bar';

Loading…
Cancel
Save