杨树林 6 years ago
commit 654f9cbc97

@ -8,7 +8,6 @@ import { WordsBtn } from 'educoder'
import AccessoryModal2 from '../coursesPublic/AccessoryModal2'
import AccessoryModal from '../coursesPublic/AccessoryModal'
import axios from 'axios'
import ConnectProject from './ConnectProject'
class CommonWorkItem extends Component{
constructor(props){
super(props);
@ -128,7 +127,7 @@ class CommonWorkItem extends Component{
}
</style>
{
mainList && mainList.homeworks.length>0 && mainList.homeworks.map((item,index)=>{
mainList && mainList.homeworks && mainList.homeworks.length>0 && mainList.homeworks.map((item,index)=>{
let canNotLink = !isAdminOrStudent && item.private_icon == true
return(
<div className="mt20 edu-back-white padding02010" key={index} >
@ -196,7 +195,7 @@ class CommonWorkItem extends Component{
<li className="fr">
{ //
item.work_status && item.work_status.indexOf('关联项目') != -1 &&
<ConnectProject className="fl" {...this.props} work={item}></ConnectProject>
<WordsBtn style="blue" className={` font-16 fl}`} onClick={() => this.props.openConnectionProject(item)}>关联项目</WordsBtn>
}
{ //
item.work_status && item.work_status.indexOf('提交作品') != -1 &&

@ -47,9 +47,14 @@ function buildColumns(that, student_works) {
}
let courseId= that.props.match.params.coursesId;
let workId= that.props.match.params.workId;
const { course_group_count } = that.state;
const { course_group_count, homework_status } = that.state;
const isAdmin = that.props.isAdmin()
const isAdminOrStudent = that.props.isAdminOrStudent()
const isStudent = that.props.isStudent()
const isNiPing = homework_status.indexOf('匿评中') != -1
// https://www.trustie.net/issues/21450 分组作业作品列表 学时视角,匿评阶段的列表显示信息不正确
const niPingAndIsStudent = isStudent && isNiPing
let columns = [{
width: 60,
title: '序号',
@ -76,21 +81,24 @@ function buildColumns(that, student_works) {
{text}
</div>
),
}, {
width: 180,
title: '学号',
dataIndex: 'student_id',
key: 'student_id',
render: (text, record) => (
<span>
<a href="javascript:;" style={{color:'#9A9A9A'}}>{record.student_id}</a>
</span>
),
}]
if (!niPingAndIsStudent) {
columns.push({
width: 180,
title: '学号',
dataIndex: 'student_id',
key: 'student_id',
render: (text, record) => (
<span>
<a href="javascript:;" style={{color:'#9A9A9A'}}>{record.student_id}</a>
</span>
),
})
}
// TODO 只有有分班时才显示分班列
if (course_group_count != 0) {
if (course_group_count != 0 && !niPingAndIsStudent) {
columns.push( {
title: '分班',
key: 'group_name',
@ -103,7 +111,7 @@ function buildColumns(that, student_works) {
),
} )
}
if (gotWorkGroup) {
if (gotWorkGroup && !niPingAndIsStudent) {
columns.push({
width: 72,
title: '分组',
@ -154,45 +162,52 @@ function buildColumns(that, student_works) {
<a href="javascript:;" style={{color:'#989898'}}>{update_time ? moment(update_time).format('YYYY-MM-DD hh:mm') : '--'}</a>
</span>
),
}, {
width: 72,
title: '教师评分',
key: 'teacher_score',
dataIndex: 'teacher_score',
render: (teacher_score, record) => (
<Tooltip title={ getScoreTip(teacher_score, teacher_score) }>
}])
if (!niPingAndIsStudent) {
columns.push({
width: 72,
title: '教师评分',
key: 'teacher_score',
dataIndex: 'teacher_score',
render: (teacher_score, record) => (
<Tooltip title={ getScoreTip(teacher_score, teacher_score) }>
<span>
{ renderScore(teacher_score) }
</span>
</Tooltip>
),
})
columns.push({
width: 72,
title: '助教评分',
key: 'teaching_asistant_score',
dataIndex: 'teaching_asistant_score',
/**
* 2名助教进行了评分
平均分85.0
*
*/
render: (teaching_asistant_score, record) => (
<span>
{ renderScore(teacher_score) }
</span>
</Tooltip>
),
}, {
width: 72,
title: '助教评分',
key: 'teaching_asistant_score',
dataIndex: 'teaching_asistant_score',
/**
* 2名助教进行了评分
平均分85.0
*
*/
render: (teaching_asistant_score, record) => (
<span>
{ <Tooltip placement="bottom" title={
getScoreTip(teaching_asistant_score,
<div>
<div>{record.ta_comment_count}名助教进行了评分</div>
<div>{that.state.ta_mode == 1 ? '平均分': '复审分'}{teaching_asistant_score}</div>
</div>) }
>
{renderScore(teaching_asistant_score) }
</Tooltip> }
</span>
),
}])
{ <Tooltip placement="bottom" title={
getScoreTip(teaching_asistant_score,
<div>
<div>{record.ta_comment_count}名助教进行了评分</div>
<div>{that.state.ta_mode == 1 ? '平均分': '复审分'}{teaching_asistant_score}</div>
</div>) }
>
{renderScore(teaching_asistant_score) }
</Tooltip> }
</span>
),
})
}
if (that.state.anonymous_comment) {
/**
@ -242,36 +257,37 @@ function buildColumns(that, student_works) {
),
})
}
columns.push({
width: 72,
title: '最终成绩',
key: 'work_score',
dataIndex: 'work_score',
render: (work_score, record) => {
return (
<span>
<Tooltip title={
getScoreTip(work_score,
<div>
<div>{`${record.user_name}${record.user_login}`}</div>
{ record.ultimate_score ?
<div>最终调整成绩{record.work_score}</div> :
if (!niPingAndIsStudent) {
columns.push({
width: 72,
title: '最终成绩',
key: 'work_score',
dataIndex: 'work_score',
render: (work_score, record) => {
return (
<span>
<Tooltip title={
getScoreTip(work_score,
<div>
{ record.final_score && <div>作业评分{record.final_score}</div> }
{ record.late_penalty >= 0 && <div>迟交扣分{record.late_penalty}</div>}
{ record.absence_penalty >= 0 && <div>缺评扣分{record.absence_penalty}</div>}
{ record.appeal_penalty >= 0 && <div>违规匿评扣分{record.appeal_penalty}</div>}
<div>最终成绩{record.work_score}</div>
</div> }
</div>)
}>
{ renderScore(work_score) }
</Tooltip>
</span>
)
},
})
<div>{`${record.user_name}${record.user_login}`}</div>
{ record.ultimate_score ?
<div>最终调整成绩{record.work_score}</div> :
<div>
{ record.final_score && <div>作业评分{record.final_score}</div> }
{ record.late_penalty >= 0 && <div>迟交扣分{record.late_penalty}</div>}
{ record.absence_penalty >= 0 && <div>缺评扣分{record.absence_penalty}</div>}
{ record.appeal_penalty >= 0 && <div>违规匿评扣分{record.appeal_penalty}</div>}
<div>最终成绩{record.work_score}</div>
</div> }
</div>)
}>
{ renderScore(work_score) }
</Tooltip>
</span>
)
},
})
}
if (isAdminOrStudent || that.props.work_public == true) {
columns.push({
width: 92,

@ -5,6 +5,7 @@ import '../css/members.css'
import { WordsBtn } from 'educoder'
import axios from 'axios'
import InfiniteScroll from 'react-infinite-scroller';
import NoneData from "../coursesPublic/NoneData"
const Search =Input.Search;
const LIMIT = 15
@ -36,7 +37,7 @@ class ConnectProject extends Component{
this.connectProject(radioValue)
}
connectProject = (project_id) => {
let workId=this.props.work.homework_id;
let workId=this.work.homework_id;
const url = `/homework_commons/${workId}/student_works/relate_project.json`
axios.post(url, {
project_id: project_id
@ -75,6 +76,9 @@ class ConnectProject extends Component{
loading: false,
hasMore: result.data.projects.length != 0
})
if (page == 1) {
this.setState({ haveProjects: result.data.projects.length > 0 })
}
}
}).catch((error)=>{
console.log(error);
@ -84,11 +88,12 @@ class ConnectProject extends Component{
if (window.location.port == 3007) {
window.location.href = '/testbdweb.educoder.net/projects/new'
} else {
window.location.href = '/educoder.net/projects/new'
window.location.href = '/projects/new'
}
}
//关联项目
openConnectionProject=()=>{
openConnectionProject=(work)=>{
this.work = work;
this.fetchData()
this.setState({
project_flag:true
@ -104,10 +109,9 @@ class ConnectProject extends Component{
}
render(){
let {project_flag, projects, loading, hasMore }=this.state;
let {project_flag, projects, loading, hasMore, haveProjects }=this.state;
return(
<React.Fragment>
<WordsBtn style="blue" className={` font-16 ${this.props.className || ''}`} onClick={this.openConnectionProject}>关联项目</WordsBtn>
<Modal
visible={project_flag}
title="关联项目"
@ -120,7 +124,7 @@ class ConnectProject extends Component{
>
<div className="newupload_conbox clearfix">
{
projects && !!projects.length &&
(projects && !!projects.length || this.state.keyword) &&
<div>
<Search placeholder="请输入项目名称进行搜索" className="with100"
value={this.state.keyword} onInput={(e) => {this.setState({keyword: e.target.value})}}
@ -145,7 +149,11 @@ class ConnectProject extends Component{
</div>
}
{
(!projects || projects.length == 0) &&
haveProjects && projects.length == 0 &&
<NoneData></NoneData>
}
{
(!haveProjects) &&
<div className="edu-txt-center">
您当前尚未管理任何项目请先<WordsBtn style="blue" className="" onClick={this.toCreateProject}>创建项目</WordsBtn>
</div>

@ -9,6 +9,7 @@ import '../css/busyWork.css'
import CoursesListType from '../coursesPublic/CoursesListType'
import CommonWorkItem from './CommonWorkItem'
import PublishRightnow from './PublishRightnow'
import ConnectProject from './ConnectProject'
import { WordsBtn } from 'educoder'
import Modals from '../../modals/Modals'
@ -53,7 +54,9 @@ class commonWork extends Component{
let {page,search,order}=this.state;
this.getList(page,search,order);
}
openConnectionProject = (work) => {
this.refs['connectProject'].openConnectionProject(work)
}
// 新建
createCommonWork=(type)=>{
@ -338,6 +341,8 @@ class commonWork extends Component{
</div>
</div>
</div> */}
<ConnectProject ref="connectProject" {...this.props}></ConnectProject>
<Titlesearchsection
title={main_category_name}
@ -418,12 +423,14 @@ class commonWork extends Component{
<Spin size="large" spinning={this.state.isSpin}>
<Checkbox.Group style={{"width":"100%"}} onChange={this.onChangeSelect} value={checkBoxValues}>
<CommonWorkItem mainList={mainList} {...this.props} workType={workType} onItemClick={this.onItemClick}></CommonWorkItem>
<CommonWorkItem mainList={mainList} {...this.props} workType={workType} onItemClick={this.onItemClick}
openConnectionProject={this.openConnectionProject}
></CommonWorkItem>
</Checkbox.Group>
</Spin>
{
mainList && mainList.homeworks.length==0 && <NoneData></NoneData>
mainList && mainList.homeworks && mainList.homeworks.length==0 && <NoneData></NoneData>
}
{

@ -46,9 +46,9 @@ class CCommentItem extends Component{
let { item, commentIndex }=this.props;
const url = `/student_works/${studentWorkId}/cancel_appeal.json`
axios.post(url, { data: {
axios.post(url, {
score_id: item.id
}})
})
.then((response) => {
if (response.data.status == 0) {
this.showNotification('撤销成功')
@ -262,9 +262,21 @@ class CCommentItem extends Component{
return(
<div className="ccomment comment_item_cont df clearfix" key={item.id}>
<div className="J_Comment_Face fl">
<a href={`${_origin}/users/${item.user_login}`} target="_blank">
{item.image_url == '--' ?
<a href={`javascript:void(0)`} >
<img alt="用户头像" height="50"
src={`${getUrl()}/images/edu_user/anony.png`} width="50"/>
</a>
: <a href={`${_origin}/users/${item.user_login}`} target="_blank">
<img alt="用户头像" height="50"
src={`${getUrl()}/images/${item.image_url}`}
width="50"/>
</a>}
{/* <a href={`${_origin}/users/${item.user_login}`} target="_blank">
<img alt="用户头像" height="50" src={getImageUrl(`images/${item.image_url}`)} width="50"/>
</a>
</a> */}
</div>
<div className="t_content fl">

@ -358,7 +358,7 @@ class CoursesBanner extends Component {
{
coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":
<Tooltip placement="bottom" title={coursedata&&coursedata.name.length<38?"":coursedata.name}>
<Tooltip placement="bottom" title={coursedata&&coursedata.name && coursedata.name.length<38?"":coursedata.name}>
<span className="font-24 fl bannername">{coursedata.name}</span>
</Tooltip>

@ -105,7 +105,8 @@ function buildColumns(that) {
}
,
});
if (that.hasGraduationModule()) {
const hasGraduationModule = that.hasGraduationModule()
if (hasGraduationModule) {
columns.push({
title: '答辩组',
key: 'graduation_group',
@ -145,7 +146,7 @@ function buildColumns(that) {
},
})
}
if(isAdmin) {
if(isAdmin && hasGraduationModule) {
columns.unshift({
title: '',
dataIndex: 'course_member_id',
@ -184,7 +185,7 @@ class studentsList extends Component{
searchValue:e.target.value
})
}
// approval 2 - 拒绝
onAgree = (record, approval = 1) => {
const courseId = this.props.match.params.coursesId
@ -197,7 +198,7 @@ class studentsList extends Component{
})
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification(`${approval ? '同意' : '拒绝'}`)
this.props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
this.fetchAll(1)
}
})
@ -215,14 +216,22 @@ class studentsList extends Component{
})
this.fetchAll(1);
const isAdminOrTeacher = this.props.isAdminOrTeacher()
const isAdmin = this.props.isAdmin()
isAdminOrTeacher && this.getGroupList();
this.getCourseGroups();
on('addTeacherSuccess', this.addTeacherSuccessListener)
isAdmin && on('updateNavSuccess', this.updateNavSuccess)
}
componentWillUnmount() {
off('addTeacherSuccess', this.addTeacherSuccessListener)
const isAdmin = this.props.isAdmin()
isAdmin && off('updateNavSuccess', this.updateNavSuccess)
}
updateNavSuccess = () => {
this.getCourseGroups()
}
addTeacherSuccessListener = (e, data) => {
// const params = JSON.parse(data)
@ -498,6 +507,7 @@ class studentsList extends Component{
})
}
const isAdminOrTeacher = this.props.isAdminOrTeacher()
const hasGraduationModule = this.hasGraduationModule()
return(
<React.Fragment>
@ -543,9 +553,9 @@ class studentsList extends Component{
`}</style>
<div className="mt20 edu-back-white padding20 teacherList">
<div className="clearfix stu_head" style={{paddingLeft: '15px'}}>
{ isAdmin && <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue} >已选 {checkBoxValues.length} </Checkbox> }
{ isAdmin && hasGraduationModule && <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue} >已选 {checkBoxValues.length} </Checkbox> }
{ <div className="studentList_operation_ul">
{ this.hasGraduationModule() && isAdminOrTeacher && <li className="li_line drop_down">
{ hasGraduationModule && isAdminOrTeacher && <li className="li_line drop_down">
加入答辩组<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"0px","left":"unset", minWidth: '222px'}}>

Loading…
Cancel
Save