diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 6eb379752..61a7cf490 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -24,10 +24,6 @@ function locationurl(list) { } } - - - - // TODO 开发期多个身份切换 let debugType = "" if (isDev) { @@ -47,10 +43,6 @@ if (isDev) { // 学生 //debugType="student"; - - - - function clearAllCookie() { cookie.remove('_educoder_session', { path: '/' }); cookie.remove('autologin_trustie', { path: '/' }); diff --git a/public/react/src/index copy.css b/public/react/src/index copy.css deleted file mode 100644 index efd553bf3..000000000 --- a/public/react/src/index copy.css +++ /dev/null @@ -1,40 +0,0 @@ -body { - margin: 0; - padding: 0; - font-family: sans-serif; -} - -.page--header { - z-index: 101 !important; -} -.ant-popover-buttons { - text-align: center !important; -} - - -/* ie11兼容性问题 评测通过图片被遮挡*/ -.page--body { - z-index: 1; -} - -/* 隐藏newMessage提示按钮 */ -#shixun_comment_block .buttons > p:last-child { - display: none !important; -} - -.ant-message{ - z-index: 20000; -} -/*.ant-modal-header{*/ - /*border-radius: 10px;*/ -/*}*/ -.ant-upload-list-item-info .anticon-loading, .ant-upload-list-item-info .anticon-paper-clip{ - color: #29bd8b !important; -} -.anticon anticon-paper-clip{ - color: #29bd8b !important; -} - -.MuiModal-root-15{ - z-index: 1000 !important; -} diff --git a/public/react/src/index copy.js b/public/react/src/index copy.js deleted file mode 100644 index cb8cb4f94..000000000 --- a/public/react/src/index copy.js +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; - -import './index.css'; -import './indexPlus.css'; -import App from './App'; - -// 加之前main.js 18.1MB -// import { message } from 'antd'; -import message from 'antd/lib/message'; -import 'antd/lib/message/style/css'; - -import { AppContainer } from 'react-hot-loader'; - -import registerServiceWorker from './registerServiceWorker'; - -import { configureUrlQuery } from 'react-url-query'; - -import history from './history'; - -// link the history used in our app to url-query so it can update the URL with it. -configureUrlQuery({ history }); -// ----------------------------------------------------------------------------------- 请求配置 - -window.__useKindEditor = false; - - -const render = (Component) => { - ReactDOM.render( - - - , - document.getElementById('root') - ); -} - - -// ReactDOM.render( -// , -// document.getElementById('root')); -// registerServiceWorker(); - -render(App); -if (module.hot) { - module.hot.accept('./App', () => { render(App) }); -} diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js index ab3718b1d..cacc0ed69 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js @@ -1,10 +1,9 @@ import React, { Component } from 'react'; -import { getRandomNumber } from 'educoder'; -import {Link} from 'react-router-dom'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import { Link } from 'react-router-dom'; +import { Route, Switch } from 'react-router-dom'; import Loadable from 'react-loadable'; import Loading from '../../../Loading'; -import { WordsBtn, MarkdownToHtml, trigger, queryString, getRandomcode } from 'educoder'; +import { WordsBtn, trigger, queryString, getRandomcode } from 'educoder'; import axios from 'axios'; import CoursesListType from '../coursesPublic/CoursesListType'; import AccessoryModal from "../coursesPublic/AccessoryModal"; @@ -17,81 +16,60 @@ import { Spin } from 'antd' //引入对应跳转的组件 -//新建分组/普通作业 -const NewWork = Loadable({ - loader: () => import('./NewWork'), - loading:Loading, -}) const CommonWorkSetting = Loadable({ loader: () => import('./CommonWorkSetting'), - loading:Loading, + loading: Loading, }) //普通作业列表 const CommonWorkList = Loadable({ loader: () => import('./CommonWorkList'), - loading:Loading, + loading: Loading, }) const CommonWorkQuestion = Loadable({ loader: () => import('./CommonWorkQuestion'), - loading:Loading, + loading: Loading, }) const CommonWorkAnswer = Loadable({ loader: () => import('./CommonWorkAnswer'), - loading:Loading, -}) -const CommonWorkAppraise = Loadable({ - loader: () => import('./CommonWorkAppraise'), - loading:Loading, -}) - -const CommonWorkPost = Loadable({ - loader: () => import('./CommonWorkPost'), - loading:Loading, -}) - -const CommonWork = Loadable({ - loader: () => import('./commonWork'), - loading:Loading, + loading: Loading, }) -class CommonWorkDetailIndex extends Component{ +class CommonWorkDetailIndex extends Component { constructor(props) { super(props) - this.publishModal = React.createRef(); - this.endModal = React.createRef(); this.state = { - DownloadType:false, - DownloadMessageval:undefined, - donwloading:false, + DownloadType: false, + DownloadMessageval: undefined, + donwloading: false, } } initWorkDetailCommonState = (data) => { this.setState({ - ...data + ...data }) } goback = () => { - let workId=this.props.match.params.workId; - // - if ( window.location.pathname.indexOf('appraise') == -1) { - let category_id= this.state.category.category_id; + let workId = this.props.match.params.workId; + // + if (window.location.pathname.indexOf('appraise') == -1) { + let category_id = this.state.category.category_id; this.props.toListPage(this.props.match.params, category_id) } else { this.props.toWorkListPage(this.props.match.params, workId) } - // this.props.history.goBack() + // this.props.history.goBack() } - // 补交附件 - Cancelvisible=()=>{ + // 补交附件 + Cancelvisible = () => { this.setState({ - accessoryVisible:false + accessoryVisible: false }) } - addAccessory=()=>{ + addAccessory = () => { this.setState({ - accessoryVisible:true + accessoryVisible: true }) } setupdate = () => { @@ -102,55 +80,41 @@ class CommonWorkDetailIndex extends Component{ } /// 确认是否下载 - confirmysl(url){ - axios.get(url+ '&export=true').then((response) => { - if(response===undefined){ + confirmysl(url) { + axios.get(url + '&export=true').then((response) => { + if (response === undefined) { return } - if(response.data.status&&response.data.status===-1){ + if (response.data.status && response.data.status === -1) { - }else if(response.data.status&&response.data.status===-2){ - if(response.data.message === "100"){ + } else if (response.data.status && response.data.status === -2) { + if (response.data.message === "100") { // 已超出文件导出的上限数量(100 ),建议: this.setState({ - DownloadType:true, - DownloadMessageval:100 + DownloadType: true, + DownloadMessageval: 100 }) - }else { + } else { //因附件资料超过500M this.setState({ - DownloadType:true, - DownloadMessageval:500 + DownloadType: true, + DownloadMessageval: 500 }) } - }else { + } else { this.props.slowDownload(getRandomcode(url)) - // this.props.showNotification(`正在下载中`); - // this.setState({ donwloading: true }) - // downloadFile({ - // url: url, - // successCallback: (url) => { - // this.setState({ donwloading: false }) - // console.log('successCallback') - // }, - // failCallback: (responseHtml, url) => { - // this.setState({ donwloading: false }) - // console.log('failCallback') - // } - // }) - // window.open("/api"+url, '_blank'); } }).catch((error) => { console.log(error) }); } - Downloadcal=()=>{ + Downloadcal = () => { this.setState({ - DownloadType:false, - DownloadMessageval:undefined + DownloadType: false, + DownloadMessageval: undefined }) } bindRef = ref => { this.child = ref }; @@ -164,45 +128,42 @@ class CommonWorkDetailIndex extends Component{ } cancelConnectionProject = (work) => { - let workId=this.props.match.params.workId; - let courseId=this.props.match.params.coursesId; const url = `/homework_commons/${work.homework_id}/student_works/cancel_relate_project.json` - axios.get(url).then((response)=> { + axios.get(url).then((response) => { if (response.data.status == 0) { this.child.fetchData && this.child.fetchData() this.props.showNotification('取消关联成功') } - }).catch((error)=>{ - console.log(error) - }) + }).catch((error) => { + console.log(error) + }) } // 关联项目 END render() { - let {course_name, homework_name, homework_status, noTab - , view_answer, author_name, category, work_id + let { course_name, homework_name, homework_status, noTab + , view_answer, author_name, category, work_id - , end_immediately, publish_immediately, work_statuses, accessoryVisible - } =this.state; + , end_immediately, publish_immediately, work_statuses, accessoryVisible + } = this.state; const { current_user } = this.props - let courseId=this.props.match.params.coursesId; - let category_id= category && category.category_id; - let category_name= category && category.category_name; + let courseId = this.props.match.params.coursesId; + let category_id = category && category.category_id; + let category_name = category && category.category_name; - let workId=this.props.match.params.workId; + let workId = this.props.match.params.workId; const studentWorkId = this.props.match.params.studentWorkId const isGroup = this.props.isGroup() - const moduleName = !isGroup? "普通作业":"分组作业"; const moduleEngName = this.props.getModuleName() const childModuleName = this.state.moduleName const commonHandler = { - initWorkDetailCommonState: this.initWorkDetailCommonState, - triggerRef: this.bindRef + initWorkDetailCommonState: this.initWorkDetailCommonState, + triggerRef: this.bindRef } const isAdmin = this.props.isAdmin() @@ -212,67 +173,64 @@ class CommonWorkDetailIndex extends Component{ // 是列表页 let params = {} if (isListModule) { - // TODO - if(this.child && this.child._getRequestParams) { + if (this.child && this.child._getRequestParams) { params = this.child._getRequestParams() !== undefined ? this.child._getRequestParams() : {}; } } - // console.log("普通作业176176176"); - // console.log(params); let exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}` let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${queryString.stringify(params)}` - document.title=course_name === undefined ? "" : course_name; + document.title = course_name === undefined ? "" : course_name; return ( -
- - - - - -
-
- - {current_user && } - -
- 36 ? homework_name : ''}`} - style={{height: 'auto'}} - > - {homework_name} - {/* {homework_name} */} - - - - - {category && 返回} - - {this.state.update_atta && + {current_user && } + +
+ 36 ? homework_name : ''}`} + style={{ height: 'auto' }} + > + {homework_name} + {/* {homework_name} */} + + + + + {category && 返回} + + {this.state.update_atta && - {this.state.accessoryVisible===true? :""} + /> : ""} 补交附件 - } -
+ } +
- { noTab !== true &&
-
- this.setState({moduleName: '作品列表'})} - className={`${isListModule ? 'active' : '' } `} - to={`/courses/${courseId}/${moduleEngName}/${workId}/list`}>作品列表 - this.setState({moduleName: '作业描述'})} - className={`${childModuleName == '作业描述' ? 'active' : '' } `} - to={`/courses/${courseId}/${moduleEngName}/${workId}/question`}>作业描述 - {view_answer == true && this.setState({moduleName: '参考答案'})} - className={`${childModuleName == '参考答案' ? 'active' : '' } `} - to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案} - this.setState({moduleName: '设置'})} - className={`${childModuleName == '设置' ? 'active' : '' } `} - style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}} - to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"} - - - {/* { this.props.tabRightComponents } */} - - - {this.props.isAdmin()? -
  • - 导出 - -
  • -
    :""} - - {/* {isAdmin && 导出作品附件} - {isAdmin && 导出成绩} */} - {/*导出*/} - {end_immediately && { this.endModal.current.open() } }>立即截止} - {publish_immediately && { this.publishModal.current.open() } } >立即发布} - - {/*项目在线质量检测*/} - {isAdmin && this.props.toEditPage(this.props.match.params, workId)}>编辑作业} - - { // - work_statuses && work_statuses.indexOf('关联项目') != -1 && - - - this.openConnectionProject({ homework_id: workId })}>关联项目 - this.props.toCreateProject()}>创建项目 - - } - - { // - work_statuses && work_statuses.indexOf('取消关联') != -1 && - this.cancelConnectionProject( {homework_id: workId} )}>取消关联 - } + {this.props.isAdmin() ? +
  • + 导出 + +
  • +
    : ""} + + {isAdmin && this.props.toEditPage(this.props.match.params, workId)}>编辑作业} + + { // + work_statuses && work_statuses.indexOf('关联项目') != -1 && + + + this.openConnectionProject({ homework_id: workId })}>关联项目 + this.props.toCreateProject()}>创建项目 + + } + + { // + work_statuses && work_statuses.indexOf('取消关联') != -1 && + this.cancelConnectionProject({ homework_id: workId })}>取消关联 + } + + {work_statuses && work_statuses.indexOf('提交作品') != -1 && { this.props.toWorkPostPage(this.props.match.params) }} + >提交作品} + + {work_statuses && work_statuses.indexOf('补交作品') != -1 && + { this.props.toWorkPostPage(this.props.match.params) }}> + 补交作品} + + {work_statuses && work_statuses.indexOf('修改作品') != -1 && { this.props.toWorkPostPage(this.props.match.params, null, true, work_id) }} + >修改作品} + {work_statuses && work_statuses.indexOf('补交附件') != -1 && + + + 补交附件 -
    -
    } + } + - {/* 内容区 */} - +
    +
    } - {/* --------------------------------------------------------------------- */} + {/* 内容区 */} + - {/* 作业设置 */} - {/* http://localhost:3007/courses/1309/homework/9300/setting */} - () - } - > + {/* --------------------------------------------------------------------- */} - {/* 作品列表 */} - () - } - > + {/* 作业设置 */} + {/* http://localhost:3007/courses/1309/homework/9300/setting */} + () + } + > - {/* 作业问答 */} - () - } - > - () - } - > + {/* 作品列表 */} + () + } + > + + {/* 作业问答 */} + () + } + > + () + } + > - () - } - > + () + } + > - {/* 作品列表 */} - () - } - > + {/* 作品列表 */} + () + } + > - {/* 作业问答 */} - () - } - > - () - } - > - -
    + {/* 作业问答 */} + () + } + > + () + } + > + + ) } } -export default ( CommonWorkDetailIndex) ; \ No newline at end of file +export default (CommonWorkDetailIndex); \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js index 78e2a4e70..204263ef3 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkList.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js @@ -1,6 +1,6 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip,Spin, Pagination} from "antd"; -import {WordsBtn, ConditionToolTip, queryString, publicSearchs, on, off, NoneData, sortDirections} from 'educoder'; +import React, { Component } from "react"; +import { Form, Table, Tooltip, Spin, Pagination } from "antd"; +import { queryString, publicSearchs, on, off, NoneData, sortDirections } from 'educoder'; import axios from 'axios'; import CheckAllGroup from '../common/button/CheckAllGroup' import moment from 'moment'; @@ -11,7 +11,6 @@ import ModulationModal from "../coursesPublic/ModulationModal"; import AccessoryModal from "../coursesPublic/AccessoryModal"; import LeaderIcon from './common/LeaderIcon' const $ = window.$; -const Search = Input.Search; function renderScore(score, content) { let color = '#747A7F' @@ -20,9 +19,9 @@ function renderScore(score, content) { } else if (score >= 60) { color = '#FF6800' } - return - {score == null || score == undefined || score == '--' ? '--': (content || score)} - + return + {score == null || score == undefined || score == '--' ? '--' : (content || score)} + } function getScoreTip(score, dom) { return score == '--' ? '未评分' : score == '**' ? '未公开' : dom @@ -41,14 +40,14 @@ function buildColumns(that, student_works, studentData) { }) } else if (studentData && studentData[0]) { if (studentData[0].work_group) { - gotWorkGroup = true - } + gotWorkGroup = true + } if (studentData[0].project_info) { gotProjectInfo = true; } } - let courseId= that.props.match.params.coursesId; - let workId= that.props.match.params.workId; + let courseId = that.props.match.params.coursesId; + let workId = that.props.match.params.workId; const { course_group_count, homework_status } = that.state; const isAdmin = that.props.isAdmin() const isAdminOrStudent = that.props.isAdminOrStudent() @@ -65,10 +64,11 @@ function buildColumns(that, student_works, studentData) { key: 'id', render: (text, record, index) => { return ( - - {record.isMine == true && (student_works && student_works.length) ? '我' : (that.state.page - 1) * PAGE_SIZE + index + 1} - - )}, + + {record.isMine == true && (student_works && student_works.length) ? '我' : (that.state.page - 1) * PAGE_SIZE + index + 1} + + ) + }, }, { title: '姓名', width: 90, @@ -78,20 +78,18 @@ function buildColumns(that, student_works, studentData) { render: (text, record) => (
    5 ? text : ''}> - {/* - */} - {record.is_leader ? -
    + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + width: '74px', + margin: '0 auto' + }} title={text && text.length > 5 ? text : ''}> + {record.is_leader ? +
    {text}
    - : {text}} + : {text}}
    ), }] @@ -101,38 +99,39 @@ function buildColumns(that, student_works, studentData) { title: '学号', dataIndex: 'student_id', key: 'student_id', - sorter: true, - sortDirections: sortDirections, + sorter: true, + sortDirections: sortDirections, render: (text, record) => ( 12 ? text : ''} - style={{ - color: '#9A9A9A', - 'text-overflow': 'ellipsis', - 'white-space': 'nowrap', - 'width': '98px', - display: 'block', - overflow: 'hidden' - , margin: '0 auto', cursor: 'default'}} + title={text && text.length > 12 ? text : ''} + style={{ + color: '#9A9A9A', + 'text-overflow': 'ellipsis', + 'white-space': 'nowrap', + 'width': '98px', + display: 'block', + overflow: 'hidden' + , margin: '0 auto', cursor: 'default' + }} >{record.student_id} - + ), }) } // TODO 只有有分班时才显示分班列 if (course_group_count != 0 && !niPingAndIsStudent) { - columns.push( { + columns.push({ title: '分班', key: 'group_name', dataIndex: 'group_name', render: (text, record) => ( - - {record.group_name} + + {record.group_name} ), - } ) + }) } if (gotWorkGroup && !niPingAndIsStudent) { columns.push({ @@ -143,7 +142,7 @@ function buildColumns(that, student_works, studentData) { render: (text, record) => ( - {record.work_group} + {record.work_group} ), }) @@ -158,15 +157,15 @@ function buildColumns(that, student_works, studentData) { render: (project_info, record) => ( {project_info && project_info.name && - {project_info.name}} + {project_info.name}} ), }) @@ -183,7 +182,7 @@ function buildColumns(that, student_works, studentData) { if (status === 2) { color = '#DD1717' text = '延时提交' - } else if (status === 0 ) { + } else if (status === 0) { color = '#747A7F' text = '未提交' } else { @@ -191,26 +190,27 @@ function buildColumns(that, student_works, studentData) { text = '按时提交' } return ( - - - {status === 0 ? "未提交" : status === 1 ? "按时提交" : status === 2 ? "延时提交" : ""} - - - )}, + + + {status === 0 ? "未提交" : status === 1 ? "按时提交" : status === 2 ? "延时提交" : ""} + + + ) + }, }, { width: 106, // isStudent ? undefined : 106 , // 匿评中 只有这几列: 序号 姓名 提交状态 更新时间 匿评评分 操作 title: '更新时间', dataIndex: 'update_time', key: 'update_time', - sorter: true, - defaultSortOrder: 'descend', - sortDirections: sortDirections, + sorter: true, + defaultSortOrder: 'descend', + sortDirections: sortDirections, render: (update_time, record) => ( - {update_time ? moment(update_time).format('YYYY-MM-DD HH:mm') : '--'} - + {update_time ? moment(update_time).format('YYYY-MM-DD HH:mm') : '--'} + ), - }]) + }]) if (!niPingAndIsStudent) { columns.push({ width: 70, @@ -220,9 +220,9 @@ function buildColumns(that, student_works, studentData) { render: (teacher_score, record) => ( - + - { renderScore(teacher_score) } + {renderScore(teacher_score)} ), @@ -240,23 +240,23 @@ function buildColumns(that, student_works, studentData) { */ render: (teaching_asistant_score, record) => ( - { -
    {record.ta_comment_count}名助教进行了评分
    -
    {that.state.ta_mode == 1 ? '平均分': '复审分'}:{teaching_asistant_score}分
    -
    ) } - > - - {renderScore(teaching_asistant_score) } - } - +
    +
    {record.ta_comment_count}名助教进行了评分
    +
    {that.state.ta_mode == 1 ? '平均分' : '复审分'}:{teaching_asistant_score}分
    +
    )} + > + + {renderScore(teaching_asistant_score)} + } + ), }) } - if (that.state.anonymous_comment) { + if (that.state.anonymous_comment) { /** 开启了匿评的才显示此列,悬浮TIP示例: 3名学生进行了匿评 @@ -265,7 +265,7 @@ function buildColumns(that, student_works, studentData) { columns.push({ width: 84, // title:
    匿评
    评分
    , - title:
    匿评评分
    , + title:
    匿评评分
    , key: 'student_score', dataIndex: 'student_score', @@ -273,18 +273,18 @@ function buildColumns(that, student_works, studentData) { - {record.student_comment_count &&
    {`${record.student_comment_count}名学生进行了匿评`}
    } -
    有效平均分:{record.student_score}分
    - + that.state.is_evaluation ? `你的评阅分数:${record.student_score}分` :
    + {record.student_comment_count &&
    {`${record.student_comment_count}名学生进行了匿评`}
    } +
    有效平均分:{record.student_score}分
    +
    ) }> - { renderScore(student_score, `${student_score}${record.student_comment_count ? ` (${record.student_comment_count})` : ''}`) } + {renderScore(student_score, `${student_score}${record.student_comment_count ? ` (${record.student_comment_count})` : ''}`)}
    -
    + ), }) - } + } if (that.state.anonymous_appeal) { columns.push({ @@ -300,41 +300,41 @@ function buildColumns(that, student_works, studentData) { {`${record.appeal_deal_count}/${appeal_all_count}`} - } - { !appeal_all_count && -/-} - + } + {!appeal_all_count && -/-} + ), }) } if (!niPingAndIsStudent) { columns.push({ - width: '113px', + width: '113px', title: '当前成绩', key: 'work_score', dataIndex: 'work_score', - sorter: true, - sortDirections: sortDirections, + sorter: true, + sortDirections: sortDirections, render: (work_score, record) => { return ( - - -
    {`${record.user_name}(${record.user_login})`}
    - {record.ultimate_score ? -
    最终调整成绩:{record.work_score}分
    : -
    - { record.final_score &&
    作业评分:{record.final_score}分
    } - { record.late_penalty >= 0 &&
    迟交扣分:{record.late_penalty}分
    } - { record.absence_penalty >= 0 &&
    缺评扣分:{record.absence_penalty}分
    } - { record.appeal_penalty >= 0 &&
    违规匿评扣分:{record.appeal_penalty}分
    } -
    最终成绩:{record.work_score}分
    -
    } - ) - }> - { renderScore(work_score) } -
    -
    + + +
    {`${record.user_name}(${record.user_login})`}
    + {record.ultimate_score ? +
    最终调整成绩:{record.work_score}分
    : +
    + {record.final_score &&
    作业评分:{record.final_score}分
    } + {record.late_penalty >= 0 &&
    迟交扣分:{record.late_penalty}分
    } + {record.absence_penalty >= 0 &&
    缺评扣分:{record.absence_penalty}分
    } + {record.appeal_penalty >= 0 &&
    违规匿评扣分:{record.appeal_penalty}分
    } +
    最终成绩:{record.work_score}分
    +
    } + ) + }> + {renderScore(work_score)} +
    +
    ) }, }) @@ -346,23 +346,23 @@ function buildColumns(that, student_works, studentData) { key: 'operation', dataIndex: 'operation', render: (operation, record) => ( - record.work_status === 0 && !isAdmin ? --: -
    - {/* 0 未提交 */} - {/**/} - {/**/} - { isAdmin && 调整学生当前成绩
    其它历史评分将全部失效}> - that.showModulationModal(record)} + record.work_status === 0 && !isAdmin ? -- : +
    + {/* 0 未提交 */} + {/**/} + {/**/} + {isAdmin && 调整学生当前成绩
    其它历史评分将全部失效}> +
    that.showModulationModal(record)} >调分 - } + } {/* toWorkDetailPage */} {/* /courses/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */} - that.props.toWorkDetailPage2(e, courseId, workId, record.id)} - onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}>{isAdmin ? '评阅' : '查看'} + that.props.toWorkDetailPage2(e, courseId, workId, record.id)} + onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}>{isAdmin ? '评阅' : '查看'} -
    +
    ), }); @@ -371,41 +371,32 @@ function buildColumns(that, student_works, studentData) { } // update_time,最终成绩:work_score,学号:student_id -// desc:倒序 , asc:顺序 -const orderMap = { - update_time: 'desc', - work_score: 'asc', - student_id: 'asc', -} const PAGE_SIZE = 20 // 类似页面 http://localhost:3007/courses/1309/graduation/graduation_tasks/48/76/setting -class CommonWorkList extends Component{ +class CommonWorkList extends Component { - constructor(props){ + constructor(props) { super(props) - this.publishModal = React.createRef(); - this.endModal = React.createRef(); - - this.state={ - course_name:"", - homework_name:"", + this.state = { + course_name: "", + homework_name: "", search: '', task_status: [], teacher_comment: [], course_group_info: [], - arg_work_status: [], + arg_work_status: [], arg_teacher_comment: [], arg_course_group: [], order: 'update_time', page: 1, - isSpin:true, + isSpin: true, left_time: {}, category: {}, - b_order: 'desc', - searchtypes:false, - loadingstate:false, - comwbool:false + b_order: 'desc', + searchtypes: false, + loadingstate: false, + comwbool: false } } onTablePagination = (page) => { @@ -415,51 +406,51 @@ class CommonWorkList extends Component{ } onSearchValue = (val) => { - if (val === ""||val===undefined) { + if (val === "" || val === undefined) { this.setState({ search: undefined, - searchtypes:false + searchtypes: false }) - }else{ + } else { this.setState({ - searchtypes:true, - loadingstate:true + searchtypes: true, + loadingstate: true }) } this.fetchList() } onSearchValueInput = (e) => { - if (e.target.value === ""||e.target.value===undefined) { + if (e.target.value === "" || e.target.value === undefined) { this.setState({ search: undefined, }) } else { - this.setState({search: e.target.value}) + this.setState({ search: e.target.value }) } } componentDidMount() { - console.log("CommonWorkList 分班list 开始加载"); + console.log("CommonWorkList 分班list 开始加载"); this.fetchList() on('commonwork_fetch_all', this.fetchAllListener) $("html").animate({ scrollTop: $('html').scrollTop() - 100 }); try { this.props.triggerRef(this); - }catch (e) { + } catch (e) { } } componentWillUnmount() { - off('commonwork_fetch_all', this.fetchAllListener) + off('commonwork_fetch_all', this.fetchAllListener) } fetchAllListener = () => { this.fetchList() } - _getRequestParams() { - const {search, arg_work_status, arg_teacher_comment, arg_course_group, order, page, arg_member_work, b_order} = this.state + _getRequestParams() { + const { search, arg_work_status, arg_teacher_comment, arg_course_group, order, page, arg_member_work, b_order } = this.state return { page, search, @@ -468,8 +459,8 @@ class CommonWorkList extends Component{ teacher_comment: arg_teacher_comment.length == 0 ? '' : arg_teacher_comment[0], order, limit: PAGE_SIZE, - b_order: b_order, - group_id:arg_course_group, + b_order: b_order, + group_id: arg_course_group, member_work: arg_member_work } } @@ -477,81 +468,81 @@ class CommonWorkList extends Component{ this.fetchList() } fetchList = () => { - if(this.state.comwbool===true){ - console.log('arg_course_group2'); - console.log(this.state.arg_course_group); - return - } - - this.setState({ - comwbool:true, - }) - //分班 - let workId=this.props.match.params.workId; - let courseId=this.props.match.params.coursesId; + if (this.state.comwbool === true) { + console.log('arg_course_group2'); + console.log(this.state.arg_course_group); + return + } + + this.setState({ + comwbool: true, + }) + //分班 + let workId = this.props.match.params.workId; + let courseId = this.props.match.params.coursesId; const url = `/homework_commons/${workId}/works_list.json` let params = this._getRequestParams() - axios.post(url, params).then((response)=> { + axios.post(url, params).then((response) => { if (response.data) { this.setState({ - ...response.data, - isSpin:false, - loadingstate:false + ...response.data, + isSpin: false, + loadingstate: false }) - this.props.initWorkDetailCommonState && this.props.initWorkDetailCommonState( Object.assign({...response.data}, { + this.props.initWorkDetailCommonState && this.props.initWorkDetailCommonState(Object.assign({ ...response.data }, { moduleName: '作品列表' })) } - setTimeout(() => { - this.setState({ - comwbool:false, - }) - }, 1000) - }).catch((error)=>{ - console.log(error) - this.setState({ - isSpin:false, - loadingstate:false - }) - setTimeout(() => { - this.setState({ - comwbool:false, - }) - }, 1000) - - }) + setTimeout(() => { + this.setState({ + comwbool: false, + }) + }, 1000) + }).catch((error) => { + console.log(error) + this.setState({ + isSpin: false, + loadingstate: false + }) + setTimeout(() => { + this.setState({ + comwbool: false, + }) + }, 1000) + + }) } teacherCommentOptionChange = (values, isAllChecked) => { - this.setState({arg_teacher_comment: isAllChecked ? [] : values, page: 1}, () => { + this.setState({ arg_teacher_comment: isAllChecked ? [] : values, page: 1 }, () => { this.fetchList() }) } statusOptionChange = (values, isAllChecked) => { - this.setState({arg_work_status: isAllChecked ? [] : values, page: 1}, () => { + this.setState({ arg_work_status: isAllChecked ? [] : values, page: 1 }, () => { this.fetchList() }) } courseGroupOptionChange = (values, isAllChecked) => { - this.setState({arg_course_group: isAllChecked ? [] : values, page: 1}, () => { + this.setState({ arg_course_group: isAllChecked ? [] : values, page: 1 }, () => { this.fetchList() }) } memberWorkChange = (values, isAllChecked) => { - this.setState({arg_member_work: isAllChecked ? '' : values[0], page: 1}, () => { + this.setState({ arg_member_work: isAllChecked ? '' : values[0], page: 1 }, () => { this.fetchList() }) } - funorder = (order, b_order) => { - this.setState({ - order: order - , - b_order: b_order - }, () => { + funorder = (order, b_order) => { + this.setState({ + order: order + , + b_order: b_order + }, () => { this.fetchList() }) } @@ -574,98 +565,98 @@ class CommonWorkList extends Component{ score: num, comment: value }) - .then((response) => { - if (response.data.status == '0') { - this.setState({ modulationModalVisible: false }) - this.props.showNotification('调分成功') - this.fetchList() - } - }) - .catch(function (error) { - console.log(error); - }); + .then((response) => { + if (response.data.status == '0') { + this.setState({ modulationModalVisible: false }) + this.props.showNotification('调分成功') + this.fetchList() + } + }) + .catch(function (error) { + console.log(error); + }); } // --------------调分 END // 补交附件 - Cancelvisible=()=>{ + Cancelvisible = () => { this.setState({ - visible:false + visible: false }) } - addAccessory=()=>{ + addAccessory = () => { this.setState({ - visible:true + visible: true }) } setupdate = () => { } - //普通作业tbale 列表塞选数据 - table1handleChange = (pagination, filters, sorter) => { - //"ascend" 升序 - //"descend" 降序 - if (JSON.stringify(sorter) === "{}") { - //没有选择 - } else { - // 时间 - try { - if (sorter.columnKey === "update_time") { - let myyslorder = ""; - if (sorter.order === "ascend") { - myyslorder = "asc"; - } else if (sorter.order === "descend") { - myyslorder = "desc"; - } - this.funorder("update_time", myyslorder); - } - - } catch (e) { - - } - - //成绩 - try { - if (sorter.columnKey === "work_score") { - let myyslorder = ""; - if (sorter.order === "ascend") { - myyslorder = "asc"; - } else if (sorter.order === "descend") { - myyslorder = "desc"; - } - this.funorder("work_score", myyslorder) - } - - } catch (e) { - - } - - //学号 - try { - if (sorter.columnKey === "student_id") { - let myyslorder = ""; - if (sorter.order === "ascend") { - myyslorder = "asc"; - } else if (sorter.order === "descend") { - myyslorder = "desc"; - } - this.funorder("student_id", myyslorder) - } - - } catch (e) { - - } - - } - } - - render(){ + //普通作业tbale 列表塞选数据 + table1handleChange = (pagination, filters, sorter) => { + //"ascend" 升序 + //"descend" 降序 + if (JSON.stringify(sorter) === "{}") { + //没有选择 + } else { + // 时间 + try { + if (sorter.columnKey === "update_time") { + let myyslorder = ""; + if (sorter.order === "ascend") { + myyslorder = "asc"; + } else if (sorter.order === "descend") { + myyslorder = "desc"; + } + this.funorder("update_time", myyslorder); + } + + } catch (e) { + + } + + //成绩 + try { + if (sorter.columnKey === "work_score") { + let myyslorder = ""; + if (sorter.order === "ascend") { + myyslorder = "asc"; + } else if (sorter.order === "descend") { + myyslorder = "desc"; + } + this.funorder("work_score", myyslorder) + } + + } catch (e) { + + } + + //学号 + try { + if (sorter.columnKey === "student_id") { + let myyslorder = ""; + if (sorter.order === "ascend") { + myyslorder = "asc"; + } else if (sorter.order === "descend") { + myyslorder = "desc"; + } + this.funorder("student_id", myyslorder) + } + + } catch (e) { + + } + + } + } + + render() { const { getFieldDecorator } = this.props.form; const dateFormat = 'YYYY-MM-DD HH:mm'; - let {course_name, homework_name, search, page, loadingstate, student_works, work_count, + let { course_name, homework_name, search, page, loadingstate, student_works, work_count, all_member_count, time_status, // 老师显示的三个过滤条件 task_status, teacher_comment, course_group_info, order, @@ -673,17 +664,17 @@ class CommonWorkList extends Component{ modulationModalVisible, work_statuses, id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score, - ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count, + ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count, late_penalty, absence_penalty, appeal_penalty - , end_immediately, publish_immediately + , end_immediately, publish_immediately , homework_id, visible, work_group, project_info, is_leader - } =this.state; + } = this.state; - let courseId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; - let workId=this.props.match.params.workId; + let courseId = this.props.match.params.coursesId; + let category_id = this.props.match.params.category_id; + let workId = this.props.match.params.workId; const radioStyle = { display: 'block', height: '30px', @@ -691,7 +682,7 @@ class CommonWorkList extends Component{ }; const options_status = task_status.map((item) => { - return { label: `${item.name}(${item.count})`, value: item.id } + return { label: `${item.name}(${item.count})`, value: item.id } }) const options_course_group = course_group_info.map((item) => { @@ -719,28 +710,30 @@ class CommonWorkList extends Component{ // work_group let StudentData; - if(id===undefined){ - StudentData=undefined - }else{ - StudentData=isStudent ? [{ id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score, - ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count, - late_penalty, absence_penalty, appeal_penalty, project_info, is_leader, - work_group, isMine: true }] : [] + if (id === undefined) { + StudentData = undefined + } else { + StudentData = isStudent ? [{ + id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score, + ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count, + late_penalty, absence_penalty, appeal_penalty, project_info, is_leader, + work_group, isMine: true + }] : [] } const columns = buildColumns(this, student_works, StudentData) let params = this._getRequestParams() let exportUrl = `/api/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`; const exportResultUrl = `/api/homework_commons/${workId}/works_list.xlsx`; - let appraisetype=false; - let appraiselist=this.state.homework_status; + let appraisetype = false; + let appraiselist = this.state.homework_status; - appraiselist&&appraiselist.map((item,key)=>{ - if(item==="评阅中"){ - appraisetype=true - return - } - }) + appraiselist && appraiselist.map((item, key) => { + if (item === "评阅中") { + appraisetype = true + return + } + }) // time_status int 时间对应的状态: 0:未发布,1:提交中,2:补交中,3:匿评中,4:申诉中,5:评阅中,6:已结束 @@ -757,46 +750,46 @@ class CommonWorkList extends Component{ const hasData = this.state.homework_status && this.state.homework_status.indexOf("未发布") == -1 // student_works && !!student_works.length && page == 1 && - // console.log(StudentData) - // console.log(student_works) - return( + // console.log(StudentData) + // console.log(student_works) + return ( - - - - - - { - modulationModalVisible === true ? - this.saveModulationModal(value, num)} - /> - : "" - } - - - - {/* 内容区 */} - -
    - { isAdmin && hasData &&
      - - - - {isGroup && } - {options_course_group.length > 1 && } - - - {/* value={search} */} -
      - {/**/} - {publicSearchs("请输入姓名或学号搜索",this.onSearchValue,this.onSearchValueInput,this.onSearchValueInput)} -
      -
    } - - {
    -
    - {hasData && - { isAdmin ? - (!!all_member_count) && - {work_count || '0'}个检索结果({all_member_count} 学生) +
    + {isAdmin && hasData &&
      + + + + {isGroup && } + {options_course_group.length > 1 && } + + + {/* value={search} */} +
      + {/**/} + {publicSearchs("请输入姓名或学号搜索", this.onSearchValue, this.onSearchValueInput, this.onSearchValueInput)} +
      +
    } + + {
    +
    + {hasData && + {isAdmin ? + (!!all_member_count) && + {work_count || '0'}个检索结果({all_member_count} 学生) : - (!!commit_count || !!uncommit_count) && - - {commit_count}已交 {uncommit_count}未交  + (!!commit_count || !!uncommit_count) && + + {commit_count}已交 {uncommit_count}未交 {timeMsg || ''} - {left_time.time} - - } - } + {left_time.time} + + } + } -
    -
    } +
    +
    } - - { isStudent &&StudentData===undefined?"":StudentData===undefined?"": - - } - - -
    - - {isStudent && student_works && student_works.length == 0 || !isStudent && student_works===undefined?"":JSON.stringify(student_works) === "[]" ||student_works===undefined? - -
    -
    - - -
    -
    -
    - : + {isStudent && student_works && student_works.length == 0 || !isStudent && student_works === undefined ? "" : JSON.stringify(student_works) === "[]" || student_works === undefined ? + +
    +
    + + +
    +
    +
    + :
    - } - + } + - {work_count > PAGE_SIZE && } + {work_count > PAGE_SIZE && } diff --git a/public/react/src/modules/courses/busyWork/CommonWorkListTemplate.js b/public/react/src/modules/courses/busyWork/CommonWorkListTemplate.js index 863093b5b..69d9f174c 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkListTemplate.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkListTemplate.js @@ -1,97 +1,48 @@ -import React,{Component} from "react"; -import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd"; -import {Link} from 'react-router-dom'; -import locale from 'antd/lib/date-picker/locale/zh_CN'; +import React, { Component } from "react"; +import { Form } from "antd"; +import { Link } from 'react-router-dom'; import { WordsBtn } from 'educoder'; -import axios from 'axios'; -import Modals from '../../modals/Modals'; import CoursesListType from '../coursesPublic/CoursesListType'; -import HomeworkModal from "../coursesPublic/HomeworkModal"; -import moment from 'moment'; import '../css/Courses.css' -const { Option} = Select; -const CheckboxGroup = Checkbox.Group; -const confirm = Modal.confirm; -let GraduationTasksnewtype=true; -const $ = window.$; -const Search = Input.Search; -const RadioGroup = Radio.Group; - -function scrollTo(className) { - $("html").animate({ scrollTop: $(`${className}`).offset().top - 400 }) -} - -function range(start, end) { - 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: () => [55, 56], - }; -} -function handleDateString (dateString) { - if (!dateString) return dateString; - const ar = dateString.split(':') - if (ar[1] != '00' && ar[1] != '30') { - return [ar[0], '00'].join(':') - } - return dateString -} // 类似页面 http://localhost:3007/courses/1309/graduation/graduation_tasks/48/76/setting -class CommonWorkSetting extends Component{ +class CommonWorkSetting extends Component { - constructor(props){ + constructor(props) { super(props) - this.state={ - course_name:"", - homework_name:"", + this.state = { + course_name: "", + homework_name: "", } } - render(){ - const { getFieldDecorator } = this.props.form; - const dateFormat = 'YYYY-MM-DD HH:mm'; - - let {course_name, homework_name - } =this.state; + render() { - let courseId=this.props.match.params.coursesId; - let category_id=this.props.match.params.category_id; - let task_Id=this.props.match.params.task_Id; - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - }; + let { course_name, homework_name } = this.state; + let courseId = this.props.match.params.coursesId; + let category_id = this.props.match.params.category_id; + let task_Id = this.props.match.params.task_Id; - - return( + return ( - {
    + {

    - {course_name} + {course_name} > - 毕设任务 + 毕设任务 > 任务详情

    -
    +

    - {homework_name} + {homework_name}

    作品列表 - 作业描述 - 参考答案 + className="active" + to={"/courses/" + courseId + "/graduation/graduation_tasks/" + category_id + "/" + task_Id + "/list"}>作品列表 + 作业描述 + 参考答案 设置 + style={{ paddingLeft: '38px' }} + to={"/courses/" + courseId + "/graduation/graduation_tasks/" + category_id + "/" + task_Id + "/setting"}>设置 - { this.end()} }>立即截止 - { this.publish()} }>立即发布 + { this.end() }}>立即截止 + { this.publish() }}>立即发布 - 编辑作业 + 编辑作业
    -
    +
    } diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index edd83c9e1..912742c68 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -1,28 +1,25 @@ -import React,{ Component } from "react"; -import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Modal } from "antd"; +import React, { Component } from "react"; +import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon } from "antd"; import axios from 'axios' import '../css/busyWork.css' import '../css/Courses.css' -import {getUploadActionUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder' +import { getUploadActionUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder' import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; -import CBreadcrumb from '../common/CBreadcrumb' - -const confirm = Modal.confirm; const $ = window.$ const MAX_TITLE_LENGTH = 60; /** 需要注意的props isGroup -*/ -class NewWorkForm extends Component{ - constructor(props){ +*/ +class NewWorkForm extends Component { + constructor(props) { super(props); this.contentMdRef = React.createRef(); this.answerMdRef = React.createRef(); - - this.state={ - title_value:"", + + this.state = { + title_value: "", title_num: 0, contentFileList: [], answerFileList: [], @@ -34,81 +31,81 @@ class NewWorkForm extends Component{ } } initValue = (data) => { - if (data.isEdit) { - const contentFileList = data.attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - status: 'done' - } - }) - const answerFileList = data.ref_attachments.map(item => { - return { - id: item.id, - uid: item.id, - name: appendFileSizeToUploadFile(item), - url: item.url, - filesize: item.filesize, - status: 'done' - } - }) - - this.setState({ - ...data, - // course_id: data.course_id, - // course_name: data.course_name, - // category: data.category, - title_num: parseInt(data.name.length), - workLoaded: true, - init_min_num: data.min_num, - init_max_num: data.max_num, - // description: data.description, - reference_answer: data.reference_answer, - contentFileList, - answerFileList, - }, () => { - // setTimeout(() => { - // this._scrollToTop() - // 阻止setValue的滚动 - // $(window).scroll( function() { - // $("html").scrollTop(0) - // $(window).unbind("scroll"); - // }); - /** - setValue会调用到 codemirror的 o.scrollIntoView(i), 会导致滚动条跳动 - */ - // $('.editormd').parent().css('position', 'fixed').css('left', '-1000px') - // this.contentMdRef.current.setValue(data.description || '') - // this.answerMdRef.current.setValue(data.reference_answer || '') - // setTimeout(() => { - // $('.editormd').parent().css('position', '').css('left', 'auto') - // }, 100); - // }, 500) - - this.props.form.setFieldsValue({ - title: data.name, - description: data.description || '', - reference_answer: data.reference_answer || '', - }); - - }) - } else { // new + if (data.isEdit) { + const contentFileList = data.attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done' + } + }) + const answerFileList = data.ref_attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done' + } + }) - } + this.setState({ + ...data, + // course_id: data.course_id, + // course_name: data.course_name, + // category: data.category, + title_num: parseInt(data.name.length), + workLoaded: true, + init_min_num: data.min_num, + init_max_num: data.max_num, + // description: data.description, + reference_answer: data.reference_answer, + contentFileList, + answerFileList, + }, () => { + // setTimeout(() => { + // this._scrollToTop() + // 阻止setValue的滚动 + // $(window).scroll( function() { + // $("html").scrollTop(0) + // $(window).unbind("scroll"); + // }); + /** + setValue会调用到 codemirror的 o.scrollIntoView(i), 会导致滚动条跳动 + */ + // $('.editormd').parent().css('position', 'fixed').css('left', '-1000px') + // this.contentMdRef.current.setValue(data.description || '') + // this.answerMdRef.current.setValue(data.reference_answer || '') + // setTimeout(() => { + // $('.editormd').parent().css('position', '').css('left', 'auto') + // }, 100); + // }, 500) + + this.props.form.setFieldsValue({ + title: data.name, + description: data.description || '', + reference_answer: data.reference_answer || '', + }); + + }) + } else { // new + + } // this._scrollToTop() } _scrollToTop = () => { // setTimeout(() => { - $("html").scrollTop(0) - // $("html").animate({ scrollTop: 0 }) + $("html").scrollTop(0) + // $("html").animate({ scrollTop: 0 }) // }, 1000) } // 输入title - changeTitle=(e)=>{ + changeTitle = (e) => { this.setState({ title_num: parseInt(e.target.value.length) @@ -117,18 +114,18 @@ class NewWorkForm extends Component{ handleSubmit = () => { - const courseId = this.state.course_id || this.props.match.params.coursesId ; - + const courseId = this.state.course_id || this.props.match.params.coursesId; + this.props.form.validateFieldsAndScroll((err, values) => { - if(err && err.personNum) delete err.personNum; + if (err && err.personNum) delete err.personNum; const mdContnet = this.contentMdRef.current.getValue().trim(); values.description = mdContnet; // return; - - {/* max={has_commit ? init_min_num : null } */} - {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} + + {/* max={has_commit ? init_min_num : null } */ } + {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */ } // 已有提交作品,人数范围只能扩大 const { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state; const isGroup = this.props.isGroup() @@ -149,8 +146,8 @@ class NewWorkForm extends Component{ this.props.showNotification('最大人数不能小于最小人数'); this.props.scrollToAnchor("numberofgroups"); return; - } - + } + if (has_commit) { if (max_num < init_max_num || min_num > init_min_num) { this.props.showNotification(`已有提交作品,人数范围只能扩大(原设置为:${init_min_num} - ${init_max_num})`) @@ -166,7 +163,7 @@ class NewWorkForm extends Component{ } else { this.doNew(courseId, values) } - + } else { $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) } @@ -187,7 +184,7 @@ class NewWorkForm extends Component{ type: isGroup ? 3 : 1, name: values.title, description: values.description, - reference_answer: values.reference_answer, + reference_answer: values.reference_answer, attachment_ids, reference_attachment_ids, @@ -206,12 +203,12 @@ class NewWorkForm extends Component{ }) const isGroup = this.props.isGroup() const { min_num, max_num, base_on_project, category } = this.state - + const params = { type: isGroup ? 3 : 1, name: values.title, description: values.description, - reference_answer: values.reference_answer, + reference_answer: values.reference_answer, attachment_ids, reference_attachment_ids, @@ -220,7 +217,7 @@ class NewWorkForm extends Component{ base_on_project } this.props.doNew && this.props.doNew(params) - + } handleContentUploadChange = (info) => { @@ -235,12 +232,12 @@ class NewWorkForm extends Component{ this.setState({ answerFileList: appendFileSizeToUploadFileAll(answerFileList) }); } } - + onAttachmentRemove = (file, stateName) => { - if(!file.percent || file.percent == 100){ + if (!file.percent || file.percent == 100) { this.props.confirm({ content: '是否确认删除?', - + onOk: () => { this.deleteAttachment(file, stateName) }, @@ -261,7 +258,7 @@ class NewWorkForm extends Component{ const { status } = response.data; if (status == 0) { - + this.setState((state) => { const index = state[stateName].indexOf(file); const newFileList = state[stateName].slice(); @@ -285,7 +282,7 @@ class NewWorkForm extends Component{ // return; // } const { min_num } = this.state; - this.setState({ + this.setState({ max_num: val, // min_num: val <= min_num ? val - 1 : min_num }) @@ -315,23 +312,23 @@ class NewWorkForm extends Component{ window.$('.groupSetting .ant-form-item-label > label').addClass('ant-form-item-required') this._scrollToTop() } - - render(){ - let {typeId,coursesId,pageType}=this.props.match.params; + + render() { + let { typeId, coursesId, pageType } = this.props.match.params; const { getFieldDecorator } = this.props.form; const isGroup = this.props.isGroup() - let{ + let { title_value, contentFileList, answerFileList, max_num, min_num, base_on_project, - init_max_num, init_min_num, + init_max_num, init_min_num, title_num, course_name, category, has_commit, has_project - }=this.state + } = this.state const { current_user } = this.props - const courseId = this.state.course_id || this.props.match.params.coursesId ; + const courseId = this.state.course_id || this.props.match.params.coursesId; this.isEdit = this.isEdit || this.props.match.url.indexOf('/edit') != -1 if ((this.isEdit) && !this.state.description && this.state.description != '') { return '' - } + } const uploadProps = { width: 600, fileList: contentFileList, @@ -371,34 +368,34 @@ class NewWorkForm extends Component{ }, }; - return( + return ( - - -
    - - {getFieldDecorator('title', { - rules: [{ - required: true, message: '请输入标题' - }], - })( - - )} - - + + + {getFieldDecorator('title', { + rules: [{ + required: true, message: '请输入标题' + }], + })( + + )} + + - { - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入作业内容和要求', - },{ - max: 5000 , message:'最大限制5000个字符' - }], - })( - - )} - } - - - (单个文件150M以内) + (单个文件150M以内) - - - { isGroup && - - {getFieldDecorator('personNum', { - validateTrigger: 'onNone', - // rules: [{ - // required: true, - // message: '人数不能为空' - // validator: this.personNumValidator - // required: true, message: '请输入最小人数和最大人数' - // }], - })( -
    -

    - - {/* max={has_commit ? init_min_num : null } */} - - - - ~ - {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} - - - - -

    -

    - - 基于项目实施 - - - -

    -
    - )} - -
    - } - -
    - - {getFieldDecorator('reference_answer', { - rules: [{ - max: 5000 , message:'最大限制5000个字符' - }], - })( - - )} - - - - (单个文件150M以内) + (单个文件150M以内) -
    - -
    - {/* htmlType="submit" */} - - this.props.onCancel()}>取消 -
    -
    - - +
    + + + + +
    ) } diff --git a/public/react/src/modules/courses/busyWork/PublishRightnow.js b/public/react/src/modules/courses/busyWork/PublishRightnow.js index 1b9c8b0f1..8bfef819c 100644 --- a/public/react/src/modules/courses/busyWork/PublishRightnow.js +++ b/public/react/src/modules/courses/busyWork/PublishRightnow.js @@ -1,30 +1,29 @@ -import React,{ Component } from "react"; -import { Input,Checkbox,Menu,Pagination } from "antd"; +import React, { Component } from "react"; +import { Input, Checkbox, Menu, Pagination } from "antd"; import HomeworkModal from '../coursesPublic/HomeworkModal'; import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; import axios from 'axios' import moment from 'moment' -import { getNextHalfHourOfMoment } from 'educoder' -class PublishRightnow extends Component{ - constructor(props){ +class PublishRightnow extends Component { + constructor(props) { super(props); - this.state={ + this.state = { course_groups: [], - modalname:undefined, - modaltype:undefined, - visible:false, - Topval:undefined, - Botvalleft:undefined, - Botval:undefined, - starttime:undefined, - endtime:undefined, - Cancelname:undefined, - Savesname:undefined, - Cancel:undefined, - Saves:undefined, - Topvalright:undefined + modalname: undefined, + modaltype: undefined, + visible: false, + Topval: undefined, + Botvalleft: undefined, + Botval: undefined, + starttime: undefined, + endtime: undefined, + Cancelname: undefined, + Savesname: undefined, + Cancel: undefined, + Saves: undefined, + Topvalright: undefined } } open = (usingCheckBeforePost) => { @@ -32,71 +31,70 @@ class PublishRightnow extends Component{ this.homeworkstart() } - homeworkstart=()=>{ - const isPublish = this.props.isPublish; - const isPublishtype = this.props.isPublishtype; - let showdatatypes=isPublish===true||isPublishtype===1; + homeworkstart = () => { + const isPublish = this.props.isPublish; + const isPublishtype = this.props.isPublishtype; + let showdatatypes = isPublish === true || isPublishtype === 1; if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) { - this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`) + this.props.showNotification(`请先选择要立即${showdatatypes ? "发布" : "截止"}的作业`) return; } - + this.fetchCourseGroups(); - - + + } showDialog = (course_groups) => { const isPublish = this.props.isPublish; - const isPublishtype = this.props.isPublishtype; + const isPublishtype = this.props.isPublishtype; const dateFormat = 'YYYY-MM-DD HH:mm'; - let showdatatype=isPublish===true&&isPublishtype===undefined; - let showdatatypes=isPublish===true||isPublishtype===1; - // getNextHalfHourOfMoment + let showdatatype = isPublish === true && isPublishtype === undefined; + let showdatatypes = isPublish === true || isPublishtype === 1; + // getNextHalfHourOfMoment const startMoment = (moment()); this.setState({ modalname: showdatatypes ? "立即发布" : "立即截止", - modaltype:course_groups.length> 0 ? 1 : 2, - visible:showdatatype?false:true, - OneSelftype:showdatatype?true:false, - Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品", + modaltype: course_groups.length > 0 ? 1 : 2, + visible: showdatatype ? false : true, + OneSelftype: showdatatype ? true : false, + Topval: showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品", // Botvalleft: isPublish ? "暂不发布" : "暂不截止", Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的作业有效" : "本操作只对“提交中”的作业有效") : '', - starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '', - starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '', - endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', - Cancelname:showdatatypes ? "暂不发布" : "暂不截止", - Savesname:showdatatypes ? "立即发布" : "立即截止", - Cancel:this.homeworkhide, - Saves:this.homeworkstartend, - typs:showdatatypes ? "start" : "end", + starttime: showdatatypes ? `发布时间:${startMoment.format(dateFormat)}` : '', + starttimes: showdatatypes ? `${startMoment.format(dateFormat)}` : '', + endtime: showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', + Cancelname: showdatatypes ? "暂不发布" : "暂不截止", + Savesname: showdatatypes ? "立即发布" : "立即截止", + Cancel: this.homeworkhide, + Saves: this.homeworkstartend, + typs: showdatatypes ? "start" : "end", }) } - homeworkhide=()=>{ + homeworkhide = () => { this.setState({ - modalname:undefined, - modaltype:undefined, - visible:false, - OneSelftype:false, - Topval:undefined, - Topvalright:undefined, - Botvalleft:undefined, - Botval:undefined, - starttime:undefined, - endtime:undefined, - Cancelname:undefined, - Savesname:undefined, - Cancel:undefined, - Saves:undefined, - StudentList_value:undefined, - addname:undefined, - addnametype:false, - addnametab:undefined + modalname: undefined, + modaltype: undefined, + visible: false, + OneSelftype: false, + Topval: undefined, + Topvalright: undefined, + Botvalleft: undefined, + Botval: undefined, + starttime: undefined, + endtime: undefined, + Cancelname: undefined, + Savesname: undefined, + Cancel: undefined, + Saves: undefined, + StudentList_value: undefined, + addname: undefined, + addnametype: false, + addnametab: undefined }) } - homeworkstartend=(arg_group_ids,endtime)=>{ - debugger + homeworkstartend = (arg_group_ids, endtime) => { if (this.usingCheckBeforePost && this.props.checkBeforePost) { const goOn = this.props.checkBeforePost(); if (!goOn) { @@ -104,7 +102,6 @@ class PublishRightnow extends Component{ return; } } - debugger const isPublish = this.props.isPublish; let group_ids = arg_group_ids if (this.usingCheckBeforePost) { @@ -112,46 +109,45 @@ class PublishRightnow extends Component{ return item.id }) } - debugger - if(this.state.course_groups.length>0){ - if (this.state.course_groups.length && (!group_ids || group_ids&&group_ids.length == 0)) { + if (this.state.course_groups.length > 0) { + if (this.state.course_groups.length && (!group_ids || group_ids && group_ids.length == 0)) { this.props.showNotification('请至少选择一个分班'); return; } } - let data={} - if(arg_group_ids&&arg_group_ids.length===0){ - data = { - homework_ids: this.props.checkBoxValues, - end_time: endtime==="Invalid date"?undefined:endtime, - } - }else if(this.props.islist===true){ - data={ - homework_ids: this.props.checkBoxValues, - group_ids: group_ids, - end_time:endtime, - } - }else{ - data={ - homework_ids: this.props.checkBoxValues, - group_ids: group_ids, - group_end_times:endtime, - detail:true - } - } - const isPublishtype = this.props.isPublishtype; - let showdatatypes=isPublish===true||isPublishtype===1; - let coursesId=this.props.match.params.coursesId; + let data = {} + if (arg_group_ids && arg_group_ids.length === 0) { + data = { + homework_ids: this.props.checkBoxValues, + end_time: endtime === "Invalid date" ? undefined : endtime, + } + } else if (this.props.islist === true) { + data = { + homework_ids: this.props.checkBoxValues, + group_ids: group_ids, + end_time: endtime, + } + } else { + data = { + homework_ids: this.props.checkBoxValues, + group_ids: group_ids, + group_end_times: endtime, + detail: true + } + } + const isPublishtype = this.props.isPublishtype; + let showdatatypes = isPublish === true || isPublishtype === 1; + let coursesId = this.props.match.params.coursesId; const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json` axios.post(url, data) .then((response) => { if (response.data.status == 0) { - this.homeworkhide() - this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功") + this.homeworkhide() + this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功") this.props.doWhenSuccess && this.props.doWhenSuccess() - this.setState({ visible : false }) - this.props.action && this.props.action() + this.setState({ visible: false }) + this.props.action && this.props.action() } }) .catch(function (error) { @@ -159,34 +155,34 @@ class PublishRightnow extends Component{ }); } // componentDidUpdate = (prevProps) => { - // if ( prevProps.match.params.boardId != this.props.match.params.boardId ) { - // this.fetchAll(null, 1) - // } + // if ( prevProps.match.params.boardId != this.props.match.params.boardId ) { + // this.fetchAll(null, 1) + // } // } fetchCourseGroups = () => { - const isPublish = this.props.isPublish; - const isPublishtype = this.props.isPublishtype; - let showdatatypes=isPublish===true||isPublishtype===1; - let coursesId=this.props.match.params.coursesId; + const isPublish = this.props.isPublish; + const isPublishtype = this.props.isPublishtype; + let showdatatypes = isPublish === true || isPublishtype === 1; + let coursesId = this.props.match.params.coursesId; // TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668 // /homework_commons/:id/publish_groups.json let url = `/courses/${coursesId}/all_course_groups.json` if (this.props.checkBoxValues.length == 1) { const isPublish = this.props.isPublish; - url = `/homework_commons/${this.props.checkBoxValues[0]}/${ showdatatypes ? 'publish_groups' : 'end_groups'}.json` + url = `/homework_commons/${this.props.checkBoxValues[0]}/${showdatatypes ? 'publish_groups' : 'end_groups'}.json` } axios.get(url, { - }) + }) .then((response) => { if (!response || response.data.status == -1) { - this.setState({ visible : false }) + this.setState({ visible: false }) return; } this.showDialog(response.data.course_groups) this.setState({ course_groups: response.data.course_groups, - starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time, + starttimesend: response.data.end_time === undefined || response.data.end_time === null || response.data.end_time === "" ? undefined : response.data.end_time, }) }) .catch(function (error) { @@ -194,12 +190,12 @@ class PublishRightnow extends Component{ }); } - render(){ + render() { const isPublish = this.props.isPublish; - const isPublishtype = this.props.isPublishtype; - let showdatatypes=isPublish===true||isPublishtype===1; + const isPublishtype = this.props.isPublishtype; + let showdatatypes = isPublish === true || isPublishtype === 1; - let{ + let { Topvalright, modalname, modaltype, @@ -208,20 +204,20 @@ class PublishRightnow extends Component{ Botvalleft, Botval, starttime, - starttimes, + starttimes, endtime, Cancelname, Savesname, Cancel, Saves, course_groups - }=this.state + } = this.state const { showActionButton } = this.props - return( + return ( ) } diff --git a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js index 3d3f83bc6..7bb309727 100644 --- a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js +++ b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js @@ -1,12 +1,9 @@ -import React,{ Component } from "react"; -import { Pagination } from "antd"; - -import update from 'immutability-helper'; +import React, { Component } from "react"; import axios from 'axios'; import moment from 'moment'; import _ from 'lodash'; -import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC'; +import { ImageLayerOfCommentHOC } from '../../../page/layers/ImageLayerOfCommentHOC'; import GraduationTasksappraiseMainEditor from '../../graduation/tasks/GraduationTasksappraiseMainEditor'; import CCommentItem from '../../common/comments/CCommentItem'; import '../../../forums/Post.css'; @@ -17,47 +14,45 @@ import '../../graduation/tasks/GraduationTasksappraiseReply.css'; import './CommonWorkAppraiseReply.css'; import ModulationModal from "../../coursesPublic/ModulationModal"; import Modals from '../../../modals/Modals'; -const REPLY_PAGE_COUNT = 10 -const $ = window.$; /* */ -class CommonWorkAppraiseReply extends Component{ - constructor(props){ +class CommonWorkAppraiseReply extends Component { + constructor(props) { super(props); this.editorRef = React.createRef(); - this.state={ + this.state = { total_count: 0, comment_scores: [], } } fetchAllComments = () => { - let category_id= this.props.match.params.category_id; + let category_id = this.props.match.params.category_id; // const url = `/graduation_works/${category_id}/comment_list.json` const task_id = this.props.task_id const url = `/student_works/${task_id}/comment_list.json` - axios.get(url).then((result)=>{ - if(result.data.comment_scores){ + axios.get(url).then((result) => { + if (result.data.comment_scores) { const comment_scores = result.data.comment_scores.map(item => { - return this.transformReply(item) + return this.transformReply(item) }) this.setState({ ...result.data, comment_scores }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) } replySuccess = () => { this.fetchAllComments() } - componentDidMount(){ + componentDidMount() { this.fetchAllComments() } addSuccess = () => { @@ -79,7 +74,7 @@ class CommonWorkAppraiseReply extends Component{ reply.journals.push(reply.appeal_info) reply.journals = _.orderBy(reply.journals, 'time', 'asc') } - + return { isSuperAdmin: isSuperAdmin, admin: isAdmin, // @@ -93,7 +88,7 @@ class CommonWorkAppraiseReply extends Component{ // time: moment(reply.comment_time).fromNow(), time: moment(reply.comment_time).format('YYYY-MM-DD HH:mm'), - image_url: reply.user_image_url, + image_url: reply.user_image_url, user_id: reply.user_id, user_login: reply.user_login, username: reply.user_name, @@ -111,19 +106,20 @@ class CommonWorkAppraiseReply extends Component{ okText: '确定', cancelText: '取消', onOk: () => { - let category_id= this.props.match.params.category_id; + let category_id = this.props.match.params.category_id; const task_id = this.props.task_id // 作业是使用 task_id const url = `/student_works/${task_id}/destroy_score.json` - axios.delete(url, { data: { + axios.delete(url, { + data: { score_id: item.id } - }).then((result)=>{ - if(result.data.status == 0){ + }).then((result) => { + if (result.data.status == 0) { this.props.showNotification('删除成功') this.fetchAllComments() } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) }, @@ -131,47 +127,47 @@ class CommonWorkAppraiseReply extends Component{ console.log('Cancel'); }, }); - + } - showModulationtype=(id)=>{ + showModulationtype = (id) => { // console.log(id) this.setState({ - Modulationtype:true, - operationId:id + Modulationtype: true, + operationId: id }) } - cancelmodel=()=>{ + cancelmodel = () => { this.setState({ - Modalstype:false, - Loadtype:false, - visible:false, - Modulationtype:false, - Allocationtype:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", + Modalstype: false, + Loadtype: false, + visible: false, + Modulationtype: false, + Allocationtype: false, + Modalstopval: "", + ModalCancel: "", + ModalSave: "", }) } - saveModulationModal=(value,num)=>{ - console.log(value,num) - let {operationId}=this.state; - let studentWorkId =this.props.match.params.studentWorkId; + saveModulationModal = (value, num) => { + console.log(value, num) + let { operationId } = this.state; + let studentWorkId = this.props.match.params.studentWorkId; // console.log(value,num) - let url ="/student_works/"+studentWorkId+"/adjust_score.json"; - axios.post(url,{ - score:num, - comment:value - }).then((result)=>{ + let url = "/student_works/" + studentWorkId + "/adjust_score.json"; + axios.post(url, { + score: num, + comment: value + }).then((result) => { // console.log(result) - if(result.data.status===0){ + if (result.data.status === 0) { // this.setState({ // Modalstype:true, // Allocationtype:false, @@ -185,7 +181,7 @@ class CommonWorkAppraiseReply extends Component{ } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) @@ -193,18 +189,18 @@ class CommonWorkAppraiseReply extends Component{ onReply = (params) => { const { task_id } = this.props; const replyUrl = `/student_works/${task_id}/add_score.json` - axios.post(replyUrl, params).then((response)=>{ - if(response.data.status == 0) { + axios.post(replyUrl, params).then((response) => { + if (response.data.status == 0) { this.editorRef.current.clearInputs() this.fetchAllComments(); this.props.onReplySuccess && this.props.onReplySuccess() } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) } - render(){ + render() { let { total_count, comments, pageCount, comment_scores, allow_score } = this.state const { current_user, memo, homework_status } = this.props const isAdmin = this.props.isAdmin() @@ -217,84 +213,84 @@ class CommonWorkAppraiseReply extends Component{ */ // && isNiPing - const needNiPingEditor = (allow_score ); + const needNiPingEditor = (allow_score); if (!needNiPingEditor && comment_scores.length == 0) { return '' } - return( + return ( -
    -
    - - - - - {this.state.Modulationtype===true?this.saveModulationModal(value,num)} - closable={false} - footer={null} - destroyOnClose={true} - centered={true} - />:""} - - {/*
    */} +
    +
    + + + + + {this.state.Modulationtype === true ? this.saveModulationModal(value, num)} + closable={false} + footer={null} + destroyOnClose={true} + centered={true} + /> : ""} + + {/*
    */} {/*

    {datalist&&datalist.task_name}

    */} {/*返回*/} {/*{this.props.isStudent()?补交附件:""}*/} - {/*
    */} + {/*
    */} - - {/* { + + {/* { (!!comment_scores.length &&
    全部评阅 ({comment_scores.length})
    )} */} -
    - {!!comment_scores.length &&
    - 全部评阅{comment_scores.length===0?"":`(${comment_scores.length})`} - - {/*
    */} - - {/* true: 老师身份显示“调分”入口,false: 不显示调分入口 */} - {isAdmin && !allow_score && - this.showModulationtype(this.props.task_id)}>调分 - } -
    } - - {needNiPingEditor && } -
    - {/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */} -
    - {/* +
    + {!!comment_scores.length &&
    + 全部评阅{comment_scores.length === 0 ? "" : `(${comment_scores.length})`} + + {/*
    */} + + {/* true: 老师身份显示“调分”入口,false: 不显示调分入口 */} + {isAdmin && !allow_score && + this.showModulationtype(this.props.task_id)}>调分 + } +
    } + + {needNiPingEditor && } +
    + {/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */} +
    + {/* .course-message .panel-comment_item { margin-top: ${needNiPingEditor ? 56 : 28}px; } */} - - {!!comment_scores.length &&
    - { comment_scores.map((item, index) => { - return - }) } -
    } -
    + {!!comment_scores.length &&
    + {comment_scores.map((item, index) => { + return + })} +
    } +
    -
    +
    ) } } -export default ImageLayerOfCommentHOC() (CommonWorkAppraiseReply); \ No newline at end of file +export default ImageLayerOfCommentHOC()(CommonWorkAppraiseReply); \ No newline at end of file diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index 20c40f025..97bdcdb25 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -1,5 +1,5 @@ -import React,{ Component } from "react"; -import {Input,InputNumber,Spin,Statistic} from "antd"; +import React, { Component } from "react"; +import { Input, InputNumber, Spin, Statistic } from "antd"; import '../css/members.css'; import '../css/busyWork.css'; @@ -7,7 +7,7 @@ import '../poll/pollStyle.css'; import '../css/Courses.css'; import moment from 'moment'; -import { WordsBtn,markdownToHTML,ActionBtn,getImageUrl, MarkdownToHtml } from 'educoder'; +import { WordsBtn, markdownToHTML, ActionBtn, getImageUrl, MarkdownToHtml } from 'educoder'; import Modals from '../../modals/Modals'; import CoursesListType from '../coursesPublic/CoursesListType'; @@ -28,82 +28,81 @@ const { Countdown } = Statistic; // console.log(deadline) -const Textarea =Input.TextArea +const Textarea = Input.TextArea const tagArray = [ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', - 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] const $ = window.$; -const statudmap={1:"未发布",2:"已发布",3:"已截止"} - -const type=["单选题","多选题","判断题","填空题","简答题","实训题"] - -const format="YYYY-MM-DD HH:mm" -class ExerciseReviewAndAnswer extends Component{ - constructor(props){ - super(props); - this.state={ - data:undefined, - questionPanelFixed:false, - e_ReviewInfo:undefined, - e_AnswerInfo:undefined, - courseName:undefined, - exercise:undefined, - question_types:undefined, - exercise_questions:undefined, - time:undefined, - hour:0, - minute:0, - second:0, - Modalstype:false, - Modalstopval:undefined, - modalsBottomval:undefined, - ModalCancel:undefined, - ModalSave:undefined, - Loadtype:undefined, - // 问卷是否可以被编辑(老师/试卷已截止/问卷已提交为1) - user_exercise_status:undefined, - - // 开始答题时间 - exercise_start_at:undefined, - - //老师身份 - exercise_scores:undefined, - exercise_answer_user:undefined, - - //学生身份 - question_status:undefined, - - score:undefined, - setScoreReason:undefined, - setTip:"", - - Id:undefined, - // 试卷总分 - exerciseTotalScore:undefined, - - // 加载效果 - isSpin:false, - // 调分数组 - ajustSore:undefined - } +const statudmap = { 1: "未发布", 2: "已发布", 3: "已截止" } + +const type = ["单选题", "多选题", "判断题", "填空题", "简答题", "实训题"] + +const format = "YYYY-MM-DD HH:mm" +class ExerciseReviewAndAnswer extends Component { + constructor(props) { + super(props); + this.state = { + data: undefined, + questionPanelFixed: false, + e_ReviewInfo: undefined, + e_AnswerInfo: undefined, + courseName: undefined, + exercise: undefined, + question_types: undefined, + exercise_questions: undefined, + time: undefined, + hour: 0, + minute: 0, + second: 0, + Modalstype: false, + Modalstopval: undefined, + modalsBottomval: undefined, + ModalCancel: undefined, + ModalSave: undefined, + Loadtype: undefined, + // 问卷是否可以被编辑(老师/试卷已截止/问卷已提交为1) + user_exercise_status: undefined, + + // 开始答题时间 + exercise_start_at: undefined, + + //老师身份 + exercise_scores: undefined, + exercise_answer_user: undefined, + + //学生身份 + question_status: undefined, + + score: undefined, + setScoreReason: undefined, + setTip: "", + + Id: undefined, + // 试卷总分 + exerciseTotalScore: undefined, + + // 加载效果 + isSpin: false, + // 调分数组 + ajustSore: undefined + } } - componentDidUpdate (prevProps) { - // 需要等get_user_info执行完才能getInfo + componentDidUpdate(prevProps) { if (!prevProps.coursedata.name && this.props.coursedata.name) { this.getInfo() } } - componentDidMount(){ - if(this.props.coursedata.name){ + componentDidMount() { + if (this.props.coursedata.name) { this.getInfo(); } - + //window.addEventListener('scroll', this.handleScroll); } - remainTime=(time)=>{ + remainTime = (time) => { // let { time } = this.state; // let h=moment(parseInt(time)*1000).hour()-8; // let m=moment(parseInt(time)*1000).minutes(); @@ -134,98 +133,100 @@ class ExerciseReviewAndAnswer extends Component{ } //自动交卷 - autoCommitExercise=()=>{ - let eId=this.props.match.params.Id; - let url=`/exercises/${eId}/commit_exercise.json`; - axios.post(url,{ - commit_method:2 - }).then((result)=>{ - if(result){ - if(result.data.status===0){ - this.setState({ - Modalstype:true, - Modalstopval:'答题结束了,系统已自动提交试卷', - modalsBottomval:"不能再修改答题", - ModalCancel:undefined, - ModalSave:this.sureCommit, - Loadtype:true, - time:null, - }) - this.props.showNotification(`${result.data.message}`); - } - - if(result.data.status===-2){ - // this.remainTime(parseInt(result.data.message)) + autoCommitExercise = () => { + let eId = this.props.match.params.Id; + let url = `/exercises/${eId}/commit_exercise.json`; + axios.post(url, { + commit_method: 2 + }).then((result) => { + if (result) { + if (result.data.status === 0) { + this.setState({ + Modalstype: true, + Modalstopval: '答题结束了,系统已自动提交试卷', + modalsBottomval: "不能再修改答题", + ModalCancel: undefined, + ModalSave: this.sureCommit, + Loadtype: true, + time: null, + }) + this.props.showNotification(`${result.data.message}`); + } + + if (result.data.status === -2) { + // this.remainTime(parseInt(result.data.message)) this.setState({ - time:parseInt(result.data.mess) + time: parseInt(result.data.mess) }) this.deadline(parseInt(result.data.message)) - } - } - }).catch((error)=>{ - console.log(error); - }) + } + } + }).catch((error) => { + console.log(error); + }) } - sureCommit=()=>{ + sureCommit = () => { let coursesId = this.props.match.params.coursesId; let eId = this.props.match.params.Id; this.props.history.push(`/courses/${coursesId}/exercises/${eId}/student_exercise_list?tab=0`); } // 滚动定位 - handleScroll=()=>{ - if(parseInt(window.scrollY)>550){ + handleScroll = () => { + if (parseInt(window.scrollY) > 550) { this.setState({ - questionPanelFixed:true + questionPanelFixed: true }) - }else{ + } else { this.setState({ - questionPanelFixed:false + questionPanelFixed: false }) } } - getInfo=()=>{ + getInfo = () => { this.setState({ - courseName:this.props.current_user.course_name, - isSpin:true + courseName: this.props.current_user.course_name, + isSpin: true }) - let eId=this.props.match.params.Id; - let user_id=this.props.match.params.userId; + let eId = this.props.match.params.Id; + let user_id = this.props.match.params.userId; - let isAdmin=this.props.isAdmin(); - if(isAdmin){ - let url=`/exercises/${eId}/review_exercise.json` - axios.get((url),{params:{ - login:user_id - }}).then((result)=>{ - if(result){ + let isAdmin = this.props.isAdmin(); + if (isAdmin) { + let url = `/exercises/${eId}/review_exercise.json` + axios.get((url), { + params: { + login: user_id + } + }).then((result) => { + if (result) { this.setState({ - data:result.data, - e_ReviewInfo:result.data, - exercise:result.data.exercise, - exercise_types:result.data.exercise_scores.exercise_types, - exercise_scores:result.data.exercise_scores, - exercise_start_at:result.data.exercise_answer_user.start_at, - exercise_answer_user:result.data.exercise_answer_user, - exercise_questions:result.data.exercise_questions, - user_exercise_status:1, - Id:result.data.exercise_answer_user.user_id, - exerciseTotalScore:result.data.exercise_answer_user.score, - isSpin:false, + data: result.data, + e_ReviewInfo: result.data, + exercise: result.data.exercise, + exercise_types: result.data.exercise_scores.exercise_types, + exercise_scores: result.data.exercise_scores, + exercise_start_at: result.data.exercise_answer_user.start_at, + exercise_answer_user: result.data.exercise_answer_user, + exercise_questions: result.data.exercise_questions, + user_exercise_status: 1, + Id: result.data.exercise_answer_user.user_id, + exerciseTotalScore: result.data.exercise_answer_user.score, + isSpin: false, }) // 先将未批的简答题放入到调分数组中 let ajustSore = []; - result.data && result.data.exercise_questions.length>0 && result.data.exercise_questions.map((item,key)=>{ - if( item.question_type == 4 && item.answer_status == 0 ){ + result.data && result.data.exercise_questions.length > 0 && result.data.exercise_questions.map((item, key) => { + if (item.question_type == 4 && item.answer_status == 0) { ajustSore.push({ - inputSore:0, - desc:undefined, - id:item.question_id, - position:item.q_position, - setTip:"" + inputSore: 0, + desc: undefined, + id: item.question_id, + position: item.q_position, + setTip: "" }) } }) @@ -233,76 +234,78 @@ class ExerciseReviewAndAnswer extends Component{ ajustSore }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) - }else{ - let url=`/exercises/${eId}/start_answer.json` - axios.get((url),{params:{ - login:user_id - }}).then((result)=>{ - if(result.status==200){ + } else { + let url = `/exercises/${eId}/start_answer.json` + axios.get((url), { + params: { + login: user_id + } + }).then((result) => { + if (result.status == 200) { this.setState({ - data:result.data, - e_AnswerInfo:result.data, - exercise:result.data.exercise, - exercise_types:result.data.exercise_types, - question_status:result.data.question_status, - exercise_start_at:result.data.exercise.exercise_start_at, - exercise_scores:result.data.exercise_scores, - exercise_questions:result.data.exercise_questions, - user_exercise_status:result.data.exercise.user_exercise_status, - time:result.data.exercise.left_time, - exerciseTotalScore:result.data.user_score, - isSpin:false + data: result.data, + e_AnswerInfo: result.data, + exercise: result.data.exercise, + exercise_types: result.data.exercise_types, + question_status: result.data.question_status, + exercise_start_at: result.data.exercise.exercise_start_at, + exercise_scores: result.data.exercise_scores, + exercise_questions: result.data.exercise_questions, + user_exercise_status: result.data.exercise.user_exercise_status, + time: result.data.exercise.left_time, + exerciseTotalScore: result.data.user_score, + isSpin: false }) - if(result.data.exercise.left_time != null){ + if (result.data.exercise.left_time != null) { // this.remainTime(result.data.exercise.left_time); this.deadline(result.data.exercise.left_time) } } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } } - scrollToAnchor=(index)=>{ - let name="Anchor_"+index; + scrollToAnchor = (index) => { + let name = "Anchor_" + index; // console.log($("#Anchor_"+index).scrollTop()); if (index) { // let anchorElement = document.getElementById(name); // if(anchorElement) { anchorElement.scrollIntoView(); } - $("html").animate({ scrollTop: $("#Anchor_"+index).offset().top - 150 }) + $("html").animate({ scrollTop: $("#Anchor_" + index).offset().top - 150 }) } } //答题后更改题目列表得状态 - changeQuestionStatus=(No,flag)=>{ + changeQuestionStatus = (No, flag) => { this.setState( - (prevState) => ({ - question_status : update(prevState.question_status, {[No]: { ques_status: {$set: flag} }}) + (prevState) => ({ + question_status: update(prevState.question_status, { [No]: { ques_status: { $set: flag } } }) }) ) } // 调分 - showSetScore=(key,flag,position,type,id)=>{ + showSetScore = (key, flag, position, type, id) => { this.setState( - (prevState) => ({ - exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}}) - }),()=>{ - if (position && type && (flag == undefined || flag==false)) { - $("#input_"+position+"_"+type).focus(); - $("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 }); - if(id){ + (prevState) => ({ + exercise_questions: update(prevState.exercise_questions, { [key]: { setScore: { $set: flag == undefined || flag == false ? true : false } } }) + }), () => { + if (position && type && (flag == undefined || flag == false)) { + $("#input_" + position + "_" + type).focus(); + $("html").animate({ scrollTop: $("#Anchor_" + position + "_" + type).offset().top - 150 }); + if (id) { let { ajustSore } = this.state; let obj = ajustSore.filter(obj => obj.id === id).length > 0; - if(!obj){ + if (!obj) { ajustSore.push({ id, - inputSore:0, - desc:undefined, - position:position, - setTip:"" + inputSore: 0, + desc: undefined, + position: position, + setTip: "" }) } } @@ -314,106 +317,106 @@ class ExerciseReviewAndAnswer extends Component{ // }) } - inputScore=(value,id)=>{ + inputScore = (value, id) => { let { ajustSore } = this.state; var index = ajustSore.map(function (item) { return item.id; }).indexOf(id); let reg = /^[0-9]+.?[0-9]*$/; - if(reg.test(value)==false){ + if (reg.test(value) == false) { // this.setState({ // setTip:"请输入数字" // }) this.setState( - (prevState) => ({ - ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "请输入数字"}}}) + (prevState) => ({ + ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "请输入数字" } } }) }) ) return; - }else{ + } else { // this.setState({ // setTip:"", // score:value // }) this.setState( - (prevState) => ({ - ajustSore : update(prevState.ajustSore, {[index]: { inputSore: {$set: value},setTip:{$set: ""}}}) + (prevState) => ({ + ajustSore: update(prevState.ajustSore, { [index]: { inputSore: { $set: value }, setTip: { $set: "" } } }) }) ) } } - changeScoreReasons=(e,id)=>{ + changeScoreReasons = (e, id) => { // console.log(e.target.value); // this.setState({ // setScoreReason:e.target.value // }) - let value = e.target.value; + let value = e.target.value; let { ajustSore } = this.state; var index = ajustSore.map(function (item) { return item.id; }).indexOf(id); this.setState( - (prevState) => ({ - ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: value}}}) + (prevState) => ({ + ajustSore: update(prevState.ajustSore, { [index]: { desc: { $set: value } } }) }) ) } -//确认调分 - setAction=(key,q_id,maxScore,oldScore)=>{ - let {ajustSore}=this.state; + //确认调分 + setAction = (key, q_id, maxScore, oldScore) => { + let { ajustSore } = this.state; let list = ajustSore.filter(obj => obj.id == q_id); let index = ajustSore.map(function (item) { return item.id; }).indexOf(q_id); let score = list[0].inputSore; let setScoreReason = list[0].desc; - let{ setTip }=this.state; - if(!score && score != 0){ + let { setTip } = this.state; + if (!score && score != 0) { // this.setState({ // setTip:"请输入分数" // }) this.setState( - (prevState) => ({ - ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "请输入分数"}}}) + (prevState) => ({ + ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "请输入分数" } } }) }) ) return; } - if(score < 0){ + if (score < 0) { // this.setState({ // setTip:"分数必须大于或者等于0" // }) this.setState( - (prevState) => ({ - ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "分数必须大于或者等于0"}}}) + (prevState) => ({ + ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "分数必须大于或者等于0" } } }) }) ) return; } - if(score > maxScore){ + if (score > maxScore) { // this.setState({ // setTip:"分数不能大于当前题目的分数" // }) this.setState( - (prevState) => ({ - ajustSore : update(prevState.ajustSore, {[index]: { setTip: {$set: "分数不能大于当前题目的分数"}}}) + (prevState) => ({ + ajustSore: update(prevState.ajustSore, { [index]: { setTip: { $set: "分数不能大于当前题目的分数" } } }) }) ) return; } - if(setTip==""){ - let url=`/exercise_questions/${q_id}/adjust_score.json` - axios.post((url),{ - score:score, - user_id:this.state.Id, - comment:setScoreReason - }).then((result)=>{ - if(result.status==200){ + if (setTip == "") { + let url = `/exercise_questions/${q_id}/adjust_score.json` + axios.post((url), { + score: score, + user_id: this.state.Id, + comment: setScoreReason + }).then((result) => { + if (result.status == 200) { this.props.showNotification('调分成功'); this.getInfo(); // let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1; - + // this.setState( // (prevState) => ({ // exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: parseFloat(score).toFixed(1)},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}), // }) // ) - + // this.setState( // (prevState) => ({ // ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}}) @@ -426,183 +429,183 @@ class ExerciseReviewAndAnswer extends Component{ // }) // this.showSetScore(key,true); } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } - + } // 选择题,切换答案 - changeOption = (index,ids) =>{ + changeOption = (index, ids) => { //console.log(index+" "+ids); this.setState( - (prevState) => ({ - exercise_questions : update(prevState.exercise_questions, {[index]: { user_answer: {$set: ids} }}), + (prevState) => ({ + exercise_questions: update(prevState.exercise_questions, { [index]: { user_answer: { $set: ids } } }), }) ) } //简答题 显示和隐藏答案 - changeA_flag=(index,status)=>{ + changeA_flag = (index, status) => { this.setState( - (prevState) => ({ - exercise_questions : update(prevState.exercise_questions, {[index]: { a_flag: {$set: status} }}) + (prevState) => ({ + exercise_questions: update(prevState.exercise_questions, { [index]: { a_flag: { $set: status } } }) }) ) } //交卷和保存前判断是否有题未答 - checkExerciseNumber=(index)=>{ - let url= `/exercises/${this.props.match.params.Id}/begin_commit.json`; - axios.get(url).then((result)=>{ - if(result){ - if(result.data.question_undo !=0 || result.data.shixun_undo !=0) { - let tip=""; - if(result.data.question_undo !=0 && result.data.shixun_undo !=0){ - tip =`有 ${result.data.question_undo} 题未答,${result.data.shixun_undo} 实训未通关`; - }else if(result.data.question_undo !=0 && result.data.shixun_undo ==0){ - tip =`有 ${result.data.question_undo} 题未答`; - }else if(result.data.question_undo ==0 && result.data.shixun_undo !=0){ - tip =`有 ${result.data.shixun_undo} 实训未通关`; + checkExerciseNumber = (index) => { + let url = `/exercises/${this.props.match.params.Id}/begin_commit.json`; + axios.get(url).then((result) => { + if (result) { + if (result.data.question_undo != 0 || result.data.shixun_undo != 0) { + let tip = ""; + if (result.data.question_undo != 0 && result.data.shixun_undo != 0) { + tip = `有 ${result.data.question_undo} 题未答,${result.data.shixun_undo} 实训未通关`; + } else if (result.data.question_undo != 0 && result.data.shixun_undo == 0) { + tip = `有 ${result.data.question_undo} 题未答`; + } else if (result.data.question_undo == 0 && result.data.shixun_undo != 0) { + tip = `有 ${result.data.shixun_undo} 实训未通关`; } this.setState({ - Modalstype:true, - Modalstopval:tip, - modalsBottomval:index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`, - ModalCancel:this.cancelCommit, - ModalSave:()=>this.sureCommitOrSave(index), - Loadtype:index === 0 ? true :false + Modalstype: true, + Modalstopval: tip, + modalsBottomval: index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`, + ModalCancel: this.cancelCommit, + ModalSave: () => this.sureCommitOrSave(index), + Loadtype: index === 0 ? true : false }) - }else{ + } else { this.setState({ - Modalstype:true, - Modalstopval:index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`, - modalsBottomval:undefined, - ModalCancel:this.cancelCommit, - ModalSave:()=>this.sureCommitOrSave(index), - Loadtype:index === 0 ? true :false + Modalstype: true, + Modalstopval: index === 0 ? `在${moment(result.data.end_time).format(format)}之前,允许修改答题` : `提交后无法再修改答题,是否确认提交?`, + modalsBottomval: undefined, + ModalCancel: this.cancelCommit, + ModalSave: () => this.sureCommitOrSave(index), + Loadtype: index === 0 ? true : false }) } } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } //交卷 - commitExercise=()=>{ + commitExercise = () => { this.checkExerciseNumber(1); } //保存 - saveExercise=()=>{ + saveExercise = () => { this.checkExerciseNumber(0); } //确认交卷或者保存 - sureCommitOrSave=(index)=>{ - if(index===0){ + sureCommitOrSave = (index) => { + if (index === 0) { //确认保存 this.cancelCommit(); this.sureCommit(); - }else{ + } else { //交卷 - let eId=this.props.match.params.Id; - let url=`/exercises/${eId}/commit_exercise.json`; - axios.post(url,{ - commit_method:1 - }).then((result)=>{ - if(result){ + let eId = this.props.match.params.Id; + let url = `/exercises/${eId}/commit_exercise.json`; + axios.post(url, { + commit_method: 1 + }).then((result) => { + if (result) { this.setState({ - Modalstype:false, - Modalstopval:undefined, - modalsBottomval:undefined, - ModalCancel:undefined, - ModalSave:undefined, - Loadtype:undefined + Modalstype: false, + Modalstopval: undefined, + modalsBottomval: undefined, + ModalCancel: undefined, + ModalSave: undefined, + Loadtype: undefined }) this.props.showNotification(`${result.data.message}`); this.getInfo(); } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } } - cancelCommit=()=>{ + cancelCommit = () => { this.setState({ - Modalstype:false, - Modalstopval:undefined, - modalsBottomval:undefined, - ModalCancel:undefined, - ModalSave:undefined, - Loadtype:undefined + Modalstype: false, + Modalstopval: undefined, + modalsBottomval: undefined, + ModalCancel: undefined, + ModalSave: undefined, + Loadtype: undefined }) } // 打回重做 - RepeatExercise=()=>{ - let status=parseInt(this.state.exercise.exercise_status); - if(status === 3){ + RepeatExercise = () => { + let status = parseInt(this.state.exercise.exercise_status); + if (status === 3) { this.setState({ - Modalstype:true, - Modalstopval:'截止时间已到,无法打回试卷', - modalsBottomval:'请在修改截止时间后再操作', - ModalCancel:this.cancelCommit, - ModalSave:this.cancelCommit, - Loadtype:true + Modalstype: true, + Modalstopval: '截止时间已到,无法打回试卷', + modalsBottomval: '请在修改截止时间后再操作', + ModalCancel: this.cancelCommit, + ModalSave: this.cancelCommit, + Loadtype: true }) - }else{ + } else { this.setState({ - Modalstype:true, - Modalstopval:'学生将得到一次重新答题的机会,现有的答题情况将被清空', - modalsBottomval:'是否确认回退TA的试卷答题', - ModalCancel:this.cancelCommit, - ModalSave:this.sureRepeatExercise, - Loadtype:false + Modalstype: true, + Modalstopval: '学生将得到一次重新答题的机会,现有的答题情况将被清空', + modalsBottomval: '是否确认回退TA的试卷答题', + ModalCancel: this.cancelCommit, + ModalSave: this.sureRepeatExercise, + Loadtype: false }) } } - sureRepeatExercise=()=>{ - let eId=this.props.match.params.Id; - let user_id=this.state.Id; - let url=`/exercises/${eId}/redo_exercise.json` - axios.post((url),{ - user_ids:[user_id] - }).then((result)=>{ - if(result){ + sureRepeatExercise = () => { + let eId = this.props.match.params.Id; + let user_id = this.state.Id; + let url = `/exercises/${eId}/redo_exercise.json` + axios.post((url), { + user_ids: [user_id] + }).then((result) => { + if (result) { this.props.showNotification(`${result.data.message}`); //打回重做后跳转到答题列表页 this.sureCommit(); } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } // 返回 - returnBtn = () =>{ - let coursesId=this.props.match.params.coursesId; - let eId=this.props.match.params.Id; + returnBtn = () => { + let coursesId = this.props.match.params.coursesId; + let eId = this.props.match.params.Id; this.props.history.push(`/courses/${coursesId}/exercises/${eId}/student_exercise_list?tab=0`) } - deadline=(time)=>{ - if(time===null){ + deadline = (time) => { + if (time === null) { this.setState({ - Datetime:0 + Datetime: 0 }) - }else{ + } else { this.setState({ - Datetime:Date.now() + time * 1000 + Datetime: Date.now() + time * 1000 }) // return Date.now() + time * 1000 ; } } - render(){ - let coursesId=this.props.match.params.coursesId; - let eId=this.props.match.params.Id; + render() { + let coursesId = this.props.match.params.coursesId; + let eId = this.props.match.params.Id; - let{ + let { data, questionPanelFixed, courseName, @@ -634,17 +637,17 @@ class ExerciseReviewAndAnswer extends Component{ exerciseTotalScore, isSpin, ajustSore - }=this.state + } = this.state let isAdmin = this.props.isAdmin(); - let isStudent =this.props.isStudent(); + let isStudent = this.props.isStudent(); const { current_user } = this.props // console.log(data&&data.exercise.user_name) - document.title=courseName&&courseName; + document.title = courseName && courseName; - return( -
    + return ( +
    - - {/*

    */} -

    */} + -
    -

    - {courseName} - > - {data && data.left_banner_name} - > - {data && data.left_banner_name}详情> - {exercise_answer_user&&exercise_answer_user.user_name}{data&&data.exercise.user_name} -

    -

    - {exercise && exercise.exercise_name} - - - - - { - (isAdmin || ( isStudent && exercise && user_exercise_status == 1)) ? - 返回 - : - time && time != 0 ? -

    - -
    - :"" - } - {/*
    */} - {/*
  • { hour >= 10 ? hour : '0'+hour}
  • */} - {/* :*/} - {/*
  • { minute >= 10 ? minute : '0'+minute}
  • */} - {/* :*/} - {/*
  • { second >= 10 ? second : '0'+second}
  • */} - {/*
    */} - { - isAdmin && 打回重做 - } -

    - { - exercise && exercise.exercise_description && -

    {exercise.exercise_description}

    - } -

    - { - exercise_types && exercise_types.q_singles > 0 && - 单选题 {exercise_types.q_singles} 题,共 {exercise_types && exercise_types.q_singles_scores} 分 - } - { - exercise_types && exercise_types.q_doubles > 0 && - 多选题 {exercise_types.q_doubles} 题,共 {exercise_types && exercise_types.q_doubles_scores} 分 - } - { - exercise_types && exercise_types.q_judges > 0 && - 判断题 {exercise_types.q_judges} 题,共 {exercise_types && exercise_types.q_judges_scores} 分 - } - { - exercise_types && exercise_types.q_nulls > 0 && - 填空题 {exercise_types.q_nulls} 题,共 {exercise_types && exercise_types.q_nulls_scores} 分 - } - { - exercise_types && exercise_types.q_mains > 0 && - 简答题 {exercise_types.q_mains} 题,共 {exercise_types && exercise_types.q_mains_scores} 分 - } +

    +

    + {courseName} + > + {data && data.left_banner_name} + > + {data && data.left_banner_name}详情> + {exercise_answer_user && exercise_answer_user.user_name}{data && data.exercise.user_name} +

    +

    + {exercise && exercise.exercise_name} + + + + + { + (isAdmin || (isStudent && exercise && user_exercise_status == 1)) ? + 返回 + : + time && time != 0 ? +

    + +
    + : "" + } + {/*
    */} + {/*
  • { hour >= 10 ? hour : '0'+hour}
  • */} + {/* :*/} + {/*
  • { minute >= 10 ? minute : '0'+minute}
  • */} + {/* :*/} + {/*
  • { second >= 10 ? second : '0'+second}
  • */} + {/*
    */} + { + isAdmin && 打回重做 + } +

    { - exercise_types && exercise_types.q_shixuns > 0 && - 实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分 + exercise && exercise.exercise_description && +

    {exercise.exercise_description}

    } - {exercise_types &&exercise_types.q_scores} - 合计 {exercise_types &&exercise_types.q_counts} 题: -

    -
    - -
    - - { - exercise_start_at && 开始答题时间:{ exercise_start_at && moment(exercise_start_at).format(format) } - } - { - (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) && exerciseTotalScore && - 总分: { exerciseTotalScore } - } - +

    + { + exercise_types && exercise_types.q_singles > 0 && + 单选题 {exercise_types.q_singles} 题,共 {exercise_types && exercise_types.q_singles_scores} 分 + } + { + exercise_types && exercise_types.q_doubles > 0 && + 多选题 {exercise_types.q_doubles} 题,共 {exercise_types && exercise_types.q_doubles_scores} 分 + } + { + exercise_types && exercise_types.q_judges > 0 && + 判断题 {exercise_types.q_judges} 题,共 {exercise_types && exercise_types.q_judges_scores} 分 + } + { + exercise_types && exercise_types.q_nulls > 0 && + 填空题 {exercise_types.q_nulls} 题,共 {exercise_types && exercise_types.q_nulls_scores} 分 + } + { + exercise_types && exercise_types.q_mains > 0 && + 简答题 {exercise_types.q_mains} 题,共 {exercise_types && exercise_types.q_mains_scores} 分 + } { - // 老师身份 || 学生身份且试卷已经截止 - (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) && -

    + exercise_types && exercise_types.q_shixuns > 0 && + 实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分 + } + {exercise_types && exercise_types.q_scores} + 合计 {exercise_types && exercise_types.q_counts} 题: +

    +
    + +
    + { - exercise_scores && exercise_scores.objective_scores && exercise_scores.objective_scores.length > 0 && -
    -

    - 客观题 - 正确 - 错误 - 部分得分 -

    - -
    + exercise_start_at && 开始答题时间:{exercise_start_at && moment(exercise_start_at).format(format)} } { - exercise_scores && exercise_scores.subjective_scores.length > 0 && -
    + (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) && exerciseTotalScore && + 总分: {exerciseTotalScore} + } + + { + // 老师身份 || 学生身份且试卷已经截止 + (isAdmin || (isStudent && exercise && exercise.exercise_status == 3)) && +
    + { + exercise_scores && exercise_scores.objective_scores && exercise_scores.objective_scores.length > 0 && +
    +

    + 客观题 + 正确 + 错误 + 部分得分 +

    + +
    + } + { + exercise_scores && exercise_scores.subjective_scores.length > 0 && +
    +

    + 主观题 + 已评 + 未评 +

    + +
    + } +
    + } + + { + //学生身份 且试卷还未截止 + isStudent && exercise && exercise.exercise_status == 2 ? +

    - 主观题 - 已评 - 未评 + 已答 + 未答

    -
    - } -
    - } - - { - //学生身份 且试卷还未截止 - isStudent && exercise && exercise.exercise_status == 2 ? -
    -

    - 已答 - 未答 -

    - -
    :"" - } -
    - {/* 试卷题目 */} -
    - { - exercise_questions && exercise_questions.map((item,key)=>{ - let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id); - return( -
    -

    - {item.q_position}、{type[item.question_type]}({item.question_score}分) - - { - // 填空(一直都有调分),和简答题调分:老师身份 已经评分的才能出现调分按钮 - isAdmin && ((parseInt(item.answer_status) != 0 && item.question_type == 4) || item.question_type == 3 || item.question_type == 1) ? - this.showSetScore(key,item.setScore,item.q_position,item.question_type,item.question_id)}>调分:"" - } - { - // 简答题,未评分的显示未批 - isAdmin && parseInt(item.answer_status) == 0 && item.question_type == 4 ? - 未批:"" - } - { - // 客观题:老师||学生(试卷已截止且答案公开)显示正确答案 - item.question_type < 3 && item.standard_answer_show ? - - 正确答案:{ item.standard_answer_show } - :"" - } - { - //(老师身份且除实训题外) || (学生身份且试卷已经截止)就显示用户当前题目所得分数 - ( isAdmin || (isStudent && exercise.exercise_status == 3)) && item.question_type != 5 && item.user_score ? - - {item.user_score} - : "" - } - { - //实训题 ,答题 - item.question_type == 5 && - 实训详情 - } - -

    -
  • - {/*

    */} - -
  • - { - // 选择题和判断题共用 - (item.question_type == 0 || item.question_type == 2) && - this.changeOption(index,ids)} - changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)} - index={key} - > - } - { - // 多选题 - item.question_type == 1 && - this.changeOption(index,ids)} - changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)} - index={key} +
    : "" + } +
    + {/* 试卷题目 */} +
    + { + exercise_questions && exercise_questions.map((item, key) => { + let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id); + return ( +
    +

    + {item.q_position}、{type[item.question_type]}({item.question_score}分) + + { + // 填空(一直都有调分),和简答题调分:老师身份 已经评分的才能出现调分按钮 + isAdmin && ((parseInt(item.answer_status) != 0 && item.question_type == 4) || item.question_type == 3 || item.question_type == 1) ? + this.showSetScore(key, item.setScore, item.q_position, item.question_type, item.question_id)}>调分 : "" + } + { + // 简答题,未评分的显示未批 + isAdmin && parseInt(item.answer_status) == 0 && item.question_type == 4 ? + 未批 : "" + } + { + // 客观题:老师||学生(试卷已截止且答案公开)显示正确答案 + item.question_type < 3 && item.standard_answer_show ? + + 正确答案:{item.standard_answer_show} + : "" + } + { + //(老师身份且除实训题外) || (学生身份且试卷已经截止)就显示用户当前题目所得分数 + (isAdmin || (isStudent && exercise.exercise_status == 3)) && item.question_type != 5 && item.user_score ? + + {item.user_score} + : "" + } + { + //实训题 ,答题 + item.question_type == 5 && + 实训详情 + } + +

    +
  • + {/*

    */} + +
  • + { + // 选择题和判断题共用 + (item.question_type == 0 || item.question_type == 2) && + this.changeOption(index, ids)} + changeQuestionStatus={(No, flag) => this.changeQuestionStatus(No, flag)} + index={key} + > + } + { + // 多选题 + item.question_type == 1 && + this.changeOption(index, ids)} + changeQuestionStatus={(No, flag) => this.changeQuestionStatus(No, flag)} + index={key} > - } - { - // 填空题 - item.question_type == 3 && - this.changeQuestionStatus(No,flag)} - index={key} - - > - } - { - // 简答题 - item.question_type == 4 && - this.changeQuestionStatus(No,flag)} - changeA_flag={(index,status)=>this.changeA_flag(index,status)} - index={key} - > - } - { - // 实训题 - item.question_type == 5 && - - } - - { - //调分理由部分 - item.question_comments && item.question_comments.comment && (item.question_type == 3 || item.question_type == 4 || item.question_type == 1) && -
    - -
    -
  • - {item.question_comments.user_name} - {moment(item.question_comments.updated_at).format(format)} -
  • -
  • {item.question_comments.comment}
  • -
    -
    - } - { - // 调分输入部分 - isAdmin && ((item.setScore && item.question_type == 3) || (item.setScore && item.question_type == 1) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4))? -
    -
    - *调分: -
  • -

    - 0 && list[0].inputSore} - step={0.1} - precision={1} - className={ list && list.length>0 && list[0].setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"} - onChange={(value)=>this.inputScore(value,item.question_id)} - id={`${"input_"+item.q_position+"_"+item.question_type}`} - > - - { - parseInt(item.answer_status) == 0 && item.question_type == 4 ? 未评分 : '' - } - this.setAction(key,item.question_id,item.question_score,item.user_score)}>确认 -

    - { - list && list.length > 0 && list[0].setTip !="" ?

    { list[0].setTip }

    :"" - } -
  • + } + { + // 填空题 + item.question_type == 3 && + this.changeQuestionStatus(No, flag)} + index={key} + + > + } + { + // 简答题 + item.question_type == 4 && + this.changeQuestionStatus(No, flag)} + changeA_flag={(index, status) => this.changeA_flag(index, status)} + index={key} + > + } + { + // 实训题 + item.question_type == 5 && + + } + + { + //调分理由部分 + item.question_comments && item.question_comments.comment && (item.question_type == 3 || item.question_type == 4 || item.question_type == 1) && +
    + +
    +
  • + {item.question_comments.user_name} + {moment(item.question_comments.updated_at).format(format)} +
  • +
  • {item.question_comments.comment}
  • +
    - -
    :"" - } -
    - ) - }) - } + } + { + // 调分输入部分 + isAdmin && ((item.setScore && item.question_type == 3) || (item.setScore && item.question_type == 1) || ((item.setScore || parseInt(item.answer_status) == 0) && item.question_type == 4)) ? +
    +
    + *调分: +
  • +

    + 0 && list[0].inputSore} + step={0.1} + precision={1} + className={list && list.length > 0 && list[0].setTip != "" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"} + onChange={(value) => this.inputScore(value, item.question_id)} + id={`${"input_" + item.q_position + "_" + item.question_type}`} + > + + { + parseInt(item.answer_status) == 0 && item.question_type == 4 ? 未评分 : '' + } + this.setAction(key, item.question_id, item.question_score, item.user_score)}>确认 +

    + { + list && list.length > 0 && list[0].setTip != "" ?

    {list[0].setTip}

    : "" + } +
  • +
    + +
    : "" + } +
    + ) + }) + } +
    + { + isStudent && user_exercise_status == 0 ? +

    + 交卷 + 保存 + { + exercise && time != null ? + 保存或者离开页面后,系统将持续计时,到达时长系统将自动交卷 + : "" + } +

    : "" + }
    - { - isStudent && user_exercise_status == 0 ? -

    - 交卷 - 保存 - { - exercise && time != null ? - 保存或者离开页面后,系统将持续计时,到达时长系统将自动交卷 - :"" - } -

    :"" - } -
    ) diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index 28cb4b029..34dc6b0c3 100644 --- a/public/react/src/modules/courses/poll/PollInfo.js +++ b/public/react/src/modules/courses/poll/PollInfo.js @@ -1,5 +1,5 @@ -import React,{ Component } from "react"; -import {Checkbox,Radio, Input} from "antd"; +import React, { Component } from "react"; +import { Checkbox, Radio, Input } from "antd"; import '../css/members.css' import '../css/busyWork.css' @@ -12,161 +12,160 @@ import CoursesListType from '../coursesPublic/CoursesListType'; import axios from 'axios'; -const map={1:"单选题",2:"多选题",3:"主观题"} -const statudmap={1:"未发布",2:"提交中",3:"已截止"} -class PollInfo extends Component{ - constructor(props){ +const map = { 1: "单选题", 2: "多选题", 3: "主观题" } +const statudmap = { 1: "未发布", 2: "提交中", 3: "已截止" } +class PollInfo extends Component { + constructor(props) { super(props); - this.state={ - courseName:undefined, - poll:undefined, - question_answered:undefined, - question_types:undefined, - questions:undefined, - inputArray:[], - modalsType:false, - modalsTopval:undefined, - modalsBottomval:undefined, - loadtype:true, - modalSave:undefined, - questionPanelFixed:false, - pollAnswerList:[] + this.state = { + courseName: undefined, + poll: undefined, + question_answered: undefined, + question_types: undefined, + questions: undefined, + inputArray: [], + modalsType: false, + modalsTopval: undefined, + modalsBottomval: undefined, + loadtype: true, + modalSave: undefined, + questionPanelFixed: false, + pollAnswerList: [] } } - componentDidUpdate (prevProps) { - // 需要等get_user_info执行完才能getInfo + componentDidUpdate(prevProps) { if (!prevProps.current_user && this.props.current_user) { this.getInfo() } } - - componentDidMount(){ - if(this.props.current_user){ + + componentDidMount() { + if (this.props.current_user) { this.getInfo(); } //window.addEventListener('scroll', this.handleScroll); } - + // 滚动定位 - handleScroll=()=>{ - if(parseInt(window.scrollY)>230){ + handleScroll = () => { + if (parseInt(window.scrollY) > 230) { this.setState({ - questionPanelFixed:true + questionPanelFixed: true }) - }else{ + } else { this.setState({ - questionPanelFixed:false + questionPanelFixed: false }) } } - scrollToAnchor=(index)=>{ - let name="Anchor_"+index; + scrollToAnchor = (index) => { + let name = "Anchor_" + index; if (index) { let anchorElement = document.getElementById(name); - if(anchorElement) { anchorElement.scrollIntoView(); } + if (anchorElement) { anchorElement.scrollIntoView(); } } } - getInfo=()=>{ + getInfo = () => { this.setState({ - courseName:this.props.current_user.course_name + courseName: this.props.current_user.course_name }) - let pollId=this.props.match.params.pollId; - let user_id=this.props.match.params.login; - let url=`/polls/${pollId}/start_answer.json?login=${user_id}` - axios.get(url).then((result)=>{ - if(result.status==200){ + let pollId = this.props.match.params.pollId; + let user_id = this.props.match.params.login; + let url = `/polls/${pollId}/start_answer.json?login=${user_id}` + axios.get(url).then((result) => { + if (result.status == 200) { this.setState({ - poll:result.data.poll, - question_answered:result.data.question_answered, - question_types:result.data.question_types, - questions:result.data.questions + poll: result.data.poll, + question_answered: result.data.question_answered, + question_types: result.data.question_types, + questions: result.data.questions }) - let list=[]; - for(var i=0;i{ + }).catch((error) => { console.log(error); }) } //选中选择题(单选题)选项保存 - ChangeOptionSingle=(item)=>{ - let arr=item.target.name - let txt=Object.assign({}, this.state.inputArray[parseInt(arr[1])]); - let ids=item.target.value; - let list=txt.answersList.filter(element => element.answer_id == ids); - - this.postAnswer(arr[0],ids,list[0].answer_text=="其他"?txt.text:"",arr[1]); + ChangeOptionSingle = (item) => { + let arr = item.target.name + let txt = Object.assign({}, this.state.inputArray[parseInt(arr[1])]); + let ids = item.target.value; + let list = txt.answersList.filter(element => element.answer_id == ids); + + this.postAnswer(arr[0], ids, list[0].answer_text == "其他" ? txt.text : "", arr[1]); } //选中选择题(多选题)选项保存 - ChangeOptionMuntil=(a_id,q_id,key)=>{ - let ind=Object.assign({}, this.state.inputArray[parseInt(key)]); - let count=0; + ChangeOptionMuntil = (a_id, q_id, key) => { + let ind = Object.assign({}, this.state.inputArray[parseInt(key)]); + let count = 0; a_id.forEach(element => { - let list=ind.answersList.filter(item=>item.answer_id==element); - if(list[0].answer_text=="其他"){ + let list = ind.answersList.filter(item => item.answer_id == element); + if (list[0].answer_text == "其他") { count++; } }); - this.postAnswer(q_id,a_id,count > 0 ? ind.text : "",key); + this.postAnswer(q_id, a_id, count > 0 ? ind.text : "", key); } - postAnswer=(q_id,a_id,text,key)=>{ - let url=`/poll_questions/${q_id}/poll_votes.json`; + postAnswer = (q_id, a_id, text, key) => { + let url = `/poll_questions/${q_id}/poll_votes.json`; console.log(text); - axios.post(url,{ - poll_answer_id:a_id, - vote_text:text - }).then((result)=>{ - if(result){ - const answer=Object.assign({}, this.state.question_answered[parseInt(key)]); - answer.ques_status=result.data.poll_vote.question_status; - const question_answered=this.state.question_answered; - question_answered[parseInt(key)]=answer - - const inputs=Object.assign({}, this.state.inputArray[parseInt(key)]); - inputs.answers=a_id; - const inputArray=this.state.inputArray; - inputArray[parseInt(key)]=inputs; + axios.post(url, { + poll_answer_id: a_id, + vote_text: text + }).then((result) => { + if (result) { + const answer = Object.assign({}, this.state.question_answered[parseInt(key)]); + answer.ques_status = result.data.poll_vote.question_status; + const question_answered = this.state.question_answered; + question_answered[parseInt(key)] = answer + + const inputs = Object.assign({}, this.state.inputArray[parseInt(key)]); + inputs.answers = a_id; + const inputArray = this.state.inputArray; + inputArray[parseInt(key)] = inputs; this.setState({ question_answered, inputArray }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } //输入其它--内容 - blurTxt=(e)=>{ - let index=parseInt(e.target.name) + blurTxt = (e) => { + let index = parseInt(e.target.name) const list = Object.assign({}, this.state.inputArray[index]) - list.text=e.target.value; - const inputArray=this.state.inputArray; - inputArray[index]=list + list.text = e.target.value; + const inputArray = this.state.inputArray; + inputArray[index] = list this.setState({ inputArray @@ -175,121 +174,121 @@ class PollInfo extends Component{ //输入其它--内容后重新保存 - saveInputAndAnswer=(e,a_id,q_id,key,type)=>{ - const inputs=Object.assign({}, this.state.inputArray[parseInt(key)]); - let answers=inputs.answers; - let flag=true; - if(answers.length){ - flag=answers.indexOf(a_id) > -1?true:false; - answers= type == 1 ? answers[0] : answers; - }else{ - flag = answers==a_id?true:false; + saveInputAndAnswer = (e, a_id, q_id, key, type) => { + const inputs = Object.assign({}, this.state.inputArray[parseInt(key)]); + let answers = inputs.answers; + let flag = true; + if (answers.length) { + flag = answers.indexOf(a_id) > -1 ? true : false; + answers = type == 1 ? answers[0] : answers; + } else { + flag = answers == a_id ? true : false; } - if(answers && (answers.length>0 || answers !="")){ - this.postAnswer(q_id,answers,flag ? inputs.text : "",key); + if (answers && (answers.length > 0 || answers != "")) { + this.postAnswer(q_id, answers, flag ? inputs.text : "", key); } } //提交主观题 - commitText=(key,q_id)=>{ + commitText = (key, q_id) => { const text = Object.assign({}, this.state.inputArray[key]).text; - - let url='/poll_questions/'+q_id+'/poll_votes.json?'; - const ans=Object.assign({}, this.state.question_answered[key]); - ans.ques_status=text ? 1 : 0 ; - const questionAnswered=this.state.question_answered; - questionAnswered[key]=ans + let url = '/poll_questions/' + q_id + '/poll_votes.json?'; + + const ans = Object.assign({}, this.state.question_answered[key]); + ans.ques_status = text ? 1 : 0; + const questionAnswered = this.state.question_answered; + questionAnswered[key] = ans this.setState({ - question_answered:questionAnswered + question_answered: questionAnswered }) - if(text!=undefined){ - axios.post((url),{ - vote_text:text - }).then((result)=>{ - if(result.status==200){ - const answer=Object.assign({}, this.state.question_answered[key]); - answer.ques_status=result.data.poll_vote.question_status; - const question_answered=this.state.question_answered; - question_answered[key]=answer + if (text != undefined) { + axios.post((url), { + vote_text: text + }).then((result) => { + if (result.status == 200) { + const answer = Object.assign({}, this.state.question_answered[key]); + answer.ques_status = result.data.poll_vote.question_status; + const question_answered = this.state.question_answered; + question_answered[key] = answer this.setState({ question_answered }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } - + } // 提交 - submitPoll=()=>{ - let {inputArray,question_answered}=this.state; - let must=0; - let may=0; - for(var j=0;j { + let { inputArray, question_answered } = this.state; + let must = 0; + let may = 0; + for (var j = 0; j < question_answered.length; j++) { + if (question_answered[j].ques_status == 0) { + if (inputArray[j].is_necessary == 1) { must++; - }else{ + } else { may++; } } } - if(must>0){ + if (must > 0) { this.setState({ - modalsType:true, - modalsTopval:"有 "+must+" 题必答题未答,无法提交 ", - modalsBottomval:"请完成全部必答题后再提交", - loadtype:true, - modalSave:this.cancelSubmit + modalsType: true, + modalsTopval: "有 " + must + " 题必答题未答,无法提交 ", + modalsBottomval: "请完成全部必答题后再提交", + loadtype: true, + modalSave: this.cancelSubmit }) return; } - if(may >= 0){ + if (may >= 0) { this.setState({ - modalsType:true, - modalsTopval: may>0 ? "有 "+may+" 题未答":"", - modalsBottomval:"提交后无法再修改答题,是否确认提交?", - loadtype:false, - modalSave:this.sureSubmit + modalsType: true, + modalsTopval: may > 0 ? "有 " + may + " 题未答" : "", + modalsBottomval: "提交后无法再修改答题,是否确认提交?", + loadtype: false, + modalSave: this.sureSubmit }) } } - - cancelSubmit=()=>{ + + cancelSubmit = () => { this.setState({ - modalsType:false, - modalsTopval:"", - modalsBottomval:"" + modalsType: false, + modalsTopval: "", + modalsBottomval: "" }) } - - sureSubmit=()=>{ - let pollId=this.props.match.params.pollId; - let url=`/polls/${pollId}/commit_poll.json` - axios.post(url).then((result)=>{ - if(result.status == 200){ + + sureSubmit = () => { + let pollId = this.props.match.params.pollId; + let url = `/polls/${pollId}/commit_poll.json` + axios.post(url).then((result) => { + if (result.status == 200) { this.props.showNotification(result.data.message) this.setState({ - modalsType:false, - modalsTopval:"", - modalsBottomval:"" + modalsType: false, + modalsTopval: "", + modalsBottomval: "" }) - window.location.href=`/courses/${this.props.match.params.coursesId}/polls/${pollId}/detail` + window.location.href = `/courses/${this.props.match.params.coursesId}/polls/${pollId}/detail` } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } - render(){ - let coursesId=this.props.match.params.coursesId; - let{poll,question_answered,question_types,questions,courseName, + render() { + let coursesId = this.props.match.params.coursesId; + let { poll, question_answered, question_types, questions, courseName, inputArray, modalsType, modalsTopval, @@ -297,13 +296,13 @@ class PollInfo extends Component{ modalsBottomval, modalSave, questionPanelFixed - }=this.state; - const { current_user } = this.props - let isAdmin=this.props.isAdmin(); - let isStudent=this.props.isStudent(); - document.title=courseName&&courseName; - return( -
    + } = this.state; + const { current_user } = this.props + let isAdmin = this.props.isAdmin(); + let isStudent = this.props.isStudent(); + document.title = courseName && courseName; + return ( +
    {/*

    */} > 问卷 > - 问卷详情> - {question_types&&question_types.user_name} + 问卷详情> + {question_types && question_types.user_name}

    - {poll && poll.polls_name} + {poll && poll.polls_name} { - isAdmin || (poll && poll.user_poll_status == 1) ? 返回 :'' + isAdmin || (poll && poll.user_poll_status == 1) ? 返回 : '' } - +

    { poll && poll.polls_description && -

    {poll.polls_description}

    +

    {poll.polls_description}

    }

    @@ -346,15 +345,15 @@ class PollInfo extends Component{ } { question_types && question_types.q_doubles > 0 && - 多选题{ question_types && question_types.q_doubles }题 + 多选题{question_types && question_types.q_doubles}题 } { question_types && question_types.q_mains > 0 && - 主观题{question_types &&question_types.q_mains}题 + 主观题{question_types && question_types.q_mains}题 }

    - -
    + +

    已答 未答 @@ -362,12 +361,12 @@ class PollInfo extends Component{

      { - question_answered && question_answered.map((item,key)=>{ - return( + question_answered && question_answered.map((item, key) => { + return ( - { - this.scrollToAnchor(`${key}`)}>{item.ques_number} - } + { + this.scrollToAnchor(`${key}`)}>{item.ques_number} + } ) }) @@ -377,57 +376,57 @@ class PollInfo extends Component{
      { - questions && questions.map((item,key)=>{ - return( -
      + questions && questions.map((item, key) => { + return ( +
      {item.question.question_number}、{map[item.question.question_type]} - { item.question.is_necessary==1 ? 必答:选答 } - { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ? + {item.question.is_necessary == 1 ? 必答 : 选答} + {item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ? { - item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : - "可选"+item.question.min_choices+"-"+item.question.max_choices+"项" + item.question.min_choices == item.question.max_choices ? "可选" + item.question.max_choices + "项" : + "可选" + item.question.min_choices + "-" + item.question.max_choices + "项" } - :"" + : "" }
      -

      {item.question.question_title}

      +

      {item.question.question_title}

      { //单选 - item.question.question_type==1 && - + item.question.question_type == 1 && + { - item.question.answers && item.question.answers.map((i,k)=>{ - return( -
    • - - {i.answer_text} + item.question.answers && item.question.answers.map((i, k) => { + return ( +
    • + + {i.answer_text} { - i.answer_text=="其他" ? - - { - inputArray && inputArray.map((j,k)=>{ - return( - - { - j.id == item.question.id ? - this.saveInputAndAnswer(e,i.answer_id,item.question.id,key,item.question.question_type)} - /> - : "" - } - - ) - }) - } - - : "" + i.answer_text == "其他" ? + + { + inputArray && inputArray.map((j, k) => { + return ( + + { + j.id == item.question.id ? + this.saveInputAndAnswer(e, i.answer_id, item.question.id, key, item.question.question_type)} + /> + : "" + } + + ) + }) + } + + : "" }
    • ) @@ -437,40 +436,40 @@ class PollInfo extends Component{ } { //多选 - item.question.question_type==2 && - this.ChangeOptionMuntil(value,item.question.id,key)} - disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1)?true:false} - defaultValue={item.question.poll_answer_ids} - className="answerList" - name={key}> + item.question.question_type == 2 && + this.ChangeOptionMuntil(value, item.question.id, key)} + disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1) ? true : false} + defaultValue={item.question.poll_answer_ids} + className="answerList" + name={key}> { - item.question.answers && item.question.answers.map((i,k)=>{ - return( -
    • + item.question.answers && item.question.answers.map((i, k) => { + return ( +
    • - {i.answer_text} + {i.answer_text} { - i.answer_text=="其他"? - - { - inputArray && inputArray.map((j,k)=>{ - return( - - { - j.id == item.question.id ? - this.saveInputAndAnswer(e,i.answer_id,item.question.id,key,item.question.question_type)} - /> - : "" - } - - ) - }) - } - - :"" + i.answer_text == "其他" ? + + { + inputArray && inputArray.map((j, k) => { + return ( + + { + j.id == item.question.id ? + this.saveInputAndAnswer(e, i.answer_id, item.question.id, key, item.question.question_type)} + /> + : "" + } + + ) + }) + } + + : "" }
    • ) @@ -480,24 +479,24 @@ class PollInfo extends Component{ } { //主观题 - item.question.question_type==3 && + item.question.question_type == 3 &&
      { - inputArray && inputArray.map((j,k)=>{ - return( + inputArray && inputArray.map((j, k) => { + return ( - { - j.id == item.question.id ? - - : "" - } + { + j.id == item.question.id ? + + : "" + } ) }) }
      } - +
      ) }) @@ -505,11 +504,11 @@ class PollInfo extends Component{
      { - isStudent && poll && poll.user_poll_status == 0 ? -
      - 提交 -
      - :"" + isStudent && poll && poll.user_poll_status == 0 ? +
      + 提交 +
      + : "" }
    diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 77b2d8ec1..dd96f5f3e 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -134,43 +134,6 @@ class LoginDialog extends Component { Phonenumberisnotco: undefined, }) } - // let reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/; - // let reg1 = /^1\d{10}$/; - // let reg2=/^[a-zA-z]\w{3,14}$/; - // // let reg3=/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/; - // let value=this.refs.loginPassText.value; - // let valuenum= value.length; - // if(valuenum>0){ - // if(!reg.test(value)&&!reg1.test(value)&&!reg2.test(value)){ - // this.setState({regular:1}) - // return - // }else{ - // // this.setState({loginValue:value}); - // this.setState({regular:0}); - // var stirngt; - // if(value.length>0){ - // var str= value.replace(/\s*/g,"") - // stirngt=str; - // }else{ - // stirngt= value; - // } - // this.setState({ - // loginValue:stirngt, - // }); - // } - // }else{ - // this.setState({loginValue:value}); - // var stirngt; - // if(value.length>0){ - // var str= value.replace(/\s*/g,"") - // stirngt=str; - // }else{ - // stirngt= value; - // } - // this.setState({ - // loginValue:stirngt, - // }); - // } }; //邮箱手机号验证 Emailphonenumberverification = (value, id) => { @@ -388,49 +351,9 @@ class LoginDialog extends Component { } return response; }, (error) => { - // // if (error.response && error.response.data.error === '401 Unauthorized') { - // // this.back_url = window.location.href; - // // this.setState({ - // // isRender: true - // // }) - // // // TODO 这里如果样式变了会出现css不加载的情况 - // // const $ = window.$; - // // const ilessLoaded = window.getComputedStyle($('.log_nav li.active')[0], null) - // // .getPropertyValue('border-bottom') - // // == "2px solid rgb(69, 155, 229)" - // // if (!ilessLoaded) { - // // const isPort3007 = window.location.port == 3007; - // // let _url_origin = isPort3007 ? 'http://localhost:3000' : '' - // // - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) ); - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) ); - // // } - // // } - // // return Promise.reject(error); }); } handleDialogClose = () => { - // if(this.props.match.path==='/'){ - // this.setState({ - // isRender: false - // }) - // this.props.Modifyloginvalue(); - // }else{ - // if(this.props.isloginCancel===undefined){ - // window.location.href="/"; - // this.props.Modifyloginvalue(); - // // this.setState({ - // // isRender: false - // // }) - // // this.props.Modifyloginvalue(); - // }else{ - // this.setState({ - // isRender: false - // }) - // this.props.Modifyloginvalue(); - // } this.setState({ isRender: false @@ -438,14 +361,6 @@ class LoginDialog extends Component { this.props.Modifyloginvalue(); - // this.setState({ - // isRender: false - // }) - // try { - // this.props.Modifyloginvalue(); - // }catch (e) { - // - // } } loginEDU = () => { @@ -464,7 +379,6 @@ class LoginDialog extends Component { autologin: isGoingValue } ).then((response) => { - debugger; if (response === undefined) { return } diff --git a/public/react/src/modules/login/Trialapplicationysl.js b/public/react/src/modules/login/Trialapplicationysl.js index 4537a2826..df6a1d115 100644 --- a/public/react/src/modules/login/Trialapplicationysl.js +++ b/public/react/src/modules/login/Trialapplicationysl.js @@ -59,8 +59,6 @@ class Trialapplicationysl extends Component { } getipthon = () => { - // console.log("Trialapplicationysl"); - // console.log("70"); let url = `/users/get_user_info.json` axios.get(url).then((result) => { console.log(result); diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index 45310673f..7ec7415e5 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -1,10 +1,10 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; import { Spin, Pagination, } from "antd"; import axios from 'axios'; -import {getImageUrl, markdownToHTML} from 'educoder'; +import { getImageUrl, markdownToHTML } from 'educoder'; import "../css/messagemy.css" import NoneData from '../../../modules/courses/coursesPublic/NoneData' //消息页面 @@ -48,7 +48,7 @@ class MessagSub extends Component { this.setState({ isSpin: true, }) - let {limit} = this.state; + let { limit } = this.state; let url = `/users/tidings.json`; axios.get((url), { params: { @@ -80,7 +80,7 @@ class MessagSub extends Component { this.setState({ isSpin: true, }) - let {typeysl, page, limit} = this.state; + let { typeysl, page, limit } = this.state; let url = `/users/tidings.json`; axios.get((url), { params: { @@ -118,7 +118,7 @@ class MessagSub extends Component { gettourl = (item) => { switch (item.container_type) { - case "ApplyUserAuthentication" : + case "ApplyUserAuthentication": if (item.tiding_type === "Apply") { if (item.auth_type === 1) { //系统管理页面 @@ -134,13 +134,13 @@ class MessagSub extends Component { return window.open("/account/certification") } return; - case "CancelUserAuthentication" : + case "CancelUserAuthentication": // 账号管理页-认证信息 return window.open("/account/certification") - case "CancelUserProCertification" : + case "CancelUserProCertification": // 账号管理页-认证信息 return window.open("/account/certification") - case "ApplyAddDepartment" : + case "ApplyAddDepartment": if (item.tiding_type === "Apply") { //部门审批 return window.open("/admins/department_applies") @@ -150,7 +150,7 @@ class MessagSub extends Component { return window.open("/account/profile") } return; - case "ApplyAddSchools" : + case "ApplyAddSchools": if (item.tiding_type === "Apply") { // 单位审批 return window.open("/admins/unit_applies") @@ -160,9 +160,9 @@ class MessagSub extends Component { return window.open("/account/profile") } return; - case "ApplyAction" : + case "ApplyAction": switch (item.parent_container_type) { - case "ApplyShixun" : + case "ApplyShixun": if (item.tiding_type === "Apply") { return window.open("/admins/shixun_authorizations") } @@ -170,7 +170,7 @@ class MessagSub extends Component { // 实训详情页 :identifier = identifier return window.open(`/shixuns/${item.identifier}/challenges`) } - case "ApplySubject" : + case "ApplySubject": if (item.tiding_type === "Apply") { // 实训课程发布 return window.open("/admins/subject_authorizations") @@ -180,7 +180,7 @@ class MessagSub extends Component { return window.open(`/paths/${item.parent_container_id}`) } - case "TrialAuthorization" : + case "TrialAuthorization": if (item.tiding_type === "Apply") { // 试用授权页面 return window.open("/managements/trial_authorization") @@ -191,7 +191,7 @@ class MessagSub extends Component { } } return; - case 'JoinCourse' : + case 'JoinCourse': // 课堂详情页 :id = return window.open(`/courses/${item.belong_container_id}/teachers`) case 'StudentJoinCourse': @@ -203,34 +203,34 @@ class MessagSub extends Component { //教学案例详情 :id = container_id return window.open(`/courses/${item.belong_container_id}/students`); } - case 'DealCourse': + case 'DealCourse': // 课堂详情页 :id = container_id return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) case 'TeacherJoinCourse': // 课堂详情页 :id = container_id return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) - case 'Course' : + case 'Course': // 课堂详情页 :id = container_id if (item.tiding_type === "Delete") { return; } return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) - case 'ArchiveCourse' : + case 'ArchiveCourse': // 课堂详情页 :id = container_id return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) - case "Shixun" : + case "Shixun": return window.open(`/shixuns/${item.identifier}/challenges`) - case "Subject" : + case "Subject": // 课程汇总详情页 :id = container_id return window.open(`/paths/${item.container_id}`) - case "JournalsForMessage" : + case "JournalsForMessage": switch (item.parent_container_type) { - case "Principal" : + case "Principal": // 反馈页 :id = parent_container_id // 不用跳了 return ''; - case "HomeworkCommon" : + case "HomeworkCommon": //学生作业页 homework = parent_container_id if (item.homework_type === "normal") { //普通作业 @@ -245,10 +245,10 @@ class MessagSub extends Component { return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`) } return ""; - case "GraduationTopic" : + case "GraduationTopic": // 毕业目标页 parent_container_id return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) - case "StudentWorksScore" : + case "StudentWorksScore": //学生作业页 if (item.homework_type === "normal") { //普通作业 @@ -264,45 +264,45 @@ class MessagSub extends Component { } return ""; } - case "Memo" : + case "Memo": // 交流问答页 :id = parent_container_id return window.open(`/forums/${item.parent_container_id}`); - case "Message" : + case "Message": // 交流问答页 :id = parent_container_id return window.open(`/forums/`); - case "Watcher" : + case "Watcher": // 用户个人中心页 :id = item.trigger_user.login return window.open(`/users/${item.trigger_user.login}/courses`) - case "PraiseTread" : + case "PraiseTread": // 这块太复杂 不好处理 return ''; - case "Grade" : + case "Grade": //个人中心页 :id = item.trigger_user.login // return window.open(`/users/${item.trigger_user.login}/courses`; return ""; - case "JoinProject" : + case "JoinProject": //项目详情-申请加入项目审核页 :id = container_id return window.open(`/projects/${item.container_id}`) - case 'ReporterJoinProject': + case 'ReporterJoinProject': //项目详情页 :id = container_id return window.open(`/projects/${item.container_id}`) - case 'DealProject': + case 'DealProject': //项目详情页 :id = container_id return window.open(`/projects/${item.container_id}`) - case 'ManagerJoinProject': + case 'ManagerJoinProject': //项目详情页 :id = container_id return window.open(`/projects/${item.container_id}`) case "Poll": switch (item.parent_container_type) { - case "CommitPoll" : + case "CommitPoll": // 课堂id belong_container_id //课堂-学生已提交问卷列表 :id = container_id return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`) - default : + default: // 课堂-问卷列表 :id = container_id return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`) } - case "Exercise" : + case "Exercise": switch (item.parent_container_type) { case "CommitExercise": // 课堂-学生试卷详情 :id = container_id :user_id = trigger_user.id @@ -312,28 +312,28 @@ class MessagSub extends Component { // 课堂-学生试卷详情 :id = container_id :user_id = trigger_user.id return window.open(` /courses/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`); //记得跳评阅页面 - default : + default: // 课堂-试卷列表详情 :id = container_id return window.open(`/courses/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`); } - case 'StudentGraduationTopic' : + case 'StudentGraduationTopic': //课堂-毕业选题详情 :id = parent_container_id return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) - case 'DealStudentTopicSelect' : + case 'DealStudentTopicSelect': //课堂-毕业选题详情 :id = parent_container_id return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) - case 'GraduationTask' : + case 'GraduationTask': //课堂-毕业任务页 :id = container_id return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`) - case "GraduationWork" : + case "GraduationWork": //课堂-毕业xx页 :id = container_id return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`) - case "GraduationWorkScore" : + case "GraduationWorkScore": // 课堂-毕业xx页 :id = parent_container_id return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.parent_container_id}`) - case "HomeworkCommon" : + case "HomeworkCommon": switch (item.parent_container_type) { - case "AnonymousCommentFail" : + case "AnonymousCommentFail": // 课堂-作业列表 homework = container_id if (item.homework_type === "normal") { //普通作业 @@ -347,7 +347,7 @@ class MessagSub extends Component { //实训作业 return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } - case "HomeworkPublish" : + case "HomeworkPublish": if (item.homework_type === "normal") { //普通作业 return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) @@ -360,7 +360,7 @@ class MessagSub extends Component { //实训作业 return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } - case "AnonymousAppeal" : + case "AnonymousAppeal": if (item.homework_type === "normal") { //普通作业 return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) @@ -373,7 +373,7 @@ class MessagSub extends Component { //实训作业 return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } - default : + default: // 课堂-作业列表 homework = container_id if (item.homework_type === "normal") { //普通作业 @@ -388,7 +388,7 @@ class MessagSub extends Component { return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } } - case "StudentWork" : + case "StudentWork": //课堂-作业 :id = container_id if (item.homework_type === "normal") { //普通作业 @@ -402,54 +402,29 @@ class MessagSub extends Component { //实训作业 return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) } - case "StudentWorksScore" : - //课堂-作业 :id = parent_container_id - // if(item.homework_type==="normal"){ - // //普通作业 - // return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) - // } - // if(item.homework_type==="group"){ - // //分组作业 - // return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) - // } - // if(item.homework_type==="practice"){ - // //实训作业 - // return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) - // } + case "StudentWorksScore": return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); - case "StudentWorksScoresAppeal" : - // if(item.homework_type==="normal"){ - // //普通作业 - // return window.open(`courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) - // } - // if(item.homework_type==="group"){ - // //分组作业 - // return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/list`) - // } - // if(item.homework_type==="practice"){ - // //实训作业 - // return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`) - // } + case "StudentWorksScoresAppeal": return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); - case "ChallengeWorkScore" : + case "ChallengeWorkScore": return ''; - case "SendMessage" : + case "SendMessage": // /managements/mirror_repository return window.open(`/managements/mirror_repository`) - case "Journal" : + case "Journal": //项目Issue页 :id = parent_container_id return window.open(`/issues/${item.parent_container_id}`); - case "Issue" : + case "Issue": //项目Issue页 :id = container_id return window.open(`/issues/${item.container_id}`) - case "PullRequest" : + case "PullRequest": // 项目pull request页 :id = parent_container_id return window.open(`/projects/${item.parent_container_id}/pull_requests`) - case "Department" : + case "Department": //账号管理页 return window.open(`/account/profile`) - case "Library" : + case "Library": if (item.tiding_type === 'Apply') { // /managements/library_applies return window.open(`/admins/library_applies`) @@ -458,7 +433,7 @@ class MessagSub extends Component { //教学案例详情 :id = container_id return window.open(`/moop_cases/${item.container_id}`) } - case "ProjectPackage" : + case "ProjectPackage": if (item.tiding_type === "Destroyed") { return; } @@ -516,14 +491,14 @@ class MessagSub extends Component { if (item.extra && item.parent_container_type !== 'HackDelete') { return window.open(`/problems/${item.extra}/edit`); } - default : + default: return } } render() { - let {page, limit, typeysl, count, isSpin, data} = this.state; + let { page, limit, typeysl, count, isSpin, data } = this.state; // console.log("6868686868"); console.log(data); return ( @@ -614,12 +589,12 @@ class MessagSub extends Component { className={boolps === true ? "ridinglist-sub clearfix df tiding_item" : "ridinglist-subs clearfix df tiding_item"} onClick={() => this.gettourl(item)}> this.myCome(item)} - src={getImageUrl("images/" + item.trigger_user.image_url)} - className="radius mr10 fl myimgw48 myimgh48"/> + src={getImageUrl("images/" + item.trigger_user.image_url)} + className="radius mr10 fl myimgw48 myimgh48" />

    this.myCome(item)}>{item.trigger_user.name} + onMouseDown={() => this.myCome(item)}>{item.trigger_user.name} {item.time} {item.tiding_type === "Apply" ? ( item.status === 0 ? @@ -639,8 +614,8 @@ class MessagSub extends Component { ` } -

    +

    @@ -655,13 +630,13 @@ class MessagSub extends Component { {data === undefined ? "" : (count > 10 ? -
    -
    - -
    -
    : "" +
    +
    + +
    +
    : "" ) } diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 17bd92001..5afa9bae9 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import { Redirect } from 'react-router'; -import AccountProfile from"../user/AccountProfile"; +import AccountProfile from "../user/AccountProfile"; import PropTypes from 'prop-types'; import Certifiedprofessional from "../../modules/modals/Certifiedprofessional" @@ -9,11 +9,11 @@ import Certifiedprofessional from "../../modules/modals/Certifiedprofessional" // /images/educoder/icon/search.svg -import { getImageUrl, toPath ,trigger,broadcastChannelPostMessage} from 'educoder' +import { getImageUrl, toPath, trigger, broadcastChannelPostMessage } from 'educoder' import axios from 'axios'; -import { Modal,Checkbox ,Radio,Input,message,notification,Popover} from 'antd'; +import { Modal, Checkbox, Radio, Input, message, notification, Popover } from 'antd'; import Addcourses from '../courses/coursesPublic/Addcourses'; @@ -50,53 +50,53 @@ window._header_componentHandler = null; class NewHeader extends Component { constructor(props) { super(props) - this.state={ - Addcoursestypes:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - RadioGroupvalue:undefined, - submitapplications:false, - isRender:false, - showSearchOpentype:false, - showTrial:false, - setevaluatinghides:false, - occupation:0, - mydisplay:false, - headtypesonClickbool:false, - headtypess:"/", - mygetHelmetapi2: null, - goshowqqgtounp:false, - visiblemyss:false, + this.state = { + Addcoursestypes: false, + tojoinitemtype: false, + tojoinclasstitle: undefined, + rolearr: ["", ""], + Checkboxteacherchecked: false, + Checkboxstudentchecked: false, + Checkboxteachingchecked: false, + Checkboxteachertype: false, + Checkboxteachingtype: false, + code_notice: false, + checked_notice: false, + RadioGroupvalue: undefined, + submitapplications: false, + isRender: false, + showSearchOpentype: false, + showTrial: false, + setevaluatinghides: false, + occupation: 0, + mydisplay: false, + headtypesonClickbool: false, + headtypess: "/", + mygetHelmetapi2: null, + goshowqqgtounp: false, + visiblemyss: false, } - // console.log("176") + // console.log("176") // console.log(props); // console.log("NewHeader1234567890"); // console.log(this.props); } - componentDidUpdate = (prevProps) => { - // console.log("componentDidMount2"); - // console.log(this.state.mygetHelmetapi2); - if(this.state.mygetHelmetapi2===undefined){ - this.getAppdata(); - } - } + componentDidUpdate = (prevProps) => { + // console.log("componentDidMount2"); + // console.log(this.state.mygetHelmetapi2); + if (this.state.mygetHelmetapi2 === undefined) { + this.getAppdata(); + } + } componentDidMount() { - // console.log("componentDidMount1"); - this.getAppdata(); + // console.log("componentDidMount1"); + this.getAppdata(); window._header_componentHandler = this; //下拉框的显示隐藏 var hoverTimeout; var hoveredPanel; - $(".edu-menu-panel").hover(function(){ + $(".edu-menu-panel").hover(function () { if (hoverTimeout) { // 一次只显示一个panel if (hoveredPanel && hoveredPanel != this) { $(hoveredPanel).find(".edu-menu-list").hide() @@ -106,21 +106,21 @@ class NewHeader extends Component { } hoveredPanel = this; $(this).find(".edu-menu-list").show(); - },function(){ - var that =this; + }, function () { + var that = this; // 延迟hide - hoverTimeout = setTimeout(function() { + hoverTimeout = setTimeout(function () { $(that).find(".edu-menu-list").hide(); }, 800) }); //获取游览器地址 - try { - window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href)) - } catch (e) { + try { + window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href)) + } catch (e) { - } + } // axios.interceptors.response.use((response) => { // if (response != undefined) // if (response && response.data.status === -1) { @@ -165,33 +165,33 @@ class NewHeader extends Component { notification.open({ message: "提示", description: - messge, + messge, }); }; componentWillReceiveProps(newProps, oldProps) { this.setState({ - user:newProps.user + user: newProps.user }) - if(newProps.Headertop!=undefined){ - old_url=newProps.Headertop.old_url + if (newProps.Headertop != undefined) { + old_url = newProps.Headertop.old_url } } - getCookie=(key)=>{ - var arr,reg = RegExp('(^| )'+key+'=([^;]+)(;|$)'); + getCookie = (key) => { + var arr, reg = RegExp('(^| )' + key + '=([^;]+)(;|$)'); if (arr = document.cookie.match(reg)) //["username=liuwei;", "", "liuwei", ";"] return decodeURIComponent(arr[2]); else return null; } - delCookie=(name)=>{ + delCookie = (name) => { var exp = new Date(); exp.setTime(exp.getTime() - 1); - var cval=this.getCookie(name); - if(cval!=null){ - document.cookie= name + "="+cval+";expires="+exp.toGMTString(); + var cval = this.getCookie(name); + if (cval != null) { + document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString(); } } onLogout = () => { @@ -200,96 +200,93 @@ class NewHeader extends Component { axios.get(url, { }) .then((response) => { - if(response.data.status===1){ + if (response.data.status === 1) { this.setState({ - user:undefined + user: undefined }) - // let path="/"; - // this.props.history.push(path); - // broadcastChannelPostMessage('refreshPage') - window.location.href ="/login" + window.location.href = "/login" message.success('退出成功'); } }); } - tojoinclass=()=>{ - let{user} =this.state; - if(user===undefined){ + tojoinclass = () => { + let { user } = this.state; + if (user === undefined) { this.setState({ - isRender:true + isRender: true }) return } - if(user&&user.login===""){ + if (user && user.login === "") { this.setState({ - isRender:true + isRender: true }) return; } - if(user&&user.profile_completed===false){ - this.setState({ - AccountProfiletype:true - }) - return; - } + if (user && user.profile_completed === false) { + this.setState({ + AccountProfiletype: true + }) + return; + } - this.setState({ - Addcoursestypes:true, + this.setState({ + Addcoursestypes: true, }) } - tojoinitem=()=>{ - if(this.props.user&&this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){ - this.openNotification("请先绑定邮箱,谢谢"); - return - } - let{user} =this.state; - if(user===undefined){ + tojoinitem = () => { + if (this.props.user && this.props.user.email === undefined || this.props.user && this.props.user.email === null || this.props.user && this.props.user.email === "") { + this.openNotification("请先绑定邮箱,谢谢"); + return + } + let { user } = this.state; + if (user === undefined) { this.setState({ - isRender:true + isRender: true }) return } - if(user&&user.login===""){ + if (user && user.login === "") { this.setState({ - isRender:true + isRender: true }) return; } - if(user&&user.profile_completed===false){ - this.setState({ - AccountProfiletype:true - }) - return; - } + if (user && user.profile_completed === false) { + this.setState({ + AccountProfiletype: true + }) + return; + } - this.setState({ - tojoinitemtype:true + this.setState({ + tojoinitemtype: true }) } - submitstatevalue=(sum,value,data)=>{ + submitstatevalue = (sum, value, data) => { this.setState({ - Addcoursestypes:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - submitapplicationssum:sum, - submitapplications:true, - submitapplicationsvalue:value, - submitapplicationsvaluedata:data, - RadioGroupvalue:undefined + Addcoursestypes: false, + tojoinitemtype: false, + tojoinclasstitle: undefined, + rolearr: ["", ""], + Checkboxteacherchecked: false, + Checkboxstudentchecked: false, + Checkboxteachingchecked: false, + Checkboxteachertype: false, + Checkboxteachingtype: false, + code_notice: false, + checked_notice: false, + submitapplicationssum: sum, + submitapplications: true, + submitapplicationsvalue: value, + submitapplicationsvaluedata: data, + RadioGroupvalue: undefined }) } @@ -299,80 +296,53 @@ class NewHeader extends Component { }); } - submitsubmitapplications=()=>{ + submitsubmitapplications = () => { let { submitapplicationssum, submitapplicationsvaluedata - }=this.state; + } = this.state; this.setState({ - submitapplications:false, - RadioGroupvalue:undefined + submitapplications: false, + RadioGroupvalue: undefined }) - if(submitapplicationssum===0){ - if(submitapplicationsvaluedata!=undefined){ - window.location.href = "/courses/"+submitapplicationsvaluedata; + if (submitapplicationssum === 0) { + if (submitapplicationsvaluedata != undefined) { + window.location.href = "/courses/" + submitapplicationsvaluedata; } - }else if(submitapplicationssum===1){ - if(submitapplicationsvaluedata!=undefined){ - window.location.href = "/projects/"+submitapplicationsvaluedata; + } else if (submitapplicationssum === 1) { + if (submitapplicationsvaluedata != undefined) { + window.location.href = "/projects/" + submitapplicationsvaluedata; } } } - hidesubmitapplications=()=>{ + hidesubmitapplications = () => { this.setState({ - Addcoursestypes:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - submitapplications:false, - RadioGroupvalue:undefined + Addcoursestypes: false, + tojoinitemtype: false, + tojoinclasstitle: undefined, + rolearr: ["", ""], + Checkboxteacherchecked: false, + Checkboxstudentchecked: false, + Checkboxteachingchecked: false, + Checkboxteachertype: false, + Checkboxteachingtype: false, + code_notice: false, + checked_notice: false, + submitapplications: false, + RadioGroupvalue: undefined }) } - educoderlogin=()=>{ + educoderlogin = () => { //登录账号 this.setState({ - isRender:true + isRender: true }) - // var url = `/accounts/logout.json`; - // - // axios.get((url)).then((result) => { - // if(result!==undefined){ - // // this.setState({ - // // isRender:true - // // }) - // window.location.href = "/"; - // } - // }).catch((error) => { - // console.log(error); - // }) } - educoderloginysl=()=>{ - //退出账号 - // this.setState({ - // isRender:true - // }) - // let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings' - // let shixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess' - // let openopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype' + educoderloginysl = () => { var url = `/accounts/logout.json`; - // let storage=window.localStorage; axios.get((url)).then((result) => { - // storage.removeItem(newTPMsettings); - // storage.removeItem(shixunopenprocess); - // storage.removeItem( openopenpublictype); - if(result!==undefined){ - // this.setState({ - // isRender:true - // }) - // broadcastChannelPostMessage('refreshPage') + if (result !== undefined) { window.location.href = "/"; } }).catch((error) => { @@ -380,184 +350,184 @@ class NewHeader extends Component { }) } - hideAddcoursestypes=()=>{ + hideAddcoursestypes = () => { this.setState({ - Addcoursestypes:false + Addcoursestypes: false }) }; - HideAddcoursestypess=(i)=>{ + HideAddcoursestypess = (i) => { console.log("调用了"); this.setState({ - Addcoursestypes:false, - mydisplay:true, - occupation:i, + Addcoursestypes: false, + mydisplay: true, + occupation: i, }) }; - ModalCancelsy=()=>{ + ModalCancelsy = () => { this.setState({ - mydisplay:false, + mydisplay: false, }) }; - hidetojoinclass=()=>{ + hidetojoinclass = () => { this.setState({ - tojoinclasstype:false, - tojoinitemtype:false, - tojoinclasstitle:undefined, - rolearr:["",""], - Checkboxteacherchecked:false, - Checkboxstudentchecked:false, - Checkboxteachingchecked:false, - Checkboxteachertype:false, - Checkboxteachingtype:false, - code_notice:false, - checked_notice:false, - RadioGroupvalue:undefined + tojoinclasstype: false, + tojoinitemtype: false, + tojoinclasstitle: undefined, + rolearr: ["", ""], + Checkboxteacherchecked: false, + Checkboxstudentchecked: false, + Checkboxteachingchecked: false, + Checkboxteachertype: false, + Checkboxteachingtype: false, + code_notice: false, + checked_notice: false, + RadioGroupvalue: undefined }) } -submittojoinclass=(value)=>{ - let {tojoinclasstitle,rolearr,RadioGroupvalue}=this.state; + submittojoinclass = (value) => { + let { tojoinclasstitle, rolearr, RadioGroupvalue } = this.state; - if(tojoinclasstitle===undefined){ - this.setState({ - code_notice:true - }) - return - } - let newrolearr=rolearr; - // if(value===1){ - if(tojoinclasstitle.length<6){ + if (tojoinclasstitle === undefined) { this.setState({ - code_notice:true + code_notice: true }) return } - // }else if(value===0){ - // if(tojoinclasstitle.length<5){ - // this.setState({ - // code_notice:true - // }) - // return - // } - // } - if(tojoinclasstitle===""||tojoinclasstitle===undefined){ - this.setState({ - code_notice:true - }) - return - }else{ - this.setState({ - code_notice:false - }) - } + let newrolearr = rolearr; + // if(value===1){ + if (tojoinclasstitle.length < 6) { + this.setState({ + code_notice: true + }) + return + } + // }else if(value===0){ + // if(tojoinclasstitle.length<5){ + // this.setState({ + // code_notice:true + // }) + // return + // } + // } + if (tojoinclasstitle === "" || tojoinclasstitle === undefined) { + this.setState({ + code_notice: true + }) + return + } else { + this.setState({ + code_notice: false + }) + } - let pamst=[]; - let num=0; - for(var i = 0 ; i { - // if( response.data.state===0){ - // this.submitstatevalue(0,"加入成功",response.data.course_id) - // }else if( response.data.state===1){ - // }else if( response.data.state===2){ - // this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)") - // }else if( response.data.state===3){ - // this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id) - // }else if( response.data.state===4){ - // this.submitstatevalue( 0,"您输入的邀请码错误)") - // }else if( response.data.state===5){ - // this.submitstatevalue( 0,"您还未登录") - // }else if( response.data.state===6){ - // this.submitstatevalue( 0,"申请已提交,请等待审核") - // }else if( response.data.state===7){ - // this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待") - // }else if( response.data.state===8){ - // this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id) - // }else if( response.data.state==9){ - // this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id) - // }else if( response.data.state==10){ - // this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id) - // }else if( response.data.state==11){ - // this.submitstatevalue(0," 该课堂已归档,请联系老师") - // }else if( response.data.state==12){ - // this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师") - // }else if( response.data.state==13){ - // this.submitstatevalue(0,"您申请已提交,请等待审核") - // }else if( response.data.state==14){ - // this.submitstatevalue("此邀请码已停用,请与老师联系") - // }else if( response.data.state==15){ - // this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行") - // }else { - // this.submitstatevalue(0," 未知错误,请稍后再试") - // } - // }) - // - // } + // if(value===0){ + // let url="/courses/join_course_multi_role.json" + // const form = new FormData(); + // form.append('invite_code', tojoinclasstitle); + // form.append('role', pamst); + // form.append('type', 1); + // axios.post(url,form,[true] + // ).then((response) => { + // if( response.data.state===0){ + // this.submitstatevalue(0,"加入成功",response.data.course_id) + // }else if( response.data.state===1){ + // }else if( response.data.state===2){ + // this.submitstatevalue( 0,"课堂已过期! 请联系课堂管理员重启课堂。(在配置课堂处)") + // }else if( response.data.state===3){ + // this.submitstatevalue( 0,"您已是课堂成员)",response.data.course_id) + // }else if( response.data.state===4){ + // this.submitstatevalue( 0,"您输入的邀请码错误)") + // }else if( response.data.state===5){ + // this.submitstatevalue( 0,"您还未登录") + // }else if( response.data.state===6){ + // this.submitstatevalue( 0,"申请已提交,请等待审核") + // }else if( response.data.state===7){ + // this.submitstatevalue( 0," 您已经发送过申请了,请耐心等待") + // }else if( response.data.state===8){ + // this.submitstatevalue( 0,"您已经是该课堂的教师了",response.data.course_id) + // }else if( response.data.state==9){ + // this.submitstatevalue( 0,"您已经是该课堂的教辅了",response.data.course_id) + // }else if( response.data.state==10){ + // this.submitstatevalue(0,"您已经是该课堂的管理员了",response.data.course_id) + // }else if( response.data.state==11){ + // this.submitstatevalue(0," 该课堂已归档,请联系老师") + // }else if( response.data.state==12){ + // this.submitstatevalue(0,"您已经发送过申请了,请耐心等待师") + // }else if( response.data.state==13){ + // this.submitstatevalue(0,"您申请已提交,请等待审核") + // }else if( response.data.state==14){ + // this.submitstatevalue("此邀请码已停用,请与老师联系") + // }else if( response.data.state==15){ + // this.submitstatevalue(0,"您已是课堂成员! 加入分班请在课堂具体分班页面进行") + // }else { + // this.submitstatevalue(0," 未知错误,请稍后再试") + // } + // }) + // + // } - if(value===1){ - let url="/project_applies.json" - // const form = new FormData(); - // form.append('code', tojoinclasstitle); - // form.append('role', RadioGroupvalue); - // form.append('type', 1); - axios.post(url,{ - code:tojoinclasstitle, - role:RadioGroupvalue - } - ).then((response) => { - if( response.data.status===1){ - this.submitstatevalue(1,"您输入的邀请码错误") - }else if( response.data.status===2){ - this.submitstatevalue( 1,"您已经是该项目成员",response.data.project) - }else if( response.data.status===3){ - this.submitstatevalue( 1,"请选择一个角色") - }else if( response.data.status===4){ - this.submitstatevalue( 1,"您的申请已提交,请等待项目管理员审批") - }else if( response.data.status===5){ - this.submitstatevalue( 1,"您已经申请加入该项目了,请耐心等待") - }else if( response.data.status===6){ - this.submitstatevalue( 1,"您已成功加入项目",response.data.project) - }else if( response.data.status===0){ - if(RadioGroupvalue==="reporter"){ - this.openNotification("您加入项目成功!"); - window.location.href=`/projects/${response.data.project_id}`; - }else{ - this.openNotification("您的申请已提交,请等待项目管理员审批!"); - } - } - }) + if (value === 1) { + let url = "/project_applies.json" + // const form = new FormData(); + // form.append('code', tojoinclasstitle); + // form.append('role', RadioGroupvalue); + // form.append('type', 1); + axios.post(url, { + code: tojoinclasstitle, + role: RadioGroupvalue + } + ).then((response) => { + if (response.data.status === 1) { + this.submitstatevalue(1, "您输入的邀请码错误") + } else if (response.data.status === 2) { + this.submitstatevalue(1, "您已经是该项目成员", response.data.project) + } else if (response.data.status === 3) { + this.submitstatevalue(1, "请选择一个角色") + } else if (response.data.status === 4) { + this.submitstatevalue(1, "您的申请已提交,请等待项目管理员审批") + } else if (response.data.status === 5) { + this.submitstatevalue(1, "您已经申请加入该项目了,请耐心等待") + } else if (response.data.status === 6) { + this.submitstatevalue(1, "您已成功加入项目", response.data.project) + } else if (response.data.status === 0) { + if (RadioGroupvalue === "reporter") { + this.openNotification("您加入项目成功!"); + window.location.href = `/projects/${response.data.project_id}`; + } else { + this.openNotification("您的申请已提交,请等待项目管理员审批!"); + } + } + }) + } + this.hidetojoinclass() } - this.hidetojoinclass() -} // trialapplications =()=>{ // console.log("点击了") @@ -569,106 +539,106 @@ submittojoinclass=(value)=>{ // 关闭 cancelModulationModels = () => { - this.setState({isRenders: false}) + this.setState({ isRenders: false }) } - inputjoinclassvalue=(e)=>{ + inputjoinclassvalue = (e) => { console.log(e.target.value.length); - if(e.target.value.length>=7){ + if (e.target.value.length >= 7) { this.openNotification("请输入6位项目邀请码!"); return } this.setState({ - tojoinclasstitle:e.target.value + tojoinclasstitle: e.target.value }) } - showSearchOpen=(e)=>{ - this.setState({ - showSearchOpentype:true - }) - - } - - hideshowSearchOpen=(e)=>{ - let {setevaluatinghides}=this.state; - if(setevaluatinghides===true){ - this.setState({ - showSearchOpentype:false, - setevaluatinghides:false - }) - - } - } - - onKeywordSearchKeyDown = (value) => { - let url=`/search?value=${value}`; - this.props.history.push(url) - } - - onKeywordSearchKeyDowns=()=>{ - this.setState( - { - setevaluatinghides:false - } - ) - } - - setevaluatinghides=()=>{ - this.setState( - { - setevaluatinghides:true - } - ) - } - //头部获取是否已经登录了 - getUser=(url,type)=>{ - - if(type==="projects"){ - if(this.props.user&&this.props.user.email===undefined||this.props.user&&this.props.user.email===null||this.props.user&&this.props.user.email===""){ - this.openNotification("请先绑定邮箱,谢谢"); - return - } - } + showSearchOpen = (e) => { + this.setState({ + showSearchOpentype: true + }) + + } + + hideshowSearchOpen = (e) => { + let { setevaluatinghides } = this.state; + if (setevaluatinghides === true) { + this.setState({ + showSearchOpentype: false, + setevaluatinghides: false + }) + + } + } + + onKeywordSearchKeyDown = (value) => { + let url = `/search?value=${value}`; + this.props.history.push(url) + } + + onKeywordSearchKeyDowns = () => { + this.setState( + { + setevaluatinghides: false + } + ) + } + + setevaluatinghides = () => { + this.setState( + { + setevaluatinghides: true + } + ) + } + //头部获取是否已经登录了 + getUser = (url, type) => { + + if (type === "projects") { + if (this.props.user && this.props.user.email === undefined || this.props.user && this.props.user.email === null || this.props.user && this.props.user.email === "") { + this.openNotification("请先绑定邮箱,谢谢"); + return + } + } // console.log("点击了503") // console.log(url); - let{user} =this.state; + let { user } = this.state; - if(user===undefined){ - this.setState({ - isRender:true - }) - return + if (user === undefined) { + this.setState({ + isRender: true + }) + return } - if(user&&user.login===""){ + if (user && user.login === "") { this.setState({ - isRender:true + isRender: true }) return; } - if(user&&user.profile_completed===false){ - this.setState({ - AccountProfiletype:true - }) - return; - } + if (user && user.profile_completed === false) { + this.setState({ + AccountProfiletype: true + }) + return; + } - if(type==="newshixuns"){ - if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ - this.setgoshowqqgtounp(true); - return; + if (type === "newshixuns") { + if (this.props && this.props.current_user && this.props.current_user.is_shixun_marker === false) { + this.setgoshowqqgtounp(true); + return; + } } - } - if(url !== undefined || url!==""){ + if (url !== undefined || url !== "") { window.location.href = url; } @@ -676,211 +646,211 @@ submittojoinclass=(value)=>{ } //修改登录方法 - Modifyloginvalue=()=>{ + Modifyloginvalue = () => { this.setState({ - isRender:false, + isRender: false, }) } - hideAccountProfile=()=>{ - this.setState({ - AccountProfiletype:false - }) - }; - headtypesonClick=(url,bool)=>{ - this.setState({ - headtypess:url, - headtypesonClickbool:bool, - }) - } - //获取数据为空的时候 - gettablogourlnull = () => { - this.setState({ - mygetHelmetapi2: undefined - }); - document.title = "EduCoder"; - var link = document.createElement('link'), - oldLink = document.getElementById('dynamic-favicon'); - link.id = 'dynamic-favicon'; - link.rel = 'shortcut icon'; - link.href = "/react/build/./favicon.ico"; - if (oldLink) { - document.head.removeChild(oldLink); - } - document.head.appendChild(link); - }; - - //获取数据的时候 - gettablogourldata = (response) => { - document.title = response.data.setting.name; - var link = document.createElement('link'), - oldLink = document.getElementById('dynamic-favicon'); - link.id = 'dynamic-favicon'; - link.rel = 'shortcut icon'; - link.href = '/' + response.data.setting.tab_logo_url; - if (oldLink) { - document.head.removeChild(oldLink); - } - document.head.appendChild(link); - } - - - handleVisibleChanges = (boll) => { - this.setState({ - visiblemyss: boll, - }) - - } - - - getAppdata=()=>{ - try { - var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting')); - var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse')); - // console.log("NewHeaderNewHeaderNewHeader"); - // console.log(chromesettingArray); - // console.log(chromesettingresponseArray); - - this.setState({ - mygetHelmetapi2:chromesettingArray - }); - if (chromesettingArray.tab_logo_url) { - this.gettablogourldata(chromesettingresponseArray); - } else { - this.gettablogourlnull(); - } - }catch (e) { - console.log("head获取游览器配置失败 重新请求开始读取配置"); - this.geturlsdata(); - } - }; - - geturlsdata=()=>{ - let url = "/setting.json"; - axios.get(url).then((response) => { - // console.log("app.js开始请求/setting.json"); - // console.log("获取当前定制信息"); - if(response){ - if(response.data){ - this.setState({ - mygetHelmetapi2:response.data.setting - }); - localStorage.setItem('chromesetting',JSON.stringify(response.data.setting)); - localStorage.setItem('chromesettingresponse',JSON.stringify(response)); - try { - if (response.data.setting.tab_logo_url) { - this.gettablogourldata(response); - } else { - this.gettablogourlnull(); - } - } catch (e) { - this.gettablogourlnull(); - } + hideAccountProfile = () => { + this.setState({ + AccountProfiletype: false + }) + }; + headtypesonClick = (url, bool) => { + this.setState({ + headtypess: url, + headtypesonClickbool: bool, + }) + } + //获取数据为空的时候 + gettablogourlnull = () => { + this.setState({ + mygetHelmetapi2: undefined + }); + document.title = "EduCoder"; + var link = document.createElement('link'), + oldLink = document.getElementById('dynamic-favicon'); + link.id = 'dynamic-favicon'; + link.rel = 'shortcut icon'; + link.href = "/react/build/./favicon.ico"; + if (oldLink) { + document.head.removeChild(oldLink); + } + document.head.appendChild(link); + }; + + //获取数据的时候 + gettablogourldata = (response) => { + document.title = response.data.setting.name; + var link = document.createElement('link'), + oldLink = document.getElementById('dynamic-favicon'); + link.id = 'dynamic-favicon'; + link.rel = 'shortcut icon'; + link.href = '/' + response.data.setting.tab_logo_url; + if (oldLink) { + document.head.removeChild(oldLink); + } + document.head.appendChild(link); + } + + handleVisibleChanges = (boll) => { + this.setState({ + visiblemyss: boll, + }) - } else { + } - this.gettablogourlnull(); - } + getAppdata = () => { + try { + var chromesettingArray = JSON.parse(localStorage.getItem('chromesetting')); + var chromesettingresponseArray = JSON.parse(localStorage.getItem('chromesettingresponse')); + // console.log("NewHeaderNewHeaderNewHeader"); + // console.log(chromesettingArray); + // console.log(chromesettingresponseArray); - } else { - this.gettablogourlnull(); + this.setState({ + mygetHelmetapi2: chromesettingArray + }); + if (chromesettingArray.tab_logo_url) { + this.gettablogourldata(chromesettingresponseArray); + } else { + this.gettablogourlnull(); + } + } catch (e) { + console.log("head获取游览器配置失败 重新请求开始读取配置"); + this.geturlsdata(); + } + }; - } + geturlsdata = () => { + let url = "/setting.json"; + axios.get(url).then((response) => { + // console.log("app.js开始请求/setting.json"); + // console.log("获取当前定制信息"); + if (response) { + if (response.data) { + this.setState({ + mygetHelmetapi2: response.data.setting + }); + localStorage.setItem('chromesetting', JSON.stringify(response.data.setting)); + localStorage.setItem('chromesettingresponse', JSON.stringify(response)); + try { + if (response.data.setting.tab_logo_url) { + this.gettablogourldata(response); + } else { + this.gettablogourlnull(); + } + } catch (e) { + this.gettablogourlnull(); + } - }).catch((error) => { - this.gettablogourlnull(); - }); - } + } else { + this.gettablogourlnull(); - matchpaths=(url)=>{ - const {match} = this.props; - if (url=== '/forums'&&match.path === '/forums') { - return true - } else if (url.startsWith('/shixuns')&&match.path.startsWith('/shixuns')) { - return true - }else if (url.startsWith('/paths')&&match.path.startsWith('/paths')) { - return true - } else if (url.startsWith('/courses')&&match.path.startsWith('/courses')) { - return true - }else if (url.startsWith('/competitions')&&match.path.startsWith('/competitions')) { - return true - }else if (url.startsWith('/crowdsourcing')&&match.path.startsWith('/crowdsourcing')) { - return true - }else if(url.startsWith('/moop_cases')&&match.path.startsWith('/moop_cases')){ - return true - }else if(url.startsWith('/developer')&&match.path.startsWith('/developer')){ - return true - }else { - return false } + + } else { + this.gettablogourlnull(); + + } + + }).catch((error) => { + this.gettablogourlnull(); + + }); + } + + + matchpaths = (url) => { + const { match } = this.props; + if (url === '/forums' && match.path === '/forums') { + return true + } else if (url.startsWith('/shixuns') && match.path.startsWith('/shixuns')) { + return true + } else if (url.startsWith('/paths') && match.path.startsWith('/paths')) { + return true + } else if (url.startsWith('/courses') && match.path.startsWith('/courses')) { + return true + } else if (url.startsWith('/competitions') && match.path.startsWith('/competitions')) { + return true + } else if (url.startsWith('/crowdsourcing') && match.path.startsWith('/crowdsourcing')) { + return true + } else if (url.startsWith('/moop_cases') && match.path.startsWith('/moop_cases')) { + return true + } else if (url.startsWith('/developer') && match.path.startsWith('/developer')) { + return true + } else { + return false } + } - // 处理弹框 - setgoshowqqgtounp=(bool)=>{ - this.setState({ - goshowqqgtounp:bool - }) - } + // 处理弹框 + setgoshowqqgtounp = (bool) => { + this.setState({ + goshowqqgtounp: bool + }) + } render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 - const {match} = this.props; + const { match } = this.props; - let {Addcoursestypes, + let { Addcoursestypes, tojoinitemtype, tojoinclasstitle, code_notice, checked_notice, - AccountProfiletype, + AccountProfiletype, submitapplications, submitapplicationsvalue, user, isRender, - showSearchOpentype, - headtypesonClickbool, - headtypess, - mygetHelmetapi2, - goshowqqgtounp, - }=this.state; + showSearchOpentype, + headtypesonClickbool, + headtypess, + mygetHelmetapi2, + goshowqqgtounp, + } = this.state; /* 用户名称 用户头像url */ - let activeIndex = false; - let activeForums = false; - let activeShixuns = false; - let activePaths = false; - let coursestype=false; - let activePackages=false; - let activeMoopCases=false; - let activeCompetitions=false; - - if (match.path === '/forums') { - activeForums = true; - } else if (match.path.startsWith('/shixuns')) { - activeShixuns = true; - }else if (match.path.startsWith('/paths')) { - activePaths = true; - } else if (match.path.startsWith('/courses')) { - coursestype = true; - }else if (match.path.startsWith('/crowdsourcing')) { - activePackages = true; - }else if(match.path.startsWith('/moop_cases')){ - activeMoopCases = true; - }else if(match.path.startsWith('/competitions')){ - activeCompetitions = true; - }else { - activeIndex = true; - } - - let headtypes='/'; - - // console.log("mygetHelmetapi2"); - // console.log(mygetHelmetapi2); - if(mygetHelmetapi2) { + let activeIndex = false; + let activeForums = false; + let activeShixuns = false; + let activePaths = false; + let coursestype = false; + let activePackages = false; + let activeMoopCases = false; + let activeCompetitions = false; + + if (match.path === '/forums') { + activeForums = true; + } else if (match.path.startsWith('/shixuns')) { + activeShixuns = true; + } else if (match.path.startsWith('/paths')) { + activePaths = true; + } else if (match.path.startsWith('/courses')) { + coursestype = true; + } else if (match.path.startsWith('/crowdsourcing')) { + activePackages = true; + } else if (match.path.startsWith('/moop_cases')) { + activeMoopCases = true; + } else if (match.path.startsWith('/competitions')) { + activeCompetitions = true; + } else { + activeIndex = true; + } + + let headtypes = '/'; + + // console.log("mygetHelmetapi2"); + // console.log(mygetHelmetapi2); + if (mygetHelmetapi2) { if (mygetHelmetapi2.navbar) { if (mygetHelmetapi2.navbar.length > 0) { // console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-="); @@ -906,137 +876,137 @@ submittojoinclass=(value)=>{ } // console.log(mygetHelmetapi2); - // console.log("NewHeadermygetHelmetapi123123123123"); - - let shixuntype=false; - let pathstype=false; - let coursestypes=false; - if(this.props&&this.props.mygetHelmetapi!=null){ - let shixun="/shixuns"; - let paths="/paths"; - let courses="/courses"; - this.props.mygetHelmetapi.navbar.map((item,key)=>{ - var reg = RegExp(item.link); - if(shixun.match(reg)){ - if(item.hidden===true){ - shixuntype=true - } - } - if(paths.match(reg)){ - if(item.hidden===true){ - pathstype=true - } - } - if(courses.match(reg)){ - if(item.hidden===true){ - coursestypes=true - } - } - }) - } - - const contents = ( -
    -

    试题库

    -

    -

    试卷库

    -

    -
    - ); + // console.log("NewHeadermygetHelmetapi123123123123"); + + let shixuntype = false; + let pathstype = false; + let coursestypes = false; + if (this.props && this.props.mygetHelmetapi != null) { + let shixun = "/shixuns"; + let paths = "/paths"; + let courses = "/courses"; + this.props.mygetHelmetapi.navbar.map((item, key) => { + var reg = RegExp(item.link); + if (shixun.match(reg)) { + if (item.hidden === true) { + shixuntype = true + } + } + if (paths.match(reg)) { + if (item.hidden === true) { + pathstype = true + } + } + if (courses.match(reg)) { + if (item.hidden === true) { + coursestypes = true + } + } + }) + } + + const contents = ( +
    +

    试题库

    +

    +

    试卷库

    +

    +
    + ); return (
    - - - {isRender===true?this.Modifyloginvalue()} - {...this.props} - {...this.state} - />:""} - - {AccountProfiletype===true?this.hideAccountProfile()} - {...this.props} - {...this.state} - />:""} - - { - goshowqqgtounp===true? - this.setgoshowqqgtounp(bool)}> - : - "" - } - - this.headtypesonClick("/",false)} className={"fl mr30 ml25 mt10"}> + } + + {isRender === true ? this.Modifyloginvalue()} + {...this.props} + {...this.state} + /> : ""} + + {AccountProfiletype === true ? this.hideAccountProfile()} + {...this.props} + {...this.state} + /> : ""} + + { + goshowqqgtounp === true ? + this.setgoshowqqgtounp(bool)}> + : + "" + } + + this.headtypesonClick("/", false)} className={"fl mr30 ml25 mt10"}> { - mygetHelmetapi2 === null ? - "" - : - mygetHelmetapi2===undefined||mygetHelmetapi2.nav_logo_url===null||mygetHelmetapi2.nav_logo_url===undefined? - 高校智能化教学与实训平台 - : - 高校智能化教学与实训平台 + mygetHelmetapi2 === null ? + "" + : + mygetHelmetapi2 === undefined || mygetHelmetapi2.nav_logo_url === null || mygetHelmetapi2.nav_logo_url === undefined ? + 高校智能化教学与实训平台 + : + 高校智能化教学与实训平台 } - + - - { - mygetHelmetapi2 === null ? - "" : - mygetHelmetapi2!==undefined&&mygetHelmetapi2.navbar!==null&&mygetHelmetapi2.navbar!==undefined&&mygetHelmetapi2.navbar.length>0? -
    -
      - {/*
    • 首页
    • */} - {/*
    • 实训路径
    • */} - { - mygetHelmetapi2.navbar && mygetHelmetapi2.navbar.map((item,key)=>{ - // console.log("headtypes"); - // console.log(headtypes);hidden - var str=new RegExp("http"); - var strbool=false; - //test方法返回值为(true或者false) - if(item.link){ - if(str.test(item.link)===true){ - strbool=true - }else{ - strbool=false - } - } - // console.log(item.hidden); - return( -
    • this.headtypesonClick(item.link,true)} className={`${this.matchpaths(item.link)===true?'pr active':'pr'}`} style={item.hidden==false?{display: 'block'}:{display: 'none'}}> - { - strbool===true? - {item.name} - : - {item.name} - } -
    • - ) - }) - } - + { + mygetHelmetapi2 === null ? + "" : + mygetHelmetapi2 !== undefined && mygetHelmetapi2.navbar !== null && mygetHelmetapi2.navbar !== undefined && mygetHelmetapi2.navbar.length > 0 ? +
      +
        + {/*
      • 首页
      • */} + {/*
      • 实训路径
      • */} + { + mygetHelmetapi2.navbar && mygetHelmetapi2.navbar.map((item, key) => { + // console.log("headtypes"); + // console.log(headtypes);hidden + var str = new RegExp("http"); + var strbool = false; + //test方法返回值为(true或者false) + if (item.link) { + if (str.test(item.link) === true) { + strbool = true + } else { + strbool = false + } + } + // console.log(item.hidden); + return ( +
      • this.headtypesonClick(item.link, true)} className={`${this.matchpaths(item.link) === true ? 'pr active' : 'pr'}`} style={item.hidden == false ? { display: 'block' } : { display: 'none' }}> + { + strbool === true ? + {item.name} + : + {item.name} + } +
      • + ) + }) + } + - {/*
      • */} - {/* */} - {/*
        */} - {/*
        */} - {/* 题库*/} - {/*
        */} - {/*
        */} - {/*
        */} - {/*
      • */} - -
      • 工程认证
      • - -
      • 0 ? 'block' : 'none'}}> - 职业路径 -
        0 ? 'block' : 'none'}}> -
          - {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { - return( -
        • {item.name}
        • - ) - }) - } -
        -
        -
      • -
      -
      - : -
      - -
        - {/*
      • 首页
      • */} - - {/*
      • 实训路径
      • */} -
      • - 实践课程 -
      • - - {/*
      • 课堂
      • */} -
      • - {/*课堂*/} - 教学课堂 -
      • -
      • - 实训项目 - {/**/} - {/**/} -
      • - -
      • 0 ? 'block' : 'none'}}> - 职业路径 -
        0 ? 'block' : 'none'}}> -
          - {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { - return( -
        • {item.name}
        • - ) - }) - } -
        -
        -
      • - - {/*
      • 教学案例
      • */} -
      • - 在线竞赛 - {/**/} -
      • -
      • 教学案例
      • - {/*
      • */} - {/*众包创新*/} - {/*
      • */} -
      • 交流问答
      • -
      • 工程认证
      • -
      -
      - } - - - - - - - + {/*
    • */} + {/* */} + {/*
      */} + {/*
      */} + {/* 题库*/} + {/*
      */} + {/*
      */} + {/*
      */} + {/*
    • */} + +
    • 工程认证
    • + +
    • 0 ? 'block' : 'none' }}> + 职业路径 +
      0 ? 'block' : 'none' }}> +
        + {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { + return ( +
      • {item.name}
      • + ) + }) + } +
      +
      +
    • +
    +
    + : +
    + +
      + {/*
    • 首页
    • */} + + {/*
    • 实训路径
    • */} +
    • + 实践课程 +
    • + + {/*
    • 课堂
    • */} +
    • + {/*课堂*/} + 教学课堂 +
    • +
    • + 实训项目 + {/**/} + {/**/} +
    • + +
    • 0 ? 'block' : 'none' }}> + 职业路径 +
      0 ? 'block' : 'none' }}> +
        + {this.props.Headertop === undefined ? "" : this.props.Headertop.career_url.map((item, key) => { + return ( +
      • {item.name}
      • + ) + }) + } +
      +
      +
    • + + {/*
    • 教学案例
    • */} +
    • + 在线竞赛 + {/**/} +
    • +
    • 教学案例
    • + {/*
    • */} + {/*众包创新*/} + {/*
    • */} +
    • 交流问答
    • +
    • 工程认证
    • +
    +
    + } + + + + + + + -
    -
    - {/**/} -
    - - 实训 - - -
    - {/**/} - {/*搜索框*/} - {showSearchOpentype===true?
    this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}> - this.onKeywordSearchKeyDowns()} - onSearch={(value) => this.onKeywordSearchKeyDown(value)} - // onPressEnter={this.onKeywordSearchKeyDown} - style={{ width: 300,height:32}} - autoFocus={true} - /> -
    :""} - - {/**/} - {/*/!**!/*/} - {/**/} - - {/**/} - {/* TODO 需要服务端接口提供最近搜索 + } + +
    +
    + {/**/} +
    + + 实训 + + +
    + {/**/} + {/*搜索框*/} + {showSearchOpentype === true ?
    this.hideshowSearchOpen(e)} onMouseLeave={() => this.setevaluatinghides()}> + this.onKeywordSearchKeyDowns()} + onSearch={(value) => this.onKeywordSearchKeyDown(value)} + // onPressEnter={this.onKeywordSearchKeyDown} + style={{ width: 300, height: 32 }} + autoFocus={true} + /> +
    : ""} + + {/**/} + {/*/!**!/*/} + {/**/} + + {/**/} + {/* TODO 需要服务端接口提供最近搜索
    最近搜索
    */} -
    -
    +
    +
    - {/* + {/* <%= link_to '登录', signin_path, :className => "mr5" %> <%= link_to '注册', user_join_path, :className => "ml5" %> */} - { user===undefined? - - this.educoderlogin()} className="mr5 color-white">登录 - - 注册 - :user.login===""? - this.educoderlogin()} className="mr5 color-white">登录 - - 注册 - : -
    - + {user === undefined ? + + this.educoderlogin()} className="mr5 color-white">登录 + + 注册 + : user.login === "" ? + this.educoderlogin()} className="mr5 color-white">登录 + + 注册 + : +
    + + src={getImageUrl(`images/` + user.image_url)} width="34"> -
      +
        {/*{user.username}*/} -
      • 我的个人主页
      • - {coursestypes===true?"":
      • {this.props.user&&this.props.user.main_site===false?"我的课堂":"我的教学课堂"}
      • } +
      • 我的个人主页
      • + {coursestypes === true ? "" :
      • {this.props.user && this.props.user.main_site === false ? "我的课堂" : "我的教学课堂"}
      • } {/* p 老师 l 学生 */} - {shixuntype===true?"":
      • 我的实训项目
      • } - {pathstype===true?"":
      • {this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}
      • } - {this.props.user&&this.props.user.main_site===true?
      • 我的开发项目
      • :""} - {/*
      • 我的众包
      • */} -
      • - 客户管理 -
      • + {shixuntype === true ? "" :
      • 我的实训项目
      • } + {pathstype === true ? "" :
      • {this.props.user && this.props.user.main_site === false ? "我的课程" : "我的实践课程"}
      • } + {this.props.user && this.props.user.main_site === true ?
      • 我的开发项目
      • : ""} + {/*
      • 我的众包
      • */} +
      • + 客户管理 +
      • { this.props.Headertop && this.props.Headertop.college_identifier &&
      • 学院统计
      • @@ -1253,159 +1223,159 @@ submittojoinclass=(value)=>{ {/*
      • this.trialapplications()} >试用申请
      • */} {/*
      • 兴趣页
      • */} -
      • +
      • - {/*this.educoderlogin()} >登录*/} - this.educoderloginysl()}>退出 + {/*this.educoderlogin()} >登录*/} + this.educoderloginysl()}>退出
    - } - {/*href="https://www.educoder.net/login"*/} -
    - {/*{ loadHeader()}*/} - {showSearchOpentype===true?"":this.props.user&&this.props.user.main_site===true?this.showSearchOpen(e)}> - {/*"/images/educoder/icon/search.svg" + } + {/*href="https://www.educoder.net/login"*/} + */} -
    + {/*
    */} +
    - + -
    -
    - - {coursestypes===true&&this.props.user&&this.props.user.main_site===false?"":
    + : ""} + }
    +
    - {this.props.user&&this.props.user.main_site===true? : ""} + + +
    +
    +
      +
      +

      + {submitapplicationsvalue} +

      +
      +
    • + 取消 + 确定 +
    • - -
      -
      -
        -
        -

        - {submitapplicationsvalue} -

        -
        -
      • - 取消 - 确定 -
      • - -
      -
      +
    - +
    +
    -
    +
    diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index a48b7c05f..ab16b01bf 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -1,39 +1,29 @@ -import React, { Component } from 'react'; - -import PropTypes from 'prop-types'; +import React from 'react'; import NewHeader from './NewHeader' import NewFooter from './NewFooter' import SiderBar from './SiderBar' -import { getUrl, downloadFile } from 'educoder' +import { downloadFile } from 'educoder' import axios from 'axios'; import { Spin } from 'antd'; import './TPMIndex.css'; import LoginDialog from '../login/LoginDialog'; import AccountProfile from '../user/AccountProfile'; import AccountPhoneemail from '../user/AccountPhoneemail'; -import Trialapplication from "../login/Trialapplication"; -// import "antd/dist/antd.css"; -// import '../../css/educoder/edu-common.css' -// import '../../css/educoder/edu-all.css' -// import '../../css/educoder/edu-main.css' const $ = window.$; const versionNum = '0001'; -// let _url_origin = getUrl() + let _url_origin = ''; if (window.location.port === "3007") { _url_origin = "https://test-newweb.educoder.net"; } -// let _url_origin=`https://www.educoder.net`; if (!window['indexHOCLoaded']) { window.indexHOCLoaded = true; //解决首屏加载问题 - // $('head').append($('') - // .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`)); $('head').append($('') .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?3`)); @@ -44,25 +34,7 @@ if (!window['indexHOCLoaded']) { $('head').append($('') .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?3`)); - - // $('head').append($('') - // .attr('href', `${_url_origin}/stylesheets/educoder/css_min_all.css?1525440977`)); - // 加timeout 为了覆盖掉antd的样式 - // setTimeout(() => { - // $('head').append( $('') - // .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1525440977`) ); - - // $('head').append( $('') - // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1525440977`) ); - // $('head').append( $('') - // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1525440977`) ); - // }, 1000); - - $("script").append('') - .attr('src', `${_url_origin}/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=${versionNum}`); - } -// `${_url_origin}/javascripts/jquery-1.8.3-ui-1.9.2-ujs-2.0.3.js?_t=${versionNum}` // TODO css加载完成后再打开页面,行为和tpm其他页面一致 export function TPMIndexHOC(WrappedComponent) { // 这里如果extends WrappedComponent 会出现 WrappedComponent mount twice的问题 @@ -90,7 +62,6 @@ export function TPMIndexHOC(WrappedComponent) { // header里面需要有user initCommonState(user) { - // 更新头像后,需要改变参数,不然会被图片缓存影响到 --> 后台已加 ?t=${new Date().getTime() const newUser = Object.assign({}, { ...user }, { image_url: `${user.image_url}` }); this.setState({ user: newUser, @@ -128,7 +99,6 @@ export function TPMIndexHOC(WrappedComponent) { .then((response) => { const status = response.data.status; if (status == 1) { - const new_author_info = Object.assign({}, creator) this.setState({ watched: !watched }) @@ -148,8 +118,6 @@ export function TPMIndexHOC(WrappedComponent) { } componentDidMount() { - // console.log("TPMIndexHOC========"); - // console.log(this.props); window.addEventListener('keyup', this.keyupListener) if (this.props.match.path === "/") { @@ -166,28 +134,6 @@ export function TPMIndexHOC(WrappedComponent) { document.title = "翻转课堂"; } - // if(this.props.match.path==="/"){ - // document.title="EduCoder-IT实践教学平台_信息技术类精品课程网_大学生MOOC平台"; - // }else if(this.props.match.path==="/403"){ - // document.title="你没有权限访问"; - // }else if(this.props.match.path==="/nopage"){ - // document.title="没有找到该页面"; - // }else if(this.props.match.path==="/shixuns"){ - // document.title="EduCoder-IT实践教学平台_信息技术类精品课程网_大学生MOOC平台"; - // }else if(this.props.match.path==="/paths"){ - // document.title="实践课程_项目实战开发_web前端开发实训_web后端开发实战_人工智能技术-EduCoder"; - // }else if(this.props.match.path==="/courses"){ - // document.title="实训项目_php后端开发_app前端开发_java_python实训_C语言入门课程-EduCoder"; - // }else if(this.props.match.path==="/competitions"){ - // document.title="在线竞赛_计算机应用大赛_编程大赛_大学生设计大赛_全国高校绿色计算大赛-EduCoder"; - // }else if(this.props.match.path==="/moop_cases"){ - // document.title="教学案例-EduCoder"; - // }else if(this.props.match.path==="/forums"){ - // document.title="交流问答-EduCoder"; - // }else if(this.props.match.path==="/forums"){ - // document.title="交流问答-EduCoder"; - // } - $.ajaxSetup({ cache: true }); @@ -216,7 +162,7 @@ export function TPMIndexHOC(WrappedComponent) { dataquerys: {}, }) } - this.fetchUsers(dataqueryss); + this.fetchUser(dataqueryss); let url = `/users/get_navigation_info.json`; axios.get(url, { @@ -462,71 +408,6 @@ export function TPMIndexHOC(WrappedComponent) { console.log(error) }) }; - fetchUsers = (yslurlobject) => { - let url = `/users/get_user_info.json` - let courseId; - let query = this.props.location.pathname; - const type = query.split('/'); - if (type[1] == 'courses' && type[2]) { - courseId = parseInt(type[2]) - // url += `?course_id=${courseId}` - } - var datay = {}; - if (JSON.stringify(yslurlobject) === "{}") { - datay = { - course_id: isNaN(courseId) ? undefined : courseId, - school: 1 - } - } else { - datay = { - course_id: isNaN(courseId) ? undefined : courseId, - school: 1, - chinaoocTimestamp: yslurlobject.chinaoocTimestamp, - websiteName: yslurlobject.websiteName, - chinaoocKey: yslurlobject.chinaoocKey, - } - } - axios.get(url, { - params: - datay - }, - { - // withCredentials: true - } - ).then((response) => { - /* - { - "username": "黄井泉", - "login": "Hjqreturn", - "user_id": 12, - "image_url": "avatar/User/12", - "admin": true, - "is_teacher": false, - "tidding_count": 0 - } - */ - if (response === undefined) { - return - } - if (response.data) { - this.initCommonState(response.data) - this.setState({ - tpmLoading: false, - coursedata: { - course_identity: response.data.course_identity >= 0 ? response.data.course_identity : undefined, - course_public: response.data.course_public, - name: response.data.course_name, - userid: response.data.user_id - }, - - }) - - } - - }).catch((error) => { - console.log(error) - }) - }; //截取url 数据的 foo = (url) => { var json = {}; @@ -534,12 +415,9 @@ export function TPMIndexHOC(WrappedComponent) { var arr; do { arr = regExp.exec(url); - // console.log(arr); // arr = [完整的字符串, key, 等号或'', value或''] - if (arr) { var key = arr[1]; var value = arr[3]; - // arr[2] === ''时, value = undefined if (!arr[2]) value = undefined; diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js index 1054d620e..67b0b83b6 100644 --- a/public/react/src/modules/user/Interestpage.js +++ b/public/react/src/modules/user/Interestpage.js @@ -1,6 +1,6 @@ -import React, {Component} from 'react'; -import {Button,notification} from 'antd'; -import {broadcastChannelPostMessage} from 'educoder'; +import React, { Component } from 'react'; +import { Button, notification } from 'antd'; +import { broadcastChannelPostMessage } from 'educoder'; import MyEduCoderModal from './MyEduCoderModal'; import axios from 'axios'; import './common.css'; @@ -25,13 +25,13 @@ class InterestpageComponent extends Component { super(props) this.state = { gouxuans: "", - gouxuans2:0, - gouxuans4:[], - namezh:this.props.namezh, - passmm:this.props.passmm, - homedatalist:undefined, + gouxuans2: 0, + gouxuans4: [], + namezh: this.props.namezh, + passmm: this.props.passmm, + homedatalist: undefined, hometypepvisible: undefined, - MyEduCoderModals:false, + MyEduCoderModals: false, } } openNotification = (messge) => { @@ -44,42 +44,42 @@ class InterestpageComponent extends Component { }, }); } - componentDidMount(){ + componentDidMount() { console.log("min"); - let{gouxuans4} =this.state; - let url=`/repertoires.json`; - axios.get(url).then((response)=> { - if(response){ + let { gouxuans4 } = this.state; + let url = `/repertoires.json`; + axios.get(url).then((response) => { + if (response) { // console.log("53"); // console.log(response.data); - for(var i=0;i{ + }).catch((error) => { console.log(error) }); } @@ -136,77 +136,77 @@ class InterestpageComponent extends Component { } - Clickteacher=(e)=>{ - // console.log(e); - if(e === "teacher"){ - this.setState({ - gouxuans:"teacher", + Clickteacher = (e) => { + // console.log(e); + if (e === "teacher") { + this.setState({ + gouxuans: "teacher", }) - }else if(e ==="student"){ + } else if (e === "student") { this.setState({ - gouxuans:"student", + gouxuans: "student", }) - }else if(e === "professional"){ + } else if (e === "professional") { this.setState({ - gouxuans:"professional", + gouxuans: "professional", }) } } - Clickteacher2=(e)=>{ + Clickteacher2 = (e) => { // console.log(e); - let {gouxuans4} =this.state; - for (var i=0;i{ + setMyEduCoderModals = () => { this.setState({ - MyEduCoderModals:true + MyEduCoderModals: true }) - } + } //兴趣页面点击 - Interestcompletionpage(){ - if(this.state.gouxuans.length === 0){ + Interestcompletionpage() { + if (this.state.gouxuans.length === 0) { this.openNotification("请选择职业"); return } - var ints=[]; - for (var i =0;i { if (response !== undefined) { - // this.Jumptotheinterestpage(); - // window.location.href = "/" - if(response.data.status===0){ + // this.Jumptotheinterestpage(); + // window.location.href = "/" + if (response.data.status === 0) { this.setMyEduCoderModals() } @@ -220,39 +220,10 @@ class InterestpageComponent extends Component { }) } - // //跳转然后登入 - // Jumptotheinterestpage=()=>{ - // console.log(this.state.login); - // console.log(this.state.password); - // var url = "/accounts/login.json"; - // axios.post(url, { - // login: this.props.login, - // password: this.props.password, - // }).then((response) => { - // if (response === undefined) { - // return - // } - // if (response.status === 200) { - // // if (response.data.status === 402) { - // // window.location.href = response.data.url; - // // } else { - // // broadcastChannelPostMessage('refreshPage') - // // this.setState({ - // // isRender: false - // // }) - // window.location.href = "/" - // // } - // } - // - // - // }).catch((error) => { - // console.log(error); - // }) - // } - setNotcompleteds=()=>{ + setNotcompleteds = () => { this.setState({ - Notcompleteds:true, - MyEduCoderModals:false + Notcompleteds: true, + MyEduCoderModals: false }) } @@ -264,45 +235,45 @@ class InterestpageComponent extends Component { console.log(window.screen.width); return ( -
    +
    {this.setNotcompleteds()}} + setNotcompleteds={() => { this.setNotcompleteds() }} />
    -
    请选择你的职业
    +
    请选择你的职业
    -
    -
    this.Clickteacher("teacher")}>{gouxuans ==="teacher"? :}老师
    -
    this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg"/>
    -
    -
    -
    this.Clickteacher("student")}>{gouxuans==="student"? :}学生
    -
    this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg"/>
    -
    -
    -
    this.Clickteacher("professional")}>{gouxuans==="professional"?:}专业人士
    -
    this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg"/>
    -
    +
    +
    this.Clickteacher("teacher")}>{gouxuans === "teacher" ? : }老师
    +
    this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg" />
    +
    +
    +
    this.Clickteacher("student")}>{gouxuans === "student" ? : }学生
    +
    this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg" />
    +
    +
    +
    this.Clickteacher("professional")}>{gouxuans === "professional" ? : }专业人士
    +
    this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg" />
    +
    -

    选择你可能感兴趣的内容

    -

    基于你关注的内容推荐

    +

    选择你可能感兴趣的内容

    +

    基于你关注的内容推荐

    - {gouxuans4&&gouxuans4.map((item,key)=>{ - return( -
    this.Clickteacher2(item.id)}> - {item.bool===true?:
    } - -

    {item.name}

    -
    + {gouxuans4 && gouxuans4.map((item, key) => { + return ( +
    this.Clickteacher2(item.id)}> + {item.bool === true ? :
    } + +

    {item.name}

    +
    - ) - })} + ) + })}
    - +
    diff --git a/public/react/src/modules/user/InterestpageMax.js b/public/react/src/modules/user/InterestpageMax.js index 6dc182154..a092ff725 100644 --- a/public/react/src/modules/user/InterestpageMax.js +++ b/public/react/src/modules/user/InterestpageMax.js @@ -1,6 +1,6 @@ -import React, {Component} from 'react'; -import {Button,notification} from 'antd'; -import {broadcastChannelPostMessage} from 'educoder'; +import React, { Component } from 'react'; +import { Button, notification } from 'antd'; +import { broadcastChannelPostMessage } from 'educoder'; import MyEduCoderModal from './MyEduCoderModal'; // import Notcompleted from '../../common/Notcompleted'; import axios from 'axios'; @@ -25,13 +25,13 @@ class InterestpageMax extends Component { super(props) this.state = { gouxuans: "", - gouxuans2:0, - gouxuans4:[], - namezh:this.props.namezh, - passmm:this.props.passmm, - homedatalist:undefined, + gouxuans2: 0, + gouxuans4: [], + namezh: this.props.namezh, + passmm: this.props.passmm, + homedatalist: undefined, hometypepvisible: undefined, - MyEduCoderModals:false + MyEduCoderModals: false } } openNotification = (messge) => { @@ -44,42 +44,42 @@ class InterestpageMax extends Component { }, }); } - componentDidMount(){ + componentDidMount() { console.log("max"); - let{gouxuans4} =this.state; - let url=`/repertoires.json`; - axios.get(url).then((response)=> { - if(response){ + let { gouxuans4 } = this.state; + let url = `/repertoires.json`; + axios.get(url).then((response) => { + if (response) { console.log("53"); console.log(response.data); - for(var i=0;i{ + }).catch((error) => { console.log(error) }); @@ -137,77 +137,77 @@ class InterestpageMax extends Component { } - Clickteacher=(e)=>{ + Clickteacher = (e) => { console.log(e); - if(e === "teacher"){ + if (e === "teacher") { this.setState({ - gouxuans:"teacher", + gouxuans: "teacher", }) - }else if(e ==="student"){ + } else if (e === "student") { this.setState({ - gouxuans:"student", + gouxuans: "student", }) - }else if(e === "professional"){ + } else if (e === "professional") { this.setState({ - gouxuans:"professional", + gouxuans: "professional", }) } } - Clickteacher2=(e)=>{ + Clickteacher2 = (e) => { console.log(e); - let {gouxuans4} =this.state; - for (var i=0;i{ + setMyEduCoderModals = () => { this.setState({ - MyEduCoderModals:true + MyEduCoderModals: true }) } //兴趣页面点击 - Interestcompletionpage(){ - if(this.state.gouxuans.length === 0){ + Interestcompletionpage() { + if (this.state.gouxuans.length === 0) { this.openNotification("请选择职业"); return } - var ints=[]; - for (var i =0;i { if (response !== undefined) { // this.Jumptotheinterestpage(); // window.location.href = "/" - if(response.data.status===0){ + if (response.data.status === 0) { this.setMyEduCoderModals() } } @@ -219,39 +219,10 @@ class InterestpageMax extends Component { }) } - // //跳转然后登入 - // Jumptotheinterestpage=()=>{ - // console.log(this.state.login); - // console.log(this.state.password); - // var url = "/accounts/login.json"; - // axios.post(url, { - // login: this.props.login, - // password: this.props.password, - // }).then((response) => { - // if (response === undefined) { - // return - // } - // if (response.status === 200) { - // // if (response.data.status === 402) { - // // window.location.href = response.data.url; - // // } else { - // // broadcastChannelPostMessage('refreshPage') - // // this.setState({ - // // isRender: false - // // }) - // window.location.href = "/" - // // } - // } - // - // - // }).catch((error) => { - // console.log(error); - // }) - // } - setNotcompleteds=()=>{ + setNotcompleteds = () => { this.setState({ - Notcompleteds:true, - MyEduCoderModals:false + Notcompleteds: true, + MyEduCoderModals: false }) } @@ -263,44 +234,44 @@ class InterestpageMax extends Component { // height: 346px; return ( -
    +
    {this.setNotcompleteds()}} + setNotcompleteds={() => { this.setNotcompleteds() }} />
    请选择你的职业
    -
    -
    this.Clickteacher("teacher")}>{gouxuans ==="teacher"? :}老师
    -
    this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg2"/>
    +
    +
    this.Clickteacher("teacher")}>{gouxuans === "teacher" ? : }老师
    +
    this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg2" />
    -
    -
    this.Clickteacher("student")}>{gouxuans==="student"? :}学生
    -
    this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg2"/>
    +
    +
    this.Clickteacher("student")}>{gouxuans === "student" ? : }学生
    +
    this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg2" />
    -
    this.Clickteacher("professional")}>{gouxuans==="professional"?:}专业人士
    -
    this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg2"/>
    +
    this.Clickteacher("professional")}>{gouxuans === "professional" ? : }专业人士
    +
    this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg2" />
    选择你可能感兴趣的内容
    基于你关注的内容推荐
    - {gouxuans4&&gouxuans4.map((item,key)=>{ - return( -
    this.Clickteacher2(item.id)}> - {item.bool===true?:
    } - + {gouxuans4 && gouxuans4.map((item, key) => { + return ( +
    this.Clickteacher2(item.id)}> + {item.bool === true ? :
    } + {item.name}
    ) })}
    - +
    diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index c42ceed88..0e3aff40d 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -1,6 +1,6 @@ -import React, {Component} from 'react'; -import {setmiyah,broadcastChannelPostMessage} from 'educoder'; -import {Tabs, Input, Checkbox, Button, notification,Menu} from 'antd'; +import React, { Component } from 'react'; +import { setmiyah, broadcastChannelPostMessage } from 'educoder'; +import { Input, Checkbox, Button, notification, Menu } from 'antd'; import passopen from '../../../src/images/login/passopen.png'; import passoff from '../../../src/images/login/passoff.png'; import axios from 'axios'; @@ -9,30 +9,15 @@ import CheckInputysl2 from './CheckInputysl'; import Notcompletedysl from './Notcompletedysl'; import './common.css' import './commontwo.css' -const { TabPane } = Tabs; -const loginInputsyl = { - "width":"434px", - "height": "462px", - "-webkit-box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", - "box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", - "border-radius": "6px", - "background": "#fff" -} //父组件EducoderLogin.js class LoginRegisterComponent extends Component { constructor(props) { super(props) - - // - // console.log("LoginRegisterComponent"); - // console.log("29"); - // console.log(props.loginstatus); - if(props.loginstatus === true){ - // console.log(props.loginstatus); + if (props.loginstatus === true) { this.state = { - tab:["0"], + tab: ["0"], classpass: "text", // 登录 passopens: passoff, @@ -53,25 +38,25 @@ class LoginRegisterComponent extends Component { codes: "", Phonenumberisnotco: undefined, Phonenumberisnotcos: undefined, - Phonenumberisnotcosyzm:undefined, - Phonenumberisnotcosymmm:undefined, - Phonenumberisnotcosytdhk:undefined, - Phonenumberisnotcosyfwtk:undefined, - Phonenumberisnotcodmm:undefined, + Phonenumberisnotcosyzm: undefined, + Phonenumberisnotcosymmm: undefined, + Phonenumberisnotcosytdhk: undefined, + Phonenumberisnotcosyfwtk: undefined, + Phonenumberisnotcodmm: undefined, Phonenumberisnotcobool: false, - Whethertoverify:false, - pciphone:true, - MyEduCoderModals:false, - registered:undefined, - Phonenumberisnotcodmms:undefined, - weixinlogin:false, - qqlogin:false + Whethertoverify: false, + pciphone: true, + MyEduCoderModals: false, + registered: undefined, + Phonenumberisnotcodmms: undefined, + weixinlogin: false, + qqlogin: false } } - if(props.loginstatus === false){ + if (props.loginstatus === false) { // console.log(props.loginstatus); this.state = { - tab:["1"], + tab: ["1"], classpass: "text", // 登录 passopens: passoff, @@ -92,25 +77,25 @@ class LoginRegisterComponent extends Component { codes: "", Phonenumberisnotco: undefined, Phonenumberisnotcos: undefined, - Phonenumberisnotcosyzm:undefined, - Phonenumberisnotcosymmm:undefined, - Phonenumberisnotcosytdhk:undefined, - Phonenumberisnotcosyfwtk:undefined, + Phonenumberisnotcosyzm: undefined, + Phonenumberisnotcosymmm: undefined, + Phonenumberisnotcosytdhk: undefined, + Phonenumberisnotcosyfwtk: undefined, Phonenumberisnotcobool: false, - Phonenumberisnotcodmm:undefined, - Whethertoverify:false, - pciphone:true, - MyEduCoderModals:false, - registered:undefined, - Phonenumberisnotcodmms:undefined, - weixinlogin:false, - qqlogin:false + Phonenumberisnotcodmm: undefined, + Whethertoverify: false, + pciphone: true, + MyEduCoderModals: false, + registered: undefined, + Phonenumberisnotcodmms: undefined, + weixinlogin: false, + qqlogin: false } } } //判断是否是手机端 - IsPC=()=> { + IsPC = () => { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", @@ -124,32 +109,32 @@ class LoginRegisterComponent extends Component { } return flag; } -// 点击表单后,改变type + // 点击表单后,改变type changeType = () => { - this.setState({classpass: 'password'}); + this.setState({ classpass: 'password' }); + } + IsPC = () => { + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", + "SymbianOS", "Windows Phone", + "iPad", "iPod"]; + var flag = true; + for (var v = 0; v < Agents.length; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; } - IsPC=()=>{ - var userAgentInfo = navigator.userAgent; - var Agents = ["Android", "iPhone", - "SymbianOS", "Windows Phone", - "iPad", "iPod"]; - var flag = true; - for (var v = 0; v < Agents.length; v++) { - if (userAgentInfo.indexOf(Agents[v]) > 0) { - flag = false; - break; - } - } - return flag; - } componentDidMount = () => { - let flag = this.IsPC(); //true为PC端,false为手机端 - this.setState({ - isphone:flag - }) + let flag = this.IsPC(); //true为PC端,false为手机端 + this.setState({ + isphone: flag + }) // console.log("componentDidUpdate"); // console.log(this.props); - let pcipns=this.IsPC(); + let pcipns = this.IsPC(); if (this.props.match.url === "/login") { // this.state = { @@ -157,7 +142,7 @@ class LoginRegisterComponent extends Component { // // } this.setState({ - tab:["0"] + tab: ["0"] }) } else if (this.props.match.url === "/register") { @@ -166,16 +151,16 @@ class LoginRegisterComponent extends Component { // // } this.setState({ - tab:["1"] + tab: ["1"] }) } this.setState({ - pciphone:pcipns, + pciphone: pcipns, }) } - openNotification = (messge,type) => { + openNotification = (messge, type) => { // type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色 notification.open({ message: "提示", @@ -209,7 +194,7 @@ class LoginRegisterComponent extends Component { }); try { this.props.Setshowbool(3); - }catch (e) { + } catch (e) { } } @@ -219,7 +204,7 @@ class LoginRegisterComponent extends Component { // -------------------- LOGIN START //下次自动登入 onAutoLoginChange = (e) => { - this.setState({autoLogin: e.target.checked}) + this.setState({ autoLogin: e.target.checked }) } // -------------------- LOGIN END @@ -248,19 +233,19 @@ class LoginRegisterComponent extends Component { } // -------------------- REGISTER START onReadAgreementChange = (e) => { - this.setState({readAgreement: e.target.checked}) + this.setState({ readAgreement: e.target.checked }) } //是否验证通过 dragOkCallback = () => { this.setState({ - Phonenumberisnotcosytdhk:undefined, + Phonenumberisnotcosytdhk: undefined, }) if (this.state.logins.length === 0) { this.setState({ - Phonenumberisnotcos:"账号不能为空", + Phonenumberisnotcos: "账号不能为空", Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) @@ -278,14 +263,14 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk:true, + dragOk: true, }) } else { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk:true, + dragOk: true, }); this.Emailphonenumberverification(this.state.logins, 2); return @@ -301,8 +286,8 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: stringdata, Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }); @@ -312,14 +297,14 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk:true, + dragOk: true, }) this.Emailphonenumberverification(this.state.logins, 2); return } this.setState({ - Phonenumberisnotcosytdhk:undefined, + Phonenumberisnotcosytdhk: undefined, }) this.Emailphonenumberverification(this.state.logins, 2) @@ -338,12 +323,12 @@ class LoginRegisterComponent extends Component { if (this.state.login === undefined || this.state.login == "") { this.setState({ - Phonenumberisnotco:"账号不能为空", + Phonenumberisnotco: "账号不能为空", }) return } else if (this.state.password === undefined || this.state.password == "") { this.setState({ - Phonenumberisnotcodmm:"密码不能为空", + Phonenumberisnotcodmm: "密码不能为空", }) return } @@ -357,38 +342,38 @@ class LoginRegisterComponent extends Component { return } - if(response.data.status === -2){ - if(response.data.message==="该手机号尚未注册" || response.data.message==="该邮箱尚未注册"){ + if (response.data.status === -2) { + if (response.data.message === "该手机号尚未注册" || response.data.message === "该邮箱尚未注册") { this.setState({ - Phonenumberisnotco:response.data.message, + Phonenumberisnotco: response.data.message, }) return; } - else if(response.data.message==="错误的账号或密码"){ + else if (response.data.message === "错误的账号或密码") { this.setState({ - Phonenumberisnotcodmms:response.data.message, + Phonenumberisnotcodmms: response.data.message, }) return; } - else if(response.data.message==="违反平台使用规范,账号已被锁定"){ + else if (response.data.message === "违反平台使用规范,账号已被锁定") { this.setState({ - Phonenumberisnotco:response.data.message, + Phonenumberisnotco: response.data.message, }) return; } else if (response.data.message === "登录密码出错已达上限,账号已被锁定, 请10分钟后重新登录或找回密码") { const messge = ( -
    -

    - 登录密码出错已达上限,账号已被锁定; +

    +

    + 登录密码出错已达上限,账号已被锁定;

    -

    - 请10分钟后重新登录或找回密码 -

    -
    +

    + 请10分钟后重新登录或找回密码 +

    +
    ) this.openNotifications(messge); return; @@ -400,11 +385,6 @@ class LoginRegisterComponent extends Component { } - // if(response.data.profile_completed !== null || response.data.profile_completed === false){ - // this.setMyEduCoderModals(); - // return; - // } - if (response.status === 200) { if (response.data.status === 402) { window.location.href = response.data.url; @@ -414,14 +394,14 @@ class LoginRegisterComponent extends Component { isRender: false }) var weekArray = JSON.parse(window.sessionStorage.getItem('yslgeturls')); - if(weekArray===undefined){ - weekArray="/"; + if (weekArray === undefined) { + weekArray = "/"; } - if(weekArray===null){ - weekArray="/"; + if (weekArray === null) { + weekArray = "/"; } - if(weekArray==="null"){ - weekArray="/"; + if (weekArray === "null") { + weekArray = "/"; } window.location.href = weekArray; } @@ -452,57 +432,57 @@ class LoginRegisterComponent extends Component { // this.openNotification(`请同意服务协议条款`,2); // return; // } - if (this.state.logins === undefined || this.state.logins === ""||this.state.logins.length===0) { + if (this.state.logins === undefined || this.state.logins === "" || this.state.logins.length === 0) { this.setState({ - Phonenumberisnotcos:"账号不能为空", + Phonenumberisnotcos: "账号不能为空", Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) return } - if(this.state.pciphone===true){ + if (this.state.pciphone === true) { if (this.state.dragOk === false) { // this.openNotification(`请拖动滑块完成验证`,2); this.setState({ - Phonenumberisnotcosytdhk:"请拖动滑块完成验证", - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + Phonenumberisnotcosytdhk: "请拖动滑块完成验证", + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) return } } - if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) { + if (this.state.codes === undefined || this.state.codes == "" || this.state.codes.length === 0) { // this.openNotification(`请输入验证码`,2); this.setState({ - Phonenumberisnotcosyzm:"验证码不能为空", + Phonenumberisnotcosyzm: "验证码不能为空", }) return - } else if (this.state.passwords === undefined || this.state.passwords == "" ||this.state.passwords.length===0) { + } else if (this.state.passwords === undefined || this.state.passwords == "" || this.state.passwords.length === 0) { this.setState({ - Phonenumberisnotcosymmm:"密码不能为空", + Phonenumberisnotcosymmm: "密码不能为空", }) return - } else if (this.state.passwords !==undefined &&this.state.passwords.length>0&&this.state.passwords.length<8){ + } else if (this.state.passwords !== undefined && this.state.passwords.length > 0 && this.state.passwords.length < 8) { this.setState({ - Phonenumberisnotcosymmm:"密码不能少于8位", + Phonenumberisnotcosymmm: "密码不能少于8位", }) return - } else if (this.state.passwords !==undefined &&this.state.passwords.length>0&&this.state.passwords.length>16){ + } else if (this.state.passwords !== undefined && this.state.passwords.length > 0 && this.state.passwords.length > 16) { this.setState({ - Phonenumberisnotcosymmm:"密码不能超过16位", + Phonenumberisnotcosymmm: "密码不能超过16位", }) return } else if (this.state.Agreetotheterms === false) { - this.openNotification(`请同意服务协议条款`,2); + this.openNotification(`请同意服务协议条款`, 2); return; } let url; - if(this.props.weixinlogin){ - url= '/weapps/register.json'; - }else{ + if (this.props.weixinlogin) { + url = '/weapps/register.json'; + } else { url = "/accounts/register.json"; } @@ -511,25 +491,25 @@ class LoginRegisterComponent extends Component { password: this.state.passwords, code: this.state.codes, }).then((result) => { - if(result){ - if(result.data.status===-2){ - if(result.data.message==="验证码不正确"){ + if (result) { + if (result.data.status === -2) { + if (result.data.message === "验证码不正确") { this.setState({ - Phonenumberisnotcosyzm:"验证码不正确", + Phonenumberisnotcosyzm: "验证码不正确", }) return; - }else if(result.data.message==="验证码已失效"){ + } else if (result.data.message === "验证码已失效") { this.setState({ - Phonenumberisnotcosyzm:"验证码不正确", + Phonenumberisnotcosyzm: "验证码不正确", }) return; - }else { + } else { this.openNotification(result.data.message); return; } - }else { + } else { // this.setState({ // logins: "", // dragOk: false, @@ -559,21 +539,21 @@ class LoginRegisterComponent extends Component { // console.log(result); // this.setState({dragOk: true}) - if(result){ - if(result.data.status===-2){ + if (result) { + if (result.data.status === -2) { if (id === 1) { - if(result.data.message==="该手机号码或邮箱已被注册"){ + if (result.data.message === "该手机号码或邮箱已被注册") { this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, - dragOk:true, + dragOk: true, }) - }else { + } else { this.setState({ Phonenumberisnotco: result.data.message, Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) @@ -583,26 +563,26 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: result.data.message, Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) return; } - }else { + } else { if (id === 1) { this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, - dragOk:true, + dragOk: true, }) return; } else if (id === 2) { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, - dragOk:true, + dragOk: true, }) return; } @@ -615,20 +595,20 @@ class LoginRegisterComponent extends Component { }; //短信验证 SMSverification = () => { - let logins=this.state.logins; + let logins = this.state.logins; var url = `/accounts/get_verification_code.json`; axios.get((url), { params: { login: this.state.logins, type: 1, - smscode:setmiyah(logins) + smscode: setmiyah(logins) } }).then((result) => { //验证有问题{"status":1,"message":"success"} // console.log(result); - if(result.data.status===1){ + if (result.data.status === 1) { this.openNotification("验证码已发送,请注意查收"); - }else if(result.data.status===-2){ + } else if (result.data.status === -2) { this.openNotification(result.data.message); } }).catch((error) => { @@ -641,13 +621,13 @@ class LoginRegisterComponent extends Component { if (this.state.classpassbool === true) { this.setState({ - passopens:passoff , + passopens: passoff, classpass: "text", classpassbool: false, }) } else { this.setState({ - passopens: passopen , + passopens: passopen, classpass: "password", classpassbool: true, }) @@ -659,19 +639,19 @@ class LoginRegisterComponent extends Component { getverificationcode = () => { // console.log(this.state.Phonenumberisnotcobool); // console.log(this.state.dragOk); - if(this.state.logins === undefined || this.state.logins.length===0){ + if (this.state.logins === undefined || this.state.logins.length === 0) { this.openNotification("请输入手机号或邮箱"); return; } //这是判断是否手机正确 - if(this.state.Phonenumberisnotcobool === true){ + if (this.state.Phonenumberisnotcobool === true) { this.openNotification(this.state.Phonenumberisnotcos); this.setState({ - Whethertoverify:this.state.Whethertoverify===true?false:true, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) return; } - if(this.state.pciphone===true) { + if (this.state.pciphone === true) { if (this.state.dragOk === false) { this.openNotification("请拖动滑块验证"); return; @@ -723,25 +703,25 @@ class LoginRegisterComponent extends Component { loginInputonChange = (e) => { // console.log(e.target.value); var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; + if (e.target.value.length > 0) { + var str = e.target.value.replace(/\s*/g, "") + stirngt = str; + } else { + stirngt = e.target.value; } if (e.target.value.length === 0) { this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, - Phonenumberisnotcodmms:undefined, + Phonenumberisnotcodmms: undefined, login: stirngt, }) - }else{ + } else { this.setState({ login: stirngt, - Phonenumberisnotco:undefined, - Phonenumberisnotcodmms:undefined, + Phonenumberisnotco: undefined, + Phonenumberisnotcodmms: undefined, }) } @@ -770,8 +750,8 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: stringdata, Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) } else { this.setState({ @@ -792,8 +772,8 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotcos: stringdata, Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) return } else { @@ -811,16 +791,16 @@ class LoginRegisterComponent extends Component { passwordonChange = (e) => { // console.log(e.target.value); var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; + if (e.target.value.length > 0) { + var str = e.target.value.replace(/\s*/g, "") + stirngt = str; + } else { + stirngt = e.target.value; } this.setState({ password: stirngt, - Phonenumberisnotcodmm:undefined, - Phonenumberisnotcodmms:undefined, + Phonenumberisnotcodmm: undefined, + Phonenumberisnotcodmms: undefined, }) // this.setState({ // password: e.target.value @@ -830,26 +810,26 @@ class LoginRegisterComponent extends Component { loginInputonChanges = (e) => { var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; + if (e.target.value.length > 0) { + var str = e.target.value.replace(/\s*/g, "") + stirngt = str; + } else { + stirngt = e.target.value; } if (e.target.value.length === 0) { this.setState({ Phonenumberisnotcos: undefined, Phonenumberisnotcobool: false, logins: stirngt, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) - }else{ + } else { this.setState({ logins: stirngt, Phonenumberisnotcos: undefined, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, + dragOk: false, + Whethertoverify: this.state.Whethertoverify === true ? false : true, }) } @@ -858,37 +838,37 @@ class LoginRegisterComponent extends Component { passwordonChanges = (e) => { // console.log(e.target.value); var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; + if (e.target.value.length > 0) { + var str = e.target.value.replace(/\s*/g, "") + stirngt = str; + } else { + stirngt = e.target.value; } this.setState({ passwords: stirngt, - Phonenumberisnotcosymmm:undefined, + Phonenumberisnotcosymmm: undefined, }) } //获取code codesonChange = (e) => { this.setState({ codes: e.target.value, - Phonenumberisnotcosyzm:undefined, + Phonenumberisnotcosyzm: undefined, }) } //切换tab - changeTab=(e)=>{ + changeTab = (e) => { this.setState({ - tab:e.key + tab: e.key }) - if(e.key === 0){ + if (e.key === 0) { this.setState({ - Phonenumberisnotcos:undefined + Phonenumberisnotcos: undefined }) - }else{ + } else { this.setState({ - Phonenumberisnotco:undefined + Phonenumberisnotco: undefined }) } @@ -896,54 +876,54 @@ class LoginRegisterComponent extends Component { // this.props.history.push(`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/student_exercise_list?tab=`+e.key) } - loginonkeyup =(e)=>{ - if(e.keyCode==32){ + loginonkeyup = (e) => { + if (e.keyCode == 32) { return false; } }; - setNotcompleteds=()=>{ + setNotcompleteds = () => { this.setState({ - Notcompleteds:true, - MyEduCoderModals:false, - registered:undefined, + Notcompleteds: true, + MyEduCoderModals: false, + registered: undefined, }) }; - setMyEduCoderModals=()=>{ + setMyEduCoderModals = () => { this.setState({ - MyEduCoderModals:true, - registered:"注册成功" + MyEduCoderModals: true, + registered: "注册成功" }) }; - openweixinlogin=()=>{ - this.setState({ - weixinlogin:true - }) - } - hideweixinlogin=()=>{ - this.setState({ - weixinlogin:false, - qqlogin:false, - tab:["0"] - }) - } - - openqqlogin=()=>{ - this.setState({ - qqlogin:true - }) - //window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code` - window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code` - // window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code` - } - - openphoneqqlogin=()=>{ - window.open( - `https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code` - ) - } + openweixinlogin = () => { + this.setState({ + weixinlogin: true + }) + } + hideweixinlogin = () => { + this.setState({ + weixinlogin: false, + qqlogin: false, + tab: ["0"] + }) + } + + openqqlogin = () => { + this.setState({ + qqlogin: true + }) + //window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code` + window.location.href = `https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code` + // window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code` + } + + openphoneqqlogin = () => { + window.open( + `https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginqq&state=null,${window.location.host}&response_type=code` + ) + } render() { const { // 登录 @@ -968,7 +948,7 @@ class LoginRegisterComponent extends Component { readAgreement, pciphone, Phonenumberisnotcodmms, - weixinlogin + weixinlogin } = this.state // height: 346px; if (this.state.seconds === 0) { @@ -978,32 +958,32 @@ class LoginRegisterComponent extends Component { return ( -
    - - -
    - {weixinlogin===false&&this.props.weixinlogin===undefined? - 登录 - 注册 - :""} - - { - weixinlogin===false&&parseInt(tab[0])==0 && -
    - + +
    + {weixinlogin === false && this.props.weixinlogin === undefined ? + 登录 + 注册 + : ""} + + { + weixinlogin === false && parseInt(tab[0]) == 0 && +
    + - - this.inputOnBlur(e, 1)} - style={{marginTop: '30px', height: '38px'}} - onPressEnter={() => this.postLogin()} - > - - { - Phonenumberisnotco && Phonenumberisnotco != "" ? -

    - {Phonenumberisnotco} -

    - :
    - } - - this.postLogin()} - className={Phonenumberisnotcodmm && Phonenumberisnotcodmm !== "" ?" color-grey-9 loginInputzhucheyslass bor-reds":" color-grey-9 loginInputzhuche"} - placeholder="密码"> - { - Phonenumberisnotcodmm && Phonenumberisnotcodmm != "" ? -

    - {Phonenumberisnotcodmm} -

    - : (Phonenumberisnotcodmms=== undefined?
    :"") - } - { - Phonenumberisnotcodmms && Phonenumberisnotcodmms != "" ? -

    - {Phonenumberisnotcodmms} -

    - : "" - } - - - - - {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?

    - - ———————— 快速登录 ———————— -

    -

    :

    - ———————— 快速登录 ———————— -

    -

    :""} -
    - } - - - - { - weixinlogin===false&&parseInt(tab[0])==1 && -
    - this.inputOnBlurzhuche(e, 2)} - style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}> - { - Phonenumberisnotcos && Phonenumberisnotcos !== "" ? -

    - {Phonenumberisnotcos} -

    - :
    - - } - {this.state.MyEduCoderModals===true? {this.setNotcompleteds()}} - />:""} - - { - Whethertoverify===false&&pciphone===true? - - - : - "" - - } - { - Whethertoverify===true&&pciphone===true? - + + this.inputOnBlur(e, 1)} + style={{ marginTop: '30px', height: '38px' }} + onPressEnter={() => this.postLogin()} + > + + { + Phonenumberisnotco && Phonenumberisnotco != "" ? +

    + {Phonenumberisnotco} +

    + :
    + } + + this.postLogin()} + className={Phonenumberisnotcodmm && Phonenumberisnotcodmm !== "" ? " color-grey-9 loginInputzhucheyslass bor-reds" : " color-grey-9 loginInputzhuche"} + placeholder="密码"> + { + Phonenumberisnotcodmm && Phonenumberisnotcodmm != "" ? +

    + {Phonenumberisnotcodmm} +

    + : (Phonenumberisnotcodmms === undefined ?
    : "") + } + { + Phonenumberisnotcodmms && Phonenumberisnotcodmms != "" ? +

    + {Phonenumberisnotcodmms} +

    + : "" + } + + + + + {this.props.mygetHelmetapi && this.props.mygetHelmetapi.main_site === true ? this.state.isphone === true ?

    + + ———————— 快速登录 ———————— +

    +

    :

    + ———————— 快速登录 ———————— +

    +

    : ""} +
    + } + + + + { + weixinlogin === false && parseInt(tab[0]) == 1 && +
    + this.inputOnBlurzhuche(e, 2)} + style={{ marginTop: '30px', height: '38px', color: '#999999', fontSize: "14px" }}> + { + Phonenumberisnotcos && Phonenumberisnotcos !== "" ? +

    + {Phonenumberisnotcos} +

    + :
    + + } + {this.state.MyEduCoderModals === true ? { this.setNotcompleteds() }} + /> : ""} + + { + Whethertoverify === false && pciphone === true ? + + + : + "" + + } + { + Whethertoverify === true && pciphone === true ? + + + : + "" + } + +
    + { + pciphone === true ? + ( + Phonenumberisnotcosytdhk && Phonenumberisnotcosytdhk !== "" ? +

    + {Phonenumberisnotcosytdhk} +

    + :
    + + ) + : "" + } +
    + + + +
    + + - - : - "" - } - -
    - { - pciphone===true? - ( - Phonenumberisnotcosytdhk && Phonenumberisnotcosytdhk !== "" ? -

    - {Phonenumberisnotcosytdhk} -

    - :
    - - ) - :"" - } -
    - - - -
    - - - - { - getverificationcodes === undefined ? - - : getverificationcodes === true ? - - : - - } - -
    -
    - { - Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ? -

    - {Phonenumberisnotcosyzm} -

    - :
    + : getverificationcodes === true ? + + : + + } + +
    +
    + { + Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ? +

    + {Phonenumberisnotcosyzm} +

    + :
    - } -
    + } +
    - - this.Showandhide(key)}> - - }> - { - Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ? -

    - {Phonenumberisnotcosymmm} -

    - :
    - - } - {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?我已阅读并同意 + } + + this.Showandhide(key)}> + + }> + { + Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ? +

    + {Phonenumberisnotcosymmm} +

    + :
    + + } + {this.props.mygetHelmetapi && this.props.mygetHelmetapi.main_site === true ? 我已阅读并同意 - 《服务协议条款》 - :""} - - - {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?

    - - ———————— 快速登录 ———————— -

    -

    :

    - ———————— 快速登录 ———————— -

    -

    :"" - } -
    - } - - - - - {weixinlogin===true?:""} - {weixinlogin===true?

    - this.hideweixinlogin()}>返回登录注册 -

    :""} -
    - -
    + 《服务协议条款》 + : ""} + + + {this.props.mygetHelmetapi && this.props.mygetHelmetapi.main_site === true ? this.state.isphone === true ?

    + + ———————— 快速登录 ———————— +

    +

    :

    + ———————— 快速登录 ———————— +

    +

    : "" + } +
    + } + + + + + {weixinlogin === true ? : ""} + {weixinlogin === true ?

    + this.hideweixinlogin()}>返回登录注册 +

    : ""} +
    + +
    ); } }