+ {
- {course_name}
+ {course_name}
>
- 毕设任务
+ 毕设任务
>
任务详情
-
+
- {homework_name}
+ {homework_name}
-
+
}
diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js
index edd83c9e1..912742c68 100644
--- a/public/react/src/modules/courses/busyWork/NewWorkForm.js
+++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js
@@ -1,28 +1,25 @@
-import React,{ Component } from "react";
-import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Modal } from "antd";
+import React, { Component } from "react";
+import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon } from "antd";
import axios from 'axios'
import '../css/busyWork.css'
import '../css/Courses.css'
-import {getUploadActionUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
+import { getUploadActionUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder'
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
-import CBreadcrumb from '../common/CBreadcrumb'
-
-const confirm = Modal.confirm;
const $ = window.$
const MAX_TITLE_LENGTH = 60;
/**
需要注意的props
isGroup
-*/
-class NewWorkForm extends Component{
- constructor(props){
+*/
+class NewWorkForm extends Component {
+ constructor(props) {
super(props);
this.contentMdRef = React.createRef();
this.answerMdRef = React.createRef();
-
- this.state={
- title_value:"",
+
+ this.state = {
+ title_value: "",
title_num: 0,
contentFileList: [],
answerFileList: [],
@@ -34,81 +31,81 @@ class NewWorkForm extends Component{
}
}
initValue = (data) => {
- if (data.isEdit) {
- const contentFileList = data.attachments.map(item => {
- return {
- id: item.id,
- uid: item.id,
- name: appendFileSizeToUploadFile(item),
- url: item.url,
- filesize: item.filesize,
- status: 'done'
- }
- })
- const answerFileList = data.ref_attachments.map(item => {
- return {
- id: item.id,
- uid: item.id,
- name: appendFileSizeToUploadFile(item),
- url: item.url,
- filesize: item.filesize,
- status: 'done'
- }
- })
-
- this.setState({
- ...data,
- // course_id: data.course_id,
- // course_name: data.course_name,
- // category: data.category,
- title_num: parseInt(data.name.length),
- workLoaded: true,
- init_min_num: data.min_num,
- init_max_num: data.max_num,
- // description: data.description,
- reference_answer: data.reference_answer,
- contentFileList,
- answerFileList,
- }, () => {
- // setTimeout(() => {
- // this._scrollToTop()
- // 阻止setValue的滚动
- // $(window).scroll( function() {
- // $("html").scrollTop(0)
- // $(window).unbind("scroll");
- // });
- /**
- setValue会调用到 codemirror的 o.scrollIntoView(i), 会导致滚动条跳动
- */
- // $('.editormd').parent().css('position', 'fixed').css('left', '-1000px')
- // this.contentMdRef.current.setValue(data.description || '')
- // this.answerMdRef.current.setValue(data.reference_answer || '')
- // setTimeout(() => {
- // $('.editormd').parent().css('position', '').css('left', 'auto')
- // }, 100);
- // }, 500)
-
- this.props.form.setFieldsValue({
- title: data.name,
- description: data.description || '',
- reference_answer: data.reference_answer || '',
- });
-
- })
- } else { // new
+ if (data.isEdit) {
+ const contentFileList = data.attachments.map(item => {
+ return {
+ id: item.id,
+ uid: item.id,
+ name: appendFileSizeToUploadFile(item),
+ url: item.url,
+ filesize: item.filesize,
+ status: 'done'
+ }
+ })
+ const answerFileList = data.ref_attachments.map(item => {
+ return {
+ id: item.id,
+ uid: item.id,
+ name: appendFileSizeToUploadFile(item),
+ url: item.url,
+ filesize: item.filesize,
+ status: 'done'
+ }
+ })
- }
+ this.setState({
+ ...data,
+ // course_id: data.course_id,
+ // course_name: data.course_name,
+ // category: data.category,
+ title_num: parseInt(data.name.length),
+ workLoaded: true,
+ init_min_num: data.min_num,
+ init_max_num: data.max_num,
+ // description: data.description,
+ reference_answer: data.reference_answer,
+ contentFileList,
+ answerFileList,
+ }, () => {
+ // setTimeout(() => {
+ // this._scrollToTop()
+ // 阻止setValue的滚动
+ // $(window).scroll( function() {
+ // $("html").scrollTop(0)
+ // $(window).unbind("scroll");
+ // });
+ /**
+ setValue会调用到 codemirror的 o.scrollIntoView(i), 会导致滚动条跳动
+ */
+ // $('.editormd').parent().css('position', 'fixed').css('left', '-1000px')
+ // this.contentMdRef.current.setValue(data.description || '')
+ // this.answerMdRef.current.setValue(data.reference_answer || '')
+ // setTimeout(() => {
+ // $('.editormd').parent().css('position', '').css('left', 'auto')
+ // }, 100);
+ // }, 500)
+
+ this.props.form.setFieldsValue({
+ title: data.name,
+ description: data.description || '',
+ reference_answer: data.reference_answer || '',
+ });
+
+ })
+ } else { // new
+
+ }
// this._scrollToTop()
}
_scrollToTop = () => {
// setTimeout(() => {
- $("html").scrollTop(0)
- // $("html").animate({ scrollTop: 0 })
+ $("html").scrollTop(0)
+ // $("html").animate({ scrollTop: 0 })
// }, 1000)
}
// 输入title
- changeTitle=(e)=>{
+ changeTitle = (e) => {
this.setState({
title_num: parseInt(e.target.value.length)
@@ -117,18 +114,18 @@ class NewWorkForm extends Component{
handleSubmit = () => {
- const courseId = this.state.course_id || this.props.match.params.coursesId ;
-
+ const courseId = this.state.course_id || this.props.match.params.coursesId;
+
this.props.form.validateFieldsAndScroll((err, values) => {
- if(err && err.personNum) delete err.personNum;
+ if (err && err.personNum) delete err.personNum;
const mdContnet = this.contentMdRef.current.getValue().trim();
values.description = mdContnet;
// return;
-
- {/* max={has_commit ? init_min_num : null } */}
- {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */}
+
+ {/* max={has_commit ? init_min_num : null } */ }
+ {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */ }
// 已有提交作品,人数范围只能扩大
const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state;
const isGroup = this.props.isGroup()
@@ -149,8 +146,8 @@ class NewWorkForm extends Component{
this.props.showNotification('最大人数不能小于最小人数');
this.props.scrollToAnchor("numberofgroups");
return;
- }
-
+ }
+
if (has_commit) {
if (max_num < init_max_num || min_num > init_min_num) {
this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`)
@@ -166,7 +163,7 @@ class NewWorkForm extends Component{
} else {
this.doNew(courseId, values)
}
-
+
} else {
$("html").animate({ scrollTop: $('html').scrollTop() - 100 })
}
@@ -187,7 +184,7 @@ class NewWorkForm extends Component{
type: isGroup ? 3 : 1,
name: values.title,
description: values.description,
- reference_answer: values.reference_answer,
+ reference_answer: values.reference_answer,
attachment_ids,
reference_attachment_ids,
@@ -206,12 +203,12 @@ class NewWorkForm extends Component{
})
const isGroup = this.props.isGroup()
const { min_num, max_num, base_on_project, category } = this.state
-
+
const params = {
type: isGroup ? 3 : 1,
name: values.title,
description: values.description,
- reference_answer: values.reference_answer,
+ reference_answer: values.reference_answer,
attachment_ids,
reference_attachment_ids,
@@ -220,7 +217,7 @@ class NewWorkForm extends Component{
base_on_project
}
this.props.doNew && this.props.doNew(params)
-
+
}
handleContentUploadChange = (info) => {
@@ -235,12 +232,12 @@ class NewWorkForm extends Component{
this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) });
}
}
-
+
onAttachmentRemove = (file, stateName) => {
- if(!file.percent || file.percent == 100){
+ if (!file.percent || file.percent == 100) {
this.props.confirm({
content: '是否确认删除?',
-
+
onOk: () => {
this.deleteAttachment(file, stateName)
},
@@ -261,7 +258,7 @@ class NewWorkForm extends Component{
const { status } = response.data;
if (status == 0) {
-
+
this.setState((state) => {
const index = state[stateName].indexOf(file);
const newFileList = state[stateName].slice();
@@ -285,7 +282,7 @@ class NewWorkForm extends Component{
// return;
// }
const { min_num } = this.state;
- this.setState({
+ this.setState({
max_num: val,
// min_num: val <= min_num ? val - 1 : min_num
})
@@ -315,23 +312,23 @@ class NewWorkForm extends Component{
window.$('.groupSetting .ant-form-item-label > label').addClass('ant-form-item-required')
this._scrollToTop()
}
-
- render(){
- let {typeId,coursesId,pageType}=this.props.match.params;
+
+ render() {
+ let { typeId, coursesId, pageType } = this.props.match.params;
const { getFieldDecorator } = this.props.form;
const isGroup = this.props.isGroup()
- let{
+ let {
title_value, contentFileList, answerFileList, max_num, min_num, base_on_project,
- init_max_num, init_min_num,
+ init_max_num, init_min_num,
title_num, course_name, category, has_commit, has_project
- }=this.state
+ } = this.state
const { current_user } = this.props
- const courseId = this.state.course_id || this.props.match.params.coursesId ;
+ const courseId = this.state.course_id || this.props.match.params.coursesId;
this.isEdit = this.isEdit || this.props.match.url.indexOf('/edit') != -1
if ((this.isEdit) && !this.state.description && this.state.description != '') {
return ''
- }
+ }
const uploadProps = {
width: 600,
fileList: contentFileList,
@@ -371,34 +368,34 @@ class NewWorkForm extends Component{
},
};
- return(
+ return (
-
-
-
- {getFieldDecorator('title', {
- rules: [{
- required: true, message: '请输入标题'
- }],
- })(
-
- )}
-
-
+
+ {getFieldDecorator('title', {
+ rules: [{
+ required: true, message: '请输入标题'
+ }],
+ })(
+
+ )}
+
+
- {
- {getFieldDecorator('description', {
- rules: [{
- required: true, message: '请输入作业内容和要求',
- },{
- max: 5000 , message:'最大限制5000个字符'
- }],
- })(
-
- )}
- }
-
-
)
}
diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js
index 1b9c8b0f1..8bfef819c 100644
--- a/public/react/src/modules/courses/busyWork/PublishRightnow.js
+++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js
@@ -1,30 +1,29 @@
-import React,{ Component } from "react";
-import { Input,Checkbox,Menu,Pagination } from "antd";
+import React, { Component } from "react";
+import { Input, Checkbox, Menu, Pagination } from "antd";
import HomeworkModal from '../coursesPublic/HomeworkModal';
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import axios from 'axios'
import moment from 'moment'
-import { getNextHalfHourOfMoment } from 'educoder'
-class PublishRightnow extends Component{
- constructor(props){
+class PublishRightnow extends Component {
+ constructor(props) {
super(props);
- this.state={
+ this.state = {
course_groups: [],
- modalname:undefined,
- modaltype:undefined,
- visible:false,
- Topval:undefined,
- Botvalleft:undefined,
- Botval:undefined,
- starttime:undefined,
- endtime:undefined,
- Cancelname:undefined,
- Savesname:undefined,
- Cancel:undefined,
- Saves:undefined,
- Topvalright:undefined
+ modalname: undefined,
+ modaltype: undefined,
+ visible: false,
+ Topval: undefined,
+ Botvalleft: undefined,
+ Botval: undefined,
+ starttime: undefined,
+ endtime: undefined,
+ Cancelname: undefined,
+ Savesname: undefined,
+ Cancel: undefined,
+ Saves: undefined,
+ Topvalright: undefined
}
}
open = (usingCheckBeforePost) => {
@@ -32,71 +31,70 @@ class PublishRightnow extends Component{
this.homeworkstart()
}
- homeworkstart=()=>{
- const isPublish = this.props.isPublish;
- const isPublishtype = this.props.isPublishtype;
- let showdatatypes=isPublish===true||isPublishtype===1;
+ homeworkstart = () => {
+ const isPublish = this.props.isPublish;
+ const isPublishtype = this.props.isPublishtype;
+ let showdatatypes = isPublish === true || isPublishtype === 1;
if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) {
- this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`)
+ this.props.showNotification(`请先选择要立即${showdatatypes ? "发布" : "截止"}的作业`)
return;
}
-
+
this.fetchCourseGroups();
-
-
+
+
}
showDialog = (course_groups) => {
const isPublish = this.props.isPublish;
- const isPublishtype = this.props.isPublishtype;
+ const isPublishtype = this.props.isPublishtype;
const dateFormat = 'YYYY-MM-DD HH:mm';
- let showdatatype=isPublish===true&&isPublishtype===undefined;
- let showdatatypes=isPublish===true||isPublishtype===1;
- // getNextHalfHourOfMoment
+ let showdatatype = isPublish === true && isPublishtype === undefined;
+ let showdatatypes = isPublish === true || isPublishtype === 1;
+ // getNextHalfHourOfMoment
const startMoment = (moment());
this.setState({
modalname: showdatatypes ? "立即发布" : "立即截止",
- modaltype:course_groups.length> 0 ? 1 : 2,
- visible:showdatatype?false:true,
- OneSelftype:showdatatype?true:false,
- Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品",
+ modaltype: course_groups.length > 0 ? 1 : 2,
+ visible: showdatatype ? false : true,
+ OneSelftype: showdatatype ? true : false,
+ Topval: showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品",
// Botvalleft: isPublish ? "暂不发布" : "暂不截止",
Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的作业有效" : "本操作只对“提交中”的作业有效") : '',
- starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '',
- starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '',
- endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
- Cancelname:showdatatypes ? "暂不发布" : "暂不截止",
- Savesname:showdatatypes ? "立即发布" : "立即截止",
- Cancel:this.homeworkhide,
- Saves:this.homeworkstartend,
- typs:showdatatypes ? "start" : "end",
+ starttime: showdatatypes ? `发布时间:${startMoment.format(dateFormat)}` : '',
+ starttimes: showdatatypes ? `${startMoment.format(dateFormat)}` : '',
+ endtime: showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
+ Cancelname: showdatatypes ? "暂不发布" : "暂不截止",
+ Savesname: showdatatypes ? "立即发布" : "立即截止",
+ Cancel: this.homeworkhide,
+ Saves: this.homeworkstartend,
+ typs: showdatatypes ? "start" : "end",
})
}
- homeworkhide=()=>{
+ homeworkhide = () => {
this.setState({
- modalname:undefined,
- modaltype:undefined,
- visible:false,
- OneSelftype: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
+ modalname: undefined,
+ modaltype: undefined,
+ visible: false,
+ OneSelftype: 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
})
}
- homeworkstartend=(arg_group_ids,endtime)=>{
- debugger
+ homeworkstartend = (arg_group_ids, endtime) => {
if (this.usingCheckBeforePost && this.props.checkBeforePost) {
const goOn = this.props.checkBeforePost();
if (!goOn) {
@@ -104,7 +102,6 @@ class PublishRightnow extends Component{
return;
}
}
- debugger
const isPublish = this.props.isPublish;
let group_ids = arg_group_ids
if (this.usingCheckBeforePost) {
@@ -112,46 +109,45 @@ class PublishRightnow extends Component{
return item.id
})
}
- debugger
- if(this.state.course_groups.length>0){
- if (this.state.course_groups.length && (!group_ids || group_ids&&group_ids.length == 0)) {
+ if (this.state.course_groups.length > 0) {
+ if (this.state.course_groups.length && (!group_ids || group_ids && group_ids.length == 0)) {
this.props.showNotification('请至少选择一个分班');
return;
}
}
- let data={}
- if(arg_group_ids&&arg_group_ids.length===0){
- data = {
- homework_ids: this.props.checkBoxValues,
- end_time: endtime==="Invalid date"?undefined:endtime,
- }
- }else if(this.props.islist===true){
- data={
- homework_ids: this.props.checkBoxValues,
- group_ids: group_ids,
- end_time:endtime,
- }
- }else{
- data={
- homework_ids: this.props.checkBoxValues,
- group_ids: group_ids,
- group_end_times:endtime,
- detail:true
- }
- }
- const isPublishtype = this.props.isPublishtype;
- let showdatatypes=isPublish===true||isPublishtype===1;
- let coursesId=this.props.match.params.coursesId;
+ let data = {}
+ if (arg_group_ids && arg_group_ids.length === 0) {
+ data = {
+ homework_ids: this.props.checkBoxValues,
+ end_time: endtime === "Invalid date" ? undefined : endtime,
+ }
+ } else if (this.props.islist === true) {
+ data = {
+ homework_ids: this.props.checkBoxValues,
+ group_ids: group_ids,
+ end_time: endtime,
+ }
+ } else {
+ data = {
+ homework_ids: this.props.checkBoxValues,
+ group_ids: group_ids,
+ group_end_times: endtime,
+ detail: true
+ }
+ }
+ const isPublishtype = this.props.isPublishtype;
+ let showdatatypes = isPublish === true || isPublishtype === 1;
+ let coursesId = this.props.match.params.coursesId;
const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json`
axios.post(url, data)
.then((response) => {
if (response.data.status == 0) {
- this.homeworkhide()
- this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功")
+ this.homeworkhide()
+ this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功")
this.props.doWhenSuccess && this.props.doWhenSuccess()
- this.setState({ visible : false })
- this.props.action && this.props.action()
+ this.setState({ visible: false })
+ this.props.action && this.props.action()
}
})
.catch(function (error) {
@@ -159,34 +155,34 @@ class PublishRightnow extends Component{
});
}
// componentDidUpdate = (prevProps) => {
- // if ( prevProps.match.params.boardId != this.props.match.params.boardId ) {
- // this.fetchAll(null, 1)
- // }
+ // if ( prevProps.match.params.boardId != this.props.match.params.boardId ) {
+ // this.fetchAll(null, 1)
+ // }
// }
fetchCourseGroups = () => {
- const isPublish = this.props.isPublish;
- const isPublishtype = this.props.isPublishtype;
- let showdatatypes=isPublish===true||isPublishtype===1;
- let coursesId=this.props.match.params.coursesId;
+ const isPublish = this.props.isPublish;
+ const isPublishtype = this.props.isPublishtype;
+ let showdatatypes = isPublish === true || isPublishtype === 1;
+ let coursesId = this.props.match.params.coursesId;
// TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668
// /homework_commons/:id/publish_groups.json
let url = `/courses/${coursesId}/all_course_groups.json`
if (this.props.checkBoxValues.length == 1) {
const isPublish = this.props.isPublish;
- url = `/homework_commons/${this.props.checkBoxValues[0]}/${ showdatatypes ? 'publish_groups' : 'end_groups'}.json`
+ url = `/homework_commons/${this.props.checkBoxValues[0]}/${showdatatypes ? 'publish_groups' : 'end_groups'}.json`
}
axios.get(url, {
- })
+ })
.then((response) => {
if (!response || response.data.status == -1) {
- this.setState({ visible : false })
+ this.setState({ visible: false })
return;
}
this.showDialog(response.data.course_groups)
this.setState({
course_groups: response.data.course_groups,
- starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
+ starttimesend: response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time,
})
})
.catch(function (error) {
@@ -194,12 +190,12 @@ class PublishRightnow extends Component{
});
}
- render(){
+ render() {
const isPublish = this.props.isPublish;
- const isPublishtype = this.props.isPublishtype;
- let showdatatypes=isPublish===true||isPublishtype===1;
+ const isPublishtype = this.props.isPublishtype;
+ let showdatatypes = isPublish === true || isPublishtype === 1;
- let{
+ let {
Topvalright,
modalname,
modaltype,
@@ -208,20 +204,20 @@ class PublishRightnow extends Component{
Botvalleft,
Botval,
starttime,
- starttimes,
+ starttimes,
endtime,
Cancelname,
Savesname,
Cancel,
Saves,
course_groups
- }=this.state
+ } = this.state
const { showActionButton } = this.props
- return(
+ return (
)
}
diff --git a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js
index 3d3f83bc6..7bb309727 100644
--- a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js
+++ b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js
@@ -1,12 +1,9 @@
-import React,{ Component } from "react";
-import { Pagination } from "antd";
-
-import update from 'immutability-helper';
+import React, { Component } from "react";
import axios from 'axios';
import moment from 'moment';
import _ from 'lodash';
-import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC';
+import { ImageLayerOfCommentHOC } from '../../../page/layers/ImageLayerOfCommentHOC';
import GraduationTasksappraiseMainEditor from '../../graduation/tasks/GraduationTasksappraiseMainEditor';
import CCommentItem from '../../common/comments/CCommentItem';
import '../../../forums/Post.css';
@@ -17,47 +14,45 @@ 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){
+class CommonWorkAppraiseReply extends Component {
+ constructor(props) {
super(props);
this.editorRef = React.createRef();
- this.state={
+ this.state = {
total_count: 0,
comment_scores: [],
}
}
fetchAllComments = () => {
- let category_id= this.props.match.params.category_id;
+ 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){
+ axios.get(url).then((result) => {
+ if (result.data.comment_scores) {
const comment_scores = result.data.comment_scores.map(item => {
- return this.transformReply(item)
+ return this.transformReply(item)
})
this.setState({
...result.data,
comment_scores
})
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error)
})
}
replySuccess = () => {
this.fetchAllComments()
}
- componentDidMount(){
+ componentDidMount() {
this.fetchAllComments()
}
addSuccess = () => {
@@ -79,7 +74,7 @@ class CommonWorkAppraiseReply extends Component{
reply.journals.push(reply.appeal_info)
reply.journals = _.orderBy(reply.journals, 'time', 'asc')
}
-
+
return {
isSuperAdmin: isSuperAdmin,
admin: isAdmin, //
@@ -93,7 +88,7 @@ class CommonWorkAppraiseReply extends Component{
// time: moment(reply.comment_time).fromNow(),
time: moment(reply.comment_time).format('YYYY-MM-DD HH:mm'),
- image_url: reply.user_image_url,
+ image_url: reply.user_image_url,
user_id: reply.user_id,
user_login: reply.user_login,
username: reply.user_name,
@@ -111,19 +106,20 @@ class CommonWorkAppraiseReply extends Component{
okText: '确定',
cancelText: '取消',
onOk: () => {
- let category_id= this.props.match.params.category_id;
+ let category_id = this.props.match.params.category_id;
const task_id = this.props.task_id
// 作业是使用 task_id
const url = `/student_works/${task_id}/destroy_score.json`
- axios.delete(url, { data: {
+ axios.delete(url, {
+ data: {
score_id: item.id
}
- }).then((result)=>{
- if(result.data.status == 0){
+ }).then((result) => {
+ if (result.data.status == 0) {
this.props.showNotification('删除成功')
this.fetchAllComments()
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error)
})
},
@@ -131,47 +127,47 @@ class CommonWorkAppraiseReply extends Component{
console.log('Cancel');
},
});
-
+
}
- showModulationtype=(id)=>{
+ showModulationtype = (id) => {
// console.log(id)
this.setState({
- Modulationtype:true,
- operationId:id
+ Modulationtype: true,
+ operationId: id
})
}
- cancelmodel=()=>{
+ cancelmodel = () => {
this.setState({
- Modalstype:false,
- Loadtype:false,
- visible:false,
- Modulationtype:false,
- Allocationtype:false,
- Modalstopval:"",
- ModalCancel:"",
- ModalSave:"",
+ 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;
+ 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)=>{
+ 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){
+ if (result.data.status === 0) {
// this.setState({
// Modalstype:true,
// Allocationtype:false,
@@ -185,7 +181,7 @@ class CommonWorkAppraiseReply extends Component{
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error)
})
@@ -193,18 +189,18 @@ class CommonWorkAppraiseReply extends Component{
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) {
+ 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)=>{
+ }).catch((error) => {
console.log(error)
})
}
- render(){
+ 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()
@@ -217,84 +213,84 @@ class CommonWorkAppraiseReply extends Component{
*/
// && isNiPing
- const needNiPingEditor = (allow_score );
+ const needNiPingEditor = (allow_score);
if (!needNiPingEditor && comment_scores.length == 0) {
return ''
}
- return(
+ return (
-
-
-
-
-
-
- {this.state.Modulationtype===true?
this.saveModulationModal(value,num)}
- closable={false}
- footer={null}
- destroyOnClose={true}
- centered={true}
- />:""}
-
- {/**/}
+
+
+
+
+
+
+ {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 &&
}
-
- {needNiPingEditor &&
}
-
- {/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */}
-
- {/*
+
+ {!!comment_scores.length &&
}
+
+ {needNiPingEditor &&
}
+
+ {/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */}
+
+ {/*
.course-message .panel-comment_item {
margin-top: ${needNiPingEditor ? 56 : 28}px;
}
*/}
-
- {!!comment_scores.length &&
- { comment_scores.map((item, index) => {
- return
- }) }
-
}
-
+ {!!comment_scores.length &&
+ {comment_scores.map((item, index) => {
+ return
+ })}
+
}
+
-
+
)
}
}
-export default ImageLayerOfCommentHOC() (CommonWorkAppraiseReply);
\ No newline at end of file
+export default ImageLayerOfCommentHOC()(CommonWorkAppraiseReply);
\ No newline at end of file
diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
index 20c40f025..97bdcdb25 100644
--- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
+++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
@@ -1,5 +1,5 @@
-import React,{ Component } from "react";
-import {Input,InputNumber,Spin,Statistic} from "antd";
+import React, { Component } from "react";
+import { Input, InputNumber, Spin, Statistic } from "antd";
import '../css/members.css';
import '../css/busyWork.css';
@@ -7,7 +7,7 @@ import '../poll/pollStyle.css';
import '../css/Courses.css';
import moment from 'moment';
-import { WordsBtn,markdownToHTML,ActionBtn,getImageUrl, MarkdownToHtml } from 'educoder';
+import { WordsBtn, markdownToHTML, ActionBtn, getImageUrl, MarkdownToHtml } from 'educoder';
import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType';
@@ -28,82 +28,81 @@ const { Countdown } = Statistic;
// console.log(deadline)
-const Textarea =Input.TextArea
+const Textarea = Input.TextArea
const tagArray = [
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
- 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
+ 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
const $ = window.$;
-const statudmap={1:"未发布",2:"已发布",3:"已截止"}
-
-const type=["单选题","多选题","判断题","填空题","简答题","实训题"]
-
-const format="YYYY-MM-DD HH:mm"
-class ExerciseReviewAndAnswer extends Component{
- constructor(props){
- super(props);
- this.state={
- data:undefined,
- questionPanelFixed:false,
- e_ReviewInfo:undefined,
- e_AnswerInfo:undefined,
- courseName:undefined,
- exercise:undefined,
- question_types:undefined,
- exercise_questions:undefined,
- time:undefined,
- hour:0,
- minute:0,
- second:0,
- Modalstype:false,
- Modalstopval:undefined,
- modalsBottomval:undefined,
- ModalCancel:undefined,
- ModalSave:undefined,
- Loadtype:undefined,
- // 问卷是否可以被编辑(老师/试卷已截止/问卷已提交为1)
- user_exercise_status:undefined,
-
- // 开始答题时间
- exercise_start_at:undefined,
-
- //老师身份
- exercise_scores:undefined,
- exercise_answer_user:undefined,
-
- //学生身份
- question_status:undefined,
-
- score:undefined,
- setScoreReason:undefined,
- setTip:"",
-
- Id:undefined,
- // 试卷总分
- exerciseTotalScore:undefined,
-
- // 加载效果
- isSpin:false,
- // 调分数组
- ajustSore:undefined
- }
+const statudmap = { 1: "未发布", 2: "已发布", 3: "已截止" }
+
+const type = ["单选题", "多选题", "判断题", "填空题", "简答题", "实训题"]
+
+const format = "YYYY-MM-DD HH:mm"
+class ExerciseReviewAndAnswer extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ data: undefined,
+ questionPanelFixed: false,
+ e_ReviewInfo: undefined,
+ e_AnswerInfo: undefined,
+ courseName: undefined,
+ exercise: undefined,
+ question_types: undefined,
+ exercise_questions: undefined,
+ time: undefined,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ Modalstype: false,
+ Modalstopval: undefined,
+ modalsBottomval: undefined,
+ ModalCancel: undefined,
+ ModalSave: undefined,
+ Loadtype: undefined,
+ // 问卷是否可以被编辑(老师/试卷已截止/问卷已提交为1)
+ user_exercise_status: undefined,
+
+ // 开始答题时间
+ exercise_start_at: undefined,
+
+ //老师身份
+ exercise_scores: undefined,
+ exercise_answer_user: undefined,
+
+ //学生身份
+ question_status: undefined,
+
+ score: undefined,
+ setScoreReason: undefined,
+ setTip: "",
+
+ Id: undefined,
+ // 试卷总分
+ exerciseTotalScore: undefined,
+
+ // 加载效果
+ isSpin: false,
+ // 调分数组
+ ajustSore: undefined
+ }
}
- componentDidUpdate (prevProps) {
- // 需要等get_user_info执行完才能getInfo
+ componentDidUpdate(prevProps) {
if (!prevProps.coursedata.name && this.props.coursedata.name) {
this.getInfo()
}
}
- componentDidMount(){
- if(this.props.coursedata.name){
+ componentDidMount() {
+ if (this.props.coursedata.name) {
this.getInfo();
}
-
+
//window.addEventListener('scroll', this.handleScroll);
}
- remainTime=(time)=>{
+ remainTime = (time) => {
// let { time } = this.state;
// let h=moment(parseInt(time)*1000).hour()-8;
// let m=moment(parseInt(time)*1000).minutes();
@@ -134,98 +133,100 @@ class ExerciseReviewAndAnswer extends Component{
}
//自动交卷
- autoCommitExercise=()=>{
- let eId=this.props.match.params.Id;
- let url=`/exercises/${eId}/commit_exercise.json`;
- axios.post(url,{
- commit_method:2
- }).then((result)=>{
- if(result){
- if(result.data.status===0){
- this.setState({
- Modalstype:true,
- Modalstopval:'答题结束了,系统已自动提交试卷',
- modalsBottomval:"不能再修改答题",
- ModalCancel:undefined,
- ModalSave:this.sureCommit,
- Loadtype:true,
- time:null,
- })
- this.props.showNotification(`${result.data.message}`);
- }
-
- if(result.data.status===-2){
- // this.remainTime(parseInt(result.data.message))
+ autoCommitExercise = () => {
+ let eId = this.props.match.params.Id;
+ let url = `/exercises/${eId}/commit_exercise.json`;
+ axios.post(url, {
+ commit_method: 2
+ }).then((result) => {
+ if (result) {
+ if (result.data.status === 0) {
+ this.setState({
+ Modalstype: true,
+ Modalstopval: '答题结束了,系统已自动提交试卷',
+ modalsBottomval: "不能再修改答题",
+ ModalCancel: undefined,
+ ModalSave: this.sureCommit,
+ Loadtype: true,
+ time: null,
+ })
+ this.props.showNotification(`${result.data.message}`);
+ }
+
+ if (result.data.status === -2) {
+ // this.remainTime(parseInt(result.data.message))
this.setState({
- time:parseInt(result.data.mess)
+ time: parseInt(result.data.mess)
})
this.deadline(parseInt(result.data.message))
- }
- }
- }).catch((error)=>{
- console.log(error);
- })
+ }
+ }
+ }).catch((error) => {
+ console.log(error);
+ })
}
- sureCommit=()=>{
+ sureCommit = () => {
let coursesId = this.props.match.params.coursesId;
let eId = this.props.match.params.Id;
this.props.history.push(`/courses/${coursesId}/exercises/${eId}/student_exercise_list?tab=0`);
}
// 滚动定位
- handleScroll=()=>{
- if(parseInt(window.scrollY)>550){
+ handleScroll = () => {
+ if (parseInt(window.scrollY) > 550) {
this.setState({
- questionPanelFixed:true
+ questionPanelFixed: true
})
- }else{
+ } else {
this.setState({
- questionPanelFixed:false
+ questionPanelFixed: false
})
}
}
- getInfo=()=>{
+ getInfo = () => {
this.setState({
- courseName:this.props.current_user.course_name,
- isSpin:true
+ courseName: this.props.current_user.course_name,
+ isSpin: true
})
- let eId=this.props.match.params.Id;
- let user_id=this.props.match.params.userId;
+ let eId = this.props.match.params.Id;
+ let user_id = this.props.match.params.userId;
- let isAdmin=this.props.isAdmin();
- if(isAdmin){
- let url=`/exercises/${eId}/review_exercise.json`
- axios.get((url),{params:{
- login:user_id
- }}).then((result)=>{
- if(result){
+ let isAdmin = this.props.isAdmin();
+ if (isAdmin) {
+ let url = `/exercises/${eId}/review_exercise.json`
+ axios.get((url), {
+ params: {
+ login: user_id
+ }
+ }).then((result) => {
+ if (result) {
this.setState({
- data:result.data,
- e_ReviewInfo:result.data,
- exercise:result.data.exercise,
- exercise_types:result.data.exercise_scores.exercise_types,
- exercise_scores:result.data.exercise_scores,
- exercise_start_at:result.data.exercise_answer_user.start_at,
- exercise_answer_user:result.data.exercise_answer_user,
- exercise_questions:result.data.exercise_questions,
- user_exercise_status:1,
- Id:result.data.exercise_answer_user.user_id,
- exerciseTotalScore:result.data.exercise_answer_user.score,
- isSpin:false,
+ data: result.data,
+ e_ReviewInfo: result.data,
+ exercise: result.data.exercise,
+ exercise_types: result.data.exercise_scores.exercise_types,
+ exercise_scores: result.data.exercise_scores,
+ exercise_start_at: result.data.exercise_answer_user.start_at,
+ exercise_answer_user: result.data.exercise_answer_user,
+ exercise_questions: result.data.exercise_questions,
+ user_exercise_status: 1,
+ Id: result.data.exercise_answer_user.user_id,
+ exerciseTotalScore: result.data.exercise_answer_user.score,
+ isSpin: false,
})
// 先将未批的简答题放入到调分数组中
let ajustSore = [];
- result.data && result.data.exercise_questions.length>0 && result.data.exercise_questions.map((item,key)=>{
- if( item.question_type == 4 && item.answer_status == 0 ){
+ result.data && result.data.exercise_questions.length > 0 && result.data.exercise_questions.map((item, key) => {
+ if (item.question_type == 4 && item.answer_status == 0) {
ajustSore.push({
- inputSore:0,
- desc:undefined,
- id:item.question_id,
- position:item.q_position,
- setTip:""
+ inputSore: 0,
+ desc: undefined,
+ id: item.question_id,
+ position: item.q_position,
+ setTip: ""
})
}
})
@@ -233,76 +234,78 @@ class ExerciseReviewAndAnswer extends Component{
ajustSore
})
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
- }else{
- let url=`/exercises/${eId}/start_answer.json`
- axios.get((url),{params:{
- login:user_id
- }}).then((result)=>{
- if(result.status==200){
+ } else {
+ let url = `/exercises/${eId}/start_answer.json`
+ axios.get((url), {
+ params: {
+ login: user_id
+ }
+ }).then((result) => {
+ if (result.status == 200) {
this.setState({
- data:result.data,
- e_AnswerInfo:result.data,
- exercise:result.data.exercise,
- exercise_types:result.data.exercise_types,
- question_status:result.data.question_status,
- exercise_start_at:result.data.exercise.exercise_start_at,
- exercise_scores:result.data.exercise_scores,
- exercise_questions:result.data.exercise_questions,
- user_exercise_status:result.data.exercise.user_exercise_status,
- time:result.data.exercise.left_time,
- exerciseTotalScore:result.data.user_score,
- isSpin:false
+ data: result.data,
+ e_AnswerInfo: result.data,
+ exercise: result.data.exercise,
+ exercise_types: result.data.exercise_types,
+ question_status: result.data.question_status,
+ exercise_start_at: result.data.exercise.exercise_start_at,
+ exercise_scores: result.data.exercise_scores,
+ exercise_questions: result.data.exercise_questions,
+ user_exercise_status: result.data.exercise.user_exercise_status,
+ time: result.data.exercise.left_time,
+ exerciseTotalScore: result.data.user_score,
+ isSpin: false
})
- if(result.data.exercise.left_time != null){
+ if (result.data.exercise.left_time != null) {
// this.remainTime(result.data.exercise.left_time);
this.deadline(result.data.exercise.left_time)
}
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
}
- scrollToAnchor=(index)=>{
- let name="Anchor_"+index;
+ scrollToAnchor = (index) => {
+ let name = "Anchor_" + index;
// console.log($("#Anchor_"+index).scrollTop());
if (index) {
// let anchorElement = document.getElementById(name);
// if(anchorElement) { anchorElement.scrollIntoView(); }
- $("html").animate({ scrollTop: $("#Anchor_"+index).offset().top - 150 })
+ $("html").animate({ scrollTop: $("#Anchor_" + index).offset().top - 150 })
}
}
//答题后更改题目列表得状态
- changeQuestionStatus=(No,flag)=>{
+ changeQuestionStatus = (No, flag) => {
this.setState(
- (prevState) => ({
- question_status : update(prevState.question_status, {[No]: { ques_status: {$set: flag} }})
+ (prevState) => ({
+ question_status: update(prevState.question_status, { [No]: { ques_status: { $set: flag } } })
})
)
}
// 调分
- showSetScore=(key,flag,position,type,id)=>{
+ showSetScore = (key, flag, position, type, id) => {
this.setState(
- (prevState) => ({
- exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}})
- }),()=>{
- if (position && type && (flag == undefined || flag==false)) {
- $("#input_"+position+"_"+type).focus();
- $("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 });
- if(id){
+ (prevState) => ({
+ exercise_questions: update(prevState.exercise_questions, { [key]: { setScore: { $set: flag == undefined || flag == false ? true : false } } })
+ }), () => {
+ if (position && type && (flag == undefined || flag == false)) {
+ $("#input_" + position + "_" + type).focus();
+ $("html").animate({ scrollTop: $("#Anchor_" + position + "_" + type).offset().top - 150 });
+ if (id) {
let { ajustSore } = this.state;
let obj = ajustSore.filter(obj => obj.id === id).length > 0;
- if(!obj){
+ if (!obj) {
ajustSore.push({
id,
- inputSore:0,
- desc:undefined,
- position:position,
- setTip:""
+ inputSore: 0,
+ desc: undefined,
+ position: position,
+ setTip: ""
})
}
}
@@ -314,106 +317,106 @@ class ExerciseReviewAndAnswer extends Component{
// })
}
- inputScore=(value,id)=>{
+ inputScore = (value, id) => {
let { ajustSore } = this.state;
var index = ajustSore.map(function (item) { return item.id; }).indexOf(id);
let reg = /^[0-9]+.?[0-9]*$/;
- if(reg.test(value)==false){
+ if (reg.test(value) == false) {
// this.setState({
// setTip:"请输入数字"
// })
this.setState(
- (prevState) => ({
- ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "请输入数字"}}})
+ (prevState) => ({
+ ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "请输入数字" } } })
})
)
return;
- }else{
+ } else {
// this.setState({
// setTip:"",
// score:value
// })
this.setState(
- (prevState) => ({
- ajustSore : update(prevState.ajustSore, {[index]: { inputSore: {$set: value},setTip:{$set: ""}}})
+ (prevState) => ({
+ ajustSore: update(prevState.ajustSore, { [index]: { inputSore: { $set: value }, setTip: { $set: "" } } })
})
)
}
}
- changeScoreReasons=(e,id)=>{
+ changeScoreReasons = (e, id) => {
// console.log(e.target.value);
// this.setState({
// setScoreReason:e.target.value
// })
- let value = e.target.value;
+ let value = e.target.value;
let { ajustSore } = this.state;
var index = ajustSore.map(function (item) { return item.id; }).indexOf(id);
this.setState(
- (prevState) => ({
- ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: value}}})
+ (prevState) => ({
+ ajustSore: update(prevState.ajustSore, { [index]: { desc: { $set: value } } })
})
)
}
-//确认调分
- setAction=(key,q_id,maxScore,oldScore)=>{
- let {ajustSore}=this.state;
+ //确认调分
+ setAction = (key, q_id, maxScore, oldScore) => {
+ let { ajustSore } = this.state;
let list = ajustSore.filter(obj => obj.id == q_id);
let index = ajustSore.map(function (item) { return item.id; }).indexOf(q_id);
let score = list[0].inputSore;
let setScoreReason = list[0].desc;
- let{ setTip }=this.state;
- if(!score && score != 0){
+ let { setTip } = this.state;
+ if (!score && score != 0) {
// this.setState({
// setTip:"请输入分数"
// })
this.setState(
- (prevState) => ({
- ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "请输入分数"}}})
+ (prevState) => ({
+ ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "请输入分数" } } })
})
)
return;
}
- if(score < 0){
+ if (score < 0) {
// this.setState({
// setTip:"分数必须大于或者等于0"
// })
this.setState(
- (prevState) => ({
- ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "分数必须大于或者等于0"}}})
+ (prevState) => ({
+ ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "分数必须大于或者等于0" } } })
})
)
return;
}
- if(score > maxScore){
+ if (score > maxScore) {
// this.setState({
// setTip:"分数不能大于当前题目的分数"
// })
this.setState(
- (prevState) => ({
- ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "分数不能大于当前题目的分数"}}})
+ (prevState) => ({
+ ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "分数不能大于当前题目的分数" } } })
})
)
return;
}
- if(setTip==""){
- let url=`/exercise_questions/${q_id}/adjust_score.json`
- axios.post((url),{
- score:score,
- user_id:this.state.Id,
- comment:setScoreReason
- }).then((result)=>{
- if(result.status==200){
+ if (setTip == "") {
+ let url = `/exercise_questions/${q_id}/adjust_score.json`
+ axios.post((url), {
+ score: score,
+ user_id: this.state.Id,
+ comment: setScoreReason
+ }).then((result) => {
+ if (result.status == 200) {
this.props.showNotification('调分成功');
this.getInfo();
// let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1;
-
+
// this.setState(
// (prevState) => ({
// exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: parseFloat(score).toFixed(1)},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}),
// })
// )
-
+
// this.setState(
// (prevState) => ({
// ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}})
@@ -426,183 +429,183 @@ class ExerciseReviewAndAnswer extends Component{
// })
// this.showSetScore(key,true);
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
-
+
}
// 选择题,切换答案
- changeOption = (index,ids) =>{
+ changeOption = (index, ids) => {
//console.log(index+" "+ids);
this.setState(
- (prevState) => ({
- exercise_questions : update(prevState.exercise_questions, {[index]: { user_answer: {$set: ids} }}),
+ (prevState) => ({
+ exercise_questions: update(prevState.exercise_questions, { [index]: { user_answer: { $set: ids } } }),
})
)
}
//简答题 显示和隐藏答案
- changeA_flag=(index,status)=>{
+ changeA_flag = (index, status) => {
this.setState(
- (prevState) => ({
- exercise_questions : update(prevState.exercise_questions, {[index]: { a_flag: {$set: status} }})
+ (prevState) => ({
+ exercise_questions: update(prevState.exercise_questions, { [index]: { a_flag: { $set: status } } })
})
)
}
//交卷和保存前判断是否有题未答
- checkExerciseNumber=(index)=>{
- let url= `/exercises/${this.props.match.params.Id}/begin_commit.json`;
- axios.get(url).then((result)=>{
- if(result){
- if(result.data.question_undo !=0 || result.data.shixun_undo !=0) {
- let tip="";
- if(result.data.question_undo !=0 && result.data.shixun_undo !=0){
- tip =`有 ${result.data.question_undo} 题未答,${result.data.shixun_undo} 实训未通关`;
- }else if(result.data.question_undo !=0 && result.data.shixun_undo ==0){
- tip =`有 ${result.data.question_undo} 题未答`;
- }else if(result.data.question_undo ==0 && result.data.shixun_undo !=0){
- tip =`有 ${result.data.shixun_undo} 实训未通关`;
+ checkExerciseNumber = (index) => {
+ let url = `/exercises/${this.props.match.params.Id}/begin_commit.json`;
+ axios.get(url).then((result) => {
+ if (result) {
+ if (result.data.question_undo != 0 || result.data.shixun_undo != 0) {
+ let tip = "";
+ if (result.data.question_undo != 0 && result.data.shixun_undo != 0) {
+ tip = `有 ${result.data.question_undo} 题未答,${result.data.shixun_undo} 实训未通关`;
+ } else if (result.data.question_undo != 0 && result.data.shixun_undo == 0) {
+ tip = `有 ${result.data.question_undo} 题未答`;
+ } else if (result.data.question_undo == 0 && result.data.shixun_undo != 0) {
+ tip = `有 ${result.data.shixun_undo} 实训未通关`;
}
this.setState({
- Modalstype:true,
- Modalstopval:tip,
- modalsBottomval:index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`,
- ModalCancel:this.cancelCommit,
- ModalSave:()=>this.sureCommitOrSave(index),
- Loadtype:index === 0 ? true :false
+ Modalstype: true,
+ Modalstopval: tip,
+ modalsBottomval: index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`,
+ ModalCancel: this.cancelCommit,
+ ModalSave: () => this.sureCommitOrSave(index),
+ Loadtype: index === 0 ? true : false
})
- }else{
+ } else {
this.setState({
- Modalstype:true,
- Modalstopval:index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`,
- modalsBottomval:undefined,
- ModalCancel:this.cancelCommit,
- ModalSave:()=>this.sureCommitOrSave(index),
- Loadtype:index === 0 ? true :false
+ Modalstype: true,
+ Modalstopval: index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`,
+ modalsBottomval: undefined,
+ ModalCancel: this.cancelCommit,
+ ModalSave: () => this.sureCommitOrSave(index),
+ Loadtype: index === 0 ? true : false
})
}
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
//交卷
- commitExercise=()=>{
+ commitExercise = () => {
this.checkExerciseNumber(1);
}
//保存
- saveExercise=()=>{
+ saveExercise = () => {
this.checkExerciseNumber(0);
}
//确认交卷或者保存
- sureCommitOrSave=(index)=>{
- if(index===0){
+ sureCommitOrSave = (index) => {
+ if (index === 0) {
//确认保存
this.cancelCommit();
this.sureCommit();
- }else{
+ } else {
//交卷
- let eId=this.props.match.params.Id;
- let url=`/exercises/${eId}/commit_exercise.json`;
- axios.post(url,{
- commit_method:1
- }).then((result)=>{
- if(result){
+ let eId = this.props.match.params.Id;
+ let url = `/exercises/${eId}/commit_exercise.json`;
+ axios.post(url, {
+ commit_method: 1
+ }).then((result) => {
+ if (result) {
this.setState({
- Modalstype:false,
- Modalstopval:undefined,
- modalsBottomval:undefined,
- ModalCancel:undefined,
- ModalSave:undefined,
- Loadtype:undefined
+ Modalstype: false,
+ Modalstopval: undefined,
+ modalsBottomval: undefined,
+ ModalCancel: undefined,
+ ModalSave: undefined,
+ Loadtype: undefined
})
this.props.showNotification(`${result.data.message}`);
this.getInfo();
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
}
- cancelCommit=()=>{
+ cancelCommit = () => {
this.setState({
- Modalstype:false,
- Modalstopval:undefined,
- modalsBottomval:undefined,
- ModalCancel:undefined,
- ModalSave:undefined,
- Loadtype:undefined
+ Modalstype: false,
+ Modalstopval: undefined,
+ modalsBottomval: undefined,
+ ModalCancel: undefined,
+ ModalSave: undefined,
+ Loadtype: undefined
})
}
// 打回重做
- RepeatExercise=()=>{
- let status=parseInt(this.state.exercise.exercise_status);
- if(status === 3){
+ RepeatExercise = () => {
+ let status = parseInt(this.state.exercise.exercise_status);
+ if (status === 3) {
this.setState({
- Modalstype:true,
- Modalstopval:'截止时间已到,无法打回试卷',
- modalsBottomval:'请在修改截止时间后再操作',
- ModalCancel:this.cancelCommit,
- ModalSave:this.cancelCommit,
- Loadtype:true
+ Modalstype: true,
+ Modalstopval: '截止时间已到,无法打回试卷',
+ modalsBottomval: '请在修改截止时间后再操作',
+ ModalCancel: this.cancelCommit,
+ ModalSave: this.cancelCommit,
+ Loadtype: true
})
- }else{
+ } else {
this.setState({
- Modalstype:true,
- Modalstopval:'学生将得到一次重新答题的机会,现有的答题情况将被清空',
- modalsBottomval:'是否确认回退TA的试卷答题',
- ModalCancel:this.cancelCommit,
- ModalSave:this.sureRepeatExercise,
- Loadtype:false
+ Modalstype: true,
+ Modalstopval: '学生将得到一次重新答题的机会,现有的答题情况将被清空',
+ modalsBottomval: '是否确认回退TA的试卷答题',
+ ModalCancel: this.cancelCommit,
+ ModalSave: this.sureRepeatExercise,
+ Loadtype: false
})
}
}
- sureRepeatExercise=()=>{
- let eId=this.props.match.params.Id;
- let user_id=this.state.Id;
- let url=`/exercises/${eId}/redo_exercise.json`
- axios.post((url),{
- user_ids:[user_id]
- }).then((result)=>{
- if(result){
+ sureRepeatExercise = () => {
+ let eId = this.props.match.params.Id;
+ let user_id = this.state.Id;
+ let url = `/exercises/${eId}/redo_exercise.json`
+ axios.post((url), {
+ user_ids: [user_id]
+ }).then((result) => {
+ if (result) {
this.props.showNotification(`${result.data.message}`);
//打回重做后跳转到答题列表页
this.sureCommit();
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
// 返回
- returnBtn = () =>{
- let coursesId=this.props.match.params.coursesId;
- let eId=this.props.match.params.Id;
+ returnBtn = () => {
+ let coursesId = this.props.match.params.coursesId;
+ let eId = this.props.match.params.Id;
this.props.history.push(`/courses/${coursesId}/exercises/${eId}/student_exercise_list?tab=0`)
}
- deadline=(time)=>{
- if(time===null){
+ deadline = (time) => {
+ if (time === null) {
this.setState({
- Datetime:0
+ Datetime: 0
})
- }else{
+ } else {
this.setState({
- Datetime:Date.now() + time * 1000
+ Datetime: Date.now() + time * 1000
})
// return Date.now() + time * 1000 ;
}
}
- render(){
- let coursesId=this.props.match.params.coursesId;
- let eId=this.props.match.params.Id;
+ render() {
+ let coursesId = this.props.match.params.coursesId;
+ let eId = this.props.match.params.Id;
- let{
+ let {
data,
questionPanelFixed,
courseName,
@@ -634,17 +637,17 @@ class ExerciseReviewAndAnswer extends Component{
exerciseTotalScore,
isSpin,
ajustSore
- }=this.state
+ } = this.state
let isAdmin = this.props.isAdmin();
- let isStudent =this.props.isStudent();
+ let isStudent = this.props.isStudent();
const { current_user } = this.props
// console.log(data&&data.exercise.user_name)
- document.title=courseName&&courseName;
+ document.title = courseName && courseName;
- return(
-
+ return (
+
-
- {/**/}
- */}
+
-
-
- {courseName}
- >
- {data && data.left_banner_name}
- >
- {data && data.left_banner_name}详情>
- {exercise_answer_user&&exercise_answer_user.user_name}{data&&data.exercise.user_name}
-
-
- {exercise && exercise.exercise_name}
-
-
-
-
- {
- (isAdmin || ( isStudent && exercise && user_exercise_status == 1)) ?
- 返回
- :
- time && time != 0 ?
-
-
-
- :""
- }
- {/*
*/}
- {/*
{ hour >= 10 ? hour : '0'+hour}*/}
- {/* :*/}
- {/* { minute >= 10 ? minute : '0'+minute}*/}
- {/* :*/}
- {/* { second >= 10 ? second : '0'+second}*/}
- {/**/}
- {
- isAdmin &&
打回重做
- }
-
- {
- exercise && exercise.exercise_description &&
-
{exercise.exercise_description}
- }
-
- {
- exercise_types && exercise_types.q_singles > 0 &&
- 单选题 {exercise_types.q_singles} 题,共 {exercise_types && exercise_types.q_singles_scores} 分
- }
- {
- exercise_types && exercise_types.q_doubles > 0 &&
- 多选题 {exercise_types.q_doubles} 题,共 {exercise_types && exercise_types.q_doubles_scores} 分
- }
- {
- exercise_types && exercise_types.q_judges > 0 &&
- 判断题 {exercise_types.q_judges} 题,共 {exercise_types && exercise_types.q_judges_scores} 分
- }
- {
- exercise_types && exercise_types.q_nulls > 0 &&
- 填空题 {exercise_types.q_nulls} 题,共 {exercise_types && exercise_types.q_nulls_scores} 分
- }
- {
- exercise_types && exercise_types.q_mains > 0 &&
- 简答题 {exercise_types.q_mains} 题,共 {exercise_types && exercise_types.q_mains_scores} 分
- }
+
+
+ {courseName}
+ >
+ {data && data.left_banner_name}
+ >
+ {data && data.left_banner_name}详情>
+ {exercise_answer_user && exercise_answer_user.user_name}{data && data.exercise.user_name}
+
+
+ {exercise && exercise.exercise_name}
+
+
+
+
+ {
+ (isAdmin || (isStudent && exercise && user_exercise_status == 1)) ?
+ 返回
+ :
+ time && time != 0 ?
+
+
+
+ : ""
+ }
+ {/*
*/}
+ {/*
{ hour >= 10 ? hour : '0'+hour}*/}
+ {/* :*/}
+ {/* { minute >= 10 ? minute : '0'+minute}*/}
+ {/* :*/}
+ {/* { second >= 10 ? second : '0'+second}*/}
+ {/**/}
+ {
+ isAdmin &&
打回重做
+ }
+
{
- exercise_types && exercise_types.q_shixuns > 0 &&
-
实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分
+ exercise && exercise.exercise_description &&
+
{exercise.exercise_description}
}
-
共 {exercise_types &&exercise_types.q_scores} 分
-
合计 {exercise_types &&exercise_types.q_counts} 题:
-
-
-
-
-
- {
- exercise_start_at && 开始答题时间:{ exercise_start_at && moment(exercise_start_at).format(format) }
- }
- {
- (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) && exerciseTotalScore &&
- 总分: { exerciseTotalScore } 分
- }
-
+
+ {
+ exercise_types && exercise_types.q_singles > 0 &&
+ 单选题 {exercise_types.q_singles} 题,共 {exercise_types && exercise_types.q_singles_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_doubles > 0 &&
+ 多选题 {exercise_types.q_doubles} 题,共 {exercise_types && exercise_types.q_doubles_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_judges > 0 &&
+ 判断题 {exercise_types.q_judges} 题,共 {exercise_types && exercise_types.q_judges_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_nulls > 0 &&
+ 填空题 {exercise_types.q_nulls} 题,共 {exercise_types && exercise_types.q_nulls_scores} 分
+ }
+ {
+ exercise_types && exercise_types.q_mains > 0 &&
+ 简答题 {exercise_types.q_mains} 题,共 {exercise_types && exercise_types.q_mains_scores} 分
+ }
{
- // 老师身份 || 学生身份且试卷已经截止
- (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) &&
-
+ exercise_types && exercise_types.q_shixuns > 0 &&
+
实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分
+ }
+
共 {exercise_types && exercise_types.q_scores} 分
+
合计 {exercise_types && exercise_types.q_counts} 题:
+
+
+
+
+
{
- exercise_scores && exercise_scores.objective_scores && exercise_scores.objective_scores.length > 0 &&
-
-
- 客观题
- 正确
- 错误
- 部分得分
-
-
-
+ exercise_start_at && 开始答题时间:{exercise_start_at && moment(exercise_start_at).format(format)}
}
{
- exercise_scores && exercise_scores.subjective_scores.length > 0 &&
-
+ (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) && exerciseTotalScore &&
+
总分: {exerciseTotalScore} 分
+ }
+
+ {
+ // 老师身份 || 学生身份且试卷已经截止
+ (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) &&
+
+ {
+ exercise_scores && exercise_scores.objective_scores && exercise_scores.objective_scores.length > 0 &&
+
+
+ 客观题
+ 正确
+ 错误
+ 部分得分
+
+
+
+ }
+ {
+ exercise_scores && exercise_scores.subjective_scores.length > 0 &&
+
+ }
+
+ }
+
+ {
+ //学生身份 且试卷还未截止
+ isStudent && exercise && exercise.exercise_status == 2 ?
+
- 主观题
- 已评
- 未评
+ 已答
+ 未答
-
- }
-
- }
-
- {
- //学生身份 且试卷还未截止
- isStudent && exercise && exercise.exercise_status == 2 ?
- :""
- }
-
- {/* 试卷题目 */}
-
- {
- exercise_questions && exercise_questions.map((item,key)=>{
- let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id);
- return(
-
-
- {item.q_position}、{type[item.question_type]}({item.question_score}分)
-
- {
- // 填空(一直都有调分),和简答题调分:老师身份 已经评分的才能出现调分按钮
- isAdmin && ((parseInt(item.answer_status) != 0 && item.question_type == 4) || item.question_type == 3 || item.question_type == 1) ?
- this.showSetScore(key,item.setScore,item.q_position,item.question_type,item.question_id)}>调分:""
- }
- {
- // 简答题,未评分的显示未批
- isAdmin && parseInt(item.answer_status) == 0 && item.question_type == 4 ?
- 未批:""
- }
- {
- // 客观题:老师||学生(试卷已截止且答案公开)显示正确答案
- item.question_type < 3 && item.standard_answer_show ?
-
- 正确答案:{ item.standard_answer_show }
- :""
- }
- {
- //(老师身份且除实训题外) || (学生身份且试卷已经截止)就显示用户当前题目所得分数
- ( isAdmin || (isStudent && exercise.exercise_status == 3)) && item.question_type != 5 && item.user_score ?
-
- {item.user_score} 分
- : ""
- }
- {
- //实训题 ,答题
- item.question_type == 5 &&
- 实训详情
- }
-
-
-
- {/* */}
-
-
- {
- // 选择题和判断题共用
- (item.question_type == 0 || item.question_type == 2) &&
-
this.changeOption(index,ids)}
- changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
- index={key}
- >
- }
- {
- // 多选题
- item.question_type == 1 &&
-
this.changeOption(index,ids)}
- changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
- index={key}
+ : ""
+ }
+
+ {/* 试卷题目 */}
+
+ {
+ exercise_questions && exercise_questions.map((item, key) => {
+ let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id);
+ return (
+
+
+ {item.q_position}、{type[item.question_type]}({item.question_score}分)
+
+ {
+ // 填空(一直都有调分),和简答题调分:老师身份 已经评分的才能出现调分按钮
+ isAdmin && ((parseInt(item.answer_status) != 0 && item.question_type == 4) || item.question_type == 3 || item.question_type == 1) ?
+ this.showSetScore(key, item.setScore, item.q_position, item.question_type, item.question_id)}>调分 : ""
+ }
+ {
+ // 简答题,未评分的显示未批
+ isAdmin && parseInt(item.answer_status) == 0 && item.question_type == 4 ?
+ 未批 : ""
+ }
+ {
+ // 客观题:老师||学生(试卷已截止且答案公开)显示正确答案
+ item.question_type < 3 && item.standard_answer_show ?
+
+ 正确答案:{item.standard_answer_show}
+ : ""
+ }
+ {
+ //(老师身份且除实训题外) || (学生身份且试卷已经截止)就显示用户当前题目所得分数
+ (isAdmin || (isStudent && exercise.exercise_status == 3)) && item.question_type != 5 && item.user_score ?
+
+ {item.user_score} 分
+ : ""
+ }
+ {
+ //实训题 ,答题
+ item.question_type == 5 &&
+ 实训详情
+ }
+
+
+
+ {/* */}
+
+
+ {
+ // 选择题和判断题共用
+ (item.question_type == 0 || item.question_type == 2) &&
+
this.changeOption(index, ids)}
+ changeQuestionStatus={(No, flag) => this.changeQuestionStatus(No, flag)}
+ index={key}
+ >
+ }
+ {
+ // 多选题
+ item.question_type == 1 &&
+
this.changeOption(index, ids)}
+ changeQuestionStatus={(No, flag) => this.changeQuestionStatus(No, flag)}
+ index={key}
>
- }
- {
- // 填空题
- item.question_type == 3 &&
-
this.changeQuestionStatus(No,flag)}
- index={key}
-
- >
- }
- {
- // 简答题
- item.question_type == 4 &&
-
this.changeQuestionStatus(No,flag)}
- changeA_flag={(index,status)=>this.changeA_flag(index,status)}
- index={key}
- >
- }
- {
- // 实训题
- item.question_type == 5 &&
-
- }
-
- {
- //调分理由部分
- item.question_comments && item.question_comments.comment && (item.question_type == 3 || item.question_type == 4 || item.question_type == 1) &&
-
-
![]({getImageUrl(`images/${item.question_comments.user_picture}`)})
-
-
- {item.question_comments.user_name}
- {moment(item.question_comments.updated_at).format(format)}
-
- {item.question_comments.comment}
-
-
- }
- {
- // 调分输入部分
- isAdmin && ((item.setScore && item.question_type == 3) || (item.setScore && item.question_type == 1) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4))?
-
-
-
*调分:
-
-
- 0 && list[0].inputSore}
- step={0.1}
- precision={1}
- className={ list && list.length>0 && list[0].setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"}
- onChange={(value)=>this.inputScore(value,item.question_id)}
- id={`${"input_"+item.q_position+"_"+item.question_type}`}
- >
- 分
- {
- parseInt(item.answer_status) == 0 && item.question_type == 4 ? 未评分 : ''
- }
- this.setAction(key,item.question_id,item.question_score,item.user_score)}>确认
-
- {
- list && list.length > 0 && list[0].setTip !="" ? { list[0].setTip }
:""
- }
-
+ }
+ {
+ // 填空题
+ item.question_type == 3 &&
+
this.changeQuestionStatus(No, flag)}
+ index={key}
+
+ >
+ }
+ {
+ // 简答题
+ item.question_type == 4 &&
+
this.changeQuestionStatus(No, flag)}
+ changeA_flag={(index, status) => this.changeA_flag(index, status)}
+ index={key}
+ >
+ }
+ {
+ // 实训题
+ item.question_type == 5 &&
+
+ }
+
+ {
+ //调分理由部分
+ item.question_comments && item.question_comments.comment && (item.question_type == 3 || item.question_type == 4 || item.question_type == 1) &&
+
+
![]({getImageUrl(`images/${item.question_comments.user_picture}`)})
+
+
+ {item.question_comments.user_name}
+ {moment(item.question_comments.updated_at).format(format)}
+
+ {item.question_comments.comment}
+
-
-
:""
- }
-
- )
- })
- }
+ }
+ {
+ // 调分输入部分
+ isAdmin && ((item.setScore && item.question_type == 3) || (item.setScore && item.question_type == 1) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4)) ?
+
+
+
*调分:
+
+
+ 0 && list[0].inputSore}
+ step={0.1}
+ precision={1}
+ className={list && list.length > 0 && list[0].setTip != "" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"}
+ onChange={(value) => this.inputScore(value, item.question_id)}
+ id={`${"input_" + item.q_position + "_" + item.question_type}`}
+ >
+ 分
+ {
+ parseInt(item.answer_status) == 0 && item.question_type == 4 ? 未评分 : ''
+ }
+ this.setAction(key, item.question_id, item.question_score, item.user_score)}>确认
+
+ {
+ list && list.length > 0 && list[0].setTip != "" ? {list[0].setTip}
: ""
+ }
+
+
+
+
: ""
+ }
+
+ )
+ })
+ }
+
+ {
+ isStudent && user_exercise_status == 0 ?
+
+ 交卷
+ 保存
+ {
+ exercise && time != null ?
+ 保存或者离开页面后,系统将持续计时,到达时长系统将自动交卷
+ : ""
+ }
+
: ""
+ }
- {
- isStudent && user_exercise_status == 0 ?
-
- 交卷
- 保存
- {
- exercise && time != null ?
- 保存或者离开页面后,系统将持续计时,到达时长系统将自动交卷
- :""
- }
-
:""
- }
-
)
diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js
index 28cb4b029..34dc6b0c3 100644
--- a/public/react/src/modules/courses/poll/PollInfo.js
+++ b/public/react/src/modules/courses/poll/PollInfo.js
@@ -1,5 +1,5 @@
-import React,{ Component } from "react";
-import {Checkbox,Radio, Input} from "antd";
+import React, { Component } from "react";
+import { Checkbox, Radio, Input } from "antd";
import '../css/members.css'
import '../css/busyWork.css'
@@ -12,161 +12,160 @@ import CoursesListType from '../coursesPublic/CoursesListType';
import axios from 'axios';
-const map={1:"单选题",2:"多选题",3:"主观题"}
-const statudmap={1:"未发布",2:"提交中",3:"已截止"}
-class PollInfo extends Component{
- constructor(props){
+const map = { 1: "单选题", 2: "多选题", 3: "主观题" }
+const statudmap = { 1: "未发布", 2: "提交中", 3: "已截止" }
+class PollInfo extends Component {
+ constructor(props) {
super(props);
- this.state={
- courseName:undefined,
- poll:undefined,
- question_answered:undefined,
- question_types:undefined,
- questions:undefined,
- inputArray:[],
- modalsType:false,
- modalsTopval:undefined,
- modalsBottomval:undefined,
- loadtype:true,
- modalSave:undefined,
- questionPanelFixed:false,
- pollAnswerList:[]
+ this.state = {
+ courseName: undefined,
+ poll: undefined,
+ question_answered: undefined,
+ question_types: undefined,
+ questions: undefined,
+ inputArray: [],
+ modalsType: false,
+ modalsTopval: undefined,
+ modalsBottomval: undefined,
+ loadtype: true,
+ modalSave: undefined,
+ questionPanelFixed: false,
+ pollAnswerList: []
}
}
- componentDidUpdate (prevProps) {
- // 需要等get_user_info执行完才能getInfo
+ componentDidUpdate(prevProps) {
if (!prevProps.current_user && this.props.current_user) {
this.getInfo()
}
}
-
- componentDidMount(){
- if(this.props.current_user){
+
+ componentDidMount() {
+ if (this.props.current_user) {
this.getInfo();
}
//window.addEventListener('scroll', this.handleScroll);
}
-
+
// 滚动定位
- handleScroll=()=>{
- if(parseInt(window.scrollY)>230){
+ handleScroll = () => {
+ if (parseInt(window.scrollY) > 230) {
this.setState({
- questionPanelFixed:true
+ questionPanelFixed: true
})
- }else{
+ } else {
this.setState({
- questionPanelFixed:false
+ questionPanelFixed: false
})
}
}
- scrollToAnchor=(index)=>{
- let name="Anchor_"+index;
+ scrollToAnchor = (index) => {
+ let name = "Anchor_" + index;
if (index) {
let anchorElement = document.getElementById(name);
- if(anchorElement) { anchorElement.scrollIntoView(); }
+ if (anchorElement) { anchorElement.scrollIntoView(); }
}
}
- getInfo=()=>{
+ getInfo = () => {
this.setState({
- courseName:this.props.current_user.course_name
+ courseName: this.props.current_user.course_name
})
- let pollId=this.props.match.params.pollId;
- let user_id=this.props.match.params.login;
- let url=`/polls/${pollId}/start_answer.json?login=${user_id}`
- axios.get(url).then((result)=>{
- if(result.status==200){
+ let pollId = this.props.match.params.pollId;
+ let user_id = this.props.match.params.login;
+ let url = `/polls/${pollId}/start_answer.json?login=${user_id}`
+ axios.get(url).then((result) => {
+ if (result.status == 200) {
this.setState({
- poll:result.data.poll,
- question_answered:result.data.question_answered,
- question_types:result.data.question_types,
- questions:result.data.questions
+ poll: result.data.poll,
+ question_answered: result.data.question_answered,
+ question_types: result.data.question_types,
+ questions: result.data.questions
})
- let list=[];
- for(var i=0;i
{
+ }).catch((error) => {
console.log(error);
})
}
//选中选择题(单选题)选项保存
- ChangeOptionSingle=(item)=>{
- let arr=item.target.name
- let txt=Object.assign({}, this.state.inputArray[parseInt(arr[1])]);
- let ids=item.target.value;
- let list=txt.answersList.filter(element => element.answer_id == ids);
-
- this.postAnswer(arr[0],ids,list[0].answer_text=="其他"?txt.text:"",arr[1]);
+ ChangeOptionSingle = (item) => {
+ let arr = item.target.name
+ let txt = Object.assign({}, this.state.inputArray[parseInt(arr[1])]);
+ let ids = item.target.value;
+ let list = txt.answersList.filter(element => element.answer_id == ids);
+
+ this.postAnswer(arr[0], ids, list[0].answer_text == "其他" ? txt.text : "", arr[1]);
}
//选中选择题(多选题)选项保存
- ChangeOptionMuntil=(a_id,q_id,key)=>{
- let ind=Object.assign({}, this.state.inputArray[parseInt(key)]);
- let count=0;
+ ChangeOptionMuntil = (a_id, q_id, key) => {
+ let ind = Object.assign({}, this.state.inputArray[parseInt(key)]);
+ let count = 0;
a_id.forEach(element => {
- let list=ind.answersList.filter(item=>item.answer_id==element);
- if(list[0].answer_text=="其他"){
+ let list = ind.answersList.filter(item => item.answer_id == element);
+ if (list[0].answer_text == "其他") {
count++;
}
});
- this.postAnswer(q_id,a_id,count > 0 ? ind.text : "",key);
+ this.postAnswer(q_id, a_id, count > 0 ? ind.text : "", key);
}
- postAnswer=(q_id,a_id,text,key)=>{
- let url=`/poll_questions/${q_id}/poll_votes.json`;
+ postAnswer = (q_id, a_id, text, key) => {
+ let url = `/poll_questions/${q_id}/poll_votes.json`;
console.log(text);
- axios.post(url,{
- poll_answer_id:a_id,
- vote_text:text
- }).then((result)=>{
- if(result){
- const answer=Object.assign({}, this.state.question_answered[parseInt(key)]);
- answer.ques_status=result.data.poll_vote.question_status;
- const question_answered=this.state.question_answered;
- question_answered[parseInt(key)]=answer
-
- const inputs=Object.assign({}, this.state.inputArray[parseInt(key)]);
- inputs.answers=a_id;
- const inputArray=this.state.inputArray;
- inputArray[parseInt(key)]=inputs;
+ axios.post(url, {
+ poll_answer_id: a_id,
+ vote_text: text
+ }).then((result) => {
+ if (result) {
+ const answer = Object.assign({}, this.state.question_answered[parseInt(key)]);
+ answer.ques_status = result.data.poll_vote.question_status;
+ const question_answered = this.state.question_answered;
+ question_answered[parseInt(key)] = answer
+
+ const inputs = Object.assign({}, this.state.inputArray[parseInt(key)]);
+ inputs.answers = a_id;
+ const inputArray = this.state.inputArray;
+ inputArray[parseInt(key)] = inputs;
this.setState({
question_answered,
inputArray
})
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
//输入其它--内容
- blurTxt=(e)=>{
- let index=parseInt(e.target.name)
+ blurTxt = (e) => {
+ let index = parseInt(e.target.name)
const list = Object.assign({}, this.state.inputArray[index])
- list.text=e.target.value;
- const inputArray=this.state.inputArray;
- inputArray[index]=list
+ list.text = e.target.value;
+ const inputArray = this.state.inputArray;
+ inputArray[index] = list
this.setState({
inputArray
@@ -175,121 +174,121 @@ class PollInfo extends Component{
//输入其它--内容后重新保存
- saveInputAndAnswer=(e,a_id,q_id,key,type)=>{
- const inputs=Object.assign({}, this.state.inputArray[parseInt(key)]);
- let answers=inputs.answers;
- let flag=true;
- if(answers.length){
- flag=answers.indexOf(a_id) > -1?true:false;
- answers= type == 1 ? answers[0] : answers;
- }else{
- flag = answers==a_id?true:false;
+ saveInputAndAnswer = (e, a_id, q_id, key, type) => {
+ const inputs = Object.assign({}, this.state.inputArray[parseInt(key)]);
+ let answers = inputs.answers;
+ let flag = true;
+ if (answers.length) {
+ flag = answers.indexOf(a_id) > -1 ? true : false;
+ answers = type == 1 ? answers[0] : answers;
+ } else {
+ flag = answers == a_id ? true : false;
}
- if(answers && (answers.length>0 || answers !="")){
- this.postAnswer(q_id,answers,flag ? inputs.text : "",key);
+ if (answers && (answers.length > 0 || answers != "")) {
+ this.postAnswer(q_id, answers, flag ? inputs.text : "", key);
}
}
//提交主观题
- commitText=(key,q_id)=>{
+ commitText = (key, q_id) => {
const text = Object.assign({}, this.state.inputArray[key]).text;
-
- let url='/poll_questions/'+q_id+'/poll_votes.json?';
- const ans=Object.assign({}, this.state.question_answered[key]);
- ans.ques_status=text ? 1 : 0 ;
- const questionAnswered=this.state.question_answered;
- questionAnswered[key]=ans
+ let url = '/poll_questions/' + q_id + '/poll_votes.json?';
+
+ const ans = Object.assign({}, this.state.question_answered[key]);
+ ans.ques_status = text ? 1 : 0;
+ const questionAnswered = this.state.question_answered;
+ questionAnswered[key] = ans
this.setState({
- question_answered:questionAnswered
+ question_answered: questionAnswered
})
- if(text!=undefined){
- axios.post((url),{
- vote_text:text
- }).then((result)=>{
- if(result.status==200){
- const answer=Object.assign({}, this.state.question_answered[key]);
- answer.ques_status=result.data.poll_vote.question_status;
- const question_answered=this.state.question_answered;
- question_answered[key]=answer
+ if (text != undefined) {
+ axios.post((url), {
+ vote_text: text
+ }).then((result) => {
+ if (result.status == 200) {
+ const answer = Object.assign({}, this.state.question_answered[key]);
+ answer.ques_status = result.data.poll_vote.question_status;
+ const question_answered = this.state.question_answered;
+ question_answered[key] = answer
this.setState({
question_answered
})
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
-
+
}
// 提交
- submitPoll=()=>{
- let {inputArray,question_answered}=this.state;
- let must=0;
- let may=0;
- for(var j=0;j {
+ let { inputArray, question_answered } = this.state;
+ let must = 0;
+ let may = 0;
+ for (var j = 0; j < question_answered.length; j++) {
+ if (question_answered[j].ques_status == 0) {
+ if (inputArray[j].is_necessary == 1) {
must++;
- }else{
+ } else {
may++;
}
}
}
- if(must>0){
+ if (must > 0) {
this.setState({
- modalsType:true,
- modalsTopval:"有 "+must+" 题必答题未答,无法提交 ",
- modalsBottomval:"请完成全部必答题后再提交",
- loadtype:true,
- modalSave:this.cancelSubmit
+ modalsType: true,
+ modalsTopval: "有 " + must + " 题必答题未答,无法提交 ",
+ modalsBottomval: "请完成全部必答题后再提交",
+ loadtype: true,
+ modalSave: this.cancelSubmit
})
return;
}
- if(may >= 0){
+ if (may >= 0) {
this.setState({
- modalsType:true,
- modalsTopval: may>0 ? "有 "+may+" 题未答":"",
- modalsBottomval:"提交后无法再修改答题,是否确认提交?",
- loadtype:false,
- modalSave:this.sureSubmit
+ modalsType: true,
+ modalsTopval: may > 0 ? "有 " + may + " 题未答" : "",
+ modalsBottomval: "提交后无法再修改答题,是否确认提交?",
+ loadtype: false,
+ modalSave: this.sureSubmit
})
}
}
-
- cancelSubmit=()=>{
+
+ cancelSubmit = () => {
this.setState({
- modalsType:false,
- modalsTopval:"",
- modalsBottomval:""
+ modalsType: false,
+ modalsTopval: "",
+ modalsBottomval: ""
})
}
-
- sureSubmit=()=>{
- let pollId=this.props.match.params.pollId;
- let url=`/polls/${pollId}/commit_poll.json`
- axios.post(url).then((result)=>{
- if(result.status == 200){
+
+ sureSubmit = () => {
+ let pollId = this.props.match.params.pollId;
+ let url = `/polls/${pollId}/commit_poll.json`
+ axios.post(url).then((result) => {
+ if (result.status == 200) {
this.props.showNotification(result.data.message)
this.setState({
- modalsType:false,
- modalsTopval:"",
- modalsBottomval:""
+ modalsType: false,
+ modalsTopval: "",
+ modalsBottomval: ""
})
- window.location.href=`/courses/${this.props.match.params.coursesId}/polls/${pollId}/detail`
+ window.location.href = `/courses/${this.props.match.params.coursesId}/polls/${pollId}/detail`
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
- render(){
- let coursesId=this.props.match.params.coursesId;
- let{poll,question_answered,question_types,questions,courseName,
+ render() {
+ let coursesId = this.props.match.params.coursesId;
+ let { poll, question_answered, question_types, questions, courseName,
inputArray,
modalsType,
modalsTopval,
@@ -297,13 +296,13 @@ class PollInfo extends Component{
modalsBottomval,
modalSave,
questionPanelFixed
- }=this.state;
- const { current_user } = this.props
- let isAdmin=this.props.isAdmin();
- let isStudent=this.props.isStudent();
- document.title=courseName&&courseName;
- return(
-
+ } = this.state;
+ const { current_user } = this.props
+ let isAdmin = this.props.isAdmin();
+ let isStudent = this.props.isStudent();
+ document.title = courseName && courseName;
+ return (
+
{/*
*/}
>
问卷
>
- 问卷详情>
- {question_types&&question_types.user_name}
+ 问卷详情>
+ {question_types && question_types.user_name}
- {poll && poll.polls_name}
+ {poll && poll.polls_name}
{
- isAdmin || (poll && poll.user_poll_status == 1) ? 返回 :''
+ isAdmin || (poll && poll.user_poll_status == 1) ? 返回 : ''
}
-
+
{
poll && poll.polls_description &&
- {poll.polls_description}
+ {poll.polls_description}
}
@@ -346,15 +345,15 @@ class PollInfo extends Component{
}
{
question_types && question_types.q_doubles > 0 &&
- 多选题{ question_types && question_types.q_doubles }题
+ 多选题{question_types && question_types.q_doubles}题
}
{
question_types && question_types.q_mains > 0 &&
- 主观题{question_types &&question_types.q_mains}题
+ 主观题{question_types && question_types.q_mains}题
}
-
-
+
+
已答
未答
@@ -362,12 +361,12 @@ class PollInfo extends Component{
diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js
index 77b2d8ec1..dd96f5f3e 100644
--- a/public/react/src/modules/login/LoginDialog.js
+++ b/public/react/src/modules/login/LoginDialog.js
@@ -134,43 +134,6 @@ class LoginDialog extends Component {
Phonenumberisnotco: undefined,
})
}
- // let reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
- // let reg1 = /^1\d{10}$/;
- // let reg2=/^[a-zA-z]\w{3,14}$/;
- // // let reg3=/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
- // let value=this.refs.loginPassText.value;
- // let valuenum= value.length;
- // if(valuenum>0){
- // if(!reg.test(value)&&!reg1.test(value)&&!reg2.test(value)){
- // this.setState({regular:1})
- // return
- // }else{
- // // this.setState({loginValue:value});
- // this.setState({regular:0});
- // var stirngt;
- // if(value.length>0){
- // var str= value.replace(/\s*/g,"")
- // stirngt=str;
- // }else{
- // stirngt= value;
- // }
- // this.setState({
- // loginValue:stirngt,
- // });
- // }
- // }else{
- // this.setState({loginValue:value});
- // var stirngt;
- // if(value.length>0){
- // var str= value.replace(/\s*/g,"")
- // stirngt=str;
- // }else{
- // stirngt= value;
- // }
- // this.setState({
- // loginValue:stirngt,
- // });
- // }
};
//邮箱手机号验证
Emailphonenumberverification = (value, id) => {
@@ -388,49 +351,9 @@ class LoginDialog extends Component {
}
return response;
}, (error) => {
- // // if (error.response && error.response.data.error === '401 Unauthorized') {
- // // this.back_url = window.location.href;
- // // this.setState({
- // // isRender: true
- // // })
- // // // TODO 这里如果样式变了会出现css不加载的情况
- // // const $ = window.$;
- // // const ilessLoaded = window.getComputedStyle($('.log_nav li.active')[0], null)
- // // .getPropertyValue('border-bottom')
- // // == "2px solid rgb(69, 155, 229)"
- // // if (!ilessLoaded) {
- // // const isPort3007 = window.location.port == 3007;
- // // let _url_origin = isPort3007 ? 'http://localhost:3000' : ''
- // //
- // // $('head').append( $('
')
- // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) );
- // // $('head').append( $('
')
- // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) );
- // // }
- // // }
- // // return Promise.reject(error);
});
}
handleDialogClose = () => {
- // if(this.props.match.path==='/'){
- // this.setState({
- // isRender: false
- // })
- // this.props.Modifyloginvalue();
- // }else{
- // if(this.props.isloginCancel===undefined){
- // window.location.href="/";
- // this.props.Modifyloginvalue();
- // // this.setState({
- // // isRender: false
- // // })
- // // this.props.Modifyloginvalue();
- // }else{
- // this.setState({
- // isRender: false
- // })
- // this.props.Modifyloginvalue();
- // }
this.setState({
isRender: false
@@ -438,14 +361,6 @@ class LoginDialog extends Component {
this.props.Modifyloginvalue();
- // this.setState({
- // isRender: false
- // })
- // try {
- // this.props.Modifyloginvalue();
- // }catch (e) {
- //
- // }
}
loginEDU = () => {
@@ -464,7 +379,6 @@ class LoginDialog extends Component {
autologin: isGoingValue
}
).then((response) => {
- debugger;
if (response === undefined) {
return
}
diff --git a/public/react/src/modules/login/Trialapplicationysl.js b/public/react/src/modules/login/Trialapplicationysl.js
index 4537a2826..df6a1d115 100644
--- a/public/react/src/modules/login/Trialapplicationysl.js
+++ b/public/react/src/modules/login/Trialapplicationysl.js
@@ -59,8 +59,6 @@ class Trialapplicationysl extends Component {
}
getipthon = () => {
- // console.log("Trialapplicationysl");
- // console.log("70");
let url = `/users/get_user_info.json`
axios.get(url).then((result) => {
console.log(result);
diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js
index 45310673f..7ec7415e5 100644
--- a/public/react/src/modules/message/js/MessagSub.js
+++ b/public/react/src/modules/message/js/MessagSub.js
@@ -1,10 +1,10 @@
-import React, {Component} from 'react';
+import React, { Component } from 'react';
import {
Spin,
Pagination,
} from "antd";
import axios from 'axios';
-import {getImageUrl, markdownToHTML} from 'educoder';
+import { getImageUrl, markdownToHTML } from 'educoder';
import "../css/messagemy.css"
import NoneData from '../../../modules/courses/coursesPublic/NoneData'
//消息页面
@@ -48,7 +48,7 @@ class MessagSub extends Component {
this.setState({
isSpin: true,
})
- let {limit} = this.state;
+ let { limit } = this.state;
let url = `/users/tidings.json`;
axios.get((url), {
params: {
@@ -80,7 +80,7 @@ class MessagSub extends Component {
this.setState({
isSpin: true,
})
- let {typeysl, page, limit} = this.state;
+ let { typeysl, page, limit } = this.state;
let url = `/users/tidings.json`;
axios.get((url), {
params: {
@@ -118,7 +118,7 @@ class MessagSub extends Component {
gettourl = (item) => {
switch (item.container_type) {
- case "ApplyUserAuthentication" :
+ case "ApplyUserAuthentication":
if (item.tiding_type === "Apply") {
if (item.auth_type === 1) {
//系统管理页面
@@ -134,13 +134,13 @@ class MessagSub extends Component {
return window.open("/account/certification")
}
return;
- case "CancelUserAuthentication" :
+ case "CancelUserAuthentication":
// 账号管理页-认证信息
return window.open("/account/certification")
- case "CancelUserProCertification" :
+ case "CancelUserProCertification":
// 账号管理页-认证信息
return window.open("/account/certification")
- case "ApplyAddDepartment" :
+ case "ApplyAddDepartment":
if (item.tiding_type === "Apply") {
//部门审批
return window.open("/admins/department_applies")
@@ -150,7 +150,7 @@ class MessagSub extends Component {
return window.open("/account/profile")
}
return;
- case "ApplyAddSchools" :
+ case "ApplyAddSchools":
if (item.tiding_type === "Apply") {
// 单位审批
return window.open("/admins/unit_applies")
@@ -160,9 +160,9 @@ class MessagSub extends Component {
return window.open("/account/profile")
}
return;
- case "ApplyAction" :
+ case "ApplyAction":
switch (item.parent_container_type) {
- case "ApplyShixun" :
+ case "ApplyShixun":
if (item.tiding_type === "Apply") {
return window.open("/admins/shixun_authorizations")
}
@@ -170,7 +170,7 @@ class MessagSub extends Component {
// 实训详情页 :identifier = identifier
return window.open(`/shixuns/${item.identifier}/challenges`)
}
- case "ApplySubject" :
+ case "ApplySubject":
if (item.tiding_type === "Apply") {
// 实训课程发布
return window.open("/admins/subject_authorizations")
@@ -180,7 +180,7 @@ class MessagSub extends Component {
return window.open(`/paths/${item.parent_container_id}`)
}
- case "TrialAuthorization" :
+ case "TrialAuthorization":
if (item.tiding_type === "Apply") {
// 试用授权页面
return window.open("/managements/trial_authorization")
@@ -191,7 +191,7 @@ class MessagSub extends Component {
}
}
return;
- case 'JoinCourse' :
+ case 'JoinCourse':
// 课堂详情页 :id =
return window.open(`/courses/${item.belong_container_id}/teachers`)
case 'StudentJoinCourse':
@@ -203,34 +203,34 @@ class MessagSub extends Component {
//教学案例详情 :id = container_id
return window.open(`/courses/${item.belong_container_id}/students`);
}
- case 'DealCourse':
+ case 'DealCourse':
// 课堂详情页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`)
case 'TeacherJoinCourse':
// 课堂详情页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`)
- case 'Course' :
+ case 'Course':
// 课堂详情页 :id = container_id
if (item.tiding_type === "Delete") {
return;
}
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`)
- case 'ArchiveCourse' :
+ case 'ArchiveCourse':
// 课堂详情页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`)
- case "Shixun" :
+ case "Shixun":
return window.open(`/shixuns/${item.identifier}/challenges`)
- case "Subject" :
+ case "Subject":
// 课程汇总详情页 :id = container_id
return window.open(`/paths/${item.container_id}`)
- case "JournalsForMessage" :
+ case "JournalsForMessage":
switch (item.parent_container_type) {
- case "Principal" :
+ case "Principal":
// 反馈页 :id = parent_container_id
// 不用跳了
return '';
- case "HomeworkCommon" :
+ case "HomeworkCommon":
//学生作业页 homework = parent_container_id
if (item.homework_type === "normal") {
//普通作业
@@ -245,10 +245,10 @@ class MessagSub extends Component {
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`)
}
return "";
- case "GraduationTopic" :
+ case "GraduationTopic":
// 毕业目标页 parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`)
- case "StudentWorksScore" :
+ case "StudentWorksScore":
//学生作业页
if (item.homework_type === "normal") {
//普通作业
@@ -264,45 +264,45 @@ class MessagSub extends Component {
}
return "";
}
- case "Memo" :
+ case "Memo":
// 交流问答页 :id = parent_container_id
return window.open(`/forums/${item.parent_container_id}`);
- case "Message" :
+ case "Message":
// 交流问答页 :id = parent_container_id
return window.open(`/forums/`);
- case "Watcher" :
+ case "Watcher":
// 用户个人中心页 :id = item.trigger_user.login
return window.open(`/users/${item.trigger_user.login}/courses`)
- case "PraiseTread" :
+ case "PraiseTread":
// 这块太复杂 不好处理
return '';
- case "Grade" :
+ case "Grade":
//个人中心页 :id = item.trigger_user.login
// return window.open(`/users/${item.trigger_user.login}/courses`;
return "";
- case "JoinProject" :
+ case "JoinProject":
//项目详情-申请加入项目审核页 :id = container_id
return window.open(`/projects/${item.container_id}`)
- case 'ReporterJoinProject':
+ case 'ReporterJoinProject':
//项目详情页 :id = container_id
return window.open(`/projects/${item.container_id}`)
- case 'DealProject':
+ case 'DealProject':
//项目详情页 :id = container_id
return window.open(`/projects/${item.container_id}`)
- case 'ManagerJoinProject':
+ case 'ManagerJoinProject':
//项目详情页 :id = container_id
return window.open(`/projects/${item.container_id}`)
case "Poll":
switch (item.parent_container_type) {
- case "CommitPoll" :
+ case "CommitPoll":
// 课堂id belong_container_id
//课堂-学生已提交问卷列表 :id = container_id
return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`)
- default :
+ default:
// 课堂-问卷列表 :id = container_id
return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`)
}
- case "Exercise" :
+ case "Exercise":
switch (item.parent_container_type) {
case "CommitExercise":
// 课堂-学生试卷详情 :id = container_id :user_id = trigger_user.id
@@ -312,28 +312,28 @@ class MessagSub extends Component {
// 课堂-学生试卷详情 :id = container_id :user_id = trigger_user.id
return window.open(` /courses/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`);
//记得跳评阅页面
- default :
+ default:
// 课堂-试卷列表详情 :id = container_id
return window.open(`/courses/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`);
}
- case 'StudentGraduationTopic' :
+ case 'StudentGraduationTopic':
//课堂-毕业选题详情 :id = parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`)
- case 'DealStudentTopicSelect' :
+ case 'DealStudentTopicSelect':
//课堂-毕业选题详情 :id = parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`)
- case 'GraduationTask' :
+ case 'GraduationTask':
//课堂-毕业任务页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`)
- case "GraduationWork" :
+ case "GraduationWork":
//课堂-毕业xx页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`)
- case "GraduationWorkScore" :
+ case "GraduationWorkScore":
// 课堂-毕业xx页 :id = parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.parent_container_id}`)
- case "HomeworkCommon" :
+ case "HomeworkCommon":
switch (item.parent_container_type) {
- case "AnonymousCommentFail" :
+ case "AnonymousCommentFail":
// 课堂-作业列表 homework = container_id
if (item.homework_type === "normal") {
//普通作业
@@ -347,7 +347,7 @@ class MessagSub extends Component {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
- case "HomeworkPublish" :
+ case "HomeworkPublish":
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
@@ -360,7 +360,7 @@ class MessagSub extends Component {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
- case "AnonymousAppeal" :
+ case "AnonymousAppeal":
if (item.homework_type === "normal") {
//普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
@@ -373,7 +373,7 @@ class MessagSub extends Component {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
- default :
+ default:
// 课堂-作业列表 homework = container_id
if (item.homework_type === "normal") {
//普通作业
@@ -388,7 +388,7 @@ class MessagSub extends Component {
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
}
- case "StudentWork" :
+ case "StudentWork":
//课堂-作业 :id = container_id
if (item.homework_type === "normal") {
//普通作业
@@ -402,54 +402,29 @@ class MessagSub extends Component {
//实训作业
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
}
- case "StudentWorksScore" :
- //课堂-作业 :id = parent_container_id
- // if(item.homework_type==="normal"){
- // //普通作业
- // return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
- // }
- // if(item.homework_type==="group"){
- // //分组作业
- // return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`)
- // }
- // if(item.homework_type==="practice"){
- // //实训作业
- // return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
- // }
+ case "StudentWorksScore":
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`);
- case "StudentWorksScoresAppeal" :
- // if(item.homework_type==="normal"){
- // //普通作业
- // return window.open(`courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`)
- // }
- // if(item.homework_type==="group"){
- // //分组作业
- // return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`)
- // }
- // if(item.homework_type==="practice"){
- // //实训作业
- // return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
- // }
+ case "StudentWorksScoresAppeal":
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`);
- case "ChallengeWorkScore" :
+ case "ChallengeWorkScore":
return '';
- case "SendMessage" :
+ case "SendMessage":
// /managements/mirror_repository
return window.open(`/managements/mirror_repository`)
- case "Journal" :
+ case "Journal":
//项目Issue页 :id = parent_container_id
return window.open(`/issues/${item.parent_container_id}`);
- case "Issue" :
+ case "Issue":
//项目Issue页 :id = container_id
return window.open(`/issues/${item.container_id}`)
- case "PullRequest" :
+ case "PullRequest":
// 项目pull request页 :id = parent_container_id
return window.open(`/projects/${item.parent_container_id}/pull_requests`)
- case "Department" :
+ case "Department":
//账号管理页
return window.open(`/account/profile`)
- case "Library" :
+ case "Library":
if (item.tiding_type === 'Apply') {
// /managements/library_applies
return window.open(`/admins/library_applies`)
@@ -458,7 +433,7 @@ class MessagSub extends Component {
//教学案例详情 :id = container_id
return window.open(`/moop_cases/${item.container_id}`)
}
- case "ProjectPackage" :
+ case "ProjectPackage":
if (item.tiding_type === "Destroyed") {
return;
}
@@ -516,14 +491,14 @@ class MessagSub extends Component {
if (item.extra && item.parent_container_type !== 'HackDelete') {
return window.open(`/problems/${item.extra}/edit`);
}
- default :
+ default:
return
}
}
render() {
- let {page, limit, typeysl, count, isSpin, data} = this.state;
+ let { page, limit, typeysl, count, isSpin, data } = this.state;
// console.log("6868686868");
console.log(data);
return (
@@ -614,12 +589,12 @@ class MessagSub extends Component {
className={boolps === true ? "ridinglist-sub clearfix df tiding_item" : "ridinglist-subs clearfix df tiding_item"}
onClick={() => this.gettourl(item)}>
![]()
this.myCome(item)}
- src={getImageUrl("images/" + item.trigger_user.image_url)}
- className="radius mr10 fl myimgw48 myimgh48"/>
+ src={getImageUrl("images/" + item.trigger_user.image_url)}
+ className="radius mr10 fl myimgw48 myimgh48" />
this.myCome(item)}>{item.trigger_user.name}
+ onMouseDown={() => this.myCome(item)}>{item.trigger_user.name}
{item.time}
{item.tiding_type === "Apply" ? (
item.status === 0 ?
@@ -639,8 +614,8 @@ class MessagSub extends Component {
`
}
-
+
@@ -655,13 +630,13 @@ class MessagSub extends Component {
{data === undefined ? ""
:
(count > 10 ?
-
: ""
+
: ""
)
}
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index 17bd92001..5afa9bae9 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Redirect } from 'react-router';
-import AccountProfile from"../user/AccountProfile";
+import AccountProfile from "../user/AccountProfile";
import PropTypes from 'prop-types';
import Certifiedprofessional from "../../modules/modals/Certifiedprofessional"
@@ -9,11 +9,11 @@ import Certifiedprofessional from "../../modules/modals/Certifiedprofessional"
// /images/educoder/icon/search.svg
-import { getImageUrl, toPath ,trigger,broadcastChannelPostMessage} from 'educoder'
+import { getImageUrl, toPath, trigger, broadcastChannelPostMessage } from 'educoder'
import axios from 'axios';
-import { Modal,Checkbox ,Radio,Input,message,notification,Popover} from 'antd';
+import { Modal, Checkbox, Radio, Input, message, notification, Popover } from 'antd';
import Addcourses from '../courses/coursesPublic/Addcourses';
@@ -50,53 +50,53 @@ window._header_componentHandler = null;
class NewHeader extends Component {
constructor(props) {
super(props)
- this.state={
- Addcoursestypes:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- RadioGroupvalue:undefined,
- submitapplications:false,
- isRender:false,
- showSearchOpentype:false,
- showTrial:false,
- setevaluatinghides:false,
- occupation:0,
- mydisplay:false,
- headtypesonClickbool:false,
- headtypess:"/",
- mygetHelmetapi2: null,
- goshowqqgtounp:false,
- visiblemyss:false,
+ this.state = {
+ Addcoursestypes: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ RadioGroupvalue: undefined,
+ submitapplications: false,
+ isRender: false,
+ showSearchOpentype: false,
+ showTrial: false,
+ setevaluatinghides: false,
+ occupation: 0,
+ mydisplay: false,
+ headtypesonClickbool: false,
+ headtypess: "/",
+ mygetHelmetapi2: null,
+ goshowqqgtounp: false,
+ visiblemyss: false,
}
- // console.log("176")
+ // console.log("176")
// console.log(props);
// console.log("NewHeader1234567890");
// console.log(this.props);
}
- componentDidUpdate = (prevProps) => {
- // console.log("componentDidMount2");
- // console.log(this.state.mygetHelmetapi2);
- if(this.state.mygetHelmetapi2===undefined){
- this.getAppdata();
- }
- }
+ componentDidUpdate = (prevProps) => {
+ // console.log("componentDidMount2");
+ // console.log(this.state.mygetHelmetapi2);
+ if (this.state.mygetHelmetapi2 === undefined) {
+ this.getAppdata();
+ }
+ }
componentDidMount() {
- // console.log("componentDidMount1");
- this.getAppdata();
+ // console.log("componentDidMount1");
+ this.getAppdata();
window._header_componentHandler = this;
//下拉框的显示隐藏
var hoverTimeout;
var hoveredPanel;
- $(".edu-menu-panel").hover(function(){
+ $(".edu-menu-panel").hover(function () {
if (hoverTimeout) { // 一次只显示一个panel
if (hoveredPanel && hoveredPanel != this) {
$(hoveredPanel).find(".edu-menu-list").hide()
@@ -106,21 +106,21 @@ class NewHeader extends Component {
}
hoveredPanel = this;
$(this).find(".edu-menu-list").show();
- },function(){
- var that =this;
+ }, function () {
+ var that = this;
// 延迟hide
- hoverTimeout = setTimeout(function() {
+ hoverTimeout = setTimeout(function () {
$(that).find(".edu-menu-list").hide();
}, 800)
});
//获取游览器地址
- try {
- window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href))
- } catch (e) {
+ try {
+ window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href))
+ } catch (e) {
- }
+ }
// axios.interceptors.response.use((response) => {
// if (response != undefined)
// if (response && response.data.status === -1) {
@@ -165,33 +165,33 @@ class NewHeader extends Component {
notification.open({
message: "提示",
description:
- messge,
+ messge,
});
};
componentWillReceiveProps(newProps, oldProps) {
this.setState({
- user:newProps.user
+ user: newProps.user
})
- if(newProps.Headertop!=undefined){
- old_url=newProps.Headertop.old_url
+ if (newProps.Headertop != undefined) {
+ old_url = newProps.Headertop.old_url
}
}
- getCookie=(key)=>{
- var arr,reg = RegExp('(^| )'+key+'=([^;]+)(;|$)');
+ getCookie = (key) => {
+ var arr, reg = RegExp('(^| )' + key + '=([^;]+)(;|$)');
if (arr = document.cookie.match(reg)) //["username=liuwei;", "", "liuwei", ";"]
return decodeURIComponent(arr[2]);
else
return null;
}
- delCookie=(name)=>{
+ delCookie = (name) => {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
- var cval=this.getCookie(name);
- if(cval!=null){
- document.cookie= name + "="+cval+";expires="+exp.toGMTString();
+ var cval = this.getCookie(name);
+ if (cval != null) {
+ document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
}
onLogout = () => {
@@ -200,96 +200,93 @@ class NewHeader extends Component {
axios.get(url, {
})
.then((response) => {
- if(response.data.status===1){
+ if (response.data.status === 1) {
this.setState({
- user:undefined
+ user: undefined
})
- // let path="/";
- // this.props.history.push(path);
- // broadcastChannelPostMessage('refreshPage')
- window.location.href ="/login"
+ window.location.href = "/login"
message.success('退出成功');
}
});
}
- tojoinclass=()=>{
- let{user} =this.state;
- if(user===undefined){
+ tojoinclass = () => {
+ let { user } = this.state;
+ if (user === undefined) {
this.setState({
- isRender:true
+ isRender: true
})
return
}
- if(user&&user.login===""){
+ if (user && user.login === "") {
this.setState({
- isRender:true
+ isRender: true
})
return;
}
- if(user&&user.profile_completed===false){
- this.setState({
- AccountProfiletype:true
- })
- return;
- }
+ if (user && user.profile_completed === false) {
+ this.setState({
+ AccountProfiletype: true
+ })
+ return;
+ }
- this.setState({
- Addcoursestypes:true,
+ this.setState({
+ Addcoursestypes: true,
})
}
- tojoinitem=()=>{
- if(this.props.user&&this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){
- this.openNotification("请先绑定邮箱,谢谢");
- return
- }
- let{user} =this.state;
- if(user===undefined){
+ tojoinitem = () => {
+ if (this.props.user && this.props.user.email === undefined || this.props.user && this.props.user.email === null || this.props.user && this.props.user.email === "") {
+ this.openNotification("请先绑定邮箱,谢谢");
+ return
+ }
+ let { user } = this.state;
+ if (user === undefined) {
this.setState({
- isRender:true
+ isRender: true
})
return
}
- if(user&&user.login===""){
+ if (user && user.login === "") {
this.setState({
- isRender:true
+ isRender: true
})
return;
}
- if(user&&user.profile_completed===false){
- this.setState({
- AccountProfiletype:true
- })
- return;
- }
+ if (user && user.profile_completed === false) {
+ this.setState({
+ AccountProfiletype: true
+ })
+ return;
+ }
- this.setState({
- tojoinitemtype:true
+ this.setState({
+ tojoinitemtype: true
})
}
- submitstatevalue=(sum,value,data)=>{
+ submitstatevalue = (sum, value, data) => {
this.setState({
- Addcoursestypes:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- submitapplicationssum:sum,
- submitapplications:true,
- submitapplicationsvalue:value,
- submitapplicationsvaluedata:data,
- RadioGroupvalue:undefined
+ Addcoursestypes: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ submitapplicationssum: sum,
+ submitapplications: true,
+ submitapplicationsvalue: value,
+ submitapplicationsvaluedata: data,
+ RadioGroupvalue: undefined
})
}
@@ -299,80 +296,53 @@ class NewHeader extends Component {
});
}
- submitsubmitapplications=()=>{
+ submitsubmitapplications = () => {
let {
submitapplicationssum,
submitapplicationsvaluedata
- }=this.state;
+ } = this.state;
this.setState({
- submitapplications:false,
- RadioGroupvalue:undefined
+ submitapplications: false,
+ RadioGroupvalue: undefined
})
- if(submitapplicationssum===0){
- if(submitapplicationsvaluedata!=undefined){
- window.location.href = "/courses/"+submitapplicationsvaluedata;
+ if (submitapplicationssum === 0) {
+ if (submitapplicationsvaluedata != undefined) {
+ window.location.href = "/courses/" + submitapplicationsvaluedata;
}
- }else if(submitapplicationssum===1){
- if(submitapplicationsvaluedata!=undefined){
- window.location.href = "/projects/"+submitapplicationsvaluedata;
+ } else if (submitapplicationssum === 1) {
+ if (submitapplicationsvaluedata != undefined) {
+ window.location.href = "/projects/" + submitapplicationsvaluedata;
}
}
}
- hidesubmitapplications=()=>{
+ hidesubmitapplications = () => {
this.setState({
- Addcoursestypes:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- submitapplications:false,
- RadioGroupvalue:undefined
+ Addcoursestypes: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ submitapplications: false,
+ RadioGroupvalue: undefined
})
}
- educoderlogin=()=>{
+ educoderlogin = () => {
//登录账号
this.setState({
- isRender:true
+ isRender: true
})
- // var url = `/accounts/logout.json`;
- //
- // axios.get((url)).then((result) => {
- // if(result!==undefined){
- // // this.setState({
- // // isRender:true
- // // })
- // window.location.href = "/";
- // }
- // }).catch((error) => {
- // console.log(error);
- // })
}
- educoderloginysl=()=>{
- //退出账号
- // this.setState({
- // isRender:true
- // })
- // let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'
- // let shixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess'
- // let openopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype'
+ educoderloginysl = () => {
var url = `/accounts/logout.json`;
- // let storage=window.localStorage;
axios.get((url)).then((result) => {
- // storage.removeItem(newTPMsettings);
- // storage.removeItem(shixunopenprocess);
- // storage.removeItem( openopenpublictype);
- if(result!==undefined){
- // this.setState({
- // isRender:true
- // })
- // broadcastChannelPostMessage('refreshPage')
+ if (result !== undefined) {
window.location.href = "/";
}
}).catch((error) => {
@@ -380,184 +350,184 @@ class NewHeader extends Component {
})
}
- hideAddcoursestypes=()=>{
+ hideAddcoursestypes = () => {
this.setState({
- Addcoursestypes:false
+ Addcoursestypes: false
})
};
- HideAddcoursestypess=(i)=>{
+ HideAddcoursestypess = (i) => {
console.log("调用了");
this.setState({
- Addcoursestypes:false,
- mydisplay:true,
- occupation:i,
+ Addcoursestypes: false,
+ mydisplay: true,
+ occupation: i,
})
};
- ModalCancelsy=()=>{
+ ModalCancelsy = () => {
this.setState({
- mydisplay:false,
+ mydisplay: false,
})
};
- hidetojoinclass=()=>{
+ hidetojoinclass = () => {
this.setState({
- tojoinclasstype:false,
- tojoinitemtype:false,
- tojoinclasstitle:undefined,
- rolearr:["",""],
- Checkboxteacherchecked:false,
- Checkboxstudentchecked:false,
- Checkboxteachingchecked:false,
- Checkboxteachertype:false,
- Checkboxteachingtype:false,
- code_notice:false,
- checked_notice:false,
- RadioGroupvalue:undefined
+ tojoinclasstype: false,
+ tojoinitemtype: false,
+ tojoinclasstitle: undefined,
+ rolearr: ["", ""],
+ Checkboxteacherchecked: false,
+ Checkboxstudentchecked: false,
+ Checkboxteachingchecked: false,
+ Checkboxteachertype: false,
+ Checkboxteachingtype: false,
+ code_notice: false,
+ checked_notice: false,
+ RadioGroupvalue: undefined
})
}
-submittojoinclass=(value)=>{
- let {tojoinclasstitle,rolearr,RadioGroupvalue}=this.state;
+ submittojoinclass = (value) => {
+ let { tojoinclasstitle, rolearr, RadioGroupvalue } = this.state;
- if(tojoinclasstitle===undefined){
- this.setState({
- code_notice:true
- })
- return
- }
- let newrolearr=rolearr;
- // if(value===1){
- if(tojoinclasstitle.length<6){
+ if (tojoinclasstitle === undefined) {
this.setState({
- code_notice:true
+ code_notice: true
})
return
}
- // }else if(value===0){
- // if(tojoinclasstitle.length<5){
- // this.setState({
- // code_notice:true
- // })
- // return
- // }
- // }
- if(tojoinclasstitle===""||tojoinclasstitle===undefined){
- this.setState({
- code_notice:true
- })
- return
- }else{
- this.setState({
- code_notice:false
- })
- }
+ let newrolearr = rolearr;
+ // if(value===1){
+ if (tojoinclasstitle.length < 6) {
+ this.setState({
+ code_notice: true
+ })
+ return
+ }
+ // }else if(value===0){
+ // if(tojoinclasstitle.length<5){
+ // this.setState({
+ // code_notice:true
+ // })
+ // return
+ // }
+ // }
+ if (tojoinclasstitle === "" || tojoinclasstitle === undefined) {
+ this.setState({
+ code_notice: true
+ })
+ return
+ } else {
+ this.setState({
+ code_notice: false
+ })
+ }
- let pamst=[];
- let num=0;
- for(var i = 0 ; i
{
- // if( response.data.state===0){
- // this.submitstatevalue(0,"加入成功",response.data.course_id)
- // }else if( response.data.state===1){
- // }else if( response.data.state===2){
- // this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)")
- // }else if( response.data.state===3){
- // this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id)
- // }else if( response.data.state===4){
- // this.submitstatevalue( 0,"您输入的邀请码错误)")
- // }else if( response.data.state===5){
- // this.submitstatevalue( 0,"您还未登录")
- // }else if( response.data.state===6){
- // this.submitstatevalue( 0,"申请已提交,请等待审核")
- // }else if( response.data.state===7){
- // this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待")
- // }else if( response.data.state===8){
- // this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id)
- // }else if( response.data.state==9){
- // this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id)
- // }else if( response.data.state==10){
- // this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id)
- // }else if( response.data.state==11){
- // this.submitstatevalue(0," 该课堂已归档,请联系老师")
- // }else if( response.data.state==12){
- // this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师")
- // }else if( response.data.state==13){
- // this.submitstatevalue(0,"您申请已提交,请等待审核")
- // }else if( response.data.state==14){
- // this.submitstatevalue("此邀请码已停用,请与老师联系")
- // }else if( response.data.state==15){
- // this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行")
- // }else {
- // this.submitstatevalue(0," 未知错误,请稍后再试")
- // }
- // })
- //
- // }
+ // if(value===0){
+ // let url="/courses/join_course_multi_role.json"
+ // const form = new FormData();
+ // form.append('invite_code', tojoinclasstitle);
+ // form.append('role', pamst);
+ // form.append('type', 1);
+ // axios.post(url,form,[true]
+ // ).then((response) => {
+ // if( response.data.state===0){
+ // this.submitstatevalue(0,"加入成功",response.data.course_id)
+ // }else if( response.data.state===1){
+ // }else if( response.data.state===2){
+ // this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)")
+ // }else if( response.data.state===3){
+ // this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id)
+ // }else if( response.data.state===4){
+ // this.submitstatevalue( 0,"您输入的邀请码错误)")
+ // }else if( response.data.state===5){
+ // this.submitstatevalue( 0,"您还未登录")
+ // }else if( response.data.state===6){
+ // this.submitstatevalue( 0,"申请已提交,请等待审核")
+ // }else if( response.data.state===7){
+ // this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待")
+ // }else if( response.data.state===8){
+ // this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id)
+ // }else if( response.data.state==9){
+ // this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id)
+ // }else if( response.data.state==10){
+ // this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id)
+ // }else if( response.data.state==11){
+ // this.submitstatevalue(0," 该课堂已归档,请联系老师")
+ // }else if( response.data.state==12){
+ // this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师")
+ // }else if( response.data.state==13){
+ // this.submitstatevalue(0,"您申请已提交,请等待审核")
+ // }else if( response.data.state==14){
+ // this.submitstatevalue("此邀请码已停用,请与老师联系")
+ // }else if( response.data.state==15){
+ // this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行")
+ // }else {
+ // this.submitstatevalue(0," 未知错误,请稍后再试")
+ // }
+ // })
+ //
+ // }
- if(value===1){
- let url="/project_applies.json"
- // const form = new FormData();
- // form.append('code', tojoinclasstitle);
- // form.append('role', RadioGroupvalue);
- // form.append('type', 1);
- axios.post(url,{
- code:tojoinclasstitle,
- role:RadioGroupvalue
- }
- ).then((response) => {
- if( response.data.status===1){
- this.submitstatevalue(1,"您输入的邀请码错误")
- }else if( response.data.status===2){
- this.submitstatevalue( 1,"您已经是该项目成员",response.data.project)
- }else if( response.data.status===3){
- this.submitstatevalue( 1,"请选择一个角色")
- }else if( response.data.status===4){
- this.submitstatevalue( 1,"您的申请已提交,请等待项目管理员审批")
- }else if( response.data.status===5){
- this.submitstatevalue( 1,"您已经申请加入该项目了,请耐心等待")
- }else if( response.data.status===6){
- this.submitstatevalue( 1,"您已成功加入项目",response.data.project)
- }else if( response.data.status===0){
- if(RadioGroupvalue==="reporter"){
- this.openNotification("您加入项目成功!");
- window.location.href=`/projects/${response.data.project_id}`;
- }else{
- this.openNotification("您的申请已提交,请等待项目管理员审批!");
- }
- }
- })
+ if (value === 1) {
+ let url = "/project_applies.json"
+ // const form = new FormData();
+ // form.append('code', tojoinclasstitle);
+ // form.append('role', RadioGroupvalue);
+ // form.append('type', 1);
+ axios.post(url, {
+ code: tojoinclasstitle,
+ role: RadioGroupvalue
+ }
+ ).then((response) => {
+ if (response.data.status === 1) {
+ this.submitstatevalue(1, "您输入的邀请码错误")
+ } else if (response.data.status === 2) {
+ this.submitstatevalue(1, "您已经是该项目成员", response.data.project)
+ } else if (response.data.status === 3) {
+ this.submitstatevalue(1, "请选择一个角色")
+ } else if (response.data.status === 4) {
+ this.submitstatevalue(1, "您的申请已提交,请等待项目管理员审批")
+ } else if (response.data.status === 5) {
+ this.submitstatevalue(1, "您已经申请加入该项目了,请耐心等待")
+ } else if (response.data.status === 6) {
+ this.submitstatevalue(1, "您已成功加入项目", response.data.project)
+ } else if (response.data.status === 0) {
+ if (RadioGroupvalue === "reporter") {
+ this.openNotification("您加入项目成功!");
+ window.location.href = `/projects/${response.data.project_id}`;
+ } else {
+ this.openNotification("您的申请已提交,请等待项目管理员审批!");
+ }
+ }
+ })
+ }
+ this.hidetojoinclass()
}
- this.hidetojoinclass()
-}
// trialapplications =()=>{
// console.log("点击了")
@@ -569,106 +539,106 @@ submittojoinclass=(value)=>{
// 关闭
cancelModulationModels = () => {
- this.setState({isRenders: false})
+ this.setState({ isRenders: false })
}
- inputjoinclassvalue=(e)=>{
+ inputjoinclassvalue = (e) => {
console.log(e.target.value.length);
- if(e.target.value.length>=7){
+ if (e.target.value.length >= 7) {
this.openNotification("请输入6位项目邀请码!");
return
}
this.setState({
- tojoinclasstitle:e.target.value
+ tojoinclasstitle: e.target.value
})
}
- showSearchOpen=(e)=>{
- this.setState({
- showSearchOpentype:true
- })
-
- }
-
- hideshowSearchOpen=(e)=>{
- let {setevaluatinghides}=this.state;
- if(setevaluatinghides===true){
- this.setState({
- showSearchOpentype:false,
- setevaluatinghides:false
- })
-
- }
- }
-
- onKeywordSearchKeyDown = (value) => {
- let url=`/search?value=${value}`;
- this.props.history.push(url)
- }
-
- onKeywordSearchKeyDowns=()=>{
- this.setState(
- {
- setevaluatinghides:false
- }
- )
- }
-
- setevaluatinghides=()=>{
- this.setState(
- {
- setevaluatinghides:true
- }
- )
- }
- //头部获取是否已经登录了
- getUser=(url,type)=>{
-
- if(type==="projects"){
- if(this.props.user&&this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){
- this.openNotification("请先绑定邮箱,谢谢");
- return
- }
- }
+ showSearchOpen = (e) => {
+ this.setState({
+ showSearchOpentype: true
+ })
+
+ }
+
+ hideshowSearchOpen = (e) => {
+ let { setevaluatinghides } = this.state;
+ if (setevaluatinghides === true) {
+ this.setState({
+ showSearchOpentype: false,
+ setevaluatinghides: false
+ })
+
+ }
+ }
+
+ onKeywordSearchKeyDown = (value) => {
+ let url = `/search?value=${value}`;
+ this.props.history.push(url)
+ }
+
+ onKeywordSearchKeyDowns = () => {
+ this.setState(
+ {
+ setevaluatinghides: false
+ }
+ )
+ }
+
+ setevaluatinghides = () => {
+ this.setState(
+ {
+ setevaluatinghides: true
+ }
+ )
+ }
+ //头部获取是否已经登录了
+ getUser = (url, type) => {
+
+ if (type === "projects") {
+ if (this.props.user && this.props.user.email === undefined || this.props.user && this.props.user.email === null || this.props.user && this.props.user.email === "") {
+ this.openNotification("请先绑定邮箱,谢谢");
+ return
+ }
+ }
// console.log("点击了503")
// console.log(url);
- let{user} =this.state;
+ let { user } = this.state;
- if(user===undefined){
- this.setState({
- isRender:true
- })
- return
+ if (user === undefined) {
+ this.setState({
+ isRender: true
+ })
+ return
}
- if(user&&user.login===""){
+ if (user && user.login === "") {
this.setState({
- isRender:true
+ isRender: true
})
return;
}
- if(user&&user.profile_completed===false){
- this.setState({
- AccountProfiletype:true
- })
- return;
- }
+ if (user && user.profile_completed === false) {
+ this.setState({
+ AccountProfiletype: true
+ })
+ return;
+ }
- if(type==="newshixuns"){
- if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){
- this.setgoshowqqgtounp(true);
- return;
+ if (type === "newshixuns") {
+ if (this.props && this.props.current_user && this.props.current_user.is_shixun_marker === false) {
+ this.setgoshowqqgtounp(true);
+ return;
+ }
}
- }
- if(url !== undefined || url!==""){
+ if (url !== undefined || url !== "") {
window.location.href = url;
}
@@ -676,211 +646,211 @@ submittojoinclass=(value)=>{
}
//修改登录方法
- Modifyloginvalue=()=>{
+ Modifyloginvalue = () => {
this.setState({
- isRender:false,
+ isRender: false,
})
}
- hideAccountProfile=()=>{
- this.setState({
- AccountProfiletype:false
- })
- };
- headtypesonClick=(url,bool)=>{
- this.setState({
- headtypess:url,
- headtypesonClickbool:bool,
- })
- }
- //获取数据为空的时候
- gettablogourlnull = () => {
- this.setState({
- mygetHelmetapi2: undefined
- });
- document.title = "EduCoder";
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = "/react/build/./favicon.ico";
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- };
-
- //获取数据的时候
- gettablogourldata = (response) => {
- document.title = response.data.setting.name;
- var link = document.createElement('link'),
- oldLink = document.getElementById('dynamic-favicon');
- link.id = 'dynamic-favicon';
- link.rel = 'shortcut icon';
- link.href = '/' + response.data.setting.tab_logo_url;
- if (oldLink) {
- document.head.removeChild(oldLink);
- }
- document.head.appendChild(link);
- }
-
-
- handleVisibleChanges = (boll) => {
- this.setState({
- visiblemyss: boll,
- })
-
- }
-
-
- getAppdata=()=>{
- try {
- var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
- var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
- // console.log("NewHeaderNewHeaderNewHeader");
- // console.log(chromesettingArray);
- // console.log(chromesettingresponseArray);
-
- this.setState({
- mygetHelmetapi2:chromesettingArray
- });
- if (chromesettingArray.tab_logo_url) {
- this.gettablogourldata(chromesettingresponseArray);
- } else {
- this.gettablogourlnull();
- }
- }catch (e) {
- console.log("head获取游览器配置失败 重新请求开始读取配置");
- this.geturlsdata();
- }
- };
-
- geturlsdata=()=>{
- let url = "/setting.json";
- axios.get(url).then((response) => {
- // console.log("app.js开始请求/setting.json");
- // console.log("获取当前定制信息");
- if(response){
- if(response.data){
- this.setState({
- mygetHelmetapi2:response.data.setting
- });
- localStorage.setItem('chromesetting',JSON.stringify(response.data.setting));
- localStorage.setItem('chromesettingresponse',JSON.stringify(response));
- try {
- if (response.data.setting.tab_logo_url) {
- this.gettablogourldata(response);
- } else {
- this.gettablogourlnull();
- }
- } catch (e) {
- this.gettablogourlnull();
- }
+ hideAccountProfile = () => {
+ this.setState({
+ AccountProfiletype: false
+ })
+ };
+ headtypesonClick = (url, bool) => {
+ this.setState({
+ headtypess: url,
+ headtypesonClickbool: bool,
+ })
+ }
+ //获取数据为空的时候
+ gettablogourlnull = () => {
+ this.setState({
+ mygetHelmetapi2: undefined
+ });
+ document.title = "EduCoder";
+ var link = document.createElement('link'),
+ oldLink = document.getElementById('dynamic-favicon');
+ link.id = 'dynamic-favicon';
+ link.rel = 'shortcut icon';
+ link.href = "/react/build/./favicon.ico";
+ if (oldLink) {
+ document.head.removeChild(oldLink);
+ }
+ document.head.appendChild(link);
+ };
+
+ //获取数据的时候
+ gettablogourldata = (response) => {
+ document.title = response.data.setting.name;
+ var link = document.createElement('link'),
+ oldLink = document.getElementById('dynamic-favicon');
+ link.id = 'dynamic-favicon';
+ link.rel = 'shortcut icon';
+ link.href = '/' + response.data.setting.tab_logo_url;
+ if (oldLink) {
+ document.head.removeChild(oldLink);
+ }
+ document.head.appendChild(link);
+ }
+
+ handleVisibleChanges = (boll) => {
+ this.setState({
+ visiblemyss: boll,
+ })
- } else {
+ }
- this.gettablogourlnull();
- }
+ getAppdata = () => {
+ try {
+ var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting'));
+ var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse'));
+ // console.log("NewHeaderNewHeaderNewHeader");
+ // console.log(chromesettingArray);
+ // console.log(chromesettingresponseArray);
- } else {
- this.gettablogourlnull();
+ this.setState({
+ mygetHelmetapi2: chromesettingArray
+ });
+ if (chromesettingArray.tab_logo_url) {
+ this.gettablogourldata(chromesettingresponseArray);
+ } else {
+ this.gettablogourlnull();
+ }
+ } catch (e) {
+ console.log("head获取游览器配置失败 重新请求开始读取配置");
+ this.geturlsdata();
+ }
+ };
- }
+ geturlsdata = () => {
+ let url = "/setting.json";
+ axios.get(url).then((response) => {
+ // console.log("app.js开始请求/setting.json");
+ // console.log("获取当前定制信息");
+ if (response) {
+ if (response.data) {
+ this.setState({
+ mygetHelmetapi2: response.data.setting
+ });
+ localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
+ localStorage.setItem('chromesettingresponse', JSON.stringify(response));
+ try {
+ if (response.data.setting.tab_logo_url) {
+ this.gettablogourldata(response);
+ } else {
+ this.gettablogourlnull();
+ }
+ } catch (e) {
+ this.gettablogourlnull();
+ }
- }).catch((error) => {
- this.gettablogourlnull();
- });
- }
+ } else {
+ this.gettablogourlnull();
- matchpaths=(url)=>{
- const {match} = this.props;
- if (url=== '/forums'&&match.path === '/forums') {
- return true
- } else if (url.startsWith('/shixuns')&&match.path.startsWith('/shixuns')) {
- return true
- }else if (url.startsWith('/paths')&&match.path.startsWith('/paths')) {
- return true
- } else if (url.startsWith('/courses')&&match.path.startsWith('/courses')) {
- return true
- }else if (url.startsWith('/competitions')&&match.path.startsWith('/competitions')) {
- return true
- }else if (url.startsWith('/crowdsourcing')&&match.path.startsWith('/crowdsourcing')) {
- return true
- }else if(url.startsWith('/moop_cases')&&match.path.startsWith('/moop_cases')){
- return true
- }else if(url.startsWith('/developer')&&match.path.startsWith('/developer')){
- return true
- }else {
- return false
}
+
+ } else {
+ this.gettablogourlnull();
+
+ }
+
+ }).catch((error) => {
+ this.gettablogourlnull();
+
+ });
+ }
+
+
+ matchpaths = (url) => {
+ const { match } = this.props;
+ if (url === '/forums' && match.path === '/forums') {
+ return true
+ } else if (url.startsWith('/shixuns') && match.path.startsWith('/shixuns')) {
+ return true
+ } else if (url.startsWith('/paths') && match.path.startsWith('/paths')) {
+ return true
+ } else if (url.startsWith('/courses') && match.path.startsWith('/courses')) {
+ return true
+ } else if (url.startsWith('/competitions') && match.path.startsWith('/competitions')) {
+ return true
+ } else if (url.startsWith('/crowdsourcing') && match.path.startsWith('/crowdsourcing')) {
+ return true
+ } else if (url.startsWith('/moop_cases') && match.path.startsWith('/moop_cases')) {
+ return true
+ } else if (url.startsWith('/developer') && match.path.startsWith('/developer')) {
+ return true
+ } else {
+ return false
}
+ }
- // 处理弹框
- setgoshowqqgtounp=(bool)=>{
- this.setState({
- goshowqqgtounp:bool
- })
- }
+ // 处理弹框
+ setgoshowqqgtounp = (bool) => {
+ this.setState({
+ goshowqqgtounp: bool
+ })
+ }
render() {
const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
- const {match} = this.props;
+ const { match } = this.props;
- let {Addcoursestypes,
+ let { Addcoursestypes,
tojoinitemtype,
tojoinclasstitle,
code_notice,
checked_notice,
- AccountProfiletype,
+ AccountProfiletype,
submitapplications,
submitapplicationsvalue,
user,
isRender,
- showSearchOpentype,
- headtypesonClickbool,
- headtypess,
- mygetHelmetapi2,
- goshowqqgtounp,
- }=this.state;
+ showSearchOpentype,
+ headtypesonClickbool,
+ headtypess,
+ mygetHelmetapi2,
+ goshowqqgtounp,
+ } = this.state;
/*
用户名称 用户头像url
*/
- let activeIndex = false;
- let activeForums = false;
- let activeShixuns = false;
- let activePaths = false;
- let coursestype=false;
- let activePackages=false;
- let activeMoopCases=false;
- let activeCompetitions=false;
-
- if (match.path === '/forums') {
- activeForums = true;
- } else if (match.path.startsWith('/shixuns')) {
- activeShixuns = true;
- }else if (match.path.startsWith('/paths')) {
- activePaths = true;
- } else if (match.path.startsWith('/courses')) {
- coursestype = true;
- }else if (match.path.startsWith('/crowdsourcing')) {
- activePackages = true;
- }else if(match.path.startsWith('/moop_cases')){
- activeMoopCases = true;
- }else if(match.path.startsWith('/competitions')){
- activeCompetitions = true;
- }else {
- activeIndex = true;
- }
-
- let headtypes='/';
-
- // console.log("mygetHelmetapi2");
- // console.log(mygetHelmetapi2);
- if(mygetHelmetapi2) {
+ let activeIndex = false;
+ let activeForums = false;
+ let activeShixuns = false;
+ let activePaths = false;
+ let coursestype = false;
+ let activePackages = false;
+ let activeMoopCases = false;
+ let activeCompetitions = false;
+
+ if (match.path === '/forums') {
+ activeForums = true;
+ } else if (match.path.startsWith('/shixuns')) {
+ activeShixuns = true;
+ } else if (match.path.startsWith('/paths')) {
+ activePaths = true;
+ } else if (match.path.startsWith('/courses')) {
+ coursestype = true;
+ } else if (match.path.startsWith('/crowdsourcing')) {
+ activePackages = true;
+ } else if (match.path.startsWith('/moop_cases')) {
+ activeMoopCases = true;
+ } else if (match.path.startsWith('/competitions')) {
+ activeCompetitions = true;
+ } else {
+ activeIndex = true;
+ }
+
+ let headtypes = '/';
+
+ // console.log("mygetHelmetapi2");
+ // console.log(mygetHelmetapi2);
+ if (mygetHelmetapi2) {
if (mygetHelmetapi2.navbar) {
if (mygetHelmetapi2.navbar.length > 0) {
// console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-=");
@@ -906,137 +876,137 @@ submittojoinclass=(value)=>{
}
// console.log(mygetHelmetapi2);
- // console.log("NewHeadermygetHelmetapi123123123123");
-
- let shixuntype=false;
- let pathstype=false;
- let coursestypes=false;
- if(this.props&&this.props.mygetHelmetapi!=null){
- let shixun="/shixuns";
- let paths="/paths";
- let courses="/courses";
- this.props.mygetHelmetapi.navbar.map((item,key)=>{
- var reg = RegExp(item.link);
- if(shixun.match(reg)){
- if(item.hidden===true){
- shixuntype=true
- }
- }
- if(paths.match(reg)){
- if(item.hidden===true){
- pathstype=true
- }
- }
- if(courses.match(reg)){
- if(item.hidden===true){
- coursestypes=true
- }
- }
- })
- }
-
- const contents = (
-
- );
+ // console.log("NewHeadermygetHelmetapi123123123123");
+
+ let shixuntype = false;
+ let pathstype = false;
+ let coursestypes = false;
+ if (this.props && this.props.mygetHelmetapi != null) {
+ let shixun = "/shixuns";
+ let paths = "/paths";
+ let courses = "/courses";
+ this.props.mygetHelmetapi.navbar.map((item, key) => {
+ var reg = RegExp(item.link);
+ if (shixun.match(reg)) {
+ if (item.hidden === true) {
+ shixuntype = true
+ }
+ }
+ if (paths.match(reg)) {
+ if (item.hidden === true) {
+ pathstype = true
+ }
+ }
+ if (courses.match(reg)) {
+ if (item.hidden === true) {
+ coursestypes = true
+ }
+ }
+ })
+ }
+
+ const contents = (
+
+ );
return (