diff --git a/public/react/public/index.html b/public/react/public/index.html index aed235761..7da699fca 100755 --- a/public/react/public/index.html +++ b/public/react/public/index.html @@ -30,15 +30,8 @@ || navigator.userAgent.indexOf('MSIE 10') != -1) && location.pathname.indexOf("/compatibility") == -1) { - debugger; - // location.href = './compatibility' location.href = '/compatibility.html' } - // const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); - const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase())); - if (isWeiXin) { - document.write(' @@ -65,24 +58,6 @@ - - - - - - - - - - - - - - - - - - - diff --git a/public/react/src/college/College.js b/public/react/src/college/College.js index 5b1e4e2b9..d18e45d48 100644 --- a/public/react/src/college/College.js +++ b/public/react/src/college/College.js @@ -8,7 +8,7 @@ import { } from "antd"; import Colleagechart from './colleagechart/Colleagechart' import Colleagechartzu from './colleagechart/Colleagechartzu' -import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; +import TPMIndexHOC from "../modules/tpm/TPMIndexHOC"; import NoneData from './../modules/courses/coursesPublic/NoneData'; import './colleagecss/colleage.css'; diff --git a/public/react/src/common/ShowSpin.js b/public/react/src/common/ShowSpin.js index 2058caa9d..f10626826 100644 --- a/public/react/src/common/ShowSpin.js +++ b/public/react/src/common/ShowSpin.js @@ -1,9 +1,9 @@ import React, { Component } from 'react'; import { SnackbarHOC } from 'educoder'; -import { TPMIndexHOC } from '../modules/tpm/TPMIndexHOC'; -import {Spin,Alert} from 'antd'; +import TPMIndexHOC from '../modules/tpm/TPMIndexHOC'; +import { Spin, Alert } from 'antd'; -class ShowSpin extends Component{ +class ShowSpin extends Component { constructor(props) { super(props) } @@ -11,23 +11,23 @@ class ShowSpin extends Component{ render() { - let marigin={ + let marigin = { width: '100%', minHeight: '500px', } return ( - + - + - + ) } } -export default SnackbarHOC() ( TPMIndexHOC(ShowSpin) ); \ No newline at end of file +export default SnackbarHOC()(TPMIndexHOC(ShowSpin)); \ No newline at end of file diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 34e47c188..715dca135 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -7,7 +7,7 @@ export { export { setmiyah as setmiyah } from './Component'; export { default as queryString } from './UrlTool2'; -export { SnackbarHOC as SnackbarHOC } from './SnackbarHOC'; +export { default as SnackbarHOC } from './SnackbarHOC'; export { trigger as trigger, on as on, off as off @@ -42,7 +42,7 @@ export { default as AttachmentList } from './components/attachment/AttachmentLis export { themes, ThemeContext } from './context/ThemeContext' -export { ModalHOC } from './components/ModalHOC' +export { default as ModalHOC } from './components/ModalHOC' export { SetAppModel } from './components/SetAppModel' @@ -73,7 +73,7 @@ export { default as ImageLayer2 } from './hooks/ImageLayer2' // 外部 export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb' -export { CNotificationHOC as CNotificationHOC } from '../modules/courses/common/CNotificationHOC' +export { default as CNotificationHOC } from '../modules/courses/common/CNotificationHOC' export { default as ModalWrapper } from '../modules/courses/common/ModalWrapper' export { default as NoneData } from '../modules/courses/coursesPublic/NoneData' diff --git a/public/react/src/modules/403/Shixunauthority.js b/public/react/src/modules/403/Shixunauthority.js index 8579a8621..d5ba4f451 100644 --- a/public/react/src/modules/403/Shixunauthority.js +++ b/public/react/src/modules/403/Shixunauthority.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; import { SnackbarHOC, getImageUrl } from 'educoder'; diff --git a/public/react/src/modules/404/Shixunnopage.js b/public/react/src/modules/404/Shixunnopage.js index 418932403..92d1a1f50 100644 --- a/public/react/src/modules/404/Shixunnopage.js +++ b/public/react/src/modules/404/Shixunnopage.js @@ -6,32 +6,32 @@ import Loading from '../../Loading'; import Loadable from 'react-loadable'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; -import { SnackbarHOC,getImageUrl } from 'educoder'; +import { SnackbarHOC, getImageUrl } from 'educoder'; class http500 extends Component { render() { return (
-
- {/*mt100 mb100*/} - -

- 您可以稍后尝试 返回首页 - ,或者  +

+ {/*mt100 mb100*/} + +

+ 您可以稍后尝试 返回首页 + ,或者  QQ反馈>> -

-
- {/*
*/} - {/**/} - {/**/} + href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd" + className="color-blue">QQ反馈>> +

+
+ {/*
*/} + {/**/} + {/**/}
); } } -export default SnackbarHOC() (TPMIndexHOC ( http500 )); +export default SnackbarHOC()(TPMIndexHOC(http500)); diff --git a/public/react/src/modules/500/http500.js b/public/react/src/modules/500/http500.js index 89e1baa57..1813866e6 100644 --- a/public/react/src/modules/500/http500.js +++ b/public/react/src/modules/500/http500.js @@ -6,32 +6,32 @@ import Loading from '../../Loading'; import Loadable from 'react-loadable'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; -import { SnackbarHOC,getImageUrl } from 'educoder'; +import { SnackbarHOC, getImageUrl } from 'educoder'; class Shixunnopage extends Component { render() { return (
-
- {/*mt100 mb100*/} - -

- 您可以稍后尝试 返回首页 - ,或者  +

+ {/*mt100 mb100*/} + +

+ 您可以稍后尝试 返回首页 + ,或者  QQ反馈>> -

-
- {/*
*/} - {/**/} - {/**/} + href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd" + className="color-blue">QQ反馈>> +

+
+ {/*
*/} + {/**/} + {/**/}
); } } -export default SnackbarHOC() (TPMIndexHOC ( Shixunnopage )); +export default SnackbarHOC()(TPMIndexHOC(Shixunnopage)); diff --git a/public/react/src/modules/common/CompatibilityPage.js b/public/react/src/modules/common/CompatibilityPage.js index 8f322e6c7..035b19037 100644 --- a/public/react/src/modules/common/CompatibilityPage.js +++ b/public/react/src/modules/common/CompatibilityPage.js @@ -7,27 +7,27 @@ import ffImg from './imgs/firefox_icon.png' import bannerImg from './imgs/icon@2x.png' -import { TPMIndexHOC } from '..//tpm/TPMIndexHOC'; +import TPMIndexHOC from '..//tpm/TPMIndexHOC'; class CompatibilityPage extends Component { - constructor(props) { - super(props) + constructor(props) { + super(props) - this.state = { - - } - } + this.state = { - onGoldRewardInputChange(event) { - this.setState({ goldRewardInput: event.target.value, goldRewardInputError: false }); - } + } + } - render() { - const { goldRewardDialogOpen } = this.props; - const { goldRewardInputError } = this.state; - + onGoldRewardInputChange(event) { + this.setState({ goldRewardInput: event.target.value, goldRewardInputError: false }); + } - return ( + render() { + const { goldRewardDialogOpen } = this.props; + const { goldRewardInputError } = this.state; + + + return ( {/* bor-bottom-greyE */}
+ style={{ display: (comments && !!comments.length) ? 'block' : 'none' }}>
全部回复 {total_count} @@ -279,19 +278,19 @@ class CommonReply extends Component{ > - {/* { true ? : + {/* { true ? :
写评论
} */}
- { total_count > REPLY_PAGE_COUNT && -
- -
写评论
-
} + {total_count > REPLY_PAGE_COUNT && +
+ +
写评论
+
}
) } } -export default ImageLayerOfCommentHOC() (CommonReply); \ No newline at end of file +export default ImageLayerOfCommentHOC()(CommonReply); \ No newline at end of file diff --git a/public/react/src/modules/courses/competitions/Competitions.js b/public/react/src/modules/courses/competitions/Competitions.js index 704b85ef9..13b764cb2 100644 --- a/public/react/src/modules/courses/competitions/Competitions.js +++ b/public/react/src/modules/courses/competitions/Competitions.js @@ -1,14 +1,12 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import { Route, Link, Switch } from "react-router-dom"; +import { Route, Switch } from "react-router-dom"; import Loading from '../../Loading'; import Loadable from 'react-loadable'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../courses/common/CNotificationHOC'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; +import CNotificationHOC from '../courses/common/CNotificationHOC'; //新版竞赛首页 const CompetitionsIndex = Loadable({ @@ -17,7 +15,7 @@ const CompetitionsIndex = Loadable({ }) //竞赛详情页 -const CompetitionCommon=Loadable({ +const CompetitionCommon = Loadable({ loader: () => import('./Competitioncommon/CompetitionCommon'), loading: Loading, }) @@ -40,7 +38,7 @@ class Competitions extends Component { super(props) } - componentDidMount(){ + componentDidMount() { window.document.title = '竞赛'; } @@ -54,9 +52,9 @@ class Competitions extends Component { {/*新版竞赛战队详情*/} () - } + render={ + (props) => () + } > @@ -64,22 +62,22 @@ class Competitions extends Component { () + (props) => () } /> {/*新版竞赛详情页面*/} () - } + render={ + (props) => () + } > {/*新版竞赛首页*/} () - } + render={ + (props) => () + } > @@ -89,4 +87,4 @@ class Competitions extends Component { } } -export default CNotificationHOC() (TPMIndexHOC (Competitions)) ; \ No newline at end of file +export default CNotificationHOC()(TPMIndexHOC(Competitions)); \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js index 6c7085ca2..d4b4e6b63 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js @@ -1,48 +1,43 @@ -import React,{ Component } from "react"; -import { Pagination } from "antd"; +import React, { Component } from "react"; import axios from 'axios' import moment from 'moment' -import { getImageUrl,WordsBtn } from 'educoder'; -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC'; +import ImageLayerOfCommentHOC from '../../../page/layers/ImageLayerOfCommentHOC'; import GraduationTasksappraiseReplyChild from './GraduationTasksappraiseReplyChild'; import '../../../forums/Post.css' import '../../../comment/Comment.css' import '../../common/courseMessage.css' import './GraduationTasksappraiseReply.css' -const REPLY_PAGE_COUNT = 10 -const $ = window.$; - /* */ -class GraduationTasksappraiseReply extends Component{ - constructor(props){ +class GraduationTasksappraiseReply extends Component { + constructor(props) { super(props); - 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` - 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) }) } - componentDidMount(){ + componentDidMount() { this.fetchAllComments() } addSuccess = () => { @@ -77,14 +72,14 @@ class GraduationTasksappraiseReply extends Component{ okText: '确定', cancelText: '取消', onOk: () => { - let category_id= this.props.match.params.category_id; + let category_id = this.props.match.params.category_id; const url = `/graduation_works/${category_id}/delete_score.json?comment_id=${item.id}` - axios.delete(url).then((result)=>{ - if(result.data.status == 0){ + axios.delete(url).then((result) => { + if (result.data.status == 0) { this.props.showNotification('删除成功') this.fetchAllComments() } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) }, @@ -92,105 +87,105 @@ class GraduationTasksappraiseReply 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 category_id= this.props.match.params.category_id; + saveModulationModal = (value, num) => { + console.log(value, num) + let { operationId } = this.state; + let category_id = this.props.match.params.category_id; // console.log(value,num) - let url ="/graduation_works/"+category_id+"/adjust_score.json"; - axios.post(url,{ - score:num, - comment:value - }).then((result)=>{ + let url = "/graduation_works/" + category_id + "/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, - Modalstopval:result.data.message, - ModalSave:this.cancelmodel, + Modalstype: true, + Allocationtype: false, + Modalstopval: result.data.message, + ModalSave: this.cancelmodel, }) - this.fetchAllComments() + this.fetchAllComments() } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) } - render(){ + render() { let { total_count, comments, pageCount, comment_scores } = this.state const { current_user, memo } = this.props const isAdmin = this.props.isAdmin(); - const isStudent=this.props.isStudent(); - const isNotMember=this.props.isNotMember(); + const isStudent = this.props.isStudent(); + const isNotMember = this.props.isNotMember(); - return( + return ( - {comment_scores.length===0&&isStudent===true||comment_scores.length===0&&isNotMember===true? "":
- {isStudent===true? - + {isStudent === true ? + this.showModulationtype(id)} - saveModulationModal={(value,num)=>this.saveModulationModal(value,num)} + showModulationtype={(id) => this.showModulationtype(id)} + saveModulationModal={(value, num) => this.saveModulationModal(value, num)} addSuccess={this.addSuccess} onDelete={this.onDelete} /> - : this.showModulationtype(id)} - saveModulationModal={(value,num)=>this.saveModulationModal(value,num)} - addSuccess={this.addSuccess} - onDelete={this.onDelete} - /> - } + : this.showModulationtype(id)} + saveModulationModal={(value, num) => this.saveModulationModal(value, num)} + addSuccess={this.addSuccess} + onDelete={this.onDelete} + /> + }
- } + }
) } } -export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReply); -{/*
*/} - {/*
*/} - {/**/} - {/**/} - {/*

暂时还没有相关数据哦!

*/} - {/*
*/} - {/*
*/} -{/**/} \ No newline at end of file +export default ImageLayerOfCommentHOC()(GraduationTasksappraiseReply); +{/*
*/ } +{/*
*/ } +{/**/ } +{/**/ } +{/*

暂时还没有相关数据哦!

*/ } +{/*
*/ } +{/*
*/ } +{/**/ } \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js index 27739b611..75d7c31fd 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReplyChild.js @@ -1,6 +1,5 @@ -import React,{ Component } from "react"; -import { Pagination } from "antd"; -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC' +import React, { Component } from "react"; +import ImageLayerOfCommentHOC from '../../../page/layers/ImageLayerOfCommentHOC' import GraduationTasksappraiseMainEditor from './GraduationTasksappraiseMainEditor' import Graduationtaskitem from './Graduationtaskitem' import '../../../forums/Post.css' @@ -9,96 +8,92 @@ import '../../common/courseMessage.css' import './GraduationTasksappraiseReply.css' import ModulationModal from "../../coursesPublic/ModulationModal"; import Modals from '../../../modals/Modals'; -const REPLY_PAGE_COUNT = 10 -const $ = window.$; -class GraduationTasksappraiseReplyChild extends Component{ - constructor(props){ +class GraduationTasksappraiseReplyChild extends Component { + constructor(props) { super(props); - this.state={ + this.state = { } } - render(){ - let { total_count, comments, pageCount, comment_scores} = this.props; + render() { + let { total_count, comments, pageCount, comment_scores } = this.props; const isAdmin = this.props.isAdmin(); - const isStudent=this.props.isStudent(); - - return( + return ( -
+
- + - {this.props.Modulationtype===true?this.props.saveModulationModal(value,num)} - closable={false} - footer={null} - destroyOnClose={true} - centered={true} - />:""} + {this.props.Modulationtype === true ? this.props.saveModulationModal(value, num)} + closable={false} + footer={null} + destroyOnClose={true} + centered={true} + /> : ""} - {/*
*/} - {/*

{datalist&&datalist.task_name}

*/} - {/*返回*/} - {/*{this.props.isStudent()?补交附件:""}*/} - {/*
*/} - {this.props.ultimate===true? isAdmin && - - :""} - {this.props.ultimate===true?"":
- 全部评阅 - { !!comment_scores.length && - {comment_scores.length===0?"":`(${comment_scores.length})`} - } -
} + {/*
*/} + {/*

{datalist&&datalist.task_name}

*/} + {/*返回*/} + {/*{this.props.isStudent()?补交附件:""}*/} + {/*
*/} + {this.props.ultimate === true ? isAdmin && + + : ""} + {this.props.ultimate === true ? "" :
+ 全部评阅 + {!!comment_scores.length && + {comment_scores.length === 0 ? "" : `(${comment_scores.length})`} + } +
} - {this.props.ultimate===true ? "": isAdmin && this.props.addSuccess()} - showSameScore={this.props.task_type == 2} - > } + {this.props.ultimate === true ? "" : isAdmin && this.props.addSuccess()} + showSameScore={this.props.task_type == 2} + >}
- {!!comment_scores.length &&
+ {!!comment_scores.length &&
- +
- { comment_scores.map(item => { + {comment_scores.map(item => { return - }) } + })}
-
} +
} ) } } -export default ImageLayerOfCommentHOC() (GraduationTasksappraiseReplyChild); \ No newline at end of file +export default ImageLayerOfCommentHOC()(GraduationTasksappraiseReplyChild); \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js index ce0554488..081250241 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingReply.js @@ -1,4 +1,4 @@ -import React,{ Component } from "react"; +import React, { Component } from "react"; import { Pagination } from "antd"; import update from 'immutability-helper' @@ -7,14 +7,16 @@ import MemoDetailMDEditor from '../../../forums/MemoDetailMDEditor' import '../../../forums/Post.css' import '../../../forums/RightSection.css' -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC' +import ImageLayerOfCommentHOC from '../../../page/layers/ImageLayerOfCommentHOC' import Comments from '../../../comment/Comments' // import './GraduateTopicReply.css' import '../../common/courseMessage.css' -import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment +import { + generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment , addSecondLevelComment, NEED_TO_WRITE_CONTENT, handleContentBeforeCreateSecondLevelComment - , handleDeleteComment, handleCommentPraise, handleHiddenComment } from '../../common/CommentsHelper' + , handleDeleteComment, handleCommentPraise, handleHiddenComment +} from '../../common/CommentsHelper' const REPLY_PAGE_COUNT = 10 const $ = window.$; @@ -23,15 +25,15 @@ const $ = window.$; 列表接口名 /graduation_tasks/${graduation_topic_id}/show_comment.json?parent_id=${parent.id}&limit=500 回复类型名 jour_type: 'GraduationTask', */ -class GraduationTaskssettingReply extends Component{ - constructor(props){ +class GraduationTaskssettingReply extends Component { + constructor(props) { super(props); - this.state={ + this.state = { pageCount: 1 } } - componentDidMount(){ + componentDidMount() { this.fetchReplies() @@ -51,14 +53,14 @@ class GraduationTaskssettingReply extends Component{ let { comments } = this.state; axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTask', - jour_id: graduation_topic_id, - notes: content, - // m_parent_id - reply_id: memo.user_id - } + journals_for_message: { + jour_type: 'GraduationTask', + jour_id: graduation_topic_id, + notes: content, + // m_parent_id + reply_id: memo.user_id } + } ).then((response) => { if (response.data.status === -1) { console.error('服务端异常') @@ -90,7 +92,7 @@ class GraduationTaskssettingReply extends Component{ // return; // } - if (this.props.memo.id === id ) { // 回复帖子 + if (this.props.memo.id === id) { // 回复帖子 this.createNewComment(commentContent, id, editor); return; } @@ -104,55 +106,55 @@ class GraduationTaskssettingReply extends Component{ commentContent = handleContentBeforeCreateSecondLevelComment(commentContent) axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTask', - jour_id: graduation_topic_id, - notes: commentContent, - m_parent_id: id, - reply_id: comment.user_id - } - }, - { - } - ).then((response) => { - if (response.data.id) { - let newId = response.data.id; - - this.setState({ - comments: addSecondLevelComment(comments, comment, commentIndex, newId, commentContent, user, editor) - }) - - const newMemo2 = Object.assign({}, this.props.memo); - newMemo2.total_count = newMemo2.total_count + 1; - this.setState({ - memo: newMemo2 - }) - } + journals_for_message: { + jour_type: 'GraduationTask', + jour_id: graduation_topic_id, + notes: commentContent, + m_parent_id: id, + reply_id: comment.user_id + } + }, + { + } + ).then((response) => { + if (response.data.id) { + let newId = response.data.id; - }).catch((error) => { - console.log(error) - }) + this.setState({ + comments: addSecondLevelComment(comments, comment, commentIndex, newId, commentContent, user, editor) + }) + + const newMemo2 = Object.assign({}, this.props.memo); + newMemo2.total_count = newMemo2.total_count + 1; + this.setState({ + memo: newMemo2 + }) + } + + }).catch((error) => { + console.log(error) + }) } loadMoreChildComments = (parent) => { const graduation_topic_id = this.props.memo.id const course_id = this.props.course_id const url = `/graduation_tasks/${graduation_topic_id}/show_comment.json?parent_id=${parent.id}&limit=500` - axios.get(url,{ + axios.get(url, { }) - .then((response) => { - const { comments } = response.data + .then((response) => { + const { comments } = response.data - // const memo = Object.assign({}, this.state.memo) - // memo.sum_replies_count = sum_replies_count; - this.setState({ - // memo, - comments: generateChildComments(comments, this.state.comments, parent, this.transformReply) + // const memo = Object.assign({}, this.state.memo) + // memo.sum_replies_count = sum_replies_count; + this.setState({ + // memo, + comments: generateChildComments(comments, this.state.comments, parent, this.transformReply) + }) + }).catch((error) => { + console.log(error) }) - }).catch((error) => { - console.log(error) - }) } onPaginationChange = (pageCount) => { @@ -166,19 +168,19 @@ class GraduationTaskssettingReply extends Component{ const course_id = this.props.course_id const url = `/graduation_tasks/${graduation_topic_id}/show_comment.json?page=${this.state.pageCount}` // page limit parent_id - axios.get(url,{ + axios.get(url, { }) - .then((response) => { - const { comments, messages_count } = response.data + .then((response) => { + const { comments, messages_count } = response.data - this.setState({ - comments: generateComments(comments, this.transformReply), - // : this.state.comments.concat(comments), - total_count: messages_count + this.setState({ + comments: generateComments(comments, this.transformReply), + // : this.state.comments.concat(comments), + total_count: messages_count + }) + }).catch((error) => { + console.log(error) }) - }).catch((error) => { - console.log(error) - }) } transformReply = (reply, children = []) => { @@ -226,20 +228,20 @@ class GraduationTaskssettingReply extends Component{ } } - render(){ + render() { let { total_count, comments, pageCount } = this.state const { current_user, memo } = this.props - return( + return ( + height={160} showError={true}>
+ style={{ display: (comments && !!comments.length) ? 'block' : 'none' }}>
全部回复 {total_count} @@ -261,19 +263,19 @@ class GraduationTaskssettingReply extends Component{ > - {/* { true ? : + {/* { true ? :
写评论
} */}
- { total_count > REPLY_PAGE_COUNT && -
- -
写评论
-
} + {total_count > REPLY_PAGE_COUNT && +
+ +
写评论
+
} ) } } -export default ImageLayerOfCommentHOC() (GraduationTaskssettingReply); \ No newline at end of file +export default ImageLayerOfCommentHOC()(GraduationTaskssettingReply); \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicReply.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicReply.js index f08938b4e..2a5522a93 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicReply.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicReply.js @@ -1,31 +1,32 @@ -import React,{ Component } from "react"; +import React, { Component } from "react"; import { Pagination } from "antd"; -import update from 'immutability-helper' import axios from 'axios' import MemoDetailMDEditor from '../../../forums/MemoDetailMDEditor' import '../../../forums/Post.css' import '../../../forums/RightSection.css' -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC' +import ImageLayerOfCommentHOC from '../../../page/layers/ImageLayerOfCommentHOC' import Comments from '../../../comment/Comments' import './GraduateTopicReply.css' import '../../common/courseMessage.css' -import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment +import { + generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment , addSecondLevelComment, NEED_TO_WRITE_CONTENT, handleContentBeforeCreateSecondLevelComment - , handleDeleteComment, handleCommentPraise, handleHiddenComment } from '../../common/CommentsHelper' + , handleDeleteComment, handleCommentPraise, handleHiddenComment +} from '../../common/CommentsHelper' const REPLY_PAGE_COUNT = 10 const $ = window.$; -class GraduateTopicReply extends Component{ - constructor(props){ +class GraduateTopicReply extends Component { + constructor(props) { super(props); - this.state={ + this.state = { pageCount: 1 } } - componentDidMount(){ + componentDidMount() { this.fetchReplies() @@ -45,14 +46,14 @@ class GraduateTopicReply extends Component{ let { comments } = this.state; axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTopic', - jour_id: graduation_topic_id, - notes: content, - // m_parent_id - reply_id: memo.user_id - } + journals_for_message: { + jour_type: 'GraduationTopic', + jour_id: graduation_topic_id, + notes: content, + // m_parent_id + reply_id: memo.user_id } + } ).then((response) => { if (response.data.status === -1) { console.error('服务端异常') @@ -84,7 +85,7 @@ class GraduateTopicReply extends Component{ // return; // } - if (this.props.memo.id === id ) { // 回复帖子 + if (this.props.memo.id === id) { // 回复帖子 this.createNewComment(commentContent, id, editor); return; } @@ -98,55 +99,55 @@ class GraduateTopicReply extends Component{ commentContent = handleContentBeforeCreateSecondLevelComment(commentContent) axios.post(url, { - journals_for_message: { - jour_type: 'GraduationTopic', - jour_id: graduation_topic_id, - notes: commentContent, - m_parent_id: id, - reply_id: comment.user_id - } - }, - { - } - ).then((response) => { - if (response.data.id) { - let newId = response.data.id; - - this.setState({ - comments: addSecondLevelComment(comments, comment, commentIndex, newId, commentContent, user, editor) - }) - - const newMemo2 = Object.assign({}, this.props.memo); - newMemo2.total_count = newMemo2.total_count + 1; - this.setState({ - memo: newMemo2 - }) - } + journals_for_message: { + jour_type: 'GraduationTopic', + jour_id: graduation_topic_id, + notes: commentContent, + m_parent_id: id, + reply_id: comment.user_id + } + }, + { + } + ).then((response) => { + if (response.data.id) { + let newId = response.data.id; - }).catch((error) => { - console.log(error) - }) + this.setState({ + comments: addSecondLevelComment(comments, comment, commentIndex, newId, commentContent, user, editor) + }) + + const newMemo2 = Object.assign({}, this.props.memo); + newMemo2.total_count = newMemo2.total_count + 1; + this.setState({ + memo: newMemo2 + }) + } + + }).catch((error) => { + console.log(error) + }) } loadMoreChildComments = (parent) => { const graduation_topic_id = this.props.memo.id const course_id = this.props.course_id const url = `/courses/${course_id}/graduation_topics/${graduation_topic_id}/show_comment.json?parent_id=${parent.id}&limit=500` - axios.get(url,{ + axios.get(url, { }) - .then((response) => { - const { comments } = response.data + .then((response) => { + const { comments } = response.data - // const memo = Object.assign({}, this.state.memo) - // memo.sum_replies_count = sum_replies_count; - this.setState({ - // memo, - comments: generateChildComments(comments, this.state.comments, parent, this.transformReply) + // const memo = Object.assign({}, this.state.memo) + // memo.sum_replies_count = sum_replies_count; + this.setState({ + // memo, + comments: generateChildComments(comments, this.state.comments, parent, this.transformReply) + }) + }).catch((error) => { + console.log(error) }) - }).catch((error) => { - console.log(error) - }) } onPaginationChange = (pageCount) => { @@ -160,19 +161,19 @@ class GraduateTopicReply extends Component{ const course_id = this.props.course_id const url = `/courses/${course_id}/graduation_topics/${graduation_topic_id}/show_comment.json?page=${this.state.pageCount}` // page limit parent_id - axios.get(url,{ + axios.get(url, { }) - .then((response) => { - const { comments, messages_count } = response.data + .then((response) => { + const { comments, messages_count } = response.data - this.setState({ - comments: generateComments(comments, this.transformReply), - // : this.state.comments.concat(comments), - total_count: messages_count + this.setState({ + comments: generateComments(comments, this.transformReply), + // : this.state.comments.concat(comments), + total_count: messages_count + }) + }).catch((error) => { + console.log(error) }) - }).catch((error) => { - console.log(error) - }) } transformReply = (reply, children = []) => { @@ -220,17 +221,17 @@ class GraduateTopicReply extends Component{ } } - render(){ + render() { let { total_count, comments, pageCount } = this.state const { current_user, memo } = this.props - return( + return ( + height={160} showError={true}>
+ style={{ display: (comments && !!comments.length) ? 'block' : 'none' }}>
全部回复 {total_count} @@ -253,19 +254,19 @@ class GraduateTopicReply extends Component{ > - {/* { true ? : + {/* { true ? :
写评论
} */}
- { total_count > REPLY_PAGE_COUNT && -
- -
写评论
-
} + {total_count > REPLY_PAGE_COUNT && +
+ +
写评论
+
} ) } } -export default ImageLayerOfCommentHOC() (GraduateTopicReply); \ No newline at end of file +export default ImageLayerOfCommentHOC()(GraduateTopicReply); \ No newline at end of file diff --git a/public/react/src/modules/courses/polldepoly/Index.js b/public/react/src/modules/courses/polldepoly/Index.js index 977046e5d..7aea0c429 100644 --- a/public/react/src/modules/courses/polldepoly/Index.js +++ b/public/react/src/modules/courses/polldepoly/Index.js @@ -1,24 +1,24 @@ import React, { Component } from 'react'; import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import Loadable from 'react-loadable'; import Loading from '../../../Loading'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../../tpm/TPMIndexHOC'; import "../css/Courses.css" //引入对应跳转的组件 -{/*提交总结*/} +{/*提交总结*/ } const Polldepoly = Loadable({ loader: () => import('./pollmount'), - loading:Loading, + loading: Loading, }) -class Polllist extends Component{ +class Polllist extends Component { constructor(props) { super(props) } @@ -40,4 +40,4 @@ class Polllist extends Component{ } } -export default SnackbarHOC() ( TPMIndexHOC(Polllist) ); \ No newline at end of file +export default SnackbarHOC()(TPMIndexHOC(Polllist)); \ No newline at end of file diff --git a/public/react/src/modules/courses/polldepoly/pollmount.js b/public/react/src/modules/courses/polldepoly/pollmount.js index f29e573c0..5935fdc89 100644 --- a/public/react/src/modules/courses/polldepoly/pollmount.js +++ b/public/react/src/modules/courses/polldepoly/pollmount.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { SnackbarHOC } from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { Checkbox,Input,DatePicker } from 'antd'; +import TPMIndexHOC from '../../tpm/TPMIndexHOC'; +import { Checkbox, Input, DatePicker } from 'antd'; import locale from 'antd/lib/date-picker/locale/zh_CN'; import "../css/Courses.css"; @@ -10,29 +10,29 @@ import CoursesListType from '../coursesPublic/CoursesListType'; -class Polldepoly extends Component{ +class Polldepoly extends Component { constructor(props) { super(props) this.state = { - contents: [{val:"",id:1}], + contents: [{ val: "", id: 1 }], } } componentDidMount() { } - submitCommitSummary=()=> { + submitCommitSummary = () => { const mdContnet = this.refs[`md${1}`].getValue().trim();; console.log(mdContnet) } - asdasdsad=()=>{ + asdasdsad = () => { this.setState({ - contents:"" + contents: "" }) } render() { - let {contents}=this.state; + let { contents } = this.state; const dateFormat = 'YYYY-MM-DD HH:mm:ss'; return ( @@ -40,108 +40,108 @@ class Polldepoly extends Component{
{/*
*/} - {/**/} - {/***/} - {/*内容*/} - {/*
*/} + {/**/} + {/***/} + {/*内容*/} + {/*
*/} - {/*
*/} {/*
*/} - + {/*
*/} + -
+
-
-

发布设置

- {/*编辑*/} -
+
+

发布设置

+ {/*编辑*/} +
-
- 统一设置 (选中则所有分班使用相同的发布设置,否则各个分班单独设置) -
+
+ 统一设置 (选中则所有分班使用相同的发布设置,否则各个分班单独设置) +
-
- {/*发布时间: (发布之前,学生不会收到问卷)*/} - 发布时间: - - - - -
+
+ {/*发布时间: (发布之前,学生不会收到问卷)*/} + 发布时间: + + + + +
-
- {/*发布时间: (发布之前,学生不会收到问卷)*/} - 截止时间: - - - - -
+
+ {/*发布时间: (发布之前,学生不会收到问卷)*/} + 截止时间: + + + + +
-
+
-
-

公开设置

- {/*编辑*/} -
+
+

公开设置

+ {/*编辑*/} +
-
- 公开统计 (选中则在截止时间之后对提交了问卷的课堂成员公开答题统计,否则不公开) -
+
+ 公开统计 (选中则在截止时间之后对提交了问卷的课堂成员公开答题统计,否则不公开) +
-
- 实名问卷 (选中则问卷不实行匿名制) -
+
+ 实名问卷 (选中则问卷不实行匿名制) +
-
+
提交 - 取消 + onClick={this.submitCommitSummary}>提交 + 取消
@@ -152,6 +152,6 @@ class Polldepoly extends Component{ } } -export default SnackbarHOC() ( TPMIndexHOC(Polldepoly) ); +export default SnackbarHOC()(TPMIndexHOC(Polldepoly)); diff --git a/public/react/src/modules/courses/shixunHomework/CommitSummary.js b/public/react/src/modules/courses/shixunHomework/CommitSummary.js index 5d48f11d9..43d97c22d 100644 --- a/public/react/src/modules/courses/shixunHomework/CommitSummary.js +++ b/public/react/src/modules/courses/shixunHomework/CommitSummary.js @@ -1,30 +1,30 @@ import React, { Component } from 'react'; import { SnackbarHOC } from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../../tpm/TPMIndexHOC'; import "../css/Courses.css"; import CoursesMarkdown from "../coursesPublic/CoursesMarkdown"; import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import { - Form, Icon, Input, Button, Checkbox,message, + Form, Icon, Input, Button, Checkbox, message, } from "antd"; -import {WordsBtn} from 'educoder'; +import { WordsBtn } from 'educoder'; //引入对应跳转的组件 import axios from 'axios'; //提交总结 -class CommitSummary extends Component{ +class CommitSummary extends Component { constructor(props) { super(props) this.state = { - contents: [{val:"",id:1}], - course_id:0, - course_name:"", - category:[], - homework_id:0, - user_name:"", - work_id:0, - description:"", - data:undefined, - cancels:false, + contents: [{ val: "", id: 1 }], + course_id: 0, + course_name: "", + category: [], + homework_id: 0, + user_name: "", + work_id: 0, + description: "", + data: undefined, + cancels: false, } } @@ -34,18 +34,18 @@ class CommitSummary extends Component{ let query = this.props.location.pathname; const type = query.split('/'); this.setState({ - shixuntypes:type[3] + shixuntypes: type[3] }) } //获取提交总结接口 - Getsubmissionsummaryinterface=()=>{ - var worksid=this.props.match.params.id; + Getsubmissionsummaryinterface = () => { + var worksid = this.props.match.params.id; // console.log("Getsubmissionsummaryinterface"); // console.log(this.props.match.params); // console.log(worksid); - var url = `/student_works/${worksid}/commit_des.json`; + var url = `/student_works/${worksid}/commit_des.json`; axios.get(url).then((result) => { // console.log(result); if (result.status === 200) { @@ -53,11 +53,11 @@ class CommitSummary extends Component{ // console.log("提交总结接口") // console.log(JSON.stringify(result)) this.setState({ - data:result.data, + data: result.data, description: result.data.description, - cancels:true, + cancels: true, }) - }else { + } else { this.props.showNotification(result.data.message); } @@ -66,11 +66,11 @@ class CommitSummary extends Component{ }) } - submitCommitSummary=()=> { + submitCommitSummary = () => { const mdContnet = this.refs[`md${1}`].getValue().trim(); console.log(mdContnet) } - gotohome=()=>{ + gotohome = () => { // let courseId=this.props.match.params.coursesId; // if(courseId===undefined){ // this.props.history.push("/courses"); @@ -79,27 +79,27 @@ class CommitSummary extends Component{ // } this.props.history.goBack() } - asdasdsad=()=>{ + asdasdsad = () => { this.setState({ - contents:"" + contents: "" }) } - handleSubmit=(e) => { + handleSubmit = (e) => { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { console.log(values.description); - if(values.description === undefined|| values.description === "" || values.description ===null){ + if (values.description === undefined || values.description === "" || values.description === null) { this.props.showNotification(`请输入提交内容`); return } - var worksid=this.props.match.params.id; + var worksid = this.props.match.params.id; - var url = `/student_works/${worksid}/update_des.json`; - axios.post(url,{ - description:values.description, + var url = `/student_works/${worksid}/update_des.json`; + axios.post(url, { + description: values.description, }).then((result) => { if (result.status === 200) { // console.log(url) @@ -118,26 +118,26 @@ class CommitSummary extends Component{ } render() { - const {getFieldDecorator} = this.props.form; - let {contents,data}=this.state; + const { getFieldDecorator } = this.props.form; + let { contents, data } = this.state; // console.log(this.props); - document.title=data === undefined ? "" :data.course_name===undefined?"": data.course_name; + document.title = data === undefined ? "" : data.course_name === undefined ? "" : data.course_name; return (
{/*
*/}

- this.gotohome()}>{data === undefined ? "" :data.course_name===undefined?"": data.course_name} + this.gotohome()}>{data === undefined ? "" : data.course_name === undefined ? "" : data.course_name} > {/* style="grey" */} {data === undefined ? "" :data.category===undefined?"":data.category.category_name} + className="btn colorgrey fl hovercolorblue ">{data === undefined ? "" : data.category === undefined ? "" : data.category.category_name} > 作业详情

@@ -146,23 +146,23 @@ class CommitSummary extends Component{
{/*educontentbox*/}
-
- - * - 内容 +
+ + * + 内容
-
+
{getFieldDecorator('description', { rules: [{ required: true, message: '请在此输入总结内容,最多5000个字符', @@ -171,7 +171,7 @@ class CommitSummary extends Component{ }], })( + mdID={'courseMessageMD'} initValue={this.state.description} className="courseMessageMD"> )}
diff --git a/public/react/src/modules/courses/studentWork/CommitSummaryIndex.js b/public/react/src/modules/courses/studentWork/CommitSummaryIndex.js index 288a98299..3dd371d7a 100644 --- a/public/react/src/modules/courses/studentWork/CommitSummaryIndex.js +++ b/public/react/src/modules/courses/studentWork/CommitSummaryIndex.js @@ -1,9 +1,9 @@ import React, { Component } from 'react'; import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; import Loadable from 'react-loadable'; import Loading from '../../../Loading'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../../tpm/TPMIndexHOC'; import "../css/Courses.css" //引入对应跳转的组件 @@ -23,7 +23,7 @@ import "../css/Courses.css" // }) // -class CommitSummaryIndex extends Component{ +class CommitSummaryIndex extends Component { constructor(props) { super(props) } @@ -50,4 +50,4 @@ class CommitSummaryIndex extends Component{ } } -export default SnackbarHOC() ( TPMIndexHOC(CommitSummaryIndex) ); \ No newline at end of file +export default SnackbarHOC()(TPMIndexHOC(CommitSummaryIndex)); \ No newline at end of file diff --git a/public/react/src/modules/developer/index.js b/public/react/src/modules/developer/index.js index fb64b3f67..0745de3c4 100644 --- a/public/react/src/modules/developer/index.js +++ b/public/react/src/modules/developer/index.js @@ -6,13 +6,13 @@ * @Last Modified time: 2019-11-15 20:43:27 */ import React from 'react'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; import { SnackbarHOC } from 'educoder'; import DeveloperHome from './DeveloperHome'; const App = (props) => { return ( - + ); } diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index cb6850761..c5e1fad38 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -12,13 +12,10 @@ import { connect } from 'react-redux'; import SplitPane from 'react-split-pane'; import LeftPane from './leftpane'; import RightPane from './rightpane'; -// import { Link } from 'react-router-dom'; -// import { getImageUrl } from 'educoder' -// import RightPane from '../newOrEditTask/rightpane'; import { Icon } from 'antd'; import UserInfo from '../components/userInfo'; import actions from '../../../redux/actions'; -import { fromStore, CNotificationHOC } from 'educoder'; +import { CNotificationHOC } from 'educoder'; import { withRouter } from 'react-router'; function StudentStudy(props) { diff --git a/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.js b/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.js index f60288c07..03494d7d3 100644 --- a/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.js +++ b/public/react/src/modules/ecs/EcSetting/reachCalculationInfo/index.js @@ -7,8 +7,7 @@ import axios from 'axios'; import { Table, InputNumber } from 'antd'; -// import EcTitleCourseEvaluations from '../ecTitle/ecTitle' -import { ECModalHOC } from '../../common/ECModalHOC' +import ECModalHOC from '../../common/ECModalHOC' import 'antd/lib/style/index.css'; diff --git a/public/react/src/modules/ecs/Ecs.js b/public/react/src/modules/ecs/Ecs.js index db4fc27df..e09d90fb4 100644 --- a/public/react/src/modules/ecs/Ecs.js +++ b/public/react/src/modules/ecs/Ecs.js @@ -3,7 +3,7 @@ import { Switch, Route } from 'react-router-dom'; import { SnackbarHOC } from 'educoder'; import CustomLoadable from "../../CustomLoadable"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; const Home = CustomLoadable(() => import('./Home/index')); const EcYear = CustomLoadable(() => import('./EcYear/index')); @@ -11,54 +11,54 @@ const EcSetting = CustomLoadable(() => import('./EcSetting/index')); const $ = window.$ //工程认证各个页面的查看详情弹层 -function elasticLayer(forumId){ - if (window.__memo) { - doElasticLayer(window.__memo, true) - return; +function elasticLayer(forumId) { + if (window.__memo) { + doElasticLayer(window.__memo, true) + return; + } + if (!forumId) return; + var url = 'https://www.educoder.net/api/memos/' + forumId + $.ajax({ + url: url, + type: 'get', + success: function (res) { + console.log(res) + doElasticLayer(res.memo) } - if (!forumId) return; - var url = 'https://www.educoder.net/api/memos/' + forumId - $.ajax({ - url: url, - type: 'get', - success: function(res) { - console.log(res) - doElasticLayer(res.memo) - } - }); - - // document.body.addEventListener('touchmove',bodyScroll,false); - // $('body').css({'position':'fixed',"width":"100%"}); + }); + + // document.body.addEventListener('touchmove',bodyScroll,false); + // $('body').css({'position':'fixed',"width":"100%"}); } -function doElasticLayer(memo, rendered){ - if (rendered) { - $(".layerContent").show(); - $(".newMain").hide(); - return; - } - window.__memo = memo - var content = memo.content - var subject = memo.subject - var html='
' + - '

'+ subject +'' + - '返回

' + - '
' - - $(".newMain").after(html).hide(); +function doElasticLayer(memo, rendered) { + if (rendered) { + $(".layerContent").show(); + $(".newMain").hide(); + return; + } + window.__memo = memo + var content = memo.content + var subject = memo.subject + var html = '
' + + '

' + subject + '' + + '返回

' + + '
' + + $(".newMain").after(html).hide(); - window.editormd.markdownToHTML("MDContent", { - htmlDecode: "style,script,iframe", // you can filter tags decode - taskList: true, - tex: true, // 默认不解析 - flowChart: true, // 默认不解析 - sequenceDiagram: true // 默认不解析 - }); + window.editormd.markdownToHTML("MDContent", { + htmlDecode: "style,script,iframe", // you can filter tags decode + taskList: true, + tex: true, // 默认不解析 + flowChart: true, // 默认不解析 + sequenceDiagram: true // 默认不解析 + }); } -function removeElasticLayer(){ - $(".layerContent").hide(); - $(".newMain").show(); +function removeElasticLayer() { + $(".layerContent").hide(); + $(".newMain").show(); } window.elasticLayer = elasticLayer window.doElasticLayer = doElasticLayer @@ -79,4 +79,4 @@ class Ecs extends React.Component { } } -export default SnackbarHOC() (TPMIndexHOC ( Ecs )); \ No newline at end of file +export default SnackbarHOC()(TPMIndexHOC(Ecs)); \ No newline at end of file diff --git a/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js b/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js index 2b525284a..379e6e599 100644 --- a/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js +++ b/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js @@ -3,11 +3,11 @@ import classNames from 'classnames' import axios from 'axios'; -// import { TPMIndexHOC } from '../../../tpm/TPMIndexHOC'; +// import TPMIndexHOC from '../../../tpm/TPMIndexHOC'; import { SnackbarHOC } from 'educoder' -import { message,Modal,Spin,Icon} from 'antd'; +import { message, Modal, Spin, Icon } from 'antd'; import 'antd/dist/antd.css'; @@ -21,41 +21,41 @@ const $ = window.$; class EcCompletionCalculation extends Component { constructor(props) { super(props) - this.state={ - schooldata:{}, - ecComponentState:"ecCompletion", - course_total_score:[], - ec_course_targets:0, - graduation_list:[], - target_list:[], - target_score:[], - evaluate_result:"", - ec_course_targets_count:0, - new_target_ec_year_id:0, - total_rate_data:undefined, - calculatetype:false, - ec_course_id:0, - morelisttype:false, - titlemessage:"提示", - completiontype:false, - completionlist:"", - course_total_scoreaverage:0, - calculatesetype:false, - Spintype:false, - ismanager:false, - course_achievement:"--", - course_rate:"--", - score_levels:[], - score_levelsdata:[], - hife:"/ecs/major_schools/3/years/60/requirement_vs_courses", + this.state = { + schooldata: {}, + ecComponentState: "ecCompletion", + course_total_score: [], + ec_course_targets: 0, + graduation_list: [], + target_list: [], + target_score: [], + evaluate_result: "", + ec_course_targets_count: 0, + new_target_ec_year_id: 0, + total_rate_data: undefined, + calculatetype: false, + ec_course_id: 0, + morelisttype: false, + titlemessage: "提示", + completiontype: false, + completionlist: "", + course_total_scoreaverage: 0, + calculatesetype: false, + Spintype: false, + ismanager: false, + course_achievement: "--", + course_rate: "--", + score_levels: [], + score_levelsdata: [], + hife: "/ecs/major_schools/3/years/60/requirement_vs_courses", } } - componentWillMount(){ + componentWillMount() { window.document.title = '课程达成评价结果'; } - componentDidMount(){ + componentDidMount() { console.log("componentDidMount"); console.log("EcCompletionCalculation"); @@ -64,36 +64,36 @@ class EcCompletionCalculation extends Component { // this.UpdateClassData(true); // const url =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; - const ec_course_id=706; - const url =`/ec_courses/${ec_course_id}/evaluation.json`; - axios.get(url) + const ec_course_id = 706; + const url = `/ec_courses/${ec_course_id}/evaluation.json`; + axios.get(url) .then((response) => { - if(response.status===200){ + if (response.status === 200) { // if(response.data.allow_visit===false){ // window.location.href="/403" // } - this.setState({ - schooldata:response.data, - ec_course_id:ec_course_id, - // evaluate_result:response.data.evaluate_result, - // course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, - // total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, - graduation_list:response.data.graduation_subitem_evaluations, - target_list:response.data.course_targets, - // target_score:response.data.target_score, - ec_course_targets_count:response.data.course_targets.length, - course_achievement:response.data.course_achievement, - course_rate:response.data.course_rate, - score_levels:response.data.score_levels, - // score_levelsdata:response.data.course_targets.score_levels, - // morelisttype:newmorelisttype, - // course_total_scoreaverage:course_total_scoreaverage, - // ismanager:response.data.is_manager - }) - // console.log("componentDidMount"); - // console.log(response.data.score_levels); - // console.log(response.data.course_targets.score_levels); + this.setState({ + schooldata: response.data, + ec_course_id: ec_course_id, + // evaluate_result:response.data.evaluate_result, + // course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, + // total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, + graduation_list: response.data.graduation_subitem_evaluations, + target_list: response.data.course_targets, + // target_score:response.data.target_score, + ec_course_targets_count: response.data.course_targets.length, + course_achievement: response.data.course_achievement, + course_rate: response.data.course_rate, + score_levels: response.data.score_levels, + // score_levelsdata:response.data.course_targets.score_levels, + // morelisttype:newmorelisttype, + // course_total_scoreaverage:course_total_scoreaverage, + // ismanager:response.data.is_manager + }) + // console.log("componentDidMount"); + // console.log(response.data.score_levels); + // console.log(response.data.course_targets.score_levels); } }) .catch(function (error) { @@ -102,24 +102,24 @@ class EcCompletionCalculation extends Component { this.props.Ontitine("competition_calculation_info"); try { this.props.triggerRef(this); - }catch (e) { + } catch (e) { } } - targetsget_navigation_data=(ec_year_id,ec_course_id)=>{ - const Url =`/ec_major_schools/get_navigation_data?ec_year_id=`+ec_year_id+"&ec_course_id="+ec_course_id; + targetsget_navigation_data = (ec_year_id, ec_course_id) => { + const Url = `/ec_major_schools/get_navigation_data?ec_year_id=` + ec_year_id + "&ec_course_id=" + ec_course_id; axios.get(Url, { withCredentials: true, }) .then((response) => { - if(response.status===200){ + if (response.status === 200) { // if(response.data.allow_visit===false){ // window.location.href="/403" // } this.setState({ - schooldata:response.data, - ec_course_id:ec_course_id + schooldata: response.data, + ec_course_id: ec_course_id }) } }) @@ -127,26 +127,26 @@ class EcCompletionCalculation extends Component { console.log(error); }); } - showmorelist=()=>{ + showmorelist = () => { this.setState({ - morelisttype:false + morelisttype: false }) this.UpdateClassData(false) } - UpdateClassData=(key)=>{ - let {calculatetype} =this.state; + UpdateClassData = (key) => { + let { calculatetype } = this.state; // let ec_course_id =this.props.match.params.ec_course_id; this.setState({ - ec_course_id:ec_course_id + ec_course_id: ec_course_id }) - const ec_course_id=706; - const Arl =`/ec_courses/`+ec_course_id+`/calculation_info_data`; + const ec_course_id = 706; + const Arl = `/ec_courses/` + ec_course_id + `/calculation_info_data`; axios.get(Arl, { withCredentials: true, }) .then((response) => { - if(response.status===200){ + if (response.status === 200) { // var list=[]; // if(key===true){ // for(var i=0; i10){ - newmorelisttype=true + let newmorelisttype = false; + if (response.data.course_total_score > 10) { + newmorelisttype = true } let course_total_scoreaverage; - let newlist=response.data.course_total_score[response.data.course_total_score.length-1].total_rate; - for(var i=0; i{ + newrightcalculatebutton = () => { console.log("调用了计算"); this.setState({ - Spintype:true + Spintype: true }) // let {ec_course_id}=this.state; - const ec_course_id=706; + const ec_course_id = 706; // const Orl =`/ec_courses/`+ec_course_id+`/sync_data`; - const Orl =`/ec_courses/${ec_course_id}/evaluation.json`; + const Orl = `/ec_courses/${ec_course_id}/evaluation.json`; axios.get(Orl) .then((response) => { - if(response){ - if(response.data.status===1){ + if (response) { + if (response.data.status === 1) { this.setState({ - calculatetype:true, - completiontype:true, - completionlist:'计算成功', - calculatesetype:true, - Spintype:false + calculatetype: true, + completiontype: true, + completionlist: '计算成功', + calculatesetype: true, + Spintype: false }) this.UpdateClassData(true); } @@ -333,54 +333,54 @@ class EcCompletionCalculation extends Component { }) .catch(function (error) { - console.log(error) + console.log(error) }); } - hidecompletion=()=>{ + hidecompletion = () => { this.setState({ - completiontype:false, - completionlist:"", - calculatesetype:false + completiontype: false, + completionlist: "", + calculatesetype: false }) } render() { - let {Spintype,calculatesetype,ec_course_id,course_total_scoreaverage,score_levels,ec_course_targets_count,course_achievement,schooldata,course_rate,ecComponentState,course_total_score,total_rate_data,ec_course_targets,graduation_list,target_list,target_score,evaluate_result,morelisttype,titlemessage,completiontype,completionlist,ismanager} = this.state; + let { Spintype, calculatesetype, ec_course_id, course_total_scoreaverage, score_levels, ec_course_targets_count, course_achievement, schooldata, course_rate, ecComponentState, course_total_score, total_rate_data, ec_course_targets, graduation_list, target_list, target_score, evaluate_result, morelisttype, titlemessage, completiontype, completionlist, ismanager } = this.state; let TargetresList = (length) => { let target_listres = []; - for(let i = 0; i < length; i++) { + for (let i = 0; i < length; i++) { // target_listres.push(目标{length-i}) // target_listres.push(目标{i+1}) - target_listres.push(目标{i+1}) + target_listres.push(目标{i + 1}) } return target_listres } let TargetresLists = (length) => { let target_listress = []; - for(let i = 0; i < length; i++) { + for (let i = 0; i < length; i++) { // target_listres.push(目标{length-i}) - target_listress.push(目标{i+1}) + target_listress.push(目标{i + 1}) // target_listres.push(目标{length-i}) } return target_listress } - let TargetresContentList = (data,value) => { - let target_listres = []; - if(data){ - if(data.length>0){ - for(var i=0;i) - } else{ - target_listres.push() - - } - } - } - } + let TargetresContentList = (data, value) => { + let target_listres = []; + if (data) { + if (data.length > 0) { + for (var i = 0; i < data.length; i++) { + console.log("TargetresContentList"); + if (data[i].id === value[0]) { + target_listres.push() + } else { + target_listres.push() + + } + } + } + } // target_listres.reverse() return target_listres }; @@ -390,40 +390,40 @@ class EcCompletionCalculation extends Component { let Total_rate_dataList = (value) => { let target_listres = []; - if(value!=undefined){ - for(let i = 0; i < value.length; i++) { + if (value != undefined) { + for (let i = 0; i < value.length; i++) { - if(i===value.length-1){ + if (i === value.length - 1) { target_listres.push( {/*
{value[i].total_score}
*/}
100%
) - }else{ - target_listres.push( - {/*
{value[i].score}
*/} - {/*
占比{(value[i].rate*100).toFixed(2)}%
*/} -
- {(value[i].rate*100).toFixed(2)}% + } else { + target_listres.push( + {/*
{value[i].score}
*/} + {/*
占比{(value[i].rate*100).toFixed(2)}%
*/} +
+ {(value[i].rate * 100).toFixed(2)}%
-
) - } + ) + } } return target_listres - }else{ + } else { target_listres.push( - {/*
{value[i].total_score}
*/} + {/*
{value[i].total_score}
*/}
--
) - return target_listres + return target_listres } } - let newTotal_rate_dataList = (length,value) => { + let newTotal_rate_dataList = (length, value) => { let target_listres = []; - if(value!=undefined){ - for(let i = 0; i < value.length; i++) { + if (value != undefined) { + for (let i = 0; i < value.length; i++) { // if(i===0){ // target_listres.push( @@ -435,9 +435,9 @@ class EcCompletionCalculation extends Component { // ) // } - if(i -
{value[i].score.toFixed(2)}
+
{value[i].score.toFixed(2)}
) } @@ -460,22 +460,22 @@ class EcCompletionCalculation extends Component {
{completionlist}
{ - calculatesetype===true? -
- 知道啦 -
- : -
- 取消 - 确定 -
+ calculatesetype === true ? +
+ 知道啦 +
+ : +
+ 取消 + 确定 +
} @@ -534,7 +534,7 @@ class EcCompletionCalculation extends Component { {/*
*/} {/*
*/} {/*
*/} - {/*课程目标*/} + {/*课程目标*/}

@@ -544,189 +544,189 @@ class EcCompletionCalculation extends Component { 实际达成 权重

- - { Spintype===true?}/>:"" } - { target_list.length===0&&Spintype===false? -
  • + {Spintype === true ? } /> : ""} + + {target_list.length === 0 && Spintype === false ? +
  • -- -- -- -- -- -- -
  • :""} - - - {Spintype===false?target_list.map((item,key)=>{ - - return( -
  • - {key+1} - {item.content} - {item.status==="not_achieved"?"未达成":"已达成"} - {item.standard_grade} - {item.actually_grade} - {item.weight} -
  • - ) + : ""} + - }):"" + {Spintype === false ? target_list.map((item, key) => { + + return ( +
  • + {key + 1} + {item.content} + {item.status === "not_achieved" ? "未达成" : "已达成"} + {item.standard_grade} + {item.actually_grade} + {item.weight} +
  • + ) + + }) : "" } - +
    - {/*毕业要求指标点达成评价结果*/} + {/*毕业要求指标点达成评价结果*/}
    - 毕业要求指标点达成评价结果 - 注: 代表支持指标点;代表不支持指标点 + 毕业要求指标点达成评价结果 + 注: 代表支持指标点;代表不支持指标点
    - { - graduation_list.length===0? -

    - 毕业要求 - {5} - - 达成结果 - 达成目标值 - 达成实际值 - 课程权重 - {TargetresList(5)} -

    - :"" - } + { + graduation_list.length === 0 ? +

    + 毕业要求 + {5} + + 达成结果 + 达成目标值 + 达成实际值 + 课程权重 + {TargetresList(5)} +

    + : "" + } - { Spintype===true?}/>:"" } + {Spintype === true ? } /> : ""} - { - graduation_list.length===0&&Spintype===false? -
  • - {/* {item.ec_graduation_name} */} - {1} - {"--"} - {"--"} - {"--"} - {"--"} - 立即配置 - {TargetresContentList(5,[2,2,2,2,2])} -
  • - :"" - } - - { - Spintype===false?graduation_list.map((item,key)=>{ - - if(key===0){ - return( -
  • 5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> -
    - 毕业要求 -
    - {item.ec_subitem_content} -
    - {TargetresList(ec_course_targets_count)} -
    -
    - 课程权重 - 达成目标值 - 达成实际值 - 达成结果 -
    -
  • - ) } - - }):"" - } - {/*mynewtarget_scoreclassysls*/} - + { + Spintype === false ? graduation_list.map((item, key) => { + + if (key === 0) { + return ( +
  • 5 ? (76 * (ec_course_targets_count + 4) + 380 + 15) : 1200 + "px" }}> +
    + 毕业要求 +
    + {item.ec_subitem_content} +
    + {TargetresList(ec_course_targets_count)} +
    +
    + 课程权重 + 达成目标值 + 达成实际值 + 达成结果 +
    +
  • + ) + } + + }) : "" + } + {/*mynewtarget_scoreclassysls*/} + -
    - { - Spintype===false?graduation_list.map((item,key)=>{ - - return( - -
  • 5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> -
    - {key+1} -
    - {item.content} -
    - {TargetresContentList(target_list,item.support_course_target_ids)} -
    -
    - {item.weights===null||item.weights===undefined||item.weights==="0.00"||item.weights===0.00||item.weights===0?立即配置:{item.weights}} - {item.actually_achievement===null?0:item.actually_achievement} - {item.objective_achievement===null?0:item.objective_achievement} - {item.status==="not_achieved"?"未完成":"完成"} -
    -
  • - - - //
  • 5 ? (76*(ec_course_targets_count+4)+380):1200+"px"}}> - // {/* {item.ec_graduation_name} */} - // {key+1} - // {item.content} - // {item.status==="not_achieved"?"未完成":"完成"} - // {item.objective_achievement===null?0:item.objective_achievement} - // {item.actually_achievement===null?0:item.actually_achievement} - // {item.weights===null||item.weights===0?立即配置:{item.weights}} - // {TargetresContentList(ec_course_targets_count,item.target_position)} - //
  • - ) - - }):"" - } - - -
    + } + +
    + { + Spintype === false ? graduation_list.map((item, key) => { + + return ( + +
  • 5 ? (76 * (ec_course_targets_count + 4) + 380 + 15) : 1200 + "px" }}> +
    + {key + 1} +
    + {item.content} +
    + {TargetresContentList(target_list, item.support_course_target_ids)} +
    +
    + {item.weights === null || item.weights === undefined || item.weights === "0.00" || item.weights === 0.00 || item.weights === 0 ? 立即配置 : {item.weights}} + {item.actually_achievement === null ? 0 : item.actually_achievement} + {item.objective_achievement === null ? 0 : item.objective_achievement} + {item.status === "not_achieved" ? "未完成" : "完成"} +
    +
  • + + + //
  • 5 ? (76*(ec_course_targets_count+4)+380):1200+"px"}}> + // {/* {item.ec_graduation_name} */} + // {key+1} + // {item.content} + // {item.status==="not_achieved"?"未完成":"完成"} + // {item.objective_achievement===null?0:item.objective_achievement} + // {item.actually_achievement===null?0:item.actually_achievement} + // {item.weights===null||item.weights===0?立即配置:{item.weights}} + // {TargetresContentList(ec_course_targets_count,item.target_position)} + //
  • + ) + + }) : "" + } + + +
    - {/*课程总评成绩表*/} + {/*课程总评成绩表*/}
    - 课程总评成绩表 + 课程总评成绩表
    -

    5 ? (180 * total_rate_data+226+16) : 1200+"px"}}> +

    5 ? (180 * total_rate_data + 226 + 16) : 1200 + "px" }}> {/*序号*/} 课程目标 {/*姓名*/} {/*学号*/} - {TargetresLists(total_rate_data-1)} + {TargetresLists(total_rate_data - 1)} 总评成绩

    {/*style={{width: 113*(total_rate_data+4)>1136?113*(total_rate_data+4.5):1136+"px"}}*/} @@ -738,10 +738,10 @@ class EcCompletionCalculation extends Component { // return( //
  • 1200?(113*(total_rate_data+4.5))+63:1200+"px"}}> // 占比 - // {/*colorTransparent*/} - // {/* 平均数 */} - // {/* 平均数 */} - // {/* {Total_rate_dataList(total_rate_data-1,i.total_rate)} + // {/*colorTransparent*/} + // {/* 平均数 */} + // {/* 平均数 */} + // {/* {Total_rate_dataList(total_rate_data-1,i.total_rate)} //
  • // ) @@ -749,19 +749,19 @@ class EcCompletionCalculation extends Component { // }) */} } - { Spintype===true?}/>:"" } - { - Spintype===false?
  • 5 ? (180 * total_rate_data+226+16) : 1200 + "px"}}> - 占比 - {/*colorTransparent*/} - {/* 平均数 */} - {/* 平均数 */} - {Total_rate_dataList(course_total_score)} - { - course_rate===undefined||course_rate===null||course_rate===""||course_rate==="0"||course_rate===0? --:{course_rate} - } -
  • :"" - } + {Spintype === true ? } /> : ""} + { + Spintype === false ?
  • 5 ? (180 * total_rate_data + 226 + 16) : 1200 + "px" }}> + 占比 + {/*colorTransparent*/} + {/* 平均数 */} + {/* 平均数 */} + {Total_rate_dataList(course_total_score)} + { + course_rate === undefined || course_rate === null || course_rate === "" || course_rate === "0" || course_rate === 0 ? -- : {course_rate} + } +
  • : "" + } {/*style={{width: 113*(total_rate_data+4)>1136?113*(total_rate_data+4):1136+"px"}}*/} { // course_total_score.map((i,k)=>{ @@ -784,22 +784,22 @@ class EcCompletionCalculation extends Component { // }) } { - Spintype===false?
  • 1200?(113*(total_rate_data+4.5))+63:1200+"px"}}> - {/*{k+1}*/} - 平均分 - {/*{i.student_scores.name}*/} - {/*{i.student_scores.student_number}*/} - {newTotal_rate_dataList(course_total_score-1,course_total_score)} - {/* {course_total_score.length===0?"":course_total_score[course_total_score-1].total_score} */} - { - course_achievement===undefined||course_achievement===null||course_achievement===""||course_achievement==="0"||course_achievement===0? --:{course_achievement} - } -
  • :"" + Spintype === false ?
  • 1200 ? (113 * (total_rate_data + 4.5)) + 63 : 1200 + "px" }}> + {/*{k+1}*/} + 平均分 + {/*{i.student_scores.name}*/} + {/*{i.student_scores.student_number}*/} + {newTotal_rate_dataList(course_total_score - 1, course_total_score)} + {/* {course_total_score.length===0?"":course_total_score[course_total_score-1].total_score} */} + { + course_achievement === undefined || course_achievement === null || course_achievement === "" || course_achievement === "0" || course_achievement === 0 ? -- : {course_achievement} + } +
  • : "" } -
  • 1136?113*(total_rate_data+4):1136+"px",display:morelisttype===true?"block":"none"}}> - this.showmorelist()}>加载更多 +
  • 1136 ? 113 * (total_rate_data + 4) : 1136 + "px", display: morelisttype === true ? "block" : "none" }}> + this.showmorelist()}>加载更多
  • @@ -808,7 +808,7 @@ class EcCompletionCalculation extends Component {
    - 课程目标成绩分析 + 课程目标成绩分析
    @@ -816,37 +816,37 @@ class EcCompletionCalculation extends Component {
    -

    +

    课程目标 平均分 最高分数 最低分数 - { - score_levels&&score_levels.map((i,k)=>{ - return( - {i.description} - ) - }) - } + { + score_levels && score_levels.map((i, k) => { + return ( + {i.description} + ) + }) + }

    { - Spintype===false?target_list.map((i,k)=>{ + Spintype === false ? target_list.map((i, k) => { - return( + return (
  • - {k+1} + {k + 1} {i.standard_grade} - {i.maximum_score===null || i.maximum_score===undefined ||i.maximum_score===""?"--":i.maximum_score} - {i.minimum_score===null || i.minimum_score===undefined || i.minimum_score===""?"--":i.minimum_score} + {i.maximum_score === null || i.maximum_score === undefined || i.maximum_score === "" ? "--" : i.maximum_score} + {i.minimum_score === null || i.minimum_score === undefined || i.minimum_score === "" ? "--" : i.minimum_score} { - i.score_levels.map((j,l)=>{ + i.score_levels.map((j, l) => { - return( - + return ( +
    {j.count}人
    -
    {j.rate===null||j.rate===undefined||j.rate===""||j.rate===0?0.00:j.rate}%
    -
    +
    {j.rate === null || j.rate === undefined || j.rate === "" || j.rate === 0 ? 0.00 : j.rate}%
    +
    ) } ) @@ -881,43 +881,43 @@ class EcCompletionCalculation extends Component {
  • ) - }):"" + }) : "" } - { Spintype===true?}/>:"" } - - {target_list.length===0&&Spintype===false? -
  • - -- - -- - -- - -- - -
    --人
    -
    --%
    -
    - -
    --人
    -
    --%
    -
    - -
    --人
    -
    --%
    -
    - -
    --人
    -
    --%
    -
    - -
    --人
    -
    --%
    -
    - -
    --人
    -
    --%
    -
    -
  • :""} - + {Spintype === true ? } /> : ""} + + {target_list.length === 0 && Spintype === false ? +
  • + -- + -- + -- + -- + +
    --人
    +
    --%
    +
    + +
    --人
    +
    --%
    +
    + +
    --人
    +
    --%
    +
    + +
    --人
    +
    --%
    +
    + +
    --人
    +
    --%
    +
    + +
    --人
    +
    --%
    +
    +
  • : ""} +
    @@ -926,5 +926,5 @@ class EcCompletionCalculation extends Component { } } -export default SnackbarHOC() (EcCompletionCalculation); +export default SnackbarHOC()(EcCompletionCalculation); diff --git a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js index 013357d44..493cb38b9 100644 --- a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js +++ b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js @@ -6,11 +6,11 @@ import classNames from 'classnames' import axios from 'axios'; -// import { TPMIndexHOC } from '../../../tpm/TPMIndexHOC'; +// import TPMIndexHOC from '../../../tpm/TPMIndexHOC'; import { SnackbarHOC } from 'educoder' -import { Select,InputNumber,message,Modal,Input,Radio,Spin,Icon,Tooltip } from 'antd'; +import { Select, InputNumber, message, Modal, Input, Radio, Spin, Icon, Tooltip } from 'antd'; import 'antd/dist/antd.css'; @@ -21,1029 +21,1029 @@ const $ = window.$; // 课程目标评价方法 class EcCourseEvaluationsbottom extends Component { - constructor(props) { - super(props) - this.state={ - totalevaluations_list:[], - ec_course_target_id:0, - achievement_list:[], - evaluations_listSelec:[], - evaluations_lists: [], - evaluation_subitems_lists: [], - evaluations_list:[], - evaluation_subitems_list:{}, - achievement_methods:[], - ec_course_target_name:"", - buttomSaveCourseEvaluationsbottom:this.SaveCourseEvaluationsbottom, - spinningstate:true, - schooldata:{}, - sequenceid:0, - target_id:null, - titlemessages:"提示", - Modallists:"", - eacoursetype:false, - eacoursesavetypes:false, - newec_course_idbottom:undefined, - methodologytype:false, - meweacoursetype:false, - newshowredvalue:false, - percentagetype:false, - ismanager:true - } - } - getec_course_achievement_methods=()=>{ - const {newec_course_idbottom}=this.state; - if(newec_course_idbottom!=undefined){ - // const url ='ec_courses/:course_id/course_targets.json'; - // const url = `/ec_course_achievement_methods?ec_course_id=`+newec_course_idbottom; - const course_id = 706 - const url =`/ec_courses/${course_id}/course_targets/course_achievement_methods.json`; - axios.get(url, { - withCredentials: true, - }) - .then((response)=>{ - this.setState({ - achievement_list:response.data.course_targets, - spinningstate:false, - ismanager:true - }) - }).catch(function (error) { - console.log(error); - }); - } - // this.setState({ - // achievement_list:[ - // {course_achievement_methods: [ - // { - // evaluate_id: 24, - // evaluate_name: "期末考试", - // course_evaluation_subitems: [ - // {evaluation_relates_id: 31, evaluation_relates_name: "期末考试1目标1考题"}, - // {evaluation_relates_id: 32, evaluation_relates_name: "期末考试1目标2考题"} - // ], - // percentage: 100, - // score: 15 - // } - // ], - // target_id: 5 - // }, - // ], - // spinningstate:false - // }) - - - } - - getNavigationData=(ec_course_id)=>{ - // const jol =`/ec_major_schools/get_navigation_data?ec_year_id=`+ec_year_id+"&ec_course_id="+ec_course_id; - const jol =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; - axios.get(jol, { - withCredentials: true, - }) - .then((response) => { - if(response.status===200){ - // if(response.data.allow_visit===false){ - // window.location.href="/403" - // } - this.setState({ - schooldata:response.data - }) - } - - }) - .catch(function (error) { - console.log(error); - }); + constructor(props) { + super(props) + this.state = { + totalevaluations_list: [], + ec_course_target_id: 0, + achievement_list: [], + evaluations_listSelec: [], + evaluations_lists: [], + evaluation_subitems_lists: [], + evaluations_list: [], + evaluation_subitems_list: {}, + achievement_methods: [], + ec_course_target_name: "", + buttomSaveCourseEvaluationsbottom: this.SaveCourseEvaluationsbottom, + spinningstate: true, + schooldata: {}, + sequenceid: 0, + target_id: null, + titlemessages: "提示", + Modallists: "", + eacoursetype: false, + eacoursesavetypes: false, + newec_course_idbottom: undefined, + methodologytype: false, + meweacoursetype: false, + newshowredvalue: false, + percentagetype: false, + ismanager: true } - componentDidMount(){ - let ec_course_id=this.props.match.params.ec_course_id; - const course_id = 706 - const url =`/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; - // /ec_courses//course_targets/course_achievement_methods.json - // const url = `/ec_course_achievement_methods?ec_course_id=`+course_id; - axios.get(url) - .then((response)=>{ - this.setState({ - achievement_list:response.data.course_targets, - spinningstate:false, - ismanager:true - }) - }).catch(function (error) { - console.log(error); - }); - - // this.getNavigationData(ec_course_id); - this.setState({ - newec_course_idbottom:course_id - }) - this.props.Ontitine("evaluation_methods"); + } + getec_course_achievement_methods = () => { + const { newec_course_idbottom } = this.state; + if (newec_course_idbottom != undefined) { + // const url ='ec_courses/:course_id/course_targets.json'; + // const url = `/ec_course_achievement_methods?ec_course_id=`+newec_course_idbottom; + const course_id = 706 + const url = `/ec_courses/${course_id}/course_targets/course_achievement_methods.json`; + axios.get(url, { + withCredentials: true, + }) + .then((response) => { + this.setState({ + achievement_list: response.data.course_targets, + spinningstate: false, + ismanager: true + }) + }).catch(function (error) { + console.log(error); + }); } - editecCourseEvaluationslist=(e)=>{ - let id =e.target.getAttribute("target_id"); - let newid =e.target.name; + // this.setState({ + // achievement_list:[ + // {course_achievement_methods: [ + // { + // evaluate_id: 24, + // evaluate_name: "期末考试", + // course_evaluation_subitems: [ + // {evaluation_relates_id: 31, evaluation_relates_name: "期末考试1目标1考题"}, + // {evaluation_relates_id: 32, evaluation_relates_name: "期末考试1目标2考题"} + // ], + // percentage: 100, + // score: 15 + // } + // ], + // target_id: 5 + // }, + // ], + // spinningstate:false + // }) + + + } + + getNavigationData = (ec_course_id) => { + // const jol =`/ec_major_schools/get_navigation_data?ec_year_id=`+ec_year_id+"&ec_course_id="+ec_course_id; + const jol = `/ec_major_schools/get_navigation_data?ec_course_id=` + ec_course_id; + axios.get(jol, { + withCredentials: true, + }) + .then((response) => { + if (response.status === 200) { + // if(response.data.allow_visit===false){ + // window.location.href="/403" + // } + this.setState({ + schooldata: response.data + }) + } - this.setState({ - buttomSaveCourseEvaluationsbottom:this.SaveCourseEvaluationsbottom, - target_id:id, - percentagetype:false - }) - // $("#ecCourseEvaluationsbottomsubmit").show(); - // $("#SystemParametersbottom").show(); - // let offsettop=$("#ecCourseEvaluationsbottomsubmit").position().top||$("#ecCourseEvaluationsbottomsubmit").scrollTop || $("#ecCourseEvaluationsbottomsubmit").pageYOffset; - // window.scrollTo(0, offsettop) - - let {evaluations_list,evaluation_subitems_list,achievement_methods} = this.state; - this.setState({ - achievement_methods:undefined, - selectevaluation_phase:[], - course_select_value:'', - evaluations_lists:[], - sequenceid:newid, - methodologytype:false, - Modallists:' ', - meweacoursetype:false, - eacoursesavetypes:false, - newshowredvalue:false }) + .catch(function (error) { + console.log(error); + }); + } + componentDidMount() { + let ec_course_id = this.props.match.params.ec_course_id; + const course_id = 706 + const url = `/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; + // /ec_courses//course_targets/course_achievement_methods.json + // const url = `/ec_course_achievement_methods?ec_course_id=`+course_id; + axios.get(url) + .then((response) => { + this.setState({ + achievement_list: response.data.course_targets, + spinningstate: false, + ismanager: true + }) + }).catch(function (error) { + console.log(error); + }); - let newevaluations_list=[]; - let newevaluation_subitems_list=new Object (); - let newachievement_methods=[]; - const url = `/ec_course_achievement_methods/edit_course_target?ec_course_target_id=`+id; - axios.get(url, { - withCredentials: true, - }) - .then((response)=>{ - if(response.status===200){ - if(response.data.evaluation_phase_list.length===0){ + // this.getNavigationData(ec_course_id); + this.setState({ + newec_course_idbottom: course_id + }) + this.props.Ontitine("evaluation_methods"); + } + editecCourseEvaluationslist = (e) => { + let id = e.target.getAttribute("target_id"); + let newid = e.target.name; + + this.setState({ + buttomSaveCourseEvaluationsbottom: this.SaveCourseEvaluationsbottom, + target_id: id, + percentagetype: false + }) + // $("#ecCourseEvaluationsbottomsubmit").show(); + // $("#SystemParametersbottom").show(); + // let offsettop=$("#ecCourseEvaluationsbottomsubmit").position().top||$("#ecCourseEvaluationsbottomsubmit").scrollTop || $("#ecCourseEvaluationsbottomsubmit").pageYOffset; + // window.scrollTo(0, offsettop) + + let { evaluations_list, evaluation_subitems_list, achievement_methods } = this.state; + this.setState({ + achievement_methods: undefined, + selectevaluation_phase: [], + course_select_value: '', + evaluations_lists: [], + sequenceid: newid, + methodologytype: false, + Modallists: ' ', + meweacoursetype: false, + eacoursesavetypes: false, + newshowredvalue: false + }) + + let newevaluations_list = []; + let newevaluation_subitems_list = new Object(); + let newachievement_methods = []; + const url = `/ec_course_achievement_methods/edit_course_target?ec_course_target_id=` + id; + axios.get(url, { + withCredentials: true, + }) + .then((response) => { + if (response.status === 200) { + if (response.data.evaluation_phase_list.length === 0) { this.setState({ - achievement_methods:undefined + achievement_methods: undefined }) - let newObject=new Object (); - newachievement_methods.push(newObject) + let newObject = new Object(); + newachievement_methods.push(newObject) } - if(response.data.evaluation_phase_list.length>0){ - let evaluation_phase_list=response.data.evaluation_phase_list; - let evaluations_list=response.data.evaluations_list; - for(var i=0; i 0) { + let evaluation_phase_list = response.data.evaluation_phase_list; + let evaluations_list = response.data.evaluations_list; + for (var i = 0; i < evaluation_phase_list.length; i++) { + let course_select_value = null; + let newevaluation_phase = evaluation_phase_list[i].evaluation_phase; + let selectevaluation_phase = [] + for (var j = 0; j < response.data.evaluations_list.length; j++) { + if (evaluation_phase_list[i].evaluation_id === evaluations_list[j].id) { + course_select_value = evaluations_list[j].name + } } - for(var z=0;z{ - - let {evaluation_subitems_list,totalevaluations_list,achievement_methods} = this.state; - let newachievement_methods=achievement_methods; - let newlist=new Object (); - let location=keythis.key; - let list=totalevaluations_list.evaluations_list; - // 点击切换清空 - for(var z=0; z { + + let { evaluation_subitems_list, totalevaluations_list, achievement_methods } = this.state; + let newachievement_methods = achievement_methods; + let newlist = new Object(); + let location = keythis.key; + let list = totalevaluations_list.evaluations_list; + // 点击切换清空 + for (var z = 0; z < newachievement_methods.length; z++) { + if (z === location) { + newachievement_methods[z].evaluation_subitems = [] + } + } + this.setState({ + evaluations_lists: evaluation_subitems_list[value], + evaluation_subitems_lists: evaluation_subitems_list[value][0], + achievement_methods: newachievement_methods + }); - if(newachievement_methods.length===0){ - for(var i=0; i0){ - if(newachievement_methods[location]===undefined){ - newachievement_methods.push(newlist) - } - for(var i=0; i 0) { + if (newachievement_methods[location] === undefined) { + newachievement_methods.push(newlist) + } + for (var i = 0; i < list.length; i++) { + if (list[i].name === value) { + newachievement_methods[location].course_evaluation_id = list[i].id + newachievement_methods[location].course_select_value = value + newachievement_methods[location].selectevaluation_phase = [] + } } - - this.setState({ - achievement_methods: newachievement_methods - }); - } - handevaluation_subitems_list=(value,keynum)=>{ - let{totalevaluations_list,achievement_methods}=this.state; - let newachievement_methods=[]; - let id; - if(value.length>0){ - - newachievement_methods=achievement_methods - for(var j=0; j { + let { totalevaluations_list, achievement_methods } = this.state; + let newachievement_methods = []; + let id; + if (value.length > 0) { + + newachievement_methods = achievement_methods + for (var j = 0; j < value.length; j++) { + if (!isNaN(keynum[j].key)) { + id = keynum[j].key } + } - let list=[]; + let list = []; - for(var k=0; k{ - let id=parseInt(keynum.key); - let{achievement_methods}=this.state; - let newachievement_methods=achievement_methods; - for(var i=0; i { + let id = parseInt(keynum.key); + let { achievement_methods } = this.state; + let newachievement_methods = achievement_methods; + for (var i = 0; i < newachievement_methods.length; i++) { + if (isNaN(id)) { + for (var j = 0; j < newachievement_methods[i].evaluation_subitems.length; j++) { + if (newachievement_methods[i].evaluation_subitems[j].name === value) { + newachievement_methods[i].evaluation_subitems.splice(j, 1); + newachievement_methods[i].selectevaluation_phase.splice(j, 1); } + } + } else { + if (id === i) { + newachievement_methods[i].evaluation_subitems.splice(i, 1); + newachievement_methods[i].selectevaluation_phase.splice(i, 1); + } } + } + this.setState({ + achievement_methods: newachievement_methods + }) + } + + + handevaluation_CourseScore = (e) => { + let { achievement_methods } = this.state; + let newachievement_methods = achievement_methods; + let id = e.target.id; + var value = parseFloat(e.target.value); + for (var i = 0; i < newachievement_methods.length; i++) { + newachievement_methods[id].score = value + } + this.setState({ + achievement_methods: newachievement_methods + }) + } + handevaluation_CoursePercentag = (e) => { + let { achievement_methods } = this.state; + let newachievement_methods = achievement_methods; + let id = e.target.id; + let value = parseFloat(e.target.value); + + if (value > 100) { + // message.warning('占比请输入0~100的数'); this.setState({ - achievement_methods:newachievement_methods + Modallists: '占比请输入0~100的数', + meweacoursetype: true, + newshowredvalue: true }) + value = 100 } - - handevaluation_CourseScore=(e)=>{ - let {achievement_methods} = this.state; - let newachievement_methods=achievement_methods; - let id=e.target.id; - var value=parseFloat(e.target.value); - for(var i=0; i{ - let {achievement_methods} = this.state; - let newachievement_methods=achievement_methods; - let id=e.target.id; - let value=parseFloat(e.target.value); - - if(value>100){ - // message.warning('占比请输入0~100的数'); - this.setState({ - Modallists:'占比请输入0~100的数', - meweacoursetype:true, - newshowredvalue:true - }) - value=100 - } - if(value<0){ - // message.warning('占比请输入0~100的数'); - this.setState({ - Modallists:'占比不能小于0', - meweacoursetype:true, - newshowredvalue:true - }) - value=0 - } - - if(value===""||value===null||value===undefined){ - // message.warning('占比请输入0~100的数'); - this.setState({ - Modallists:'占比不能为空', - meweacoursetype:true, - newshowredvalue:true - }) - value=0 - } - - for(var i=0; i{ - let {achievement_methods} = this.state; - let newachievement_methods=achievement_methods; - let newlist=new Object (); - newachievement_methods.push(newlist); - this.setState({ - achievement_methods:newachievement_methods - }); + for (var i = 0; i < newachievement_methods.length; i++) { + newachievement_methods[id].percentage = value } - Delethandevaluation=(e)=>{ - let {achievement_methods} = this.state; - let id =e.target.getAttribute("index"); - let newachievement_methods=achievement_methods; - newachievement_methods.splice(id,1); - this.setState({ - achievement_methods:newachievement_methods - }); - } - - - EvaluationsSaveonloadgetdata=(id)=>{ - const course_id = 706; - const url = `/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; - axios.get(url, { - withCredentials: true, - }) - .then((response)=>{ - this.setState({ - achievement_list:response.data.course_targets, - spinningstate:false, - ismanager:true - }) - - }).catch(function (error) { - console.log(error); - this.setState({ - spinningstate:false - }) - }); - - - } - ecrestoration=()=>{ - this.setState({ - buttomSaveCourseEvaluationsbottom:this.SaveCourseEvaluationsbottom - }) - } + this.setState({ + achievement_methods: newachievement_methods + }) + } + + Addhandevaluation = (e) => { + let { achievement_methods } = this.state; + let newachievement_methods = achievement_methods; + let newlist = new Object(); + newachievement_methods.push(newlist); + this.setState({ + achievement_methods: newachievement_methods + }); + } + Delethandevaluation = (e) => { + let { achievement_methods } = this.state; + let id = e.target.getAttribute("index"); + let newachievement_methods = achievement_methods; + newachievement_methods.splice(id, 1); + this.setState({ + achievement_methods: newachievement_methods + }); + } + + + EvaluationsSaveonloadgetdata = (id) => { + const course_id = 706; + const url = `/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; + axios.get(url, { + withCredentials: true, + }) + .then((response) => { + this.setState({ + achievement_list: response.data.course_targets, + spinningstate: false, + ismanager: true + }) - SaveCourseEvaluationsbottom=()=>{ - let ec_course_id=this.props.match.params.ec_course_id; + }).catch(function (error) { + console.log(error); this.setState({ - buttomSaveCourseEvaluationsbottom:'', - percentagetype:true + spinningstate: false }) - let {newec_course_target_id,achievement_methods} = this.state; + }); - for(var j=0; j { + this.setState({ + buttomSaveCourseEvaluationsbottom: this.SaveCourseEvaluationsbottom + }) + } - if(achievement_methods[j].evaluation_subitems===undefined){ - // message.error('提交失败!请选择支撑项'); - this.setState({ - Modallists:'提交失败,支撑项内容不能为空', - meweacoursetype:true, - eacoursesavetypes:true - }) - this.ecrestoration(); - return; - } - if(achievement_methods[j].score===undefined||achievement_methods[j].score===NaN||achievement_methods[j].score===null){ - // message.error('提交失败!请填写支撑分数!'); - this.setState({ - Modallists:'提交失败,支撑分数不能为空', - meweacoursetype:true, - eacoursesavetypes:true - }) - this.ecrestoration(); - return; - } - - if(achievement_methods[j].percentage===undefined||achievement_methods[j].percentage===NaN||achievement_methods[j].percentage===null){ - // message.error('提交失败!请填写占比!'); - this.setState({ - Modallists:'提交失败,占比不能为空', - meweacoursetype:true, - eacoursesavetypes:true, - newshowredvalue:true - }) - this.ecrestoration(); - return; - } + SaveCourseEvaluationsbottom = () => { + let ec_course_id = this.props.match.params.ec_course_id; + this.setState({ + buttomSaveCourseEvaluationsbottom: '', + percentagetype: true + }) + let { newec_course_target_id, achievement_methods } = this.state; + for (var j = 0; j < achievement_methods.length; j++) { + if (achievement_methods[j].course_evaluation_id === undefined) { + // message.error('提交失败!请选择该目标评价环节'); + this.setState({ + Modallists: '提交失败,评价环节不能为空', + meweacoursetype: true, + eacoursesavetypes: true + }) + this.ecrestoration(); + return; } - let percentagenum=0; - for(var o=0;o100){ - // message.error('提交失败!支撑占比不能超过总和100%'); - this.setState({ - Modallists:'提交失败,支撑占比不能超过总和100%', - meweacoursetype:true, - newshowredvalue:true, - percentagetype:true - }) + if (achievement_methods[j].evaluation_subitems === undefined) { + // message.error('提交失败!请选择支撑项'); this.setState({ - buttomSaveCourseEvaluationsbottom:this.SaveCourseEvaluationsbottom - }) - return + Modallists: '提交失败,支撑项内容不能为空', + meweacoursetype: true, + eacoursesavetypes: true + }) + this.ecrestoration(); + return; } - if(percentagenum<100){ - // message.error('提交失败!支撑占比不能超过总和100%'); - this.setState({ - Modallists:'提交失败,支撑占比总和要等于100%', - meweacoursetype:true, - newshowredvalue:true, - percentagetype:true - }) + if (achievement_methods[j].score === undefined || achievement_methods[j].score === NaN || achievement_methods[j].score === null) { + // message.error('提交失败!请填写支撑分数!'); this.setState({ - buttomSaveCourseEvaluationsbottom:this.SaveCourseEvaluationsbottom - }) - return + Modallists: '提交失败,支撑分数不能为空', + meweacoursetype: true, + eacoursesavetypes: true + }) + this.ecrestoration(); + return; } - for(var i=0;i { - if(response.data.status===0){ - this.setState({ - target_id:null, - newec_course_idbottom:response.data.ec_course_id, - buttomSaveCourseEvaluationsbottom:this.SaveCourseEvaluationsbottom, - // Modallists:response.data.message, - // eacoursetype:true, - Modallists:' ', - meweacoursetype:false, - achievement_methods:undefined, - eacoursesavetypes:false, - newshowredvalue:false, - ismanager:true - }) - // $("#ecCourseEvaluationsbottomsubmit").hide(); - // $("#SystemParametersbottom").hide(); - this.EvaluationsSaveonloadgetdata(response.data.ec_course_id); - this.getNavigationData(ec_course_id); - - }else if(response.data.status===-1){ - this.setState({ - buttomSaveCourseEvaluationsbottom:this.SaveCourseEvaluationsbottom, - Modallists:response.data.message, - eacoursetype:true, - }) - } - }).catch((error) => { - console.log(error) + let percentagenum = 0; + for (var o = 0; o < achievement_methods.length; o++) { + percentagenum = percentagenum + achievement_methods[o].percentage; + } + if (percentagenum > 100) { + // message.error('提交失败!支撑占比不能超过总和100%'); + this.setState({ + Modallists: '提交失败,支撑占比不能超过总和100%', + meweacoursetype: true, + newshowredvalue: true, + percentagetype: true + }) + this.setState({ + buttomSaveCourseEvaluationsbottom: this.SaveCourseEvaluationsbottom }) + return } - CancelecCourseEvaluationsbottom=()=>{ + if (percentagenum < 100) { + // message.error('提交失败!支撑占比不能超过总和100%'); this.setState({ - achievement_methods:undefined, - target_id:null, - methodologytype:false, - Modallists:' ', - meweacoursetype:false, - eacoursesavetypes:false, - newshowredvalue:false, - percentagetype:false + Modallists: '提交失败,支撑占比总和要等于100%', + meweacoursetype: true, + newshowredvalue: true, + percentagetype: true }) - // $("#ecCourseEvaluationsbottomsubmit").hide(); - // $("#SystemParametersbottom").hide(); - this.getec_course_achievement_methods(); + this.setState({ + buttomSaveCourseEvaluationsbottom: this.SaveCourseEvaluationsbottom + }) + return } - - selectsonFocuslist=(e,key)=>{ - let value =e.course_select_value; - let {evaluation_subitems_list,totalevaluations_list,achievement_methods} = this.state; - let newachievement_methods=achievement_methods; - let newlist=new Object (); - let location=key; - let list=totalevaluations_list.evaluations_list; - this.setState({ - evaluations_lists: evaluation_subitems_list[value], - evaluation_subitems_lists: evaluation_subitems_list[value][0] - }); - - if(newachievement_methods.length===0){ - for(var i=0; i0){ - if(newachievement_methods[location]===undefined){ - newachievement_methods.push(newlist) - } - for(var i=0; i{ + + // var Url = '/ec_course_achievement_methods/create_evaluation_methods'; + var Url = '/ec_courses/:course_id/course_targets/:target_id/course_achievement_methods.json'; + + axios.post(Url, { + ec_course_target_id: newec_course_target_id, + achievement_methods: achievement_methods + }, + { + withCredentials: true + } + ).then((response) => { + if (response.data.status === 0) { this.setState({ - eacoursetype:false + target_id: null, + newec_course_idbottom: response.data.ec_course_id, + buttomSaveCourseEvaluationsbottom: this.SaveCourseEvaluationsbottom, + // Modallists:response.data.message, + // eacoursetype:true, + Modallists: ' ', + meweacoursetype: false, + achievement_methods: undefined, + eacoursesavetypes: false, + newshowredvalue: false, + ismanager: true }) + // $("#ecCourseEvaluationsbottomsubmit").hide(); + // $("#SystemParametersbottom").hide(); + this.EvaluationsSaveonloadgetdata(response.data.ec_course_id); + this.getNavigationData(ec_course_id); + + } else if (response.data.status === -1) { + this.setState({ + buttomSaveCourseEvaluationsbottom: this.SaveCourseEvaluationsbottom, + Modallists: response.data.message, + eacoursetype: true, + }) + } + }).catch((error) => { + console.log(error) + }) + } + CancelecCourseEvaluationsbottom = () => { + this.setState({ + achievement_methods: undefined, + target_id: null, + methodologytype: false, + Modallists: ' ', + meweacoursetype: false, + eacoursesavetypes: false, + newshowredvalue: false, + percentagetype: false + }) + // $("#ecCourseEvaluationsbottomsubmit").hide(); + // $("#SystemParametersbottom").hide(); + this.getec_course_achievement_methods(); + } + + selectsonFocuslist = (e, key) => { + let value = e.course_select_value; + let { evaluation_subitems_list, totalevaluations_list, achievement_methods } = this.state; + let newachievement_methods = achievement_methods; + let newlist = new Object(); + let location = key; + let list = totalevaluations_list.evaluations_list; + this.setState({ + evaluations_lists: evaluation_subitems_list[value], + evaluation_subitems_lists: evaluation_subitems_list[value][0] + }); + + if (newachievement_methods.length === 0) { + for (var i = 0; i < list.length; i++) { + if (list[i].name === value) { + newlist.course_evaluation_id = list[i].id + } + } + newachievement_methods.push(newlist) + } else if (newachievement_methods.length > 0) { + if (newachievement_methods[location] === undefined) { + newachievement_methods.push(newlist) + } + for (var i = 0; i < list.length; i++) { + if (list[i].name === value) { + newachievement_methods[location].course_evaluation_id = list[i].id + } + } } - render() { - const Option = Select.Option; - let {schooldata,achievement_list,spinningstate,evaluations_list,evaluations_lists,newec_course_target_id,achievement_methods,ec_course_target_name,buttomSaveCourseEvaluationsbottom,sequenceid,target_id, - titlemessages, - Modallists, - eacoursetype, - eacoursesavetypes, - methodologytype, - newec_course_idbottom, - meweacoursetype, - percentagetype, - ismanager - } = this.state; - // console.log("EcCourseEvaluationsbottom12345"); - // console.log(achievement_list); - return ( -
    -
    - { + this.setState({ + eacoursetype: false + }) + } + render() { + const Option = Select.Option; + let { schooldata, achievement_list, spinningstate, evaluations_list, evaluations_lists, newec_course_target_id, achievement_methods, ec_course_target_name, buttomSaveCourseEvaluationsbottom, sequenceid, target_id, + titlemessages, + Modallists, + eacoursetype, + eacoursesavetypes, + methodologytype, + newec_course_idbottom, + meweacoursetype, + percentagetype, + ismanager + } = this.state; + // console.log("EcCourseEvaluationsbottom12345"); + // console.log(achievement_list); + return ( +
    +
    + +
    +
    {Modallists}
    +
    +
    + 取消 + 确定 +
    +
    + + {/*导航*/} + {/*
    */} + + {/*

    */} + {/*课程列表 > */} + {/* {schooldata.ec_course_name} 课程考核方式与数据来源*/} + {/*/!* *!/*/} + {/*/!* 导出培养目标 *!/*/} + {/*导出策略*/} + {/*

    */} + + {/*
    */} + {/*课程考核标准*/} + {/*(请在完成配置后,使用各项成绩导入模板,将本学年所有参与的学生成绩数据导入系统)*/} + {/*在线课堂:{course_name}*/} + {/*导入课堂数据*/} + {/*
    */} + + {/*
    */} + {/**/} + + {/*
    */} + + {/*

    */} + {/* 课程体系 >*/} + {/* {schooldata.ec_course_name} */} + {/*

    请结合本课程的教学情况,修改说明每个课程目标的评价环节和评估方式 window.elasticLayer(3533)}>查看详情
    */} + + {/* /!*课程考核方式与数据来源*!/*/} + {/* /!* *!/*/} + {/* /!* 导出培养目标 *!/*/} + {/* */} + {/* 导出评价方法*/} + {/* */} + {/*

    */} + + {/*
    */} + {/* /!*课程目标达成方法*!/*/} + {/* 1.课程目标*/} + {/* 2.课程考核方式与数据来源*/} + {/* 3.成绩等级设置*/} + {/* 4.课程目标评价方法*/} + {/* 5.课程达成评价结果*/} + {/* (各环节平均得分*占比)之和/(各环节总分*占比)之和*/} + {/*
    */} + + {/*
    */} + +
    + +

    + 课程目标 + 评价环节 + 数据内容 + -

    -
    {Modallists}
    -
    -
    - 取消 - 确定 -
    - - - {/*导航*/} - {/*
    */} - - {/*

    */} - {/*课程列表 > */} - {/* {schooldata.ec_course_name} 课程考核方式与数据来源*/} - {/*/!* *!/*/} - {/*/!* 导出培养目标 *!/*/} - {/*导出策略*/} - {/*

    */} - - {/*
    */} - {/*课程考核标准*/} - {/*(请在完成配置后,使用各项成绩导入模板,将本学年所有参与的学生成绩数据导入系统)*/} - {/*在线课堂:{course_name}*/} - {/*导入课堂数据*/} - {/*
    */} - - {/*
    */} - {/**/} - - {/*
    */} - - {/*

    */} - {/* 课程体系 >*/} - {/* {schooldata.ec_course_name} */} - {/*

    请结合本课程的教学情况,修改说明每个课程目标的评价环节和评估方式 window.elasticLayer(3533)}>查看详情
    */} - - {/* /!*课程考核方式与数据来源*!/*/} - {/* /!* *!/*/} - {/* /!* 导出培养目标 *!/*/} - {/* */} - {/* 导出评价方法*/} - {/* */} - {/*

    */} - - {/*
    */} - {/* /!*课程目标达成方法*!/*/} - {/* 1.课程目标*/} - {/* 2.课程考核方式与数据来源*/} - {/* 3.成绩等级设置*/} - {/* 4.课程目标评价方法*/} - {/* 5.课程达成评价结果*/} - {/* (各环节平均得分*占比)之和/(各环节总分*占比)之和*/} - {/*
    */} - - {/*
    */} - -
    - -

    - 课程目标 - 评价环节 - 数据内容 - - 操作 + 操作 - 评价占比 - 支撑总分值 -

    - - { - achievement_list===undefined?"":achievement_list&&achievement_list.length===0?}/>:achievement_list&&achievement_list.map((item,key)=>{ - return( -
    + 评价占比 + 支撑总分值 +

    + + { + achievement_list === undefined ? "" : achievement_list && achievement_list.length === 0 ? } /> : achievement_list && achievement_list.map((item, key) => { + return ( +
    + { + item.course_achievement_methods.length === 0 ? +
  • +
    + {key + 1} + + + + + + + + +
    +
    + +
    +
    +
    + + + +
    +
    + + +
    +
    + +
    +
    + + {/* 修改start*/} +
    +
    + {/*
    */} +
    +
    + {/* 课程目标{sequenceid}:{ec_course_target_name} */} + 课程目标{key + 1}:{ec_course_target_name} +
    +
    + { + achievement_methods === undefined ? " " : achievement_methods.map((item, itemkey) => { + return ( +
    +
    + 评价环节 + + + + + + + + + + 100 && eacoursesavetypes === true || percentagetype === true ? "bor-red" : ""} + onInput={this.handevaluation_CoursePercentag.bind(this)} id={itemkey} style={{ width: '11%' }} placeholder="请输入占比" /> + % + +
    + + + + + + +
    +
    +
    +
    +
    + ) + }) + } + {Modallists} +
    +
    保存
    +
    取消
    +
    +
    +
    + {/* 修改end*/} + + + +
  • + : item.course_achievement_methods.map((i, k) => { + return ( +
  • +
    + {key - k === key ? key + 1 : ""} + + + {i.course_evaluation.name} + + { - item.course_achievement_methods.length===0? -
  • -
    - {key+1} - - - - - - - - -
    -
    - -
    -
    -
    - - - -
    -
    - - -
    -
    - -
    + i.course_evaluation_subitems.map((y, e) => { + return ( +
    {y.name + " "}
    + ) + }) + } + + { + key - k === key ? +
    +
    + +
    +
    +
    : + +
    +
    +
    - - {/* 修改start*/} -
    -
    - {/*
    */} -
    -
    - {/* 课程目标{sequenceid}:{ec_course_target_name} */} - 课程目标{key+1}:{ec_course_target_name} -
    -
    - { - achievement_methods===undefined?" ":achievement_methods.map((item,itemkey)=>{ - return( -
    -
    - 评价环节 - - - - - - - - - - 100&&eacoursesavetypes===true||percentagetype===true?"bor-red": ""} - onInput={this.handevaluation_CoursePercentag.bind(this)} id={itemkey} style={{ width: '11%' }} placeholder="请输入占比"/> - % - -
    - - - - - - -
    -
    -
    -
    -
    - ) - }) - } - {Modallists} -
    -
    保存
    -
    取消
    -
    +
    + + } + + + +
    {i.percentage + "%"}
    +
    + + +
    {i.score}
    +
    + + +
    + {/* 修改start*/} +
    +
    +
    +
    + {/* 课程目标{sequenceid}:{ec_course_target_name} */} + 课程目标{key + 1}:{ec_course_target_name} +
    +
    + { + achievement_methods === undefined ? " " : achievement_methods.map((item, itemkey) => { + + return ( +
    +
    + 评价环节 + + + + + + + + + + 100 && eacoursesavetypes === true || percentagetype === true ? "bor-red" : ""} + onInput={this.handevaluation_CoursePercentag.bind(this)} + id={itemkey} style={{ width: '11%' }} + placeholder="请输入占比" /> + % + + +
    - {/* 修改end*/} - - - -
  • - :item.course_achievement_methods.map((i,k)=>{ - return( -
  • -
    - {key-k===key?key+1:""} - - - {i.course_evaluation.name} - - - { - i.course_evaluation_subitems.map((y,e)=>{ - return( -
    {y.name+" "}
    - ) - }) - } -
    - { - key-k===key? -
    -
    - -
    -
    -
    : - -
    -
    - -
    -
    -
    - } - - - -
    {i.percentage+"%"}
    -
    - - -
    {i.score}
    -
    - -
    -
    - {/* 修改start*/} -
    -
    -
    -
    - {/* 课程目标{sequenceid}:{ec_course_target_name} */} - 课程目标{key+1}:{ec_course_target_name} -
    -
    - { - achievement_methods===undefined?" ":achievement_methods.map((item,itemkey)=>{ - - return( -
    -
    - 评价环节 - - - - - - - - - - 100&&eacoursesavetypes===true||percentagetype===true?"bor-red": ""} - onInput={this.handevaluation_CoursePercentag.bind(this)} - id={itemkey} style={{ width: '11%' }} - placeholder="请输入占比"/> - % - -
    - - - - - - -
    -
    -
    -
    -
    - ) - }) - } - {Modallists} -
    -
    保存
    -
    取消
    -
    -
    -
    - {/* 修改end*/} - -
  • - - ) +
    +
    + ) + }) + } + {Modallists} +
    +
    保存
    +
    取消
    +
    +
    +
    + {/* 修改end*/} + + + + ) + + }) + } +
    + ) + }) + } +
    - }) - } -
    - ) - }) - } -
    - -
    -
    - ); - } +
    +
    + ); + } } -export default SnackbarHOC() (EcCourseEvaluationsbottom); \ No newline at end of file +export default SnackbarHOC()(EcCourseEvaluationsbottom); \ No newline at end of file diff --git a/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/index.js b/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/index.js index e3fd8e243..3ab47eea9 100644 --- a/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/index.js +++ b/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/index.js @@ -8,7 +8,7 @@ import { SnackbarHOC } from 'educoder' import axios from 'axios' import 'antd/dist/antd.css'; import './style.less' -import { ECModalHOC } from '../../common/ECModalHOC' +import ECModalHOC from '../../common/ECModalHOC' class EcCourseSupportSetting extends Component { constructor(props) { diff --git a/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js b/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js index e8876b7a5..19076d13d 100644 --- a/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js +++ b/public/react/src/modules/ecs/subroute/ecStudentList/EcStudentList.js @@ -2,11 +2,11 @@ import React, { Component } from 'react'; import axios from 'axios'; -import { TPMIndexHOC } from '../../../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../../../tpm/TPMIndexHOC'; -import { SnackbarHOC,getImageUrl } from 'educoder' +import { SnackbarHOC, getImageUrl } from 'educoder' -import { Pagination,Upload,Modal,Checkbox,Spin } from 'antd'; +import { Pagination, Upload, Modal, Checkbox, Spin } from 'antd'; import EcTitleCourseEvaluations from '../../ecTitle/ecTitle' @@ -19,199 +19,204 @@ const $ = window.$; class EcStudentList extends Component { constructor(props) { super(props) - this.state={ - majorschoollist:undefined, - titlemessage:"提示", + this.state = { + majorschoollist: undefined, + titlemessage: "提示", // ecComponentState:"ecStudentList", - visible:false, - Modallist:'', - Modallisttypes:0, - studentall:false, - student_id:undefined, - Modallisttypess:0, - ismanager:false, - isSpin:false, - pages:1, - per_pages:20, - total_student:0, - Myschoolstudents:[], + visible: false, + Modallist: '', + Modallisttypes: 0, + studentall: false, + student_id: undefined, + Modallisttypess: 0, + ismanager: false, + isSpin: false, + pages: 1, + per_pages: 20, + total_student: 0, + Myschoolstudents: [], } } - componentDidMount(){ + componentDidMount() { window.document.title = '学生列表'; - let major_id=this.props.match.params.majorId; - let year_id=this.props.match.params.yearId; - - const url ='/ec_years/'+year_id+'/students.json'; - axios.get(url, {params: { - page:this.state.pages, - per_page:this.state.per_pages, - }}).then((response) => { - if(response){ - if(response.status){ - if(response.status===200){ - this.setState({ - total_student:response.data.count, - majorschoollist:response.data, - ismanager:response.data.ismanager, - }); - try { - if(response.data.students.length>0){ - var mst=response.data.students; - for(var i=0;i { + if (response) { + if (response.status) { + if (response.status === 200) { + this.setState({ + total_student: response.data.count, + majorschoollist: response.data, + ismanager: response.data.ismanager, + }); + try { + if (response.data.students.length > 0) { + var mst = response.data.students; + for (var i = 0; i < mst.length; i++) { + mst[i].istrue = false; } - }catch (e) { this.setState({ - Myschoolstudents:[] + Myschoolstudents: mst }); } - + } catch (e) { + this.setState({ + Myschoolstudents: [] + }); } + } } + } - }) + }) .catch(function (error) { console.log(error); }); } - uploadcomponentDidMount(){ - let major_id=this.props.match.params.majorId; - let year_id=this.props.match.params.yearId; - const url ='/ec_years/'+year_id+'/students.json'; - axios.get(url, {params: { + uploadcomponentDidMount() { + let major_id = this.props.match.params.majorId; + let year_id = this.props.match.params.yearId; + const url = '/ec_years/' + year_id + '/students.json'; + axios.get(url, { + params: { page: this.state.pages, per_page: this.state.per_pages, } - } + } ).then((response) => { - if(response){ - if(response.status){ - if(response.status===200){ - this.setState({ - total_student:response.data.count, - majorschoollist:response.data, - ismanager:response.data.ismanager, - }); - try { - if(response.data.students.length>0){ - var mst=response.data.students; - for(var i=0;i 0) { + var mst = response.data.students; + for (var i = 0; i < mst.length; i++) { + mst[i].istrue = false; + } + this.setState({ + Myschoolstudents: mst + }); + } + } catch (e) { + this.setState({ + Myschoolstudents: [] + }); + } + + } + } + } }) - .catch(function (error) { - console.log(error); - }); + .catch(function (error) { + console.log(error); + }); } - - windowsgoblack=()=>{ + + windowsgoblack = () => { window.history.go(-1) } - uploadfile=(file)=>{ + uploadfile = (file) => { console.log("导入的文件"); console.log(file); - this.setState({isSpin:true}) - let {majorschoollist}=this.state; - let year_id=this.props.match.params.yearId; - let Url ='/ec_years/'+year_id+'/students/import.json'; + this.setState({ isSpin: true }) + let { majorschoollist } = this.state; + let year_id = this.props.match.params.yearId; + let Url = '/ec_years/' + year_id + '/students/import.json'; const config = { headers: { "Content-Type": "multipart/form-data" } }; const form = new FormData(); form.append('file', file.file); - axios.post(Url,form - ,config).then((response) => { - if(response.data.status===0){ - // message.success('已成功导入'+response.data.count+"条数据!"); - this.setState({ - // titlemessage: response.data.message+"(支撑关系变更)", - Modallist: '已成功导入'+response.data.success_count+"条数据!", - Modallisttype:true, - Modallisttypes:1, - Modallisttypess:0, - isSpin:false - }) - }else{ - // message.warning(response.data.message); - this.setState({ - // titlemessage: response.data.message+"(支撑关系变更)", - Modallist:response.data.message, - Modallisttype:true, - Modallisttypes:0, - Modallisttypess:0, - isSpin:false - }) - } - }).catch((error) => { - console.log(error) - }) + axios.post(Url, form + , config).then((response) => { + if (response.data.status === 0) { + // message.success('已成功导入'+response.data.count+"条数据!"); + this.setState({ + // titlemessage: response.data.message+"(支撑关系变更)", + Modallist: '已成功导入' + response.data.success_count + "条数据!", + Modallisttype: true, + Modallisttypes: 1, + Modallisttypess: 0, + isSpin: false + }) + } else { + // message.warning(response.data.message); + this.setState({ + // titlemessage: response.data.message+"(支撑关系变更)", + Modallist: response.data.message, + Modallisttype: true, + Modallisttypes: 0, + Modallisttypess: 0, + isSpin: false + }) + } + }).catch((error) => { + console.log(error) + }) } - hidemodeldelete=(Modallisttypes)=>{ + hidemodeldelete = (Modallisttypes) => { this.setState({ - Modallisttype:false, - Modallist:'', - Modallisttypess:0 + Modallisttype: false, + Modallist: '', + Modallisttypess: 0 }) - if(Modallisttypes===1){ + if (Modallisttypes === 1) { // window.location.reload(); this.uploadcomponentDidMount(); } } - showecStudentList=(page)=>{ - - let major_id=this.props.match.params.majorId; - let year_id=this.props.match.params.yearId; - const url ='/ec_years/'+year_id+'/students.json'; - axios.get(url, {params: { - page:page, - per_page:this.state.per_pages, - }}).then((response) => { - if(response){ - if(response.status){ - if(response.status===200){ + showecStudentList = (page) => { + + let major_id = this.props.match.params.majorId; + let year_id = this.props.match.params.yearId; + const url = '/ec_years/' + year_id + '/students.json'; + axios.get(url, { + params: { + page: page, + per_page: this.state.per_pages, + } + }).then((response) => { + if (response) { + if (response.status) { + if (response.status === 200) { this.setState({ - total_student:response.data.count, - majorschoollist:response.data, - ismanager:response.data.ismanager, - pages:page, + total_student: response.data.count, + majorschoollist: response.data, + ismanager: response.data.ismanager, + pages: page, }); try { - if(response.data.students.length>0){ - var mst=response.data.students; - for(var i=0;i 0) { + var mst = response.data.students; + for (var i = 0; i < mst.length; i++) { + mst[i].istrue = false; } this.setState({ - Myschoolstudents:mst + Myschoolstudents: mst }); } - }catch (e) { + } catch (e) { this.setState({ - Myschoolstudents:[] + Myschoolstudents: [] }); } @@ -219,88 +224,90 @@ class EcStudentList extends Component { } } }).catch(function (error) { - console.log(error); - }); + console.log(error); + }); }; - //全选 - onChangestudentall=(e)=>{ - let {Myschoolstudents}=this.state; - let mewmajorschoollist=Myschoolstudents - for(var i=0; i { + let { Myschoolstudents } = this.state; + let mewmajorschoollist = Myschoolstudents + for (var i = 0; i < mewmajorschoollist.length; i++) { + mewmajorschoollist[i].istrue = e.target.checked } this.setState({ - studentall:e.target.checked, - Myschoolstudents:mewmajorschoollist - }) + studentall: e.target.checked, + Myschoolstudents: mewmajorschoollist + }) }; //单选 - onChangestudent=(e)=>{ - let {Myschoolstudents,studentall}=this.state; - let mewmajorschoollist=Myschoolstudents; - let newstudentall=studentall; - if(e.target.checked===false){ - newstudentall=false + onChangestudent = (e) => { + let { Myschoolstudents, studentall } = this.state; + let mewmajorschoollist = Myschoolstudents; + let newstudentall = studentall; + if (e.target.checked === false) { + newstudentall = false } - for(var i=0; i{ - let {Myschoolstudents,studentall} =this.state; - let studentalltype=0 - for(var i=0; i { + let { Myschoolstudents, studentall } = this.state; + let studentalltype = 0 + for (var i = 0; i < Myschoolstudents.length; i++) { + if (Myschoolstudents[i].istrue === true) { + studentalltype = 1 } } - if(studentall===true||studentalltype===1){ + if (studentall === true || studentalltype === 1) { this.setState({ Modallist: '确定删除这些学生吗?', - Modallisttype:true, - Modallisttypess:1 - }) - }else{ + Modallisttype: true, + Modallisttypess: 1 + }) + } else { this.setState({ Modallist: '请选择学生!', - Modallisttype:true - }) + Modallisttype: true + }) } }; //删除学生 - deletelistbthenters=()=>{ - debugger - let {Myschoolstudents,studentall} =this.state; - let major_id=this.props.match.params.majorId; - let year_id=this.props.match.params.yearId; - let newstudent_id=[]; - if(studentall===false){ - for(var i=0; i { + debugger + let { Myschoolstudents, studentall } = this.state; + let major_id = this.props.match.params.majorId; + let year_id = this.props.match.params.yearId; + let newstudent_id = []; + if (studentall === false) { + for (var i = 0; i < Myschoolstudents.length; i++) { + if (Myschoolstudents[i].istrue === true) { newstudent_id.push(Myschoolstudents[i].id) } } } - let url ='/ec_years/'+year_id+'/students.json' - axios.delete(url,{data:{ - ids:newstudent_id, - }}).then((response) => { - if(response.data.status===0){ - this.setState({ + let url = '/ec_years/' + year_id + '/students.json' + axios.delete(url, { + data: { + ids: newstudent_id, + } + }).then((response) => { + if (response.data.status === 0) { + this.setState({ // Modallist: "删除成功!", // Modallisttype:true, - Modallisttypes:1, - Modallisttypess:0 - }) - this.hidemodeldelete(1); + Modallisttypes: 1, + Modallisttypess: 0 + }) + this.hidemodeldelete(1); } }).catch((error) => { console.log(error) @@ -319,7 +326,7 @@ class EcStudentList extends Component { total_student, ismanager, Myschoolstudents - }=this.state; + } = this.state; const uploadProps = { name: 'file', @@ -336,126 +343,126 @@ class EcStudentList extends Component { } } return ( -
    - -
    -
    {Modallist}
    -
    - -
    -
    - {/*
    */} - {/*学生列表*/} - {/*返回*/} - {/*
    */} - -
    - -
    学生列表( +
    + +
    +
    {Modallist}
    +
    + +
    +
    + {/*
    */} + {/*学生列表*/} + {/*返回*/} + {/*
    */} + +
    + +
    学生列表( {total_student} - ) -
    提供模板支持导入学生信息(请先下载模板) + ) +
    提供模板支持导入学生信息(请先下载模板) 查看详情 -
    -
    - -
    - {ismanager===false?"": - 请使用导入模板(点击下载),将本学年所有参与的学生导入系统,以便录入教学活动相关数据 - } - - {ismanager===false?"": - 导入 +
    +
    + +
    + {ismanager === false ? "" : + 请使用导入模板(点击下载),将本学年所有参与的学生导入系统,以便录入教学活动相关数据 + } + + {ismanager === false ? "" : + 导入 } - -
    + +
    -
    - {ismanager===false?"":
    - 删除 +
    + {ismanager === false ? "" :
    + 删除
    } -
    - -
    -
    -

    - - - 序号 +

    + +
    +
    +

    + + + 序号 - 姓名 - 学号 -

    - -
      - { - Myschoolstudents===undefined? -
      -

      -

      学生数据为空,请导入数据

      -
      - :Myschoolstudents&&Myschoolstudents.length===0? -
      -

      -

      学生数据为空,请导入数据

      -
      :Myschoolstudents&&Myschoolstudents.map((item,key)=>{ - // console.log(item) - return( -
    • -
      - - {item.index} -
      -
      {item.name}
      -
      {item.student_id}
      -
    • - ) - }) - } - -
    -
    -
    - +
      + { + Myschoolstudents === undefined ? +
      +

      +

      学生数据为空,请导入数据

      +
      + : Myschoolstudents && Myschoolstudents.length === 0 ? +
      +

      +

      学生数据为空,请导入数据

      +
      : Myschoolstudents && Myschoolstudents.map((item, key) => { + // console.log(item) + return ( +
    • +
      + + {item.index} +
      +
      {item.name}
      +
      {item.student_id}
      +
    • + ) + }) + } + +
    +
    +
    + -
    - { - majorschoollist&&majorschoollist.students&&majorschoollist.students.length===0?"": - - } -
    - - -
    -
    - -
    + } + +
    + { + majorschoollist && majorschoollist.students && majorschoollist.students.length === 0 ? "" : + + } +
    + + +
    +
    + +
    ) } } -export default SnackbarHOC() (EcStudentList); +export default SnackbarHOC()(EcStudentList); diff --git a/public/react/src/modules/forums/ForumsIndex.js b/public/react/src/modules/forums/ForumsIndex.js index a4f3c61bd..9f65688fc 100644 --- a/public/react/src/modules/forums/ForumsIndex.js +++ b/public/react/src/modules/forums/ForumsIndex.js @@ -1,20 +1,12 @@ import React, { Component } from 'react'; import { Redirect } from 'react-router'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; +import { Route, Switch } from "react-router-dom"; -import PropTypes from 'prop-types'; - -import Loading from '../../Loading' - -import Loadable from 'react-loadable'; import classNames from 'classnames' import MemoTechShare from './MemoTechShare' -// import MemoGuide from './MemoGuide' -// import MemoNewest from './MemoNewest' -// import MemoHottest from './MemoHottest' import MemoDetail from './MemoDetail' import MemoNew from './MemoNew' @@ -22,7 +14,7 @@ import MemoMyPublish from './MemoMyPublish' import MemoShixun from './shixun/MemoShixun' -import { TPMIndexHOC } from '../tpm/TPMIndexHOC' +import TPMIndexHOC from '../tpm/TPMIndexHOC' import RightMyPublish from './RightMyPublish' import UserSection from './UserSection' @@ -32,146 +24,142 @@ import RightMemoLabel from './RightMemoLabel' import RecommendShixun from './RecommendShixun' -import ForumsNavTab from './ForumsNavTab' - -import axios from 'axios' - import 'rc-select/assets/index.css'; import './ForumsIndex.css' import './RightSection.css' import { SnackbarHOC, getUrl } from 'educoder' -import { CNotificationHOC } from '../courses/common/CNotificationHOC' +import CNotificationHOC from '../courses/common/CNotificationHOC' let _url_origin = getUrl() const $ = window.$ -$('head').append( $('') - .attr('href', `${_url_origin}/stylesheets/css/edu-admin.css?6`) ); -$('head').append( $('') - .attr('href', `${_url_origin}/stylesheets/css/edu-forum.css?1525440977`) ); -$('head').append( $('') - .attr('href', `${_url_origin}/stylesheets/educoder/magic-check.css?1525440977`) ); - -setTimeout(()=>{ +$('head').append($('') + .attr('href', `${_url_origin}/stylesheets/css/edu-admin.css?6`)); +$('head').append($('') + .attr('href', `${_url_origin}/stylesheets/css/edu-forum.css?1525440977`)); +$('head').append($('') + .attr('href', `${_url_origin}/stylesheets/educoder/magic-check.css?1525440977`)); + +setTimeout(() => { // 附件上传滚动条 \public\stylesheets\jquery\jquery-ui-1.9.2.css - $('head').append( $('') - .attr('href', `${_url_origin}/stylesheets/jquery/jquery-ui-1.9.2.css`) ); + $('head').append($('') + .attr('href', `${_url_origin}/stylesheets/jquery/jquery-ui-1.9.2.css`)); }, 1000) class ForumsIndex extends Component { - constructor(props) { - super(props) - - this.state = { - searchValue: '', - enterKeyFlag: false, - showSearchValue: false, - selectedHotLabelIndex: -1, - } + constructor(props) { + super(props) + + this.state = { + searchValue: '', + enterKeyFlag: false, + showSearchValue: false, + selectedHotLabelIndex: -1, } + } - setSearchValue = (searchValue, enterKeyFlag) => { - if (enterKeyFlag === true) { - this.setState({ - selectedHotLabelIndex: -1 - }) - } + setSearchValue = (searchValue, enterKeyFlag) => { + if (enterKeyFlag === true) { this.setState({ - searchValue, - showSearchValue: (enterKeyFlag && searchValue) ? true : false, - enterKeyFlag: enterKeyFlag === true ? !this.state.enterKeyFlag : this.state.enterKeyFlag + selectedHotLabelIndex: -1 }) } - - setHotLabelIndex = (index, callback) => { - const newState = { - selectedHotLabelIndex: index, - } - if (index != -1) { - newState.searchValue = '' - newState.showSearchValue = false - } - this.setState({ - ...newState - }, callback) + this.setState({ + searchValue, + showSearchValue: (enterKeyFlag && searchValue) ? true : false, + enterKeyFlag: enterKeyFlag === true ? !this.state.enterKeyFlag : this.state.enterKeyFlag + }) + } + + setHotLabelIndex = (index, callback) => { + const newState = { + selectedHotLabelIndex: index, } - - initForumState(data) { - this.setState({...data}) + if (index != -1) { + newState.searchValue = '' + newState.showSearchValue = false } + this.setState({ + ...newState + }, callback) + } + initForumState(data) { + this.setState({ ...data }) + } - componentDidMount() { - window.document.title = '交流问答' - - } + componentDidMount() { + window.document.title = '交流问答' + } - componentWillReceiveProps(newProps, newContext) { - } - - - render() { - const { match, history, resLoading } = this.props - const { memo } = this.state; + componentWillReceiveProps(newProps, newContext) { + + } + + - const techSharePath = `${match.path}/categories/:memoType` - const guidePath = `${match.path}/categories/:memoType` - const hottestPath = `${match.path}/categories/:memoType` // ?order=hottest - const newestPath = `${match.path}/categories/:memoType` // ?order=newest + render() { + const { match, history, resLoading } = this.props + const { memo } = this.state; - const shixunDiscussPath = `/forums/categories/shixun_discuss` - const locationPath = history.location.pathname + const techSharePath = `${match.path}/categories/:memoType` + const guidePath = `${match.path}/categories/:memoType` + const hottestPath = `${match.path}/categories/:memoType` // ?order=hottest + const newestPath = `${match.path}/categories/:memoType` // ?order=newest + const shixunDiscussPath = `/forums/categories/shixun_discuss` + const locationPath = history.location.pathname - const isWidth100 = (locationPath.indexOf('forums/new') !== -1 - || locationPath.indexOf('/edit') !== -1) ? true : false - const pathArray = locationPath.split('/'); - const isMemoDetail = (!isWidth100 && - pathArray.length === 3 && !isNaN(parseInt(pathArray[2])) ) ? true : false + const isWidth100 = (locationPath.indexOf('forums/new') !== -1 + || locationPath.indexOf('/edit') !== -1) ? true : false - const isGuide = locationPath.indexOf('/forums/categories/3') !== -1 + const pathArray = locationPath.split('/'); + const isMemoDetail = (!isWidth100 && + pathArray.length === 3 && !isNaN(parseInt(pathArray[2]))) ? true : false - return ( -
    -
    - {/* 左边栏 component={TechShare} + const isGuide = locationPath.indexOf('/forums/categories/3') !== -1 + + return ( +
    +
    + {/* 左边栏 component={TechShare} */} -
    - - - - (this.initForumState(data)} - setSearchValue={this.setSearchValue} - setHotLabelIndex={this.setHotLabelIndex} - />) - }> - (this.initForumState(data)} - setSearchValue={this.setSearchValue} - setHotLabelIndex={this.setHotLabelIndex} - />) - }> - (this.initForumState(data)} - setSearchValue={this.setSearchValue} - setHotLabelIndex={this.setHotLabelIndex} - />) - }> - - - {/* +
    + + + + ( this.initForumState(data)} + setSearchValue={this.setSearchValue} + setHotLabelIndex={this.setHotLabelIndex} + />) + }> + ( this.initForumState(data)} + setSearchValue={this.setSearchValue} + setHotLabelIndex={this.setHotLabelIndex} + />) + }> + ( this.initForumState(data)} + setSearchValue={this.setSearchValue} + setHotLabelIndex={this.setHotLabelIndex} + />) + }> + + + {/* (this.initForumState(data)} />) @@ -185,71 +173,71 @@ class ForumsIndex extends Component { initForumState={(data)=>this.initForumState(data)} />) }> */} - {/* :forumTypeId/ */} - (this.initForumState(data)} - />) - }> + {/* :forumTypeId/ */} + ( this.initForumState(data)} + />) + }> - (this.initForumState(data)} - />) - }> + ( this.initForumState(data)} + />) + }> - - (this.initForumState(data)} - />) - }> - + ( this.initForumState(data)} + />) + }> - - - - -
    - - {/* 右边栏 */} - { !isWidth100 &&
    -
    - {isMemoDetail ? - - this.initForumState(data)} > - {/*todo 新增RightMemoLabel 和 推荐实训RecommendShixun */} - { memo && memo.tag && } - - - : - - - { !isGuide && } - - - - } - - - - -
    -
    - } + + +
    + +
    + + + {/* 右边栏 */} + {!isWidth100 &&
    +
    + {isMemoDetail ? + + this.initForumState(data)} > + {/*todo 新增RightMemoLabel 和 推荐实训RecommendShixun */} + {memo && memo.tag && } + + + : + + + {!isGuide && } + + + + } + + + + +
    + } +
    - ); - } +
    + ); + } } -export default CNotificationHOC() (SnackbarHOC() ( TPMIndexHOC ( ForumsIndex ) )); +export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(ForumsIndex))); /* : diff --git a/public/react/src/modules/forums/MemoDetail.js b/public/react/src/modules/forums/MemoDetail.js index cc264b324..d4974005d 100644 --- a/public/react/src/modules/forums/MemoDetail.js +++ b/public/react/src/modules/forums/MemoDetail.js @@ -1,11 +1,7 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; +import { Link } from "react-router-dom"; -import PropTypes from 'prop-types'; - -import classNames from 'classnames' import axios from 'axios' @@ -17,17 +13,16 @@ import update from 'immutability-helper' // import Tooltip from '@material-ui/core/Tooltip'; import RewardDialog from '../common/RewardDialog'; -import { ImageLayerOfCommentHOC } from '../page/layers/ImageLayerOfCommentHOC' +import ImageLayerOfCommentHOC from '../page/layers/ImageLayerOfCommentHOC' import MemoDetailKEEditor from './MemoDetailKEEditor' import MemoDetailMDEditor from './MemoDetailMDEditor' -import { bytesToSize, CBreadcrumb, htmlEncode } from 'educoder' +import { CBreadcrumb, htmlEncode } from 'educoder' import { Tooltip } from 'antd' // import CBreadcrumb from '../courses/common/CBreadcrumb' import { typeNameMap2 } from './MemoNew' -import CaseDetail from "../moop_cases/CaseDetail"; const $ = window.$ function urlStringify(params) { let noParams = true; diff --git a/public/react/src/modules/forums/MemoList.js b/public/react/src/modules/forums/MemoList.js index 96af68767..edb4bb721 100644 --- a/public/react/src/modules/forums/MemoList.js +++ b/public/react/src/modules/forums/MemoList.js @@ -1,28 +1,15 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames' import Pagination from 'rc-pagination'; -import {getImageUrl, toPath} from 'educoder'; - -import { postPaginationHOC } from './PostPaginationHOC' - -import PostItem from './PostItem' - -import ForumsNavTab from './ForumsNavTab' +import { getImageUrl } from 'educoder'; -import { queryString, ThemeContext } from 'educoder' +import { ThemeContext } from 'educoder' class MemoList extends Component { render() { - const { match, history, currentPage, memo_count ,memo_list, renderMemoList, onPaginationChange } = this.props + const { match, history, currentPage, memo_count, memo_list, renderMemoList, onPaginationChange } = this.props let theme = this.context; return ( @@ -36,7 +23,7 @@ class MemoList extends Component {
    {!memo_list || memo_list.length === 0 ?
    - +

    暂时还没有相关数据哦!

    : renderMemoList() @@ -44,12 +31,12 @@ class MemoList extends Component {
    - { !!memo_count && memo_count > 15 && -
    - onPaginationChange(pageNum, pageSize)} - showQuickJumper current={currentPage} total={memo_count} pageSize={15}/> -
    } + {!!memo_count && memo_count > 15 && +
    + onPaginationChange(pageNum, pageSize)} + showQuickJumper current={currentPage} total={memo_count} pageSize={15} /> +
    } ); @@ -57,4 +44,4 @@ class MemoList extends Component { } MemoList.contextType = ThemeContext; -export default ( MemoList ); +export default (MemoList); diff --git a/public/react/src/modules/forums/MemoMyPublish.js b/public/react/src/modules/forums/MemoMyPublish.js index d1adca32a..355e4ca1c 100644 --- a/public/react/src/modules/forums/MemoMyPublish.js +++ b/public/react/src/modules/forums/MemoMyPublish.js @@ -1,73 +1,62 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; +import { Link } from "react-router-dom"; -import PropTypes from 'prop-types'; -import classNames from 'classnames' +import postPaginationHOC from './PostPaginationHOC' -import Pagination from 'rc-pagination'; -import { postPaginationHOC } from './PostPaginationHOC' - -import PostItem from './PostItem' - -import ForumsNavTab from './ForumsNavTab' - -// import queryString from 'query-string' -import { queryString } from 'educoder' import MemoList from './MemoList' class MemoMyPublish extends Component { - constructor(props) { - super(props) - - this.state = { - - } - } + constructor(props) { + super(props) + + this.state = { - onPaginationChange(pageNum, pageSize) { - this.props.onPaginationChange(pageNum, pageSize) } + } - componentDidMount() { + onPaginationChange(pageNum, pageSize) { + this.props.onPaginationChange(pageNum, pageSize) + } - } + componentDidMount() { - componentWillUnmount() { + } - } - componentWillReceiveProps(newProps, newContext) { + componentWillUnmount() { - } - renderMemoList() { + } + componentWillReceiveProps(newProps, newContext) { + } + renderMemoList() { - return this.props.renderMemoList(); - } - - render() { - const { match, history, currentPage, memo_count, memo_list } = this.props - return ( - + return this.props.renderMemoList(); + } + + render() { + const { match, history, currentPage, memo_count, memo_list } = this.props + + return ( +
    -

    - 我的发布 +

    + 我的发布 返回 -

    -
    +

    +
    this.renderMemoList()} - onPaginationChange={ (pageNum, pageSize) => this.props.onPaginationChange(pageNum, pageSize) } + onPaginationChange={(pageNum, pageSize) => this.props.onPaginationChange(pageNum, pageSize)} > - + - ); - } + ); + } } -export default postPaginationHOC({ isMyPublish: true }) ( MemoMyPublish ); +export default postPaginationHOC({ isMyPublish: true })(MemoMyPublish); diff --git a/public/react/src/modules/forums/MemoOldGuide.js b/public/react/src/modules/forums/MemoOldGuide.js index 85813e5cd..4788cdb2f 100644 --- a/public/react/src/modules/forums/MemoOldGuide.js +++ b/public/react/src/modules/forums/MemoOldGuide.js @@ -1,65 +1,56 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames' import Pagination from 'rc-pagination'; -import { postPaginationHOC } from './PostPaginationHOC' - -import PostItem from './PostItem' +import postPaginationHOC from './PostPaginationHOC' import ForumsNavTab from './ForumsNavTab' class MemoGuide extends Component { - constructor(props) { - super(props) - - this.state = { - - } - } - - onPaginationChange(pageNum, pageSize) { - - this.props.onPaginationChange(pageNum, pageSize) - } + constructor(props) { + super(props) + this.state = { - renderMemoList() { - // const { memo_list, user } = this.props; - // if (!memo_list) { - // return '' - // } - // return memo_list.map( (item, index) => { - // return ( - // - // ) - // }) - return this.props.renderMemoList(); } - render() { - const { match, history, currentPage, memo_count } = this.props - - return ( - + } + + onPaginationChange(pageNum, pageSize) { + + this.props.onPaginationChange(pageNum, pageSize) + } + + + renderMemoList() { + // const { memo_list, user } = this.props; + // if (!memo_list) { + // return '' + // } + // return memo_list.map( (item, index) => { + // return ( + // + // ) + // }) + return this.props.renderMemoList(); + } + render() { + const { match, history, currentPage, memo_count } = this.props + + return ( + -
    - +
    + {this.renderMemoList()} - { !!memo_count && this.onPaginationChange(pageNum, pageSize)} - showQuickJumper current={currentPage} total={memo_count} pageSize={15}/> } + {!!memo_count && this.onPaginationChange(pageNum, pageSize)} + showQuickJumper current={currentPage} total={memo_count} pageSize={15} />}
    - + - ); - } + ); + } } -export default postPaginationHOC( MemoGuide ); +export default postPaginationHOC(MemoGuide); diff --git a/public/react/src/modules/forums/MemoOldHottest.js b/public/react/src/modules/forums/MemoOldHottest.js index 9a1190c07..1ba08ae75 100644 --- a/public/react/src/modules/forums/MemoOldHottest.js +++ b/public/react/src/modules/forums/MemoOldHottest.js @@ -1,84 +1,74 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames' import Pagination from 'rc-pagination'; -import { postPaginationHOC } from './PostPaginationHOC' - -import PostItem from './PostItem' - +import postPaginationHOC from './PostPaginationHOC' import ForumsNavTab from './ForumsNavTab' class MemoHottest extends Component { - constructor(props) { - super(props) - - this.handleLocationChange = this.handleLocationChange.bind(this); - - this.state = { - - } - } + constructor(props) { + super(props) - onPaginationChange(pageNum, pageSize) { - - this.props.onPaginationChange(pageNum, pageSize) - } + this.handleLocationChange = this.handleLocationChange.bind(this); - componentDidMount() { - // this.handleLocationChange(this.props.history.location); - this.unlisten = this.props.history.listen(this.handleLocationChange); - } + this.state = { - componentWillUnmount() { - this.unlisten(); } + } - handleLocationChange(location) { - // your staff here - console.log(`- - - location: '${location.pathname}'`); - if (location.pathname && location.pathname.indexOf('/forums/categories/all') != -1 - && this.locationSearch != location.search) { - this.props.fetchMemos(); - } - this.locationSearch = location.search; - } + onPaginationChange(pageNum, pageSize) { + + this.props.onPaginationChange(pageNum, pageSize) + } + + componentDidMount() { + // this.handleLocationChange(this.props.history.location); + this.unlisten = this.props.history.listen(this.handleLocationChange); + } + + componentWillUnmount() { + this.unlisten(); + } - renderMemoList() { - // const { memo_list, user } = this.props; - // if (!memo_list) { - // return '' - // } - // return memo_list.map( (item, index) => { - // return ( - // - // ) - // }) - return this.props.renderMemoList(); + handleLocationChange(location) { + // your staff here + console.log(`- - - location: '${location.pathname}'`); + if (location.pathname && location.pathname.indexOf('/forums/categories/all') != -1 + && this.locationSearch != location.search) { + this.props.fetchMemos(); } - render() { - const { match, history, currentPage, memo_count } = this.props - - return ( - - -
    - - {this.renderMemoList()} - - { !!memo_count && this.onPaginationChange(pageNum, pageSize)} - showQuickJumper current={currentPage} total={memo_count} pageSize={15}/> } -
    -
    - ); - } + this.locationSearch = location.search; + } + + renderMemoList() { + // const { memo_list, user } = this.props; + // if (!memo_list) { + // return '' + // } + // return memo_list.map( (item, index) => { + // return ( + // + // ) + // }) + return this.props.renderMemoList(); + } + render() { + const { match, history, currentPage, memo_count } = this.props + + return ( + + +
    + + {this.renderMemoList()} + + {!!memo_count && this.onPaginationChange(pageNum, pageSize)} + showQuickJumper current={currentPage} total={memo_count} pageSize={15} />} +
    +
    + ); + } } -export default postPaginationHOC( MemoHottest ); +export default postPaginationHOC(MemoHottest); diff --git a/public/react/src/modules/forums/MemoOldNewest.js b/public/react/src/modules/forums/MemoOldNewest.js index 618262dac..60b1b5736 100644 --- a/public/react/src/modules/forums/MemoOldNewest.js +++ b/public/react/src/modules/forums/MemoOldNewest.js @@ -1,63 +1,53 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames' import Pagination from 'rc-pagination'; -import { postPaginationHOC } from './PostPaginationHOC' - -import PostItem from './PostItem' - +import postPaginationHOC from './PostPaginationHOC' import ForumsNavTab from './ForumsNavTab' class MemoNewest extends Component { - constructor(props) { - super(props) - - this.state = { - - } - } - - onPaginationChange(pageNum, pageSize) { - - this.props.onPaginationChange(pageNum, pageSize) - } + constructor(props) { + super(props) + this.state = { - renderMemoList() { - // const { memo_list, user } = this.props; - // if (!memo_list) { - // return '' - // } - // return memo_list.map( (item, index) => { - // return ( - // - // ) - // }) - return this.props.renderMemoList(); } - render() { - const { match, history, currentPage, memo_count } = this.props - - return ( - - -
    - {this.renderMemoList()} - - { !!memo_count && this.onPaginationChange(pageNum, pageSize)} - showQuickJumper current={currentPage} total={memo_count} pageSize={15}/> } -
    -
    - ); - } + } + + onPaginationChange(pageNum, pageSize) { + + this.props.onPaginationChange(pageNum, pageSize) + } + + + renderMemoList() { + // const { memo_list, user } = this.props; + // if (!memo_list) { + // return '' + // } + // return memo_list.map( (item, index) => { + // return ( + // + // ) + // }) + return this.props.renderMemoList(); + } + render() { + const { match, history, currentPage, memo_count } = this.props + + return ( + + +
    + {this.renderMemoList()} + + {!!memo_count && this.onPaginationChange(pageNum, pageSize)} + showQuickJumper current={currentPage} total={memo_count} pageSize={15} />} +
    +
    + ); + } } -export default postPaginationHOC( MemoNewest ); +export default postPaginationHOC(MemoNewest); diff --git a/public/react/src/modules/forums/MemoTechShare.js b/public/react/src/modules/forums/MemoTechShare.js index d32bd2e2f..61100ce60 100644 --- a/public/react/src/modules/forums/MemoTechShare.js +++ b/public/react/src/modules/forums/MemoTechShare.js @@ -1,116 +1,104 @@ import React, { Component } from 'react'; -import { Redirect } from 'react-router'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames' - -import Pagination from 'rc-pagination'; - -import { postPaginationHOC } from './PostPaginationHOC' - -import PostItem from './PostItem' +import postPaginationHOC from './PostPaginationHOC' import ForumsNavTab from './ForumsNavTab' -// import queryString from 'query-string' -import { queryString } from 'educoder' +import { queryString } from 'educoder' import MemoList from './MemoList' class MemoTechShare extends Component { - constructor(props) { - super(props) + constructor(props) { + super(props) - this.handleLocationChange = this.handleLocationChange.bind(this); - - this.state = { - - } - } + this.handleLocationChange = this.handleLocationChange.bind(this); - onPaginationChange(pageNum, pageSize) { - this.props.onPaginationChange(pageNum, pageSize) - } + this.state = { - componentDidMount() { - // this.handleLocationChange(this.props.history.location); - // this.unlisten = this.props.history.listen(this.handleLocationChange); } - - componentWillUnmount() { - // this.unlisten(); + } + + onPaginationChange(pageNum, pageSize) { + this.props.onPaginationChange(pageNum, pageSize) + } + + componentDidMount() { + // this.handleLocationChange(this.props.history.location); + // this.unlisten = this.props.history.listen(this.handleLocationChange); + } + + componentWillUnmount() { + // this.unlisten(); + } + componentDidUpdate(prevProps) { + if (this.props.match.params.memoType !== prevProps.match.params.memoType) { + // do something + console.log(`memoType changed`) + this.props.fetchMemos(); } - componentDidUpdate(prevProps) { - if(this.props.match.params.memoType !== prevProps.match.params.memoType) { - // do something - console.log(`memoType changed`) - this.props.fetchMemos(); - } + } + + componentWillReceiveProps(newProps, newContext) { + if (newProps.match.url === this.props.match.url) { + const oldParsed = queryString.parse(this.props.location.search); + const newParsed = queryString.parse(newProps.location.search); + if (!newParsed.page && oldParsed.page || + (oldParsed.order && newParsed.order && oldParsed.order != newParsed.order)) { + this.props.fetchMemos(); + } + // console.log('componentWillReceiveProps...') } - - componentWillReceiveProps(newProps, newContext) { - if (newProps.match.url === this.props.match.url) { + } + + handleLocationChange(location) { + console.log(`- - - location: '${location.pathname}'`); + if (location.pathname) { + if (location.pathname.indexOf('/forums/categories/all') != -1 + && this.props.location.search && this.props.location.search.indexOf('order=') != -1 + && location.search.indexOf('order=') != -1) { const oldParsed = queryString.parse(this.props.location.search); - const newParsed = queryString.parse(newProps.location.search); - if (!newParsed.page && oldParsed.page || - (oldParsed.order && newParsed.order && oldParsed.order != newParsed.order)) { + const newParsed = queryString.parse(location.search); + if (oldParsed.order != newParsed.order) { // 只有在热门和最新间跳转时,才需要处理 this.props.fetchMemos(); } - // console.log('componentWillReceiveProps...') - } - } - - handleLocationChange(location) { - console.log(`- - - location: '${location.pathname}'`); - if (location.pathname) { - if (location.pathname.indexOf('/forums/categories/all') != -1 - && this.props.location.search && this.props.location.search.indexOf('order=') != -1 - && location.search.indexOf('order=') != -1) { - const oldParsed = queryString.parse(this.props.location.search); - const newParsed = queryString.parse(location.search); - if (oldParsed.order != newParsed.order) { // 只有在热门和最新间跳转时,才需要处理 - this.props.fetchMemos(); - } - } } } - - renderMemoList() { - - - // const { memo_list, user } = this.props; - // if (!memo_list) { - // return '' - // } - // return memo_list.map( (item, index) => { - - // return ( - // this.setTop(memo)} - // setDown={(memo)=>this.setDown(memo)} memo={item} - // > - // ) - // }) - return this.props.renderMemoList(); - } - - render() { - const { match, history, currentPage, memo_count ,memo_list } = this.props - - return ( - - - this.renderMemoList()} - onPaginationChange={ (pageNum, pageSize) => this.props.onPaginationChange(pageNum, pageSize) } - > - - - ); - } + } + + renderMemoList() { + + + // const { memo_list, user } = this.props; + // if (!memo_list) { + // return '' + // } + // return memo_list.map( (item, index) => { + + // return ( + // this.setTop(memo)} + // setDown={(memo)=>this.setDown(memo)} memo={item} + // > + // ) + // }) + return this.props.renderMemoList(); + } + + render() { + const { match, history, currentPage, memo_count, memo_list } = this.props + + return ( + + + this.renderMemoList()} + onPaginationChange={(pageNum, pageSize) => this.props.onPaginationChange(pageNum, pageSize)} + > + + + ); + } } -export default postPaginationHOC() ( MemoTechShare ); +export default postPaginationHOC()(MemoTechShare); diff --git a/public/react/src/modules/help/Help.js b/public/react/src/modules/help/Help.js index f148dd373..2d627dc4f 100644 --- a/public/react/src/modules/help/Help.js +++ b/public/react/src/modules/help/Help.js @@ -7,7 +7,7 @@ import { SnackbarHOC } from 'educoder'; import './Help.css'; import CustomLoadable from "../../CustomLoadable"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; const AboutUs = CustomLoadable(() => import('./AboutUs')); const ContactUs = CustomLoadable(() => import('./ContactUs')); @@ -17,7 +17,7 @@ const HelpCenter = CustomLoadable(() => import('./HelpCenter')); const Feedback = CustomLoadable(() => import('./Feedback')); class Help extends React.Component { - constructor (props) { + constructor(props) { super(props); this.state = { @@ -26,7 +26,7 @@ class Help extends React.Component { } componentDidUpdate(prevProps) { - if(prevProps.match.params.type !== this.props.match.params.type){ + if (prevProps.match.params.type !== this.props.match.params.type) { this.setState({ type: this.props.match.params.type }); } } @@ -61,8 +61,8 @@ class Help extends React.Component { - () }> - + ()}> +
    @@ -73,4 +73,4 @@ class Help extends React.Component { } } -export default SnackbarHOC() (TPMIndexHOC ( Help )); \ No newline at end of file +export default SnackbarHOC()(TPMIndexHOC(Help)); \ No newline at end of file diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 00a2c2e49..fa96cab54 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -5,7 +5,7 @@ import { Link } from "react-router-dom"; import axios from 'axios'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; import UpgradeModals from '../modals/UpgradeModals'; diff --git a/public/react/src/modules/message/js/Messagerouting.js b/public/react/src/modules/message/js/Messagerouting.js index 2667127ca..ce3287922 100644 --- a/public/react/src/modules/message/js/Messagerouting.js +++ b/public/react/src/modules/message/js/Messagerouting.js @@ -1,11 +1,9 @@ import React, { Component } from 'react'; -import {Input,Pagination,Tooltip} from 'antd'; -import {TPMIndexHOC} from "../../../modules/tpm/TPMIndexHOC"; -import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder'; +import TPMIndexHOC from "../../../modules/tpm/TPMIndexHOC"; +import { SnackbarHOC, getImageUrl } from 'educoder'; import axios from 'axios'; import "../css/messagemy.css" -import { Redirect } from 'react-router'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; +import { Route, Switch } from "react-router-dom"; import Loading from '../../../Loading' import Loadable from 'react-loadable'; @@ -25,20 +23,20 @@ const MessagChat = Loadable({ loader: () => import('./MessagChat'), loading: Loading, }) -class Messagerouting extends Component{ +class Messagerouting extends Component { constructor(props) { super(props); - this.state={ - routing:1, - unread_message_count:0, - unread_tiding_count:0, + this.state = { + routing: 1, + unread_message_count: 0, + unread_tiding_count: 0, } } - componentDidMount(){ + componentDidMount() { // console.log("Messagerouting"); // console.log(this.props); - // let courstype=this.props.location.search; + // let courstype=this.props.location.search; // // courstype=courstype.splice('/'); // // courstype=courstype[3]; // // console.log("45"); @@ -54,207 +52,207 @@ class Messagerouting extends Component{ // console.log("22222222222"); // console.log(this.props); // console.log("33333333333"); - if(prevProps.current_user !== this.props.current_user){ - this.Messageprivatemessageunreadmessage(this.props.current_user.login); - // console.log("Messagerouting59"); - // console.log(this.props.current_user); - } + if (prevProps.current_user !== this.props.current_user) { + this.Messageprivatemessageunreadmessage(this.props.current_user.login); + // console.log("Messagerouting59"); + // console.log(this.props.current_user); + } } //消息未读 - Messageprivatemessageunreadmessage=(user_id)=>{ - const url=`/users/${user_id}/unread_message_info.json` + Messageprivatemessageunreadmessage = (user_id) => { + const url = `/users/${user_id}/unread_message_info.json` axios.get(url).then((result) => { - if(result===undefined){ + if (result === undefined) { return } // console.log("消息未读1"); // console.log(result); this.setState({ - unread_message_count:result.data.unread_message_count, - unread_tiding_count:result.data.unread_tiding_count, + unread_message_count: result.data.unread_message_count, + unread_tiding_count: result.data.unread_tiding_count, }) }).catch((error) => { console.log(error) }) }; - SwitchonClick=(value,child)=>{ - this.setState({ - routing:value, - }); - this.Messageprivatemessageunreadmessage(this.props.current_user.login); - if(value===1){ - this.props.history.replace(`/messages/${this.props.current_user.login}/user_tidings`); - this.homeworkendss1(child); - } - if(value===2){ - this.props.history.replace(`/messages/${this.props.current_user.login}/private_messages`); - this.homeworkendss2(child); - } + SwitchonClick = (value, child) => { + this.setState({ + routing: value, + }); + this.Messageprivatemessageunreadmessage(this.props.current_user.login); + if (value === 1) { + this.props.history.replace(`/messages/${this.props.current_user.login}/user_tidings`); + this.homeworkendss1(child); + } + if (value === 2) { + this.props.history.replace(`/messages/${this.props.current_user.login}/private_messages`); + this.homeworkendss2(child); + } }; - Message2=(data)=>{ + Message2 = (data) => { // console.log("64"); // console.log(data); this.setState({ - unread_message_count:parseInt(data.unread_message_count), - unread_tiding_count:parseInt(data.unread_tiding_count), + unread_message_count: parseInt(data.unread_message_count), + unread_tiding_count: parseInt(data.unread_tiding_count), }) }; //跳转到链接 - Modifyur=(i,id)=>{ + Modifyur = (i, id) => { // console.log("跳转到链接1"); // console.log(i); // console.log(item); // console.log("跳转到链接2"); - if(i<3){ + if (i < 3) { this.setState({ - routing:i, + routing: i, }); - if(i===1){ + if (i === 1) { this.props.history.replace(`/messages/${this.props.current_user.login}/user_tidings`); } - if(i===2){ + if (i === 2) { this.props.history.replace(`/messages/${this.props.current_user.login}/private_messages`); } - }else { + } else { this.setState({ - routing:i, + routing: i, }); console.log("22222222222"); this.props.history.replace(`/messages/${this.props.current_user.login}/message_detail?target_ids=${id}`); } }; - myCome=(e)=>{ - window.location.href="/users/"+e.target.login; + myCome = (e) => { + window.location.href = "/users/" + e.target.login; } - myxiaoxisixintab=(i)=>{ - if(i===1){ + myxiaoxisixintab = (i) => { + if (i === 1) { this.setState({ - routing:1, + routing: 1, }); } - if(i===2){ + if (i === 2) { this.setState({ - routing:2, + routing: 2, }); } - if(i===3){ + if (i === 3) { this.setState({ - routing:3, + routing: 3, }); } }; bindRef = ref => { this.child = ref }; - homeworkendss1(child){ + homeworkendss1(child) { // console.log(child); // // console.log(this.refs.childModel); // console.log(child); try { child.getdatas(); - }catch (e) { + } catch (e) { } // } - homeworkendss2(child){ + homeworkendss2(child) { // console.log(child); // // console.log(this.refs.childModel); // console.log(child); try { child.getdatas2(); - }catch (e) { + } catch (e) { } // } render() { - let{routing,unread_message_count,unread_tiding_count} =this.state; + let { routing, unread_message_count, unread_tiding_count } = this.state; // console.log(this.props); // console.log(routing); return (
    -
    - {/*左边*/} -
    - {/*头像*/} -
    - - { - this.props.current_user!== undefined? - - :"" - } +
    + {/*左边*/} +
    + {/*头像*/} +
    + + { + this.props.current_user !== undefined ? + + : "" + } - -

    {this.props.current_user&&this.props.current_user.username}

    -

    {this.props.current_user&&this.props.current_user.user_identity}

    -
    - {/*路由跳转*/} -
      -
    • - this.SwitchonClick(1,this.child)}>消息 - {unread_tiding_count===0?"":unread_tiding_count>0?{unread_tiding_count}:""} + +

      {this.props.current_user && this.props.current_user.username}

      +

      {this.props.current_user && this.props.current_user.user_identity}

      +
    + {/*路由跳转*/} + -
    +
    - {/*右边*/} -
    -
    - {/*/!*消息自路由*!/*/} - {/*{routing===1?this.Message2()}> :""}*/} + {/*右边*/} +
    +
    + {/*/!*消息自路由*!/*/} + {/*{routing===1?this.Message2()}> :""}*/} - {/*/!*私信*!/*/} - {/*{routing===2?this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)}> :""}*/} + {/*/!*私信*!/*/} + {/*{routing===2?this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)}> :""}*/} - {/*/!*私信聊天页面*!/*/} - {/*{routing===3?this.Message2()} Modifyur={(i)=>this.Modifyur(i)}>:""}*/} + {/*/!*私信聊天页面*!/*/} + {/*{routing===3?this.Message2()} Modifyur={(i)=>this.Modifyur(i)}>:""}*/} - - {/*/!*消息自路由*! name 是 /message/info/:userid/*/} - (this.Message2()} Mtab={(i)=>this.myxiaoxisixintab(i)}>) - } - > - {/*/!*私信*! name 是letter/*/} - (this.Message2()} Modifyur={(i,item)=>this.Modifyur(i,item)} Mtab={(i)=>this.myxiaoxisixintab(i)}> ) - } - > - {/*/!*私信聊天页面*! letters/*/} - (this.Message2()} Modifyur={(i)=>this.Modifyur(i)} Mtab={(i)=>this.myxiaoxisixintab(i)}>) - } - > + + {/*/!*消息自路由*! name 是 /message/info/:userid/*/} + ( this.Message2()} Mtab={(i) => this.myxiaoxisixintab(i)}>) + } + > + {/*/!*私信*! name 是letter/*/} + ( this.Message2()} Modifyur={(i, item) => this.Modifyur(i, item)} Mtab={(i) => this.myxiaoxisixintab(i)}>) + } + > + {/*/!*私信聊天页面*! letters/*/} + ( this.Message2()} Modifyur={(i) => this.Modifyur(i)} Mtab={(i) => this.myxiaoxisixintab(i)}>) + } + > - + -
    +
    +
    -
    ) } } -export default SnackbarHOC() (TPMIndexHOC ( Messagerouting )); \ No newline at end of file +export default SnackbarHOC()(TPMIndexHOC(Messagerouting)); \ No newline at end of file diff --git a/public/react/src/modules/moop_cases/index.js b/public/react/src/modules/moop_cases/index.js index 8ac4aa33f..3aef241ad 100644 --- a/public/react/src/modules/moop_cases/index.js +++ b/public/react/src/modules/moop_cases/index.js @@ -1,97 +1,97 @@ -import React,{ Component } from "react"; +import React, { Component } from "react"; import './css/moopCases.css' import '../courses/css/Courses.css' import { SnackbarHOC } from 'educoder'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../courses/common/CNotificationHOC' +import TPMIndexHOC from '../tpm/TPMIndexHOC'; +import CNotificationHOC from '../courses/common/CNotificationHOC' -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import { Route, Switch } from 'react-router-dom'; import Loading from '../../Loading'; import Loadable from 'react-loadable'; import axios from 'axios'; const CaseList = Loadable({ - loader: () => import('./CaseList'), - loading:Loading, + loader: () => import('./CaseList'), + loading: Loading, }) const CaseDetail = Loadable({ - loader: () => import('./CaseDetail'), - loading:Loading, + loader: () => import('./CaseDetail'), + loading: Loading, }) const CaseNew = Loadable({ - loader: () => import('./CaseNew'), - loading:Loading, + loader: () => import('./CaseNew'), + loading: Loading, }) const CaseSuccess = Loadable({ - loader: () => import('./Success'), - loading:Loading, + loader: () => import('./Success'), + loading: Loading, }) -class Index extends Component{ - constructor(props){ +class Index extends Component { + constructor(props) { super(props); - this.state={ - praise_count:0, - CaseDetail:undefined, - cover:undefined, - creator:undefined, - operation:undefined, - tags:undefined, - attachments:undefined, - user_praised:true, + this.state = { + praise_count: 0, + CaseDetail: undefined, + cover: undefined, + creator: undefined, + operation: undefined, + tags: undefined, + attachments: undefined, + user_praised: true, } } - componentDidMount(){ + componentDidMount() { } // 获取案例详情 - getDetail = (caseID) =>{ - let url=`/libraries/${caseID}.json` - axios.get(url).then((result)=>{ - if(result){ + getDetail = (caseID) => { + let url = `/libraries/${caseID}.json` + axios.get(url).then((result) => { + if (result) { this.setState({ - CaseDetail:result.data, - praise_count:result.data.praise_count, - cover:result.data.cover, - creator:result.data.creator, - operation:result.data.operation, - user_praised:result.data.operation.user_praised, - tags:result.data.tags, - attachments:result.data.attachments + CaseDetail: result.data, + praise_count: result.data.praise_count, + cover: result.data.cover, + creator: result.data.creator, + operation: result.data.operation, + user_praised: result.data.operation.user_praised, + tags: result.data.tags, + attachments: result.data.attachments }) - window.document.title = result.data.title; + window.document.title = result.data.title; } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } // 点赞 - praisePoint=(caseID)=>{ - let { praise_count }=this.state; - let url =`/praise_tread/like.json`; - axios.post(url,{ - object_id:caseID, - object_type:"library" - }).then((result)=>{ - if(result){ + praisePoint = (caseID) => { + let { praise_count } = this.state; + let url = `/praise_tread/like.json`; + axios.post(url, { + object_id: caseID, + object_type: "library" + }).then((result) => { + if (result) { this.setState({ - praise_count: parseInt(praise_count)+1, - user_praised:true + praise_count: parseInt(praise_count) + 1, + user_praised: true }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); - }) + }) } - render(){ - - return( + render() { + + return (
    @@ -100,29 +100,29 @@ class Index extends Component{ (props) => () } > - + () } > - + () + (props) => () } > () + (props) => () } > () + (props) => () } > @@ -131,4 +131,4 @@ class Index extends Component{ ) } } -export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(Index) )); \ No newline at end of file +export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))); \ No newline at end of file diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index 6f723e660..4a7c43658 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -1,9 +1,9 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; import axios from 'axios'; -import {SnackbarHOC, WordsBtn,getImageUrl,markdownToHTML} from 'educoder'; -import {Row, Col,Input,Divider,Card,Button,Pagination,Breadcrumb,Icon,Spin} from 'antd'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../courses/common/CNotificationHOC'; +import { getImageUrl, markdownToHTML } from 'educoder'; +import { Row, Col, Input, Divider, Card, Button, Pagination, Breadcrumb, Icon, Spin } from 'antd'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; +import CNotificationHOC from '../courses/common/CNotificationHOC'; import Osshackathonmd from './Osshackathonmd'; import './Osshackathon.css'; import Osshackathonmodel from "./Osshackathonmodel"; @@ -13,15 +13,15 @@ class Osshackathon extends Component { constructor(props) { super(props) this.state = { - page:1, - limit:10, - search:undefined, - data:undefined, - hackathonedit:false, - Osshackathonmodeltype:false, - spinning:false, - opentitletype:true, - boxoffsetHeigh:0 + page: 1, + limit: 10, + search: undefined, + data: undefined, + hackathonedit: false, + Osshackathonmodeltype: false, + spinning: false, + opentitletype: true, + boxoffsetHeigh: 0 } } @@ -30,96 +30,98 @@ class Osshackathon extends Component { window.document.title = '竞赛报名'; } - getosshackathon=(page,limit,search)=>{ + getosshackathon = (page, limit, search) => { this.setState({ - spinning:true + spinning: true }) - let url=`/osshackathon.json`; - axios.get(url,{params:{ - page:page, - limit:limit, - search:search, - }}).then((result)=>{ - if(result.status==200){ + let url = `/osshackathon.json`; + axios.get(url, { + params: { + page: page, + limit: limit, + search: search, + } + }).then((result) => { + if (result.status == 200) { this.setState({ - data:result.data, - spinning:false + data: result.data, + spinning: false }) - }else{ + } else { this.setState({ - spinning:false + spinning: false }) } - }).catch((error)=>{ + }).catch((error) => { this.setState({ - spinning:true + spinning: true }) }) } - getosshackathonlist=()=>{ - let {page,limit,search}=this.state; + getosshackathonlist = () => { + let { page, limit, search } = this.state; this.setState({ - page:1, - search:undefined + page: 1, + search: undefined }) - this.getosshackathon(1,limit,undefined) + this.getosshackathon(1, limit, undefined) } - componentDidUpdate = (prevProps,prevState) => { - if(prevState.data!=this.state.data){ - //防止陷入无限循环 - let box=document.getElementById("Osshackathonfontlists"); - if(box){ - this.setState({ - boxoffsetHeigh:box.offsetHeight - }) - } + componentDidUpdate = (prevProps, prevState) => { + if (prevState.data != this.state.data) { + //防止陷入无限循环 + let box = document.getElementById("Osshackathonfontlists"); + if (box) { + this.setState({ + boxoffsetHeigh: box.offsetHeight + }) + } } } - PaginationTask=(pageNumber)=>{ - let {hackathonedit}=this.state; - if(hackathonedit===true){ + PaginationTask = (pageNumber) => { + let { hackathonedit } = this.state; + if (hackathonedit === true) { this.props.showNotification(`请先保存或者关闭编辑状态`); - }else { + } else { this.setState({ page: pageNumber }) - let {page, limit, search} = this.state; + let { page, limit, search } = this.state; this.getosshackathon(pageNumber, limit, search) } } - hackathonedit=(id)=>{ + hackathonedit = (id) => { //管理员编辑title - this.setState({ - hackathonedit:true - }) + this.setState({ + hackathonedit: true + }) } - hidehackathonedit=()=>{ + hidehackathonedit = () => { this.setState({ - hackathonedit:false + hackathonedit: false }) } - Signupentry=(id)=>{ - // 用户报名 - if(this.props.checkIfLogin()===false){ + Signupentry = (id) => { + // 用户报名 + if (this.props.checkIfLogin() === false) { this.props.showLoginDialog() return } - if(this.props.checkIfProfileCompleted()===false){ + if (this.props.checkIfProfileCompleted() === false) { this.props.showProfileCompleteDialog() return } //判断是否绑定邮箱 - - if(this.props.user.email===null&&this.props.user.phone===null){ + + if (this.props.user.email === null && this.props.user.phone === null) { this.props.showhideAccountPhoneemailDialog() return } @@ -133,11 +135,11 @@ class Osshackathon extends Component { } - Signupentrys=(id)=>{ - let url=`/osshackathon/${id}/entry.json`; + Signupentrys = (id) => { + let url = `/osshackathon/${id}/entry.json`; axios.post(url ).then((response) => { - if(response.data.status===0){ + if (response.data.status === 0) { this.getosshackathonlist() this.props.showNotification(`报名成功,预祝您夺得桂冠`); } @@ -146,46 +148,46 @@ class Osshackathon extends Component { }) } - editSignupentry=(id,name,description)=>{ - let {hackathonedit}=this.state; - if(hackathonedit===true){ + editSignupentry = (id, name, description) => { + let { hackathonedit } = this.state; + if (hackathonedit === true) { this.props.showNotification(`请先保存或者关闭编辑状态`); - }else{ + } else { // 管理员编辑项目 this.setState({ - Osshackathonmodeltype:true + Osshackathonmodeltype: true }) - if(id===undefined){ + if (id === undefined) { this.setState({ - modelid:undefined, - modelname:undefined, - modeldescription:undefined + modelid: undefined, + modelname: undefined, + modeldescription: undefined }) - }else{ + } else { this.setState({ - modelid:id, - modelname:name, - modeldescription:description + modelid: id, + modelname: name, + modeldescription: description }) } } } - hideeditSignupentry=(id)=>{ + hideeditSignupentry = (id) => { // 管理员取消项目 this.setState({ - Osshackathonmodeltype:false + Osshackathonmodeltype: false }) } - delSignupentry=(id)=>{ + delSignupentry = (id) => { // 管理员删除项目 - let {hackathonedit}=this.state; - if(hackathonedit===true){ + let { hackathonedit } = this.state; + if (hackathonedit === true) { this.props.showNotification(`请先保存或者关闭编辑状态`); - }else { + } else { this.props.confirm({ content: `是否确认删除该项目?`, onOk: () => { @@ -194,8 +196,8 @@ class Osshackathon extends Component { }) } } - delSignupentrys=(id)=>{ - let url=`/osshackathon/${id}.json`; + delSignupentrys = (id) => { + let url = `/osshackathon/${id}.json`; axios.delete(url) .then((response) => { if (response.data.status == 0) { @@ -211,37 +213,37 @@ class Osshackathon extends Component { } - onsearchvalue=(value)=>{ - let {hackathonedit}=this.state; - if(hackathonedit===true){ + onsearchvalue = (value) => { + let { hackathonedit } = this.state; + if (hackathonedit === true) { this.props.showNotification(`请先保存或者关闭编辑状态`); - }else { + } else { this.setState({ - search:value + search: value }) - if(value.length>300){ + if (value.length > 300) { this.props.showNotification(`搜索字数大于300个字`); } - let {page,limit,search}=this.state; - this.getosshackathon(page,limit,value) + let { page, limit, search } = this.state; + this.getosshackathon(page, limit, value) } } - onsetsearchvalue=(e)=>{ + onsetsearchvalue = (e) => { this.setState({ - search:e.target.value + search: e.target.value }) } - opentitle=()=>{ + opentitle = () => { this.setState({ - opentitletype:false + opentitletype: false }) } render() { - let {page,data,hackathonedit,opentitletype}=this.state; + let { page, data, hackathonedit, opentitletype } = this.state; return (
    @@ -261,117 +263,117 @@ class Osshackathon extends Component { } -
    +
    - {this.props.user&&this.props.user.admin===true? - - - this.onsetsearchvalue(e)} - onSearch={value => this.onsearchvalue(value)} - /> - - - + {this.props.user && this.props.user.admin === true ? + + + this.onsetsearchvalue(e)} + onSearch={value => this.onsearchvalue(value)} + /> + + +
    - 报名总数:{data&&data.hackathon.hackathon_users_count} 个 + 报名总数:{data && data.hackathon.hackathon_users_count}
    - - -
    :""} - - {hackathonedit===true?"": - - {data&&data.hackathon.name} - - {this.props.user&&this.props.user.admin===true? - - :""} - } - {hackathonedit===true?"": } + } + } - {hackathonedit===true?"":} + {hackathonedit === true ? "" : } - {opentitletype===true?:""} - {hackathonedit===true?"":

    - {data&&data.hackathon.description===null?"":

    } -

    } - - {opentitletype===true&&this.state.boxoffsetHeigh===180?this.opentitle()} className={"pointer Breadcrumbfont"}>展开阅读全文:""} - - {hackathonedit===true?this.getosshackathonlist()} - hidehackathonedit={()=>this.hidehackathonedit()} - {...this.props} - {...this.state} - />:""} - {this.state.Osshackathonmodeltype===true?this.getosshackathonlist()} - hideeditSignupentry={()=>this.hideeditSignupentry()} - {...this.props} - {...this.state} - />:""} - {this.props.user&&this.props.user.admin===true? - - - - :""} - {/*学生身份*/} - { - this.props.user&&this.props.user.admin===false?data&&data.hacks.length==0?"":data&&data.hacks.map((item,key)=>{ - return( - - - - {item.name} - - - - 报名人数:{item.hack_users_count} - {item.entry_info===true?:} - - -

    {item.description}

    -
    - ) - }):"" - } + : ""} + {hackathonedit === true ? "" :

    + {data && data.hackathon.description === null ? "" :

    } +

    } + + {opentitletype === true && this.state.boxoffsetHeigh === 180 ? this.opentitle()} className={"pointer Breadcrumbfont"}>展开阅读全文 : ""} + + {hackathonedit === true ? this.getosshackathonlist()} + hidehackathonedit={() => this.hidehackathonedit()} + {...this.props} + {...this.state} + /> : ""} + {this.state.Osshackathonmodeltype === true ? this.getosshackathonlist()} + hideeditSignupentry={() => this.hideeditSignupentry()} + {...this.props} + {...this.state} + /> : ""} + {this.props.user && this.props.user.admin === true ? + + + + : ""} + {/*学生身份*/} + { + this.props.user && this.props.user.admin === false ? data && data.hacks.length == 0 ? "" : data && data.hacks.map((item, key) => { + return ( + + + + {item.name} + + + + 报名人数:{item.hack_users_count} + {item.entry_info === true ? : } + + +

    {item.description}

    +
    + ) + }) : "" + } - {/*教师身份*/} - {this.props.user&&this.props.user.admin===true? : ""} + { + this.props.user && this.props.user.admin === true ? data && data.hacks.length == 0 ? "" : data && data.hacks.map((item, key) => { + return ( + + + + {item.name} + + + + this.editSignupentry(item.id, item.name, item.description)}>编辑 + this.delSignupentry(item.id)}>删除 + + + + + + +
    + + +
    {item.hack_users_count}
    + +
    + + + +
    报名数
    + +
    +
    + + + {item.description} + +
    + + +
    + ) + }) : "" } - :""} - { - this.props.user&&this.props.user.admin===true?data&&data.hacks.length==0?"":data&&data.hacks.map((item,key)=>{ - return( - - - - {item.name} - - - - this.editSignupentry(item.id,item.name,item.description)}>编辑 - this.delSignupentry(item.id)}>删除 - - - - - - -
    - - -
    {item.hack_users_count}
    - -
    - - - -
    报名数
    - -
    -
    - - - {item.description} - -
    - - -
    - )}):"" - } - {data&&data.hacks_count>10?data&&data.hacks.length===0?"":
    - -
    :""} + {data && data.hacks_count > 10 ? data && data.hacks.length === 0 ? "" :
    + +
    : ""}
    @@ -448,4 +451,4 @@ class Osshackathon extends Component { -export default CNotificationHOC() (TPMIndexHOC (Osshackathon)) ; \ No newline at end of file +export default CNotificationHOC()(TPMIndexHOC(Osshackathon)); \ No newline at end of file diff --git a/public/react/src/modules/page/main/LeftViewContainer.js b/public/react/src/modules/page/main/LeftViewContainer.js index a2032414c..ea84e1a6e 100644 --- a/public/react/src/modules/page/main/LeftViewContainer.js +++ b/public/react/src/modules/page/main/LeftViewContainer.js @@ -5,7 +5,7 @@ import LeftView from './LeftView' import axios from 'axios' -import { commentHOC } from '../../comment/CommentsHOC' +import commentHOC from '../../comment/CommentsHOC' import ImageLayer from '../layers/ImageLayer' diff --git a/public/react/src/modules/paths/Index.js b/public/react/src/modules/paths/Index.js index 67ef9125b..f4d7782bd 100644 --- a/public/react/src/modules/paths/Index.js +++ b/public/react/src/modules/paths/Index.js @@ -3,19 +3,18 @@ import React, { Component } from 'react'; import { SnackbarHOC, CNotificationHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import { Route, Switch } from 'react-router-dom'; import Loadable from 'react-loadable'; import Loading from '../../Loading'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; -import NewFooter from "../tpm/NewFooter"; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; const PathsDetail = Loadable({ loader: () => import('./PathDetail/PathDetailIndex'), - loading:Loading, + loading: Loading, }) const PathsNew = Loadable({ loader: () => import('./PathNew'), - loading:Loading, + loading: Loading, }) // const Statistics = Loadable({ // loader: () => import('./SchoolStatistics/Statistics'), @@ -28,10 +27,10 @@ const Statistics = Loadable({ const ShixunPaths = Loadable({ loader: () => import('./ShixunPaths'), - loading:Loading, + loading: Loading, }) -class Index extends Component{ +class Index extends Component { constructor(props) { super(props) } @@ -39,26 +38,26 @@ class Index extends Component{ return (
    - + ()} + render={(props) => ()} > ()} + render={(props) => ()} + > + {/*编辑页面*/} + ()} > - {/*编辑页面*/} - ()} - > {/**/} - ()} - > + ()} + >
    ) } } -export default CNotificationHOC() (SnackbarHOC() ( TPMIndexHOC(Index) )); \ No newline at end of file +export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))); \ No newline at end of file diff --git a/public/react/src/modules/projectPackages/ProjectPackageIndex.js b/public/react/src/modules/projectPackages/ProjectPackageIndex.js index 097e012e0..bcd5ce89e 100644 --- a/public/react/src/modules/projectPackages/ProjectPackageIndex.js +++ b/public/react/src/modules/projectPackages/ProjectPackageIndex.js @@ -7,7 +7,7 @@ import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import Loading from '../../Loading' import Loadable from 'react-loadable'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC' +import TPMIndexHOC from '../tpm/TPMIndexHOC' import { SnackbarHOC } from 'educoder' @@ -31,7 +31,7 @@ class ProjectPackageIndex extends Component { super(props) } - componentDidMount(){ + componentDidMount() { window.document.title = '众包创新' } @@ -44,27 +44,27 @@ class ProjectPackageIndex extends Component { {/*众包首页*/} () - } + render={ + (props) => () + } > () - } + render={ + (props) => () + } > () - } + render={ + (props) => () + } > () - } + render={ + (props) => () + } > @@ -73,4 +73,4 @@ class ProjectPackageIndex extends Component { } } -export default SnackbarHOC() (TPMIndexHOC (ProjectPackageIndex)) ; \ No newline at end of file +export default SnackbarHOC()(TPMIndexHOC(ProjectPackageIndex)); \ No newline at end of file diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index 232ba9d72..169a0d5d7 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -1,23 +1,12 @@ -import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import React, { Component } from "react"; import axios from 'axios'; import { - notification, - Spin, - Table, Pagination, - Drawer, - Input, - Tooltip } from "antd"; -import {parabola} from './animation/parabola' import Headplugselections from "./component/Headplugselections"; import QuestionModal from "./component/QuestionModal"; import QuestionModals from "./component/QuestionModals"; import Contentpart from "./component/Contentpart"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; -import NoneData from './component/NoneData'; import './questioncss/questioncom.css'; import Bottomsubmit from "../modals/Bottomsubmit"; @@ -27,16 +16,16 @@ class NewMyShixunModel extends Component { super(props); this.state = { count: 50, - defaultActiveKey:"1", + defaultActiveKey: "1", Headertop: "", Footerdown: "", visible: false, placement: 'right', modalsType: false, - modalsTypes:false, + modalsTypes: false, titilesm: "在平台审核后,所有成员均可使用试题", titiless: "是否设置为公开?", - titilesms:"单选题", + titilesms: "单选题", titbool: false, Contentdata: [], difficulty: null, @@ -54,109 +43,109 @@ class NewMyShixunModel extends Component { program_questions_count: 0, single_questions_count: 0, subjective_questions_count: 0, - page:1, - per_page:10, - disciplinesdata:[], - discipline_id:null, - sub_discipline_id:null, - tag_discipline_id:null, - booljupyterurls:false, - disciplinesdatakc:0, - disciplinesdatazsd:0, - selectallquestionsonthispages:false, - oj_status:null, + page: 1, + per_page: 10, + disciplinesdata: [], + discipline_id: null, + sub_discipline_id: null, + tag_discipline_id: null, + booljupyterurls: false, + disciplinesdatakc: 0, + disciplinesdatazsd: 0, + selectallquestionsonthispages: false, + oj_status: null, isVisible: false, - selectionbools:false, + selectionbools: false, } } - setdiscipline_id=(discipline_id)=>{ + setdiscipline_id = (discipline_id) => { this.setState({ - discipline_id:discipline_id, - sub_discipline_id:null, - tag_discipline_id:null, - keywords:"", - page:1, - per_page:10, - oj_status:null + discipline_id: discipline_id, + sub_discipline_id: null, + tag_discipline_id: null, + keywords: "", + page: 1, + per_page: 10, + oj_status: null }) var data = { - discipline_id:discipline_id, - sub_discipline_id:null, - tag_discipline_id:null, + discipline_id: discipline_id, + sub_discipline_id: null, + tag_discipline_id: null, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: null, page: this.state.page, - per_page:10, - oj_status:null, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + oj_status: null, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); } - setsub_discipline_id=(discipline_id,sub_discipline_id)=>{ + setsub_discipline_id = (discipline_id, sub_discipline_id) => { this.setState({ - sub_discipline_id:sub_discipline_id, - tag_discipline_id:null, - keywords:"", - page:1, - per_page:10, - oj_status:null + sub_discipline_id: sub_discipline_id, + tag_discipline_id: null, + keywords: "", + page: 1, + per_page: 10, + oj_status: null }) var data = { - discipline_id:discipline_id, - sub_discipline_id:sub_discipline_id, - tag_discipline_id:null, + discipline_id: discipline_id, + sub_discipline_id: sub_discipline_id, + tag_discipline_id: null, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, - keywords:null, + keywords: null, page: 1, - per_page:10, - oj_status:null, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + oj_status: null, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); } - settag_discipline_id=(tag_discipline_id)=>{ + settag_discipline_id = (tag_discipline_id) => { this.setState({ - tag_discipline_id:tag_discipline_id, - keywords:"", - page:1, - per_page:10, - oj_status:null + tag_discipline_id: tag_discipline_id, + keywords: "", + page: 1, + per_page: 10, + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: null, page: 1, - per_page:10, - oj_status:null, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + oj_status: null, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); } //初始化 componentDidMount() { - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; - const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; - const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; - let {defaultActiveKey} = this.props; - var defaultActiveKeys=defaultActiveKey; - if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ - defaultActiveKeys="0" - }else{ - defaultActiveKeys="1" + const isysladmins = this.props && this.props.current_user && this.props.current_user.admin ? this.props.current_user.admin : false; + const is_teacher = this.props && this.props.current_user && this.props.current_user.is_teacher ? this.props.current_user.is_teacher : false; + const professional_certification = this.props && this.props.current_user && this.props.current_user.professional_certification ? this.props.current_user.professional_certification : false; + let { defaultActiveKey } = this.props; + var defaultActiveKeys = defaultActiveKey; + if (isysladmins === true || (is_teacher === true && professional_certification === true)) { + defaultActiveKeys = "0" + } else { + defaultActiveKeys = "1" } this.callback(defaultActiveKeys); let url = `/users/get_navigation_info.json`; @@ -177,9 +166,11 @@ class NewMyShixunModel extends Component { //获取题库筛选资料 let urls = `/disciplines.json`; - axios.get(urls, {params: { - source:"question" - }}).then((response) => { + axios.get(urls, { + params: { + source: "question" + } + }).then((response) => { //console.log("Questiondisciplines"); //console.log(response.data); if (response) { @@ -191,17 +182,17 @@ class NewMyShixunModel extends Component { } componentDidUpdate(prevProps) { - if(prevProps.current_user !== this.props.current_user) { + if (prevProps.current_user !== this.props.current_user) { debugger - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; - const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; - const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; - let {defaultActiveKey} = this.props; - var defaultActiveKeys=defaultActiveKey; - if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ - defaultActiveKeys="0" - }else{ - defaultActiveKeys="1" + const isysladmins = this.props && this.props.current_user && this.props.current_user.admin ? this.props.current_user.admin : false; + const is_teacher = this.props && this.props.current_user && this.props.current_user.is_teacher ? this.props.current_user.is_teacher : false; + const professional_certification = this.props && this.props.current_user && this.props.current_user.professional_certification ? this.props.current_user.professional_certification : false; + let { defaultActiveKey } = this.props; + var defaultActiveKeys = defaultActiveKey; + if (isysladmins === true || (is_teacher === true && professional_certification === true)) { + defaultActiveKeys = "0" + } else { + defaultActiveKeys = "1" } this.callback(defaultActiveKeys); } @@ -211,22 +202,22 @@ class NewMyShixunModel extends Component { callback = (key) => { this.setState({ defaultActiveKey: key, - selectallquestionsonthispages:false, - difficulty:null, - page:1, - oj_status:null + selectallquestionsonthispages: false, + difficulty: null, + page: 1, + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: key, item_type: this.state.item_type, difficulty: null, page: 1, - per_page:10, - oj_status:null, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + oj_status: null, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); @@ -236,15 +227,15 @@ class NewMyShixunModel extends Component { getdata = (data) => { const url = `/item_banks.json`; this.setState({ - booljupyterurls:true, - selectionbools:false, + booljupyterurls: true, + selectionbools: false, }) - axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ + axios.get((url), { params: data }).then((response) => { + setTimeout(() => { this.setState({ - booljupyterurls:false, + booljupyterurls: false, }) - },1000); + }, 1000); if (response === null || response === undefined) { return @@ -264,7 +255,7 @@ class NewMyShixunModel extends Component { }).catch((error) => { //////console.log(error) this.setState({ - booljupyterurls:false, + booljupyterurls: false, }) }); } @@ -273,12 +264,12 @@ class NewMyShixunModel extends Component { getdatasy = (data) => { const url = `/item_banks.json`; this.setState({ - selectionbools:false, + selectionbools: false, }) - axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ + axios.get((url), { params: data }).then((response) => { + setTimeout(() => { - },1000); + }, 1000); if (response === null || response === undefined) { return @@ -303,43 +294,43 @@ class NewMyShixunModel extends Component { } //计算 - getdataslen=(arr)=>{ - var contes=0; - for(let data of arr) { - if(data.item_type==="PROGRAM"){ + getdataslen = (arr) => { + var contes = 0; + for (let data of arr) { + if (data.item_type === "PROGRAM") { //编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 - if(data.program_attr.status===1){ + if (data.program_attr.status === 1) { //已发布 - contes=contes+1; + contes = contes + 1; } } - }else{ + } else { //不是编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 - contes=contes+1; + contes = contes + 1; } } } - if(contes>0){ + if (contes > 0) { this.setState({ - selectionbools:false, - selectallquestionsonthispages:false, + selectionbools: false, + selectallquestionsonthispages: false, }) - }else { + } else { this.setState({ - selectionbools:true, - selectallquestionsonthispages:true, + selectionbools: true, + selectallquestionsonthispages: true, }) } } @@ -349,27 +340,27 @@ class NewMyShixunModel extends Component { page: pageNumber, }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: pageNumber, - per_page:10, - oj_status:this.state.oj_status, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + oj_status: this.state.oj_status, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); } showDrawer = () => { - if(this.state.visible===true){ + if (this.state.visible === true) { this.setState({ visible: false, }); - }else{ + } else { this.setState({ visible: true, }); @@ -425,19 +416,19 @@ class NewMyShixunModel extends Component { modalsType: false }) } - modalCancels=()=>{ + modalCancels = () => { this.setState({ modalsTypes: false }) } - showQuestionModals =(item_type)=>{ + showQuestionModals = (item_type) => { this.setState({ modalsTypes: true, - titilesms:item_type, + titilesms: item_type, }) } - setDownloads=(item_type)=>{ + setDownloads = (item_type) => { this.Deletebigquestiontype(item_type); this.setState({ modalsTypes: false @@ -462,23 +453,23 @@ class NewMyShixunModel extends Component { difficulty: difficulty, visiblemys: false, page: 1, - per_page:10, - keywords:"", - oj_status:null + per_page: 10, + keywords: "", + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: difficulty, item_type: this.state.item_type, - keywords:null, - page:1, - per_page:10, - oj_status:null, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + keywords: null, + page: 1, + per_page: 10, + oj_status: null, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); @@ -489,23 +480,23 @@ class NewMyShixunModel extends Component { item_type: item_type, visiblemyss: false, page: 1, - per_page:10, - keywords:"", - oj_status:null + per_page: 10, + keywords: "", + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: item_type, page: 1, - per_page:10, - keywords:null, - oj_status:null, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + keywords: null, + oj_status: null, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); @@ -550,17 +541,17 @@ class NewMyShixunModel extends Component { keywords: value, }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: value, page: this.state.page, - per_page:10, - oj_status:this.state.oj_status, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + oj_status: this.state.oj_status, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); @@ -575,16 +566,16 @@ class NewMyShixunModel extends Component { // this.props.showNotification('删除试题成功') // props.history.push(response.data.right_url) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); } @@ -601,23 +592,23 @@ class NewMyShixunModel extends Component { if (result.data.status == 0) { // this.props.showNotification(`公开题目成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } getbasket_listdata = () => { @@ -654,13 +645,13 @@ class NewMyShixunModel extends Component { //选用 - getitem_baskets=(data)=>{ + getitem_baskets = (data) => { //选用题型可以上传单个 或者多个题型 - let url=""; - if(this.props.exam_id===undefined){ - url="/item_baskets.json"; - }else{ - url="/examination_items.json"; + let url = ""; + if (this.props.exam_id === undefined) { + url = "/item_baskets.json"; + } else { + url = "/examination_items.json"; } @@ -669,16 +660,16 @@ class NewMyShixunModel extends Component { if (result.data.status == 0) { // this.props.showNotification(`选用成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdatasy(data); this.getbasket_listdata(); @@ -687,128 +678,132 @@ class NewMyShixunModel extends Component { // }) } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } // 撤销 - getitem_basketss=(id)=>{ - let url=""; - if(this.props.exam_id===undefined){ - url=`/item_baskets/${id}.json`; + getitem_basketss = (id) => { + let url = ""; + if (this.props.exam_id === undefined) { + url = `/item_baskets/${id}.json`; axios.delete(url) .then((result) => { if (result.data.status == 0) { // this.props.showNotification(`撤销成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdatasy(data); this.getbasket_listdata(); } }).catch((error) => { - ////console.log(error); + ////console.log(error); + }) + } else { + url = `/examination_banks/${this.props.exam_id}/revoke_item.json`; + axios.delete(url, { + data: { + item_id: id === undefined ? "" : parseInt(id), + } }) - }else{ - url=`/examination_banks/${this.props.exam_id}/revoke_item.json`; - axios.delete(url,{ data: { - item_id:id===undefined?"":parseInt(id), - }}) .then((result) => { if (result.data.status == 0) { // this.props.showNotification(`撤销成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdatasy(data); this.getbasket_listdata(); } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } } //全选试题库 - selectallquestionsonthispage=()=>{ - var item_idsdata=[]; + selectallquestionsonthispage = () => { + var item_idsdata = []; - var arr= this.state.Contentdata.items; - for(let data of arr) { - if(data.item_type==="PROGRAM"){ + var arr = this.state.Contentdata.items; + for (let data of arr) { + if (data.item_type === "PROGRAM") { //编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 - if(data.program_attr.status===1){ + if (data.program_attr.status === 1) { //已发布 item_idsdata.push(data.id); } } - }else{ + } else { //不是编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 item_idsdata.push(data.id); } } } - const data={ - item_ids:item_idsdata, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + const data = { + item_ids: item_idsdata, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), } this.getitem_baskets(data); this.setState({ - selectallquestionsonthispages:true, + selectallquestionsonthispages: true, }) } //全选的状态 //删除大题型 - Deletebigquestiontype =(item_type)=>{ - const url=`/item_baskets/delete_item_type.json`; - axios.delete((url), { data: { - item_type:item_type - }}) + Deletebigquestiontype = (item_type) => { + const url = `/item_baskets/delete_item_type.json`; + axios.delete((url), { + data: { + item_type: item_type + } + }) .then((response) => { if (response.data.status == 0) { // this.props.showNotification('删除成功'); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); this.getbasket_listdata(); @@ -822,31 +817,31 @@ class NewMyShixunModel extends Component { //跳转 - gotopaperreview=()=>{ + gotopaperreview = () => { this.props.history.replace("/paperreview"); } - setoj_status=(oj_status)=>{ + setoj_status = (oj_status) => { //编程题发布未发布 this.setState({ - selectallquestionsonthispages:false, - difficulty:null, - oj_status:oj_status + selectallquestionsonthispages: false, + difficulty: null, + oj_status: oj_status }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - oj_status:oj_status, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + per_page: 10, + oj_status: oj_status, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), }; this.getdata(data); } @@ -854,9 +849,9 @@ class NewMyShixunModel extends Component { render() { let { - page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list, + page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes, basket_list, completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count, - program_questions_count, single_questions_count, subjective_questions_count,selectionbools + program_questions_count, single_questions_count, subjective_questions_count, selectionbools } = this.state; const Datacount = completion_questions_count + judgement_questions_count @@ -866,11 +861,11 @@ class NewMyShixunModel extends Component { + subjective_questions_count; return ( -
    +
    { - visible===true? + visible === true ? - :"" + : "" } { - visible===true? + visible === true ?
    - :""} + : ""} { - modalsTypes===true? + modalsTypes === true ? this.modalCancels()} - setDownloads={(e) => this.setDownloads(e)}> - :"" + setDownloads={(e) => this.setDownloads(e)}> + : "" } { - modalsType===true? + modalsType === true ? this.modalCancel()} - setDownload={() => this.setDownload()}> - :"" + setDownload={() => this.setDownload()}> + : "" } {/*顶部*/} @@ -923,43 +918,43 @@ class NewMyShixunModel extends Component { {...this.state} setdifficulty={(e) => this.setdifficulty(e)} setitem_types={(e) => this.setitem_types(e)} - setdiscipline_id={(e)=>this.setdiscipline_id(e)} - setsub_discipline_id={(e)=>this.setsub_discipline_id(e)} - settag_discipline_id={(e)=>this.settag_discipline_id(e)} + setdiscipline_id={(e) => this.setdiscipline_id(e)} + setsub_discipline_id={(e) => this.setsub_discipline_id(e)} + settag_discipline_id={(e) => this.settag_discipline_id(e)} /> {/*头部*/} this.getitem_basketss(id)} - selectallquestionsonthispage={()=>this.selectallquestionsonthispage()} - getitem_baskets={(e)=>this.getitem_baskets(e)} - setdatafuns={(e) => this.setdatafuns(e)} - setdatafunsval={(e) => this.setdatafunsval(e)} - handleVisibleChanges={(e) => this.handleVisibleChanges(e)} - handleVisibleChange={(e) => this.handleVisibleChange(e)} - showmodels={(e) => this.showmodels(e)} - showmodelysl={(e) => this.showmodelysl(e)} - callback={(e) => this.callback(e)} - setoj_status={(e)=>this.setoj_status(e)}> + exam_id={this.props.exam_id} + Isitapopup={"true"} + getitem_basketss={(id) => this.getitem_basketss(id)} + selectallquestionsonthispage={() => this.selectallquestionsonthispage()} + getitem_baskets={(e) => this.getitem_baskets(e)} + setdatafuns={(e) => this.setdatafuns(e)} + setdatafunsval={(e) => this.setdatafunsval(e)} + handleVisibleChanges={(e) => this.handleVisibleChanges(e)} + handleVisibleChange={(e) => this.handleVisibleChange(e)} + showmodels={(e) => this.showmodels(e)} + showmodelysl={(e) => this.showmodelysl(e)} + callback={(e) => this.callback(e)} + setoj_status={(e) => this.setoj_status(e)}> { - items_count&&items_count>10? + items_count && items_count > 10 ?
    + pageSize={per_page} + total={items_count}>
    - :
    + :
    } this.props.setnewmyshixunmodelbool(false)} - onSubmits={() => this.props.setnewmyshixunmodelbool(false)} url={'/paperlibrary'}> + Cohetepaperbool={true} + setCohetepaperbool={() => this.props.setnewmyshixunmodelbool(false)} + onSubmits={() => this.props.setnewmyshixunmodelbool(false)} url={'/paperlibrary'}>
    ) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 2adc77c03..071b1d60e 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -1,26 +1,10 @@ -import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import React, { Component } from "react"; +import { SnackbarHOC } from 'educoder'; import axios from 'axios'; -import { - notification, - Spin, - Table, - Pagination, - Drawer, - Input, - Button, - Breadcrumb -} from "antd"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; -import Itembankstop from "./component/Itembankstop"; -import NoneData from './component/NoneData'; +import { Breadcrumb } from "antd"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; import './questioncss/questioncom.css'; import '../tpm/newshixuns/css/Newshixuns.css'; -import Choicequestion from './component/Choicequestion'; -import SingleEditor from "./component/SingleEditor"; -import ChoquesEditor from "./component/ChoquesEditor" -import JudquestionEditor from "./component/JudquestionEditor"; import Paperreview_item from "./Paperreview_item" import Bottomsubmit from "../../modules/modals/Bottomsubmit"; import Comthetestpaperst from "./comthetestpaper/Comthetestpaperst"; @@ -38,22 +22,22 @@ class Paperreview extends Component { disciplinesdata: [], knowledgepoints: [], disciplmy: [], - single_questions:null, - multiple_questions:null, - judgement_questions:null, - program_questions:null, - all_score:0, - all_questions_count:0, - Cohetepaperbool:false, - discipline_id:null, - sub_discipline_id:null, - tag_discipline_id:null, - difficulty:null, - name:null, - duration:null, - newmyshixunmodelbool:false, - artificialtype:"artificial", - Intelligentformation:false, + single_questions: null, + multiple_questions: null, + judgement_questions: null, + program_questions: null, + all_score: 0, + all_questions_count: 0, + Cohetepaperbool: false, + discipline_id: null, + sub_discipline_id: null, + tag_discipline_id: null, + difficulty: null, + name: null, + duration: null, + newmyshixunmodelbool: false, + artificialtype: "artificial", + Intelligentformation: false, } // single_questions:null, 单选题 @@ -70,10 +54,10 @@ class Paperreview extends Component { //console.log("Paperreview.js"); //console.log(this.props.match.params); this.setState({ - artificialtype:this.props.match.params.type + artificialtype: this.props.match.params.type }) - var data = {}; - this.getdata(data); + var data = {}; + this.getdata(data); let urls = `/disciplines.json`; axios.get(urls, { params: { @@ -90,7 +74,7 @@ class Paperreview extends Component { const didata = response.data.disciplines; for (var i = 0; i < didata.length; i++) { - const childern=[]; + const childern = []; //方向 const fxdidata = didata[i].sub_disciplines; @@ -112,7 +96,7 @@ class Paperreview extends Component { } } - const datakec={ + const datakec = { value: didata[i].id, label: didata[i].name, children: childern, @@ -122,7 +106,7 @@ class Paperreview extends Component { this.setState({ knowledgepoints: this.state.knowledgepoints, - disciplmy:this.state.disciplmy, + disciplmy: this.state.disciplmy, }) @@ -137,23 +121,23 @@ class Paperreview extends Component { getdata = (data) => { - if(this.props.match.params.type==="artificial"){ + if (this.props.match.params.type === "artificial") { //人工组卷 - }else{ + } else { //智能组卷 // data = { - exam_setting_id:this.props.match.params.id + exam_setting_id: this.props.match.params.id } } const url = `/item_baskets.json`; this.setState({ booljupyterurls: true, }) - axios.get((url), {params: data}).then((response) => { - if(response===undefined|| response===null){ + axios.get((url), { params: data }).then((response) => { + if (response === undefined || response === null) { return; } setTimeout(() => { @@ -173,14 +157,14 @@ class Paperreview extends Component { try { this.setState({ Contentdata: response.data, - single_questions:response.data.single_questions.questions_count===0? null:response.data.single_questions, - multiple_questions:response.data.multiple_questions.questions_count===0? null:response.data.multiple_questions, - judgement_questions:response.data.judgement_questions.questions_count===0? null:response.data.judgement_questions, - program_questions:response.data.program_questions.questions_count===0? null:response.data.program_questions, - all_score:response.data.all_score, - all_questions_count:response.data.all_questions_count, + single_questions: response.data.single_questions.questions_count === 0 ? null : response.data.single_questions, + multiple_questions: response.data.multiple_questions.questions_count === 0 ? null : response.data.multiple_questions, + judgement_questions: response.data.judgement_questions.questions_count === 0 ? null : response.data.judgement_questions, + program_questions: response.data.program_questions.questions_count === 0 ? null : response.data.program_questions, + all_score: response.data.all_score, + all_questions_count: response.data.all_questions_count, }) - }catch (e) { + } catch (e) { } @@ -211,46 +195,46 @@ class Paperreview extends Component { } preservation = () => { //保存试卷 - if(this.state.artificialtype==="artificial"){ - if(this.state.Cohetepaperbool===true){ - if (this.contentMdRef.Getdatas().length === 0) { - this.scrollToAnchor("Itembankstopid"); - return; - } - var myrbkc=[]; - var Getdatasdatas=this.contentMdRef.Getdatas()[2].rbzsd; - for(let myda of Getdatasdatas) { - myrbkc.push(myda.id); - } - const url = `/examination_banks.json`; - var data={ - difficulty:this.contentMdRef.Getdatas()[0].rbnd, - name:this.contentMdRef.Getdatas()[4].classroom, - duration:this.contentMdRef.Getdatas()[5].kssc, - discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0], - sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1], - tag_discipline_id: myrbkc, - } - axios.post(url, data) - .then((result) => { - if (result.data.status === 0) { - // this.props.showNotification(`组卷成功`); - this.props.history.replace('/paperlibrary'); - } - }).catch((error) => { + if (this.state.artificialtype === "artificial") { + if (this.state.Cohetepaperbool === true) { + if (this.contentMdRef.Getdatas().length === 0) { + this.scrollToAnchor("Itembankstopid"); + return; + } + var myrbkc = []; + var Getdatasdatas = this.contentMdRef.Getdatas()[2].rbzsd; + for (let myda of Getdatasdatas) { + myrbkc.push(myda.id); + } + const url = `/examination_banks.json`; + var data = { + difficulty: this.contentMdRef.Getdatas()[0].rbnd, + name: this.contentMdRef.Getdatas()[4].classroom, + duration: this.contentMdRef.Getdatas()[5].kssc, + discipline_id: this.contentMdRef.Getdatas()[3].rbkc[0], + sub_discipline_id: this.contentMdRef.Getdatas()[3].rbkc[1], + tag_discipline_id: myrbkc, + } + axios.post(url, data) + .then((result) => { + if (result.data.status === 0) { + // this.props.showNotification(`组卷成功`); + this.props.history.replace('/paperlibrary'); + } + }).catch((error) => { //console.log(error); }) - }else{ - this.setCohetepaperbool(true); + } else { + this.setCohetepaperbool(true); - } + } - }else{ - //智能组卷 - this.setIntelligentformation(true); + } else { + //智能组卷 + this.setIntelligentformation(true); - } + } @@ -264,32 +248,32 @@ class Paperreview extends Component { } - setCohetepaperbool =(bool)=>{ - this.setState({ - Cohetepaperbool:bool - }) + setCohetepaperbool = (bool) => { + this.setState({ + Cohetepaperbool: bool + }) } getcontentMdRef = (Ref) => { this.contentMdRef = Ref; } - setnewmyshixunmodelbool=(bool)=>{ - //人工组卷 - if(bool===true){ - let scrollToTop = window.setInterval(function() { - let pos = window.pageYOffset; - if ( pos > 0 ) { - window.scrollTo( 0, pos - 20 ); // how far to scroll on each step - } else { - window.clearInterval( scrollToTop ); - } - }, 2); - } - this.setState({ - newmyshixunmodelbool:bool - }) - var data = {} - this.getdata(data); + setnewmyshixunmodelbool = (bool) => { + //人工组卷 + if (bool === true) { + let scrollToTop = window.setInterval(function () { + let pos = window.pageYOffset; + if (pos > 0) { + window.scrollTo(0, pos - 20); // how far to scroll on each step + } else { + window.clearInterval(scrollToTop); + } + }, 2); + } + this.setState({ + newmyshixunmodelbool: bool + }) + var data = {} + this.getdata(data); @@ -297,27 +281,27 @@ class Paperreview extends Component { } //换题型 - Replacementtype=(value)=>{ - var item_types=""; - if(value==="单选题"){ - item_types="SINGLE"; + Replacementtype = (value) => { + var item_types = ""; + if (value === "单选题") { + item_types = "SINGLE"; } - else if(value==="多选题"){ - item_types="MULTIPLE"; + else if (value === "多选题") { + item_types = "MULTIPLE"; } - else if(value==="判断题"){ - item_types="JUDGMENT"; + else if (value === "判断题") { + item_types = "JUDGMENT"; } - else if(value==="编程题"){ - item_types="PROGRAM"; + else if (value === "编程题") { + item_types = "PROGRAM"; } - const url=`/examination_intelligent_settings/${this.props.match.params.id}/exchange_items.json`; - let data={ - item_type:item_types, - } + const url = `/examination_intelligent_settings/${this.props.match.params.id}/exchange_items.json`; + let data = { + item_type: item_types, + } axios.post(url, data) .then((result) => { if (result.data.status == 0) { @@ -326,14 +310,14 @@ class Paperreview extends Component { this.getdata(data); } }).catch((error) => { - //console.log(error); - }) + //console.log(error); + }) } //换题 - Changingtopics=(id)=>{ - const url=`/examination_intelligent_settings/${this.props.match.params.id}/exchange_one_item.json`; - let data={ - item_id:id, + Changingtopics = (id) => { + const url = `/examination_intelligent_settings/${this.props.match.params.id}/exchange_one_item.json`; + let data = { + item_id: id, } axios.post(url, data) .then((result) => { @@ -343,23 +327,23 @@ class Paperreview extends Component { this.getdata(data); } }).catch((error) => { - //console.log(error); - }) + //console.log(error); + }) } - setIntelligentformation=(bool)=>{ + setIntelligentformation = (bool) => { this.setState({ - Intelligentformation:bool + Intelligentformation: bool }) } - Confirmationofvolumeformations=()=>{ + Confirmationofvolumeformations = () => { this.setState({ - Intelligentformation:false + Intelligentformation: false }) } render() { - let {page, limit, count, Headertop, visible, placement, modalsType, item_type,artificialtype,Cohetepaperbool,newmyshixunmodelbool,Intelligentformation} = this.state; + let { page, limit, count, Headertop, visible, placement, modalsType, item_type, artificialtype, Cohetepaperbool, newmyshixunmodelbool, Intelligentformation } = this.state; const params = this.props && this.props.match && this.props.match.params; // ////console.log(params); return ( @@ -367,24 +351,24 @@ class Paperreview extends Component {
    { - Intelligentformation===true? - this.getdata(data)} {...this.state} {...this.props} exam_id={this.props.match.params.id} Confirmationofvolumeformations={()=>this.Confirmationofvolumeformations()}> - :"" + Intelligentformation === true ? + this.getdata(data)} {...this.state} {...this.props} exam_id={this.props.match.params.id} Confirmationofvolumeformations={() => this.Confirmationofvolumeformations()}> + : "" } { - newmyshixunmodelbool===true? + newmyshixunmodelbool === true ? - :"" + : "" } { - newmyshixunmodelbool===true? + newmyshixunmodelbool === true ?
    - this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
    : "" @@ -403,8 +387,8 @@ class Paperreview extends Component {
    { - Cohetepaperbool===false? - artificialtype==="artificial"? + Cohetepaperbool === false ? + artificialtype === "artificial" ? 试题库 人工组卷 @@ -426,14 +410,14 @@ class Paperreview extends Component {
    { - Cohetepaperbool===false? - this.Changingtopics(e)} Replacementtype={(e)=>this.Replacementtype(e)} getdata={(data)=>this.getdata(data)} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}> + Cohetepaperbool === false ? + this.Changingtopics(e)} Replacementtype={(e) => this.Replacementtype(e)} getdata={(data) => this.getdata(data)} setnewmyshixunmodelbool={(e) => this.setnewmyshixunmodelbool(e)}> : this.getcontentMdRef(ref)} - setitem_type={(item) => this.setitem_type(item)} + getJudquestio={(ref) => this.getcontentMdRef(ref)} + setitem_type={(item) => this.setitem_type(item)} > } @@ -447,9 +431,9 @@ class Paperreview extends Component {
    - this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/question'}> + this.setCohetepaperbool(bool)} + onSubmits={() => this.preservation()} url={'/question'}>
    ) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index f1f139257..b12fe35f3 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -1,22 +1,12 @@ -import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import React, { Component } from "react"; +import { SnackbarHOC } from 'educoder'; import axios from 'axios'; -import { - notification, - Spin, - Table, - Pagination, - Drawer, - Input, - Tooltip -} from "antd"; -import {parabola} from './animation/parabola' +import { Pagination, Drawer } from "antd"; import Headplugselections from "./component/Headplugselections"; import QuestionModal from "./component/QuestionModal"; import QuestionModals from "./component/QuestionModals"; import Contentpart from "./component/Contentpart"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; import NoneData from './component/NoneData'; import './questioncss/questioncom.css'; import SiderBars from "../question/component/SiderBars"; @@ -26,16 +16,16 @@ class Question extends Component { super(props); this.state = { count: 50, - defaultActiveKey:"1", + defaultActiveKey: "1", Headertop: "", Footerdown: "", visible: false, placement: 'right', modalsType: false, - modalsTypes:false, + modalsTypes: false, titilesm: "在平台审核后,所有成员均可使用试题", titiless: "是否设置为公开?", - titilesms:"单选题", + titilesms: "单选题", titbool: false, Contentdata: [], difficulty: null, @@ -53,109 +43,109 @@ class Question extends Component { program_questions_count: 0, single_questions_count: 0, subjective_questions_count: 0, - page:1, - per_page:10, - disciplinesdata:[], - discipline_id:null, - sub_discipline_id:null, - tag_discipline_id:null, - booljupyterurls:false, - disciplinesdatakc:0, - disciplinesdatazsd:0, - selectallquestionsonthispages:false, - oj_status:null, + page: 1, + per_page: 10, + disciplinesdata: [], + discipline_id: null, + sub_discipline_id: null, + tag_discipline_id: null, + booljupyterurls: false, + disciplinesdatakc: 0, + disciplinesdatazsd: 0, + selectallquestionsonthispages: false, + oj_status: null, isVisible: false, - selectionbools:false, - chakanjiexiboolindex:"无", + selectionbools: false, + chakanjiexiboolindex: "无", } } - chakanjiexibool=(index)=>{ - if(this.state.chakanjiexiboolindex===index){ + chakanjiexibool = (index) => { + if (this.state.chakanjiexiboolindex === index) { this.setState({ - chakanjiexiboolindex:"无", + chakanjiexiboolindex: "无", }) return } this.setState({ - chakanjiexiboolindex:index, + chakanjiexiboolindex: index, }) } - setmychakanjiexibool=(str)=>{ + setmychakanjiexibool = (str) => { this.setState({ - chakanjiexiboolindex:str, + chakanjiexiboolindex: str, }) } - setdiscipline_id=(discipline_id)=>{ + setdiscipline_id = (discipline_id) => { this.setState({ - discipline_id:discipline_id, - sub_discipline_id:null, - tag_discipline_id:null, - keywords:"", - page:1, - per_page:10, - oj_status:null + discipline_id: discipline_id, + sub_discipline_id: null, + tag_discipline_id: null, + keywords: "", + page: 1, + per_page: 10, + oj_status: null }) var data = { - discipline_id:discipline_id, - sub_discipline_id:null, - tag_discipline_id:null, + discipline_id: discipline_id, + sub_discipline_id: null, + tag_discipline_id: null, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: null, page: this.state.page, - per_page:10, - oj_status:null + per_page: 10, + oj_status: null }; this.getdata(data); } - setsub_discipline_id=(discipline_id,sub_discipline_id)=>{ + setsub_discipline_id = (discipline_id, sub_discipline_id) => { this.setState({ - sub_discipline_id:sub_discipline_id, - tag_discipline_id:null, - keywords:"", - page:1, - per_page:10, - oj_status:null + sub_discipline_id: sub_discipline_id, + tag_discipline_id: null, + keywords: "", + page: 1, + per_page: 10, + oj_status: null }) var data = { - discipline_id:discipline_id, - sub_discipline_id:sub_discipline_id, - tag_discipline_id:null, + discipline_id: discipline_id, + sub_discipline_id: sub_discipline_id, + tag_discipline_id: null, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, - keywords:null, + keywords: null, page: 1, - per_page:10, - oj_status:null + per_page: 10, + oj_status: null }; this.getdata(data); } - settag_discipline_id=(tag_discipline_id)=>{ + settag_discipline_id = (tag_discipline_id) => { this.setState({ - tag_discipline_id:tag_discipline_id, - keywords:"", - page:1, - per_page:10, - oj_status:null + tag_discipline_id: tag_discipline_id, + keywords: "", + page: 1, + per_page: 10, + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: null, page: 1, - per_page:10, - oj_status:null + per_page: 10, + oj_status: null }; this.getdata(data); } @@ -176,37 +166,39 @@ class Question extends Component { this.getbasket_listdata(); //获取题库筛选资料 let urls = `/disciplines.json`; - axios.get(urls, {params: { - source:"question" - }}).then((response) => { + axios.get(urls, { + params: { + source: "question" + } + }).then((response) => { //console.log("Questiondisciplines"); //console.log(response.data); if (response) { - this.setState({ - disciplinesdata: response.data.disciplines, - }) + this.setState({ + disciplinesdata: response.data.disciplines, + }) } }); } - //公共和我的 + //公共和我的 callback = (key) => { this.setState({ defaultActiveKey: key, - selectallquestionsonthispages:false, - difficulty:null, - page:1, - oj_status:null + selectallquestionsonthispages: false, + difficulty: null, + page: 1, + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: key, item_type: this.state.item_type, difficulty: null, page: 1, - per_page:10, - oj_status:null + per_page: 10, + oj_status: null }; this.getdata(data); @@ -216,15 +208,15 @@ class Question extends Component { getdata = (data) => { const url = `/item_banks.json`; this.setState({ - booljupyterurls:true, - selectionbools:false, + booljupyterurls: true, + selectionbools: false, }) - axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ + axios.get((url), { params: data }).then((response) => { + setTimeout(() => { this.setState({ - booljupyterurls:false, + booljupyterurls: false, }) - },1000); + }, 1000); if (response === null || response === undefined) { return @@ -244,7 +236,7 @@ class Question extends Component { }).catch((error) => { //////console.log(error) this.setState({ - booljupyterurls:false, + booljupyterurls: false, }) }); } @@ -252,13 +244,13 @@ class Question extends Component { //不刷新加载 getdatasy = (data) => { const url = `/item_banks.json`; - this.setState({ - selectionbools:false, + this.setState({ + selectionbools: false, }) - axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ + axios.get((url), { params: data }).then((response) => { + setTimeout(() => { - },1000); + }, 1000); if (response === null || response === undefined) { return @@ -283,43 +275,43 @@ class Question extends Component { } //计算 - getdataslen=(arr)=>{ - var contes=0; - for(let data of arr) { - if(data.item_type==="PROGRAM"){ + getdataslen = (arr) => { + var contes = 0; + for (let data of arr) { + if (data.item_type === "PROGRAM") { //编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 - if(data.program_attr.status===1){ + if (data.program_attr.status === 1) { //已发布 - contes=contes+1; + contes = contes + 1; } } - }else{ + } else { //不是编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 - contes=contes+1; + contes = contes + 1; } } } - if(contes>0){ + if (contes > 0) { this.setState({ - selectionbools:false, - selectallquestionsonthispages:false, + selectionbools: false, + selectallquestionsonthispages: false, }) - }else { + } else { this.setState({ - selectionbools:true, - selectallquestionsonthispages:true, + selectionbools: true, + selectallquestionsonthispages: true, }) } } @@ -329,27 +321,27 @@ class Question extends Component { page: pageNumber, }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: pageNumber, - per_page:10, - oj_status:this.state.oj_status + per_page: 10, + oj_status: this.state.oj_status }; this.getdata(data); this.setmychakanjiexibool("无") } showDrawer = () => { - if(this.state.visible===true){ + if (this.state.visible === true) { this.setState({ visible: false, }); - }else{ + } else { this.setState({ visible: true, }); @@ -405,19 +397,19 @@ class Question extends Component { modalsType: false }) } - modalCancels=()=>{ + modalCancels = () => { this.setState({ modalsTypes: false }) } - showQuestionModals =(item_type)=>{ + showQuestionModals = (item_type) => { this.setState({ modalsTypes: true, - titilesms:item_type, + titilesms: item_type, }) } - setDownloads=(item_type)=>{ + setDownloads = (item_type) => { this.Deletebigquestiontype(item_type); this.setState({ modalsTypes: false @@ -442,22 +434,22 @@ class Question extends Component { difficulty: difficulty, visiblemys: false, page: 1, - per_page:10, - keywords:"", - oj_status:null + per_page: 10, + keywords: "", + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: difficulty, item_type: this.state.item_type, - keywords:null, - page:1, - per_page:10, - oj_status:null + keywords: null, + page: 1, + per_page: 10, + oj_status: null }; this.getdata(data); @@ -468,22 +460,22 @@ class Question extends Component { item_type: item_type, visiblemyss: false, page: 1, - per_page:10, - keywords:"", - oj_status:null + per_page: 10, + keywords: "", + oj_status: null }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: item_type, page: 1, - per_page:10, - keywords:null, - oj_status:null + per_page: 10, + keywords: null, + oj_status: null }; this.getdata(data); @@ -528,16 +520,16 @@ class Question extends Component { keywords: value, }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: value, page: this.state.page, - per_page:10, - oj_status:this.state.oj_status + per_page: 10, + oj_status: this.state.oj_status }; this.getdata(data); @@ -552,15 +544,15 @@ class Question extends Component { // this.props.showNotification('删除试题成功') // props.history.push(response.data.right_url) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, + per_page: 10, }; this.getdata(data); } @@ -577,21 +569,21 @@ class Question extends Component { if (result.data.status == 0) { // this.props.showNotification(`公开题目成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, + per_page: 10, }; this.getdata(data); } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } getbasket_listdata = () => { @@ -599,53 +591,53 @@ class Question extends Component { const url = "/item_baskets/basket_list.json"; axios.get(url) .then((result) => { - // ////console.log("getbasket_listdata"); - // ////console.log(result.data); - this.setState({ - completion_questions_count: result.data.completion_questions_count, - judgement_questions_count: result.data.judgement_questions_count, - multiple_questions_count: result.data.multiple_questions_count, - practical_questions_count: result.data.practical_questions_count, - program_questions_count: result.data.program_questions_count, - single_questions_count: result.data.single_questions_count, - subjective_questions_count: result.data.subjective_questions_count, - }) + // ////console.log("getbasket_listdata"); + // ////console.log(result.data); + this.setState({ + completion_questions_count: result.data.completion_questions_count, + judgement_questions_count: result.data.judgement_questions_count, + multiple_questions_count: result.data.multiple_questions_count, + practical_questions_count: result.data.practical_questions_count, + program_questions_count: result.data.program_questions_count, + single_questions_count: result.data.single_questions_count, + subjective_questions_count: result.data.subjective_questions_count, + }) }).catch((error) => { - // ////console.log(error); - this.setState({ - completion_questions_count: 0, - judgement_questions_count: 0, - multiple_questions_count: 0, - practical_questions_count: 0, - program_questions_count: 0, - single_questions_count: 0, - subjective_questions_count: 0, + // ////console.log(error); + this.setState({ + completion_questions_count: 0, + judgement_questions_count: 0, + multiple_questions_count: 0, + practical_questions_count: 0, + program_questions_count: 0, + single_questions_count: 0, + subjective_questions_count: 0, + }) }) - }) } - //选用 - getitem_baskets=(data)=>{ + //选用 + getitem_baskets = (data) => { //选用题型可以上传单个 或者多个题型 - let url="/item_baskets.json"; + let url = "/item_baskets.json"; axios.post(url, data) .then((result) => { if (result.data.status == 0) { // this.props.showNotification(`选用成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, + per_page: 10, }; this.getdatasy(data); this.getbasket_listdata(); @@ -654,96 +646,98 @@ class Question extends Component { // }) } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } - // 撤销 - getitem_basketss=(id)=>{ + // 撤销 + getitem_basketss = (id) => { //选用题型可以上传单个 或者多个题型 - let url=`/item_baskets/${id}.json`; + let url = `/item_baskets/${id}.json`; axios.delete(url) .then((result) => { if (result.data.status == 0) { // this.props.showNotification(`撤销成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, + per_page: 10, }; this.getdatasy(data); this.getbasket_listdata(); } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } //全选试题库 - selectallquestionsonthispage=()=>{ - var item_idsdata=[]; + selectallquestionsonthispage = () => { + var item_idsdata = []; - var arr= this.state.Contentdata.items; - for(let data of arr) { - if(data.item_type==="PROGRAM"){ + var arr = this.state.Contentdata.items; + for (let data of arr) { + if (data.item_type === "PROGRAM") { //编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 - if(data.program_attr.status===1){ + if (data.program_attr.status === 1) { //已发布 item_idsdata.push(data.id); } } - }else{ + } else { //不是编程题 - if(data.choosed===true){ + if (data.choosed === true) { - }else{ + } else { //未选用 item_idsdata.push(data.id); } } } - const data={ - item_ids:item_idsdata + const data = { + item_ids: item_idsdata } this.getitem_baskets(data); this.setState({ - selectallquestionsonthispages:true, + selectallquestionsonthispages: true, }) } //全选的状态 - //删除大题型 - Deletebigquestiontype =(item_type)=>{ - const url=`/item_baskets/delete_item_type.json`; - axios.delete((url), { data: { - item_type:item_type - }}) + //删除大题型 + Deletebigquestiontype = (item_type) => { + const url = `/item_baskets/delete_item_type.json`; + axios.delete((url), { + data: { + item_type: item_type + } + }) .then((response) => { if (response.data.status == 0) { // this.props.showNotification('删除成功'); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, + per_page: 10, }; this.getdata(data); this.getbasket_listdata(); @@ -757,30 +751,30 @@ class Question extends Component { //跳转 - gotopaperreview=()=>{ + gotopaperreview = () => { this.props.history.replace("/paperreview/artificial"); } - setoj_status=(oj_status)=>{ + setoj_status = (oj_status) => { //编程题发布未发布 this.setState({ - selectallquestionsonthispages:false, - difficulty:null, - oj_status:oj_status + selectallquestionsonthispages: false, + difficulty: null, + oj_status: oj_status }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: this.state.item_type, keywords: this.state.keywords, page: this.state.page, - per_page:10, - oj_status:oj_status + per_page: 10, + oj_status: oj_status }; this.getdata(data); } @@ -790,9 +784,9 @@ class Question extends Component { render() { let { - page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list, + page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes, basket_list, completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count, - program_questions_count, single_questions_count, subjective_questions_count,selectionbools + program_questions_count, single_questions_count, subjective_questions_count, selectionbools } = this.state; const Datacount = completion_questions_count + judgement_questions_count @@ -800,15 +794,15 @@ class Question extends Component { + program_questions_count + single_questions_count + subjective_questions_count; - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; - const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; - const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; + const isysladmins = this.props && this.props.current_user && this.props.current_user.admin ? this.props.current_user.admin : false; + const is_teacher = this.props && this.props.current_user && this.props.current_user.is_teacher ? this.props.current_user.is_teacher : false; + const professional_certification = this.props && this.props.current_user && this.props.current_user.professional_certification ? this.props.current_user.professional_certification : false; return ( -
    +
    { - visible===true? + visible === true ? - :"" + : "" } { - visible===true? -
    - :""} + visible === true ? +
    + : ""} { - modalsTypes===true? + modalsTypes === true ? this.modalCancels()} - setDownloads={(e) => this.setDownloads(e)}> - :"" + setDownloads={(e) => this.setDownloads(e)}> + : "" } { - modalsType===true? + modalsType === true ? this.modalCancel()} - setDownload={() => this.setDownload()}> - :"" + setDownload={() => this.setDownload()}> + : "" } @@ -865,7 +859,7 @@ class Question extends Component { } { - isysladmins===true? + isysladmins === true ? : - is_teacher===true&&professional_certification===true? + is_teacher === true && professional_certification === true ? : - "" + "" } @@ -901,35 +895,35 @@ class Question extends Component { {...this.state} setdifficulty={(e) => this.setdifficulty(e)} setitem_types={(e) => this.setitem_types(e)} - setdiscipline_id={(e)=>this.setdiscipline_id(e)} - setsub_discipline_id={(e,id)=>this.setsub_discipline_id(e,id)} - settag_discipline_id={(e)=>this.settag_discipline_id(e)} + setdiscipline_id={(e) => this.setdiscipline_id(e)} + setsub_discipline_id={(e, id) => this.setsub_discipline_id(e, id)} + settag_discipline_id={(e) => this.settag_discipline_id(e)} /> {/*头部*/} this.chakanjiexibool(e)} - getitem_basketss={(id)=>this.getitem_basketss(id)} - selectallquestionsonthispage={()=>this.selectallquestionsonthispage()} - getitem_baskets={(e)=>this.getitem_baskets(e)} - setdatafuns={(e) => this.setdatafuns(e)} - setdatafunsval={(e) => this.setdatafunsval(e)} - handleVisibleChanges={(e) => this.handleVisibleChanges(e)} - handleVisibleChange={(e) => this.handleVisibleChange(e)} - showmodels={(e) => this.showmodels(e)} - showmodelysl={(e) => this.showmodelysl(e)} - callback={(e) => this.callback(e)} - setoj_status={(e)=>this.setoj_status(e)}> + Isitapopup={"false"} + chakanjiexiboolindex={this.state.chakanjiexiboolindex} + chakanjiexibool={(e) => this.chakanjiexibool(e)} + getitem_basketss={(id) => this.getitem_basketss(id)} + selectallquestionsonthispage={() => this.selectallquestionsonthispage()} + getitem_baskets={(e) => this.getitem_baskets(e)} + setdatafuns={(e) => this.setdatafuns(e)} + setdatafunsval={(e) => this.setdatafunsval(e)} + handleVisibleChanges={(e) => this.handleVisibleChanges(e)} + handleVisibleChange={(e) => this.handleVisibleChange(e)} + showmodels={(e) => this.showmodels(e)} + showmodelysl={(e) => this.showmodelysl(e)} + callback={(e) => this.callback(e)} + setoj_status={(e) => this.setoj_status(e)}> { - items_count&&items_count>10? + items_count && items_count > 10 ?
    + pageSize={per_page} + total={items_count}>
    - :
    + :
    } @@ -990,7 +984,7 @@ class Question extends Component {

    单选题{'('}{single_questions_count}{')'}

    this.showQuestionModals("SINGLE")}>

    + className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("SINGLE")}>

    } { @@ -1001,7 +995,7 @@ class Question extends Component {

    多选题{'('}{multiple_questions_count}{')'}

    this.showQuestionModals("MULTIPLE")}>

    + className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("MULTIPLE")}>

    } { @@ -1012,7 +1006,7 @@ class Question extends Component {

    判断题{'('}{judgement_questions_count}{')'}

    this.showQuestionModals("JUDGMENT")}>

    + className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("JUDGMENT")}>

    } { @@ -1023,7 +1017,7 @@ class Question extends Component {

    填空题{'('}{completion_questions_count}{')'}

    this.showQuestionModals("COMPLETION")}>

    + className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("COMPLETION")}>

    } { @@ -1034,7 +1028,7 @@ class Question extends Component {

    简答题{'('}{subjective_questions_count}{')'}

    this.showQuestionModals("SUBJECTIVE")}>

    + className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("SUBJECTIVE")}>

    } { @@ -1056,13 +1050,13 @@ class Question extends Component {

    编程题{'('}{program_questions_count}{')'}

    this.showQuestionModals("PROGRAM")}>

    + className="iconfont icon-shanchu1 font-14 lg lh30 icondrawercolor " onClick={() => this.showQuestionModals("PROGRAM")}>

    }
    -
    this.gotopaperreview()}> +
    this.gotopaperreview()}> 试卷预览
    diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index 549bcc5ae..2da18a42c 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -1,18 +1,8 @@ -import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import React, { Component } from "react"; +import { SnackbarHOC } from 'educoder'; import axios from 'axios'; -import { - notification, - Spin, - Table, - Pagination, - Drawer, - Input, - Button, - Breadcrumb -} from "antd"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import { Breadcrumb } from "antd"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; import Itembankstop from "./component/Itembankstop"; import './questioncss/questioncom.css'; import '../tpm/newshixuns/css/Newshixuns.css'; @@ -35,7 +25,7 @@ class Questionitem_banks extends Component { myquestion_choicesco: [], disciplinesdata: [], knowledgepoints: [], - disciplmy:[] + disciplmy: [] } } @@ -115,7 +105,7 @@ class Questionitem_banks extends Component { const didata = response.data.disciplines; for (var i = 0; i < didata.length; i++) { - const childern=[]; + const childern = []; //方向 const fxdidata = didata[i].sub_disciplines; @@ -137,7 +127,7 @@ class Questionitem_banks extends Component { } } - const datakec={ + const datakec = { value: didata[i].id, label: didata[i].name, children: childern, @@ -147,7 +137,7 @@ class Questionitem_banks extends Component { this.setState({ knowledgepoints: this.state.knowledgepoints, - disciplmy:this.state.disciplmy, + disciplmy: this.state.disciplmy, }) @@ -225,15 +215,15 @@ class Questionitem_banks extends Component { // "编辑" } - if (this.contentMdRef.Getdatas().length === 0) { - this.scrollToAnchor("Itembankstopid"); - return; - } + if (this.contentMdRef.Getdatas().length === 0) { + this.scrollToAnchor("Itembankstopid"); + return; + } - var Getdatasdata=this.contentMdRef.Getdatas(); - if (this.state.item_type === null) { - return - } + var Getdatasdata = this.contentMdRef.Getdatas(); + if (this.state.item_type === null) { + return + } if (this.state.item_type === "SINGLE") { @@ -260,18 +250,18 @@ class Questionitem_banks extends Component { // repertoire_id:1, // sub_repertoire_id:1, // tag_repertoire_id:[1,3], - var myrbkc=[]; - var Getdatasdatas=Getdatasdata[2].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = Getdatasdata[2].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } var data = { discipline_id: Getdatasdata[3].rbkc[0], - sub_discipline_id: Getdatasdata[3].rbkc[1], + sub_discipline_id: Getdatasdata[3].rbkc[1], tag_discipline_id: myrbkc, name: anserdata[0], item_type: Getdatasdata[1].rbtx, - difficulty:Getdatasdata[0].rbnd, + difficulty: Getdatasdata[0].rbnd, analysis: anserdata[3], choices: choices, @@ -287,8 +277,8 @@ class Questionitem_banks extends Component { } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } else { axios.put(url, data) .then((result) => { @@ -299,8 +289,8 @@ class Questionitem_banks extends Component { } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } @@ -338,18 +328,18 @@ class Questionitem_banks extends Component { } - var myrbkc=[]; - var Getdatasdatas=Getdatasdata[2].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = Getdatasdata[2].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } var data = { discipline_id: Getdatasdata[3].rbkc[0], - sub_discipline_id: Getdatasdata[3].rbkc[1], + sub_discipline_id: Getdatasdata[3].rbkc[1], tag_discipline_id: myrbkc, name: anserdata[0], item_type: Getdatasdata[1].rbtx, - difficulty:Getdatasdata[0].rbnd, + difficulty: Getdatasdata[0].rbnd, analysis: anserdata[3], choices: choices, @@ -366,8 +356,8 @@ class Questionitem_banks extends Component { } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } else { axios.put(url, data) @@ -379,8 +369,8 @@ class Questionitem_banks extends Component { } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } @@ -407,18 +397,18 @@ class Questionitem_banks extends Component { is_answer: anserdata[1] === "1" ? 1 : 0, } choices.push(choicesdatas); - var myrbkc=[]; - var Getdatasdatas=Getdatasdata[2].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = Getdatasdata[2].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } var data = { discipline_id: Getdatasdata[3].rbkc[0], - sub_discipline_id: Getdatasdata[3].rbkc[1], + sub_discipline_id: Getdatasdata[3].rbkc[1], tag_discipline_id: myrbkc, name: anserdata[0], item_type: Getdatasdata[1].rbtx, - difficulty:Getdatasdata[0].rbnd, + difficulty: Getdatasdata[0].rbnd, analysis: anserdata[2], choices: choices, @@ -432,8 +422,8 @@ class Questionitem_banks extends Component { } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } else { axios.put(url, data) @@ -444,8 +434,8 @@ class Questionitem_banks extends Component { } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } @@ -454,9 +444,9 @@ class Questionitem_banks extends Component { } if (this.state.item_type === "PROGRAM") { //编程题 跳转到 oj 中创建 - var myrbkc=[]; - var Getdatasdatas=Getdatasdata[2].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = Getdatasdata[2].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } @@ -480,7 +470,7 @@ class Questionitem_banks extends Component { } render() { - let {page, limit, count, Headertop, visible, placement, modalsType, item_type} = this.state; + let { page, limit, count, Headertop, visible, placement, modalsType, item_type } = this.state; const params = this.props && this.props.match && this.props.match.params; // ////console.log(params); return ( @@ -516,48 +506,48 @@ class Questionitem_banks extends Component {
    - { - item_type && item_type === "SINGLE" ? - -
    - this.getanswerMdRef(ref)} - > - - -
    - : item_type && item_type === "MULTIPLE" ? -
    - this.getChoquesEditor(ref)} - > - - -
    - - : item_type && item_type === "JUDGMENT" ? + { + item_type && item_type === "SINGLE" ?
    - this.getJudquestio(ref)} + getanswerMdRef={(ref) => this.getanswerMdRef(ref)} > - +
    - - - : item_type && item_type === "PROGRAM" ? - "" - : "" - } -
    + : item_type && item_type === "MULTIPLE" ? +
    + this.getChoquesEditor(ref)} + > + + +
    + + : item_type && item_type === "JUDGMENT" ? + +
    + this.getJudquestio(ref)} + > + + +
    + + + : item_type && item_type === "PROGRAM" ? + "" + : "" + } +
    @@ -567,7 +557,7 @@ class Questionitem_banks extends Component { "" : this.preservation()} url={item_type === "PROGRAM" ?'/problems':'/question'}> + onSubmits={() => this.preservation()} url={item_type === "PROGRAM" ? '/problems' : '/question'}> }
    ) diff --git a/public/react/src/modules/testpaper/Intecomponents.js b/public/react/src/modules/testpaper/Intecomponents.js index 8776b6a9e..97963e2a2 100644 --- a/public/react/src/modules/testpaper/Intecomponents.js +++ b/public/react/src/modules/testpaper/Intecomponents.js @@ -1,6 +1,6 @@ -import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import React, { Component } from "react"; +import { Link, NavLink } from 'react-router-dom'; +import { WordsBtn, ActionBtn, SnackbarHOC, getImageUrl } from 'educoder'; import axios from 'axios'; import { notification, @@ -12,7 +12,7 @@ import { Button, Breadcrumb } from "antd"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; import './testioncss/testioncss.css'; import '../tpm/newshixuns/css/Newshixuns.css'; import Bottomsubmit from "../../modules/modals/Bottomsubmit"; @@ -29,11 +29,11 @@ class Intecomponents extends Component { knowledgepoints: [], disciplmy: [], item_banksedit: [], - newmyshixunmodelbool:false, - single_question_count:0, - multiple_question_count:0, - judgement_question_count:0, - program_question_count:0, + newmyshixunmodelbool: false, + single_question_count: 0, + multiple_question_count: 0, + judgement_question_count: 0, + program_question_count: 0, } @@ -111,107 +111,107 @@ class Intecomponents extends Component { } //难度 - getdatas=()=>{ - if (this.Judquestio.Getdatas().length === 0) { - this.scrollToAnchor("Itembankstopid"); - return false; - } - //console.log(this.Judquestio.Getdatas()); - var myrbkc=[]; - var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd; - for(let myda of Getdatasdatas) { - myrbkc.push(myda.id); - } - const url="/examination_intelligent_settings/optinal_items.json"; - var data={ - sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1], - tag_discipline_id:myrbkc, - source:this.Judquestio.Getdatas()[7].rbly, - difficulty:this.Judquestio.Getdatas()[0].rbnd, + getdatas = () => { + if (this.Judquestio.Getdatas().length === 0) { + this.scrollToAnchor("Itembankstopid"); + return false; + } + //console.log(this.Judquestio.Getdatas()); + var myrbkc = []; + var Getdatasdatas = this.Judquestio.Getdatas()[1].rbzsd; + for (let myda of Getdatasdatas) { + myrbkc.push(myda.id); + } + const url = "/examination_intelligent_settings/optinal_items.json"; + var data = { + sub_discipline_id: this.Judquestio.Getdatas()[2].rbkc[1], + tag_discipline_id: myrbkc, + source: this.Judquestio.Getdatas()[7].rbly, + difficulty: this.Judquestio.Getdatas()[0].rbnd, } - this.getwangluodata(url,data); + this.getwangluodata(url, data); } //课程 - getdatasss=(kech)=>{ + getdatasss = (kech) => { if (this.Judquestio.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return false; } //console.log(this.Judquestio.Getdatas()); - var myrbkc=[]; - var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = this.Judquestio.Getdatas()[1].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } - const url="/examination_intelligent_settings/optinal_items.json"; - var data={ - sub_discipline_id:kech, - tag_discipline_id:myrbkc, - source:this.Judquestio.Getdatas()[7].rbly, - difficulty:this.Judquestio.Getdatas()[0].rbnd, + const url = "/examination_intelligent_settings/optinal_items.json"; + var data = { + sub_discipline_id: kech, + tag_discipline_id: myrbkc, + source: this.Judquestio.Getdatas()[7].rbly, + difficulty: this.Judquestio.Getdatas()[0].rbnd, } - this.getwangluodata(url,data); + this.getwangluodata(url, data); } //知识点 - getdatassss=(zhishidian)=>{ + getdatassss = (zhishidian) => { if (this.Judquestio.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return false; } //console.log(this.Judquestio.Getdatas()); - var myrbkc=[]; - var Getdatasdatas=zhishidian; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = zhishidian; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } - const url="/examination_intelligent_settings/optinal_items.json"; - var data={ - sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1], - tag_discipline_id:myrbkc, - source:this.Judquestio.Getdatas()[7].rbly, - difficulty:this.Judquestio.Getdatas()[0].rbnd, + const url = "/examination_intelligent_settings/optinal_items.json"; + var data = { + sub_discipline_id: this.Judquestio.Getdatas()[2].rbkc[1], + tag_discipline_id: myrbkc, + source: this.Judquestio.Getdatas()[7].rbly, + difficulty: this.Judquestio.Getdatas()[0].rbnd, } - this.getwangluodata(url,data); + this.getwangluodata(url, data); } //来源 - getdatassssy=(rbly)=>{ + getdatassssy = (rbly) => { if (this.Judquestio.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return false; } //console.log(this.Judquestio.Getdatas()); - var myrbkc=[]; - var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = this.Judquestio.Getdatas()[1].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } - const url="/examination_intelligent_settings/optinal_items.json"; - var data={ - sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1], - tag_discipline_id:myrbkc, - source:rbly, - difficulty:this.Judquestio.Getdatas()[0].rbnd, + const url = "/examination_intelligent_settings/optinal_items.json"; + var data = { + sub_discipline_id: this.Judquestio.Getdatas()[2].rbkc[1], + tag_discipline_id: myrbkc, + source: rbly, + difficulty: this.Judquestio.Getdatas()[0].rbnd, } - this.getwangluodata(url,data); + this.getwangluodata(url, data); } - getwangluodata=(url,data)=>{ - axios.post(url,data).then((response) => { + getwangluodata = (url, data) => { + axios.post(url, data).then((response) => { if (response) { //console.log("智能组卷"); //console.log(response); - if(response.data){ + if (response.data) { this.setState({ - single_question_count:response.data.single_question_count, - multiple_question_count:response.data.multiple_question_count, - judgement_question_count:response.data.judgement_question_count, - program_question_count:response.data.program_question_count, + single_question_count: response.data.single_question_count, + multiple_question_count: response.data.multiple_question_count, + judgement_question_count: response.data.judgement_question_count, + program_question_count: response.data.program_question_count, }) } @@ -220,35 +220,35 @@ class Intecomponents extends Component { }); } //难度 - getdatass=(nandu)=>{ + getdatass = (nandu) => { if (this.Judquestio.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return false; } //console.log(this.Judquestio.Getdatas()); - var myrbkc=[]; - var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = this.Judquestio.Getdatas()[1].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } - const url="/examination_intelligent_settings/optinal_items.json"; - var data={ - sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1], - tag_discipline_id:myrbkc, - source:this.Judquestio.Getdatas()[7].rbly, - difficulty:nandu, + const url = "/examination_intelligent_settings/optinal_items.json"; + var data = { + sub_discipline_id: this.Judquestio.Getdatas()[2].rbkc[1], + tag_discipline_id: myrbkc, + source: this.Judquestio.Getdatas()[7].rbly, + difficulty: nandu, } - axios.post(url,data).then((response) => { + axios.post(url, data).then((response) => { if (response) { //console.log("智能组卷"); //console.log(response); - if(response.data){ + if (response.data) { this.setState({ - single_question_count:response.data.single_question_count, - multiple_question_count:response.data.multiple_question_count, - judgement_question_count:response.data.judgement_question_count, - program_question_count:response.data.program_question_count, + single_question_count: response.data.single_question_count, + multiple_question_count: response.data.multiple_question_count, + judgement_question_count: response.data.judgement_question_count, + program_question_count: response.data.program_question_count, }) } @@ -286,9 +286,9 @@ class Intecomponents extends Component { this.scrollToAnchor("Itembankstopid"); return; } - var myrbkc=[]; - var Getdatasdatas=this.Judquestio.Getdatas()[1].rbzsd; - for(let myda of Getdatasdatas) { + var myrbkc = []; + var Getdatasdatas = this.Judquestio.Getdatas()[1].rbzsd; + for (let myda of Getdatasdatas) { myrbkc.push(myda.id); } // //console.log(myrbkc); @@ -296,7 +296,7 @@ class Intecomponents extends Component { // //console.log(this.Judquestio.Getdatas()); - var question_settings =[ + var question_settings = [ { "item_type": "SINGLE", "count": this.Judquestio.Getdatas()[3].rbdxt @@ -316,14 +316,14 @@ class Intecomponents extends Component { ] - const url="/examination_intelligent_settings.json" + const url = "/examination_intelligent_settings.json" var data = { discipline_id: this.Judquestio.Getdatas()[2].rbkc[0], - sub_discipline_id:this.Judquestio.Getdatas()[2].rbkc[1], - tag_discipline_id:myrbkc, - source:this.Judquestio.Getdatas()[7].rbly, - difficulty:this.Judquestio.Getdatas()[0].rbnd, - question_settings:question_settings, + sub_discipline_id: this.Judquestio.Getdatas()[2].rbkc[1], + tag_discipline_id: myrbkc, + source: this.Judquestio.Getdatas()[7].rbly, + difficulty: this.Judquestio.Getdatas()[0].rbnd, + question_settings: question_settings, } axios.post(url, data) .then((result) => { @@ -332,8 +332,8 @@ class Intecomponents extends Component { this.props.history.push(`/Integeneration/Intelligence/${result.data.exam_setting_id}`); } }).catch((error) => { - //console.log(error); - }) + //console.log(error); + }) } @@ -350,12 +350,12 @@ class Intecomponents extends Component { this.contentMdRef = Ref; } - setnewmyshixunmodelbool=()=>{ + setnewmyshixunmodelbool = () => { } render() { - let {paperlibrartdata,newmyshixunmodelbool,single_question_count,multiple_question_count,judgement_question_count,program_question_count} = this.state; + let { paperlibrartdata, newmyshixunmodelbool, single_question_count, multiple_question_count, judgement_question_count, program_question_count } = this.state; const params = this.props && this.props.match && this.props.match.params; return (
    @@ -379,16 +379,16 @@ class Intecomponents extends Component {
    this.getdatas()} - getdatass={(nd)=>this.getdatass(nd)} - getJudquestio={(ref) => this.getJudquestio(ref)} - getdatasss={(e)=>this.getdatasss(e)} - getdatassss={(e)=>this.getdatassss(e)} - getdatassssy={(e)=>this.getdatassssy(e)} + single_question_count={this.state.single_question_count} + multiple_question_count={this.state.multiple_question_count} + judgement_question_count={this.state.judgement_question_count} + program_question_count={this.state.program_question_count} + getdatas={() => this.getdatas()} + getdatass={(nd) => this.getdatass(nd)} + getJudquestio={(ref) => this.getJudquestio(ref)} + getdatasss={(e) => this.getdatasss(e)} + getdatassss={(e) => this.getdatassss(e)} + getdatassssy={(e) => this.getdatassssy(e)} > @@ -401,9 +401,9 @@ class Intecomponents extends Component { { newmyshixunmodelbool === true ? "" : this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/paperlibrary'}> + Cohetepaperbool={false} + setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)} + onSubmits={() => this.preservation()} url={'/paperlibrary'}> }
    ) diff --git a/public/react/src/modules/testpaper/Paperlibraryeditid.js b/public/react/src/modules/testpaper/Paperlibraryeditid.js index 524cdd153..eaf6a1046 100644 --- a/public/react/src/modules/testpaper/Paperlibraryeditid.js +++ b/public/react/src/modules/testpaper/Paperlibraryeditid.js @@ -4,7 +4,7 @@ import axios from 'axios'; import { Breadcrumb } from "antd"; -import { TPMIndexHOC } from "../tpm/TPMIndexHOC"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; import './testioncss/testioncss.css'; import '../tpm/newshixuns/css/Newshixuns.css'; import Bottomsubmit from "../../modules/modals/Bottomsubmit"; diff --git a/public/react/src/modules/testpaper/Paperlibraryseeid.js b/public/react/src/modules/testpaper/Paperlibraryseeid.js index aa9263e67..07681ebf2 100644 --- a/public/react/src/modules/testpaper/Paperlibraryseeid.js +++ b/public/react/src/modules/testpaper/Paperlibraryseeid.js @@ -1,19 +1,8 @@ -import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import React, { Component } from "react"; +import { SnackbarHOC } from 'educoder'; import axios from 'axios'; -import { - notification, - Spin, - Table, - Pagination, - Drawer, - Input, - Button, - Breadcrumb -} from "antd"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; -import NoneData from './component/NoneData'; +import { Breadcrumb } from "antd"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; import './testioncss/testioncss.css'; import '../tpm/newshixuns/css/Newshixuns.css'; import Bottomsubmit from "../../modules/modals/Bottomsubmit"; @@ -25,7 +14,7 @@ class Paperlibraryseeid extends Component { super(props); this.contentMdRef = React.createRef(); this.state = { - paperlibrartdata:[], + paperlibrartdata: [], } @@ -85,14 +74,14 @@ class Paperlibraryseeid extends Component { } - setCohetepaperbool =(bool)=>{ + setCohetepaperbool = (bool) => { } getcontentMdRef = (Ref) => { this.contentMdRef = Ref; } render() { - let {paperlibrartdata} = this.state; + let { paperlibrartdata } = this.state; const params = this.props && this.props.match && this.props.match.params; // ////console.log(params); return ( @@ -112,21 +101,21 @@ class Paperlibraryseeid extends Component {
    - - 试卷库 - 公告试卷库 - 试卷查看 - + + 试卷库 + 公告试卷库 + 试卷查看 +
    - {paperlibrartdata&&paperlibrartdata.exam&&paperlibrartdata.exam.name} + {paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.name}
    - @@ -135,17 +124,17 @@ class Paperlibraryseeid extends Component { this.getdata()} - single_questions={paperlibrartdata&&paperlibrartdata.single_questions&&paperlibrartdata.single_questions.questions.length>0?paperlibrartdata.single_questions:null} - multiple_questions={paperlibrartdata&&paperlibrartdata.multiple_questions - &&paperlibrartdata.multiple_questions.questions.length>0?paperlibrartdata.multiple_questions:null - } - judgement_questions={paperlibrartdata&&paperlibrartdata.judgement_questions - &&paperlibrartdata.judgement_questions.questions.length>0?paperlibrartdata.judgement_questions:null - } - program_questions={paperlibrartdata&&paperlibrartdata.program_questions - &&paperlibrartdata.program_questions.questions.length>0?paperlibrartdata.program_questions:null - } + getdata={() => this.getdata()} + single_questions={paperlibrartdata && paperlibrartdata.single_questions && paperlibrartdata.single_questions.questions.length > 0 ? paperlibrartdata.single_questions : null} + multiple_questions={paperlibrartdata && paperlibrartdata.multiple_questions + && paperlibrartdata.multiple_questions.questions.length > 0 ? paperlibrartdata.multiple_questions : null + } + judgement_questions={paperlibrartdata && paperlibrartdata.judgement_questions + && paperlibrartdata.judgement_questions.questions.length > 0 ? paperlibrartdata.judgement_questions : null + } + program_questions={paperlibrartdata && paperlibrartdata.program_questions + && paperlibrartdata.program_questions.questions.length > 0 ? paperlibrartdata.program_questions : null + } > @@ -170,8 +159,8 @@ class Paperlibraryseeid extends Component {
    this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/paperlibrary'}> + setCohetepaperbool={(bool) => this.setCohetepaperbool(bool)} + onSubmits={() => this.preservation()} url={'/paperlibrary'}>
    ) diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index fe244b9c4..0d2501e92 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -1,17 +1,8 @@ -import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import React, { Component } from "react"; +import { SnackbarHOC } from 'educoder'; import axios from 'axios'; -import { - notification, - Spin, - Table, - Pagination, - Drawer, - Input -} from "antd"; -import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; -import NoneData from './component/NoneData'; +import { Pagination, } from "antd"; +import TPMIndexHOC from "../tpm/TPMIndexHOC"; import './testioncss/testioncss.css'; import Contentpart from "./component/Contentpart"; import SiderBar from "../tpm/SiderBar"; @@ -23,23 +14,23 @@ class Testpaperlibrary extends Component { super(props); this.state = { Headertop: "", - disciplinesdata:null, - discipline_id:null, - sub_discipline_id:null, - tag_discipline_id:null, - public:null, - difficulty:null, - item_type:null, - keywords:null, - page:1, - per_page:10, - booljupyterurls:false, - Contentdata:[], - items_count:0, - defaultActiveKey:"1", - modalsTypes:false, - modalsType:false, - timuid:0, + disciplinesdata: null, + discipline_id: null, + sub_discipline_id: null, + tag_discipline_id: null, + public: null, + difficulty: null, + item_type: null, + keywords: null, + page: 1, + per_page: 10, + booljupyterurls: false, + Contentdata: [], + items_count: 0, + defaultActiveKey: "1", + modalsTypes: false, + modalsType: false, + timuid: 0, } } getContainer = () => { @@ -66,9 +57,11 @@ class Testpaperlibrary extends Component { }); //获取题库筛选资料 let urls = `/disciplines.json`; - axios.get(urls, {params: { - source:"question" - }}).then((response) => { + axios.get(urls, { + params: { + source: "question" + } + }).then((response) => { if (response) { this.setState({ disciplinesdata: response.data.disciplines, @@ -77,19 +70,19 @@ class Testpaperlibrary extends Component { }); } - paginationonChange=(pages)=>{ + paginationonChange = (pages) => { this.setState({ - page:pages + page: pages }) - var data={ - page:pages, - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + var data = { + page: pages, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, keywords: null, - per_page:10, + per_page: 10, } this.getdata(data); } @@ -105,50 +98,50 @@ class Testpaperlibrary extends Component { this.setState({ keywords: value, }) - var data={ - page:this.state.page, - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + var data = { + page: this.state.page, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, keywords: value, - per_page:10, + per_page: 10, } this.getdata(data); } callback = (key) => { this.setState({ defaultActiveKey: key, - difficulty:null, - keywords:null, - page:1, + difficulty: null, + keywords: null, + page: 1, }) - var data={ - page:1, - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + var data = { + page: 1, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: key, - difficulty:null, + difficulty: null, keywords: null, - per_page:10, + per_page: 10, } this.getdata(data); } //获取数据 - getdata=(data)=>{ + getdata = (data) => { const url = `/examination_banks.json`; this.setState({ - booljupyterurls:true, + booljupyterurls: true, }) - axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ + axios.get((url), { params: data }).then((response) => { + setTimeout(() => { this.setState({ - booljupyterurls:false, + booljupyterurls: false, }) - },1000); + }, 1000); if (response === null || response === undefined) { return @@ -167,88 +160,88 @@ class Testpaperlibrary extends Component { }).catch((error) => { //////console.log(error) this.setState({ - booljupyterurls:false, + booljupyterurls: false, }) }); } - setdiscipline_id=(discipline_id)=>{ + setdiscipline_id = (discipline_id) => { this.setState({ - discipline_id:discipline_id, - sub_discipline_id:null, - tag_discipline_id:null, - keywords:null, + discipline_id: discipline_id, + sub_discipline_id: null, + tag_discipline_id: null, + keywords: null, page: 1, - per_page:10, + per_page: 10, }) var data = { - discipline_id:discipline_id, - sub_discipline_id:null, - tag_discipline_id:null, + discipline_id: discipline_id, + sub_discipline_id: null, + tag_discipline_id: null, public: this.state.defaultActiveKey, difficulty: this.props.difficulty, keywords: null, page: 1, - per_page:10, + per_page: 10, }; this.getdata(data); } - setsub_discipline_id=(discipline_id,sub_discipline_id)=>{ + setsub_discipline_id = (discipline_id, sub_discipline_id) => { this.setState({ - sub_discipline_id:sub_discipline_id, - tag_discipline_id:null, - keywords:null, - page:1, - per_page:10, + sub_discipline_id: sub_discipline_id, + tag_discipline_id: null, + keywords: null, + page: 1, + per_page: 10, }) var data = { - discipline_id:discipline_id, - sub_discipline_id:sub_discipline_id, - tag_discipline_id:null, + discipline_id: discipline_id, + sub_discipline_id: sub_discipline_id, + tag_discipline_id: null, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, keywords: null, - page:1, - per_page:10, + page: 1, + per_page: 10, }; this.getdata(data); } - settag_discipline_id=(tag_discipline_id)=>{ + settag_discipline_id = (tag_discipline_id) => { this.setState({ - tag_discipline_id:tag_discipline_id, - keywords:null, - page:1, - per_page:10, + tag_discipline_id: tag_discipline_id, + keywords: null, + page: 1, + per_page: 10, }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, keywords: null, page: 1, - per_page:10, + per_page: 10, }; this.getdata(data); } - modalCancels=()=>{ + modalCancels = () => { this.setState({ modalsTypes: false }) } - setDownloads=(item_type)=>{ + setDownloads = (item_type) => { this.Deletebigquestiontype(item_type); this.setState({ modalsTypes: false }) } //删除大题型 - Deletebigquestiontype =(item_type)=>{ + Deletebigquestiontype = (item_type) => { } modalCancel = () => { @@ -279,20 +272,20 @@ class Testpaperlibrary extends Component { if (result.data.status == 0) { // this.props.showNotification(`公开试卷成功`); var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, keywords: this.state.keywords, page: this.state.page, - per_page:10, + per_page: 10, }; this.getdata(data); } }).catch((error) => { - ////console.log(error); - }) + ////console.log(error); + }) } //删除试卷 @@ -305,14 +298,14 @@ class Testpaperlibrary extends Component { // this.props.showNotification('删除试卷成功'); // props.history.push(response.data.right_url) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, keywords: this.state.keywords, page: this.state.page, - per_page:10, + per_page: 10, }; this.getdata(data); } @@ -332,7 +325,7 @@ class Testpaperlibrary extends Component { }) }; - Testpapereditor=(id)=>{ + Testpapereditor = (id) => { this.props.history.push(`/paperlibrary/edit/${id}`); } @@ -349,24 +342,24 @@ class Testpaperlibrary extends Component { }) }; - setdifficulty=(difficulty)=>{ + setdifficulty = (difficulty) => { this.setState({ difficulty: difficulty, visiblemys: false, - keywords:"", + keywords: "", page: 1, - per_page:10, + per_page: 10, }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: difficulty, - keywords:null, - page:1, - per_page:10, + keywords: null, + page: 1, + per_page: 10, }; this.getdata(data); @@ -379,21 +372,21 @@ class Testpaperlibrary extends Component { this.setState({ item_type: item_type, visiblemyss: false, - keywords:null, + keywords: null, page: 1, - per_page:10, + per_page: 10, }) var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, item_type: item_type, - keywords:"", + keywords: "", page: 1, - per_page:10, + per_page: 10, }; this.getdata(data); @@ -403,55 +396,55 @@ class Testpaperlibrary extends Component { render() { - let{Headertop,items_count,page,per_page,modalsTypes,modalsType}=this.state; + let { Headertop, items_count, page, per_page, modalsTypes, modalsType } = this.state; - const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; - const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; - const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; + const isysladmins = this.props && this.props.current_user && this.props.current_user.admin ? this.props.current_user.admin : false; + const is_teacher = this.props && this.props.current_user && this.props.current_user.is_teacher ? this.props.current_user.is_teacher : false; + const professional_certification = this.props && this.props.current_user && this.props.current_user.professional_certification ? this.props.current_user.professional_certification : false; return (
    { - modalsTypes===true? + modalsTypes === true ? this.modalCancels()} - setDownloads={(e) => this.setDownloads(e)}> - :"" + setDownloads={(e) => this.setDownloads(e)}> + : "" } { - modalsType===true? + modalsType === true ? this.modalCancel()} - setDownload={() => this.setDownload()}> - :"" + setDownload={() => this.setDownload()}> + : "" } {/*试卷库*/} this.showDrawer()} - Headertop={Headertop}/> + Headertop={Headertop} /> {/*顶部*/} this.setdiscipline_id(e)} - setsub_discipline_id={(e,id)=>this.setsub_discipline_id(e,id)} - settag_discipline_id={(e)=>this.settag_discipline_id(e)} - setitem_types={(e) => this.setitem_types(e)} - setdifficulty={(e) => this.setdifficulty(e)} + disciplinesdata={this.state.disciplinesdata} + setdiscipline_id={(e) => this.setdiscipline_id(e)} + setsub_discipline_id={(e, id) => this.setsub_discipline_id(e, id)} + settag_discipline_id={(e) => this.settag_discipline_id(e)} + setitem_types={(e) => this.setitem_types(e)} + setdifficulty={(e) => this.setdifficulty(e)} > {/*头部*/} this.Testpapereditor(e)} - setdifficulty={(e)=>this.setdifficulty(e)} - showmodels={(e)=>this.showmodels(e)} - showmodelysl={(e)=>this.showmodelysl(e)} - setdatafuns={(key)=>this.setdatafuns(key)} - callback={(key)=>this.callback(key)} - setdatafunsval={(key)=>this.setdatafunsval(key)} - setdifficulty={(bool)=>this.setdifficulty(bool)} + Testpapereditor={(e) => this.Testpapereditor(e)} + setdifficulty={(e) => this.setdifficulty(e)} + showmodels={(e) => this.showmodels(e)} + showmodelysl={(e) => this.showmodelysl(e)} + setdatafuns={(key) => this.setdatafuns(key)} + callback={(key) => this.callback(key)} + setdatafunsval={(key) => this.setdatafunsval(key)} + setdifficulty={(bool) => this.setdifficulty(bool)} > @@ -460,11 +453,11 @@ class Testpaperlibrary extends Component { { - items_count&&items_count>10? + items_count && items_count > 10 ?
    + pageSize={per_page} + total={items_count}>
    :
    diff --git a/public/react/src/modules/topic_bank/Topic_bank.js b/public/react/src/modules/topic_bank/Topic_bank.js index 740925923..549da4262 100644 --- a/public/react/src/modules/topic_bank/Topic_bank.js +++ b/public/react/src/modules/topic_bank/Topic_bank.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { Route, Switch } from "react-router-dom"; import Loading from '../../Loading' import Loadable from 'react-loadable'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC' +import TPMIndexHOC from '../tpm/TPMIndexHOC' import { SnackbarHOC } from 'educoder' diff --git a/public/react/src/modules/tpm/1.js b/public/react/src/modules/tpm/1.js index 7bade29c9..7a79986f7 100644 --- a/public/react/src/modules/tpm/1.js +++ b/public/react/src/modules/tpm/1.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import Comments from '../comment/Comments' -import { commentHOC } from '../comment/CommentsHOC' +import commentHOC from '../comment/CommentsHOC' import './TPMShixunDiscuss.css' diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 654e27352..ad10bcb84 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -2,13 +2,13 @@ import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; -import { Row, Col ,Menu,Popover,Button} from 'antd'; +import { Row, Col, Menu, Popover, Button } from 'antd'; import Loading from '../../Loading'; import Loadable from 'react-loadable'; -import { TPMIndexHOC } from './TPMIndexHOC'; +import TPMIndexHOC from './TPMIndexHOC'; import { SnackbarHOC } from 'educoder'; @@ -84,8 +84,8 @@ import '../page/tpiPage.css'; //新建实训 const TPMchallengesnew = Loadable({ - loader: () => import('./challengesnew/TPMchallengesnew'), - loading: Loading, + loader: () => import('./challengesnew/TPMchallengesnew'), + loading: Loading, }) //新建实训 // const TPMchallengesnew = Loadable({ @@ -95,8 +95,8 @@ const TPMchallengesnew = Loadable({ //新建tab2 const TPMevaluation = Loadable({ - loader: () => import('./challengesnew/TPMevaluation'), - loading: Loading, + loader: () => import('./challengesnew/TPMevaluation'), + loading: Loading, }) //新建tab3答案 @@ -105,306 +105,306 @@ const TPMevaluation = Loadable({ // loading: Loading, // }) const TPManswer = Loadable({ - loader: () => import('./challengesnew/TPManswer2'), - loading: Loading, + loader: () => import('./challengesnew/TPManswer2'), + loading: Loading, }) //选择题 const TPMquestion = Loadable({ - loader: () => import('./challengesnew/TPMquestion'), - loading: Loading, + loader: () => import('./challengesnew/TPMquestion'), + loading: Loading, }) //fork列表 const TPMFork_listComponent = Loadable({ - loader: () => import('./TPMFork/TPMForklist'), - loading: Loading, + loader: () => import('./TPMFork/TPMForklist'), + loading: Loading, }) //背景知识修改 const TPMUpdatepropaede = Loadable({ - loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'), - loading: Loading, + loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'), + loading: Loading, }) // 版本库添加文件 const AddFile = Loadable({ - loader: () => import('./shixunchild/Repository/RepositoryAddFile'), - loading: Loading, + loader: () => import('./shixunchild/Repository/RepositoryAddFile'), + loading: Loading, }) const interceptorUrlArray = ['repository.json', 'commits.json', 'propaedeutics.json' - , 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json'] + , 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json'] const cacheInterceptorUrlMap = {} class TPMIndex extends Component { - constructor(props) { - super(props) - this.state = { - loadingContent: false, - power: false, - shixunsDetails: {}, - shixunId: undefined, - star_info: [0, 0, 0, 0, 0, 0], - star_infos: [0, 0, 0, 0, 0, 0], - identity:undefined, - TPMRightSectionData:undefined, - PropaedeuticsList: undefined, - tpmindexjupyterbool:false, - is_jupyter:false, - selectedKeys:"", - openknows:false - } + constructor(props) { + super(props) + this.state = { + loadingContent: false, + power: false, + shixunsDetails: {}, + shixunId: undefined, + star_info: [0, 0, 0, 0, 0, 0], + star_infos: [0, 0, 0, 0, 0, 0], + identity: undefined, + TPMRightSectionData: undefined, + PropaedeuticsList: undefined, + tpmindexjupyterbool: false, + is_jupyter: false, + selectedKeys: "", + openknows: false } + } - openknow=()=>{ - let storage=window.localStorage; - this.setState({ - openknows:false - }) - let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings' - storage.setItem(newTPMsettings,false); - } + openknow = () => { + let storage = window.localStorage; + this.setState({ + openknows: false + }) + let newTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings' + storage.setItem(newTPMsettings, false); + } componentDidUpdate(prevProps, prevState) { - if (prevProps!=this.props) { - if(this.props.user&&this.props.user.user_id){ - let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; - let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) - if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ - this.setState({ - openknows:false - }) - }else{ - this.setState({ - openknows:false - }) - } + if (prevProps != this.props) { + if (this.props.user && this.props.user.user_id) { + let getnewTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings'; + let newTPMsettings = window.localStorage.getItem(getnewTPMsettings) + if (newTPMsettings === undefined || newTPMsettings === false || newTPMsettings === null) { + this.setState({ + openknows: false + }) + } else { + this.setState({ + openknows: false + }) } } } + } - getcomponentdidmount=()=>{ - let userid=this.props.user&&this.props.user.user_id; - let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'; - let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) - let id = this.props.match.params.shixunId; - // console.log('props', this.props); - // let collaborators = `/shixuns/` + id + `/propaedeutics.json`; - // - // axios.get(collaborators).then((response) => { - // if (response.status === 200) { - // if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - // - // }else{ - // this.setState({ - // PropaedeuticsList: response.data, - // shixunId: id - // }); - // } - // - // } - // }).catch((error) => { - // console.log(error) - // }); - let Url = `/shixuns/` + id + `.json`; - axios.get(Url).then((response) => { - if (response.status === 200) { - document.title=response.data.name; - let newstar_info = []; - // let start1= - for (var i = 0; i < response.data.score_info.length; i++) { - - if (i === 0) { - newstar_info.push(response.data.score_info[i]) - } else { - newstar_info.push((response.data.score_info[i] / 100) * 5) - } - } - let newstar_infos = response.data.score_info; - this.setState({ - shixunsDetails: response.data, - shixunId: id, - star_info: newstar_info, - star_infos: newstar_infos, - power: response.data.power, - identity: response.data.identity, - propaedeutics:response.data.propaedeutics, - status: response.data.shixun_status, - secret_repository: response.data.secret_repository, - public:response.data.public, - is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter, - }); - - if(userid){ - if(response.data.identity <4){ - if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ - console.log() - this.setState({ - openknows:true - }) - }else{ - this.setState({ - openknows:false - }) - } - } + getcomponentdidmount = () => { + let userid = this.props.user && this.props.user.user_id; + let getnewTPMsettings = this.props.user && this.props.user.user_id + 'newTPMsettings'; + let newTPMsettings = window.localStorage.getItem(getnewTPMsettings) + let id = this.props.match.params.shixunId; + // console.log('props', this.props); + // let collaborators = `/shixuns/` + id + `/propaedeutics.json`; + // + // axios.get(collaborators).then((response) => { + // if (response.status === 200) { + // if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + // + // }else{ + // this.setState({ + // PropaedeuticsList: response.data, + // shixunId: id + // }); + // } + // + // } + // }).catch((error) => { + // console.log(error) + // }); + let Url = `/shixuns/` + id + `.json`; + axios.get(Url).then((response) => { + if (response.status === 200) { + document.title = response.data.name; + let newstar_info = []; + // let start1= + for (var i = 0; i < response.data.score_info.length; i++) { + + if (i === 0) { + newstar_info.push(response.data.score_info[i]) + } else { + newstar_info.push((response.data.score_info[i] / 100) * 5) } - } - }).catch((error) => { + let newstar_infos = response.data.score_info; this.setState({ - shixunsDetails: undefined, - shixunId: undefined, - star_info: undefined, - star_infos: undefined, - power: undefined, - identity: undefined, - status: undefined, - propaedeutics:undefined, - is_jupyter:false, + shixunsDetails: response.data, + shixunId: id, + star_info: newstar_info, + star_infos: newstar_infos, + power: response.data.power, + identity: response.data.identity, + propaedeutics: response.data.propaedeutics, + status: response.data.shixun_status, + secret_repository: response.data.secret_repository, + public: response.data.public, + is_jupyter: response.data.is_jupyter === undefined || response.data.is_jupyter === null ? false : response.data.is_jupyter, }); - }); - - this.tpmContentRequestInterceptor = axios.interceptors.request.use((config) => { - let url = config.url; - // console.log('tpmContentRequestInterceptor:', url) - for ( let i = 0; i < interceptorUrlArray.length; i++ ) { - if (url.indexOf(interceptorUrlArray[i]) != -1) { - url = url.split('?')[0] - console.log('loadingContent, url:', url) - - this.setState({ loadingContent: false }) - cacheInterceptorUrlMap[url] = true + if (userid) { + if (response.data.identity < 4) { + if (newTPMsettings === undefined || newTPMsettings === false || newTPMsettings === null) { + console.log() + this.setState({ + openknows: true + }) + } else { + this.setState({ + openknows: false + }) + } } } - return config; - }, function (error) { - return Promise.reject(error); + + } + }).catch((error) => { + this.setState({ + shixunsDetails: undefined, + shixunId: undefined, + star_info: undefined, + star_infos: undefined, + power: undefined, + identity: undefined, + status: undefined, + propaedeutics: undefined, + is_jupyter: false, }); + }); - // Add a response interceptor - this.tpmContentResponseInterceptor = axios.interceptors.response.use((response) => { - // console.log('loadingContent finished, url:', response.config.url) - // TODO 依赖了api这个前缀 - let url = response.config.url.split('api')[1]; - url = url.split('?')[0] - if (cacheInterceptorUrlMap[url]) { + this.tpmContentRequestInterceptor = axios.interceptors.request.use((config) => { + let url = config.url; + // console.log('tpmContentRequestInterceptor:', url) + for (let i = 0; i < interceptorUrlArray.length; i++) { + if (url.indexOf(interceptorUrlArray[i]) != -1) { + url = url.split('?')[0] + console.log('loadingContent, url:', url) this.setState({ loadingContent: false }) - delete cacheInterceptorUrlMap[response.url] - } - return response; - }, function (error) { - // Do something with response error - return Promise.reject(error); - }); - //右侧数据 - let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; - axios.get(shixunsDetailsURL).then((response)=> { - if(response.data){ + cacheInterceptorUrlMap[url] = true } - this.setState({ - TPMRightSectionData: response.data - }); - }) - this.getnavdatas() - } - componentDidMount = () => { - this.getcomponentdidmount() - - } - - componentWillUnmount = () => { - axios.interceptors.request.eject(this.tpmContentRequestInterceptor); - this.tpmContentRequestInterceptor = null; - axios.interceptors.request.eject(this.tpmContentResponseInterceptor); - this.tpmContentResponseInterceptor = null; - // this.getnavdatas() - } + } + return config; + }, function (error) { + return Promise.reject(error); + }); - setLoadingContent = (isLoadingContent) => { - // this.setState({ loadingContent: isLoadingContent }) - } + // Add a response interceptor + this.tpmContentResponseInterceptor = axios.interceptors.response.use((response) => { + // console.log('loadingContent finished, url:', response.config.url) + // TODO 依赖了api这个前缀 + let url = response.config.url.split('api')[1]; + url = url.split('?')[0] + if (cacheInterceptorUrlMap[url]) { + this.setState({ loadingContent: false }) + delete cacheInterceptorUrlMap[response.url] + } + return response; + }, function (error) { + // Do something with response error + return Promise.reject(error); + }); + //右侧数据 + let shixunsDetailsURL = `/shixuns/` + id + `/show_right.json`; + axios.get(shixunsDetailsURL).then((response) => { + if (response.data) { - getnavdatas=()=>{ - let selectedKeys; - const {location} = this.props; - if(location.pathname.indexOf('/challenges')!=-1){ - selectedKeys="1" - }else if(location.pathname.indexOf('/propaedeutics')!=-1){ - selectedKeys="2" - }else if(location.pathname.indexOf('/repository')!=-1){ - selectedKeys="3" - }else if(location.pathname.indexOf('/secret_repository')!=-1){ - selectedKeys="4" - } else if(location.pathname.indexOf('/collaborators')!=-1){ - selectedKeys="5" - }else if(location.pathname.indexOf('/dataset')!=-1){ - selectedKeys="6" - }else if(location.pathname.indexOf('/shixun_discuss')!=-1){ - selectedKeys="7" - }else if(location.pathname.indexOf('/ranking_list')!=-1){ - selectedKeys="8" - }else if(location.pathname.indexOf('/settings')!=-1){ - selectedKeys="9" } this.setState({ - selectedKeys:selectedKeys - }) + TPMRightSectionData: response.data + }); + }) + this.getnavdatas() + } + componentDidMount = () => { + this.getcomponentdidmount() + + } + + componentWillUnmount = () => { + axios.interceptors.request.eject(this.tpmContentRequestInterceptor); + this.tpmContentRequestInterceptor = null; + axios.interceptors.request.eject(this.tpmContentResponseInterceptor); + this.tpmContentResponseInterceptor = null; + // this.getnavdatas() + } + + setLoadingContent = (isLoadingContent) => { + // this.setState({ loadingContent: isLoadingContent }) + } + + + getnavdatas = () => { + let selectedKeys; + const { location } = this.props; + if (location.pathname.indexOf('/challenges') != -1) { + selectedKeys = "1" + } else if (location.pathname.indexOf('/propaedeutics') != -1) { + selectedKeys = "2" + } else if (location.pathname.indexOf('/repository') != -1) { + selectedKeys = "3" + } else if (location.pathname.indexOf('/secret_repository') != -1) { + selectedKeys = "4" + } else if (location.pathname.indexOf('/collaborators') != -1) { + selectedKeys = "5" + } else if (location.pathname.indexOf('/dataset') != -1) { + selectedKeys = "6" + } else if (location.pathname.indexOf('/shixun_discuss') != -1) { + selectedKeys = "7" + } else if (location.pathname.indexOf('/ranking_list') != -1) { + selectedKeys = "8" + } else if (location.pathname.indexOf('/settings') != -1) { + selectedKeys = "9" } + this.setState({ + selectedKeys: selectedKeys + }) + } - handleClick=(e)=>{ + handleClick = (e) => { this.setState({ selectedKeys: e.key, }); let id = this.props.match.params.shixunId; - if(e.key==="1"){ + if (e.key === "1") { this.props.history.replace(`/shixuns/${id}/challenges`); - }else if(e.key==="2"){ + } else if (e.key === "2") { this.props.history.replace(`/shixuns/${id}/propaedeutics`); - }else if(e.key==="3"){ + } else if (e.key === "3") { this.props.history.replace(`/shixuns/${id}/repository`); - }else if(e.key==="4"){ + } else if (e.key === "4") { this.props.history.replace(`/shixuns/${id}/secret_repository`); - }else if(e.key==="5"){ + } else if (e.key === "5") { this.props.history.replace(`/shixuns/${id}/collaborators`); - }else if(e.key==="6"){ + } else if (e.key === "6") { this.props.history.replace(`/shixuns/${id}/dataset`); - }else if(e.key==="7"){ + } else if (e.key === "7") { this.props.history.replace(`/shixuns/${id}/shixun_discuss`); - }else if(e.key==="8"){ + } else if (e.key === "8") { this.props.history.replace(`/shixuns/${id}/ranking_list`); - }else if(e.key==="9"){ + } else if (e.key === "9") { this.props.history.replace(`/shixuns/${id}/settings`); } } - render() { - - let url = window.location.href; - let flag = url.indexOf("add_file")>-1; - - return ( -
    - {/*头部*/} - { - !flag && - - } + render() { + + let url = window.location.href; + let flag = url.indexOf("add_file") > -1; + + return ( +
    + {/*头部*/} + { + !flag && + + } - - -
    - - - - - - 任务 - - - { this.state.propaedeutics===undefined?"":this.state.propaedeutics===false?"": - 背景知识 - } - - { this.state.identity >4||this.state.identity===undefined ?"": - this.state.is_jupyter===false? - 版本库 - :""} - - {this.state.identity >4||this.state.identity===undefined ?"": this.state.secret_repository && - 私密版本库 - } - - - 合作者 - - - { this.state.identity >4||this.state.identity===undefined ? "":this.state.is_jupyter===true? - 数据集 - :""} - - { this.state.is_jupyter===false? - 评论 - :""} - - { this.state.is_jupyter===false? - 排行榜 - :""} - {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?*/} - {/* */} - {/*
    更多设置在这里,点击“配置”看一看~
    */} - {/*
    */} - {/* */} - {/* }*/} - {/* trigger="click"*/} - {/* placement="top"*/} - {/* visible={this.state.openknows}*/} - {/* >*/} - {/* */} - {/*
    :""}*/} - - {this.state.identity >4||this.state.identity===undefined ? "": - - 配置 - - } - - {this.state.identity >2||this.state.identity===undefined?"": -
    - 审核情况 -
    - } -
    - + } + + +
    + + + + + + 任务 + + + {this.state.propaedeutics === undefined ? "" : this.state.propaedeutics === false ? "" : + 背景知识 + } + + {this.state.identity > 4 || this.state.identity === undefined ? "" : + this.state.is_jupyter === false ? + 版本库 + : ""} + + {this.state.identity > 4 || this.state.identity === undefined ? "" : this.state.secret_repository && + 私密版本库 + } + + + 合作者 + + + {this.state.identity > 4 || this.state.identity === undefined ? "" : this.state.is_jupyter === true ? + 数据集 + : ""} + + {this.state.is_jupyter === false ? + 评论 + : ""} + + {this.state.is_jupyter === false ? + 排行榜 + : ""} + {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?*/} + {/* */} + {/*
    更多设置在这里,点击“配置”看一看~
    */} + {/*
    */} + {/* */} + {/* }*/} + {/* trigger="click"*/} + {/* placement="top"*/} + {/* visible={this.state.openknows}*/} + {/* >*/} + {/* */} + {/*
    :""}*/} + + {this.state.identity > 4 || this.state.identity === undefined ? "" : + + 配置 + + } + + {this.state.identity > 2 || this.state.identity === undefined ? "" : +
    + 审核情况
    - - - {/*筛选*/} - {/*{*/} - {/* tpmindexjupyterbool===false?*/} - - {/* :""*/} - {/*}*/} - {/* */} - - - - () - }> - () - }> - {/*任务*/} - () - }> - - () - }> - - () - }> - () - }> - - {/* */} - - () - }> - - - () - }> - - - {/* */} - - - (this.initForumState(data)} - setSearchValue={this.setSearchValue} - setHotLabelIndex={this.setHotLabelIndex} - />) - }> - - - () - }> - - {/*实训项目条目塞选*/} - () - }> - {/*合作者*/} - () - }> - - () - }> - - () - }> - - () - }> - - {/*评测设置*/} - () - }> - - - {/*参考答案*/} - () - }> - - {/*新建关卡*/} - () - }> - - {/*编辑关卡*/} - () - }> - - {/*新建选择题*/} - () - }> - - {/*修改选择题*/} - () - }> - - {/*修改选择题*/} - () - }> - - () - }> - + } +
    + +
    +
    + + {/*筛选*/} + {/*{*/} + {/* tpmindexjupyterbool===false?*/} + + {/* :""*/} + {/*}*/} + {/* */} + + + + () + }> + () + }> + {/*任务*/} + () + }> + + () + }> + + () + }> + () + }> + + {/* */} + + () + }> + + + () + }> + + + {/* */} + + + ( this.initForumState(data)} + setSearchValue={this.setSearchValue} + setHotLabelIndex={this.setHotLabelIndex} + />) + }> + + + () + }> + + {/*实训项目条目塞选*/} + () + }> + {/*合作者*/} + () + }> + + () + }> + + () + }> + + () + }> + + {/*评测设置*/} + () + }> + + + {/*参考答案*/} + () + }> + + {/*新建关卡*/} + () + }> + + {/*编辑关卡*/} + () + }> + + {/*新建选择题*/} + () + }> + + {/*修改选择题*/} + () + }> + + {/*修改选择题*/} + () + }> + + () + }> - {/**/} - - -
    - ); - } + + {/**/} + + +
    + ); + } } -export default SnackbarHOC() (TPMIndexHOC ( TPMIndex )); +export default SnackbarHOC()(TPMIndexHOC(TPMIndex)); diff --git a/public/react/src/modules/tpm/TPMShixunDiscuss.js b/public/react/src/modules/tpm/TPMShixunDiscuss.js index 35e476aef..d36c16628 100644 --- a/public/react/src/modules/tpm/TPMShixunDiscuss.js +++ b/public/react/src/modules/tpm/TPMShixunDiscuss.js @@ -6,7 +6,7 @@ import TPMRightSection from './component/TPMRightSection' import TPMNav from './component/TPMNav' import Comments from '../comment/Comments' -import { commentHOC } from '../comment/CommentsHOC' +import commentHOC from '../comment/CommentsHOC' import Loading from '../../components/loading'; diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index d017fe2aa..cd3f3ef69 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -1,14 +1,14 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; -import {TPMIndexHOC} from '../TPMIndexHOC'; +import TPMIndexHOC from '../TPMIndexHOC'; -import {SnackbarHOC} from 'educoder'; +import { SnackbarHOC } from 'educoder'; -import {Select, Radio, Input, Modal, Button, Form, Tooltip, Upload, Icon, notification} from 'antd'; +import { Select, Radio, Input, Modal, Button, Form, Tooltip, Upload, Icon, notification } from 'antd'; import axios from 'axios'; -import {getUploadActionUrl} from 'educoder'; +import { getUploadActionUrl } from 'educoder'; import './css/Newshixuns.css'; @@ -32,7 +32,7 @@ class Newshixuns extends Component { run_method: undefined, postapplyvisible: undefined, fileList: [], - Radiovalue:"1" + Radiovalue: "1" } } @@ -103,15 +103,15 @@ class Newshixuns extends Component { let Url = `/shixuns.json`; axios.post(Url, { - description: mdContnet, - main_type: values.main_type, - sub_type: values.sub_type, - shixun: { - name: values.name, - trainee: values.select, - is_jupyter: values.is_jupyter === "2" ? true : false, - } + description: mdContnet, + main_type: values.main_type, + sub_type: values.sub_type, + shixun: { + name: values.name, + trainee: values.select, + is_jupyter: values.is_jupyter === "2" ? true : false, } + } ).then((response) => { if (response.status === 200) { window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; @@ -126,7 +126,7 @@ class Newshixuns extends Component { loading: false }) }) - }else{ + } else { this.setState({ loading: false }) @@ -198,7 +198,7 @@ class Newshixuns extends Component { sendsure_apply = () => { - let {language, runtime, run_method} = this.state; + let { language, runtime, run_method } = this.state; if (!language || language === "") { // this.props.showNotification(`请填写该镜像是基于什么语言`); @@ -326,7 +326,7 @@ class Newshixuns extends Component { // 附件相关 START handleChange = (info) => { if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let {fileList} = this.state; + let { fileList } = this.state; if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { console.log("handleChange1"); @@ -369,7 +369,7 @@ class Newshixuns extends Component { axios.delete(url, {}) .then((response) => { if (response.data) { - const {status} = response.data; + const { status } = response.data; if (status == 0) { // console.log('--- success') @@ -392,8 +392,8 @@ class Newshixuns extends Component { } render() { - const {getFieldDecorator} = this.props.form; - const {newshixunlist, fileList, postapplytitle, postapplyvisible} = this.state; + const { getFieldDecorator } = this.props.form; + const { newshixunlist, fileList, postapplytitle, postapplyvisible } = this.state; const uploadProps = { width: 600, fileList, @@ -452,11 +452,11 @@ class Newshixuns extends Component { 新建实训项目 {this.props.user && this.props.user.main_site === true ? 实训制作指南 : ""} + target="_blank">实训制作指南 : ""}
    - + {getFieldDecorator('is_jupyter')( 普通实训 @@ -478,37 +478,37 @@ class Newshixuns extends Component { }], })( + className={"input-100-45 greyInput"} + onInput={this.shixunNameInput} autoComplete="off" + addonAfter={`${String(!this.state.shixunName ? 0 : this.state.shixunName.length)}/${this.state.NAME_COUNT}`} + className="newViewAfter" /> )} {getFieldDecorator('select', { - rules: [{required: true, message: '请选择难易度'}], + rules: [{ required: true, message: '请选择难易度' }], })(
    { - newshixunlist === undefined ? "" : this.state.Radiovalue==="2"?newshixunlist.main_type.map((item, key) => { - let itemtype=item.type_name.toLowerCase().indexOf('jupyter'.toLowerCase()) - if(itemtype>-1){ + newshixunlist === undefined ? "" : this.state.Radiovalue === "2" ? newshixunlist.main_type.map((item, key) => { + let itemtype = item.type_name.toLowerCase().indexOf('jupyter'.toLowerCase()) + if (itemtype > -1) { return ( ) } - }):"" + }) : "" } { - newshixunlist === undefined ? "" : this.state.Radiovalue==="1"?newshixunlist.main_type.map((item, key) => { - let itemtype=item.type_name.toLowerCase().indexOf('jupyter'.toLowerCase()) - if(itemtype===-1){ + newshixunlist === undefined ? "" : this.state.Radiovalue === "1" ? newshixunlist.main_type.map((item, key) => { + let itemtype = item.type_name.toLowerCase().indexOf('jupyter'.toLowerCase()) + if (itemtype === -1) { return ( ) } - }):"" + }) : "" } @@ -588,25 +588,25 @@ class Newshixuns extends Component { }
    {getFieldDecorator('sub_type')(
    @@ -692,7 +692,7 @@ class Newshixuns extends Component { className={this.state.testcoderunmodetype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"} onInput={this.setrun_method} value={this.state.run_method} - style={{height: '100px'}} + style={{ height: '100px' }} placeholder="请填写该镜像中测试代码运行方式" id="demand_info"> @@ -718,10 +718,10 @@ class Newshixuns extends Component {
  • this.sendhideModaly()} + onClick={() => this.sendhideModaly()} >取消 + className="task-btn task-btn-orange">确定
  • @@ -733,14 +733,14 @@ class Newshixuns extends Component {
    - this.handleSubmit()} loadings={this.state.loading}/> + this.handleSubmit()} loadings={this.state.loading} />
    ); } } -const NewshixunsNew = Form.create({name: 'newshixun'})(Newshixuns); +const NewshixunsNew = Form.create({ name: 'newshixun' })(Newshixuns); export default SnackbarHOC()(TPMIndexHOC(NewshixunsNew)); diff --git a/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js b/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js index 4904219bb..9d35cb74c 100644 --- a/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js @@ -1,10 +1,10 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; -import {TPMIndexHOC} from '../TPMIndexHOC'; +import TPMIndexHOC from '../TPMIndexHOC'; -import {SnackbarHOC,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; +import { SnackbarHOC, appendFileSizeToUploadFileAll, getUploadActionUrl } from 'educoder'; -import {Input, Select, Radio, Checkbox, Modal, Icon, DatePicker,Upload,Button,message,Form,notification,Tooltip} from 'antd'; +import { Input, Select, Radio, Checkbox, Modal, Icon, DatePicker, Upload, Button, message, Form, notification, Tooltip } from 'antd'; // import "antd/dist/antd.css"; @@ -14,7 +14,7 @@ import axios from 'axios'; import './css/Newshixuns.css'; -import {getUrl} from 'educoder' +import { getUrl } from 'educoder' import moment from 'moment'; @@ -35,25 +35,25 @@ const confirm = Modal.confirm; // 处理整点 半点 // 取传入时间往后的第一个半点 export function handleDateStrings(dateString) { - if (!dateString) return dateString; - const ar = dateString.split(':') - if (ar[1] == '00' || ar[1] == '30') { - return dateString - } - const miniute = parseInt(ar[1]); - if (miniute < 30 || miniute == 60) { - return [ar[0], '30'].join(':') - } - if (miniute < 60) { - // 加一个小时 - const tempStr = [ar[0], '00'].join(':'); - const format = "YYYY-MM-DD HH:mm"; - const _moment = moment(tempStr, format) - _moment.add(1, 'hours') - return _moment.format(format) - } - - return dateString + if (!dateString) return dateString; + const ar = dateString.split(':') + if (ar[1] == '00' || ar[1] == '30') { + return dateString + } + const miniute = parseInt(ar[1]); + if (miniute < 30 || miniute == 60) { + return [ar[0], '30'].join(':') + } + if (miniute < 60) { + // 加一个小时 + const tempStr = [ar[0], '00'].join(':'); + const format = "YYYY-MM-DD HH:mm"; + const _moment = moment(tempStr, format) + _moment.add(1, 'hours') + return _moment.format(format) + } + + return dateString } @@ -177,22 +177,22 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback) { } function range(start, end) { - const result = []; - for (let i = start; i < end; i++) { - result.push(i); - } - return result; + const result = []; + for (let i = start; i < end; i++) { + result.push(i); + } + return result; } function disabledDateTime() { - return { - // disabledHours: () => range(0, 24).splice(4, 20), - disabledMinutes: () => range(1, 30).concat(range(31, 60)), - // disabledSeconds: () => [0, 60], - }; + return { + // disabledHours: () => range(0, 24).splice(4, 20), + disabledMinutes: () => range(1, 30).concat(range(31, 60)), + // disabledSeconds: () => [0, 60], + }; } function disabledDate(current) { - return current && current < moment().endOf('day').subtract(1, 'days'); + return current && current < moment().endOf('day').subtract(1, 'days'); } class Newshixuns extends Component { constructor(props) { @@ -225,16 +225,16 @@ class Newshixuns extends Component { onSearchvalue: "", scope_partmenttype: false, languagewrite: undefined, - systemenvironment:undefined, - testcoderunmode:undefined, - file:undefined, - deleteisnot:true, - languagewritetype:false, - systemenvironmenttype:false, - testcoderunmodetype:false, - attachmentidstype:false, - datalisttype:false, - bottonloading:false + systemenvironment: undefined, + testcoderunmode: undefined, + file: undefined, + deleteisnot: true, + languagewritetype: false, + systemenvironmenttype: false, + testcoderunmodetype: false, + attachmentidstype: false, + datalisttype: false, + bottonloading: false } } @@ -269,7 +269,7 @@ class Newshixuns extends Component { let newshixunUrl = `/shixuns/new.json`; axios.get(newshixunUrl).then((response) => { if (response.status === 200) { - if (response.data.message===undefined) { + if (response.data.message === undefined) { this.setState({ newshixunlist: response.data }); @@ -284,18 +284,18 @@ class Newshixuns extends Component { let departmentsUrl = `/shixuns/departments.json`; axios.get(departmentsUrl).then((response) => { if (response.status === 200) { - if (response.data.message===undefined) { - this.setState({ - departmentslist: response.data.shools_name - }); - } + if (response.data.message === undefined) { + this.setState({ + departmentslist: response.data.shools_name + }); + } } }).catch((error) => { console.log(error) }); } - setlanguagewrite = (e)=>{ + setlanguagewrite = (e) => { this.setState({ languagewrite: e.target.value }) @@ -393,7 +393,7 @@ class Newshixuns extends Component { } adduse_scopeinput = () => { - let {scope_partment} = this.state; + let { scope_partment } = this.state; let array = scope_partment; let newarray = "" array.push(newarray) @@ -403,36 +403,36 @@ class Newshixuns extends Component { } shixunScopeInput = (e, id) => { - let types=false - let {scope_partment} = this.state; + let types = false + let { scope_partment } = this.state; let datalist = scope_partment; if (datalist === undefined) { datalist = [] } - datalist.map((item,key)=>{ - if(e===item){ - types=true - this.setState({ - datalisttype:true - }) - return - } - }) - - if(types===false){ - datalist.push(e) - this.setState({ - scope_partment: datalist, - onSearchvalue: "" - }); - } + datalist.map((item, key) => { + if (e === item) { + types = true + this.setState({ + datalisttype: true + }) + return + } + }) + + if (types === false) { + datalist.push(e) + this.setState({ + scope_partment: datalist, + onSearchvalue: "" + }); + } } deleteScopeInput = (key) => { - let {scope_partment} = this.state; + let { scope_partment } = this.state; let datalist = scope_partment; datalist.splice(key, 1); this.setState({ @@ -443,7 +443,7 @@ class Newshixuns extends Component { //提交数据 submit_new_shixun = () => { const mdVal = this.taskpass_editormd.getValue(); - let {can_copy, main_type, name, scope_partment, small_type, trainee, use_scope, vnc, webssh, multi_webssh, TimePickervalue} = this.state; + let { can_copy, main_type, name, scope_partment, small_type, trainee, use_scope, vnc, webssh, multi_webssh, TimePickervalue } = this.state; let Url = `/shixuns.json` if (name === "") { this.setState({ @@ -495,38 +495,38 @@ class Newshixuns extends Component { } else { newmulti_webssh = "" } - this.setState({ - bottonloading:true - }) + this.setState({ + bottonloading: true + }) axios.post(Url, { - name: name, - can_copy: can_copy, - description: mdVal, - main_type: main_type, - scope_partment: scope_partment, - small_type: small_type, - trainee: trainee, - use_scope: use_scope, - vnc: vnc, - webssh: webssh, - multi_webssh: newmulti_webssh, - task_pass: 1, - opening_time: TimePickervalue - } + name: name, + can_copy: can_copy, + description: mdVal, + main_type: main_type, + scope_partment: scope_partment, + small_type: small_type, + trainee: trainee, + use_scope: use_scope, + vnc: vnc, + webssh: webssh, + multi_webssh: newmulti_webssh, + task_pass: 1, + opening_time: TimePickervalue + } ).then((response) => { if (response.status === 200) { window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); - }else{ - this.setState({ - bottonloading:false - }) - } + } else { + this.setState({ + bottonloading: false + }) + } }).catch((error) => { console.log(error) - this.setState({ - bottonloading:false - }) + this.setState({ + bottonloading: false + }) }) } @@ -541,9 +541,9 @@ class Newshixuns extends Component { function fake() { let departmentsUrl = `/shixuns/departments.json?q=` + currentValue; axios.get(departmentsUrl).then((response) => { - if (response.data.message===undefined) { - callback(response.data.shools_name); - } + if (response.data.message === undefined) { + callback(response.data.shools_name); + } }).catch((error) => { console.log(error) }); @@ -554,7 +554,7 @@ class Newshixuns extends Component { shixunHandleSearch = (value) => { - this.shixunsfetch(value, departmentslist => this.setState({departmentslist})); + this.shixunsfetch(value, departmentslist => this.setState({ departmentslist })); this.setState({ onSearchvalue: "" @@ -567,7 +567,7 @@ class Newshixuns extends Component { }) } sendsure_apply = () => { - let {languagewrite,systemenvironment,testcoderunmode} = this.state; + let { languagewrite, systemenvironment, testcoderunmode } = this.state; // console.log("点击确定") // console.log("languagewrite"+languagewrite); // console.log("systemenvironment"+systemenvironment); @@ -579,103 +579,103 @@ class Newshixuns extends Component { // return item.response ? item.response.id : item.id // }) // } - if(languagewrite === undefined || languagewrite === "" ){ + if (languagewrite === undefined || languagewrite === "") { // this.props.showNotification(`请填写该镜像是基于什么语言`); this.setState({ - languagewritetype:true - }) + languagewritetype: true + }) return } - if(systemenvironment === undefined || systemenvironment === ""){ + if (systemenvironment === undefined || systemenvironment === "") { // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`); - this.setState({ - systemenvironmenttype:true - }) + this.setState({ + systemenvironmenttype: true + }) return; } - if(testcoderunmode === undefined || testcoderunmode === "") { + if (testcoderunmode === undefined || testcoderunmode === "") { // this.props.showNotification(`请填写该镜像中测试代码运行方式`); - this.setState({ - testcoderunmodetype:true - }) + this.setState({ + testcoderunmodetype: true + }) return; } - var attachment_ids=undefined; + var attachment_ids = undefined; if (this.state.fileList) { attachment_ids = this.state.fileList.map(item => { return item.response ? item.response.id : item.id }) } - if( attachment_ids === undefined || attachment_ids.length===0){ - - // notification.open( - // { - // message: '提示', - // description: - // '请上传附件!', - // - // } - // ) - this.setState({ - attachmentidstype:true - }) + if (attachment_ids === undefined || attachment_ids.length === 0) { + + // notification.open( + // { + // message: '提示', + // description: + // '请上传附件!', + // + // } + // ) + this.setState({ + attachmentidstype: true + }) return; } // console.log("attachment_ids"+attachment_ids); // alert(languagewrite +" "+systemenvironment +" "+testcoderunmode + " "+attachment_ids); - var data={ - language:languagewrite, - runtime:systemenvironment, - run_method:testcoderunmode, - attachment_id:attachment_ids[0], + var data = { + language: languagewrite, + runtime: systemenvironment, + run_method: testcoderunmode, + attachment_id: attachment_ids[0], } - var url =`/shixuns/apply_shixun_mirror.json`; - axios.post(url,data + var url = `/shixuns/apply_shixun_mirror.json`; + axios.post(url, data ).then((response) => { try { if (response.data) { // const { id } = response.data; // if (id) { - if(this.state.file !== undefined){ + if (this.state.file !== undefined) { console.log("549"); // this.deleteAttachment(this.state.file); this.setState({ - file:undefined, - deleteisnot:true, - languagewrite:"", - systemenvironment:"", - testcoderunmode:"", - fileList:[] + file: undefined, + deleteisnot: true, + languagewrite: "", + systemenvironment: "", + testcoderunmode: "", + fileList: [] }) - }else { + } else { this.setState({ - file:undefined, - deleteisnot:true, - languagewrite:"", - systemenvironment:"", - testcoderunmode:"", - fileList:[] + file: undefined, + deleteisnot: true, + languagewrite: "", + systemenvironment: "", + testcoderunmode: "", + fileList: [] }) } // this.props.showNotification('提交成功!'); - notification.open( - { - message: '提示', - description: - '提交成功!', - - } - ) - this.sendhideModaly() + notification.open( + { + message: '提示', + description: + '提交成功!', + + } + ) + this.sendhideModaly() // this.props.history.push(`/courses/${cid}/graduation_topics`); // } } - }catch (e) { + } catch (e) { } @@ -686,25 +686,25 @@ class Newshixuns extends Component { this.setState({ postapplyvisible: false, }) - if(this.state.file !== undefined){ + if (this.state.file !== undefined) { console.log("580"); // this.deleteAttachment(this.state.file); this.setState({ - file:undefined, - deleteisnot:true, - languagewrite:"", - systemenvironment:"", - testcoderunmode:"", - fileList:[] + file: undefined, + deleteisnot: true, + languagewrite: "", + systemenvironment: "", + testcoderunmode: "", + fileList: [] }) - }else { + } else { this.setState({ - file:undefined, - deleteisnot:true, - languagewrite:"", - systemenvironment:"", - testcoderunmode:"", - fileList:[] + file: undefined, + deleteisnot: true, + languagewrite: "", + systemenvironment: "", + testcoderunmode: "", + fileList: [] }) } } @@ -764,50 +764,50 @@ class Newshixuns extends Component { onChangeTimePicker = (value, dateString) => { this.setState({ - TimePickervalue: dateString=== ""?"":moment(handleDateStrings(dateString)) + TimePickervalue: dateString === "" ? "" : moment(handleDateStrings(dateString)) }) } - // 附件相关 START + // 附件相关 START handleChange = (info) => { - if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - let {fileList} = this.state; - - if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { - console.log("handleChange1"); - // if(fileList.length===0){ - let fileLists = info.fileList; - this.setState({ - // fileList:appendFileSizeToUploadFileAll(fileList), - fileList: fileLists, - deleteisnot: false - }); - // } - } - } + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { + let { fileList } = this.state; + + if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { + console.log("handleChange1"); + // if(fileList.length===0){ + let fileLists = info.fileList; + this.setState({ + // fileList:appendFileSizeToUploadFileAll(fileList), + fileList: fileLists, + deleteisnot: false + }); + // } + } + } } onAttachmentRemove = (file) => { - if(!file.percent || file.percent == 100){ - confirm({ - title: '确定要删除这个附件吗?', - okText: '确定', - cancelText: '取消', - // content: 'Some descriptions', - onOk: () => { - console.log("665") - this.deleteAttachment(file) - }, - onCancel() { - console.log('Cancel'); - }, - }); - return false; - } + if (!file.percent || file.percent == 100) { + confirm({ + title: '确定要删除这个附件吗?', + okText: '确定', + cancelText: '取消', + // content: 'Some descriptions', + onOk: () => { + console.log("665") + this.deleteAttachment(file) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } } deleteAttachment = (file) => { - console.log(file); - let id=file.response ==undefined ? file.id : file.response.id + console.log(file); + let id = file.response == undefined ? file.id : file.response.id const url = `/attachments/${id}.json` axios.delete(url, { }) @@ -824,7 +824,7 @@ class Newshixuns extends Component { newFileList.splice(index, 1); return { fileList: newFileList, - deleteisnot:true + deleteisnot: true }; }); } @@ -836,11 +836,11 @@ class Newshixuns extends Component { } - handleSubmit=()=>{ + handleSubmit = () => { // console.log(this.state.languagewrite) // console.log(this.state.systemenvironment) // console.log(this.state.testcoderunmode) - var attachment_ids; + var attachment_ids; if (this.state.fileList) { attachment_ids = this.state.fileList.map(item => { return item.response ? item.response.id : item.id @@ -869,7 +869,7 @@ class Newshixuns extends Component { } render() { const { getFieldDecorator } = this.props.form; - let {testcoderunmode ,systemenvironment,languagewrite,deleteisnot, fileList,TimePickervalue, scope_partmenttype, opensmail, newshixunlist, name, scope_partment, departmentslist, postapplyvisible, sendsure_applyvalue, postapplytitle, shixun_nametype, main_types, trainee_types, SelectTheCommandtype, opers, datalisttype, onSearchvalue} = this.state; + let { testcoderunmode, systemenvironment, languagewrite, deleteisnot, fileList, TimePickervalue, scope_partmenttype, opensmail, newshixunlist, name, scope_partment, departmentslist, postapplyvisible, sendsure_applyvalue, postapplytitle, shixun_nametype, main_types, trainee_types, SelectTheCommandtype, opers, datalisttype, onSearchvalue } = this.state; let options if (departmentslist != undefined) { options = this.state.departmentslist.map((d, k) => { @@ -885,7 +885,7 @@ class Newshixuns extends Component { // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUploadActionUrl()}`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file, fileList) => { @@ -897,23 +897,23 @@ class Newshixuns extends Component { const isLt150M = file.size / 1024 / 1024 < 50; if (!isLt150M) { // this.props.showNotification(`文件大小必须小于50MB`); - notification.open( - { - message: '提示', - description: - '文件大小必须小于50MB', - - } - ) + notification.open( + { + message: '提示', + description: + '文件大小必须小于50MB', + + } + ) } - if(this.state.file !== undefined){ + if (this.state.file !== undefined) { console.log("763") - this.setState({ - file:file + this.setState({ + file: file }) - }else { - this.setState({ - file:file + } else { + this.setState({ + file: file }) } @@ -950,8 +950,8 @@ class Newshixuns extends Component {

    创建实训 - {this.props.user&&this.props.user.main_site===true?实训制作指南:""} + {this.props.user && this.props.user.main_site === true ? 实训制作指南 : ""}

    @@ -968,12 +968,12 @@ class Newshixuns extends Component { placeholder="请输入实训名称,最多60个字符" size="60" type="text" - style={{width: shixun_nametype === false ? '1123px' : '93%'}} + style={{ width: shixun_nametype === false ? '1123px' : '93%' }} /> - 必填项 + 必填项
    @@ -989,8 +989,8 @@ class Newshixuns extends Component {
    - +

    @@ -1002,24 +1002,24 @@ class Newshixuns extends Component {
    *
    + // onMouseLeave={this.bigopens} + > + style={{ width: '89%', height: '100px' }} + onInput={this.setlanguagewrite} + value={languagewrite} + placeholder="请填写该镜像是基于什么语言:示例:Python" + id="demand_info"> -
    {this.state.languagewritetype===true?"请填写该镜像语言":""}
    +
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
  • + onInput={this.setsystemenvironment} + style={{ height: '100px' }} + value={systemenvironment} + placeholder="请填写该镜像是基于什么linux系统环境,代码运行环境" + id="demand_info">
  • -
    {this.state.systemenvironmenttype===true?"请填写该镜像语言系统环境":""}
    +
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
  • + onInput={this.settestcoderunmode} + value={testcoderunmode} + style={{ height: '100px' }} + placeholder="请填写该镜像中测试代码运行方式" + id="demand_info">
  • -
    {this.state.testcoderunmodetype===true?"请填写该镜像测试代码运行方式":""}
    +
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
  • -
    - - - 上传附件 - (单个文件50M以内) + + + 上传附件 + (单个文件50M以内) - -
    + +
  • -
    - {this.state.attachmentidstype===true?"请上传附件":""} -
    +
    + {this.state.attachmentidstype === true ? "请上传附件" : ""} +
  • this.sendhideModaly()} + onClick={() => this.sendhideModaly()} >取消 - +
  • @@ -1116,35 +1116,35 @@ class Newshixuns extends Component {

    新建申请已提交,请等待管理员的审核

    + className="font-17 mt10">新建申请已提交,请等待管理员的审核

  • 我们将在1-2个工作日内与您联系
  • 知道啦 + onClick={this.yeshidemodel}>知道啦
    + // onMouseLeave={this.bigopens} + >

    请在配置页面完成后续的评测脚本设置操作

    -
    +
    必填项 + id="shixun_tech_platform_notice">必填项
    @@ -1166,14 +1166,14 @@ class Newshixuns extends Component {
    无命令行窗口 (选中则不给学员的实践任务提供命令窗口) + className="color-grey-9">(选中则不给学员的实践任务提供命令窗口) 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) + className="color-grey-9">(选中则给学员提供用于练习操作的命令行窗口) 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) - + className="color-grey-9">(选中则给学员提供用于关卡评测的命令行窗口) + 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) @@ -1186,19 +1186,19 @@ class Newshixuns extends Component {
    对所有公开 (选中则所有已被试用授权的用户可以学习) + className="color-grey-9">(选中则所有已被试用授权的用户可以学习) 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) + className="color-grey-9">(选中则下方指定单位的已被试用授权的用户可以学习)
    + style={{ display: this.state.scopetype === false ? 'none' : 'block' }}>
    -
    +
    (搜索选中添加单位名称) - {this.state.datalisttype===true?请勿选择重复单位:""} + {this.state.datalisttype === true ? 请勿选择重复单位 : ""} {/*+ 添加*/}
    -
    +
    { scope_partment === undefined ? "" : scope_partment.map((item, key) => { return (
  • {item} - this.deleteScopeInput(key)}>× + this.deleteScopeInput(key)}>×
  • ) }) @@ -1252,9 +1252,9 @@ class Newshixuns extends Component {
    - - 请选择需要公开的单位 + id="public_unit_notice"> + + 请选择需要公开的单位
    @@ -1265,18 +1265,18 @@ class Newshixuns extends Component {

    发布信息

    + // onMouseLeave={this.bigopens} + >
    *面向学员:
    实训难易度定位,不限定用户群体 -
    +
    必填项 + className="fa fa-exclamation-circle mr3">必填项
  • 复制: + style={{ "width": "86px" }}>复制: - +
  • 开启时间: + style={{ "width": "86px" }}>开启时间:
  • -
  • @@ -1332,8 +1332,8 @@ class Newshixuns extends Component {
    - 取消
    diff --git a/public/react/src/modules/tpm/shixunchild/Shixunfork_list.js b/public/react/src/modules/tpm/shixunchild/Shixunfork_list.js index f813441f1..553f6f2f7 100644 --- a/public/react/src/modules/tpm/shixunchild/Shixunfork_list.js +++ b/public/react/src/modules/tpm/shixunchild/Shixunfork_list.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { Redirect } from 'react-router'; -import { BrowserRouter as Router, Route, Link} from "react-router-dom"; +import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import { Switch } from 'antd'; @@ -9,15 +9,15 @@ import PropTypes from 'prop-types'; import classNames from 'classnames' -import { TPMIndexHOC } from '../TPMIndexHOC' +import TPMIndexHOC from '../TPMIndexHOC' import { SnackbarHOC } from 'educoder' import ShixunCard from '.././shixuns/ShixunCard'; -import { Pagination,Row,Col,Rate } from 'antd'; +import { Pagination, Row, Col, Rate } from 'antd'; - import './shixunchildCss/Shixunfork_list.css'; +import './shixunchildCss/Shixunfork_list.css'; import 'antd/lib/rate/style/index.css'; @@ -29,41 +29,41 @@ class Shixunforklist extends Component { this.state = { } - } + } - handleChange = (value) => { - console.log('Page: ', value); - // this.setState({ value }); - } + handleChange = (value) => { + console.log('Page: ', value); + // this.setState({ value }); + } //JSX - render() { + render() { const { match, history } = this.props - return ( -
    + return ( +
    -
    - Fork实训列表 - 返回 -
    +
    + Fork实训列表 + 返回 +
    - + -
    -
    -
      +
      +
      +
        -
      -
      -
      +
    +
    +
    +
    -
    -
    - ); - } +
    + ); + } } -export default SnackbarHOC() (TPMIndexHOC ( Shixunforklist )); +export default SnackbarHOC()(TPMIndexHOC(Shixunforklist)); diff --git a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js index 82fa6a3f9..fddd8a03e 100644 --- a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js +++ b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js @@ -8,7 +8,7 @@ import axios from 'axios'; import { Spin } from 'antd'; -import { TPMIndexHOC } from '../TPMIndexHOC'; +import TPMIndexHOC from '../TPMIndexHOC'; import { SnackbarHOC } from 'educoder'; @@ -27,89 +27,89 @@ const $ = window.$; class ShixunsIndex extends Component { constructor(props) { super(props) - this.state={ + this.state = { order_by: "new", - page:1, - limit:16, - keyword:"", - status:0, - diff:0, + page: 1, + limit: 16, + keyword: "", + status: 0, + diff: 0, tag_level: 1, - tag_id:'', - middleshixundata:[], - typepvisible:true, - pages:1, - search_tags:null, - parsedid:undefined, - newtag_level:undefined, - newpalce:undefined, - sort:"desc" + tag_id: '', + middleshixundata: [], + typepvisible: true, + pages: 1, + search_tags: null, + parsedid: undefined, + newtag_level: undefined, + newpalce: undefined, + sort: "desc" } } - componentDidMount(){ + componentDidMount() { - const upsystem=`/users/system_update.json`; - axios.get(upsystem).then((response)=>{ - let updata=response.data; - this.setState({ - updata:updata - }) - }).catch((error)=>{ - console.log(error); - }) + const upsystem = `/users/system_update.json`; + axios.get(upsystem).then((response) => { + let updata = response.data; + this.setState({ + updata: updata + }) + }).catch((error) => { + console.log(error); + }) - let _keyword; + let _keyword; if (window.__headSearchKeyword) { this.setState({ keyword: window.__headSearchKeyword }) _keyword = window.__headSearchKeyword delete window.__headSearchKeyword } const parsed = queryString.parse(this.props.location.search); - if(parsed.id===undefined&&parsed.type===undefined){ - let {order_by, tag_level, tag_id, page, limit, keyword, status, diff} = this.state; - let params={ - order_by:order_by, - tag_level:tag_level, - tag_id:tag_id, - page:page, - limit:limit, - keyword: _keyword || keyword , - status:status, - diff:diff, + if (parsed.id === undefined && parsed.type === undefined) { + let { order_by, tag_level, tag_id, page, limit, keyword, status, diff } = this.state; + let params = { + order_by: order_by, + tag_level: tag_level, + tag_id: tag_id, + page: page, + limit: limit, + keyword: _keyword || keyword, + status: status, + diff: diff, sort: "desc" } this.shixunresultend(params); - }else{ - let {order_by,page, limit, keyword, status, diff} = this.state; - let nawparsed=parsed.type; - let newpalce=parsed.palce; - if(nawparsed==="rep"){ - nawparsed=1 + } else { + let { order_by, page, limit, keyword, status, diff } = this.state; + let nawparsed = parsed.type; + let newpalce = parsed.palce; + if (nawparsed === "rep") { + nawparsed = 1 } - else if(nawparsed==="sub"){ - nawparsed=2 - }else if(nawparsed==="tag"){ - nawparsed=3 + else if (nawparsed === "sub") { + nawparsed = 2 + } else if (nawparsed === "tag") { + nawparsed = 3 } - let params={ - order_by:order_by, - tag_level:nawparsed, - tag_id:parsed.id, - page:page, - limit:limit, + let params = { + order_by: order_by, + tag_level: nawparsed, + tag_id: parsed.id, + page: page, + limit: limit, keyword: _keyword || keyword, - status:status, - diff:diff, + status: status, + diff: diff, sort: "desc" } this.setState({ - parsedid:parsed.id, - newtag_level:nawparsed, - tag_level:nawparsed, - newpalce:newpalce, - tag_id:parsed.id, + parsedid: parsed.id, + newtag_level: nawparsed, + tag_level: nawparsed, + newpalce: newpalce, + tag_id: parsed.id, keyword: _keyword || keyword, }) this.shixunresultend(params); @@ -117,221 +117,221 @@ class ShixunsIndex extends Component { } - allUpdatashixunlist=()=>{ - let{sort,order_by}=this.state; + allUpdatashixunlist = () => { + let { sort, order_by } = this.state; this.setState({ tag_level: 1, - tag_id:'', + tag_id: '', page: 1, limit: 16, - keyword:'', + keyword: '', status: 0, diff: 0, }) - let params={ - order_by:order_by, + let params = { + order_by: order_by, tag_level: 1, - tag_id:'', + tag_id: '', page: 1, limit: 16, - keyword:'', + keyword: '', status: 0, diff: 0, - sort:sort + sort: sort } this.shixunresultend(params) } - Updatasearchlist=(value)=>{ + Updatasearchlist = (value) => { if (value[1].tag_id === " ") { this.setState({ keyword: "" }) } this.setState({ - tag_level:value[0].tag_level, - tag_id:value[1].tag_id, - typepvisible:true + tag_level: value[0].tag_level, + tag_id: value[1].tag_id, + typepvisible: true }) - let {order_by, sort, limit, keyword, status, diff} = this.state; - - let params={ - order_by:order_by, - tag_level:value[0].tag_level, - tag_id:value[1].tag_id, - page:1, - limit:limit, - keyword:keyword, - status:status, - diff:diff, - sort:sort + let { order_by, sort, limit, keyword, status, diff } = this.state; + + let params = { + order_by: order_by, + tag_level: value[0].tag_level, + tag_id: value[1].tag_id, + page: 1, + limit: limit, + keyword: keyword, + status: status, + diff: diff, + sort: sort } this.shixunresultend(params) } - StatusEnquiry=(key)=>{ + StatusEnquiry = (key) => { - let Vrl=`/shixuns.json`; + let Vrl = `/shixuns.json`; let newstatus; let newdiff; - if(key[0].type===1){ + if (key[0].type === 1) { this.setState({ status: key[1].value, - typepvisible:true + typepvisible: true }) - newstatus=key[1].value; - newdiff=this.state.diff; - }else if(key[0].type===2){ + newstatus = key[1].value; + newdiff = this.state.diff; + } else if (key[0].type === 2) { this.setState({ diff: key[1].value, - typepvisible:true + typepvisible: true }) - newdiff=key[1].value; - newstatus=this.state.status; + newdiff = key[1].value; + newstatus = this.state.status; } - let params= { - order_by:this.state.order_by, - tag_level:this.state.tag_level, - tag_id:this.state.tag_id, - page:1, - limit:this.state.limit, - keyword:this.state.keyword, - status:newstatus, - diff:newdiff, + let params = { + order_by: this.state.order_by, + tag_level: this.state.tag_level, + tag_id: this.state.tag_id, + page: 1, + limit: this.state.limit, + keyword: this.state.keyword, + status: newstatus, + diff: newdiff, } this.shixunresultend(params) } - OnSearchInput=(value,type)=>{ - if(type===true){ - this.setState({ - keyword:value, - typepvisible:true, - pages:1 - }) - let {order_by, tag_level, tag_id, sort, limit, status, diff} = this.state; - let params= { - order_by:order_by, - tag_level:tag_level, - tag_id:tag_id, - page:1, - limit:limit, - keyword:value, - status:status, - diff:diff, - sort:sort + OnSearchInput = (value, type) => { + if (type === true) { + this.setState({ + keyword: value, + typepvisible: true, + pages: 1 + }) + let { order_by, tag_level, tag_id, sort, limit, status, diff } = this.state; + let params = { + order_by: order_by, + tag_level: tag_level, + tag_id: tag_id, + page: 1, + limit: limit, + keyword: value, + status: status, + diff: diff, + sort: sort + } + this.shixunresultend(params) + } else { + this.setState({ + keyword: value, + pages: 1 + }) } - this.shixunresultend(params) - }else{ - this.setState({ - keyword:value, - pages:1 - }) - } } - ShixunsSwitch=()=>{ + ShixunsSwitch = () => { //types this.setState({ - order_by:"mine", - typepvisible:true, - pages:1, + order_by: "mine", + typepvisible: true, + pages: 1, }) - let{tag_level,tag_id,page,limit,keyword,status,diff,sort}=this.state; - let newsort=sort; - if(newsort===undefined){ - newsort="desc" + let { tag_level, tag_id, page, limit, keyword, status, diff, sort } = this.state; + let newsort = sort; + if (newsort === undefined) { + newsort = "desc" } - let params= { - order_by:"mine", - tag_level:tag_level, - tag_id:tag_id, - page:1, - limit:limit, - keyword:keyword, - status:status, - diff:diff, - sort:newsort + let params = { + order_by: "mine", + tag_level: tag_level, + tag_id: tag_id, + page: 1, + limit: limit, + keyword: keyword, + status: status, + diff: diff, + sort: newsort } this.shixunresultend(params) } - shixunsPage=(value)=>{ + shixunsPage = (value) => { this.setState({ - page:value, - typepvisible:true, - pages:value + page: value, + typepvisible: true, + pages: value }) - let {order_by, tag_level, tag_id, limit, keyword, status, diff,sort} = this.state; - let params= { - order_by:order_by, - tag_level:tag_level, - tag_id:tag_id, - page:value, - limit:limit, - keyword:keyword, - status:status, - diff:diff, - sort:sort + let { order_by, tag_level, tag_id, limit, keyword, status, diff, sort } = this.state; + let params = { + order_by: order_by, + tag_level: tag_level, + tag_id: tag_id, + page: value, + limit: limit, + keyword: keyword, + status: status, + diff: diff, + sort: sort } - let Url=`/shixuns.json`; - axios.get(Url,{ + let Url = `/shixuns.json`; + axios.get(Url, { params - }).then((response)=> { - if(response.status===200){ + }).then((response) => { + if (response.status === 200) { this.setState({ middleshixundata: response.data, - typepvisible:false, + typepvisible: false, }); } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }); } - ShixunsState=(val,type,sorts)=>{ + ShixunsState = (val, type, sorts) => { // sort, - let {tag_level, tag_id, page, limit, keyword, status, diff,sort} = this.state; - let newsort=sorts?sorts:sort; + let { tag_level, tag_id, page, limit, keyword, status, diff, sort } = this.state; + let newsort = sorts ? sorts : sort; this.setState({ - order_by:type, - typepvisible:true, - pages:1, - sort:sorts?sorts:sort + order_by: type, + typepvisible: true, + pages: 1, + sort: sorts ? sorts : sort }) let params // let vals=false - if(newsort===undefined){ - newsort="desc" - }else{ - newsort=sorts?sorts:sort - } - params= { - order_by:type, - tag_level:tag_level, - tag_id:tag_id, - page:1, - limit:limit, - keyword:keyword, - status:status, - diff:diff, - sort:newsort + if (newsort === undefined) { + newsort = "desc" + } else { + newsort = sorts ? sorts : sort + } + params = { + order_by: type, + tag_level: tag_level, + tag_id: tag_id, + page: 1, + limit: limit, + keyword: keyword, + status: status, + diff: diff, + sort: newsort } this.shixunresultend(params) } - Shixunsupcircles=(sort)=>{ + Shixunsupcircles = (sort) => { console.log(sort) this.setState({ - sort:sort + sort: sort }) let { order_by, @@ -345,16 +345,16 @@ class ShixunsIndex extends Component { - let params= { - order_by:order_by, - tag_level:tag_level, - tag_id:tag_id, - page:1, - limit:limit, - keyword:keyword, - status:status, - diff:diff, - sort:sort + let params = { + order_by: order_by, + tag_level: tag_level, + tag_id: tag_id, + page: 1, + limit: limit, + keyword: keyword, + status: status, + diff: diff, + sort: sort } this.shixunresultend(params) } @@ -362,69 +362,69 @@ class ShixunsIndex extends Component { - shixunresultend=(params)=>{ - let Url=`/shixuns.json`; - axios.get(Url,{ + shixunresultend = (params) => { + let Url = `/shixuns.json`; + axios.get(Url, { params - }).then((response)=> { + }).then((response) => { // TODO 有keyword返回值时 显示一共有多少条记录 - if(response.status===200){ + if (response.status === 200) { this.setState({ - search_tags:response.data.search_tags, + search_tags: response.data.search_tags, middleshixundata: response.data, - typepvisible:false, - pages:1 + typepvisible: false, + pages: 1 }); } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }); } render() { - let {middleshixundata, typepvisible, pages, search_tags, keyword,parsedid,newtag_level,newpalce} = this.state; + let { middleshixundata, typepvisible, pages, search_tags, keyword, parsedid, newtag_level, newpalce } = this.state; // console.log(this.state.updata) return (
    - {this.state.updata===undefined?"":} + {this.state.updata === undefined ? "" : } {/**/} - - - - {/*下方图片*/} - + + + + {/*下方图片*/} + {/**/}
    ); } } -export default SnackbarHOC() (TPMIndexHOC ( ShixunsIndex )); +export default SnackbarHOC()(TPMIndexHOC(ShixunsIndex)); diff --git a/public/react/src/modules/user/AccountPage.js b/public/react/src/modules/user/AccountPage.js index 42a323dfd..179e5febb 100644 --- a/public/react/src/modules/user/AccountPage.js +++ b/public/react/src/modules/user/AccountPage.js @@ -1,86 +1,86 @@ import React, { Component } from 'react'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; -import {CNotificationHOC} from '../courses/common/CNotificationHOC' +import { Route, Switch } from "react-router-dom"; +import CNotificationHOC from '../courses/common/CNotificationHOC' import Loading from '../../Loading'; import Loadable from 'react-loadable'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import TPMIndexHOC from '../tpm/TPMIndexHOC'; -import { SnackbarHOC, getImageUrl } from 'educoder'; +import { SnackbarHOC } from 'educoder'; import AccountNav from './account/AccountNav' import axios from 'axios' -const AccountBasic= Loadable({ +const AccountBasic = Loadable({ loader: () => import('./account/AccountBasic'), loading: Loading, }) -const AccountBasicEdit= Loadable({ +const AccountBasicEdit = Loadable({ loader: () => import('./account/AccountBasicEdit'), loading: Loading, }) -const AccountCertification= Loadable({ +const AccountCertification = Loadable({ loader: () => import('./account/AccountCertification'), loading: Loading, }) -const AccountSecure= Loadable({ +const AccountSecure = Loadable({ loader: () => import('./account/AccountSecure'), loading: Loading, }) -const AccountBinding= Loadable({ - loader: () => import('./account/AccountBinding'), - loading: Loading, +const AccountBinding = Loadable({ + loader: () => import('./account/AccountBinding'), + loading: Loading, }) class AccountPage extends Component { - constructor (props) { + constructor(props) { super(props) this.state = { basicInfo: {} } } - componentDidUpdate =(prevState)=>{ - if(this.props.current_user && this.props.current_user != prevState.current_user){ + componentDidUpdate = (prevState) => { + if (this.props.current_user && this.props.current_user != prevState.current_user) { this.getBasicInfo(this.props.current_user.login); } } - componentDidMount = () =>{ - if(this.props.current_user){ + componentDidMount = () => { + if (this.props.current_user) { this.getBasicInfo(this.props.current_user.login); } } - getBasicInfo=(login)=>{ - let url=`/users/accounts/${login || this.props.current_user.login}.json`; - axios.get(url).then((result)=>{ - if(result.data){ - if(result.data && result.data.base_info_completed == false){ + getBasicInfo = (login) => { + let url = `/users/accounts/${login || this.props.current_user.login}.json`; + axios.get(url).then((result) => { + if (result.data) { + if (result.data && result.data.base_info_completed == false) { this.props.history.push(`/account/profile/edit`); } // "authentication": "uncertified", // "uncertified" | "applying" | "certified" this.setState({ - basicInfo: Object.assign({}, {...result.data}, { - avatar_url: `${result.data.avatar_url}`, - gender: result.data.gender == null || result.data.gender == undefined ? 0 : result.data.gender - }) + basicInfo: Object.assign({}, { ...result.data }, { + avatar_url: `${result.data.avatar_url}`, + gender: result.data.gender == null || result.data.gender == undefined ? 0 : result.data.gender + }) }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } - render() { - let { basicInfo }=this.state; - const common = { basicInfo, getBasicInfo : this.getBasicInfo } - return ( -
    -
    - - -
    - - () - } - > - - () - } - > - - () - } - > - - () - } - > - - () - } - > - - (this.getBasicInfo()} {...this.props} {...props} {...this.state} {...common} />) - } - > - - - -
    -
    + +
    + + () + } + > + + () + } + > + + () + } + > + + () + } + > + + () + } + > + + ( this.getBasicInfo()} {...this.props} {...props} {...this.state} {...common} />) + } + > + + +
    - ); - } +
    +
    + ); + } } -export default CNotificationHOC()(SnackbarHOC() ( TPMIndexHOC ( AccountPage ))); +export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(AccountPage))); diff --git a/public/react/src/modules/user/LoginRegisterPage.js b/public/react/src/modules/user/LoginRegisterPage.js index 8990f1d78..1478f2f90 100644 --- a/public/react/src/modules/user/LoginRegisterPage.js +++ b/public/react/src/modules/user/LoginRegisterPage.js @@ -1,30 +1,22 @@ import React, { Component } from 'react'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import Loading from '../../Loading'; - -import Loadable from 'react-loadable'; - -// import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; - -import { SnackbarHOC, getImageUrl } from 'educoder'; +import { SnackbarHOC } from 'educoder'; import LoginRegisterComponent from './LoginRegisterComponent'; import FindPasswordComponent from './FindPasswordComponent'; class LoginRegisterPage extends Component { - render() { - // newMain clearfix - return ( -
    - - -

    -

    - -
    - ); - } + render() { + // newMain clearfix + return ( +
    + + +

    +

    + +
    + ); + } } -export default SnackbarHOC() ( ( LoginRegisterPage )); +export default SnackbarHOC()((LoginRegisterPage)); diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index 50d9e7300..b2949be16 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -1,62 +1,58 @@ import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip, Menu, Pagination, Spin, Dropdown} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; +import { Tooltip, Menu, Pagination, Spin, Dropdown } from 'antd'; import axios from 'axios'; import NoneData from '../../courses/coursesPublic/NoneData' -import {getImageUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import { getImageUrl } from 'educoder'; import "./usersInfo.css" import Create from './publicCreatNew' -class InfosCourse extends Component{ - constructor(props){ +class InfosCourse extends Component { + constructor(props) { super(props); - this.state={ - category:undefined, - status:undefined, - page:1, - per_page:16, + this.state = { + category: undefined, + status: undefined, + page: 1, + per_page: 16, sort_by: "updated_at", sort_direction: "desc", - totalCount:undefined, - data:undefined, - isSpin:false + totalCount: undefined, + data: undefined, + isSpin: false } } - componentDidMount=()=>{ + componentDidMount = () => { this.setState({ - isSpin:true + isSpin: true }) - let {category, status, page, sort_by, sort_direction} = this.state; + let { category, status, page, sort_by, sort_direction } = this.state; this.getCourses(category, status, page, sort_by, sort_direction); } getCourses = (category, status, page, sort_by, sort_direction) => { - let url=`/users/${this.props.match.params.username}/courses.json`; - axios.get((url),{params:{ - category, - status, - page, + let url = `/users/${this.props.match.params.username}/courses.json`; + axios.get((url), { + params: { + category, + status, + page, sort_by, sort_direction, - per_page: this.props.is_current && category && page ==1?17:16 - }}).then((result)=>{ - if(result){ + per_page: this.props.is_current && category && page == 1 ? 17 : 16 + } + }).then((result) => { + if (result) { console.log("请求成功"); this.setState({ - totalCount:result.data.count, - data:result.data, + totalCount: result.data.count, + data: result.data, sort_direction: sort_direction, sort_by: sort_by, - isSpin:false + isSpin: false }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); this.setState({ isSpin: false @@ -65,38 +61,38 @@ class InfosCourse extends Component{ } //切换种类 - changeCategory=(cate)=>{ + changeCategory = (cate) => { this.setState({ - category:cate, - page:1, - isSpin:true + category: cate, + page: 1, + isSpin: true }) - let {status, sort_by, sort_direction} = this.state; + let { status, sort_by, sort_direction } = this.state; this.getCourses(cate, status, 1, sort_by, sort_direction); } //切换状态 - changeStatus=(status)=>{ + changeStatus = (status) => { this.setState({ - status:status, - page:1, - isSpin:true + status: status, + page: 1, + isSpin: true }) - let {category, sort_by, sort_direction} = this.state; + let { category, sort_by, sort_direction } = this.state; this.getCourses(category, status, 1, sort_by, sort_direction); } //切换页数 - changePage=(page)=>{ + changePage = (page) => { this.setState({ page, - isSpin:true + isSpin: true }) - let {category, status, sort_by, sort_direction} = this.state; + let { category, status, sort_by, sort_direction } = this.state; this.getCourses(category, status, page, sort_by, sort_direction); } // 进入课堂 - turnToCourses=(url,flag)=>{ - if(flag){ + turnToCourses = (url, flag) => { + if (flag) { this.props.history.push(url); } } @@ -106,7 +102,7 @@ class InfosCourse extends Component{ this.setState({ isSpin: true }); - let {category, status, page, sort_direction} = this.state; + let { category, status, page, sort_direction } = this.state; this.getCourses(category, status, 1, sort_by, "desc"); } @@ -119,7 +115,7 @@ class InfosCourse extends Component{ isSpin: true }); - let {category, status, page, sort_by, sort_direction} = this.state; + let { category, status, page, sort_by, sort_direction } = this.state; let sort_directiony = sort_directions; if (sort_directions === "asc") { if (sort_directions === sort_direction) { @@ -134,8 +130,8 @@ class InfosCourse extends Component{ this.getCourses(category, status, page, sort_by, sort_directiony); } - render(){ - let{ + render() { + let { category, status, page, @@ -145,9 +141,9 @@ class InfosCourse extends Component{ sort_by, sort_direction } = this.state; - let is_current=this.props.is_current; + let is_current = this.props.is_current; - // console.log(this.props.current_user&&this.props.current_user.user_identity==="学生") + // console.log(this.props.current_user&&this.props.current_user.user_identity==="学生") const menu = ( this.updatedlist("updated_at")}> @@ -161,7 +157,7 @@ class InfosCourse extends Component{ ); console.log("InfosCourse"); console.log(status); - return( + return (
    - + - { - is_current && - - } -

    +

  • this.changeStatus()} + className="w32">全部
  • +
  • this.changeStatus("processing")} className="w66">正在进行
  • +
  • this.changeStatus("end")} className="w66">已结束
  • +
    + } +

    - 共参与{totalCount}个{category?category=="manage"?"发布":"学习":"课堂"} + 共参与{totalCount}个{category ? category == "manage" ? "发布" : "学习" : "课堂"} - - this.updatedlists("asc", 1)}> + + this.updatedlists("asc", 1)}> - + - this.updatedlists("desc", 2)}> - + this.updatedlists("desc", 2)}> + - - {sort_by === "updated_at" ? '最新动态' : sort_by === "created_at" ? '最新创建' : ""} + + {sort_by === "updated_at" ? '最新动态' : sort_by === "created_at" ? '最新创建' : ""} - + -

    +

    -
    - {/* 289 */} - { - page == 1 && is_current && !category && - this.props.current_user && this.props.current_user.user_identity != "学生" ? - : "" - } - { - (!data || (data && data.courses.length === 0)) && (category || (!category && this.props.current_user && this.props.current_user.user_identity == "学生")) && - } - { - data && data.courses && data.courses.map((item,key)=>{ - return( -
    this.turnToCourses(`${item.first_category_url}`,item.can_visited)} style={{"cursor": "pointer",height:"289px"}}> - { - item.is_public == 1 && - -
    - - 公开 -
    - } - { - item.can_visited ==false? -
    - -

    非成员不能访问

    -
    :"" - } +
    + {/* 289 */} + { + page == 1 && is_current && !category && + this.props.current_user && this.props.current_user.user_identity != "学生" ? + : "" + } + { + (!data || (data && data.courses.length === 0)) && (category || (!category && this.props.current_user && this.props.current_user.user_identity == "学生")) && + } + { + data && data.courses && data.courses.map((item, key) => { + return ( +
    this.turnToCourses(`${item.first_category_url}`, item.can_visited)} style={{ "cursor": "pointer", height: "289px" }}> + { + item.is_public == 1 && + +
    + + 公开 +
    + } + { + item.can_visited == false ? +
    + +

    非成员不能访问

    +
    : "" + } -
    -

    - {item.name} -

    - 用户 -

    {item.teacher && item.teacher.real_name}

    -

    {item&&item.school}

    -
    -
    -
    - {item.visits>0? - - {item.visits} - +
    +

    + {item.name} +

    + 用户 +

    {item.teacher && item.teacher.real_name}

    +

    {item && item.school}

    +
    +
    +
    + {item.visits > 0 ? + + {item.visits} + - :""} + : ""} - { - item.members_count > 0 && - - - {item.members_count} - - } - { - item.homework_commons_count > 0 && - - - {item.homework_commons_count} - - } - {/*{*/} + { + item.members_count > 0 && + + + {item.members_count} + + } + { + item.homework_commons_count > 0 && + + + {item.homework_commons_count} + + } + {/*{*/} {/*item.attachments_count > 0 && */} {/**/} - {/**/} - {/*{item.attachments_count}*/} + {/**/} + {/*{item.attachments_count}*/} {/**/} - {/*}*/} + {/*}*/} +
    -
    - ) - }) - } -
    - { - totalCount > 15 && -
    - + ) + }) + }
    - } + { + totalCount > 15 && +
    + +
    + }
    ) diff --git a/public/react/src/modules/user/usersInfo/InfosIndex.js b/public/react/src/modules/user/usersInfo/InfosIndex.js index 89d69ab5d..4c6273820 100644 --- a/public/react/src/modules/user/usersInfo/InfosIndex.js +++ b/public/react/src/modules/user/usersInfo/InfosIndex.js @@ -1,90 +1,89 @@ import React, { Component } from 'react'; -import {Link} from 'react-router-dom'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import { Route, Switch } from 'react-router-dom'; import { SnackbarHOC } from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import TPMIndexHOC from '../../tpm/TPMIndexHOC'; +import CNotificationHOC from '../../courses/common/CNotificationHOC' import Loadable from 'react-loadable'; import Loading from '../../../Loading'; const UsersInfo = Loadable({ - loader: () => import('./Infos'), - loading: Loading, + loader: () => import('./Infos'), + loading: Loading, }) const VideoUploadList = Loadable({ - loader: () => import('./video/VideoUploadList'), - loading: Loading, + loader: () => import('./video/VideoUploadList'), + loading: Loading, }) const VideoPublishSuccess = Loadable({ - loader: () => import('./video/VideoPublishSuccess'), - loading: Loading, + loader: () => import('./video/VideoPublishSuccess'), + loading: Loading, }) const VideoProtocol = Loadable({ - loader: () => import('./video/VideoProtocol'), - loading: Loading, + loader: () => import('./video/VideoProtocol'), + loading: Loading, }) const $ = window.$; -class InfosIndex extends Component{ - constructor(props){ +class InfosIndex extends Component { + constructor(props) { super(props); - this.state={ - data:undefined, + this.state = { + data: undefined, } } - componentDidMount =()=>{ - + componentDidMount = () => { + } //判断是否看的是当前用户的个人主页 - componentDidUpdate =(prevProps)=> { - + componentDidUpdate = (prevProps) => { + } - render(){ - let { - data , - }=this.state; - return( - - - {/* --------------------------------------------------------------------- */} - - - {/* 视频发布 */} - () - } - > - () - } - > - () - } - > - - - - - - - () - } - > - - + render() { + let { + data, + } = this.state; + return ( + + + {/* --------------------------------------------------------------------- */} + + + {/* 视频发布 */} + () + } + > + () + } + > + () + } + > + + + + + + + () + } + > + + ) } } -export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(InfosIndex) )); \ No newline at end of file +export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(InfosIndex))); \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index c3a1aaa23..c82d1258d 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -1,62 +1,58 @@ import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip, Menu, Pagination, Spin, Dropdown} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; +import { Tooltip, Menu, Pagination, Spin, Dropdown } from 'antd'; import NoneData from '../../courses/coursesPublic/NoneData' import axios from 'axios'; -import {getImageUrl,setImagesUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import { getImageUrl } from 'educoder'; import "./usersInfo.css" import Create from './publicCreatNew' -class InfosPath extends Component{ - constructor(props){ +class InfosPath extends Component { + constructor(props) { super(props); - this.state={ - category:undefined, - page:1, - status:undefined, - per_page:16, - isSpin:false, + this.state = { + category: undefined, + page: 1, + status: undefined, + per_page: 16, + isSpin: false, sort_by: "updated_at", sort_direction: "desc", - totalCount:undefined, - data:undefined + totalCount: undefined, + data: undefined } } - componentDidMount=()=>{ + componentDidMount = () => { this.setState({ - isSpin:true + isSpin: true }) - let {category, status, sort_by, page, per_page, sort_direction} = this.state; + let { category, status, sort_by, page, per_page, sort_direction } = this.state; this.getCourses(category, status, sort_by, page, sort_direction); } getCourses = (category, status, sort_by, page, sort_direction) => { - let url=`/users/${this.props.match.params.username}/subjects.json`; - axios.get((url),{params:{ - category, - status, - sort_by, - page, + let url = `/users/${this.props.match.params.username}/subjects.json`; + axios.get((url), { + params: { + category, + status, + sort_by, + page, sort_direction, - per_page:this.props.is_current && category && page ==1?17:16 - }}).then((result)=>{ - if(result){ + per_page: this.props.is_current && category && page == 1 ? 17 : 16 + } + }).then((result) => { + if (result) { this.setState({ - totalCount:result.data.count, - data:result.data, + totalCount: result.data.count, + data: result.data, sort_by: sort_by, sort_direction: sort_direction, - isSpin:false + isSpin: false }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); this.setState({ isSpin: false @@ -65,49 +61,49 @@ class InfosPath extends Component{ } //切换种类 - changeCategory=(cate)=>{ + changeCategory = (cate) => { this.setState({ - category:cate, - status:undefined, - page:1, - isSpin:true + category: cate, + status: undefined, + page: 1, + isSpin: true }) - let {sort_by, sort_direction} = this.state; + let { sort_by, sort_direction } = this.state; this.getCourses(cate, undefined, sort_by, 1, sort_direction); } // 切换状态 - changeStatus=(status)=>{ - let {category, sort_by, sort_direction} = this.state; + changeStatus = (status) => { + let { category, sort_by, sort_direction } = this.state; this.setState({ status, - page:1, - isSpin:true + page: 1, + isSpin: true }) this.getCourses(category, status, sort_by, 1, sort_direction); } //切换页数 - changePage=(page)=>{ + changePage = (page) => { this.setState({ page, - isSpin:true + isSpin: true }) - let {category, sort_by, status, sort_direction} = this.state; + let { category, sort_by, status, sort_direction } = this.state; this.getCourses(category, status, sort_by, page, sort_direction); } // 进入课堂 - turnToCourses=(url)=>{ + turnToCourses = (url) => { this.props.history.push(url); } // 切换排序方式 - changeOrder= (sort)=>{ + changeOrder = (sort) => { this.setState({ - sort_by:sort, - isSpin:true + sort_by: sort, + isSpin: true }) - let {category, status, page, sort_direction} = this.state; + let { category, status, page, sort_direction } = this.state; this.getCourses(category, status, sort, page, sort_direction); } @@ -118,7 +114,7 @@ class InfosPath extends Component{ this.setState({ isSpin: true }); - let {category, status, page, sort_direction} = this.state; + let { category, status, page, sort_direction } = this.state; this.getCourses(category, status, sort_by, 1, "desc"); } @@ -128,7 +124,7 @@ class InfosPath extends Component{ this.setState({ isSpin: true }); - let {category, status, page, sort_by, sort_direction} = this.state; + let { category, status, page, sort_by, sort_direction } = this.state; let sort_directiony = sort_directions; if (sort_directions === "asc") { if (sort_directions === sort_direction) { @@ -144,8 +140,8 @@ class InfosPath extends Component{ } - render(){ - let{ + render() { + let { category, status, sort_by, @@ -156,7 +152,7 @@ class InfosPath extends Component{ isSpin } = this.state; let isStudent = this.props.isStudent(); - let is_current=this.props.is_current; + let is_current = this.props.is_current; const menu = ( this.updatedlist("updated_at")}> @@ -170,7 +166,7 @@ class InfosPath extends Component{ ); // console.log(this.props.user&&this.props.user.main_site) - return( + return (
    - { - category && category == "manage" && is_current && - - } - { - category && category == "study" && is_current && - - } + { + category && category == "manage" && is_current && + + } + { + category && category == "study" && is_current && + + }
    - 共参与{totalCount}个{category?category=="manage"?"发布":"学习":"实践课程"} + 共参与{totalCount}个{category ? category == "manage" ? "发布" : "学习" : "实践课程"} - - this.updatedlists("asc")}> + + this.updatedlists("asc")}> - + - this.updatedlists("desc")}> - + this.updatedlists("desc")}> + - - {sort_by === "updated_at" ? '最近更新' : sort_by === "created_at" ? '最新创建' : ""} + + {sort_by === "updated_at" ? '最近更新' : sort_by === "created_at" ? '最新创建' : ""} - + -
    +
    -
    - {/* 295 */} - { - this.props.user&&this.props.user.main_site===true?page == 1 && is_current && !category ? :"":"" - } - { - this.props.user&&this.props.user.main_site===false?this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?page == 1 && is_current && !category ? :"":"":"" - } - { - (!data || (data && data.subjects.length==0)) && category && - } - { - data && data.subjects && data.subjects.map((item,key)=>{ - return( -
    this.turnToCourses(`/paths/${item.id}`)}> - { - item.tag &&
    {item.tag} - {/**/} -
    - } - Subject12 -
    -

    - {item.name} -

    -
    -

    - 12 ? item.owner_name : ''} style={{ maxWidth: '175px'}} - >{item.owner_name} - - - - - {item.visits_count} - +

    + {/* 295 */} + { + this.props.user && this.props.user.main_site === true ? page == 1 && is_current && !category ? : "" : "" + } + { + this.props.user && this.props.user.main_site === false ? this.props.user && this.props.user.admin === true || this.props.user && this.props.user.is_teacher === true || this.props.user && this.props.user.business === true ? page == 1 && is_current && !category ? : "" : "" : "" + } + { + (!data || (data && data.subjects.length == 0)) && category && + } + { + data && data.subjects && data.subjects.map((item, key) => { + return ( +
    this.turnToCourses(`/paths/${item.id}`)}> + { + item.tag &&
    {item.tag} + {/**/} +
    + } + Subject12 +
    -
    - ) - }) - } -
    - { - totalCount > 15 && -
    - + ) + }) + }
    - } + { + totalCount > 15 && +
    + +
    + }
    ) diff --git a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js index 121119a0d..43d53606e 100644 --- a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js +++ b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js @@ -1,11 +1,10 @@ import React, { Component } from 'react'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; - +import { Route, Switch } from 'react-router-dom'; import { Breadcrumb } from 'antd'; import { SnackbarHOC } from 'educoder'; -import { TPMIndexHOC } from '../../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../../courses/common/CNotificationHOC' +import TPMIndexHOC from '../../../tpm/TPMIndexHOC'; +import CNotificationHOC from '../../../courses/common/CNotificationHOC' import "../usersInfo.css" import "../../../courses/css/members.css" @@ -16,77 +15,77 @@ import Loading from '../../../../Loading'; // 毕设选题 const GtopicBanks = Loadable({ - loader: () => import('./GtopicBanks'), - loading: Loading, + loader: () => import('./GtopicBanks'), + loading: Loading, }) const BanksTabIndex = Loadable({ - loader: () => import('./BanksTabIndex'), - loading: Loading, + loader: () => import('./BanksTabIndex'), + loading: Loading, }) const GtopicBanksEdit = Loadable({ - loader: () => import('./GtopicBanksEdit'), - loading: Loading, + loader: () => import('./GtopicBanksEdit'), + loading: Loading, }) const HomeworkBanksEdit = Loadable({ - loader: () => import('./HomeworkBanksEdit'), - loading: Loading, + loader: () => import('./HomeworkBanksEdit'), + loading: Loading, }); const ExerciseBanksEdit = Loadable({ - loader: () => import('./ExerciseBanksEdit'), - loading: Loading, + loader: () => import('./ExerciseBanksEdit'), + loading: Loading, }); //普通作业题库详情 -const Generaljobbankdetails =Loadable({ +const Generaljobbankdetails = Loadable({ loader: () => import('../../../courses/questionbank/Generaljobbankdetails'), loading: Loading, }); //分组作业题库详情 -const GroupjobbankPage =Loadable({ +const GroupjobbankPage = Loadable({ loader: () => import('../../../courses/groupjobbank/GroupjobbankPage'), loading: Loading, }); //毕设选题详情 -const CompletetopicdePage =Loadable({ +const CompletetopicdePage = Loadable({ loader: () => import('../../../courses/comtopicdetails/CompletetopicdePage'), loading: Loading, }); //毕设任务详情 -const Completetaskpage =Loadable({ +const Completetaskpage = Loadable({ loader: () => import('../../../courses/completetaskdetails/Completetaskpage'), loading: Loading, }); //问卷编辑 -const PollNewQuestbank =Loadable({ +const PollNewQuestbank = Loadable({ loader: () => import('../../../courses/poll/PollNewQuestbank'), loading: Loading, }); const GtaskBanksEdit = Loadable({ - loader: () => import('./GtaskBanksEdit'), - loading: Loading, + loader: () => import('./GtaskBanksEdit'), + loading: Loading, }) -class BanksIndex extends Component{ - constructor(props){ +class BanksIndex extends Component { + constructor(props) { super(props); - this.state={ - crumbData:undefined, - publicly:undefined + this.state = { + crumbData: undefined, + publicly: undefined } } - componentDidMount = () =>{ + componentDidMount = () => { // let pathname = this.props.location.pathname; // this.setState({ // publicly:pathname.indexOf("/publicly") > -1 // }) - + } - initPublic = (crumbData,data) =>{ - if(data && data.status && data.status == -2){ + initPublic = (crumbData, data) => { + if (data && data.status && data.status == -2) { this.props.history.push(`/topicbank/publicly`); } this.setState({ @@ -94,8 +93,8 @@ class BanksIndex extends Component{ }) } - componentDidUpdate(prevProps) { - // if(prevProps.current_user!=this.props.current_user){ + componentDidUpdate(prevProps) { + // if(prevProps.current_user!=this.props.current_user){ // let { publicly }=this.state; // if( this.props.checkIfLogin()) { // if (this.props.current_user && this.props.current_user.professional_certification == false && publicly){ @@ -116,57 +115,57 @@ class BanksIndex extends Component{ // } } - render(){ - let { crumbData }=this.state + render() { + let { crumbData } = this.state const common = { - initPublic:this.initPublic + initPublic: this.initPublic } - return( + return (
    { crumbData && - { crumbData && crumbData.is_public == true ? '公共' : '我的' }题库 + {crumbData && crumbData.is_public == true ? '公共' : '我的'}题库 { - crumbData.crumbArray && crumbData.crumbArray.map((item,key)=>{ - return( + crumbData.crumbArray && crumbData.crumbArray.map((item, key) => { + return ( {item.content} ) }) - } + } } - { - crumbData &&

    - {crumbData && crumbData.title} - { crumbData.is_public == true ? - 公开 - : - 私有 - } + { + crumbData &&

    + {crumbData && crumbData.title} + {crumbData.is_public == true ? + 公开 + : + 私有 + } -

    } +

    } - {/*毕设任务编辑*/} - { - return () - } - }> + {/*毕设任务编辑*/} + { + return () + } + }> - { return () } - }> - + }> + { @@ -174,7 +173,7 @@ class BanksIndex extends Component{ isGroup={true} />) } - }> + }> ) } - }> + }> { - return () + return () } - }> + }> - {/*题库问卷编辑详情*/} - () - } - > + {/*题库问卷编辑详情*/} + () + } + > { return () } - }> - { - return () - } - }> - {/*毕设任务题库详情*/} + }> + { + return () + } + }> + {/*毕设任务题库详情*/} () - } + render={ + (props) => () + } > {/*毕设内容题库详情*/} () - } + render={ + (props) => () + } > {/*分组作业题库详情*/} () - } + render={ + (props) => () + } > {/* 普通作业题库详情*/} () - } + render={ + (props) => () + } > @@ -246,7 +245,7 @@ class BanksIndex extends Component{ ) } } -export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(BanksIndex) )); +export default CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(BanksIndex))); diff --git a/public/react/src/modules/user/usersInfo/publicCreatNew.js b/public/react/src/modules/user/usersInfo/publicCreatNew.js index da89143df..bce7e1ee6 100644 --- a/public/react/src/modules/user/usersInfo/publicCreatNew.js +++ b/public/react/src/modules/user/usersInfo/publicCreatNew.js @@ -1,86 +1,76 @@ import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip,Menu,Pagination} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; -import axios from 'axios'; -import {getImageUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC'; -import GotoQQgroup from '../../../modal/GotoQQgroup'; import "./usersInfo.css" -class publicCreateNew extends Component{ - constructor(props){ - super(props); - this.state={ +class publicCreateNew extends Component { + constructor(props) { + super(props); + this.state = { } - } + } //头部获取是否已经登录了 - getUser=(url,name)=> { - 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.props.showNotification("请先绑定邮箱,谢谢"); - return + getUser = (url, name) => { + 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.props.showNotification("请先绑定邮箱,谢谢"); + return + } + if (name === "新建实训") { + if (this.props && this.props.current_user && this.props.current_user.is_shixun_marker === false) { + this.props.setgoshowqqgtounp(true); + return; } - if(name==="新建实训"){ - if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ - this.props.setgoshowqqgtounp(true); - return; - } - } + } - if(url !== undefined || url!==""){ + if (url !== undefined || url !== "") { window.location.href = url; } } - getUsers=(url,name)=> { + getUsers = (url, name) => { - if(name==="新建实训"){ - if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ - this.props.setgoshowqqgtounp(true); - return; - } + if (name === "新建实训") { + if (this.props && this.props.current_user && this.props.current_user.is_shixun_marker === false) { + this.props.setgoshowqqgtounp(true); + return; + } } - if(url !== undefined || url!==""){ + if (url !== undefined || url !== "") { window.location.href = url; } } - render() { - let {href,name,index}=this.props; + render() { + let { href, name, index } = this.props; - return ( -
    + return ( + +
    +
    + + {name} + +
    +
    +
    + ) + } } export default publicCreateNew; diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js index a3678e56e..7a1e275d3 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js @@ -1,14 +1,12 @@ import React, { useState, useEffect, useContext, useRef, memo } from 'react'; -import {Link} from 'react-router-dom'; -import {Pagination, Input, Button} from 'antd' -import { getUrl2, isDev, ThemeContext, ActionBtn, NoneData } from 'educoder' +import { Pagination, Input, Button } from 'antd' +import { ThemeContext, ActionBtn, NoneData } from 'educoder' import axios from 'axios' import VideoInReviewItem from './VideoInReviewItem' import EditVideoModal from './EditVideoModal' import './InfosVideo.css' import InfoTab from '../common/InfoTab' import HeadlessModal from '../common/HeadlessModal' -import CRoundSelect from '../common/CRoundSelect' import ClipboardJS from 'clipboard' @@ -45,11 +43,11 @@ const DEFAULT_VIDEO_WIDTH_IN_MD = "90%" // 400 const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400 let videoId = {}; let _clipboard = null; -const _items=[ - {key: 'published_at-desc', name: '最新上传'}, - {key: 'published_at-asc', name: '最早上传'}, +const _items = [ + { key: 'published_at-desc', name: '最新上传' }, + { key: 'published_at-asc', name: '最早上传' }, ] -function InfoVideo (props) { +function InfoVideo(props) { const [videos, setvideos] = useState(undefined) const [reviewvideos, setReviewvideos] = useState(undefined) const [count, setCount] = useState(0) @@ -80,30 +78,30 @@ function InfoVideo (props) { const fetchUrl = `/users/${username}/videos.json` const sorts = sortKey.split('-') setLoading(true) - axios.get(fetchUrl, { + axios.get(fetchUrl, { params: { page: pageObj.current, per_page: PAGE_SIZE, sort_by: sorts[0], sort_direction: sorts[1], - // + // } }) - .then((response) => { - setLoading(false) - if (response.data.videos) { - setvideos(response.data.videos) - setCount(response.data.count) - } - }).catch(() => { - setLoading(false) - }) + .then((response) => { + setLoading(false) + if (response.data.videos) { + setvideos(response.data.videos) + setCount(response.data.count) + } + }).catch(() => { + setLoading(false) + }) } function fetchReviewvideos() { const fetchUrl = `/users/${username}/videos/review.json` const sorts = sortKey.split('-') setLoading(true) - axios.get(fetchUrl, { + axios.get(fetchUrl, { params: { page: pageObj.current, per_page: PAGE_SIZE, @@ -111,15 +109,15 @@ function InfoVideo (props) { sort_direction: sorts[1], } }) - .then((response) => { - setLoading(false) - if (response.data.videos) { - setReviewvideos(response.data.videos) - setCount(response.data.count) - } - }).catch(() => { + .then((response) => { + setLoading(false) + if (response.data.videos) { + setReviewvideos(response.data.videos) + setCount(response.data.count) + } + }).catch(() => { - }) + }) } useEffect(() => { @@ -130,7 +128,7 @@ function InfoVideo (props) { fetchReviewvideos() } } else { - pageObj.onChange(1) + pageObj.onChange(1) } }, [categoryObj.category]) @@ -140,7 +138,7 @@ function InfoVideo (props) { } else { fetchReviewvideos() } - }, [ pageObj.current, sortKey ]) + }, [pageObj.current, sortKey]) useEffect(() => { if (videoModalObj.visible == false) { @@ -158,9 +156,9 @@ function InfoVideo (props) { _clipboard = new ClipboardJS('.copybtn'); _clipboard.on('success', (e) => { showNotification('复制成功') - }); + }); } - }, 200) + }, 200) } }, [videoModalObj.visible]) @@ -173,7 +171,7 @@ function InfoVideo (props) { } function onEditVideo(item) { - videoId = { + videoId = { videoId: item.id, title: item.title } @@ -182,7 +180,7 @@ function InfoVideo (props) { // this.refs['editVideoModal'].setVisible(true, video); } function onMaskClick(item) { - videoId = { + videoId = { videoId: item.id, title: item.title, file_url: item.file_url, @@ -219,12 +217,12 @@ function InfoVideo (props) { } - function getCopyText (file_url, cover_url) { + function getCopyText(file_url, cover_url) { return `` } - const _inputValue = getCopyText(videoId.file_url, videoId.cover_url); - const sorts = sortKey.split('-') + const _inputValue = getCopyText(videoId.file_url, videoId.cover_url); + const sorts = sortKey.split('-') return (
    @@ -238,7 +236,7 @@ function InfoVideo (props) { className="showVideoModal" width={800 - 1} > -
    ) } diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js index fc50bcbfa..b7cd07eb3 100644 --- a/public/react/src/search/SearchPage.js +++ b/public/react/src/search/SearchPage.js @@ -1,122 +1,122 @@ -import React,{ Component } from "react"; -import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd"; -import {TPMIndexHOC} from "../modules/tpm/TPMIndexHOC"; -import {Link,NavLink} from 'react-router-dom'; -import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder'; +import React, { Component } from "react"; +import { Input, Pagination, Menu, Icon } from "antd"; +import TPMIndexHOC from "../modules/tpm/TPMIndexHOC"; +import { SnackbarHOC, getImageUrl } from 'educoder'; import axios from 'axios'; import './searchc.css' const Search = Input.Search; -class SearchPage extends Component{ +class SearchPage extends Component { constructor(props) { super(props); - this.state={ - tab:"1", - count:0, - keywords:undefined, - type:"subject", - page:1, - perpages:20, - data:[], - jupyterbool:false, + this.state = { + tab: "1", + count: 0, + keywords: undefined, + type: "subject", + page: 1, + perpages: 20, + data: [], + jupyterbool: false, } } //切换tab - changeTab=(e)=>{ + changeTab = (e) => { // course 2 课堂, shixun 0 实训项目 subject 1 实践课程 memo 3交流问答 - let types =""; - if(parseInt(e.key)===0){ - types="shixun"; + let types = ""; + if (parseInt(e.key) === 0) { + types = "shixun"; } - if(parseInt(e.key)===1){ - types="subject"; + if (parseInt(e.key) === 1) { + types = "subject"; } - if(parseInt(e.key)===2){ - types="course"; + if (parseInt(e.key) === 2) { + types = "course"; } - if(parseInt(e.key)===3){ - types="memo"; + if (parseInt(e.key) === 3) { + types = "memo"; } this.setState({ - tab:e.key, - type:types, - page:1, + tab: e.key, + type: types, + page: 1, }) - this.getdata(1,types,this.state.keywords); + this.getdata(1, types, this.state.keywords); } - componentDidMount(){ - let courstype=decodeURI(decodeURI(this.props.location.search)); + componentDidMount() { + let courstype = decodeURI(decodeURI(this.props.location.search)); courstype = courstype.split('?value='); this.setState({ - keywords:courstype[1] + keywords: courstype[1] }) - this.getdata(this.state.page,this.state.type,courstype[1]); + this.getdata(this.state.page, this.state.type, courstype[1]); } componentDidUpdate(prevProps) { - if(prevProps.location.search!=this.props.location.search){ - let courstype=decodeURI(decodeURI(this.props.location.search)); + if (prevProps.location.search != this.props.location.search) { + let courstype = decodeURI(decodeURI(this.props.location.search)); courstype = courstype.split('?value='); this.setState({ - keywords:courstype[1] + keywords: courstype[1] }) - this.getdata(this.state.page,this.state.type,courstype[1]); + this.getdata(this.state.page, this.state.type, courstype[1]); } } - setdatafunsval=(e)=>{ + setdatafunsval = (e) => { this.setState({ - keywords:e.target.value + keywords: e.target.value }) } - setdatafuns =(value)=>{ + setdatafuns = (value) => { this.setState({ - keywords:value, - page:1 + keywords: value, + page: 1 }) this.props.history.replace(`/search?value=${value}`) - this.getdata(1,this.state.type,value); + this.getdata(1, this.state.type, value); } paginationonChanges = (pageNumber) => { this.setState({ page: pageNumber, loadingstate: true, }) - this.getdata(pageNumber,this.state.type,this.state.keywords); + this.getdata(pageNumber, this.state.type, this.state.keywords); } //获取数据 - getdata=(pages,type,keywords)=>{ + getdata = (pages, type, keywords) => { let url = "/search.json"; this.setState({ loading: true }) - axios.get(url,{params:{ - keyword:keywords, - type:type, - page:pages, - per_page:this.state.perpages, + axios.get(url, { + params: { + keyword: keywords, + type: type, + page: pages, + per_page: this.state.perpages, } }).then((response) => { this.setState({ loading: false }) - if(response === undefined){ + if (response === undefined) { return } this.setState({ - count:response.data.count, - data:response.data.results, + count: response.data.count, + data: response.data.results, }) }).catch((error) => { @@ -124,11 +124,11 @@ class SearchPage extends Component{ }); } - render(){ - let {tab,count,data,page,perpages, type }=this.state; + render() { + let { tab, count, data, page, perpages, type } = this.state; - return( + return (
    {/*
    */} -
    +
    搜索} - onInput={(e)=>this.setdatafunsval(e)} - onSearch={ (value)=>this.setdatafuns(value)} /> + enterButton={ 搜索} + onInput={(e) => this.setdatafunsval(e)} + onSearch={(value) => this.setdatafuns(value)} />
    - - 实践课程 - 教学课堂 - 实训项目 - 交流问答 - + + 实践课程 + 教学课堂 + 实训项目 + 交流问答 +
    { @@ -170,7 +170,7 @@ class SearchPage extends Component{
    - +

    暂时还没有相关数据哦!

    @@ -201,108 +201,108 @@ class SearchPage extends Component{ {data === undefined ? "" : data.map((item, key) => { return ( -
    +
    -
    - {/*标题*/} -
    +
    + {/*标题*/} +
    - - { - type==="shixun"? - ( - item.is_jupyter===true? -

    Jupyter

    - :"" - ) - :"" - } -
    - - {/*描述*/} -
    + dangerouslySetInnerHTML={{ __html: item.title }} /> + { + type === "shixun" ? + ( + item.is_jupyter === true ? +

    Jupyter

    + : "" + ) + : "" + } +
    + {/*描述*/} +
    - {item.content.content === undefined || item.content.content===0?"": item.content.content.map((item4, key4) => { - return ( - - ) - }) - } -
    - -
    - {/*内容*/} - {item.content.description === undefined || item.content.description===0?"": item.content.description.map((item3, key3) => { - return ( - - ) - }) - } -
    -
    + {item.content.content === undefined || item.content.content === 0 ? "" : item.content.content.map((item4, key4) => { + return ( + + ) + }) + } +
    + +
    + {/*内容*/} + {item.content.description === undefined || item.content.description === 0 ? "" : item.content.description.map((item3, key3) => { + return ( + + ) + }) + } +
    -
    - {/*挑战名字*/} +
    +
    + {/*挑战名字*/} - {item.content.challenge_names === undefined || item.content.challenge_names===0?"": item.content.challenge_names.map((item5, key5) => { - return ( -
    - 关卡名称: - -
    - ) - }) - } -
    -
    - {/*挑战标签*/} - {item.content.challenge_tag_names === undefined || item.content.challenge_tag_names===0?"": item.content.challenge_tag_names.map((item6, key6) => { - return ( -
    - 关卡标签: - 1?" tzbq ":" tzbqx"} style={{ - width:"100%" - }} - dangerouslySetInnerHTML={{__html:item6}} /> -
    - ) - }) - } -
    -
    - {/*合作单位*/} - {item.content.member_user_names === undefined || item.content.member_user_names===0?"": item.content.member_user_names.map((item7, key7) => { - return ( -
    - 合作团队: - 1?" tzbq ":" tzbqx"} - dangerouslySetInnerHTML={{__html:item7}} /> -
    - ) - }) - } -
    + {item.content.challenge_names === undefined || item.content.challenge_names === 0 ? "" : item.content.challenge_names.map((item5, key5) => { + return ( +
    + 关卡名称: + +
    + ) + }) + } +
    + +
    + {/*挑战标签*/} + {item.content.challenge_tag_names === undefined || item.content.challenge_tag_names === 0 ? "" : item.content.challenge_tag_names.map((item6, key6) => { + return ( +
    + 关卡标签: + 1 ? " tzbq " : " tzbqx"} style={{ + width: "100%" + }} + dangerouslySetInnerHTML={{ __html: item6 }} /> +
    + ) + }) + } +
    +
    + {/*合作单位*/} + {item.content.member_user_names === undefined || item.content.member_user_names === 0 ? "" : item.content.member_user_names.map((item7, key7) => { + return ( +
    + 合作团队: + 1 ? " tzbq " : " tzbqx"} + dangerouslySetInnerHTML={{ __html: item7 }} /> +
    + ) + }) + } +
    -
    - {/* +
    + {/* 主讲:{item.author_name} {item.author_school_name} @@ -319,57 +319,57 @@ class SearchPage extends Component{ */} - - {/* */} - {item.author_name} + + {/* */} + {item.author_name} {item.author_school_name} - - {!!item.challenges_count && - {/* */} - 任务: - {item.challenges_count} - } - {!!item.study_count && - {/* */} - 学习人数: + {!!item.challenges_count && + {/* */} + 任务: + {item.challenges_count} + + } + {!!item.study_count && + {/* */} + 学习人数: {item.study_count} - - } + + } - {!!item.shixuns_count && - {/* */} - 实训数: + {!!item.shixuns_count && + {/* */} + 实训数: {item.shixuns_count} - - } - {type == 'subject' && !!item.visits_count && - {/* */} - 访问数: + + } + {type == 'subject' && !!item.visits_count && + {/* */} + 访问数: {item.visits_count} - - } + + } - {!!item.members_count && - {/* */} - 成员数: + {!!item.members_count && + {/* */} + 成员数: {item.members_count} - - } + + } - {!!item.all_replies_count && - {/* */} - 回复数:{item.all_replies_count} - } + {!!item.all_replies_count && + {/* */} + 回复数:{item.all_replies_count} + } - {/* + {/* 学习人数:{item.study_count===undefined?0:item.study_count} */} +
    -
    ) @@ -389,11 +389,11 @@ class SearchPage extends Component{ { - count && count && count> perpages ? -
    + count && count && count > perpages ? +
    + onChange={this.paginationonChanges} pageSize={perpages} + total={count}>
    : "" } @@ -404,4 +404,4 @@ class SearchPage extends Component{ } } -export default SnackbarHOC() (TPMIndexHOC ( SearchPage )); +export default SnackbarHOC()(TPMIndexHOC(SearchPage));