From 86eae252e8936b2de36037bbfee0ed517830a284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 20 Jun 2019 16:39:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busyWork/reply/CommonWorkAppraiseReply.js | 2 +- .../tasks/GraduationTasksappraiseReply.js | 2 +- .../GraduationTasksappraiseReplyChild.js | 2 +- .../shixunHomework/Workquestionandanswer.js | 2 +- .../boards/TopicDetail.js | 0 .../busyWork/CommonWorkAppraise.js | 0 .../busyWork/reply/CommonWorkAppraiseReply.js | 315 +++++++++++ .../common/CommentsHelper.js | 0 .../tasks/GraduationTasksappraiseReply.js | 193 +++++++ .../GraduationTasksappraiseReplyChild.js | 103 ++++ .../modules/{Courses => courses}/poll/Poll.js | 0 .../shixunHomework/Workquestionandanswer.js | 511 ++++++++++++++++++ .../react/src/modules/login/EducoderLogin.js | 342 ++++++------ 13 files changed, 1297 insertions(+), 175 deletions(-) rename public/react/src/modules/{Courses => courses}/boards/TopicDetail.js (100%) rename public/react/src/modules/{Courses => courses}/busyWork/CommonWorkAppraise.js (100%) create mode 100644 public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js rename public/react/src/modules/{Courses => courses}/common/CommentsHelper.js (100%) create mode 100644 public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js create mode 100644 public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js rename public/react/src/modules/{Courses => courses}/poll/Poll.js (100%) create mode 100644 public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js diff --git a/public/react/src/modules/Courses/busyWork/reply/CommonWorkAppraiseReply.js b/public/react/src/modules/Courses/busyWork/reply/CommonWorkAppraiseReply.js index 740d1b66b..7e0c267a4 100644 --- a/public/react/src/modules/Courses/busyWork/reply/CommonWorkAppraiseReply.js +++ b/public/react/src/modules/Courses/busyWork/reply/CommonWorkAppraiseReply.js @@ -11,7 +11,7 @@ import GraduationTasksappraiseMainEditor from '../../graduation/tasks/Graduation import CCommentItem from '../../common/comments/CCommentItem'; import '../../../forums/Post.css'; import '../../../comment/Comment.css'; -import '../../../courses/common/courseMessage.css'; +import '../../common/courseMessage.css'; import '../../graduation/tasks/GraduationTasksappraiseReply.css'; import './CommonWorkAppraiseReply.css'; diff --git a/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReply.js b/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReply.js index 372690d1c..69ab8ba79 100644 --- a/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReply.js +++ b/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReply.js @@ -7,7 +7,7 @@ import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHO import GraduationTasksappraiseReplyChild from './GraduationTasksappraiseReplyChild'; import '../../../forums/Post.css' import '../../../comment/Comment.css' -import '../../../courses/common/courseMessage.css' +import '../../common/courseMessage.css' import './GraduationTasksappraiseReply.css' const REPLY_PAGE_COUNT = 10 diff --git a/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReplyChild.js b/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReplyChild.js index 11139112e..094f8d96f 100644 --- a/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReplyChild.js +++ b/public/react/src/modules/Courses/graduation/tasks/GraduationTasksappraiseReplyChild.js @@ -5,7 +5,7 @@ import GraduationTasksappraiseMainEditor from './GraduationTasksappraiseMainEdit import Graduationtaskitem from './Graduationtaskitem' import '../../../forums/Post.css' import '../../../comment/Comment.css' -import '../../../courses/common/courseMessage.css' +import '../../common/courseMessage.css' import './GraduationTasksappraiseReply.css' import ModulationModal from "../../coursesPublic/ModulationModal"; import Modals from '../../../modals/Modals'; diff --git a/public/react/src/modules/Courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/Courses/shixunHomework/Workquestionandanswer.js index 06a4924fa..419bca1b5 100644 --- a/public/react/src/modules/Courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/Courses/shixunHomework/Workquestionandanswer.js @@ -1,7 +1,7 @@ import React, {Component} from "react"; import CoursesListType from '../coursesPublic/CoursesListType'; import {WordsBtn,ActionBtn,markdownToHTML} from 'educoder'; -import GraduateTopicReply from '../../courses/graduation/topics/GraduateTopicReply' +import GraduateTopicReply from '../graduation/topics/GraduateTopicReply' import MemoDetailMDEditortwo from '../../forums/MemoDetailMDEditortwo' import { Form, diff --git a/public/react/src/modules/Courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js similarity index 100% rename from public/react/src/modules/Courses/boards/TopicDetail.js rename to public/react/src/modules/courses/boards/TopicDetail.js diff --git a/public/react/src/modules/Courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js similarity index 100% rename from public/react/src/modules/Courses/busyWork/CommonWorkAppraise.js rename to public/react/src/modules/courses/busyWork/CommonWorkAppraise.js diff --git a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js new file mode 100644 index 000000000..740d1b66b --- /dev/null +++ b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js @@ -0,0 +1,315 @@ +import React,{ Component } from "react"; +import { Pagination } from "antd"; + +import update from 'immutability-helper'; +import axios from 'axios'; +import moment from 'moment'; +import _ from 'lodash'; + +import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC'; +import GraduationTasksappraiseMainEditor from '../../graduation/tasks/GraduationTasksappraiseMainEditor'; +import CCommentItem from '../../common/comments/CCommentItem'; +import '../../../forums/Post.css'; +import '../../../comment/Comment.css'; +import '../../../courses/common/courseMessage.css'; + +import '../../graduation/tasks/GraduationTasksappraiseReply.css'; +import './CommonWorkAppraiseReply.css'; +import ModulationModal from "../../coursesPublic/ModulationModal"; +import Modals from '../../../modals/Modals'; +const REPLY_PAGE_COUNT = 10 +const $ = window.$; + +/* + +*/ +class CommonWorkAppraiseReply extends Component{ + constructor(props){ + super(props); + + this.editorRef = React.createRef(); + + this.state={ + total_count: 0, + comment_scores: [], + } + } + + fetchAllComments = () => { + let category_id= this.props.match.params.category_id; + // const url = `/graduation_works/${category_id}/comment_list.json` + const task_id = this.props.task_id + const url = `/student_works/${task_id}/comment_list.json` + axios.get(url).then((result)=>{ + if(result.data.comment_scores){ + const comment_scores = result.data.comment_scores.map(item => { + return this.transformReply(item) + }) + this.setState({ + ...result.data, + comment_scores + }) + } + }).catch((error)=>{ + console.log(error) + }) + } + replySuccess = () => { + this.fetchAllComments() + } + componentDidMount(){ + this.fetchAllComments() + } + addSuccess = () => { + this.fetchAllComments() + } + + transformReply = (reply, children = []) => { + const isAdmin = this.props.isAdmin() + const isSuperAdmin = this.props.isSuperAdmin() + if (reply.appeal_info && reply.appeal_info.time) { + reply.appeal_info.user_info = { + "user_name": reply.appeal_info.user_name, + "user_login": reply.appeal_info.user_login, + "user_image_url": reply.appeal_info.user_image_url + } + reply.appeal_info.is_appeal_info = true + reply.appeal_info.appeal_status = reply.appeal_status + reply.appeal_info.score_id = reply.score_id + reply.journals.push(reply.appeal_info) + reply.journals = _.orderBy(reply.journals, 'time', 'asc') + } + + return { + isSuperAdmin: isSuperAdmin, + admin: isAdmin, // + journals: reply.journals, + appeal_status: reply.appeal_status, + attachments: reply.attachments, + can_appeal: reply.can_appeal, + can_reply: reply.can_reply, + child_message_count: reply.child_message_count, + id: reply.comment_id, + // time: moment(reply.comment_time).fromNow(), + time: moment(reply.comment_time).format('YYYY-MM-DD HH:mm'), + + image_url: reply.user_image_url, + user_id: reply.user_id, + user_login: reply.user_login, + username: reply.user_name, + content: reply.content, + + score: reply.score, + delete: reply.delete, + is_invalid: reply.is_invalid, + comment_role: reply.comment_role + } + } + onDelete = (item) => { + this.props.confirm({ + content: '确定要删除这个评阅吗?', + okText: '确定', + cancelText: '取消', + onOk: () => { + let category_id= this.props.match.params.category_id; + const url = `/graduation_works/${category_id}/delete_score.json?comment_id=${item.id}` + axios.delete(url).then((result)=>{ + if(result.data.status == 0){ + this.props.showNotification('删除成功') + this.fetchAllComments() + } + }).catch((error)=>{ + console.log(error) + }) + }, + onCancel() { + console.log('Cancel'); + }, + }); + + } + + showModulationtype=(id)=>{ + // console.log(id) + + this.setState({ + Modulationtype:true, + operationId:id + }) + + } + + cancelmodel=()=>{ + + this.setState({ + Modalstype:false, + Loadtype:false, + visible:false, + Modulationtype:false, + Allocationtype:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", + }) + + } + + + saveModulationModal=(value,num)=>{ + console.log(value,num) + let {operationId}=this.state; + let studentWorkId =this.props.match.params.studentWorkId; + // console.log(value,num) + let url ="/student_works/"+studentWorkId+"/adjust_score.json"; + axios.post(url,{ + score:num, + comment:value + }).then((result)=>{ + // console.log(result) + if(result.data.status===0){ + // this.setState({ + // Modalstype:true, + // Allocationtype:false, + // Modalstopval:result.data.message, + // ModalSave:this.cancelmodel, + // }) + this.cancelmodel() + this.props.showNotification('调分成功') + this.props.onReplySuccess && this.props.onReplySuccess() + this.fetchAllComments(); + + } + + }).catch((error)=>{ + console.log(error) + }) + + } + onReply = (params) => { + const { task_id } = this.props; + const replyUrl = `/student_works/${task_id}/add_score.json` + axios.post(replyUrl, params).then((response)=>{ + if(response.data.status == 0) { + this.editorRef.current.clearInputs() + this.fetchAllComments(); + this.props.onReplySuccess && this.props.onReplySuccess() + } + + }).catch((error)=>{ + console.log(error) + }) + } + render(){ + let { total_count, comments, pageCount, comment_scores, allow_score } = this.state + const { current_user, memo, homework_status } = this.props + const isAdmin = this.props.isAdmin() + + const isNiPing = homework_status && homework_status.indexOf('匿评中') != -1 + /** + isAdmin || 评阅入口:超级管理员、老师和助教显示; -》 改成admin也不显示 + 匿评人:匿评期间显示 + */ + const needNiPingEditor = (allow_score && isNiPing); + if (!needNiPingEditor && comment_scores.length == 0) { + return '' + } + return( + +
+
+ + + + + {this.state.Modulationtype===true?this.saveModulationModal(value,num)} + closable={false} + footer={null} + destroyOnClose={true} + centered={true} + />:""} + + {/*
*/} + {/*

{datalist&&datalist.task_name}

*/} + {/*返回*/} + {/*{this.props.isStudent()?补交附件:""}*/} + {/*
*/} + + + + {/* { + (!!comment_scores.length && +
+ 全部评阅 + ({comment_scores.length}) +
)} */} +
+ {!!comment_scores.length &&
+ 全部评阅{comment_scores.length===0?"":`(${comment_scores.length})`} + + {/*
*/} + + {/* true: 老师身份显示“调分”入口,false: 不显示调分入口 */} + {isAdmin && !allow_score && + this.showModulationtype(this.props.task_id)}>调分 + } +
} + + {needNiPingEditor && } +
+ +
+ {/* + .course-message .panel-comment_item { + margin-top: ${needNiPingEditor ? 56 : 28}px; + } + */} + + {!!comment_scores.length &&
+ { comment_scores.map((item, index) => { + return + }) } +
} +
+ + +
+
+
+ ) + } +} +export default ImageLayerOfCommentHOC() (CommonWorkAppraiseReply); \ No newline at end of file diff --git a/public/react/src/modules/Courses/common/CommentsHelper.js b/public/react/src/modules/courses/common/CommentsHelper.js similarity index 100% rename from public/react/src/modules/Courses/common/CommentsHelper.js rename to public/react/src/modules/courses/common/CommentsHelper.js diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js new file mode 100644 index 000000000..372690d1c --- /dev/null +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js @@ -0,0 +1,193 @@ +import React,{ Component } from "react"; +import { Pagination } from "antd"; +import axios from 'axios' +import moment from 'moment' +import { getImageUrl,WordsBtn } from 'educoder'; +import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC'; +import GraduationTasksappraiseReplyChild from './GraduationTasksappraiseReplyChild'; +import '../../../forums/Post.css' +import '../../../comment/Comment.css' +import '../../../courses/common/courseMessage.css' +import './GraduationTasksappraiseReply.css' + +const REPLY_PAGE_COUNT = 10 +const $ = window.$; + +/* + +*/ +class GraduationTasksappraiseReply extends Component{ + constructor(props){ + super(props); + this.state={ + total_count: 0, + comment_scores: [] + } + } + + fetchAllComments = () => { + let category_id= this.props.match.params.category_id; + const url = `/graduation_works/${category_id}/comment_list.json` + axios.get(url).then((result)=>{ + if(result.data.comment_scores){ + const comment_scores = result.data.comment_scores.map(item => { + return this.transformReply(item) + }) + this.setState({ + ...result.data, + comment_scores + }) + } + }).catch((error)=>{ + console.log(error) + }) + } + componentDidMount(){ + this.fetchAllComments() + } + addSuccess = () => { + this.fetchAllComments() + } + + transformReply = (reply, children = []) => { + const isAdmin = this.props.isAdmin() + const isSuperAdmin = this.props.isSuperAdmin() + return { + isSuperAdmin: isSuperAdmin, + admin: isAdmin, // + children: children, + child_message_count: reply.child_message_count, + id: reply.comment_id, + image_url: reply.user_image_url, + // time: moment(reply.comment_time).fromNow(), + time: moment(reply.comment_time).format('YYYY-MM-DD HH:mm'), + user_login: reply.user_login, + username: reply.user_name, + content: reply.content, + + score: reply.score, + delete: reply.delete, + is_invalid: reply.is_invalid, + comment_role: reply.comment_role + } + } + onDelete = (item) => { + this.props.confirm({ + content: '确定要删除这个评阅吗?', + okText: '确定', + cancelText: '取消', + onOk: () => { + let category_id= this.props.match.params.category_id; + const url = `/graduation_works/${category_id}/delete_score.json?comment_id=${item.id}` + axios.delete(url).then((result)=>{ + if(result.data.status == 0){ + this.props.showNotification('删除成功') + this.fetchAllComments() + } + }).catch((error)=>{ + console.log(error) + }) + }, + onCancel() { + console.log('Cancel'); + }, + }); + + } + + showModulationtype=(id)=>{ + // console.log(id) + + this.setState({ + Modulationtype:true, + operationId:id + }) + + } + + cancelmodel=()=>{ + + this.setState({ + Modalstype:false, + Loadtype:false, + visible:false, + Modulationtype:false, + Allocationtype:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", + }) + + } + + + saveModulationModal=(value,num)=>{ + console.log(value,num) + let {operationId}=this.state; + // console.log(value,num) + let url ="/graduation_works/"+operationId+"/adjust_score.json"; + axios.post(url,{ + score:num, + comment:value + }).then((result)=>{ + // console.log(result) + if(result.data.status===0){ + this.setState({ + Modalstype:true, + Allocationtype:false, + Modalstopval:result.data.message, + ModalSave:this.cancelmodel, + }) + } + + }).catch((error)=>{ + console.log(error) + }) + + } + + render(){ + let { total_count, comments, pageCount, comment_scores } = this.state + const { current_user, memo } = this.props + const isAdmin = this.props.isAdmin(); + const isStudent=this.props.isStudent(); + + + return( + +
+ {isStudent===true?comment_scores.length===0? +
+
+
+ +

没有数据可以显示!

+
+
+
: + this.showModulationtype(id)} + saveModulationModal={(value,num)=>this.saveModulationModal(value,num)} + addSuccess={this.addSuccess} + onDelete={this.onDelete} + /> + : + this.showModulationtype(id)} + saveModulationModal={(value,num)=>this.saveModulationModal(value,num)} + addSuccess={this.addSuccess} + onDelete={this.onDelete} + /> + } +
+
+ ) + } +} +export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReply); \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js new file mode 100644 index 000000000..11139112e --- /dev/null +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js @@ -0,0 +1,103 @@ +import React,{ Component } from "react"; +import { Pagination } from "antd"; +import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC' +import GraduationTasksappraiseMainEditor from './GraduationTasksappraiseMainEditor' +import Graduationtaskitem from './Graduationtaskitem' +import '../../../forums/Post.css' +import '../../../comment/Comment.css' +import '../../../courses/common/courseMessage.css' +import './GraduationTasksappraiseReply.css' +import ModulationModal from "../../coursesPublic/ModulationModal"; +import Modals from '../../../modals/Modals'; +const REPLY_PAGE_COUNT = 10 +const $ = window.$; + +class GraduationTasksappraiseReplyChild extends Component{ + constructor(props){ + super(props); + this.state={ + + } + } + + render(){ + let { total_count, comments, pageCount, comment_scores} = this.props; + + const isAdmin = this.props.isAdmin(); + const isStudent=this.props.isStudent(); + + + return( + + +
+ + + + + {this.props.Modulationtype===true?this.props.saveModulationModal(value,num)} + closable={false} + footer={null} + destroyOnClose={true} + centered={true} + />:""} + + {/*
*/} + {/*

{datalist&&datalist.task_name}

*/} + {/*返回*/} + {/*{this.props.isStudent()?补交附件:""}*/} + {/*
*/} + {this.props.ultimate===true? isAdmin && +
+ this.props.showModulationtype(this.props.task_id)}>调分 +
+ :""} + {this.props.ultimate===true?"":
+ 全部评阅 + { !!comment_scores.length && + {comment_scores.length===0?"":(comment_scores.length)} + } +
} + +
+ {/* style={{ display: (comments && !!comments.length) ? 'block' : 'none' }} */} + {/*
+ +
*/} + + {this.props.ultimate===true?"": isAdmin && } + +
+ { comment_scores.map(item => { + return + }) } +
+
+
+
+ ) + } +} +export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReplyChild); \ No newline at end of file diff --git a/public/react/src/modules/Courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js similarity index 100% rename from public/react/src/modules/Courses/poll/Poll.js rename to public/react/src/modules/courses/poll/Poll.js diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js new file mode 100644 index 000000000..06a4924fa --- /dev/null +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -0,0 +1,511 @@ +import React, {Component} from "react"; +import CoursesListType from '../coursesPublic/CoursesListType'; +import {WordsBtn,ActionBtn,markdownToHTML} from 'educoder'; +import GraduateTopicReply from '../../courses/graduation/topics/GraduateTopicReply' +import MemoDetailMDEditortwo from '../../forums/MemoDetailMDEditortwo' +import { + Form, + Select, + Input, + Button, + Checkbox, + Upload, + Icon, + message, + Modal, + Table, + Divider, + InputNumber, + Tag, + DatePicker, + Radio, + Tooltip, + notification +} from "antd"; +import {Link, Switch, Route, Redirect} from 'react-router-dom'; +import axios from 'axios'; +import '../css/members.css' +import "../common/formCommon.css" +import '../css/Courses.css' +import './style.css' +import 'antd/lib/pagination/style/index.css'; +import './Challenges.css' +import CommonReply from "../common/comments/CommonReply"; +import Homeworddescription from "../shixunHomework/Homeworddescription"; +import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; +import HomeworkModal from "../coursesPublic/HomeworkModal"; +// import Homeworddescription from "../shixunHomework/Homeworddescription"; + +const TextArea = Input.TextArea + +//GraduationTaskssetting.js + + +//作业问答页面 +class Workquestionandanswer extends Component { + //unifiedsetting 统一设置 + //allowreplenishment 允许补交 + //completionefficiencyscore 完成效率评分占比 + //level级别 + //proportion 比例 + constructor(props) { + super(props); + // this.props.form.setFieldsValue({ + // radiogroup:1, + // + // }); + this.state ={ + // namestring:"JFinal是基于Java语言的极速web开发框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、`Restful`。在拥有Java语言所有优势的同时再拥有`ruby`、`python`等动态语言的开发效率。\r\n\r\n在本实训中,我们将基于JFinal框架搭建一个在线商城。我们会学习到如何合理设计`Model`来进行数据表映射和数据操作、如何设计`Controller`对请求进行合理的处理…… 通过本实训,您不仅能收获到具体框架和技术的使用经验,也能对项目架构设计等知识有所了解或巩固。\r\n\r\n
\r\n\t\r\n
\r\n\r\n本实训聚焦一个在线商城项目的核心业务逻辑实现。你将在这一过程中收获Java Web项目设计的基本思想,也能得到编程能力的一次跃升。", + props: props, + starttimetype: false, + endtimetype: false, + latetimetype: false, + allowlate: 1, + latepenaltytype: false, + unifiedsetting: false, + allowreplenishment: undefined, + completionefficiencyscore: false, + proportion: undefined, + level: undefined, + ealuation: false, + latededuction: undefined, + latedeductiontwo: undefined, + Showupdateinstructions:false, + database: false, + datasheet: false, + databasetwo: undefined, + datasheettwo: undefined, + publicwork: undefined, + memo: {id: "94", user_id: 1}, + polls_descriptiontest: "作业说明...", + jobdescriptiondisplay:"none", + score_open:false, + code_review:false + } + } + + componentDidMount() { + var homeworkid = this.props.match.params.homeworkid; + // console.log(homeworkid) + this.Gettitleinformation(homeworkid) + let query = this.props.location.pathname; + const type = query.split('/'); + this.setState({ + shixuntypes:type[3] + }) + } + + isupdatas=()=>{ + var homeworkid = this.props.match.params.homeworkid; + this.Gettitleinformation(homeworkid) + } + //获取题目信息 + Gettitleinformation = (homeworkid) => { + // console.log("获取题目信息"); + let url = `/homework_commons/${homeworkid}.json`; + axios.get(url).then((result) => { + if (result.status === 200) { + // console.log(url) + // console.log("设置页") + // console.log(JSON.stringify(result)) + this.setState({ + jobsettingsdata:result, + ...result.data + }) + } + }).catch((error) => { + console.log(error) + }) + } + jobdescriptiondisplaybj =()=>{ + this.setState({ + Showupdateinstructions:true, + }) + } + + //统一设置 + onChange = (e) => { + this.setState({ + unifiedsetting: e.target.checked, + }) + // console.log(e.target.checked); + } + + //立即发布 + homeworkstart = () => { + let homeworkid=this.props.match.params.homeworkid; + let url="/homework_commons/"+homeworkid+"/publish_groups.json"; + + axios.get(url).then((response) => { + + if (response.status === 200) { + let starttime = this.props.getNowFormatDates(1); + let endtime = this.props.getNowFormatDates(2); + this.setState({ + modalname: "立即发布", + modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, + visible: true, + Topval: "本操作只对“未发布”的对象生效", + Botvalleft: "暂不发布", + Botval: "则通过后续手动设置,定时发布", + starttime: "发布时间:" + starttime, + endtime: "截止时间:" + endtime, + Cancelname: "暂不发布", + Savesname: "立即发布", + Cancel: this.homeworkhide, + Saves: this.homeworkstartend, + course_groups: response.data.course_groups, + starttimes:starttime, + typs:"start", + }) + } + }).catch((error) => { + console.log(error) + }); + + } + //立即截止 + homeworkends = () => { + let homeworkid=this.props.match.params.homeworkid; + let url="/homework_commons/"+homeworkid+"/end_groups.json"; + + axios.get(url).then((response) => { + + if (response.status === 200) { + this.setState({}) + this.setState({ + modalname: "立即截止", + modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, + visible: true, + Topval: "本操作只对“提交中”的对象生效", + Botvalleft: "暂不截止", + Botval: "则将根据已设置的截止时间,定时截止", + Cancelname: "暂不截止", + Savesname: "立即截止", + Cancel: this.homeworkhide, + Saves: this.coursetaskend, + starttime: undefined, + endtime: undefined, + course_groups: response.data.course_groups, + typs:"end", + }) + } + }).catch((error) => { + console.log(error) + }); + + + } +// 立即发布 + homeworkstartend = (ds,endtime) => { + var homeworkid = this.props.match.params.homeworkid; + let {course_groupslist} = this.state; + + let coursesId = this.props.match.params.coursesId; + let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json"; + axios.post(url, { + homework_ids: [homeworkid], + group_ids: course_groupslist, + end_time:endtime, + }).then((result) => { + if (result.status === 200) { + if (result.data.status === 0) { + notification.open({ + message:"提示", + description:result.data.message + }); + this.homeworkhide(); + } + + } + }).catch((error) => { + console.log(error); + }) + } + + //立即截止确定按钮 + coursetaskend = () => { + var homeworkid = this.props.match.params.homeworkid; + let {course_groupslist} = this.state; + + + const cid = this.props.match.params.coursesId; + let url = "/courses/" + cid + "/homework_commons/end_homework.json"; + axios.post(url, { + group_ids: course_groupslist, + homework_ids: [homeworkid], + }) + .then((response) => { + if (response.data.status == 0) { + notification.open({ + message:"提示", + description:response.data.message + }); + this.homeworkhide() + } + }) + .catch(function (error) { + console.log(error); + }); + } + ReleaseNotes=(explanations)=>{ + var homeworkid = this.props.match.params.homeworkid; + let url=`/homework_commons/${homeworkid}/update_explanation.json`; + axios.post((url), { + explanation: explanations + }) + .then((result)=>{ + if(result){ + this.props.showNotification(`${result.data.message}`); + this.setState({ + Showupdateinstructions:false + }) + var homeworkid = this.props.match.params.homeworkid; + // console.log(homeworkid) + this.Gettitleinformation(homeworkid) + } + }).catch((error)=>{ + console.log(error); + }) + } + + NOReleaseNotes=()=>{ + this.setState({ + Showupdateinstructions:false, + }) + } + workshowmodel=()=>{ + this.setState({ + showmodel:true + }) + } + + hideshowmodel=()=>{ + this.setState({ + showmodel:false + }) + } + + homeworkhide=()=>{ + this.isupdatas() + this.setState({ + modalname:undefined, + modaltype:undefined, + visible:false, + Topval:undefined, + Topvalright:undefined, + Botvalleft:undefined, + Botval:undefined, + starttime:undefined, + endtime:undefined, + Cancelname:undefined, + Savesname:undefined, + Cancel:undefined, + Saves:undefined, + StudentList_value:undefined, + addname:undefined, + addnametype:false, + addnametab:undefined, + typs:undefined, + starttimes:undefined, + }) + } + getcourse_groupslist=(id)=>{ + this.setState({ + course_groupslist:id + }) + } + render() { + const dateFormat = 'YYYY-MM-DD HH:mm:ss'; + let {starttimetype, endtimetype, latetimetype, allowlate, latepenaltytype, jobsettingsdata,score_open,Showupdateinstructions + , homework_id} = this.state; + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + }; + const formItemLayout = { + labelCol: {span: 6}, + wrapperCol: {span: 14}, + }; + let coursesId = this.props.match.params.coursesId; + + + return ( +
+ {this.state.showmodel===true?this.hideshowmodel()} + updatas={()=>this.isupdatas()} + />:""} + {/*立即发布*/} + this.getcourse_groupslist(id)} + starttimes={this.state.starttimes} + typs={this.state.typs} + /> +
+
+

+ {jobsettingsdata === undefined ? "" : jobsettingsdata.data.course_name} + > + {jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_name} + > + 作业详情 +

+
+
+

+ {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name} +

+ + 返回 + 实训详情 + + +
+
+
+
+ {this.props.isAdmin() === true? 作品列表: + 作品列表 + // :作品列表(学生完成) + } + + 作业问答 + {this.props.isAdmin()? + this.state.code_review===false?"": + 代码查重:""} + + 设置 + {/*导出成绩*/} + {this.props.isAdmin() ? 导出 : ""} + {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true? + 立即截止:"" : ""} + {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.publish_immediately===true? + 立即发布 :"": ""} + + + {this.props.isAdmin()? + this.state.code_review===true? + 代码查重 + :"":""} + +
+
+ + {jobsettingsdata === undefined|| jobsettingsdata.data.description===null? "" :
+ +
+
+ {/* /!*{}}>
+ {/* /!*{jobsettingsdata.data.description}*!/*/} + {/* */} +
+ {/*
*/} + {/*

*/} + {/* /!*{ChallengesDataList === undefined ? "" :ChallengesDataList.description===null?""*!/*/} + {/* */} + {/* /!*}*!/*/} + {/*

*/} + + {/*
*/} + +
} + +
+
作业说明:
+ { + this.props.isAdmin()&&this.props.isAdmin()===true ? + this.jobdescriptiondisplaybj()} > + :"" + } + +
+ + +
+ {jobsettingsdata === undefined ? "" : jobsettingsdata === null ? "" : jobsettingsdata === "null" ? "" : +
+ } +
+
+
+{/* */} + {/*
*/} + {/**/} + {/*
*/} + { Showupdateinstructions&& Showupdateinstructions === true? +
+ +
+ :"" + } + { homework_id && + } + + +
+ + + + ) + } +} + +export default Workquestionandanswer; \ No newline at end of file diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 46c953f32..94341d7e2 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -1,172 +1,172 @@ -import React, {Component} from "react"; -import { - Form, - Select, - Input, - Button, - Checkbox, - Upload, - Icon, - message, - Modal, - Table, - Divider, - InputNumber, - Tag, - DatePicker, - Radio, - Tooltip, - notification -} from "antd"; -import {Link, Switch, Route, Redirect} from 'react-router-dom'; -import '../../modules/courses/css/members.css'; -import "../../modules/courses/common/formCommon.css" -import '../../modules/courses/css/Courses.css'; -import beijintulogontwo from '../../../src/images/login/beijintulogontwo.png'; -import educodernet from '../../../src/images/login/educodernet.png'; -import LoginRegisterComponent from '../user/LoginRegisterComponent'; -import FindPasswordComponent from '../user/FindPasswordComponent'; -import passopen from "../../images/login/passopen.png"; -//educoder登入页面 -var sectionStyle = { - "height": "100%", - "width": "100%", - "min-width": "1000px", -// makesure here is String确保这里是一个字符串,以下是es6写法 - - -}; -var imgback = { - " background-size":"cover", -"background-repeat":"no-repeat", - backgroundImage: `url(${beijintulogontwo})`, -} -var imgmian ={ - "width": "100%", - "background": `url(${beijintulogontwo})`, - "height": "100%", - "position": "relative", -} - -var newContainer={ - "min-height": "100%", - "background": `url(${beijintulogontwo})`, - "height": "auto !important", - "position": "relative", -} -class EducoderLogin extends Component { - constructor(props) { - super(props); - if( props.match.url === "/changepassword" ){ - this.state = { - showbool: false, - } - }else { - if(props.match.url === "/login"){ - this.state = { - showbool: true, - loginstatus:true - } - }else if(props.match.url === "/register"){ - this.state = { - showbool: true, - loginstatus:false, - } - }else{ - this.state = { - showbool: true, - } - } - - } - - } - - componentDidMount() { - - } - - Setshowbool = () => { - - if (this.state.showbool === true) { - this.setState({ - showbool: false - }) - - } else { - this.setState({ - showbool: true - }) - } - } - - - render() { - let {showbool} = this.state; - return ( -
- -
-
-
- -
- - -
- { - showbool === true ? -
-
- -
- - -
-
-
- : -
-
- -
- - -
-
-
- - } -
-
- ) - } - -} - +import React, {Component} from "react"; +import { + Form, + Select, + Input, + Button, + Checkbox, + Upload, + Icon, + message, + Modal, + Table, + Divider, + InputNumber, + Tag, + DatePicker, + Radio, + Tooltip, + notification +} from "antd"; +import {Link, Switch, Route, Redirect} from 'react-router-dom'; +import '../courses/css/members.css'; +import "../courses/common/formCommon.css" +import '../courses/css/Courses.css'; +import beijintulogontwo from '../../../src/images/login/beijintulogontwo.png'; +import educodernet from '../../../src/images/login/educodernet.png'; +import LoginRegisterComponent from '../user/LoginRegisterComponent'; +import FindPasswordComponent from '../user/FindPasswordComponent'; +import passopen from "../../images/login/passopen.png"; +//educoder登入页面 +var sectionStyle = { + "height": "100%", + "width": "100%", + "min-width": "1000px", +// makesure here is String确保这里是一个字符串,以下是es6写法 + + +}; +var imgback = { + " background-size":"cover", +"background-repeat":"no-repeat", + backgroundImage: `url(${beijintulogontwo})`, +} +var imgmian ={ + "width": "100%", + "background": `url(${beijintulogontwo})`, + "height": "100%", + "position": "relative", +} + +var newContainer={ + "min-height": "100%", + "background": `url(${beijintulogontwo})`, + "height": "auto !important", + "position": "relative", +} +class EducoderLogin extends Component { + constructor(props) { + super(props); + if( props.match.url === "/changepassword" ){ + this.state = { + showbool: false, + } + }else { + if(props.match.url === "/login"){ + this.state = { + showbool: true, + loginstatus:true + } + }else if(props.match.url === "/register"){ + this.state = { + showbool: true, + loginstatus:false, + } + }else{ + this.state = { + showbool: true, + } + } + + } + + } + + componentDidMount() { + + } + + Setshowbool = () => { + + if (this.state.showbool === true) { + this.setState({ + showbool: false + }) + + } else { + this.setState({ + showbool: true + }) + } + } + + + render() { + let {showbool} = this.state; + return ( +
+ +
+
+
+ +
+ + +
+ { + showbool === true ? +
+
+ +
+ + +
+
+
+ : +
+
+ +
+ + +
+
+
+ + } +
+
+ ) + } + +} + export default EducoderLogin; \ No newline at end of file