调整合作者

chromesetting
杨树明 5 years ago
parent 984e38c55c
commit cb44790e9e

@ -32,7 +32,7 @@ module.exports = {
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
// devtool: "cheap-module-eval-source-map", // devtool: "cheap-module-eval-source-map",
// 开启调试 // 开启调试
devtool: "source-map", // 开启调试 //devtool: "source-map", // 开启调试
// These are the "entry points" to our application. // These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle. // This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS. // The first two entry points enable "hot" CSS and auto-refreshes for JS.

@ -748,7 +748,7 @@ submittojoinclass=(value)=>{
return true return true
} else if (url.startsWith('/courses')&&match.path.startsWith('/courses')) { } else if (url.startsWith('/courses')&&match.path.startsWith('/courses')) {
return true return true
}else if (url.startsWith('/competitions')&&match.path.startsWith('/crowdsourcing')) { }else if (url.startsWith('/competitions')&&match.path.startsWith('/competitions')) {
return true return true
}else if (url.startsWith('/crowdsourcing')&&match.path.startsWith('/crowdsourcing')) { }else if (url.startsWith('/crowdsourcing')&&match.path.startsWith('/crowdsourcing')) {
return true return true
@ -789,7 +789,7 @@ submittojoinclass=(value)=>{
let coursestype=false; let coursestype=false;
let activePackages=false; let activePackages=false;
let activeMoopCases=false; let activeMoopCases=false;
let activeCompetitions=false;
if (match.path === '/forums') { if (match.path === '/forums') {
activeForums = true; activeForums = true;
@ -803,6 +803,8 @@ submittojoinclass=(value)=>{
activePackages = true; activePackages = true;
}else if(match.path.startsWith('/moop_cases')){ }else if(match.path.startsWith('/moop_cases')){
activeMoopCases = true; activeMoopCases = true;
}else if(match.path.startsWith('/competitions')){
activeCompetitions = true;
}else { }else {
activeIndex = true; activeIndex = true;
} }
@ -1097,7 +1099,7 @@ submittojoinclass=(value)=>{
</li> </li>
{/*<li className=""><a href={"/libraries"}>教学案例</a></li>*/} {/*<li className=""><a href={"/libraries"}>教学案例</a></li>*/}
<li className=""> <li className={`${activeCompetitions === true ? 'pr active' : 'pr'}`}>
<a href={this.props.Headertop===undefined?"":this.props.Headertop.competitions_url}>在线竞赛</a> <a href={this.props.Headertop===undefined?"":this.props.Headertop.competitions_url}>在线竞赛</a>
{/*<img className="roundedRectangles"*/} {/*<img className="roundedRectangles"*/}
{/* src={require('./roundedRectangle.png')}*/} {/* src={require('./roundedRectangle.png')}*/}

@ -25,14 +25,14 @@ class TPMCollaborators extends Component {
<React.Fragment> <React.Fragment>
<div className="educontent clearfix mt30 mb80"> <div className="educontent clearfix mt30 mb80">
<div className="with65 fl edu-back-white" > <div className={" with65 fl "}>
<TPMNav {/*<TPMNav*/}
match={match} {/* match={match}*/}
user={user} {/* user={user}*/}
shixun={shixun} {/* shixun={shixun}*/}
{...this.props} {/* {...this.props}*/}
is_jupyter={this.props.is_jupyter} {/* is_jupyter={this.props.is_jupyter}*/}
></TPMNav> {/*></TPMNav>*/}
<Collaborators <Collaborators
{...this.props} {...this.props}
/> />

@ -252,6 +252,9 @@ class TPMIndex extends Component {
//右侧数据 //右侧数据
let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`;
axios.get(shixunsDetailsURL).then((response)=> { axios.get(shixunsDetailsURL).then((response)=> {
if(response.data){
}
this.setState({ this.setState({
TPMRightSectionData: response.data TPMRightSectionData: response.data
}); });

@ -1,14 +1,14 @@
import React, { Component } from 'react'; import React, {Component} from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import {BrowserRouter as Router, Route, Link} from "react-router-dom";
import axios from 'axios'; import axios from 'axios';
import { getImageUrl,} from "educoder"; import {getImageUrl,} from "educoder";
import './TPMright.css'; import './TPMright.css';
import {Icon,Tooltip} from 'antd'; import {Icon, Tooltip} from 'antd';
// import "antd/dist/antd.css"; // import "antd/dist/antd.css";
@ -17,8 +17,8 @@ class TPMRightSection extends Component {
super(props) super(props)
this.state = { this.state = {
TPMRightSection:false, TPMRightSection: false,
clickNewsubscripttype:false clickNewsubscripttype: false
} }
} }
@ -41,40 +41,51 @@ class TPMRightSection extends Component {
// shouldComponentUpdate(nextProps, nextState) { // shouldComponentUpdate(nextProps, nextState) {
// return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData // return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData
// } // }
clickNewsubscript=(val)=>{ clickNewsubscript = (val) => {
if(val===0){ if (val === 0) {
this.setState({ this.setState({
TPMRightSection:true, TPMRightSection: true,
clickNewsubscripttype:true clickNewsubscripttype: true
}) })
}else{ } else {
this.setState({ this.setState({
TPMRightSection:false, TPMRightSection: false,
clickNewsubscripttype:false clickNewsubscripttype: false
}) })
} }
} }
render() { render() {
let {TPMRightSection,clickNewsubscripttype}=this.state; let {TPMRightSection, clickNewsubscripttype} = this.state;
let {TPMRightSectionData}=this.props let {TPMRightSectionData} = this.props
return ( return (
<div> <div>
{ {
TPMRightSectionData===undefined?"": TPMRightSectionData === undefined ? "" :
<div> <div>
<div className="edu-back-white padding40-20 mb10"> <div className="edu-back-white pd302020zuoze mb10">
<p className="font-16 mb20">创建者</p> <p className="font-16 mb20">创建者</p>
<div className="df"> <div className="df">
<a href={TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":`/users/${TPMRightSectionData.creator.login}/courses`}> <a
<img alt="头像" className="radius mr10" height="80" src={getImageUrl(TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":'images/'+TPMRightSectionData.creator.image_url+"?1532489442")} width="80" /> href={TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : `/users/${TPMRightSectionData.creator.login}/courses`}>
<img alt="头像" className="radius mr10" height="36"
src={getImageUrl(TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : 'images/' + TPMRightSectionData.creator.image_url + "?1532489442")}
width="36"/>
</a> </a>
<div className="flex1"> <div className="flex1">
<p className="mb20">{TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.name}</p> <div className="creatorname sortinxdirection space-between">
<div className={"creatornamelist"}>
{TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : TPMRightSectionData.creator.name}
</div>
<div className={"creatornamelist width80center"}>
{TPMRightSectionData.user_shixuns_count}
</div>
</div>
<div className="clearfix"> <div className="clearfix">
<span>发布 {TPMRightSectionData.user_shixuns_count}</span> <span className={"fr color888hezuo"}>发布实训项目</span>
{/*<span className="ml20">粉丝 <span id="user_h_fan_count">{TPMRightSectionData.fans_count}</span></span>*/} {/*<span className="ml20">粉丝 <span id="user_h_fan_count">{TPMRightSectionData.fans_count}</span></span>*/}
{/* <a href="/watchers/unwatch?className=fr+user_watch_btn+edu-default-btn+edu-focus-btn&amp;object_id=3039&amp;object_type=user&amp;shixun_id=61&amp;target_id=3039" className="fr edu-default-btn user_watch_btn edu-focus-btn" data-method="post" data-remote="true" id="cancel_watch" rel="nofollow">取消关注</a> */} {/* <a href="/watchers/unwatch?className=fr+user_watch_btn+edu-default-btn+edu-focus-btn&amp;object_id=3039&amp;object_type=user&amp;shixun_id=61&amp;target_id=3039" className="fr edu-default-btn user_watch_btn edu-focus-btn" data-method="post" data-remote="true" id="cancel_watch" rel="nofollow">取消关注</a> */}
</div> </div>
@ -83,33 +94,43 @@ class TPMRightSection extends Component {
</div> </div>
</div> </div>
{ {
TPMRightSectionData === undefined ? "" :TPMRightSectionData.tags===undefined?"": TPMRightSectionData.tags.length === 0 ? "" : TPMRightSectionData === undefined ? "" : TPMRightSectionData.tags === undefined ? "" : TPMRightSectionData.tags.length === 0 ? "" :
<div className="edu-back-white padding40-20 mb10 relative"> <div className="edu-back-white padding40-20 mb10 relative">
<p className="font-16 mb20">技能标签 <span className="color-grey-c">{TPMRightSectionData.tags.length}</span></p> <p className="font-16 mb20">
<div className={TPMRightSection===false?"newedbox newedboxheight":"newedbox newminheight"}> <span>技能标签</span>
<span className={"sortinxdirection space-between fr"}>
<span className="color888hezuo font-12">已获得 {TPMRightSectionData&&TPMRightSectionData.user_tag_count} / {TPMRightSectionData&&TPMRightSectionData.tag_count} </span>
</span>
</p>
<div className={TPMRightSection === false ? "newedbox newedboxheight" : "newedbox newminheight"}>
<div className="clearfix" id="boxheight"> <div className="clearfix" id="boxheight">
{ TPMRightSectionData.tags.map((item,key)=>{ {TPMRightSectionData.tags.map((item, key) => {
return( return (
<span className={item.status===false?"newedu-filter-btn fl":"edu-filter-btn29BD8B fl"} <span className={item.status === false ? "newedu-filter-btn fl" : "edu-filter-btn29BD8B fl"}
style={{display:item.tag_name===" "||item.tag_name===""?"none":""}} style={{display: item.tag_name === " " || item.tag_name === "" ? "none" : ""}}
key={key}>{item.tag_name}</span> key={key}>{item.tag_name}</span>
)}) )
})
} }
</div> </div>
</div> </div>
<div className={TPMRightSectionData.tags.length>15&&clickNewsubscripttype===false?"newsubscript mb9 color-grey-9":"newsubscript mb9 color-grey-9 none"} <div
className={TPMRightSectionData.tags.length > 15 && clickNewsubscripttype === false ? "newsubscript mb9 color-grey-9" : "newsubscript mb9 color-grey-9 none"}
data-tip-down="显示全部" data-tip-down="显示全部"
onClick={()=>this.clickNewsubscript(0)}><span className="mr8">...</span><Icon type="caret-down" /> onClick={() => this.clickNewsubscript(0)}><span className="mr8">...</span><Icon
type="caret-down"/>
</div> </div>
<div className={clickNewsubscripttype===false?"newsubscript mb9 color-grey-9 none":"newsubscript mb9 color-grey-9"} <div
className={clickNewsubscripttype === false ? "newsubscript mb9 color-grey-9 none" : "newsubscript mb9 color-grey-9"}
data-tip-down="显示全部" data-tip-down="显示全部"
onClick={()=>this.clickNewsubscript(1)}><Icon type="caret-up" /> onClick={() => this.clickNewsubscript(1)}><Icon type="caret-up"/>
</div> </div>
</div> </div>
@ -119,27 +140,29 @@ class TPMRightSection extends Component {
<div className="padding20 edu-back-white mb10 mt10" style={{ <div className="padding20 edu-back-white mb10 mt10" style={{
display: TPMRightSectionData === undefined?"none":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "none" : "block" display: TPMRightSectionData === undefined ? "none" : TPMRightSectionData.paths === undefined ? "" : TPMRightSectionData.paths.length === 0 ? "none" : "block"
}}> }}>
<p className="mb20 font-16 clearfix">所属课程</p> <p className="mb20 font-16 clearfix">所属课程</p>
<div className="recommend-list" > <div className="recommend-list">
{ {
TPMRightSectionData===undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.map((i,k)=>{ TPMRightSectionData === undefined ? "" : TPMRightSectionData.paths === undefined ? "" : TPMRightSectionData.paths.map((i, k) => {
return( return (
<div className="recomments clearfix df" key={k}> <div className="recomments clearfix df" key={k}>
<a href={"/paths/"+i.id} height="96" width="128" target="_blank"> <a href={"/paths/" + i.id} height="96" width="128" target="_blank">
<img alt="实训" height="96" src={"/"+i.image_url} width="128" /> <img alt="实训" height="96" src={"/" + i.image_url} width="128"/>
</a> </a>
<div className="ml10 flex1"> <div className="ml10 flex1">
<a href={"/paths/"+i.id} target="_blank" data-tip-down={i.name} className="color-grey-6 task-hide mb12 recomment-name">{i.name}</a> <a href={"/paths/" + i.id} target="_blank" data-tip-down={i.name}
className="color-grey-6 task-hide mb12 recomment-name">{i.name}</a>
<p className="clearfix mt8 font-12 color-grey-B4"> <p className="clearfix mt8 font-12 color-grey-B4">
<Tooltip placement="bottom" title={"章节"}> <Tooltip placement="bottom" title={"章节"}>
<span className="mr10 fl squareIconSpan"><i className="iconfont icon-shixun fl mr3"></i>{i.stages_count}</span> <span className="mr10 fl squareIconSpan"><i
className="iconfont icon-shixun fl mr3"></i>{i.stages_count}</span>
</Tooltip> </Tooltip>
{/*<Tooltip placement="bottom" title={"经验值"}>*/} {/*<Tooltip placement="bottom" title={"经验值"}>*/}
@ -147,7 +170,8 @@ class TPMRightSection extends Component {
{/*</Tooltip>*/} {/*</Tooltip>*/}
<Tooltip placement="bottom" title={"学习人数"}> <Tooltip placement="bottom" title={"学习人数"}>
<span className="mr10 fl squareIconSpan"><i className="iconfont icon-chengyuan fl mr3"></i>{i.members_count}</span> <span className="mr10 fl squareIconSpan"><i
className="iconfont icon-chengyuan fl mr3"></i>{i.members_count}</span>
</Tooltip> </Tooltip>
</p> </p>
@ -161,25 +185,26 @@ class TPMRightSection extends Component {
</div> </div>
</div> </div>
{TPMRightSectionData === undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.length === 0 ? "" : {TPMRightSectionData === undefined ? "" : TPMRightSectionData.paths === undefined ? "" : TPMRightSectionData.paths.length === 0 ? "" :
this.props.user&&this.props.user.main_site===true?<div className="padding20 edu-back-white" this.props.user && this.props.user.main_site === true ? <div className="padding20 edu-back-white"
style={{ style={{
display: display:
TPMRightSectionData === undefined?"none":TPMRightSectionData.recommands===undefined?"none":TPMRightSectionData.recommands.length === 0 ? "none" : "block" TPMRightSectionData === undefined ? "none" : TPMRightSectionData.recommands === undefined ? "none" : TPMRightSectionData.recommands.length === 0 ? "none" : "block"
}} }}
> >
<p className="mb20 font-16 clearfix">推荐实训</p> <p className="mb20 font-16 clearfix">推荐实训</p>
<div className="recommend-list"> <div className="recommend-list">
{ {
TPMRightSectionData===undefined?"":TPMRightSectionData.recommands===undefined?"":TPMRightSectionData.recommands.map((item,key)=>{ TPMRightSectionData === undefined ? "" : TPMRightSectionData.recommands === undefined ? "" : TPMRightSectionData.recommands.map((item, key) => {
return( return (
<div className="recomments clearfix df" key={key}> <div className="recomments clearfix df" key={key}>
<a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank"> <a href={"/shixuns/" + item.identifier + "/challenges"} target="_blank">
<img alt="69?1526971094" height="96" src={"/"+item.pic} width="128"/> <img alt="69?1526971094" height="96" src={"/" + item.pic} width="128"/>
</a> </a>
<div className="ml10 flex1"> <div className="ml10 flex1">
<Tooltip placement="bottom" title={item.name}> <Tooltip placement="bottom" title={item.name}>
<a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank" className="color-grey-6 task-hide mb12 recomment-name">{item.name}</a> <a href={"/shixuns/" + item.identifier + "/challenges"} target="_blank"
className="color-grey-6 task-hide mb12 recomment-name">{item.name}</a>
</Tooltip> </Tooltip>
<p className="clearfix mt8 font-12 color-grey-B4"> <p className="clearfix mt8 font-12 color-grey-B4">
{item.stu_num} 人学习 {item.stu_num} 人学习
@ -191,7 +216,7 @@ class TPMRightSection extends Component {
}) })
} }
</div> </div>
</div>:"" </div> : ""
} }
</div> </div>
} }

@ -1,5 +1,5 @@
/*bæ°æ ‡ç­¾*/ /*bæ°æ ‡ç­¾*/
.newedu-filter-btn{ .newedu-filter-btn {
display: block; display: block;
float: left; float: left;
padding: 0 9px; padding: 0 9px;
@ -11,24 +11,28 @@
margin-right: 10px; margin-right: 10px;
margin-bottom: 9px; margin-bottom: 9px;
} }
.newedbox{
.newedbox {
/*flex-wrap: wrap;*/ /*flex-wrap: wrap;*/
/*display: -webkit-flex; !* Safari *!*/ /*display: -webkit-flex; !* Safari *!*/
/*display: flex;*/ /*display: flex;*/
width: 360px; width: 360px;
position:relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.newsubscript{
.newsubscript {
position: absolute; position: absolute;
right: 23px; right: 23px;
bottom: 16px; bottom: 16px;
cursor: pointer; cursor: pointer;
} }
.newsubscript:hover{
color:deepskyblue; .newsubscript:hover {
color: deepskyblue;
} }
.edu-filter-btn29BD8B{
.edu-filter-btn29BD8B {
display: block; display: block;
float: left; float: left;
padding: 0 9px; padding: 0 9px;
@ -40,40 +44,71 @@
margin-right: 10px; margin-right: 10px;
margin-bottom: 9px; margin-bottom: 9px;
} }
.relative{
position:relative; .relative {
position: relative;
} }
.newedboxheight{
.newedboxheight {
max-height: 177px; max-height: 177px;
overflow-y: hidden; overflow-y: hidden;
} }
.newminheight{
.newminheight {
/*max-height: 670px;*/ /*max-height: 670px;*/
max-height: 300px; max-height: 300px;
overflow-y: auto; overflow-y: auto;
} }
.delSubentry{ .delSubentry {
font-size:7px; font-size: 7px;
font-family:MicrosoftYaHei; font-family: MicrosoftYaHei;
font-weight:400; font-weight: 400;
color:rgba(76,172,255,1); color: rgba(76, 172, 255, 1);
line-height:9px; line-height: 9px;
cursor: pointer; cursor: pointer;
} }
.operationalter .delSubentry{
font-size:15px !important; .operationalter .delSubentry {
font-size: 15px !important;
line-height: 25px; line-height: 25px;
} }
/*临时的tpiå…³é—­æŒ‰é®æ ·å¼*/ /*临时的tpiå…³é—­æŒ‰é®æ ·å¼*/
.headerRight a { .headerRight a {
color: #1a3f5f; color: #1a3f5f;
} }
/*实训做成弹窗a标签样式调整*/ /*实训做成弹窗a标签样式调整*/
.-task-list-title a:link, .-task-list-title a:visited {color: #bcc6cd;} .-task-list-title a:link, .-task-list-title a:visited {
.-task-list-title a:hover{ color: #bcc6cd;
}
.-task-list-title a:hover {
color: #459be5; color: #459be5;
} }
.headerLeft .-header-right{
.headerLeft .-header-right {
height: 32px; height: 32px;
} }
.creatorname {
font-size: 16px;
color: rgba(51, 51, 51, 1);
}
.creatornamelist {
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.width80center {
width: 80px;
text-align: center;
}
.pd302020zuoze {
padding: 30px 20px 20px;
}

@ -143,8 +143,8 @@
height:34px; height:34px;
line-height: 34px; line-height: 34px;
} }
.hezuozhe660{ .hezuozhe630{
width: 660px; width: 630px;
} }
.color333hezuo{ .color333hezuo{
@ -154,3 +154,24 @@
.color888hezuo{ .color888hezuo{
color:#888888; color:#888888;
} }
.newyslusercjz{
display: inline-block;
position: absolute;
bottom: 0px;
left: -18px;
width: 44px;
height: 18px;
border-radius: 13px;
background: #F38B03;
color: #fff;
}
.newyslusercjztest{
width: 45px;
height: 29px;
font-size: 10px;
color: #fff;
line-height: 18px;
text-align: center;
}

@ -1,18 +1,8 @@
import React, { Component } from 'react'; import React, {Component} from 'react';
import { Redirect } from 'react-router'; import {Modal, Button, Radio, Input, Checkbox, message, Spin, Icon, Pagination} from 'antd';
import {Modal, Button, Radio, Input, Checkbox,message,Spin, Icon,Pagination} from 'antd'; import {getImageUrl, toPath} from 'educoder'
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { CircularProgress } from 'material-ui/Progress';
import { getImageUrl, toPath } from 'educoder'
import axios from 'axios'; import axios from 'axios';
@ -42,46 +32,49 @@ class Collaborators extends Component {
Collaboratorslisttype: false, Collaboratorslisttype: false,
collaborators_deletetype: false, collaborators_deletetype: false,
collaborators_deletevalue: null, collaborators_deletevalue: null,
onSearchcalue:"", onSearchcalue: "",
collaboratorListsum:10, collaboratorListsum: 10,
collaboratorListsumtype:true, collaboratorListsumtype: true,
user_name:undefined, user_name: undefined,
school_name:undefined, school_name: undefined,
spinnings:false, spinnings: false,
useristrue:false, useristrue: false,
mylistansum:6, mylistansum: 6,
limit:20, limit: 20,
} }
} }
componentDidMount() { componentDidMount() {
let id=this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let collaborators=`/shixuns/`+id+`/collaborators.json`; let collaborators = `/shixuns/` + id + `/collaborators.json`;
axios.get(collaborators).then((response)=> { axios.get(collaborators).then((response) => {
if(response.status===200){ if (response.status === 200) {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
}else{ } else {
this.setState({ this.setState({
collaboratorList: response.data collaboratorList: response.data
}); });
} }
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
updatacomponentDiddata = () => { updatacomponentDiddata = (pageNumber) => {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let collaborators = `/shixuns/` + id + `/collaborators.json`; let collaborators = `/shixuns/` + id + `/collaborators.json`;
axios.get(collaborators).then((response) => { axios.get((collaborators),{params:{
page:pageNumber?pageNumber:undefined
}}).then((response) => {
if (response.status === 200) { if (response.status === 200) {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
}else{ } else {
this.setState({ this.setState({
collaboratorList: response.data collaboratorList: response.data
}); });
@ -96,14 +89,14 @@ class Collaborators extends Component {
if (type === "cooperation") { if (type === "cooperation") {
this.setState({ this.setState({
Collaboratorsvisibleadmin: false, Collaboratorsvisibleadmin: false,
Collaboratorslist:[], Collaboratorslist: [],
Searchadmin:[] Searchadmin: []
}); });
} else if (type === "admin") { } else if (type === "admin") {
this.setState({ this.setState({
Collaboratorsvisible: false, Collaboratorsvisible: false,
Collaboratorslist:[], Collaboratorslist: [],
Searchadmin:[] Searchadmin: []
}); });
} else if (type === "collaborators_deletetype") { } else if (type === "collaborators_deletetype") {
this.setState({ this.setState({
@ -116,11 +109,11 @@ class Collaborators extends Component {
this.setState({ this.setState({
Collaboratorslist: [], Collaboratorslist: [],
Searchadmin:undefined, Searchadmin: undefined,
onSearchcalue:"" onSearchcalue: ""
}) })
let admintype = this.props.identity; let admintype = this.props.identity;
if (admintype>4) { if (admintype > 4) {
this.props.showSnackbar("您没有权限"); this.props.showSnackbar("您没有权限");
return return
} }
@ -136,9 +129,9 @@ class Collaborators extends Component {
// this.setState({ // this.setState({
// Collaboratorsvisible: true // Collaboratorsvisible: true
// }) // })
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
}else{ } else {
this.setState({ this.setState({
Collaboratorsvisible: true, Collaboratorsvisible: true,
Collaboratorslist: response.data Collaboratorslist: response.data
@ -157,17 +150,17 @@ class Collaborators extends Component {
value: e.target.value, value: e.target.value,
}); });
} }
onSearchadmins=(e)=>{ onSearchadmins = (e) => {
this.setState({ this.setState({
onSearchcalue:e.target.value onSearchcalue: e.target.value
}) })
} }
onSearchadmin = (value) => { onSearchadmin = (value) => {
let {collaboratorList,user_name,school_name} = this.state; let {collaboratorList, user_name, school_name} = this.state;
this.setState({ this.setState({
// Searchadmin: undefined, // Searchadmin: undefined,
spinnings:true, spinnings: true,
}) })
// if (value === "") { // if (value === "") {
// this.setState({ // this.setState({
@ -179,15 +172,17 @@ class Collaborators extends Component {
// } // }
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/add_collaborators.json"; let url = "/shixuns/" + id + "/add_collaborators.json";
axios.get(url,{params:{ axios.get(url, {
user_name:user_name , params: {
school_name:school_name, user_name: user_name,
}}).then((response) => { school_name: school_name,
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { }
}).then((response) => {
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
this.setState({ this.setState({
spinnings:false spinnings: false
}) })
}else{ } else {
let newlist = response.data.users; let newlist = response.data.users;
for (var i = 0; i < newlist.length; i++) { for (var i = 0; i < newlist.length; i++) {
newlist[i].checked = false newlist[i].checked = false
@ -195,7 +190,7 @@ class Collaborators extends Component {
this.setState({ this.setState({
Searchadmin: newlist, Searchadmin: newlist,
collaboratorList: collaboratorList, collaboratorList: collaboratorList,
spinnings:false spinnings: false
}) })
} }
@ -226,16 +221,16 @@ class Collaborators extends Component {
alltype = false alltype = false
} }
if(newlist.length===0){ if (newlist.length === 0) {
this.setState({ this.setState({
Searchadmin: newlist, Searchadmin: newlist,
allChangechecked: alltype, allChangechecked: alltype,
}) })
}else{ } else {
this.setState({ this.setState({
Searchadmin: newlist, Searchadmin: newlist,
allChangechecked: alltype, allChangechecked: alltype,
useristrue:false useristrue: false
}) })
} }
@ -256,7 +251,7 @@ class Collaborators extends Component {
submit_add_collaborators_form = () => { submit_add_collaborators_form = () => {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let {Searchadmin,collaboratorList} = this.state; let {Searchadmin, collaboratorList} = this.state;
let newlist = Searchadmin; let newlist = Searchadmin;
let user_ids = [] let user_ids = []
if (newlist.length === 0) { if (newlist.length === 0) {
@ -271,9 +266,9 @@ class Collaborators extends Component {
} }
} }
for(var i=0; i<user_ids.length;i++){ for (var i = 0; i < user_ids.length; i++) {
for(var j=0; j<collaboratorList.length;j++){ for (var j = 0; j < collaboratorList.length; j++) {
if(user_ids[i]===collaboratorList[j].user.user_id){ if (user_ids[i] === collaboratorList[j].user.user_id) {
message.error("添加失败,重复添加!"); message.error("添加失败,重复添加!");
return return
@ -281,9 +276,9 @@ class Collaborators extends Component {
} }
} }
if(user_ids.length===0){ if (user_ids.length === 0) {
this.setState({ this.setState({
useristrue:true useristrue: true
}) })
return return
} }
@ -295,8 +290,8 @@ class Collaborators extends Component {
this.props.showSnackbar(response.data.message); this.props.showSnackbar(response.data.message);
this.setState({ this.setState({
Collaboratorsvisibleadmin: false, Collaboratorsvisibleadmin: false,
Collaboratorslist:[], Collaboratorslist: [],
Searchadmin:[] Searchadmin: []
}) })
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -315,11 +310,11 @@ class Collaborators extends Component {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/change_manager.json"; let url = "/shixuns/" + id + "/change_manager.json";
if(addadminrediovalue===undefined){ if (addadminrediovalue === undefined) {
this.setState({ this.setState({
Collaboratorsvisible: false, Collaboratorsvisible: false,
Collaboratorslist:[], Collaboratorslist: [],
Searchadmin:[] Searchadmin: []
}); });
this.props.showSnackbar("所选人员为空,没有更换成功"); this.props.showSnackbar("所选人员为空,没有更换成功");
this.CollaboratorsshowModal("admin") this.CollaboratorsshowModal("admin")
@ -332,8 +327,8 @@ class Collaborators extends Component {
}).then((response) => { }).then((response) => {
this.setState({ this.setState({
Collaboratorsvisible: false, Collaboratorsvisible: false,
Collaboratorslist:[], Collaboratorslist: [],
Searchadmin:[] Searchadmin: []
}); });
this.updatacomponentDiddata(); this.updatacomponentDiddata();
this.props.showSnackbar(response.data.message); this.props.showSnackbar(response.data.message);
@ -371,35 +366,37 @@ class Collaborators extends Component {
}); });
} }
loadMore=()=>{ loadMore = () => {
let {collaboratorList}=this.state; let {collaboratorList} = this.state;
this.setState({ this.setState({
collaboratorListsum:collaboratorList.length, collaboratorListsum: collaboratorList.length,
collaboratorListsumtype:false collaboratorListsumtype: false
}) })
} }
contentViewScrolledit=(e)=>{ contentViewScrolledit = (e) => {
//滑动到底判断 //滑动到底判断
let newscrollTop=parseInt(e.currentTarget.scrollTop); let newscrollTop = parseInt(e.currentTarget.scrollTop);
let allclientHeight=e.currentTarget.clientHeight+newscrollTop; let allclientHeight = e.currentTarget.clientHeight + newscrollTop;
if(e.currentTarget.scrollHeight-allclientHeight===0||e.currentTarget.scrollHeight-allclientHeight===1||e.currentTarget.scrollHeight-allclientHeight===-1){ if (e.currentTarget.scrollHeight - allclientHeight === 0 || e.currentTarget.scrollHeight - allclientHeight === 1 || e.currentTarget.scrollHeight - allclientHeight === -1) {
let {page,collaboratorList,user_name,school_name,Searchadmin} = this.state; let {page, collaboratorList, user_name, school_name, Searchadmin} = this.state;
let newpage=page+1; let newpage = page + 1;
let newSearchadmin=Searchadmin let newSearchadmin = Searchadmin
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/add_collaborators.json"; let url = "/shixuns/" + id + "/add_collaborators.json";
axios.get(url,{params:{ axios.get(url, {
user_name:user_name , params: {
school_name:school_name, user_name: user_name,
page:newpage school_name: school_name,
}}).then((response) => { page: newpage
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { }
}).then((response) => {
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
}else{ } else {
let newlist = response.data.users; let newlist = response.data.users;
for (var i = 0; i < newlist.length; i++) { for (var i = 0; i < newlist.length; i++) {
newlist[i].checked = false newlist[i].checked = false
@ -409,7 +406,7 @@ class Collaborators extends Component {
this.setState({ this.setState({
Searchadmin: newSearchadmin, Searchadmin: newSearchadmin,
collaboratorList: collaboratorList, collaboratorList: collaboratorList,
page:newpage page: newpage
}) })
} }
@ -420,6 +417,9 @@ class Collaborators extends Component {
} }
} }
onChangepageNumber=(pageNumber)=>{
this.updatacomponentDiddata(pageNumber);
}
render() { render() {
let { let {
@ -448,9 +448,9 @@ class Collaborators extends Component {
lineHeight: '30px', lineHeight: '30px',
}; };
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; const antIcon = <Icon type="loading" style={{fontSize: 24}} spin/>;
// console.log(Searchadmin) // console.log(collaboratorList)
return ( return (
<React.Fragment> <React.Fragment>
<style> <style>
@ -466,11 +466,13 @@ class Collaborators extends Component {
` `
} }
</style> </style>
<div className={"edu-back-white"}>
<p className="sortinxdirection sortinxdirectionbox" <p className="sortinxdirection sortinxdirectionbox"
style={{display:this.props.identity<5?"flex":"none"}} style={{display: this.props.identity < 5 ? "flex" : "none"}}
> >
<div className="yslwushiwidth"> <div className="yslwushiwidth">
<p className="edu-default-btn edu-greenback-btn ml20 height28 mt25 color333hezuo">{collaboratorList&&collaboratorList.length}</p> <p
className="edu-default-btn edu-greenback-btn ml20 height28 mt25 color333hezuo">{collaboratorList && collaboratorList.member_count}</p>
</div> </div>
<div className="yslwushiwidth xaxisreverseorder pt25"> <div className="yslwushiwidth xaxisreverseorder pt25">
@ -494,7 +496,7 @@ class Collaborators extends Component {
className="edu-default-btn edu-greenback-btn mr20 heighthezuo34 yslwushiwidthbuton" className="edu-default-btn edu-greenback-btn mr20 heighthezuo34 yslwushiwidthbuton"
>添加合作者</Button> >添加合作者</Button>
<Button type="primary" ghost <Button type="primary" ghost
style={{display:this.props.identity===1?"flex":"none"}} style={{display: this.props.identity === 1 ? "flex" : "none"}}
onClick={() => this.showCollaboratorsvisible("admin")} onClick={() => this.showCollaboratorsvisible("admin")}
className="edu-default-btn mr20 heighthezuo34"> className="edu-default-btn mr20 heighthezuo34">
更换管理员 更换管理员
@ -545,7 +547,7 @@ class Collaborators extends Component {
</Modal> </Modal>
{Collaboratorsvisibleadmin===true?<Modal {Collaboratorsvisibleadmin === true ? <Modal
keyboard={false} keyboard={false}
title="添加合作者" title="添加合作者"
visible={Collaboratorsvisibleadmin} visible={Collaboratorsvisibleadmin}
@ -562,17 +564,21 @@ class Collaborators extends Component {
{/*/>*/} {/*/>*/}
<span className="mr10">姓名或手机号:</span> <span className="mr10">姓名或手机号:</span>
<Input placeholder="请输入姓名或手机号码搜索" value={user_name} onInput={(e) => {this.setState({user_name: e.target.value})}} <Input placeholder="请输入姓名或手机号码搜索" value={user_name} onInput={(e) => {
style={{ width: '215px'}} this.setState({user_name: e.target.value})
}}
style={{width: '215px'}}
></Input> ></Input>
<span className="label ml10 " style={{ minWidth: '36px' }}>单位:</span> <span className="label ml10 " style={{minWidth: '36px'}}>单位:</span>
<Input placeholder="请输入单位名称" className="ml10" value={school_name} onInput={(e) => {this.setState({school_name: e.target.value})}} <Input placeholder="请输入单位名称" className="ml10" value={school_name} onInput={(e) => {
style={{ width: '215px'}} this.setState({school_name: e.target.value})
}}
style={{width: '215px'}}
> >
</Input> </Input>
<a className="task-btn task-btn-orange ml20" onClick={() => this.onSearchadmin()} <a className="task-btn task-btn-orange ml20" onClick={() => this.onSearchadmin()}
style={{ height: '30px', lineHeight: '30px', width: '70px'}} style={{height: '30px', lineHeight: '30px', width: '70px'}}
>搜索</a> >搜索</a>
<p className="clearfix pl35 mt20"> <p className="clearfix pl35 mt20">
<span className="fl edu-txt-w100 task-hide font-bd ml10 edu-txt-left">姓名</span> <span className="fl edu-txt-w100 task-hide font-bd ml10 edu-txt-left">姓名</span>
@ -584,10 +590,11 @@ class Collaborators extends Component {
<div className="mt5" style={{background: '#f7f9fd'}}> <div className="mt5" style={{background: '#f7f9fd'}}>
<Spin indicator={antIcon} spinning={this.state.spinnings}> <Spin indicator={antIcon} spinning={this.state.spinnings}>
<div className="clearfix"> <div className="clearfix">
<ul className="upload_select_box fl" id="search_not_teachers_list" onScroll={this.contentViewScrolledit}> <ul className="upload_select_box fl" id="search_not_teachers_list"
onScroll={this.contentViewScrolledit}>
{Searchadmin === undefined ? <li style={{textAlign: 'center'}}> {Searchadmin === undefined ? <li style={{textAlign: 'center'}}>
<span>请试试搜索一下</span> <span>请试试搜索一下</span>
</li>:Searchadmin.length === 0 ?<NoneData/>: Searchadmin.map((item, key) => { </li> : Searchadmin.length === 0 ? <NoneData/> : Searchadmin.map((item, key) => {
return ( return (
<li key={key} style={{display: item.identify === "专业人士" ? "none" : "block"}}> <li key={key} style={{display: item.identify === "专业人士" ? "none" : "block"}}>
<Checkbox className="fl mr20" checked={item.checked} <Checkbox className="fl mr20" checked={item.checked}
@ -598,7 +605,7 @@ class Collaborators extends Component {
<span <span
title={item.school_name} title={item.school_name}
style={{width: '150px'}} style={{width: '150px'}}
className="span3 color-grey fl edu-txt-w260 task-hide ml50 task-hide" >{item.school_name}</span> className="span3 color-grey fl edu-txt-w260 task-hide ml50 task-hide">{item.school_name}</span>
</li> </li>
) )
}) })
@ -620,14 +627,14 @@ class Collaborators extends Component {
</div> </div>
{useristrue===true?<span className={"color-red"}>请先选择用户</span>:""} {useristrue === true ? <span className={"color-red"}>请先选择用户</span> : ""}
<div className="clearfix edu-txt-center mt20"> <div className="clearfix edu-txt-center mt20">
<a className="pop_close task-btn mb10 mr40 colorFFF" <a className="pop_close task-btn mb10 mr40 colorFFF"
onClick={() => this.CollaboratorsshowModal("cooperation")}>取消</a> onClick={() => this.CollaboratorsshowModal("cooperation")}>取消</a>
<a className="task-btn task-btn-orange" <a className="task-btn task-btn-orange"
onClick={() => this.submit_add_collaborators_form()}>确定</a> onClick={() => this.submit_add_collaborators_form()}>确定</a>
</div> </div>
</Modal>:""} </Modal> : ""}
<style> <style>
{ {
` `
@ -640,36 +647,48 @@ class Collaborators extends Component {
</style> </style>
<div className="pl20" id="collaborators_list_info"> <div className="pl20" id="collaborators_list_info">
{ {
collaboratorList===undefined?"":collaboratorList.map((item,key)=>{ collaboratorList === undefined || collaboratorList.length === 0 ? "" : collaboratorList.members.map((item, key) => {
if(key<collaboratorListsum){ return (
return(
<div className="collaborators-item clearfix sortinxdirection ysltithead" key={key}> <div className="collaborators-item clearfix sortinxdirection ysltithead" key={key}>
<a href={item.user.user_url} target="_blank" className="mr20 fl"> <a href={item.user.user_url} target="_blank" className="mr20 fl edu-position">
<img alt="用户头像" className="radius" height="80" src={getImageUrl("images/"+item.user.image_url)} width="80"/></a> <img alt="用户头像" className="radius" height="48" src={getImageUrl("images/" + item.user.image_url)}
width="48"/>
<span className={item && item.user && item.user.shixun_manager === true ? "ml20 yslusercjz newyslusercjz" : "none "}
// style={{display: this.props.power === false ? "none" : "inline-block"}}
>
<p
className="yslusercjztest newyslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span>
</a>
<div className="fl collaborators-item-middles"> <div className="fl collaborators-item-middles">
<p className="mb10 "> <p className="mb10 ">
<a href={item.user.user_url} target="_blank" className="yslusername">{item.user.name}</a> <a href={item.user.user_url} target="_blank" className="yslusername">{item.user.name}</a>
<span className={item&&item.user&&item.user.shixun_manager === true?"ml20 yslusercjz ":"ml20"} style={{display:this.props.power===false?"none":"inline-block"}}><p className="yslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span> {/*<span*/}
{/* className={item && item.user && item.user.shixun_manager === true ? "ml20 yslusercjz " : "ml20"}*/}
{/* style={{display: this.props.power === false ? "none" : "inline-block"}}><p*/}
{/* className="yslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span>*/}
</p> </p>
<p className="color-grey-B2 font-12 mb10 sortinxdirection mt14"> <p className="color-grey-B2 font-12 mb10 sortinxdirection mt14">
<p className="hezuozhe660 sortinxdirection space-between"> <p className="hezuozhe630 sortinxdirection space-between">
{/*<p className={item.user.identity===null||item.user.identity===undefined||item.user.identity===""?" font-16 ":"mr20 font-16 w70"}>{item.user.identity}</p>*/} {/*<p className={item.user.identity===null||item.user.identity===undefined||item.user.identity===""?" font-16 ":"mr20 font-16 w70"}>{item.user.identity}</p>*/}
<p className={item.user.school_name===null||item.user.school_name===""?"":"mr40 font-16 maxnamewidth150"}>{item.user.school_name}</p> <p
<p className="fabushixunwidth color888hezuo">发布实训项目&nbsp;&nbsp;<span className="ml2">{item.user.user_shixuns_count}</span></p> className={item.user.school_name === null || item.user.school_name === "" ? "" : "mr40 font-16 maxnamewidth150 color888hezuo"}>{item.user.school_name}</p>
<p className="fabushixunwidth color888hezuo">发布实训项目&nbsp;&nbsp;<span
className="ml2">{item.user.user_shixuns_count}</span></p>
</p> </p>
<div className="xaxisreverseorder yslwushiwidth10"> {/*删除n12.17*/}
{item.user.shixun_manager === true ? "" : {/*<div className="xaxisreverseorder yslwushiwidth10">*/}
{/* {item.user.shixun_manager === true ? "" :*/}
<i className="iconfont icon-shanchu newbianji1 color-grey-c font-16 w40" {/* <i className="iconfont icon-shanchu newbianji1 color-grey-c font-16 w40"*/}
style={{display: this.props.power === false ? "none" : "block"}} {/* style={{display: this.props.power === false ? "none" : "block"}}*/}
onClick={() => this.collaborators_delete(item.user.user_id)}> {/* onClick={() => this.collaborators_delete(item.user.user_id)}>*/}
</i> {/* </i>*/}
} {/* }*/}
</div> {/*</div>*/}
</p> </p>
{/*<p className="mb10">*/} {/*<p className="mb10">*/}
@ -682,9 +701,7 @@ class Collaborators extends Component {
</div> </div>
{/*<a href="/watchers/unwatch?object_id=3039&amp;object_type=user&amp;shixun_id=61&amp;target_id=3039" className="fr user_default_btn user_private_btn mt30 font-16 mr20" data-method="post" data-remote="true" rel="nofollow">取消关注</a>*/} {/*<a href="/watchers/unwatch?object_id=3039&amp;object_type=user&amp;shixun_id=61&amp;target_id=3039" className="fr user_default_btn user_private_btn mt30 font-16 mr20" data-method="post" data-remote="true" rel="nofollow">取消关注</a>*/}
</div> </div>
) )
}
}) })
} }
<Modal <Modal
@ -706,23 +723,28 @@ class Collaborators extends Component {
</Modal> </Modal>
</div> </div>
<div {/*<div*/}
className={collaboratorList.length>10&&collaboratorListsumtype===true?"":"none"} {/* className={collaboratorList.length > 10 && collaboratorListsumtype === true ? "" : "none"}*/}
style={{textAlign:'center',borderTop:'1px solid #eee'}}> {/* style={{textAlign: 'center', borderTop: '1px solid #eee'}}>*/}
<a className="loadMore" onClick={this.loadMore}>加载更多</a> {/* <a className="loadMore" onClick={this.loadMore}>加载更多</a>*/}
{/*{*/} {/* /!*{*!/*/}
{/* mylistansum>5?*/} {/* /!* mylistansum>5?*!/*/}
{/* <div className="edu-txt-center mt40 mb40">*/} {/* /!* <div className="edu-txt-center mt40 mb40">*!/*/}
{/* <Pagination showQuickJumper current={page}*/} {/* /!* <Pagination showQuickJumper current={page}*!/*/}
{/* onChange={this.paginationonChanges} pageSize={limit}*/} {/* /!* onChange={this.paginationonChanges} pageSize={limit}*!/*/}
{/* total={mylistansum}*/} {/* /!* total={mylistansum}*!/*/}
{/* ></Pagination>*/} {/* /!* ></Pagination>*!/*/}
{/* </div>*/} {/* /!* </div>*!/*/}
{/* :""*/} {/* /!* :""*!/*/}
{/*}*/} {/* /!*}*!/*/}
{/*</div>*/}
</div> </div>
{collaboratorList && collaboratorList.member_count>10?<div className={"edu-txt-center mt30 "}>
<Pagination showQuickJumper defaultCurrent={1} total={collaboratorList && collaboratorList.member_count} onChange={this.onChangepageNumber} />
</div>:""}
</React.Fragment> </React.Fragment>
); );

Loading…
Cancel
Save