diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 2539403af..08d0da42f 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -46,8 +46,8 @@ class PollsController < ApplicationController @polls = member_show_polls.size > 0 ? member_show_polls.public_or_unset : [] else #已分班级的成员,可以查看统一设置和单独设置(试卷是发布在该班级)试卷 # 已发布 当前用户班级分组的 试卷id - not_poll_ids = @course.poll_group_settings.poll_group_not_published.where("course_group_id = #{@member_group_id}").pluck(:poll_id) - @polls = member_show_polls.where.not(id: not_poll_ids) + publish_poll_ids = @course.poll_group_settings.poll_group_published.where("course_group_id = #{@member_group_id}").pluck(:poll_id) + @polls = member_show_polls.unified_setting.or(member_show_polls.where(id: publish_poll_ids)) end else #用户未登陆或不是该课堂成员,仅显示统一设置的(已发布的/已截止的),如有公开,则不显示锁,不公开,则显示锁 @is_teacher_or = 0 diff --git a/app/models/poll.rb b/app/models/poll.rb index 0ea76a8a3..365e46008 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -19,6 +19,7 @@ class Poll < ApplicationRecord scope :poll_by_ids, lambda { |ids| where(id: ids) unless ids.blank? } scope :poll_by_status, lambda { |s| where(polls_status: s) unless s.blank? } scope :poll_group_ended, -> {where("end_time is NOT NULL AND end_time <= ?",Time.now)} + scope :unified_setting, -> { where("unified_setting = ?",true) } scope :poll_search, lambda { |keywords| where("polls_name LIKE ?", "%#{keywords}%") unless keywords.blank?} diff --git a/public/react/src/modules/courses/coursesPublic/ApprausePublic.js b/public/react/src/modules/courses/coursesPublic/ApprausePublic.js new file mode 100644 index 000000000..af5d1acdd --- /dev/null +++ b/public/react/src/modules/courses/coursesPublic/ApprausePublic.js @@ -0,0 +1,167 @@ +import React,{ Component } from "react"; +import { Modal,Checkbox,Upload,Button,Icon,message,Input,Radio} from "antd"; +import { WordNumberTextarea } from 'educoder'; + + +class ApprausePublic extends Component{ + constructor(props){ + super(props); + this.state={ + group_ids:[], + fileList:[], + Inputsval:undefined, + textareavaltype:false, + comment:undefined, + hidden_comment:undefined + } + } + + componentDidMount() { + + + } + + comment=(e)=>{ + this.setState({ + comment:e.target.value + }) + this.hideentyps(e.target.value) + } + + hideentyps=(value)=>{ + if(value===undefined||value===null||value===""){ + + }else{ + this.setState({ + textareavaltype:false + }) + } + } + hidden_comment=(e)=>{ + this.setState({ + hidden_comment:e.target.value + }) + this.hideentyps(e.target.value) + } + + Saves=()=>{ + let{comment,hidden_comment}=this.state; + let commenttype=comment===undefined||comment===null||comment===""; + let hidden_commenttype=hidden_comment===undefined||hidden_comment===null||hidden_comment===""; + + if(commenttype===true&&hidden_commenttype===true){ + this.setState({ + textareavaltype:true + }) + return + } + this.props.SaveAppraiseModal(this.state.comment,this.state.hidden_comment); + } + render(){ + let {textareavaltype,comment,hidden_comment}=this.state; + return( +
+ + + + +
+ +
+

+ 可见(学生可查看老师的评阅内容) +

+ {/**/} + {/*可见 (学生查看老师的评阅内容)*/} + {/*不可见 (仅对课堂老师可见)*/} + {/**/} + this.comment(e)} + value={comment} + maxlength={500} + /> + +

+ 不可见(仅对课堂老师可见) +

+ this.hidden_comment(e)} + value={hidden_comment} + maxlength={500} + /> + +
  • 评阅内容至少有一个不为空
  • +
    + +
    + this.props.Cancel()}>{this.props.Cancelname || '取消'} + this.Saves()}>{this.props.Savesname || '确定'} +
    +
    +
    +
    + ) + } +} +export default ApprausePublic; \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css index 9bdf44e68..326548202 100644 --- a/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css +++ b/public/react/src/modules/courses/coursesPublic/Newshixunmodel.css @@ -308,7 +308,7 @@ backgroud: rgba(234, 234, 234, 1); width: 530px; margin-left: 10px; - margin-top: 25px; + margin-top: 5px; height: 214px !important; } diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js index 1af04bebe..485cdc07c 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForth.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js @@ -116,6 +116,7 @@ class PollDetailTabForth extends Component{ let url=`/polls/${pollId}/poll_setting.json`; axios.get(url).then((result)=>{ if(result){ + this.props.getPollInfo(); this.setState({ polls:result.data.poll, unitSetting:result.data.poll.unified_setting, diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 438df7b05..e1c55625a 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1294,11 +1294,11 @@ class Listofworksstudentone extends Component { record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 : + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===false?"评阅":"详情"} : this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===false?"评阅":"详情"} ) }, @@ -1656,11 +1656,11 @@ class Listofworksstudentone extends Component { record.submitstate === "未开启" ? this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 : + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===false?"评阅":"详情"} : this.Viewstudenttraininginformationtysl2(e, record)} - onClick={() => this.Viewstudenttraininginformationt(record)}>评阅 + onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===false?"评阅":"详情"} ) }, @@ -1886,7 +1886,12 @@ class Listofworksstudentone extends Component { console.log(error); }) } - + AkeyreviewitGetalistofworkstwo=()=>{ + this.setState({ + loadingstate: true, + }) + this.Getalistofworkstwo("", "", "", "", 1, 20); + } // 获取作品列表 Getalistofworkstwo = (ordervlue, checkedValuesine, checkedValuesineinfo, searchtext, page, limit) => { // console.log("获取作品列表");222222222222 @@ -2075,6 +2080,7 @@ class Listofworksstudentone extends Component { stduynumber: teacherdata.student_id, classroom: teacherdata.group_name, cost_time: teacherdata.cost_time, + has_comment:teacherdata.has_comment, submitstate: teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", @@ -2119,6 +2125,7 @@ class Listofworksstudentone extends Component { stduynumber: student_works[i].student_id, classroom: student_works[i].group_name, cost_time: student_works[i].cost_time, + has_comment:teacherdata[i].has_comment, submitstate: student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", @@ -2280,6 +2287,7 @@ class Listofworksstudentone extends Component { stduynumber: teacherdata.student_id, classroom: teacherdata.group_name, cost_time: teacherdata.cost_time, + has_comment:teacherdata.has_comment, submitstate: teacherdata.work_status === 0 ? "未开启" : teacherdata.work_status === 1 ? "未通关" : teacherdata.work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", @@ -2642,6 +2650,7 @@ class Listofworksstudentone extends Component { stduynumber: student_works[i].student_id, classroom: student_works[i].group_name, cost_time: student_works[i].cost_time, + has_comment:teacherdata[i].has_comment, submitstate: student_works[i].work_status === 0 ? "未开启" : student_works[i].work_status === 1 ? "未通关" : student_works[i].work_status === 2 ? "按时通关" : "迟交通关", // updatetime:this.state.teacherdata.student_works[i].update_time, // updatetime:"", diff --git a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js index d4ccb2af9..ca31f9fc8 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunHomeworkPage.js @@ -6,18 +6,20 @@ import { notification, Spin } from "antd"; -import '../css/members.css'; -import "../common/formCommon.css"; -import '../css/Courses.css'; -import './style.css'; -import '../css/busyWork.css'; -import '../poll/pollStyle.css'; +import ApprausePublic from "../coursesPublic/ApprausePublic"; import Listofworksstudentone from './Listofworksstudentone'; import Trainingjobsetting from './Trainingjobsetting'; import Workquestionandanswer from './Workquestionandanswer'; import CoursesListType from '../coursesPublic/CoursesListType'; import ShixunStudentWork from "./ShixunStudentWork"; import Startshixuntask from "../coursesPublic/Startshixuntask"; +import '../css/members.css'; +import "../common/formCommon.css"; +import '../css/Courses.css'; +import './style.css'; +import '../css/busyWork.css'; +import '../poll/pollStyle.css'; + import TPMMDEditor from "../../tpm/challengesnew/TPMMDEditor"; import DownloadMessageysl from "../../modals/DownloadMessageysl"; @@ -41,6 +43,7 @@ class ShixunHomeworkPage extends Component { ModalsType:false, mylistisSpin:false, Showupdateinstructions:false, + AppraiseModaltype:false } } @@ -189,8 +192,41 @@ class ShixunHomeworkPage extends Component { this.props.history.replace(`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.category_id === undefined ? "" : jobsettingsdatapage.data.category.category_id}`); } + + Akeyreviewit=()=>{ + this.setState({ + AppraiseModaltype:true + }) + } + + hideAppraiseModaltype=()=>{ + this.setState({ + AppraiseModaltype:false + }) + } + + SaveAppraiseModal=(comment,hidden_comment)=>{ + let url = `/homework_commons/${this.props.match.params.homeworkid}/batch_comment.jsonr` + axios.post(url,{ + comment: comment, + hidden_comment: hidden_comment, + } + ) + .then((response) => { + if (response.data.status == 0) { + this.props.showNotification('一键评阅成功') + this.hideAppraiseModaltype() + this.child.AkeyreviewitGetalistofworkstwo() + } else { + + } + }) + .catch( (error) =>{ + + }); + } render() { - let {tab, teacherdatapage, jobsettingsdatapage} = this.state; + let {tab, teacherdatapage, jobsettingsdatapage,AppraiseModaltype} = this.state; const isAdmin = this.props.isAdmin(); // console.log(119) @@ -207,6 +243,17 @@ class ShixunHomeworkPage extends Component { loadtype={false} > + + {AppraiseModaltype===true?this.hideAppraiseModaltype()} + SaveAppraiseModal={(comment,hidden_comment)=>this.SaveAppraiseModal(comment,hidden_comment)} + />:""} + +
    { @@ -313,10 +360,17 @@ class ShixunHomeworkPage extends Component { this.homeworkstarts(this.child)}>立即发布 : "" : ""} + {this.props.isAdmin() ? teacherdatapage && teacherdatapage.code_review === true ? this.workshowmodels(this.child)}>代码查重 : "" : ""} + + {parseInt(tab) === 0 ?this.props.isAdmin() ? + jobsettingsdatapage === undefined ? [""] : jobsettingsdatapage.data.homework_status[0] === "未发布" ? "" : + this.Akeyreviewit()}>一键评阅 + : "":""} + { parseInt(tab)===1? this.props.isAdmin() ? diff --git a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css index 9a85f33d4..003002749 100644 --- a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css +++ b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css @@ -733,7 +733,7 @@ a.white-btn.use_scope-btn:hover{ backgroud: rgba(234, 234, 234, 1); width: 530px; margin-left: 10px; - margin-top: 25px; + margin-top: 5px; height: 214px !important; }