dev_aliyun2
harry 5 years ago
parent 593cbfc1b8
commit 9456783685

@ -24,10 +24,6 @@ function locationurl(list) {
} }
} }
// TODO 开发期多个身份切换 // TODO 开发期多个身份切换
let debugType = "" let debugType = ""
if (isDev) { if (isDev) {
@ -47,10 +43,6 @@ if (isDev) {
// 学生 // 学生
//debugType="student"; //debugType="student";
function clearAllCookie() { function clearAllCookie() {
cookie.remove('_educoder_session', { path: '/' }); cookie.remove('_educoder_session', { path: '/' });
cookie.remove('autologin_trustie', { path: '/' }); cookie.remove('autologin_trustie', { path: '/' });

@ -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;
}

@ -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(
<AppContainer {...this.props} {...this.state}>
<Component {...this.props} {...this.state}/>
</AppContainer>,
document.getElementById('root')
);
}
// ReactDOM.render(
// ,
// document.getElementById('root'));
// registerServiceWorker();
render(App);
if (module.hot) {
module.hot.accept('./App', () => { render(App) });
}

@ -1,10 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { getRandomNumber } from 'educoder'; import { Link } from 'react-router-dom';
import {Link} from 'react-router-dom'; import { Route, Switch } from 'react-router-dom';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
import Loading from '../../../Loading'; import Loading from '../../../Loading';
import { WordsBtn, MarkdownToHtml, trigger, queryString, getRandomcode } from 'educoder'; import { WordsBtn, trigger, queryString, getRandomcode } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import AccessoryModal from "../coursesPublic/AccessoryModal"; import AccessoryModal from "../coursesPublic/AccessoryModal";
@ -17,52 +16,31 @@ import { Spin } from 'antd'
//引入对应跳转的组件 //引入对应跳转的组件
//新建分组/普通作业
const NewWork = Loadable({
loader: () => import('./NewWork'),
loading:Loading,
})
const CommonWorkSetting = Loadable({ const CommonWorkSetting = Loadable({
loader: () => import('./CommonWorkSetting'), loader: () => import('./CommonWorkSetting'),
loading:Loading, loading: Loading,
}) })
//普通作业列表 //普通作业列表
const CommonWorkList = Loadable({ const CommonWorkList = Loadable({
loader: () => import('./CommonWorkList'), loader: () => import('./CommonWorkList'),
loading:Loading, loading: Loading,
}) })
const CommonWorkQuestion = Loadable({ const CommonWorkQuestion = Loadable({
loader: () => import('./CommonWorkQuestion'), loader: () => import('./CommonWorkQuestion'),
loading:Loading, loading: Loading,
}) })
const CommonWorkAnswer = Loadable({ const CommonWorkAnswer = Loadable({
loader: () => import('./CommonWorkAnswer'), loader: () => import('./CommonWorkAnswer'),
loading:Loading, 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,
}) })
class CommonWorkDetailIndex extends Component{ class CommonWorkDetailIndex extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.publishModal = React.createRef();
this.endModal = React.createRef();
this.state = { this.state = {
DownloadType:false, DownloadType: false,
DownloadMessageval:undefined, DownloadMessageval: undefined,
donwloading:false, donwloading: false,
} }
} }
initWorkDetailCommonState = (data) => { initWorkDetailCommonState = (data) => {
@ -71,10 +49,10 @@ class CommonWorkDetailIndex extends Component{
}) })
} }
goback = () => { goback = () => {
let workId=this.props.match.params.workId; let workId = this.props.match.params.workId;
// //
if ( window.location.pathname.indexOf('appraise') == -1) { if (window.location.pathname.indexOf('appraise') == -1) {
let category_id= this.state.category.category_id; let category_id = this.state.category.category_id;
this.props.toListPage(this.props.match.params, category_id) this.props.toListPage(this.props.match.params, category_id)
} else { } else {
this.props.toWorkListPage(this.props.match.params, workId) this.props.toWorkListPage(this.props.match.params, workId)
@ -83,15 +61,15 @@ class CommonWorkDetailIndex extends Component{
} }
// 补交附件 // 补交附件
Cancelvisible=()=>{ Cancelvisible = () => {
this.setState({ this.setState({
accessoryVisible:false accessoryVisible: false
}) })
} }
addAccessory=()=>{ addAccessory = () => {
this.setState({ this.setState({
accessoryVisible:true accessoryVisible: true
}) })
} }
setupdate = () => { setupdate = () => {
@ -102,55 +80,41 @@ class CommonWorkDetailIndex extends Component{
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url) {
axios.get(url+ '&export=true').then((response) => { axios.get(url + '&export=true').then((response) => {
if(response===undefined){ if (response === undefined) {
return 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){ } else if (response.data.status && response.data.status === -2) {
if(response.data.message === "100"){ if (response.data.message === "100") {
// 已超出文件导出的上限数量100 ),建议: // 已超出文件导出的上限数量100 ),建议:
this.setState({ this.setState({
DownloadType:true, DownloadType: true,
DownloadMessageval:100 DownloadMessageval: 100
}) })
}else { } else {
//因附件资料超过500M //因附件资料超过500M
this.setState({ this.setState({
DownloadType:true, DownloadType: true,
DownloadMessageval:500 DownloadMessageval: 500
}) })
} }
}else { } else {
this.props.slowDownload(getRandomcode(url)) 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) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
Downloadcal=()=>{ Downloadcal = () => {
this.setState({ this.setState({
DownloadType:false, DownloadType: false,
DownloadMessageval:undefined DownloadMessageval: undefined
}) })
} }
bindRef = ref => { this.child = ref }; bindRef = ref => { this.child = ref };
@ -164,39 +128,36 @@ class CommonWorkDetailIndex extends Component{
} }
cancelConnectionProject = (work) => { 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` 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) { if (response.data.status == 0) {
this.child.fetchData && this.child.fetchData() this.child.fetchData && this.child.fetchData()
this.props.showNotification('取消关联成功') this.props.showNotification('取消关联成功')
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}) })
} }
// 关联项目 END // 关联项目 END
render() { render() {
let {course_name, homework_name, homework_status, noTab let { course_name, homework_name, homework_status, noTab
, view_answer, author_name, category, work_id , view_answer, author_name, category, work_id
, end_immediately, publish_immediately, work_statuses, accessoryVisible , end_immediately, publish_immediately, work_statuses, accessoryVisible
} =this.state; } = this.state;
const { current_user } = this.props const { current_user } = this.props
let courseId=this.props.match.params.coursesId; let courseId = this.props.match.params.coursesId;
let category_id= category && category.category_id; let category_id = category && category.category_id;
let category_name= category && category.category_name; 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 studentWorkId = this.props.match.params.studentWorkId
const isGroup = this.props.isGroup() const isGroup = this.props.isGroup()
const moduleName = !isGroup? "普通作业":"分组作业";
const moduleEngName = this.props.getModuleName() const moduleEngName = this.props.getModuleName()
const childModuleName = this.state.moduleName const childModuleName = this.state.moduleName
@ -212,19 +173,16 @@ class CommonWorkDetailIndex extends Component{
// 是列表页 // 是列表页
let params = {} let params = {}
if (isListModule) { if (isListModule) {
// TODO if (this.child && this.child._getRequestParams) {
if(this.child && this.child._getRequestParams) {
params = this.child._getRequestParams() !== undefined ? 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 exportUrl = `/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`
let exportResultUrl = `/homework_commons/${workId}/works_list.xlsx?${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 ( return (
<div> <div>
<PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={true} doWhenSuccess={this.doWhenSuccess} checkBeforePost={this.saveWorkSetting} isPublish={true} doWhenSuccess={this.doWhenSuccess} checkBeforePost={this.saveWorkSetting}
onToPublishClick={this.onToPublishClick} onToPublishClick={this.onToPublishClick}
></PublishRightnow> ></PublishRightnow>
@ -234,7 +192,7 @@ class CommonWorkDetailIndex extends Component{
modalCancel={this.Downloadcal} modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType} modalsType={this.state.DownloadType}
/> />
<PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow> isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow>
@ -246,18 +204,18 @@ class CommonWorkDetailIndex extends Component{
} }
`}</style> `}</style>
{current_user && <CBreadcrumb items={[ {current_user && <CBreadcrumb items={[
{ to: current_user&&current_user.first_category_url , name: course_name}, { to: current_user && current_user.first_category_url, name: course_name },
{ to: `/courses/${courseId}/${moduleEngName}/${category_id}`, name: category_name }, { to: `/courses/${courseId}/${moduleEngName}/${category_id}`, name: category_name },
window.location.pathname.indexOf('appraise') == -1 ? { } : { to: `/courses/${courseId}/${moduleEngName}/${workId}/list`, name: '作业详情' }, window.location.pathname.indexOf('appraise') == -1 ? {} : { to: `/courses/${courseId}/${moduleEngName}/${workId}/list`, name: '作业详情' },
// 1. 与上一条联动当匿评他人作品时TA人作品的作者真实姓名切换为“匿名” // 1. 与上一条联动当匿评他人作品时TA人作品的作者真实姓名切换为“匿名”
window.location.pathname.indexOf('appraise') == -1 ? { name: '作业详情' } : { name: author_name }, window.location.pathname.indexOf('appraise') == -1 ? { name: '作业详情' } : { name: author_name },
// window.location.pathname.indexOf('appraise') == -1 ? { } : { to: `/courses/${courseId}/${moduleEngName}/${workId}/list`, name: '作品列表' }, // window.location.pathname.indexOf('appraise') == -1 ? { } : { to: `/courses/${courseId}/${moduleEngName}/${workId}/list`, name: '作品列表' },
// { name: childModuleName } // { name: childModuleName }
]}></CBreadcrumb>} ]}></CBreadcrumb>}
<div style={{ width:'100%',height:'52px'}} > <div style={{ width: '100%', height: '52px' }} >
<span className=" fl color-black summaryname" title={`${homework_name && homework_name.length > 36 ? homework_name : ''}`} <span className=" fl color-black summaryname" title={`${homework_name && homework_name.length > 36 ? homework_name : ''}`}
style={{height: 'auto'}} style={{ height: 'auto' }}
> >
{homework_name} {homework_name}
{/* <Link to={"/courses/"+courseId+"/graduation"+"/graduation_tasks/"}>{homework_name}</Link> */} {/* <Link to={"/courses/"+courseId+"/graduation"+"/graduation_tasks/"}>{homework_name}</Link> */}
@ -268,11 +226,11 @@ class CommonWorkDetailIndex extends Component{
/> />
{category && <a className="color-grey-6 fr font-16 ml30 mt5 mr20" onClick={this.goback} style={{ marginRight: '26px'}}>返回</a>} {category && <a className="color-grey-6 fr font-16 ml30 mt5 mr20" onClick={this.goback} style={{ marginRight: '26px' }}>返回</a>}
{this.state.update_atta && {this.state.update_atta &&
<React.Fragment> <React.Fragment>
{this.state.accessoryVisible===true? <AccessoryModal {this.state.accessoryVisible === true ? <AccessoryModal
{...this.props} {...this.props}
modalname={"补交附件"} modalname={"补交附件"}
visible={this.state.accessoryVisible} visible={this.state.accessoryVisible}
@ -282,7 +240,7 @@ class CommonWorkDetailIndex extends Component{
setupdate={this.setupdate} setupdate={this.setupdate}
seeworks={undefined} seeworks={undefined}
reviseAttachmentUrl={`/student_works/${work_id || studentWorkId}/revise_attachment.json`} reviseAttachmentUrl={`/student_works/${work_id || studentWorkId}/revise_attachment.json`}
/>:""} /> : ""}
<a className={"fr color-blue font-16 "} href={"javascript:void(0)"} <a className={"fr color-blue font-16 "} href={"javascript:void(0)"}
onClick={this.addAccessory} style={{ 'marginTop': '-4px' }} onClick={this.addAccessory} style={{ 'marginTop': '-4px' }}
>补交附件</a> >补交附件</a>
@ -291,25 +249,25 @@ class CommonWorkDetailIndex extends Component{
} }
</div> </div>
{ noTab !== true && <div className="stud-class-set bor-bottom-greyE floatSpinParent"> {noTab !== true && <div className="stud-class-set bor-bottom-greyE floatSpinParent">
<div className="mt10 clearfix edu-back-white poll_list pl5"> <div className="mt10 clearfix edu-back-white poll_list pl5">
<Link <Link
onClick={() => this.setState({moduleName: '作品列表'})} onClick={() => this.setState({ moduleName: '作品列表' })}
className={`${isListModule ? 'active' : '' } `} className={`${isListModule ? 'active' : ''} `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/list`}>作品列表</Link> to={`/courses/${courseId}/${moduleEngName}/${workId}/list`}>作品列表</Link>
<Link <Link
onClick={() => this.setState({moduleName: '作业描述'})} onClick={() => this.setState({ moduleName: '作业描述' })}
className={`${childModuleName == '作业描述' ? 'active' : '' } `} className={`${childModuleName == '作业描述' ? 'active' : ''} `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/question`}>作业描述</Link> to={`/courses/${courseId}/${moduleEngName}/${workId}/question`}>作业描述</Link>
{view_answer == true && <Link {view_answer == true && <Link
onClick={() => this.setState({moduleName: '参考答案'})} onClick={() => this.setState({ moduleName: '参考答案' })}
className={`${childModuleName == '参考答案' ? 'active' : '' } `} className={`${childModuleName == '参考答案' ? 'active' : ''} `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案</Link>} to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案</Link>}
<Link <Link
onClick={() => this.setState({moduleName: '设置'})} onClick={() => this.setState({ moduleName: '设置' })}
className={`${childModuleName == '设置' ? 'active' : '' } `} className={`${childModuleName == '设置' ? 'active' : ''} `}
style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}} style={{ paddingLeft: this.props.isAdmin() ? '38px' : '20px' }}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"}</Link> to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin() ? "设置" : "得分规则"}</Link>
{/* { this.props.tabRightComponents } */} {/* { this.props.tabRightComponents } */}
@ -335,10 +293,10 @@ class CommonWorkDetailIndex extends Component{
float: right; float: right;
} }
`}</style> `}</style>
{this.props.isAdmin()? <Spin spinning={this.state.donwloading} style={{ }}> {this.props.isAdmin() ? <Spin spinning={this.state.donwloading} >
<li className="li_line drop_down fr color-blue font-16 mt20" style={{"padding":"0 20px"}}> <li className="li_line drop_down fr color-blue font-16 mt20" style={{ "padding": "0 20px" }}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{ "right": "-34px", "left": "unset", "height": "auto" }}>
<li> <li>
<a href={"javascript:void(0)"} className="color-dark" <a href={"javascript:void(0)"} className="color-dark"
@ -353,21 +311,14 @@ class CommonWorkDetailIndex extends Component{
</li> </li>
</ul> </ul>
</li> </li>
</Spin>:""} </Spin> : ""}
{/* {isAdmin && <a className={"fr color-blue font-16"} href={exportUrl}></a>}
{isAdmin && <a className={"fr color-blue font-16"} href={exportResultUrl}>导出成绩</a>} */}
{/*<a className={"fr color-blue font-16"}>导出</a>*/}
{end_immediately && <a className={"fr color-blue font-16"} onClick={() => { this.endModal.current.open() } }>立即截止</a>}
{publish_immediately && <a className={"fr color-blue font-16"} onClick={() => { this.publishModal.current.open() } } >立即发布</a>}
{/*<a className={"fr color-blue font-16"}>项目在线质量检测</a>*/}
{isAdmin && <a className={"fr color-blue font-16"} onClick={() => this.props.toEditPage(this.props.match.params, workId)}>编辑作业</a>} {isAdmin && <a className={"fr color-blue font-16"} onClick={() => this.props.toEditPage(this.props.match.params, workId)}>编辑作业</a>}
{ // { //
work_statuses && work_statuses.indexOf('关联项目') != -1 && work_statuses && work_statuses.indexOf('关联项目') != -1 &&
<React.Fragment> <React.Fragment>
<ConnectProject ref="connectProject" {...this.props} connectSuccess={this.connectSuccess}></ConnectProject> <ConnectProject {...this.props} connectSuccess={this.connectSuccess}></ConnectProject>
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.openConnectionProject({ homework_id: workId })}>关联项目</WordsBtn> <WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.openConnectionProject({ homework_id: workId })}>关联项目</WordsBtn>
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.props.toCreateProject()}>创建项目</WordsBtn> <WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.props.toCreateProject()}>创建项目</WordsBtn>
</React.Fragment> </React.Fragment>
@ -375,20 +326,20 @@ class CommonWorkDetailIndex extends Component{
{ // { //
work_statuses && work_statuses.indexOf('取消关联') != -1 && work_statuses && work_statuses.indexOf('取消关联') != -1 &&
<WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.cancelConnectionProject( {homework_id: workId} )}>取消关联</WordsBtn> <WordsBtn style="blue" className={` font-16 fr`} onClick={() => this.cancelConnectionProject({ homework_id: workId })}>取消关联</WordsBtn>
} }
{work_statuses && work_statuses.indexOf('提交作品') != -1 && <a className={"fr color-blue font-16"} href={"javascript:void(0)"} {work_statuses && work_statuses.indexOf('提交作品') != -1 && <a className={"fr color-blue font-16"} href={"javascript:void(0)"}
onClick={() => { this.props.toWorkPostPage(this.props.match.params)}} onClick={() => { this.props.toWorkPostPage(this.props.match.params) }}
>提交作品</a>} >提交作品</a>}
{ work_statuses && work_statuses.indexOf('补交作品') != -1 && {work_statuses && work_statuses.indexOf('补交作品') != -1 &&
<a className={"fr color-blue font-16"} href={"javascript:void(0)"} <a className={"fr color-blue font-16"} href={"javascript:void(0)"}
onClick={() => { this.props.toWorkPostPage(this.props.match.params)}}> onClick={() => { this.props.toWorkPostPage(this.props.match.params) }}>
补交作品</a> } 补交作品</a>}
{work_statuses && work_statuses.indexOf('修改作品') != -1 && <a className={"fr color-blue font-16"} href={"javascript:void(0)"} {work_statuses && work_statuses.indexOf('修改作品') != -1 && <a className={"fr color-blue font-16"} href={"javascript:void(0)"}
onClick={() => { this.props.toWorkPostPage(this.props.match.params, null, true, work_id)}} onClick={() => { this.props.toWorkPostPage(this.props.match.params, null, true, work_id) }}
>修改作品</a>} >修改作品</a>}
{work_statuses && work_statuses.indexOf('补交附件') != -1 && {work_statuses && work_statuses.indexOf('补交附件') != -1 &&
<React.Fragment> <React.Fragment>
@ -411,7 +362,7 @@ class CommonWorkDetailIndex extends Component{
</React.Fragment> </React.Fragment>
</div> </div>
</div> } </div>}
{/* 内容区 */} {/* 内容区 */}
<Switch {...this.props}> <Switch {...this.props}>
@ -422,52 +373,52 @@ class CommonWorkDetailIndex extends Component{
{/* http://localhost:3007/courses/1309/homework/9300/setting */} {/* http://localhost:3007/courses/1309/homework/9300/setting */}
<Route exact path="/courses/:coursesId/common_homeworks/:workId/setting" <Route exact path="/courses/:coursesId/common_homeworks/:workId/setting"
render={ render={
(props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
{/* 作品列表 */} {/* 作品列表 */}
<Route exact path="/courses/:coursesId/common_homeworks/:workId/list" <Route exact path="/courses/:coursesId/common_homeworks/:workId/list"
render={ render={
(props) => (<CommonWorkList ref="commonWorkList" triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
{/* 作业问答 */} {/* 作业问答 */}
<Route exact path="/courses/:coursesId/common_homeworks/:workId/question" <Route exact path="/courses/:coursesId/common_homeworks/:workId/question"
render={ render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/common_homeworks/:workId/answer" <Route exact path="/courses/:coursesId/common_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/group_homeworks/:workId/setting" <Route exact path="/courses/:coursesId/group_homeworks/:workId/setting"
render={ render={
(props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkSetting {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
{/* 作品列表 */} {/* 作品列表 */}
<Route exact path="/courses/:coursesId/group_homeworks/:workId/list" <Route exact path="/courses/:coursesId/group_homeworks/:workId/list"
render={ render={
(props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkList triggerRef={this.bindRef} {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
{/* 作业问答 */} {/* 作业问答 */}
<Route exact path="/courses/:coursesId/group_homeworks/:workId/question" <Route exact path="/courses/:coursesId/group_homeworks/:workId/question"
render={ render={
(props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkQuestion {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/group_homeworks/:workId/answer" <Route exact path="/courses/:coursesId/group_homeworks/:workId/answer"
render={ render={
(props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler}/>) (props) => (<CommonWorkAnswer {...this.props} {...props} {...this.state} {...commonHandler} />)
} }
></Route> ></Route>
</Switch> </Switch>
@ -479,4 +430,4 @@ class CommonWorkDetailIndex extends Component{
} }
} }
export default ( CommonWorkDetailIndex) ; export default (CommonWorkDetailIndex);

@ -1,6 +1,6 @@
import React,{Component} from "react"; 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 { Form, Table, Tooltip, Spin, Pagination } from "antd";
import {WordsBtn, ConditionToolTip, queryString, publicSearchs, on, off, NoneData, sortDirections} from 'educoder'; import { queryString, publicSearchs, on, off, NoneData, sortDirections } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import CheckAllGroup from '../common/button/CheckAllGroup' import CheckAllGroup from '../common/button/CheckAllGroup'
import moment from 'moment'; import moment from 'moment';
@ -11,7 +11,6 @@ import ModulationModal from "../coursesPublic/ModulationModal";
import AccessoryModal from "../coursesPublic/AccessoryModal"; import AccessoryModal from "../coursesPublic/AccessoryModal";
import LeaderIcon from './common/LeaderIcon' import LeaderIcon from './common/LeaderIcon'
const $ = window.$; const $ = window.$;
const Search = Input.Search;
function renderScore(score, content) { function renderScore(score, content) {
let color = '#747A7F' let color = '#747A7F'
@ -21,7 +20,7 @@ function renderScore(score, content) {
color = '#FF6800' color = '#FF6800'
} }
return <a href="javascript:;" style={{ color, cursor: 'default', minWidth: '30px', display: 'inline-block', textAlign: 'center' }}> return <a href="javascript:;" style={{ color, cursor: 'default', minWidth: '30px', display: 'inline-block', textAlign: 'center' }}>
{score == null || score == undefined || score == '--' ? '--': (content || score)} {score == null || score == undefined || score == '--' ? '--' : (content || score)}
</a> </a>
} }
function getScoreTip(score, dom) { function getScoreTip(score, dom) {
@ -47,8 +46,8 @@ function buildColumns(that, student_works, studentData) {
gotProjectInfo = true; gotProjectInfo = true;
} }
} }
let courseId= that.props.match.params.coursesId; let courseId = that.props.match.params.coursesId;
let workId= that.props.match.params.workId; let workId = that.props.match.params.workId;
const { course_group_count, homework_status } = that.state; const { course_group_count, homework_status } = that.state;
const isAdmin = that.props.isAdmin() const isAdmin = that.props.isAdmin()
const isAdminOrStudent = that.props.isAdminOrStudent() const isAdminOrStudent = that.props.isAdminOrStudent()
@ -68,7 +67,8 @@ function buildColumns(that, student_works, studentData) {
<span style={{ minWidth: '50px', display: 'inline-block', textAlign: 'center' }} > <span style={{ minWidth: '50px', display: 'inline-block', textAlign: 'center' }} >
{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}
</span> </span>
)}, )
},
}, { }, {
title: '姓名', title: '姓名',
width: 90, width: 90,
@ -84,10 +84,8 @@ function buildColumns(that, student_works, studentData) {
width: '74px', width: '74px',
margin: '0 auto' margin: '0 auto'
}} title={text && text.length > 5 ? text : ''}> }} title={text && text.length > 5 ? text : ''}>
{/* <Tooltip placement="bottom" title={text}>
</Tooltip> */}
{record.is_leader ? {record.is_leader ?
<div style={{ display: 'flex', 'flex-direction': 'column', 'align-items': 'center'}}> <div style={{ display: 'flex', 'flex-direction': 'column', 'align-items': 'center' }}>
<div >{text}</div> <div >{text}</div>
<LeaderIcon></LeaderIcon> <LeaderIcon></LeaderIcon>
</div> </div>
@ -114,7 +112,8 @@ function buildColumns(that, student_works, studentData) {
'width': '98px', 'width': '98px',
display: 'block', display: 'block',
overflow: 'hidden' overflow: 'hidden'
, margin: '0 auto', cursor: 'default'}} , margin: '0 auto', cursor: 'default'
}}
>{record.student_id}</a> >{record.student_id}</a>
</span> </span>
), ),
@ -123,16 +122,16 @@ function buildColumns(that, student_works, studentData) {
// TODO 只有有分班时才显示分班列 // TODO 只有有分班时才显示分班列
if (course_group_count != 0 && !niPingAndIsStudent) { if (course_group_count != 0 && !niPingAndIsStudent) {
columns.push( { columns.push({
title: '分班', title: '分班',
key: 'group_name', key: 'group_name',
dataIndex: 'group_name', dataIndex: 'group_name',
render: (text, record) => ( render: (text, record) => (
<span> <span>
<a href="javascript:;" style={{color:'#9A9A9A', cursor: 'default'}}>{record.group_name}</a> <a href="javascript:;" style={{ color: '#9A9A9A', cursor: 'default' }}>{record.group_name}</a>
</span> </span>
), ),
} ) })
} }
if (gotWorkGroup && !niPingAndIsStudent) { if (gotWorkGroup && !niPingAndIsStudent) {
columns.push({ columns.push({
@ -143,7 +142,7 @@ function buildColumns(that, student_works, studentData) {
render: (text, record) => ( render: (text, record) => (
<span> <span>
<a href="javascript:void(0);" style={{color:'#4CACFF'}}>{record.work_group}</a> <a href="javascript:void(0);" style={{ color: '#4CACFF' }}>{record.work_group}</a>
</span> </span>
), ),
}) })
@ -183,7 +182,7 @@ function buildColumns(that, student_works, studentData) {
if (status === 2) { if (status === 2) {
color = '#DD1717' color = '#DD1717'
text = '延时提交' text = '延时提交'
} else if (status === 0 ) { } else if (status === 0) {
color = '#747A7F' color = '#747A7F'
text = '未提交' text = '未提交'
} else { } else {
@ -192,11 +191,12 @@ function buildColumns(that, student_works, studentData) {
} }
return ( return (
<span> <span>
<a href="javascript:;" style={{color: color, cursor: 'default'}}> <a href="javascript:;" style={{ color: color, cursor: 'default' }}>
{status === 0 ? "未提交" : status === 1 ? "按时提交" : status === 2 ? "延时提交" : ""} {status === 0 ? "未提交" : status === 1 ? "按时提交" : status === 2 ? "延时提交" : ""}
</a> </a>
</span> </span>
)}, )
},
}, { }, {
width: 106, // isStudent ? undefined : 106 , // 匿评中 只有这几列: 序号 姓名 提交状态 更新时间 匿评评分 操作 width: 106, // isStudent ? undefined : 106 , // 匿评中 只有这几列: 序号 姓名 提交状态 更新时间 匿评评分 操作
title: '更新时间', title: '更新时间',
@ -207,7 +207,7 @@ function buildColumns(that, student_works, studentData) {
sortDirections: sortDirections, sortDirections: sortDirections,
render: (update_time, record) => ( render: (update_time, record) => (
<span> <span>
<a href="javascript:;" style={{color:'#989898', cursor: 'default'}}>{update_time ? moment(update_time).format('YYYY-MM-DD HH:mm') : '--'}</a> <a href="javascript:;" style={{ color: '#989898', cursor: 'default' }}>{update_time ? moment(update_time).format('YYYY-MM-DD HH:mm') : '--'}</a>
</span> </span>
), ),
}]) }])
@ -220,9 +220,9 @@ function buildColumns(that, student_works, studentData) {
render: (teacher_score, record) => ( render: (teacher_score, record) => (
<Tooltip title={ getScoreTip(teacher_score, teacher_score) }> <Tooltip title={getScoreTip(teacher_score, teacher_score)}>
<span> <span>
{ renderScore(teacher_score) } {renderScore(teacher_score)}
</span> </span>
</Tooltip> </Tooltip>
), ),
@ -240,16 +240,16 @@ function buildColumns(that, student_works, studentData) {
*/ */
render: (teaching_asistant_score, record) => ( render: (teaching_asistant_score, record) => (
<span> <span>
{ <Tooltip placement="bottom" title={ {<Tooltip placement="bottom" title={
getScoreTip(teaching_asistant_score, getScoreTip(teaching_asistant_score,
<div> <div>
<div>{record.ta_comment_count}名助教进行了评分</div> <div>{record.ta_comment_count}名助教进行了评分</div>
<div>{that.state.ta_mode == 1 ? '平均分': '复审分'}{teaching_asistant_score}</div> <div>{that.state.ta_mode == 1 ? '平均分' : '复审分'}{teaching_asistant_score}</div>
</div>) } </div>)}
> >
{renderScore(teaching_asistant_score) } {renderScore(teaching_asistant_score)}
</Tooltip> } </Tooltip>}
</span> </span>
), ),
}) })
@ -265,7 +265,7 @@ function buildColumns(that, student_works, studentData) {
columns.push({ columns.push({
width: 84, width: 84,
// title: <div style={{color: 'rgba(0,0,0,.85)'}}><div style={{color: 'rgba(0,0,0,.85)'}}>匿评</div>评分</div>, // title: <div style={{color: 'rgba(0,0,0,.85)'}}><div style={{color: 'rgba(0,0,0,.85)'}}>匿评</div>评分</div>,
title: <div style={{color: 'rgba(0,0,0,.85)'}}>匿评评分</div>, title: <div style={{ color: 'rgba(0,0,0,.85)' }}>匿评评分</div>,
key: 'student_score', key: 'student_score',
dataIndex: 'student_score', dataIndex: 'student_score',
@ -279,7 +279,7 @@ function buildColumns(that, student_works, studentData) {
</div> </div>
) )
}> }>
{ 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})` : ''}`)}
</Tooltip> </Tooltip>
</span> </span>
), ),
@ -300,8 +300,8 @@ function buildColumns(that, student_works, studentData) {
<span style={{ minWidth: '30px', display: 'inline-block', textAlign: 'center' }}> <span style={{ minWidth: '30px', display: 'inline-block', textAlign: 'center' }}>
{`${record.appeal_deal_count}/${appeal_all_count}`} {`${record.appeal_deal_count}/${appeal_all_count}`}
</span> </span>
</Tooltip> } </Tooltip>}
{ !appeal_all_count && <span style={{ color: '#747A7F' }}>-/-</span>} {!appeal_all_count && <span style={{ color: '#747A7F' }}>-/-</span>}
</span> </span>
), ),
}) })
@ -324,15 +324,15 @@ function buildColumns(that, student_works, studentData) {
{record.ultimate_score ? {record.ultimate_score ?
<div>最终调整成绩{record.work_score}</div> : <div>最终调整成绩{record.work_score}</div> :
<div> <div>
{ record.final_score && <div>作业评分{record.final_score}</div> } {record.final_score && <div>作业评分{record.final_score}</div>}
{ record.late_penalty >= 0 && <div>迟交扣分{record.late_penalty}</div>} {record.late_penalty >= 0 && <div>迟交扣分{record.late_penalty}</div>}
{ record.absence_penalty >= 0 && <div>缺评扣分{record.absence_penalty}</div>} {record.absence_penalty >= 0 && <div>缺评扣分{record.absence_penalty}</div>}
{ record.appeal_penalty >= 0 && <div>违规匿评扣分{record.appeal_penalty}</div>} {record.appeal_penalty >= 0 && <div>违规匿评扣分{record.appeal_penalty}</div>}
<div>最终成绩{record.work_score}</div> <div>最终成绩{record.work_score}</div>
</div> } </div>}
</div>) </div>)
}> }>
{ renderScore(work_score) } {renderScore(work_score)}
</Tooltip> </Tooltip>
</span> </span>
) )
@ -346,19 +346,19 @@ function buildColumns(that, student_works, studentData) {
key: 'operation', key: 'operation',
dataIndex: 'operation', dataIndex: 'operation',
render: (operation, record) => ( render: (operation, record) => (
record.work_status === 0 && !isAdmin ? <span style={{ color: '#747A7F' }}>--</span>: record.work_status === 0 && !isAdmin ? <span style={{ color: '#747A7F' }}>--</span> :
<div> <div>
{/* 0 未提交 */} {/* 0 未提交 */}
{/*<React.Fragment>*/} {/*<React.Fragment>*/}
{/*</React.Fragment>*/} {/*</React.Fragment>*/}
{ isAdmin && <Tooltip placement="bottom" title={<pre>调整学生当前成绩<br/>其它历史评分将全部失效</pre>}> {isAdmin && <Tooltip placement="bottom" title={<pre>调整学生当前成绩<br />其它历史评分将全部失效</pre>}>
<a style={{color: "#4CACFF"}} <a style={{ color: "#4CACFF" }}
onClick={() => that.showModulationModal(record)} onClick={() => that.showModulationModal(record)}
>调分</a> >调分</a>
</Tooltip> } </Tooltip>}
{/* toWorkDetailPage */} {/* toWorkDetailPage */}
{/* /courses/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */} {/* /courses/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */}
<a style={{color: '#4CACFF', marginLeft: '4px'}} id={"asdasdasdasd"} <a style={{ color: '#4CACFF', marginLeft: '4px' }} id={"asdasdasdasd"}
onMouseDown={(e) => that.props.toWorkDetailPage2(e, courseId, workId, record.id)} onMouseDown={(e) => that.props.toWorkDetailPage2(e, courseId, workId, record.id)}
onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}>{isAdmin ? '评阅' : '查看'}</a> onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}>{isAdmin ? '评阅' : '查看'}</a>
@ -371,25 +371,16 @@ function buildColumns(that, student_works, studentData) {
} }
// update_time最终成绩work_score学号student_id // update_time最终成绩work_score学号student_id
// desc倒序 asc顺序
const orderMap = {
update_time: 'desc',
work_score: 'asc',
student_id: 'asc',
}
const PAGE_SIZE = 20 const PAGE_SIZE = 20
// 类似页面 http://localhost:3007/courses/1309/graduation/graduation_tasks/48/76/setting // 类似页面 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) super(props)
this.publishModal = React.createRef(); this.state = {
this.endModal = React.createRef(); course_name: "",
homework_name: "",
this.state={
course_name:"",
homework_name:"",
search: '', search: '',
task_status: [], task_status: [],
teacher_comment: [], teacher_comment: [],
@ -399,13 +390,13 @@ class CommonWorkList extends Component{
arg_course_group: [], arg_course_group: [],
order: 'update_time', order: 'update_time',
page: 1, page: 1,
isSpin:true, isSpin: true,
left_time: {}, left_time: {},
category: {}, category: {},
b_order: 'desc', b_order: 'desc',
searchtypes:false, searchtypes: false,
loadingstate:false, loadingstate: false,
comwbool:false comwbool: false
} }
} }
onTablePagination = (page) => { onTablePagination = (page) => {
@ -415,27 +406,27 @@ class CommonWorkList extends Component{
} }
onSearchValue = (val) => { onSearchValue = (val) => {
if (val === ""||val===undefined) { if (val === "" || val === undefined) {
this.setState({ this.setState({
search: undefined, search: undefined,
searchtypes:false searchtypes: false
}) })
}else{ } else {
this.setState({ this.setState({
searchtypes:true, searchtypes: true,
loadingstate:true loadingstate: true
}) })
} }
this.fetchList() this.fetchList()
} }
onSearchValueInput = (e) => { onSearchValueInput = (e) => {
if (e.target.value === ""||e.target.value===undefined) { if (e.target.value === "" || e.target.value === undefined) {
this.setState({ this.setState({
search: undefined, search: undefined,
}) })
} else { } else {
this.setState({search: e.target.value}) this.setState({ search: e.target.value })
} }
} }
@ -446,7 +437,7 @@ class CommonWorkList extends Component{
$("html").animate({ scrollTop: $('html').scrollTop() - 100 }); $("html").animate({ scrollTop: $('html').scrollTop() - 100 });
try { try {
this.props.triggerRef(this); this.props.triggerRef(this);
}catch (e) { } catch (e) {
} }
@ -459,7 +450,7 @@ class CommonWorkList extends Component{
} }
_getRequestParams() { _getRequestParams() {
const {search, arg_work_status, arg_teacher_comment, arg_course_group, order, page, arg_member_work, b_order} = this.state const { search, arg_work_status, arg_teacher_comment, arg_course_group, order, page, arg_member_work, b_order } = this.state
return { return {
page, page,
search, search,
@ -469,7 +460,7 @@ class CommonWorkList extends Component{
order, order,
limit: PAGE_SIZE, limit: PAGE_SIZE,
b_order: b_order, b_order: b_order,
group_id:arg_course_group, group_id: arg_course_group,
member_work: arg_member_work member_work: arg_member_work
} }
} }
@ -477,47 +468,47 @@ class CommonWorkList extends Component{
this.fetchList() this.fetchList()
} }
fetchList = () => { fetchList = () => {
if(this.state.comwbool===true){ if (this.state.comwbool === true) {
console.log('arg_course_group2'); console.log('arg_course_group2');
console.log(this.state.arg_course_group); console.log(this.state.arg_course_group);
return return
} }
this.setState({ this.setState({
comwbool:true, comwbool: true,
}) })
//分班 //分班
let workId=this.props.match.params.workId; let workId = this.props.match.params.workId;
let courseId=this.props.match.params.coursesId; let courseId = this.props.match.params.coursesId;
const url = `/homework_commons/${workId}/works_list.json` const url = `/homework_commons/${workId}/works_list.json`
let params = this._getRequestParams() let params = this._getRequestParams()
axios.post(url, params).then((response)=> { axios.post(url, params).then((response) => {
if (response.data) { if (response.data) {
this.setState({ this.setState({
...response.data, ...response.data,
isSpin:false, isSpin: false,
loadingstate:false loadingstate: false
}) })
this.props.initWorkDetailCommonState && this.props.initWorkDetailCommonState( Object.assign({...response.data}, { this.props.initWorkDetailCommonState && this.props.initWorkDetailCommonState(Object.assign({ ...response.data }, {
moduleName: '作品列表' moduleName: '作品列表'
})) }))
} }
setTimeout(() => { setTimeout(() => {
this.setState({ this.setState({
comwbool:false, comwbool: false,
}) })
}, 1000) }, 1000)
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
this.setState({ this.setState({
isSpin:false, isSpin: false,
loadingstate:false loadingstate: false
}) })
setTimeout(() => { setTimeout(() => {
this.setState({ this.setState({
comwbool:false, comwbool: false,
}) })
}, 1000) }, 1000)
@ -526,23 +517,23 @@ class CommonWorkList extends Component{
} }
teacherCommentOptionChange = (values, isAllChecked) => { teacherCommentOptionChange = (values, isAllChecked) => {
this.setState({arg_teacher_comment: isAllChecked ? [] : values, page: 1}, () => { this.setState({ arg_teacher_comment: isAllChecked ? [] : values, page: 1 }, () => {
this.fetchList() this.fetchList()
}) })
} }
statusOptionChange = (values, isAllChecked) => { statusOptionChange = (values, isAllChecked) => {
this.setState({arg_work_status: isAllChecked ? [] : values, page: 1}, () => { this.setState({ arg_work_status: isAllChecked ? [] : values, page: 1 }, () => {
this.fetchList() this.fetchList()
}) })
} }
courseGroupOptionChange = (values, isAllChecked) => { courseGroupOptionChange = (values, isAllChecked) => {
this.setState({arg_course_group: isAllChecked ? [] : values, page: 1}, () => { this.setState({ arg_course_group: isAllChecked ? [] : values, page: 1 }, () => {
this.fetchList() this.fetchList()
}) })
} }
memberWorkChange = (values, isAllChecked) => { 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() this.fetchList()
}) })
} }
@ -588,15 +579,15 @@ class CommonWorkList extends Component{
// --------------调分 END // --------------调分 END
// 补交附件 // 补交附件
Cancelvisible=()=>{ Cancelvisible = () => {
this.setState({ this.setState({
visible:false visible: false
}) })
} }
addAccessory=()=>{ addAccessory = () => {
this.setState({ this.setState({
visible:true visible: true
}) })
} }
setupdate = () => { setupdate = () => {
@ -661,11 +652,11 @@ class CommonWorkList extends Component{
} }
} }
render(){ render() {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const dateFormat = 'YYYY-MM-DD HH:mm'; 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, all_member_count, time_status,
// 老师显示的三个过滤条件 // 老师显示的三个过滤条件
task_status, teacher_comment, course_group_info, order, task_status, teacher_comment, course_group_info, order,
@ -678,12 +669,12 @@ class CommonWorkList extends Component{
, end_immediately, publish_immediately , end_immediately, publish_immediately
, homework_id, visible, work_group, project_info, is_leader , homework_id, visible, work_group, project_info, is_leader
} =this.state; } = this.state;
let courseId=this.props.match.params.coursesId; let courseId = this.props.match.params.coursesId;
let category_id=this.props.match.params.category_id; let category_id = this.props.match.params.category_id;
let workId=this.props.match.params.workId; let workId = this.props.match.params.workId;
const radioStyle = { const radioStyle = {
display: 'block', display: 'block',
height: '30px', height: '30px',
@ -719,25 +710,27 @@ class CommonWorkList extends Component{
// work_group // work_group
let StudentData; let StudentData;
if(id===undefined){ if (id === undefined) {
StudentData=undefined StudentData = undefined
}else{ } else {
StudentData=isStudent ? [{ id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score, 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, ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
late_penalty, absence_penalty, appeal_penalty, project_info, is_leader, late_penalty, absence_penalty, appeal_penalty, project_info, is_leader,
work_group, isMine: true }] : [] work_group, isMine: true
}] : []
} }
const columns = buildColumns(this, student_works, StudentData) const columns = buildColumns(this, student_works, StudentData)
let params = this._getRequestParams() let params = this._getRequestParams()
let exportUrl = `/api/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`; let exportUrl = `/api/homework_commons/${workId}/works_list.zip?${queryString.stringify(params)}`;
const exportResultUrl = `/api/homework_commons/${workId}/works_list.xlsx`; const exportResultUrl = `/api/homework_commons/${workId}/works_list.xlsx`;
let appraisetype=false; let appraisetype = false;
let appraiselist=this.state.homework_status; let appraiselist = this.state.homework_status;
appraiselist&&appraiselist.map((item,key)=>{ appraiselist && appraiselist.map((item, key) => {
if(item==="评阅中"){ if (item === "评阅中") {
appraisetype=true appraisetype = true
return return
} }
}) })
@ -759,7 +752,7 @@ class CommonWorkList extends Component{
// console.log(StudentData) // console.log(StudentData)
// console.log(student_works) // console.log(student_works)
return( return (
<React.Fragment> <React.Fragment>
<CheckCodeModal <CheckCodeModal
ref="checkCodeModal" ref="checkCodeModal"
@ -778,9 +771,9 @@ class CommonWorkList extends Component{
reviseAttachmentUrl={`/student_works/${id}/revise_attachment.json`} reviseAttachmentUrl={`/student_works/${id}/revise_attachment.json`}
/> />
<PublishRightnow ref={this.publishModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={true} doWhenSuccess={this.doWhenSuccess}></PublishRightnow> isPublish={true} doWhenSuccess={this.doWhenSuccess}></PublishRightnow>
<PublishRightnow ref={this.endModal} showActionButton={false} {...this.props} checkBoxValues={[workId]} <PublishRightnow showActionButton={false} {...this.props} checkBoxValues={[workId]}
isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow> isPublish={false} doWhenSuccess={this.doWhenSuccess}></PublishRightnow>
{ {
@ -812,17 +805,17 @@ class CommonWorkList extends Component{
padding: 10px 1px; padding: 10px 1px;
} }
`}</style> `}</style>
<div style={{ background: '#fff'}} className="workListContent"> <div style={{ background: '#fff' }} className="workListContent">
{ isAdmin && hasData && <ul className="clearfix" style={{padding: "20px 40px 10px", position: 'relative', paddingLeft: '24px'}}> {isAdmin && hasData && <ul className="clearfix" style={{ padding: "20px 40px 10px", position: 'relative', paddingLeft: '24px' }}>
<CheckAllGroup comwbool={this.state.comwbool} options={options_teacher_comment} label={'你的评阅:'} onChange={this.teacherCommentOptionChange}></CheckAllGroup> <CheckAllGroup comwbool={this.state.comwbool} options={options_teacher_comment} label={'你的评阅:'} onChange={this.teacherCommentOptionChange}></CheckAllGroup>
<CheckAllGroup comwbool={this.state.comwbool} options={options_status} label={'作品状态:'} onChange={this.statusOptionChange}></CheckAllGroup> <CheckAllGroup comwbool={this.state.comwbool} options={options_status} label={'作品状态:'} onChange={this.statusOptionChange}></CheckAllGroup>
{isGroup && <CheckAllGroup comwbool={this.state.comwbool} options={options_member_work} label={'组内角色:'} onChange={this.memberWorkChange}></CheckAllGroup>} {isGroup && <CheckAllGroup comwbool={this.state.comwbool} options={options_member_work} label={'组内角色:'} onChange={this.memberWorkChange}></CheckAllGroup>}
{options_course_group.length > 1 && <CheckAllGroup comwbool={this.state.comwbool} options={options_course_group} label={'分班情况:'} onChange={this.courseGroupOptionChange} checkboxGroupStyle={{width: '980px'}}></CheckAllGroup>} {options_course_group.length > 1 && <CheckAllGroup comwbool={this.state.comwbool} options={options_course_group} label={'分班情况:'} onChange={this.courseGroupOptionChange} checkboxGroupStyle={{ width: '980px' }}></CheckAllGroup>}
{/* value={search} */} {/* value={search} */}
<div className="fr search-new mr8" style={{marginBottom:'1px'}}> <div className="fr search-new mr8" style={{ marginBottom: '1px' }}>
{/*<Search*/} {/*<Search*/}
{/* placeholder="请输入姓名或学号搜索1"*/} {/* placeholder="请输入姓名或学号搜索1"*/}
{/* id="subject_search_input"*/} {/* id="subject_search_input"*/}
@ -830,20 +823,20 @@ class CommonWorkList extends Component{
{/* onSearch={this.onSearchValue}*/} {/* onSearch={this.onSearchValue}*/}
{/* autoComplete="off"*/} {/* autoComplete="off"*/}
{/*></Search>*/} {/*></Search>*/}
{publicSearchs("请输入姓名或学号搜索",this.onSearchValue,this.onSearchValueInput,this.onSearchValueInput)} {publicSearchs("请输入姓名或学号搜索", this.onSearchValue, this.onSearchValueInput, this.onSearchValueInput)}
</div> </div>
</ul> } </ul>}
{ <div id="graduation_work_list" style={{padding: isStudent ? '10px 24px 10px 24px' : '0px 24px 10px 24px'}}> {<div id="graduation_work_list" style={{ padding: isStudent ? '10px 24px 10px 24px' : '0px 24px 10px 24px' }}>
<div className="clearfix"> <div className="clearfix">
{hasData && <span className="fl color-grey-6 font-12"> {hasData && <span className="fl color-grey-6 font-12">
{ isAdmin ? {isAdmin ?
(!!all_member_count) && <React.Fragment> (!!all_member_count) && <React.Fragment>
<span className="color-orange-tip">{work_count || '0'}</span>{all_member_count} <span className="color-orange-tip">{work_count || '0'}</span>{all_member_count}
</React.Fragment> : </React.Fragment> :
(!!commit_count || !!uncommit_count) && (!!commit_count || !!uncommit_count) &&
<React.Fragment> <React.Fragment>
<span className="color-orange-tip">{commit_count}</span> {uncommit_count}  <span className="color-orange-tip">{commit_count}</span> {uncommit_count}
{timeMsg || ''} {timeMsg || ''}
<span className="color-orange-tip">{left_time.time}</span> <span className="color-orange-tip">{left_time.time}</span>
</React.Fragment> </React.Fragment>
@ -852,7 +845,7 @@ class CommonWorkList extends Component{
</div> </div>
</div> } </div>}
<style>{` <style>{`
@ -864,23 +857,20 @@ class CommonWorkList extends Component{
font-size: 13px !important; font-size: 13px !important;
} }
`}</style> `}</style>
{ isStudent &&StudentData===undefined?"":StudentData===undefined?"": {isStudent && StudentData === undefined ? "" : StudentData === undefined ? "" :
<Table <Table
className="studentTable" className="studentTable"
dataSource={StudentData} dataSource={StudentData}
onChange={this.table1handleChange} onChange={this.table1handleChange}
columns={columns} columns={columns}
pagination={false} pagination={false}
showHeader={ !student_works || student_works.length == 0} showHeader={!student_works || student_works.length == 0}
/> />
} }
<div className={"justify break_full_word new_li edu-back-white course_table_wrap"} style={{minHeight:"480px", marginBottom: '30px'}}> <div className={"justify break_full_word new_li edu-back-white course_table_wrap"} style={{ minHeight: "480px", marginBottom: '30px' }}>
<style>{` <style>{`
// .ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
// top: 72%;}
// }
.singleLine tr.ant-table-row { .singleLine tr.ant-table-row {
background: #f1f9ff; background: #f1f9ff;
} }
@ -889,7 +879,7 @@ class CommonWorkList extends Component{
text-align: center; text-align: center;
} }
`}</style> `}</style>
{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 ?
<Spin size="large" spinning={this.state.isSpin}> <Spin size="large" spinning={this.state.isSpin}>
<div id="forum_list" className="forum_table"> <div id="forum_list" className="forum_table">
<div className="mh650 edu-back-white"> <div className="mh650 edu-back-white">

@ -1,97 +1,48 @@
import React,{Component} from "react"; import React, { Component } from "react";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd"; import { Form } from "antd";
import {Link} from 'react-router-dom'; import { Link } from 'react-router-dom';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn } from 'educoder'; import { WordsBtn } from 'educoder';
import axios from 'axios';
import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import HomeworkModal from "../coursesPublic/HomeworkModal";
import moment from 'moment';
import '../css/Courses.css' 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 // 类似页面 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) super(props)
this.state={ this.state = {
course_name:"", course_name: "",
homework_name:"", homework_name: "",
} }
} }
render(){ render() {
const { getFieldDecorator } = this.props.form;
const dateFormat = 'YYYY-MM-DD HH:mm';
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;
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 (
<React.Fragment> <React.Fragment>
{ <div> {<div>
<div className="newMain clearfix"> <div className="newMain clearfix">
<div className={"educontent mb20"}> <div className={"educontent mb20"}>
<p className="clearfix mt10"> <p className="clearfix mt10">
<WordsBtn style="grey" className="fl"> <Link to={"/courses/"+courseId} className="color-grey-6">{course_name}</Link></WordsBtn> <WordsBtn style="grey" className="fl"> <Link to={"/courses/" + courseId} className="color-grey-6">{course_name}</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl"> <Link to={"/courses/"+courseId+"/graduation"} className="color-grey-6">毕设任务</Link></WordsBtn> <WordsBtn style="grey" className="fl"> <Link to={"/courses/" + courseId + "/graduation"} className="color-grey-6">毕设任务</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>任务详情</span> <span>任务详情</span>
</p> </p>
<div style={{ width:'100%',height:'75px'}} > <div style={{ width: '100%', height: '75px' }} >
<p className=" fl color-black mt25 summaryname"> <p className=" fl color-black mt25 summaryname">
<Link to={"/courses/"+courseId+"/graduation"+"/graduation_tasks/"}>{homework_name}</Link> <Link to={"/courses/" + courseId + "/graduation" + "/graduation_tasks/"}>{homework_name}</Link>
</p> </p>
<CoursesListType <CoursesListType
typelist={["已开启补交"]} typelist={["已开启补交"]}
@ -104,17 +55,17 @@ class CommonWorkSetting extends Component{
<div className="mt10 clearfix edu-back-white poll_list pl20"> <div className="mt10 clearfix edu-back-white poll_list pl20">
<Link <Link
className="active" className="active"
to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id+"/"+task_Id+"/list"}>作品列表</Link> to={"/courses/" + courseId + "/graduation/graduation_tasks/" + category_id + "/" + task_Id + "/list"}>作品列表</Link>
<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id+"/"+task_Id+"/questions"}>作业描述</Link> <Link to={"/courses/" + courseId + "/graduation/graduation_tasks/" + category_id + "/" + task_Id + "/questions"}>作业描述</Link>
<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id+"/"+task_Id+"/questions"}>参考答案</Link> <Link to={"/courses/" + courseId + "/graduation/graduation_tasks/" + category_id + "/" + task_Id + "/questions"}>参考答案</Link>
<Link <Link
style={{paddingLeft:'38px'}} style={{ paddingLeft: '38px' }}
to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id+"/"+task_Id+"/setting"}>设置</Link> to={"/courses/" + courseId + "/graduation/graduation_tasks/" + category_id + "/" + task_Id + "/setting"}>设置</Link>
<a className={"fr color-blue font-16"} onClick={() => { this.end()} }>立即截止</a> <a className={"fr color-blue font-16"} onClick={() => { this.end() }}>立即截止</a>
<a className={"fr color-blue font-16"} onClick={() => { this.publish()} }>立即发布</a> <a className={"fr color-blue font-16"} onClick={() => { this.publish() }}>立即发布</a>
<a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation/graduation_tasks/"+task_Id+"/edit"}>编辑作业</a> <a className={"fr color-blue font-16"} href={"/courses/" + courseId + "/graduation/graduation_tasks/" + task_Id + "/edit"}>编辑作业</a>
</div> </div>
</div> </div>

@ -1,13 +1,10 @@
import React,{ Component } from "react"; import React, { Component } from "react";
import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Modal } from "antd"; import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon } from "antd";
import axios from 'axios' import axios from 'axios'
import '../css/busyWork.css' import '../css/busyWork.css'
import '../css/Courses.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 TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
import CBreadcrumb from '../common/CBreadcrumb'
const confirm = Modal.confirm;
const $ = window.$ const $ = window.$
const MAX_TITLE_LENGTH = 60; const MAX_TITLE_LENGTH = 60;
@ -15,14 +12,14 @@ const MAX_TITLE_LENGTH = 60;
需要注意的props 需要注意的props
isGroup isGroup
*/ */
class NewWorkForm extends Component{ class NewWorkForm extends Component {
constructor(props){ constructor(props) {
super(props); super(props);
this.contentMdRef = React.createRef(); this.contentMdRef = React.createRef();
this.answerMdRef = React.createRef(); this.answerMdRef = React.createRef();
this.state={ this.state = {
title_value:"", title_value: "",
title_num: 0, title_num: 0,
contentFileList: [], contentFileList: [],
answerFileList: [], answerFileList: [],
@ -108,7 +105,7 @@ class NewWorkForm extends Component{
} }
// 输入title // 输入title
changeTitle=(e)=>{ changeTitle = (e) => {
this.setState({ this.setState({
title_num: parseInt(e.target.value.length) title_num: parseInt(e.target.value.length)
@ -117,18 +114,18 @@ class NewWorkForm extends Component{
handleSubmit = () => { 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) => { 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(); const mdContnet = this.contentMdRef.current.getValue().trim();
values.description = mdContnet; values.description = mdContnet;
// return; // return;
{/* max={has_commit ? init_min_num : null } */} {/* max={has_commit ? init_min_num : null } */ }
{/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} {/* 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 { has_commit, max_num, init_max_num, min_num, init_min_num } = this.state;
const isGroup = this.props.isGroup() const isGroup = this.props.isGroup()
@ -237,7 +234,7 @@ class NewWorkForm extends Component{
} }
onAttachmentRemove = (file, stateName) => { onAttachmentRemove = (file, stateName) => {
if(!file.percent || file.percent == 100){ if (!file.percent || file.percent == 100) {
this.props.confirm({ this.props.confirm({
content: '是否确认删除?', content: '是否确认删除?',
@ -316,18 +313,18 @@ class NewWorkForm extends Component{
this._scrollToTop() this._scrollToTop()
} }
render(){ render() {
let {typeId,coursesId,pageType}=this.props.match.params; let { typeId, coursesId, pageType } = this.props.match.params;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const isGroup = this.props.isGroup() const isGroup = this.props.isGroup()
let{ let {
title_value, contentFileList, answerFileList, max_num, min_num, base_on_project, 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 title_num, course_name, category, has_commit, has_project
}=this.state } = this.state
const { current_user } = this.props 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 this.isEdit = this.isEdit || this.props.match.url.indexOf('/edit') != -1
if ((this.isEdit) && !this.state.description && this.state.description != '') { if ((this.isEdit) && !this.state.description && this.state.description != '') {
return '' return ''
@ -371,7 +368,7 @@ class NewWorkForm extends Component{
}, },
}; };
return( return (
<React.Fragment> <React.Fragment>
<style> <style>
@ -395,7 +392,7 @@ class NewWorkForm extends Component{
required: true, message: '请输入标题' required: true, message: '请输入标题'
}], }],
})( })(
<Input placeholder="请输入作业标题最大限制60个字符" onInput={this.changeTitle} className="searchView yslnewworkinputaddonAfter searchViewAfter" style={{"width":"100%"}} maxLength={MAX_TITLE_LENGTH} addonAfter={`${String(title_num)}/${MAX_TITLE_LENGTH}`}/> <Input placeholder="请输入作业标题最大限制60个字符" onInput={this.changeTitle} className="searchView yslnewworkinputaddonAfter searchViewAfter" style={{ "width": "100%" }} maxLength={MAX_TITLE_LENGTH} addonAfter={`${String(title_num)}/${MAX_TITLE_LENGTH}`} />
)} )}
</Form.Item> </Form.Item>
<style>{` <style>{`
@ -445,22 +442,22 @@ class NewWorkForm extends Component{
`}</style> `}</style>
{ <Form.Item {<Form.Item
label="内容" label="内容"
className="AboutInputForm workContent mdInForm" className="AboutInputForm workContent mdInForm"
> >
{getFieldDecorator('description', { {getFieldDecorator('description', {
rules: [{ rules: [{
required: true, message: '请输入作业内容和要求', required: true, message: '请输入作业内容和要求',
},{ }, {
max: 5000 , message:'最大限制5000个字符' max: 5000, message: '最大限制5000个字符'
}], }],
})( })(
<TPMMDEditor ref={this.contentMdRef} placeholder="请在此输入作业内容和要求,最大限制5000个字符" mdID={'courseContentMD'} refreshTimeout={1500} <TPMMDEditor ref={this.contentMdRef} placeholder="请在此输入作业内容和要求,最大限制5000个字符" mdID={'courseContentMD'} refreshTimeout={1500}
initValue={this.state.description} noSetValueOnInit={!!this.isEdit} initValue={this.state.description} noSetValueOnInit={!!this.isEdit}
className="courseMessageMD" ></TPMMDEditor> className="courseMessageMD" ></TPMMDEditor>
)} )}
</Form.Item> } </Form.Item>}
<Upload {...uploadProps} className="upload_1 newWorkUpload"> <Upload {...uploadProps} className="upload_1 newWorkUpload">
<Button className="uploadBtn"> <Button className="uploadBtn">
<Icon type="upload" /> 上传附件 <Icon type="upload" /> 上传附件
@ -469,7 +466,7 @@ class NewWorkForm extends Component{
</Upload> </Upload>
<span id={"numberofgroups"}></span> <span id={"numberofgroups"}></span>
{ isGroup && {isGroup &&
<Form.Item <Form.Item
label="分组设置" label="分组设置"
className="AboutInputForm groupSetting" className="AboutInputForm groupSetting"
@ -489,14 +486,14 @@ class NewWorkForm extends Component{
{/* max={has_commit ? init_min_num : null } */} {/* max={has_commit ? init_min_num : null } */}
<InputNumber placeholder="请填写每组最小人数" min={1} className="winput-240-40" value={min_num} <InputNumber placeholder="请填写每组最小人数" min={1} className="winput-240-40" value={min_num}
onChange={this.min_num_change} style={{width:'180px'}} /> onChange={this.min_num_change} style={{ width: '180px' }} />
</ConditionToolTip> </ConditionToolTip>
<span className="ml15 mr15">~</span> <span className="ml15 mr15">~</span>
{/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */} {/* min={has_commit ? init_max_num : (min_num == undefined ? 2 : min_num + 1) } */}
<ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}> <ConditionToolTip condition={has_commit} title={'已有提交作品,人数范围只能扩大'}>
<InputNumber className="winput-240-40" placeholder="请填写每组最大人数" value={max_num} max={10} <InputNumber className="winput-240-40" placeholder="请填写每组最大人数" value={max_num} max={10}
onChange={this.max_num_change} style={{width:'180px'}} /> onChange={this.max_num_change} style={{ width: '180px' }} />
</ConditionToolTip> </ConditionToolTip>
<label className="color-grey-9 ml20 font-14">学生提交作品时需要关联同组成员组内成员作品共享</label> <label className="color-grey-9 ml20 font-14">学生提交作品时需要关联同组成员组内成员作品共享</label>
</p> </p>
@ -519,11 +516,11 @@ class NewWorkForm extends Component{
<Form.Item <Form.Item
label="参考答案" label="参考答案"
className="AboutInputForm clearPaddingBottom pr" className="AboutInputForm clearPaddingBottom pr"
style={{"borderBottom":"none"}} style={{ "borderBottom": "none" }}
> >
{getFieldDecorator('reference_answer', { {getFieldDecorator('reference_answer', {
rules: [{ rules: [{
max: 5000 , message:'最大限制5000个字符' max: 5000, message: '最大限制5000个字符'
}], }],
})( })(
<TPMMDEditor ref={this.answerMdRef} placeholder="请在此输入作业的参考答案,最大限制5000个字符" mdID={'workAnswerMD'} <TPMMDEditor ref={this.answerMdRef} placeholder="请在此输入作业的参考答案,最大限制5000个字符" mdID={'workAnswerMD'}

@ -1,30 +1,29 @@
import React,{ Component } from "react"; import React, { Component } from "react";
import { Input,Checkbox,Menu,Pagination } from "antd"; import { Input, Checkbox, Menu, Pagination } from "antd";
import HomeworkModal from '../coursesPublic/HomeworkModal'; import HomeworkModal from '../coursesPublic/HomeworkModal';
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import axios from 'axios' import axios from 'axios'
import moment from 'moment' import moment from 'moment'
import { getNextHalfHourOfMoment } from 'educoder' class PublishRightnow extends Component {
class PublishRightnow extends Component{ constructor(props) {
constructor(props){
super(props); super(props);
this.state={ this.state = {
course_groups: [], course_groups: [],
modalname:undefined, modalname: undefined,
modaltype:undefined, modaltype: undefined,
visible:false, visible: false,
Topval:undefined, Topval: undefined,
Botvalleft:undefined, Botvalleft: undefined,
Botval:undefined, Botval: undefined,
starttime:undefined, starttime: undefined,
endtime:undefined, endtime: undefined,
Cancelname:undefined, Cancelname: undefined,
Savesname:undefined, Savesname: undefined,
Cancel:undefined, Cancel: undefined,
Saves:undefined, Saves: undefined,
Topvalright:undefined Topvalright: undefined
} }
} }
open = (usingCheckBeforePost) => { open = (usingCheckBeforePost) => {
@ -32,13 +31,13 @@ class PublishRightnow extends Component{
this.homeworkstart() this.homeworkstart()
} }
homeworkstart=()=>{ homeworkstart = () => {
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype; const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1; let showdatatypes = isPublish === true || isPublishtype === 1;
if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) { if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) {
this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`) this.props.showNotification(`请先选择要立即${showdatatypes ? "发布" : "截止"}的作业`)
return; return;
} }
@ -50,53 +49,52 @@ class PublishRightnow extends Component{
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype; const isPublishtype = this.props.isPublishtype;
const dateFormat = 'YYYY-MM-DD HH:mm'; const dateFormat = 'YYYY-MM-DD HH:mm';
let showdatatype=isPublish===true&&isPublishtype===undefined; let showdatatype = isPublish === true && isPublishtype === undefined;
let showdatatypes=isPublish===true||isPublishtype===1; let showdatatypes = isPublish === true || isPublishtype === 1;
// getNextHalfHourOfMoment // getNextHalfHourOfMoment
const startMoment = (moment()); const startMoment = (moment());
this.setState({ this.setState({
modalname: showdatatypes ? "立即发布" : "立即截止", modalname: showdatatypes ? "立即发布" : "立即截止",
modaltype:course_groups.length> 0 ? 1 : 2, modaltype: course_groups.length > 0 ? 1 : 2,
visible:showdatatype?false:true, visible: showdatatype ? false : true,
OneSelftype:showdatatype?true:false, OneSelftype: showdatatype ? true : false,
Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品", Topval: showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品",
// Botvalleft: isPublish ? "暂不发布" : "暂不截止", // Botvalleft: isPublish ? "暂不发布" : "暂不截止",
Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的作业有效" : "本操作只对“提交中”的作业有效") : '', Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的作业有效" : "本操作只对“提交中”的作业有效") : '',
starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '', starttime: showdatatypes ? `发布时间:${startMoment.format(dateFormat)}` : '',
starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '', starttimes: showdatatypes ? `${startMoment.format(dateFormat)}` : '',
endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', endtime: showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
Cancelname:showdatatypes ? "暂不发布" : "暂不截止", Cancelname: showdatatypes ? "暂不发布" : "暂不截止",
Savesname:showdatatypes ? "立即发布" : "立即截止", Savesname: showdatatypes ? "立即发布" : "立即截止",
Cancel:this.homeworkhide, Cancel: this.homeworkhide,
Saves:this.homeworkstartend, Saves: this.homeworkstartend,
typs:showdatatypes ? "start" : "end", typs: showdatatypes ? "start" : "end",
}) })
} }
homeworkhide=()=>{ homeworkhide = () => {
this.setState({ this.setState({
modalname:undefined, modalname: undefined,
modaltype:undefined, modaltype: undefined,
visible:false, visible: false,
OneSelftype:false, OneSelftype: false,
Topval:undefined, Topval: undefined,
Topvalright:undefined, Topvalright: undefined,
Botvalleft:undefined, Botvalleft: undefined,
Botval:undefined, Botval: undefined,
starttime:undefined, starttime: undefined,
endtime:undefined, endtime: undefined,
Cancelname:undefined, Cancelname: undefined,
Savesname:undefined, Savesname: undefined,
Cancel:undefined, Cancel: undefined,
Saves:undefined, Saves: undefined,
StudentList_value:undefined, StudentList_value: undefined,
addname:undefined, addname: undefined,
addnametype:false, addnametype: false,
addnametab:undefined addnametab: undefined
}) })
} }
homeworkstartend=(arg_group_ids,endtime)=>{ homeworkstartend = (arg_group_ids, endtime) => {
debugger
if (this.usingCheckBeforePost && this.props.checkBeforePost) { if (this.usingCheckBeforePost && this.props.checkBeforePost) {
const goOn = this.props.checkBeforePost(); const goOn = this.props.checkBeforePost();
if (!goOn) { if (!goOn) {
@ -104,7 +102,6 @@ class PublishRightnow extends Component{
return; return;
} }
} }
debugger
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
let group_ids = arg_group_ids let group_ids = arg_group_ids
if (this.usingCheckBeforePost) { if (this.usingCheckBeforePost) {
@ -112,37 +109,36 @@ class PublishRightnow extends Component{
return item.id return item.id
}) })
} }
debugger if (this.state.course_groups.length > 0) {
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 && (!group_ids || group_ids&&group_ids.length == 0)) {
this.props.showNotification('请至少选择一个分班'); this.props.showNotification('请至少选择一个分班');
return; return;
} }
} }
let data={} let data = {}
if(arg_group_ids&&arg_group_ids.length===0){ if (arg_group_ids && arg_group_ids.length === 0) {
data = { data = {
homework_ids: this.props.checkBoxValues, homework_ids: this.props.checkBoxValues,
end_time: endtime==="Invalid date"?undefined:endtime, end_time: endtime === "Invalid date" ? undefined : endtime,
} }
}else if(this.props.islist===true){ } else if (this.props.islist === true) {
data={ data = {
homework_ids: this.props.checkBoxValues, homework_ids: this.props.checkBoxValues,
group_ids: group_ids, group_ids: group_ids,
end_time:endtime, end_time: endtime,
} }
}else{ } else {
data={ data = {
homework_ids: this.props.checkBoxValues, homework_ids: this.props.checkBoxValues,
group_ids: group_ids, group_ids: group_ids,
group_end_times:endtime, group_end_times: endtime,
detail:true detail: true
} }
} }
const isPublishtype = this.props.isPublishtype; const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1; let showdatatypes = isPublish === true || isPublishtype === 1;
let coursesId=this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json` const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json`
axios.post(url, data) axios.post(url, data)
.then((response) => { .then((response) => {
@ -150,7 +146,7 @@ class PublishRightnow extends Component{
this.homeworkhide() this.homeworkhide()
this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功") this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功")
this.props.doWhenSuccess && this.props.doWhenSuccess() this.props.doWhenSuccess && this.props.doWhenSuccess()
this.setState({ visible : false }) this.setState({ visible: false })
this.props.action && this.props.action() this.props.action && this.props.action()
} }
}) })
@ -166,27 +162,27 @@ class PublishRightnow extends Component{
fetchCourseGroups = () => { fetchCourseGroups = () => {
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype; const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1; let showdatatypes = isPublish === true || isPublishtype === 1;
let coursesId=this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
// TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668 // TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668
// /homework_commons/:id/publish_groups.json // /homework_commons/:id/publish_groups.json
let url = `/courses/${coursesId}/all_course_groups.json` let url = `/courses/${coursesId}/all_course_groups.json`
if (this.props.checkBoxValues.length == 1) { if (this.props.checkBoxValues.length == 1) {
const isPublish = this.props.isPublish; 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, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
if (!response || response.data.status == -1) { if (!response || response.data.status == -1) {
this.setState({ visible : false }) this.setState({ visible: false })
return; return;
} }
this.showDialog(response.data.course_groups) this.showDialog(response.data.course_groups)
this.setState({ this.setState({
course_groups: response.data.course_groups, 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) { .catch(function (error) {
@ -194,12 +190,12 @@ class PublishRightnow extends Component{
}); });
} }
render(){ render() {
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype; const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1; let showdatatypes = isPublish === true || isPublishtype === 1;
let{ let {
Topvalright, Topvalright,
modalname, modalname,
modaltype, modaltype,
@ -215,13 +211,13 @@ class PublishRightnow extends Component{
Cancel, Cancel,
Saves, Saves,
course_groups course_groups
}=this.state } = this.state
const { showActionButton } = this.props const { showActionButton } = this.props
return( return (
<div> <div>
{/*立即截止*/} {/*立即截止*/}
{visible===true?<HomeworkModal {visible === true ? <HomeworkModal
modaltype={modaltype} modaltype={modaltype}
modalname={modalname} modalname={modalname}
visible={visible} visible={visible}
@ -237,12 +233,12 @@ class PublishRightnow extends Component{
Cancel={Cancel} Cancel={Cancel}
Saves={Saves} Saves={Saves}
course_groups={course_groups} course_groups={course_groups}
usingCheckBeforePost= {this.usingCheckBeforePost} usingCheckBeforePost={this.usingCheckBeforePost}
onToPublishClick={this.props.onToPublishClick} onToPublishClick={this.props.onToPublishClick}
typs={this.state.typs} typs={this.state.typs}
/>:""} /> : ""}
{/*立即发布*/} {/*立即发布*/}
{this.state.OneSelftype===true?<OneSelfOrderModal {this.state.OneSelftype === true ? <OneSelfOrderModal
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
modalname={this.state.modalname} modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype} OneSelftype={this.state.OneSelftype}
@ -260,8 +256,8 @@ class PublishRightnow extends Component{
starttimes={this.state.starttimes} starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend} starttimesend={this.state.starttimesend}
typs={this.state.typs} typs={this.state.typs}
/>:""} /> : ""}
{ showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{ showdatatypes ? "立即发布" : "立即截止" }</a> } {showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{showdatatypes ? "立即发布" : "立即截止"}</a>}
</div> </div>
) )
} }

@ -1,12 +1,9 @@
import React,{ Component } from "react"; import React, { Component } from "react";
import { Pagination } from "antd";
import update from 'immutability-helper';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import _ from 'lodash'; import _ from 'lodash';
import {ImageLayerOfCommentHOC} from '../../../page/layers/ImageLayerOfCommentHOC'; import { ImageLayerOfCommentHOC } from '../../../page/layers/ImageLayerOfCommentHOC';
import GraduationTasksappraiseMainEditor from '../../graduation/tasks/GraduationTasksappraiseMainEditor'; import GraduationTasksappraiseMainEditor from '../../graduation/tasks/GraduationTasksappraiseMainEditor';
import CCommentItem from '../../common/comments/CCommentItem'; import CCommentItem from '../../common/comments/CCommentItem';
import '../../../forums/Post.css'; import '../../../forums/Post.css';
@ -17,31 +14,29 @@ import '../../graduation/tasks/GraduationTasksappraiseReply.css';
import './CommonWorkAppraiseReply.css'; import './CommonWorkAppraiseReply.css';
import ModulationModal from "../../coursesPublic/ModulationModal"; import ModulationModal from "../../coursesPublic/ModulationModal";
import Modals from '../../../modals/Modals'; import Modals from '../../../modals/Modals';
const REPLY_PAGE_COUNT = 10
const $ = window.$;
/* /*
*/ */
class CommonWorkAppraiseReply extends Component{ class CommonWorkAppraiseReply extends Component {
constructor(props){ constructor(props) {
super(props); super(props);
this.editorRef = React.createRef(); this.editorRef = React.createRef();
this.state={ this.state = {
total_count: 0, total_count: 0,
comment_scores: [], comment_scores: [],
} }
} }
fetchAllComments = () => { 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 url = `/graduation_works/${category_id}/comment_list.json`
const task_id = this.props.task_id const task_id = this.props.task_id
const url = `/student_works/${task_id}/comment_list.json` const url = `/student_works/${task_id}/comment_list.json`
axios.get(url).then((result)=>{ axios.get(url).then((result) => {
if(result.data.comment_scores){ if (result.data.comment_scores) {
const comment_scores = result.data.comment_scores.map(item => { const comment_scores = result.data.comment_scores.map(item => {
return this.transformReply(item) return this.transformReply(item)
}) })
@ -50,14 +45,14 @@ class CommonWorkAppraiseReply extends Component{
comment_scores comment_scores
}) })
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}) })
} }
replySuccess = () => { replySuccess = () => {
this.fetchAllComments() this.fetchAllComments()
} }
componentDidMount(){ componentDidMount() {
this.fetchAllComments() this.fetchAllComments()
} }
addSuccess = () => { addSuccess = () => {
@ -111,19 +106,20 @@ class CommonWorkAppraiseReply extends Component{
okText: '确定', okText: '确定',
cancelText: '取消', cancelText: '取消',
onOk: () => { 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 const task_id = this.props.task_id
// 作业是使用 task_id // 作业是使用 task_id
const url = `/student_works/${task_id}/destroy_score.json` const url = `/student_works/${task_id}/destroy_score.json`
axios.delete(url, { data: { axios.delete(url, {
data: {
score_id: item.id score_id: item.id
} }
}).then((result)=>{ }).then((result) => {
if(result.data.status == 0){ if (result.data.status == 0) {
this.props.showNotification('删除成功') this.props.showNotification('删除成功')
this.fetchAllComments() this.fetchAllComments()
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}) })
}, },
@ -134,44 +130,44 @@ class CommonWorkAppraiseReply extends Component{
} }
showModulationtype=(id)=>{ showModulationtype = (id) => {
// console.log(id) // console.log(id)
this.setState({ this.setState({
Modulationtype:true, Modulationtype: true,
operationId:id operationId: id
}) })
} }
cancelmodel=()=>{ cancelmodel = () => {
this.setState({ this.setState({
Modalstype:false, Modalstype: false,
Loadtype:false, Loadtype: false,
visible:false, visible: false,
Modulationtype:false, Modulationtype: false,
Allocationtype:false, Allocationtype: false,
Modalstopval:"", Modalstopval: "",
ModalCancel:"", ModalCancel: "",
ModalSave:"", ModalSave: "",
}) })
} }
saveModulationModal=(value,num)=>{ saveModulationModal = (value, num) => {
console.log(value,num) console.log(value, num)
let {operationId}=this.state; let { operationId } = this.state;
let studentWorkId =this.props.match.params.studentWorkId; let studentWorkId = this.props.match.params.studentWorkId;
// console.log(value,num) // console.log(value,num)
let url ="/student_works/"+studentWorkId+"/adjust_score.json"; let url = "/student_works/" + studentWorkId + "/adjust_score.json";
axios.post(url,{ axios.post(url, {
score:num, score: num,
comment:value comment: value
}).then((result)=>{ }).then((result) => {
// console.log(result) // console.log(result)
if(result.data.status===0){ if (result.data.status === 0) {
// this.setState({ // this.setState({
// Modalstype:true, // Modalstype:true,
// Allocationtype:false, // Allocationtype:false,
@ -185,7 +181,7 @@ class CommonWorkAppraiseReply extends Component{
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}) })
@ -193,18 +189,18 @@ class CommonWorkAppraiseReply extends Component{
onReply = (params) => { onReply = (params) => {
const { task_id } = this.props; const { task_id } = this.props;
const replyUrl = `/student_works/${task_id}/add_score.json` const replyUrl = `/student_works/${task_id}/add_score.json`
axios.post(replyUrl, params).then((response)=>{ axios.post(replyUrl, params).then((response) => {
if(response.data.status == 0) { if (response.data.status == 0) {
this.editorRef.current.clearInputs() this.editorRef.current.clearInputs()
this.fetchAllComments(); this.fetchAllComments();
this.props.onReplySuccess && this.props.onReplySuccess() this.props.onReplySuccess && this.props.onReplySuccess()
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}) })
} }
render(){ render() {
let { total_count, comments, pageCount, comment_scores, allow_score } = this.state let { total_count, comments, pageCount, comment_scores, allow_score } = this.state
const { current_user, memo, homework_status } = this.props const { current_user, memo, homework_status } = this.props
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
@ -217,14 +213,14 @@ class CommonWorkAppraiseReply extends Component{
*/ */
// && isNiPing // && isNiPing
const needNiPingEditor = (allow_score ); const needNiPingEditor = (allow_score);
if (!needNiPingEditor && comment_scores.length == 0) { if (!needNiPingEditor && comment_scores.length == 0) {
return '' return ''
} }
return( return (
<React.Fragment> <React.Fragment>
<div className="edu-back-white padding10-10" style={{marginTop: '16px'}}> <div className="edu-back-white padding10-10" style={{ marginTop: '16px' }}>
<div className={"stud-class-set edu-back-white mb10"} style={{height:"100%"}}> <div className={"stud-class-set edu-back-white mb10"} style={{ height: "100%" }}>
<Modals <Modals
modalsType={this.state.Modalstype} modalsType={this.state.Modalstype}
@ -238,18 +234,18 @@ class CommonWorkAppraiseReply extends Component{
/> />
{this.state.Modulationtype===true?<ModulationModal {this.state.Modulationtype === true ? <ModulationModal
modalname={"调分"} modalname={"调分"}
visible={this.state.Modulationtype} visible={this.state.Modulationtype}
Cancelname={"取消"} Cancelname={"取消"}
Savesname={"保存"} Savesname={"保存"}
Cancel={this.cancelmodel} Cancel={this.cancelmodel}
Saves={(value,num)=>this.saveModulationModal(value,num)} Saves={(value, num) => this.saveModulationModal(value, num)}
closable={false} closable={false}
footer={null} footer={null}
destroyOnClose={true} destroyOnClose={true}
centered={true} centered={true}
/>:""} /> : ""}
{/*<div style={{ width:'100%',height:'75px'}} >*/} {/*<div style={{ width:'100%',height:'75px'}} >*/}
{/*<p className=" fl color-black mt25 summaryname">{datalist&&datalist.task_name}</p>*/} {/*<p className=" fl color-black mt25 summaryname">{datalist&&datalist.task_name}</p>*/}
@ -267,15 +263,15 @@ class CommonWorkAppraiseReply extends Component{
</div>)} */} </div>)} */}
<div className={`padding20-30 ${comment_scores.length ? 'bor-bottom-greyE' : ''}`}> <div className={`padding20-30 ${comment_scores.length ? 'bor-bottom-greyE' : ''}`}>
{!!comment_scores.length && <div className={"color-grey-6 font-16"}> {!!comment_scores.length && <div className={"color-grey-6 font-16"}>
全部评阅<span className="count">{comment_scores.length===0?"":`(${comment_scores.length})`}</span> 全部评阅<span className="count">{comment_scores.length === 0 ? "" : `(${comment_scores.length})`}</span>
{/* <div style={{ width:'100%',height:'75px'}} ></div> */} {/* <div style={{ width:'100%',height:'75px'}} ></div> */}
{/* true: 老师身份显示“调分”入口false: 不显示调分入口 */} {/* true: 老师身份显示“调分”入口false: 不显示调分入口 */}
{isAdmin && !allow_score && {isAdmin && !allow_score &&
<a className={"fr color-blue font-16"} onClick={()=>this.showModulationtype(this.props.task_id)}>调分</a> <a className={"fr color-blue font-16"} onClick={() => this.showModulationtype(this.props.task_id)}>调分</a>
} }
</div> } </div>}
{needNiPingEditor && <GraduationTasksappraiseMainEditor {...this.props} {needNiPingEditor && <GraduationTasksappraiseMainEditor {...this.props}
title={'评语'} title={'评语'}
@ -283,7 +279,7 @@ class CommonWorkAppraiseReply extends Component{
addSuccess={this.addSuccess} ref={this.editorRef} totalCount={comment_scores.length} addSuccess={this.addSuccess} ref={this.editorRef} totalCount={comment_scores.length}
onReply={this.onReply} placeholder={"请在此输入对本作品的评语最大限制2000个字符"} onReply={this.onReply} placeholder={"请在此输入对本作品的评语最大限制2000个字符"}
showSameScore={isGroup && isAdmin} showSameScore={isGroup && isAdmin}
></GraduationTasksappraiseMainEditor> } ></GraduationTasksappraiseMainEditor>}
</div> </div>
{/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */} {/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */}
<div className={`padding20 memoReplies commentsDelegateParent course-message`} <div className={`padding20 memoReplies commentsDelegateParent course-message`}
@ -308,9 +304,9 @@ class CommonWorkAppraiseReply extends Component{
} }
`}</style> `}</style>
{!!comment_scores.length && <div className="panel-comment_item"> {!!comment_scores.length && <div className="panel-comment_item">
{ comment_scores.map((item, index) => { {comment_scores.map((item, index) => {
return <CCommentItem item={item} onDelete={this.onDelete} {...this.props} commentIndex={index} replySuccess={this.replySuccess}></CCommentItem> return <CCommentItem item={item} onDelete={this.onDelete} {...this.props} commentIndex={index} replySuccess={this.replySuccess}></CCommentItem>
}) } })}
</div>} </div>}
</div> </div>
@ -321,4 +317,4 @@ class CommonWorkAppraiseReply extends Component{
) )
} }
} }
export default ImageLayerOfCommentHOC() (CommonWorkAppraiseReply); export default ImageLayerOfCommentHOC()(CommonWorkAppraiseReply);

@ -1,5 +1,5 @@
import React,{ Component } from "react"; import React, { Component } from "react";
import {Checkbox,Radio, Input} from "antd"; import { Checkbox, Radio, Input } from "antd";
import '../css/members.css' import '../css/members.css'
import '../css/busyWork.css' import '../css/busyWork.css'
@ -12,37 +12,36 @@ import CoursesListType from '../coursesPublic/CoursesListType';
import axios from 'axios'; import axios from 'axios';
const map={1:"单选题",2:"多选题",3:"主观题"} const map = { 1: "单选题", 2: "多选题", 3: "主观题" }
const statudmap={1:"未发布",2:"提交中",3:"已截止"} const statudmap = { 1: "未发布", 2: "提交中", 3: "已截止" }
class PollInfo extends Component{ class PollInfo extends Component {
constructor(props){ constructor(props) {
super(props); super(props);
this.state={ this.state = {
courseName:undefined, courseName: undefined,
poll:undefined, poll: undefined,
question_answered:undefined, question_answered: undefined,
question_types:undefined, question_types: undefined,
questions:undefined, questions: undefined,
inputArray:[], inputArray: [],
modalsType:false, modalsType: false,
modalsTopval:undefined, modalsTopval: undefined,
modalsBottomval:undefined, modalsBottomval: undefined,
loadtype:true, loadtype: true,
modalSave:undefined, modalSave: undefined,
questionPanelFixed:false, questionPanelFixed: false,
pollAnswerList:[] pollAnswerList: []
} }
} }
componentDidUpdate (prevProps) { componentDidUpdate(prevProps) {
// 需要等get_user_info执行完才能getInfo
if (!prevProps.current_user && this.props.current_user) { if (!prevProps.current_user && this.props.current_user) {
this.getInfo() this.getInfo()
} }
} }
componentDidMount(){ componentDidMount() {
if(this.props.current_user){ if (this.props.current_user) {
this.getInfo(); this.getInfo();
} }
@ -50,123 +49,123 @@ class PollInfo extends Component{
} }
// 滚动定位 // 滚动定位
handleScroll=()=>{ handleScroll = () => {
if(parseInt(window.scrollY)>230){ if (parseInt(window.scrollY) > 230) {
this.setState({ this.setState({
questionPanelFixed:true questionPanelFixed: true
}) })
}else{ } else {
this.setState({ this.setState({
questionPanelFixed:false questionPanelFixed: false
}) })
} }
} }
scrollToAnchor=(index)=>{ scrollToAnchor = (index) => {
let name="Anchor_"+index; let name = "Anchor_" + index;
if (index) { if (index) {
let anchorElement = document.getElementById(name); let anchorElement = document.getElementById(name);
if(anchorElement) { anchorElement.scrollIntoView(); } if (anchorElement) { anchorElement.scrollIntoView(); }
} }
} }
getInfo=()=>{ getInfo = () => {
this.setState({ this.setState({
courseName:this.props.current_user.course_name courseName: this.props.current_user.course_name
}) })
let pollId=this.props.match.params.pollId; let pollId = this.props.match.params.pollId;
let user_id=this.props.match.params.login; let user_id = this.props.match.params.login;
let url=`/polls/${pollId}/start_answer.json?login=${user_id}` let url = `/polls/${pollId}/start_answer.json?login=${user_id}`
axios.get(url).then((result)=>{ axios.get(url).then((result) => {
if(result.status==200){ if (result.status == 200) {
this.setState({ this.setState({
poll:result.data.poll, poll: result.data.poll,
question_answered:result.data.question_answered, question_answered: result.data.question_answered,
question_types:result.data.question_types, question_types: result.data.question_types,
questions:result.data.questions questions: result.data.questions
}) })
let list=[]; let list = [];
for(var i=0;i<result.data.questions.length;i++){ for (var i = 0; i < result.data.questions.length; i++) {
list.push({ list.push({
id:result.data.questions[i].question.id, id: result.data.questions[i].question.id,
text:result.data.questions[i].question.poll_vote_texts || "", text: result.data.questions[i].question.poll_vote_texts || "",
is_necessary:result.data.questions[i].question.is_necessary, is_necessary: result.data.questions[i].question.is_necessary,
answers:result.data.questions[i].question.poll_answer_ids, answers: result.data.questions[i].question.poll_answer_ids,
answersList:result.data.questions[i].question.answers answersList: result.data.questions[i].question.answers
}) })
} }
this.setState({ this.setState({
inputArray:list inputArray: list
}) })
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
} }
//选中选择题(单选题)选项保存 //选中选择题(单选题)选项保存
ChangeOptionSingle=(item)=>{ ChangeOptionSingle = (item) => {
let arr=item.target.name let arr = item.target.name
let txt=Object.assign({}, this.state.inputArray[parseInt(arr[1])]); let txt = Object.assign({}, this.state.inputArray[parseInt(arr[1])]);
let ids=item.target.value; let ids = item.target.value;
let list=txt.answersList.filter(element => element.answer_id == ids); let list = txt.answersList.filter(element => element.answer_id == ids);
this.postAnswer(arr[0],ids,list[0].answer_text=="其他"?txt.text:"",arr[1]); this.postAnswer(arr[0], ids, list[0].answer_text == "其他" ? txt.text : "", arr[1]);
} }
//选中选择题(多选题)选项保存 //选中选择题(多选题)选项保存
ChangeOptionMuntil=(a_id,q_id,key)=>{ ChangeOptionMuntil = (a_id, q_id, key) => {
let ind=Object.assign({}, this.state.inputArray[parseInt(key)]); let ind = Object.assign({}, this.state.inputArray[parseInt(key)]);
let count=0; let count = 0;
a_id.forEach(element => { a_id.forEach(element => {
let list=ind.answersList.filter(item=>item.answer_id==element); let list = ind.answersList.filter(item => item.answer_id == element);
if(list[0].answer_text=="其他"){ if (list[0].answer_text == "其他") {
count++; 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)=>{ postAnswer = (q_id, a_id, text, key) => {
let url=`/poll_questions/${q_id}/poll_votes.json`; let url = `/poll_questions/${q_id}/poll_votes.json`;
console.log(text); console.log(text);
axios.post(url,{ axios.post(url, {
poll_answer_id:a_id, poll_answer_id: a_id,
vote_text:text vote_text: text
}).then((result)=>{ }).then((result) => {
if(result){ if (result) {
const answer=Object.assign({}, this.state.question_answered[parseInt(key)]); const answer = Object.assign({}, this.state.question_answered[parseInt(key)]);
answer.ques_status=result.data.poll_vote.question_status; answer.ques_status = result.data.poll_vote.question_status;
const question_answered=this.state.question_answered; const question_answered = this.state.question_answered;
question_answered[parseInt(key)]=answer question_answered[parseInt(key)] = answer
const inputs=Object.assign({}, this.state.inputArray[parseInt(key)]); const inputs = Object.assign({}, this.state.inputArray[parseInt(key)]);
inputs.answers=a_id; inputs.answers = a_id;
const inputArray=this.state.inputArray; const inputArray = this.state.inputArray;
inputArray[parseInt(key)]=inputs; inputArray[parseInt(key)] = inputs;
this.setState({ this.setState({
question_answered, question_answered,
inputArray inputArray
}) })
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
} }
//输入其它--内容 //输入其它--内容
blurTxt=(e)=>{ blurTxt = (e) => {
let index=parseInt(e.target.name) let index = parseInt(e.target.name)
const list = Object.assign({}, this.state.inputArray[index]) const list = Object.assign({}, this.state.inputArray[index])
list.text=e.target.value; list.text = e.target.value;
const inputArray=this.state.inputArray; const inputArray = this.state.inputArray;
inputArray[index]=list inputArray[index] = list
this.setState({ this.setState({
inputArray inputArray
@ -175,49 +174,49 @@ class PollInfo extends Component{
//输入其它--内容后重新保存 //输入其它--内容后重新保存
saveInputAndAnswer=(e,a_id,q_id,key,type)=>{ saveInputAndAnswer = (e, a_id, q_id, key, type) => {
const inputs=Object.assign({}, this.state.inputArray[parseInt(key)]); const inputs = Object.assign({}, this.state.inputArray[parseInt(key)]);
let answers=inputs.answers; let answers = inputs.answers;
let flag=true; let flag = true;
if(answers.length){ if (answers.length) {
flag=answers.indexOf(a_id) > -1?true:false; flag = answers.indexOf(a_id) > -1 ? true : false;
answers= type == 1 ? answers[0] : answers; answers = type == 1 ? answers[0] : answers;
}else{ } else {
flag = answers==a_id?true:false; flag = answers == a_id ? true : false;
} }
if(answers && (answers.length>0 || answers !="")){ if (answers && (answers.length > 0 || answers != "")) {
this.postAnswer(q_id,answers,flag ? inputs.text : "",key); 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; const text = Object.assign({}, this.state.inputArray[key]).text;
let url='/poll_questions/'+q_id+'/poll_votes.json?'; let url = '/poll_questions/' + q_id + '/poll_votes.json?';
const ans=Object.assign({}, this.state.question_answered[key]); const ans = Object.assign({}, this.state.question_answered[key]);
ans.ques_status=text ? 1 : 0 ; ans.ques_status = text ? 1 : 0;
const questionAnswered=this.state.question_answered; const questionAnswered = this.state.question_answered;
questionAnswered[key]=ans questionAnswered[key] = ans
this.setState({ this.setState({
question_answered:questionAnswered question_answered: questionAnswered
}) })
if(text!=undefined){ if (text != undefined) {
axios.post((url),{ axios.post((url), {
vote_text:text vote_text: text
}).then((result)=>{ }).then((result) => {
if(result.status==200){ if (result.status == 200) {
const answer=Object.assign({}, this.state.question_answered[key]); const answer = Object.assign({}, this.state.question_answered[key]);
answer.ques_status=result.data.poll_vote.question_status; answer.ques_status = result.data.poll_vote.question_status;
const question_answered=this.state.question_answered; const question_answered = this.state.question_answered;
question_answered[key]=answer question_answered[key] = answer
this.setState({ this.setState({
question_answered question_answered
}) })
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
} }
@ -225,71 +224,71 @@ class PollInfo extends Component{
} }
// 提交 // 提交
submitPoll=()=>{ submitPoll = () => {
let {inputArray,question_answered}=this.state; let { inputArray, question_answered } = this.state;
let must=0; let must = 0;
let may=0; let may = 0;
for(var j=0;j<question_answered.length;j++){ for (var j = 0; j < question_answered.length; j++) {
if(question_answered[j].ques_status==0){ if (question_answered[j].ques_status == 0) {
if(inputArray[j].is_necessary==1){ if (inputArray[j].is_necessary == 1) {
must++; must++;
}else{ } else {
may++; may++;
} }
} }
} }
if(must>0){ if (must > 0) {
this.setState({ this.setState({
modalsType:true, modalsType: true,
modalsTopval:"有 "+must+" 题必答题未答,无法提交 ", modalsTopval: "有 " + must + " 题必答题未答,无法提交 ",
modalsBottomval:"请完成全部必答题后再提交", modalsBottomval: "请完成全部必答题后再提交",
loadtype:true, loadtype: true,
modalSave:this.cancelSubmit modalSave: this.cancelSubmit
}) })
return; return;
} }
if(may >= 0){ if (may >= 0) {
this.setState({ this.setState({
modalsType:true, modalsType: true,
modalsTopval: may>0 ? "有 "+may+" 题未答":"", modalsTopval: may > 0 ? "有 " + may + " 题未答" : "",
modalsBottomval:"提交后无法再修改答题,是否确认提交?", modalsBottomval: "提交后无法再修改答题,是否确认提交?",
loadtype:false, loadtype: false,
modalSave:this.sureSubmit modalSave: this.sureSubmit
}) })
} }
} }
cancelSubmit=()=>{ cancelSubmit = () => {
this.setState({ this.setState({
modalsType:false, modalsType: false,
modalsTopval:"", modalsTopval: "",
modalsBottomval:"" modalsBottomval: ""
}) })
} }
sureSubmit=()=>{ sureSubmit = () => {
let pollId=this.props.match.params.pollId; let pollId = this.props.match.params.pollId;
let url=`/polls/${pollId}/commit_poll.json` let url = `/polls/${pollId}/commit_poll.json`
axios.post(url).then((result)=>{ axios.post(url).then((result) => {
if(result.status == 200){ if (result.status == 200) {
this.props.showNotification(result.data.message) this.props.showNotification(result.data.message)
this.setState({ this.setState({
modalsType:false, modalsType: false,
modalsTopval:"", modalsTopval: "",
modalsBottomval:"" 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); console.log(error);
}) })
} }
render(){ render() {
let coursesId=this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let{poll,question_answered,question_types,questions,courseName, let { poll, question_answered, question_types, questions, courseName,
inputArray, inputArray,
modalsType, modalsType,
modalsTopval, modalsTopval,
@ -297,13 +296,13 @@ class PollInfo extends Component{
modalsBottomval, modalsBottomval,
modalSave, modalSave,
questionPanelFixed questionPanelFixed
}=this.state; } = this.state;
const { current_user } = this.props const { current_user } = this.props
let isAdmin=this.props.isAdmin(); let isAdmin = this.props.isAdmin();
let isStudent=this.props.isStudent(); let isStudent = this.props.isStudent();
document.title=courseName&&courseName; document.title = courseName && courseName;
return( return (
<div className="newMain" style={{paddingTop:"0px"}}> <div className="newMain" style={{ paddingTop: "0px" }}>
{/*<p style={{height:"60px"}}></p>*/} {/*<p style={{height:"60px"}}></p>*/}
<Modals <Modals
modalsType={modalsType} modalsType={modalsType}
@ -320,19 +319,19 @@ class PollInfo extends Component{
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/polls/${poll && poll.left_banner_id}`}>问卷</WordsBtn> <WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/polls/${poll && poll.left_banner_id}`}>问卷</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" to={`/courses/${coursesId}/polls/${this.props.match.params.pollId}/detail`} className="fl mr3">问卷详情</WordsBtn>&gt; <WordsBtn style="grey" to={`/courses/${coursesId}/polls/${this.props.match.params.pollId}/detail`} className="fl mr3">问卷详情</WordsBtn>&gt;
<span className="ml3">{question_types&&question_types.user_name}</span> <span className="ml3">{question_types && question_types.user_name}</span>
</p> </p>
<p className="clearfix mb20"> <p className="clearfix mb20">
<span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"30px"}}>{poll && poll.polls_name}</span> <span className="color-grey-3 font-24 fl task-hide break-word" style={{ maxWidth: "900px", lineHeight: "30px" }}>{poll && poll.polls_name}</span>
<CoursesListType typelist={[`${statudmap[poll && poll.poll_status]}`]} typesylename={""} /> <CoursesListType typelist={[`${statudmap[poll && poll.poll_status]}`]} typesylename={""} />
{ {
isAdmin || (poll && poll.user_poll_status == 1) ? <WordsBtn className="fr font-16 mt5" style="grey" to={`/courses/${coursesId}/polls/${this.props.match.params.pollId}/detail`}>返回</WordsBtn> :'' isAdmin || (poll && poll.user_poll_status == 1) ? <WordsBtn className="fr font-16 mt5" style="grey" to={`/courses/${coursesId}/polls/${this.props.match.params.pollId}/detail`}>返回</WordsBtn> : ''
} }
</p> </p>
{ {
poll && poll.polls_description && poll && poll.polls_description &&
<p style={{backgroundColor:"#F2F9FF",whiteSpace:"pre-wrap"}} className="color-blue pl30 pr30 pt15 pb15">{poll.polls_description}</p> <p style={{ backgroundColor: "#F2F9FF", whiteSpace: "pre-wrap" }} className="color-blue pl30 pr30 pt15 pb15">{poll.polls_description}</p>
} }
<div className="edu-back-white"> <div className="edu-back-white">
<p className="padding20-30 bor-bottom-greyE"> <p className="padding20-30 bor-bottom-greyE">
@ -346,15 +345,15 @@ class PollInfo extends Component{
} }
{ {
question_types && question_types.q_doubles > 0 && question_types && question_types.q_doubles > 0 &&
<span className="color-grey-9 mr15">多选题{ question_types && question_types.q_doubles }</span> <span className="color-grey-9 mr15">多选题{question_types && question_types.q_doubles}</span>
} }
{ {
question_types && question_types.q_mains > 0 && question_types && question_types.q_mains > 0 &&
<span className="color-grey-9">主观题{question_types &&question_types.q_mains}</span> <span className="color-grey-9">主观题{question_types && question_types.q_mains}</span>
} }
</p> </p>
<div className={ questionPanelFixed==true ? "questionsfixed":"questionsNo"}> <div className={questionPanelFixed == true ? "questionsfixed" : "questionsNo"}>
<p className="clearfix pl20"> <p className="clearfix pl20">
<span className="mr40 answered">已答</span> <span className="mr40 answered">已答</span>
<span className="unanswer">未答</span> <span className="unanswer">未答</span>
@ -362,11 +361,11 @@ class PollInfo extends Component{
</p> </p>
<ul className="clearfix leaderNav"> <ul className="clearfix leaderNav">
{ {
question_answered && question_answered.map((item,key)=>{ question_answered && question_answered.map((item, key) => {
return( return (
<React.Fragment> <React.Fragment>
{ {
<a className={item.ques_status==1? "acted" : ""} onClick={()=>this.scrollToAnchor(`${key}`)}>{item.ques_number}</a> <a className={item.ques_status == 1 ? "acted" : ""} onClick={() => this.scrollToAnchor(`${key}`)}>{item.ques_number}</a>
} }
</React.Fragment> </React.Fragment>
) )
@ -377,19 +376,19 @@ class PollInfo extends Component{
<div> <div>
{ {
questions && questions.map((item,key)=>{ questions && questions.map((item, key) => {
return( return (
<div className="previewList" id={'Anchor_'+`${key}`}> <div className="previewList" id={'Anchor_' + `${key}`}>
<div className="pl30 pr30 mt30 mb10 clearfix"> <div className="pl30 pr30 mt30 mb10 clearfix">
<span className="color-blue fl font-16">{item.question.question_number}{map[item.question.question_type]}</span> <span className="color-blue fl font-16">{item.question.question_number}{map[item.question.question_type]}</span>
{ item.question.is_necessary==1 ? <span className="mustAnswer fl ml10 mr10 mt5">必答</span>:<span className="mustAnswer fl ml10 mr10 mt5"></span> } {item.question.is_necessary == 1 ? <span className="mustAnswer fl ml10 mr10 mt5">必答</span> : <span className="mustAnswer fl ml10 mr10 mt5"></span>}
{ item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ? {item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ?
<span className="color-grey-9 font-14 fl mt2"> <span className="color-grey-9 font-14 fl mt2">
{ {
item.question.min_choices == item.question.max_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 + "项"
} }
</span>:"" </span> : ""
} }
</div> </div>
<p className="pl30 pr30 mb10 "><span className="font-14 flex1" style={{ <p className="pl30 pr30 mb10 "><span className="font-14 flex1" style={{
@ -399,26 +398,26 @@ class PollInfo extends Component{
}}>{item.question.question_title}</span></p> }}>{item.question.question_title}</span></p>
{ {
//单选 //单选
item.question.question_type==1 && item.question.question_type == 1 &&
<Radio.Group disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1)?true:false} className="answerList" defaultValue={item.question.poll_answer_ids[0]} name={[item.question.id,key]} onChange={this.ChangeOptionSingle}> <Radio.Group disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1) ? true : false} className="answerList" defaultValue={item.question.poll_answer_ids[0]} name={[item.question.id, key]} onChange={this.ChangeOptionSingle}>
{ {
item.question.answers && item.question.answers.map((i,k)=>{ item.question.answers && item.question.answers.map((i, k) => {
return( return (
<li className={i.answer_text=="其他"?"df clearfix":"clearfix"}> <li className={i.answer_text == "其他" ? "df clearfix" : "clearfix"}>
<Radio name={[item.question.id,key]} className="fl" value={i.answer_id} ></Radio> <Radio name={[item.question.id, key]} className="fl" value={i.answer_id} ></Radio>
<span className="break-word fl" style={{maxWidth:"1116px"}}>{i.answer_text}</span> <span className="break-word fl" style={{ maxWidth: "1116px" }}>{i.answer_text}</span>
{ {
i.answer_text=="其他" ? i.answer_text == "其他" ?
<React.Fragment> <React.Fragment>
{ {
inputArray && inputArray.map((j,k)=>{ inputArray && inputArray.map((j, k) => {
return( return (
<React.Fragment> <React.Fragment>
{ {
j.id == item.question.id ? j.id == item.question.id ?
<Input type="text" className="otherTxt" autoComplete="off" value={j.text && j.text} name={key} <Input type="text" className="otherTxt" autoComplete="off" value={j.text && j.text} name={key}
onInput={this.blurTxt} onInput={this.blurTxt}
onBlur={(e)=>this.saveInputAndAnswer(e,i.answer_id,item.question.id,key,item.question.question_type)} onBlur={(e) => this.saveInputAndAnswer(e, i.answer_id, item.question.id, key, item.question.question_type)}
/> />
: "" : ""
} }
@ -437,31 +436,31 @@ class PollInfo extends Component{
} }
{ {
//多选 //多选
item.question.question_type==2 && item.question.question_type == 2 &&
<Checkbox.Group <Checkbox.Group
onChange={(value)=>this.ChangeOptionMuntil(value,item.question.id,key)} onChange={(value) => this.ChangeOptionMuntil(value, item.question.id, key)}
disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1)?true:false} disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1) ? true : false}
defaultValue={item.question.poll_answer_ids} defaultValue={item.question.poll_answer_ids}
className="answerList" className="answerList"
name={key}> name={key}>
{ {
item.question.answers && item.question.answers.map((i,k)=>{ item.question.answers && item.question.answers.map((i, k) => {
return( return (
<li className={i.answer_text=="其他"?"df clearfix":"clearfix"}> <li className={i.answer_text == "其他" ? "df clearfix" : "clearfix"}>
<Checkbox className="fl mr8" value={i.answer_id} key={i.answer_id}></Checkbox> <Checkbox className="fl mr8" value={i.answer_id} key={i.answer_id}></Checkbox>
<span className="break-word fl" style={{maxWidth:"1116px"}}>{i.answer_text}</span> <span className="break-word fl" style={{ maxWidth: "1116px" }}>{i.answer_text}</span>
{ {
i.answer_text=="其他"? i.answer_text == "其他" ?
<React.Fragment> <React.Fragment>
{ {
inputArray && inputArray.map((j,k)=>{ inputArray && inputArray.map((j, k) => {
return( return (
<React.Fragment> <React.Fragment>
{ {
j.id == item.question.id ? j.id == item.question.id ?
<Input type="text" className="otherTxt" autoComplete="off" value={j.text && j.text} name={key} <Input type="text" className="otherTxt" autoComplete="off" value={j.text && j.text} name={key}
onInput={this.blurTxt} onInput={this.blurTxt}
onBlur={(e)=>this.saveInputAndAnswer(e,i.answer_id,item.question.id,key,item.question.question_type)} onBlur={(e) => this.saveInputAndAnswer(e, i.answer_id, item.question.id, key, item.question.question_type)}
/> />
: "" : ""
} }
@ -470,7 +469,7 @@ class PollInfo extends Component{
}) })
} }
</React.Fragment> </React.Fragment>
:"" : ""
} }
</li> </li>
) )
@ -480,15 +479,15 @@ class PollInfo extends Component{
} }
{ {
//主观题 //主观题
item.question.question_type==3 && item.question.question_type == 3 &&
<div className="mt10 pl30 pr30 pb20"> <div className="mt10 pl30 pr30 pb20">
{ {
inputArray && inputArray.map((j,k)=>{ inputArray && inputArray.map((j, k) => {
return( return (
<React.Fragment> <React.Fragment>
{ {
j.id == item.question.id ? j.id == item.question.id ?
<textarea placeholder="在此填入答案" disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1) ? true:false} value={j.text && j.text} className="winput-100-130" name={key} onInput={this.blurTxt} onBlur={()=>this.commitText(key,item.question.id)}></textarea> <textarea placeholder="在此填入答案" disabled={isAdmin || (isStudent && poll && poll.user_poll_status == 1) ? true : false} value={j.text && j.text} className="winput-100-130" name={key} onInput={this.blurTxt} onBlur={() => this.commitText(key, item.question.id)}></textarea>
: "" : ""
} }
</React.Fragment> </React.Fragment>
@ -509,7 +508,7 @@ class PollInfo extends Component{
<div className="mt30 mb50"> <div className="mt30 mb50">
<a type="primary" className="defalutSubmitbtn" onClick={this.submitPoll}>提交</a> <a type="primary" className="defalutSubmitbtn" onClick={this.submitPoll}>提交</a>
</div> </div>
:"" : ""
} }
</div> </div>
</div> </div>

@ -134,43 +134,6 @@ class LoginDialog extends Component {
Phonenumberisnotco: undefined, 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) => { Emailphonenumberverification = (value, id) => {
@ -388,49 +351,9 @@ class LoginDialog extends Component {
} }
return response; return response;
}, (error) => { }, (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( $('<link rel="stylesheet" type="text/css" />')
// // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) );
// // $('head').append( $('<link rel="stylesheet" type="text/css" />')
// // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) );
// // }
// // }
// // return Promise.reject(error);
}); });
} }
handleDialogClose = () => { 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({ this.setState({
isRender: false isRender: false
@ -438,14 +361,6 @@ class LoginDialog extends Component {
this.props.Modifyloginvalue(); this.props.Modifyloginvalue();
// this.setState({
// isRender: false
// })
// try {
// this.props.Modifyloginvalue();
// }catch (e) {
//
// }
} }
loginEDU = () => { loginEDU = () => {
@ -464,7 +379,6 @@ class LoginDialog extends Component {
autologin: isGoingValue autologin: isGoingValue
} }
).then((response) => { ).then((response) => {
debugger;
if (response === undefined) { if (response === undefined) {
return return
} }

@ -59,8 +59,6 @@ class Trialapplicationysl extends Component {
} }
getipthon = () => { getipthon = () => {
// console.log("Trialapplicationysl");
// console.log("70");
let url = `/users/get_user_info.json` let url = `/users/get_user_info.json`
axios.get(url).then((result) => { axios.get(url).then((result) => {
console.log(result); console.log(result);

@ -1,10 +1,10 @@
import React, {Component} from 'react'; import React, { Component } from 'react';
import { import {
Spin, Spin,
Pagination, Pagination,
} from "antd"; } from "antd";
import axios from 'axios'; import axios from 'axios';
import {getImageUrl, markdownToHTML} from 'educoder'; import { getImageUrl, markdownToHTML } from 'educoder';
import "../css/messagemy.css" import "../css/messagemy.css"
import NoneData from '../../../modules/courses/coursesPublic/NoneData' import NoneData from '../../../modules/courses/coursesPublic/NoneData'
//消息页面 //消息页面
@ -48,7 +48,7 @@ class MessagSub extends Component {
this.setState({ this.setState({
isSpin: true, isSpin: true,
}) })
let {limit} = this.state; let { limit } = this.state;
let url = `/users/tidings.json`; let url = `/users/tidings.json`;
axios.get((url), { axios.get((url), {
params: { params: {
@ -80,7 +80,7 @@ class MessagSub extends Component {
this.setState({ this.setState({
isSpin: true, isSpin: true,
}) })
let {typeysl, page, limit} = this.state; let { typeysl, page, limit } = this.state;
let url = `/users/tidings.json`; let url = `/users/tidings.json`;
axios.get((url), { axios.get((url), {
params: { params: {
@ -118,7 +118,7 @@ class MessagSub extends Component {
gettourl = (item) => { gettourl = (item) => {
switch (item.container_type) { switch (item.container_type) {
case "ApplyUserAuthentication" : case "ApplyUserAuthentication":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
if (item.auth_type === 1) { if (item.auth_type === 1) {
//系统管理页面 //系统管理页面
@ -134,13 +134,13 @@ class MessagSub extends Component {
return window.open("/account/certification") return window.open("/account/certification")
} }
return; return;
case "CancelUserAuthentication" : case "CancelUserAuthentication":
// 账号管理页-认证信息 // 账号管理页-认证信息
return window.open("/account/certification") return window.open("/account/certification")
case "CancelUserProCertification" : case "CancelUserProCertification":
// 账号管理页-认证信息 // 账号管理页-认证信息
return window.open("/account/certification") return window.open("/account/certification")
case "ApplyAddDepartment" : case "ApplyAddDepartment":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
//部门审批 //部门审批
return window.open("/admins/department_applies") return window.open("/admins/department_applies")
@ -150,7 +150,7 @@ class MessagSub extends Component {
return window.open("/account/profile") return window.open("/account/profile")
} }
return; return;
case "ApplyAddSchools" : case "ApplyAddSchools":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
// 单位审批 // 单位审批
return window.open("/admins/unit_applies") return window.open("/admins/unit_applies")
@ -160,9 +160,9 @@ class MessagSub extends Component {
return window.open("/account/profile") return window.open("/account/profile")
} }
return; return;
case "ApplyAction" : case "ApplyAction":
switch (item.parent_container_type) { switch (item.parent_container_type) {
case "ApplyShixun" : case "ApplyShixun":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
return window.open("/admins/shixun_authorizations") return window.open("/admins/shixun_authorizations")
} }
@ -170,7 +170,7 @@ class MessagSub extends Component {
// 实训详情页 :identifier = identifier // 实训详情页 :identifier = identifier
return window.open(`/shixuns/${item.identifier}/challenges`) return window.open(`/shixuns/${item.identifier}/challenges`)
} }
case "ApplySubject" : case "ApplySubject":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
// 实训课程发布 // 实训课程发布
return window.open("/admins/subject_authorizations") return window.open("/admins/subject_authorizations")
@ -180,7 +180,7 @@ class MessagSub extends Component {
return window.open(`/paths/${item.parent_container_id}`) return window.open(`/paths/${item.parent_container_id}`)
} }
case "TrialAuthorization" : case "TrialAuthorization":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
// 试用授权页面 // 试用授权页面
return window.open("/managements/trial_authorization") return window.open("/managements/trial_authorization")
@ -191,7 +191,7 @@ class MessagSub extends Component {
} }
} }
return; return;
case 'JoinCourse' : case 'JoinCourse':
// 课堂详情页 :id = // 课堂详情页 :id =
return window.open(`/courses/${item.belong_container_id}/teachers`) return window.open(`/courses/${item.belong_container_id}/teachers`)
case 'StudentJoinCourse': case 'StudentJoinCourse':
@ -209,28 +209,28 @@ class MessagSub extends Component {
case 'TeacherJoinCourse': case 'TeacherJoinCourse':
// 课堂详情页 :id = container_id // 课堂详情页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`)
case 'Course' : case 'Course':
// 课堂详情页 :id = container_id // 课堂详情页 :id = container_id
if (item.tiding_type === "Delete") { if (item.tiding_type === "Delete") {
return; return;
} }
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`) return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.container_id}`)
case 'ArchiveCourse' : case 'ArchiveCourse':
// 课堂详情页 :id = container_id // 课堂详情页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.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`) return window.open(`/shixuns/${item.identifier}/challenges`)
case "Subject" : case "Subject":
// 课程汇总详情页 :id = container_id // 课程汇总详情页 :id = container_id
return window.open(`/paths/${item.container_id}`) return window.open(`/paths/${item.container_id}`)
case "JournalsForMessage" : case "JournalsForMessage":
switch (item.parent_container_type) { switch (item.parent_container_type) {
case "Principal" : case "Principal":
// 反馈页 :id = parent_container_id // 反馈页 :id = parent_container_id
// 不用跳了 // 不用跳了
return ''; return '';
case "HomeworkCommon" : case "HomeworkCommon":
//学生作业页 homework = parent_container_id //学生作业页 homework = parent_container_id
if (item.homework_type === "normal") { 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 window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=1`)
} }
return ""; return "";
case "GraduationTopic" : case "GraduationTopic":
// 毕业目标页 parent_container_id // 毕业目标页 parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`)
case "StudentWorksScore" : case "StudentWorksScore":
//学生作业页 //学生作业页
if (item.homework_type === "normal") { if (item.homework_type === "normal") {
//普通作业 //普通作业
@ -264,23 +264,23 @@ class MessagSub extends Component {
} }
return ""; return "";
} }
case "Memo" : case "Memo":
// 交流问答页 :id = parent_container_id // 交流问答页 :id = parent_container_id
return window.open(`/forums/${item.parent_container_id}`); return window.open(`/forums/${item.parent_container_id}`);
case "Message" : case "Message":
// 交流问答页 :id = parent_container_id // 交流问答页 :id = parent_container_id
return window.open(`/forums/`); return window.open(`/forums/`);
case "Watcher" : case "Watcher":
// 用户个人中心页 :id = item.trigger_user.login // 用户个人中心页 :id = item.trigger_user.login
return window.open(`/users/${item.trigger_user.login}/courses`) return window.open(`/users/${item.trigger_user.login}/courses`)
case "PraiseTread" : case "PraiseTread":
// 这块太复杂 不好处理 // 这块太复杂 不好处理
return ''; return '';
case "Grade" : case "Grade":
//个人中心页 :id = item.trigger_user.login //个人中心页 :id = item.trigger_user.login
// return window.open(`/users/${item.trigger_user.login}/courses`; // return window.open(`/users/${item.trigger_user.login}/courses`;
return ""; return "";
case "JoinProject" : case "JoinProject":
//项目详情-申请加入项目审核页 :id = container_id //项目详情-申请加入项目审核页 :id = container_id
return window.open(`/projects/${item.container_id}`) return window.open(`/projects/${item.container_id}`)
case 'ReporterJoinProject': case 'ReporterJoinProject':
@ -294,15 +294,15 @@ class MessagSub extends Component {
return window.open(`/projects/${item.container_id}`) return window.open(`/projects/${item.container_id}`)
case "Poll": case "Poll":
switch (item.parent_container_type) { switch (item.parent_container_type) {
case "CommitPoll" : case "CommitPoll":
// 课堂id belong_container_id // 课堂id belong_container_id
//课堂-学生已提交问卷列表 :id = container_id //课堂-学生已提交问卷列表 :id = container_id
return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`) return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`)
default : default:
// 课堂-问卷列表 :id = container_id // 课堂-问卷列表 :id = container_id
return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`) return window.open(` /courses/${item.belong_container_id}/polls/${item.container_id}`)
} }
case "Exercise" : case "Exercise":
switch (item.parent_container_type) { switch (item.parent_container_type) {
case "CommitExercise": case "CommitExercise":
// 课堂-学生试卷详情 :id = container_id :user_id = trigger_user.id // 课堂-学生试卷详情 :id = container_id :user_id = trigger_user.id
@ -312,28 +312,28 @@ class MessagSub extends Component {
// 课堂-学生试卷详情 :id = container_id :user_id = trigger_user.id // 课堂-学生试卷详情 :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`); return window.open(` /courses/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`);
//记得跳评阅页面 //记得跳评阅页面
default : default:
// 课堂-试卷列表详情 :id = container_id // 课堂-试卷列表详情 :id = container_id
return window.open(`/courses/${item.belong_container_id}/exercises/${item.container_id}/student_exercise_list?tab=0`); 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 //课堂-毕业选题详情 :id = parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`)
case 'DealStudentTopicSelect' : case 'DealStudentTopicSelect':
//课堂-毕业选题详情 :id = parent_container_id //课堂-毕业选题详情 :id = parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`) return window.open(`/courses/${item.belong_container_id}/graduation_topics/${item.parent_container_id}/detail`)
case 'GraduationTask' : case 'GraduationTask':
//课堂-毕业任务页 :id = container_id //课堂-毕业任务页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`) return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`)
case "GraduationWork" : case "GraduationWork":
//课堂-毕业xx页 :id = container_id //课堂-毕业xx页 :id = container_id
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`) return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}`)
case "GraduationWorkScore" : case "GraduationWorkScore":
// 课堂-毕业xx页 :id = parent_container_id // 课堂-毕业xx页 :id = parent_container_id
return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.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) { switch (item.parent_container_type) {
case "AnonymousCommentFail" : case "AnonymousCommentFail":
// 课堂-作业列表 homework = container_id // 课堂-作业列表 homework = container_id
if (item.homework_type === "normal") { 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`) 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") { if (item.homework_type === "normal") {
//普通作业 //普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) 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`) 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") { if (item.homework_type === "normal") {
//普通作业 //普通作业
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/list`) 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`) return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
} }
default : default:
// 课堂-作业列表 homework = container_id // 课堂-作业列表 homework = container_id
if (item.homework_type === "normal") { 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`) return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
} }
} }
case "StudentWork" : case "StudentWork":
//课堂-作业 :id = container_id //课堂-作业 :id = container_id
if (item.homework_type === "normal") { 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`) return window.open(`/courses/${item.belong_container_id}/shixun_homeworks/${item.parent_container_id}/list?tab=0`)
} }
case "StudentWorksScore" : 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`)
// }
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`);
case "StudentWorksScoresAppeal" : 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`)
// }
return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`); return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.trigger_user.id}/${item.parent_container_id}/appraise`);
case "ChallengeWorkScore" : case "ChallengeWorkScore":
return ''; return '';
case "SendMessage" : case "SendMessage":
// /managements/mirror_repository // /managements/mirror_repository
return window.open(`/managements/mirror_repository`) return window.open(`/managements/mirror_repository`)
case "Journal" : case "Journal":
//项目Issue页 :id = parent_container_id //项目Issue页 :id = parent_container_id
return window.open(`/issues/${item.parent_container_id}`); return window.open(`/issues/${item.parent_container_id}`);
case "Issue" : case "Issue":
//项目Issue页 :id = container_id //项目Issue页 :id = container_id
return window.open(`/issues/${item.container_id}`) return window.open(`/issues/${item.container_id}`)
case "PullRequest" : case "PullRequest":
// 项目pull request页 :id = parent_container_id // 项目pull request页 :id = parent_container_id
return window.open(`/projects/${item.parent_container_id}/pull_requests`) return window.open(`/projects/${item.parent_container_id}/pull_requests`)
case "Department" : case "Department":
//账号管理页 //账号管理页
return window.open(`/account/profile`) return window.open(`/account/profile`)
case "Library" : case "Library":
if (item.tiding_type === 'Apply') { if (item.tiding_type === 'Apply') {
// /managements/library_applies // /managements/library_applies
return window.open(`/admins/library_applies`) return window.open(`/admins/library_applies`)
@ -458,7 +433,7 @@ class MessagSub extends Component {
//教学案例详情 :id = container_id //教学案例详情 :id = container_id
return window.open(`/moop_cases/${item.container_id}`) return window.open(`/moop_cases/${item.container_id}`)
} }
case "ProjectPackage" : case "ProjectPackage":
if (item.tiding_type === "Destroyed") { if (item.tiding_type === "Destroyed") {
return; return;
} }
@ -516,14 +491,14 @@ class MessagSub extends Component {
if (item.extra && item.parent_container_type !== 'HackDelete') { if (item.extra && item.parent_container_type !== 'HackDelete') {
return window.open(`/problems/${item.extra}/edit`); return window.open(`/problems/${item.extra}/edit`);
} }
default : default:
return return
} }
} }
render() { render() {
let {page, limit, typeysl, count, isSpin, data} = this.state; let { page, limit, typeysl, count, isSpin, data } = this.state;
// console.log("6868686868"); // console.log("6868686868");
console.log(data); console.log(data);
return ( return (
@ -615,7 +590,7 @@ class MessagSub extends Component {
onClick={() => this.gettourl(item)}> onClick={() => this.gettourl(item)}>
<img onMouseDown={() => this.myCome(item)} <img onMouseDown={() => this.myCome(item)}
src={getImageUrl("images/" + item.trigger_user.image_url)} src={getImageUrl("images/" + item.trigger_user.image_url)}
className="radius mr10 fl myimgw48 myimgh48"/> className="radius mr10 fl myimgw48 myimgh48" />
<div className="fl flex1"> <div className="fl flex1">
<p> <p>
<a className="mr20 private_message_a" <a className="mr20 private_message_a"
@ -639,8 +614,8 @@ class MessagSub extends Component {
` `
} }
</style> </style>
<p className="color-grey-6 yslspansk markdown-body mt10" style={{wordBreak: "break-word"}} <p className="color-grey-6 yslspansk markdown-body mt10" style={{ wordBreak: "break-word" }}
dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}}></p> dangerouslySetInnerHTML={{ __html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁") }}></p>
</div> </div>
<span className={item.new_tiding === true ? "new-point fr mr40 mt22" : ""}></span> <span className={item.new_tiding === true ? "new-point fr mr40 mt22" : ""}></span>
@ -655,7 +630,7 @@ class MessagSub extends Component {
{data === undefined ? "" {data === undefined ? ""
: :
(count > 10 ? (count > 10 ?
<div style={{textAlign: "center"}} className="new_expand mt10"> <div style={{ textAlign: "center" }} className="new_expand mt10">
<div className="edu-txt-center mt30"> <div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page} <Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit} onChange={this.paginationonChanges} pageSize={limit}

File diff suppressed because it is too large Load Diff

@ -1,39 +1,29 @@
import React, { Component } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import NewHeader from './NewHeader' import NewHeader from './NewHeader'
import NewFooter from './NewFooter' import NewFooter from './NewFooter'
import SiderBar from './SiderBar' import SiderBar from './SiderBar'
import { getUrl, downloadFile } from 'educoder' import { downloadFile } from 'educoder'
import axios from 'axios'; import axios from 'axios';
import { Spin } from 'antd'; import { Spin } from 'antd';
import './TPMIndex.css'; import './TPMIndex.css';
import LoginDialog from '../login/LoginDialog'; import LoginDialog from '../login/LoginDialog';
import AccountProfile from '../user/AccountProfile'; import AccountProfile from '../user/AccountProfile';
import AccountPhoneemail from '../user/AccountPhoneemail'; 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 $ = window.$;
const versionNum = '0001'; const versionNum = '0001';
// let _url_origin = getUrl()
let _url_origin = ''; let _url_origin = '';
if (window.location.port === "3007") { if (window.location.port === "3007") {
_url_origin = "https://test-newweb.educoder.net"; _url_origin = "https://test-newweb.educoder.net";
} }
// let _url_origin=`https://www.educoder.net`;
if (!window['indexHOCLoaded']) { if (!window['indexHOCLoaded']) {
window.indexHOCLoaded = true; window.indexHOCLoaded = true;
//解决首屏加载问题 //解决首屏加载问题
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />') $('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?3`)); .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?3`));
@ -44,25 +34,7 @@ if (!window['indexHOCLoaded']) {
$('head').append($('<link rel="stylesheet" type="text/css" />') $('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?3`)); .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?3`));
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/css_min_all.css?1525440977`));
// 加timeout 为了覆盖掉antd的样式
// setTimeout(() => {
// $('head').append( $('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/css/edu-common.css?1525440977`) );
// $('head').append( $('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?1525440977`) );
// $('head').append( $('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?1525440977`) );
// }, 1000);
$("script").append('<script></script>')
.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其他页面一致 // TODO css加载完成后再打开页面行为和tpm其他页面一致
export function TPMIndexHOC(WrappedComponent) { export function TPMIndexHOC(WrappedComponent) {
// 这里如果extends WrappedComponent 会出现 WrappedComponent mount twice的问题 // 这里如果extends WrappedComponent 会出现 WrappedComponent mount twice的问题
@ -90,7 +62,6 @@ export function TPMIndexHOC(WrappedComponent) {
// header里面需要有user // header里面需要有user
initCommonState(user) { initCommonState(user) {
// 更新头像后,需要改变参数,不然会被图片缓存影响到 --> 后台已加 ?t=${new Date().getTime()
const newUser = Object.assign({}, { ...user }, { image_url: `${user.image_url}` }); const newUser = Object.assign({}, { ...user }, { image_url: `${user.image_url}` });
this.setState({ this.setState({
user: newUser, user: newUser,
@ -128,7 +99,6 @@ export function TPMIndexHOC(WrappedComponent) {
.then((response) => { .then((response) => {
const status = response.data.status; const status = response.data.status;
if (status == 1) { if (status == 1) {
const new_author_info = Object.assign({}, creator)
this.setState({ this.setState({
watched: !watched watched: !watched
}) })
@ -148,8 +118,6 @@ export function TPMIndexHOC(WrappedComponent) {
} }
componentDidMount() { componentDidMount() {
// console.log("TPMIndexHOC========");
// console.log(this.props);
window.addEventListener('keyup', this.keyupListener) window.addEventListener('keyup', this.keyupListener)
if (this.props.match.path === "/") { if (this.props.match.path === "/") {
@ -166,28 +134,6 @@ export function TPMIndexHOC(WrappedComponent) {
document.title = "翻转课堂"; 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({ $.ajaxSetup({
cache: true cache: true
}); });
@ -216,7 +162,7 @@ export function TPMIndexHOC(WrappedComponent) {
dataquerys: {}, dataquerys: {},
}) })
} }
this.fetchUsers(dataqueryss); this.fetchUser(dataqueryss);
let url = `/users/get_navigation_info.json`; let url = `/users/get_navigation_info.json`;
axios.get(url, { axios.get(url, {
@ -462,71 +408,6 @@ export function TPMIndexHOC(WrappedComponent) {
console.log(error) 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 数据的 //截取url 数据的
foo = (url) => { foo = (url) => {
var json = {}; var json = {};
@ -534,12 +415,9 @@ export function TPMIndexHOC(WrappedComponent) {
var arr; var arr;
do { do {
arr = regExp.exec(url); arr = regExp.exec(url);
// console.log(arr); // arr = [完整的字符串, key, 等号或'', value或'']
if (arr) { if (arr) {
var key = arr[1]; var key = arr[1];
var value = arr[3]; var value = arr[3];
// arr[2] === ''时, value = undefined
if (!arr[2]) if (!arr[2])
value = undefined; value = undefined;

@ -1,6 +1,6 @@
import React, {Component} from 'react'; import React, { Component } from 'react';
import {Button,notification} from 'antd'; import { Button, notification } from 'antd';
import {broadcastChannelPostMessage} from 'educoder'; import { broadcastChannelPostMessage } from 'educoder';
import MyEduCoderModal from './MyEduCoderModal'; import MyEduCoderModal from './MyEduCoderModal';
import axios from 'axios'; import axios from 'axios';
import './common.css'; import './common.css';
@ -25,13 +25,13 @@ class InterestpageComponent extends Component {
super(props) super(props)
this.state = { this.state = {
gouxuans: "", gouxuans: "",
gouxuans2:0, gouxuans2: 0,
gouxuans4:[], gouxuans4: [],
namezh:this.props.namezh, namezh: this.props.namezh,
passmm:this.props.passmm, passmm: this.props.passmm,
homedatalist:undefined, homedatalist: undefined,
hometypepvisible: undefined, hometypepvisible: undefined,
MyEduCoderModals:false, MyEduCoderModals: false,
} }
} }
openNotification = (messge) => { openNotification = (messge) => {
@ -44,42 +44,42 @@ class InterestpageComponent extends Component {
}, },
}); });
} }
componentDidMount(){ componentDidMount() {
console.log("min"); console.log("min");
let{gouxuans4} =this.state; let { gouxuans4 } = this.state;
let url=`/repertoires.json`; let url = `/repertoires.json`;
axios.get(url).then((response)=> { axios.get(url).then((response) => {
if(response){ if (response) {
// console.log("53"); // console.log("53");
// console.log(response.data); // console.log(response.data);
for(var i=0;i<response.data.repertoires.length;i++){ for (var i = 0; i < response.data.repertoires.length; i++) {
var qdkfys=""; var qdkfys = "";
if(response.data.repertoires[i].id===1){ if (response.data.repertoires[i].id === 1) {
qdkfys=qdkf; qdkfys = qdkf;
}if(response.data.repertoires[i].id===2){ } if (response.data.repertoires[i].id === 2) {
qdkfys=hdkf; qdkfys = hdkf;
}if(response.data.repertoires[i].id===3){ } if (response.data.repertoires[i].id === 3) {
qdkfys=ydkf; qdkfys = ydkf;
}if(response.data.repertoires[i].id===4){ } if (response.data.repertoires[i].id === 4) {
qdkfys=sjk; qdkfys = sjk;
}if(response.data.repertoires[i].id===5){ } if (response.data.repertoires[i].id === 5) {
qdkfys=ysj; qdkfys = ysj;
}if(response.data.repertoires[i].id===6){ } if (response.data.repertoires[i].id === 6) {
qdkfys=yunwei; qdkfys = yunwei;
}if(response.data.repertoires[i].id===8){ } if (response.data.repertoires[i].id === 8) {
qdkfys=qita; qdkfys = qita;
}if(response.data.repertoires[i].id===9){ } if (response.data.repertoires[i].id === 9) {
qdkfys=rgzn; qdkfys = rgzn;
} }
if(response.data.repertoires[i].id===1) { if (response.data.repertoires[i].id === 1) {
var datas = { var datas = {
id: response.data.repertoires[i].id, id: response.data.repertoires[i].id,
name: response.data.repertoires[i].name, name: response.data.repertoires[i].name,
bool: true, bool: true,
url: qdkfys url: qdkfys
}; };
} else{ } else {
var datas = { var datas = {
id: response.data.repertoires[i].id, id: response.data.repertoires[i].id,
name: response.data.repertoires[i].name, name: response.data.repertoires[i].name,
@ -90,14 +90,14 @@ class InterestpageComponent extends Component {
gouxuans4.push(datas); gouxuans4.push(datas);
this.setState({ this.setState({
gouxuans4:gouxuans4, gouxuans4: gouxuans4,
}) })
} }
// console.log("75"); // console.log("75");
// console.log(gouxuans4); // console.log(gouxuans4);
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
@ -136,77 +136,77 @@ class InterestpageComponent extends Component {
} }
Clickteacher=(e)=>{ Clickteacher = (e) => {
// console.log(e); // console.log(e);
if(e === "teacher"){ if (e === "teacher") {
this.setState({ this.setState({
gouxuans:"teacher", gouxuans: "teacher",
}) })
}else if(e ==="student"){ } else if (e === "student") {
this.setState({ this.setState({
gouxuans:"student", gouxuans: "student",
}) })
}else if(e === "professional"){ } else if (e === "professional") {
this.setState({ this.setState({
gouxuans:"professional", gouxuans: "professional",
}) })
} }
} }
Clickteacher2=(e)=>{ Clickteacher2 = (e) => {
// console.log(e); // console.log(e);
let {gouxuans4} =this.state; let { gouxuans4 } = this.state;
for (var i=0;i<gouxuans4.length;i++){ for (var i = 0; i < gouxuans4.length; i++) {
if(gouxuans4[i].id === e){ if (gouxuans4[i].id === e) {
// console.log("51"); // console.log("51");
// console.log(e); // console.log(e);
if(gouxuans4[i].bool === true){ if (gouxuans4[i].bool === true) {
gouxuans4[i].bool=false; gouxuans4[i].bool = false;
}else{ } else {
gouxuans4[i].bool=true; gouxuans4[i].bool = true;
} }
} }
} }
// console.log(gouxuans4); // console.log(gouxuans4);
this.setState({ this.setState({
gouxuans4:gouxuans4, gouxuans4: gouxuans4,
}) })
} }
setMyEduCoderModals=()=>{ setMyEduCoderModals = () => {
this.setState({ this.setState({
MyEduCoderModals:true MyEduCoderModals: true
}) })
} }
//兴趣页面点击 //兴趣页面点击
Interestcompletionpage(){ Interestcompletionpage() {
if(this.state.gouxuans.length === 0){ if (this.state.gouxuans.length === 0) {
this.openNotification("请选择职业"); this.openNotification("请选择职业");
return return
} }
var ints=[]; var ints = [];
for (var i =0;i<this.state.gouxuans4.length;i++) { for (var i = 0; i < this.state.gouxuans4.length; i++) {
if(this.state.gouxuans4[i].bool === true){ if (this.state.gouxuans4[i].bool === true) {
ints.push(this.state.gouxuans4[i].id); ints.push(this.state.gouxuans4[i].id);
} }
} }
console.log("195195"); console.log("195195");
console.log(ints); console.log(ints);
if(ints.length<1){ if (ints.length < 1) {
this.openNotification("请至少选择一个您感兴趣的内容"); this.openNotification("请至少选择一个您感兴趣的内容");
return return
} }
var url = "/users/interest.json"; var url = "/users/interest.json";
axios.post(url, { axios.post(url, {
identity:this.state.gouxuans, identity: this.state.gouxuans,
interest_ids: ints, interest_ids: ints,
}).then((response) => { }).then((response) => {
if (response !== undefined) { if (response !== undefined) {
// this.Jumptotheinterestpage(); // this.Jumptotheinterestpage();
// window.location.href = "/" // window.location.href = "/"
if(response.data.status===0){ if (response.data.status === 0) {
this.setMyEduCoderModals() this.setMyEduCoderModals()
} }
@ -220,39 +220,10 @@ class InterestpageComponent extends Component {
}) })
} }
// //跳转然后登入 setNotcompleteds = () => {
// 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=()=>{
this.setState({ this.setState({
Notcompleteds:true, Notcompleteds: true,
MyEduCoderModals:false MyEduCoderModals: false
}) })
} }
@ -264,45 +235,45 @@ class InterestpageComponent extends Component {
console.log(window.screen.width); console.log(window.screen.width);
return ( return (
<div className="ysllogin_register_contents" style={{width:"60%"}}> <div className="ysllogin_register_contents" style={{ width: "60%" }}>
<MyEduCoderModal <MyEduCoderModal
modalsType={this.state.MyEduCoderModals} modalsType={this.state.MyEduCoderModals}
setNotcompleteds={()=>{this.setNotcompleteds()}} setNotcompleteds={() => { this.setNotcompleteds() }}
/> />
<div className="ysllogin_section"> <div className="ysllogin_section">
<div style={{marginTop: "1%"}}><span className="yslspans1">请选择你的职业</span></div> <div style={{ marginTop: "1%" }}><span className="yslspans1">请选择你的职业</span></div>
<div className="ysldivhome1" > <div className="ysldivhome1" >
<div className="ysldivhomediv" style={{marginLeft:"30px"}} > <div className="ysldivhomediv" style={{ marginLeft: "30px" }} >
<div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher("teacher")}>{gouxuans ==="teacher"? <img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}老师</div> <div className="ysldivhomedivtxt" onClick={() => this.Clickteacher("teacher")}>{gouxuans === "teacher" ? <img src={gouxuan} className="gouxuanimg" /> : <img className="gouxuanimg" src={meigouxuan} />}老师</div>
<div className="ysldivhomedivimgsy" ><img onClick={()=>this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg"/></div> <div className="ysldivhomedivimgsy" ><img onClick={() => this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg" /></div>
</div> </div>
<div className="ysldivhomediv" style={{ marginLeft:"101px",marginRight:"101px"}}> <div className="ysldivhomediv" style={{ marginLeft: "101px", marginRight: "101px" }}>
<div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher("student")}>{gouxuans==="student"? <img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}学生</div> <div className="ysldivhomedivtxt" onClick={() => this.Clickteacher("student")}>{gouxuans === "student" ? <img src={gouxuan} className="gouxuanimg" /> : <img className="gouxuanimg" src={meigouxuan} />}学生</div>
<div className="ysldivhomedivimgsy"><img onClick={()=>this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg"/></div> <div className="ysldivhomedivimgsy"><img onClick={() => this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg" /></div>
</div> </div>
<div className="ysldivhomediv" > <div className="ysldivhomediv" >
<div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher("professional")}>{gouxuans==="professional"?<img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}专业人士</div> <div className="ysldivhomedivtxt" onClick={() => this.Clickteacher("professional")}>{gouxuans === "professional" ? <img src={gouxuan} className="gouxuanimg" /> : <img className="gouxuanimg" src={meigouxuan} />}专业人士</div>
<div className="ysldivhomedivimgsy"><img onClick={()=>this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg"/></div> <div className="ysldivhomedivimgsy"><img onClick={() => this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg" /></div>
</div> </div>
</div> </div>
<p className="yslspans2">选择你可能感兴趣的内容</p> <p className="yslspans2">选择你可能感兴趣的内容</p>
<p className="yslspans3">基于你关注的内容推荐</p> <p className="yslspans3">基于你关注的内容推荐</p>
<div className="ysldivhome2"> <div className="ysldivhome2">
{gouxuans4&&gouxuans4.map((item,key)=>{ {gouxuans4 && gouxuans4.map((item, key) => {
return( return (
<div className={item.id<5?"ysldivhomediv1":"ysldivhomediv2"} onClick={()=>this.Clickteacher2(item.id)}> <div className={item.id < 5 ? "ysldivhomediv1" : "ysldivhomediv2"} onClick={() => this.Clickteacher2(item.id)}>
{item.bool===true?<img src={gouxuan} className="yslgouxuanimg"/>:<div className="yslgouxuanimg2"></div>} {item.bool === true ? <img src={gouxuan} className="yslgouxuanimg" /> : <div className="yslgouxuanimg2"></div>}
<img className="div1img" src={item.url}/> <img className="div1img" src={item.url} />
<p className="textall">{item.name}</p> <p className="textall">{item.name}</p>
</div> </div>
) )
})} })}
</div> </div>
<Button className="yslbutton" size={"large"} type="primary"onClick={()=>this.Interestcompletionpage()} style={{width:"255px",height: "35px",background: "#4CACFF",marginTop: "2%",marginBottom:" 2%",}}>完成</Button> <Button className="yslbutton" size={"large"} type="primary" onClick={() => this.Interestcompletionpage()} style={{ width: "255px", height: "35px", background: "#4CACFF", marginTop: "2%", marginBottom: " 2%", }}>完成</Button>
</div> </div>
</div> </div>

@ -1,6 +1,6 @@
import React, {Component} from 'react'; import React, { Component } from 'react';
import {Button,notification} from 'antd'; import { Button, notification } from 'antd';
import {broadcastChannelPostMessage} from 'educoder'; import { broadcastChannelPostMessage } from 'educoder';
import MyEduCoderModal from './MyEduCoderModal'; import MyEduCoderModal from './MyEduCoderModal';
// import Notcompleted from '../../common/Notcompleted'; // import Notcompleted from '../../common/Notcompleted';
import axios from 'axios'; import axios from 'axios';
@ -25,13 +25,13 @@ class InterestpageMax extends Component {
super(props) super(props)
this.state = { this.state = {
gouxuans: "", gouxuans: "",
gouxuans2:0, gouxuans2: 0,
gouxuans4:[], gouxuans4: [],
namezh:this.props.namezh, namezh: this.props.namezh,
passmm:this.props.passmm, passmm: this.props.passmm,
homedatalist:undefined, homedatalist: undefined,
hometypepvisible: undefined, hometypepvisible: undefined,
MyEduCoderModals:false MyEduCoderModals: false
} }
} }
openNotification = (messge) => { openNotification = (messge) => {
@ -44,42 +44,42 @@ class InterestpageMax extends Component {
}, },
}); });
} }
componentDidMount(){ componentDidMount() {
console.log("max"); console.log("max");
let{gouxuans4} =this.state; let { gouxuans4 } = this.state;
let url=`/repertoires.json`; let url = `/repertoires.json`;
axios.get(url).then((response)=> { axios.get(url).then((response) => {
if(response){ if (response) {
console.log("53"); console.log("53");
console.log(response.data); console.log(response.data);
for(var i=0;i<response.data.repertoires.length;i++){ for (var i = 0; i < response.data.repertoires.length; i++) {
var qdkfys=""; var qdkfys = "";
if(response.data.repertoires[i].id===1){ if (response.data.repertoires[i].id === 1) {
qdkfys=qdkf; qdkfys = qdkf;
}if(response.data.repertoires[i].id===2){ } if (response.data.repertoires[i].id === 2) {
qdkfys=hdkf; qdkfys = hdkf;
}if(response.data.repertoires[i].id===3){ } if (response.data.repertoires[i].id === 3) {
qdkfys=ydkf; qdkfys = ydkf;
}if(response.data.repertoires[i].id===4){ } if (response.data.repertoires[i].id === 4) {
qdkfys=sjk; qdkfys = sjk;
}if(response.data.repertoires[i].id===5){ } if (response.data.repertoires[i].id === 5) {
qdkfys=ysj; qdkfys = ysj;
}if(response.data.repertoires[i].id===6){ } if (response.data.repertoires[i].id === 6) {
qdkfys=yunwei; qdkfys = yunwei;
}if(response.data.repertoires[i].id===8){ } if (response.data.repertoires[i].id === 8) {
qdkfys=qita; qdkfys = qita;
}if(response.data.repertoires[i].id===9){ } if (response.data.repertoires[i].id === 9) {
qdkfys=rgzn; qdkfys = rgzn;
} }
if(response.data.repertoires[i].id===1) { if (response.data.repertoires[i].id === 1) {
var datas = { var datas = {
id: response.data.repertoires[i].id, id: response.data.repertoires[i].id,
name: response.data.repertoires[i].name, name: response.data.repertoires[i].name,
bool: true, bool: true,
url: qdkfys url: qdkfys
}; };
} else{ } else {
var datas = { var datas = {
id: response.data.repertoires[i].id, id: response.data.repertoires[i].id,
name: response.data.repertoires[i].name, name: response.data.repertoires[i].name,
@ -90,14 +90,14 @@ class InterestpageMax extends Component {
gouxuans4.push(datas); gouxuans4.push(datas);
this.setState({ this.setState({
gouxuans4:gouxuans4, gouxuans4: gouxuans4,
}) })
} }
console.log("75"); console.log("75");
console.log(gouxuans4); console.log(gouxuans4);
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -137,77 +137,77 @@ class InterestpageMax extends Component {
} }
Clickteacher=(e)=>{ Clickteacher = (e) => {
console.log(e); console.log(e);
if(e === "teacher"){ if (e === "teacher") {
this.setState({ this.setState({
gouxuans:"teacher", gouxuans: "teacher",
}) })
}else if(e ==="student"){ } else if (e === "student") {
this.setState({ this.setState({
gouxuans:"student", gouxuans: "student",
}) })
}else if(e === "professional"){ } else if (e === "professional") {
this.setState({ this.setState({
gouxuans:"professional", gouxuans: "professional",
}) })
} }
} }
Clickteacher2=(e)=>{ Clickteacher2 = (e) => {
console.log(e); console.log(e);
let {gouxuans4} =this.state; let { gouxuans4 } = this.state;
for (var i=0;i<gouxuans4.length;i++){ for (var i = 0; i < gouxuans4.length; i++) {
if(gouxuans4[i].id === e){ if (gouxuans4[i].id === e) {
console.log("51"); console.log("51");
console.log(e); console.log(e);
if(gouxuans4[i].bool === true){ if (gouxuans4[i].bool === true) {
gouxuans4[i].bool=false; gouxuans4[i].bool = false;
}else{ } else {
gouxuans4[i].bool=true; gouxuans4[i].bool = true;
} }
} }
} }
console.log(gouxuans4); console.log(gouxuans4);
this.setState({ this.setState({
gouxuans4:gouxuans4, gouxuans4: gouxuans4,
}) })
} }
setMyEduCoderModals=()=>{ setMyEduCoderModals = () => {
this.setState({ this.setState({
MyEduCoderModals:true MyEduCoderModals: true
}) })
} }
//兴趣页面点击 //兴趣页面点击
Interestcompletionpage(){ Interestcompletionpage() {
if(this.state.gouxuans.length === 0){ if (this.state.gouxuans.length === 0) {
this.openNotification("请选择职业"); this.openNotification("请选择职业");
return return
} }
var ints=[]; var ints = [];
for (var i =0;i<this.state.gouxuans4.length;i++) { for (var i = 0; i < this.state.gouxuans4.length; i++) {
if(this.state.gouxuans4[i].bool === true){ if (this.state.gouxuans4[i].bool === true) {
ints.push(this.state.gouxuans4[i].id); ints.push(this.state.gouxuans4[i].id);
} }
} }
console.log("200200"); console.log("200200");
console.log(ints); console.log(ints);
if(ints.length<1){ if (ints.length < 1) {
this.openNotification("请至少选择一个您感兴趣的内容"); this.openNotification("请至少选择一个您感兴趣的内容");
return return
} }
var url = "/users/interest.json"; var url = "/users/interest.json";
axios.post(url, { axios.post(url, {
identity:this.state.gouxuans, identity: this.state.gouxuans,
interest_ids: ints, interest_ids: ints,
}).then((response) => { }).then((response) => {
if (response !== undefined) { if (response !== undefined) {
// this.Jumptotheinterestpage(); // this.Jumptotheinterestpage();
// window.location.href = "/" // window.location.href = "/"
if(response.data.status===0){ if (response.data.status === 0) {
this.setMyEduCoderModals() this.setMyEduCoderModals()
} }
} }
@ -219,39 +219,10 @@ class InterestpageMax extends Component {
}) })
} }
// //跳转然后登入 setNotcompleteds = () => {
// 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=()=>{
this.setState({ this.setState({
Notcompleteds:true, Notcompleteds: true,
MyEduCoderModals:false MyEduCoderModals: false
}) })
} }
@ -263,44 +234,44 @@ class InterestpageMax extends Component {
// height: 346px; // height: 346px;
return ( return (
<div className="ysllogin_register_contents2" style={{width:"800px",height: "550px"}}> <div className="ysllogin_register_contents2" style={{ width: "800px", height: "550px" }}>
<MyEduCoderModal <MyEduCoderModal
modalsType={this.state.MyEduCoderModals} modalsType={this.state.MyEduCoderModals}
setNotcompleteds={()=>{this.setNotcompleteds()}} setNotcompleteds={() => { this.setNotcompleteds() }}
/> />
<div className="ysllogin_section2"> <div className="ysllogin_section2">
<div className="mt15"><span className="yslspans12">请选择你的职业</span></div> <div className="mt15"><span className="yslspans12">请选择你的职业</span></div>
<div className="ysldivhome12" > <div className="ysldivhome12" >
<div className="ysldivhomediv222" style={{marginLeft:"30px"}} > <div className="ysldivhomediv222" style={{ marginLeft: "30px" }} >
<div className="ysldivhomedivtxt2" onClick={()=>this.Clickteacher("teacher")}>{gouxuans ==="teacher"? <img src={gouxuan} className="gouxuanimg2"/>:<img className="gouxuanimg2" src={meigouxuan}/>}老师</div> <div className="ysldivhomedivtxt2" onClick={() => this.Clickteacher("teacher")}>{gouxuans === "teacher" ? <img src={gouxuan} className="gouxuanimg2" /> : <img className="gouxuanimg2" src={meigouxuan} />}老师</div>
<div className="ysldivhomedivimg2" ><img onClick={()=>this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg2"/></div> <div className="ysldivhomedivimg2" ><img onClick={() => this.Clickteacher("teacher")} src={skzbdx} className="ysldivhomedivimg2" /></div>
</div> </div>
<div className="ysldivhomediv222" style={{ marginLeft:"101px",marginRight:"101px"}}> <div className="ysldivhomediv222" style={{ marginLeft: "101px", marginRight: "101px" }}>
<div className="ysldivhomedivtxt2" onClick={()=>this.Clickteacher("student")}>{gouxuans==="student"? <img src={gouxuan} className="gouxuanimg2"/>:<img className="gouxuanimg2" src={meigouxuan}/>}学生</div> <div className="ysldivhomedivtxt2" onClick={() => this.Clickteacher("student")}>{gouxuans === "student" ? <img src={gouxuan} className="gouxuanimg2" /> : <img className="gouxuanimg2" src={meigouxuan} />}学生</div>
<div className="ysldivhomedivimg2"><img onClick={()=>this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg2"/></div> <div className="ysldivhomedivimg2"><img onClick={() => this.Clickteacher("student")} src={mytc} className="ysldivhomedivimg2" /></div>
</div> </div>
<div className="ysldivhomediv222" > <div className="ysldivhomediv222" >
<div className="ysldivhomedivtxt2" onClick={()=>this.Clickteacher("professional")}>{gouxuans==="professional"?<img src={gouxuan} className="gouxuanimg2"/>:<img className="gouxuanimg2" src={meigouxuan}/>}专业人士</div> <div className="ysldivhomedivtxt2" onClick={() => this.Clickteacher("professional")}>{gouxuans === "professional" ? <img src={gouxuan} className="gouxuanimg2" /> : <img className="gouxuanimg2" src={meigouxuan} />}专业人士</div>
<div className="ysldivhomedivimg2"><img onClick={()=>this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg2"/></div> <div className="ysldivhomedivimg2"><img onClick={() => this.Clickteacher("professional")} src={zyrs1} className="ysldivhomedivimg2" /></div>
</div> </div>
</div> </div>
<div><span className="yslspans22">选择你可能感兴趣的内容</span></div> <div><span className="yslspans22">选择你可能感兴趣的内容</span></div>
<div ><span className="yslspans32">基于你关注的内容推荐</span></div> <div ><span className="yslspans32">基于你关注的内容推荐</span></div>
<div className="ysldivhome22"> <div className="ysldivhome22">
{gouxuans4&&gouxuans4.map((item,key)=>{ {gouxuans4 && gouxuans4.map((item, key) => {
return( return (
<div className={item.id<5?"ysldivhomediv12":"ysldivhomediv22"} onClick={()=>this.Clickteacher2(item.id)}> <div className={item.id < 5 ? "ysldivhomediv12" : "ysldivhomediv22"} onClick={() => this.Clickteacher2(item.id)}>
{item.bool===true?<img src={gouxuan} className="yslgouxuanimg22x"/>:<div className="yslgouxuanimg22x"></div>} {item.bool === true ? <img src={gouxuan} className="yslgouxuanimg22x" /> : <div className="yslgouxuanimg22x"></div>}
<img className="div1img2" src={item.url}/> <img className="div1img2" src={item.url} />
<span className="textall2">{item.name}</span> <span className="textall2">{item.name}</span>
</div> </div>
) )
})} })}
</div> </div>
<Button className="yslbutton2" size={"large"} type="primary"onClick={()=>this.Interestcompletionpage()} style={{width:"255px",height: "35px",background: "#4CACFF",marginTop: "17px"} }>完成</Button> <Button className="yslbutton2" size={"large"} type="primary" onClick={() => this.Interestcompletionpage()} style={{ width: "255px", height: "35px", background: "#4CACFF", marginTop: "17px" }}>完成</Button>
</div> </div>
</div> </div>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save