Conflicts:
	public/react/src/modules/tpm/NewHeader.js
dev_forum
caishi 6 years ago
commit 0a6b09d227

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import {Tooltip} from 'antd'
import moment from 'moment'
import { getUrl } from 'educoder'
import { getUrl, WordsBtn } from 'educoder'
class BoardsListItem extends Component{
constructor(props){
super(props);
@ -61,34 +61,37 @@ class BoardsListItem extends Component{
</h6>
<div className="cl"></div>
<p className="color-grey panel-lightgrey mt10 fl">
<p className="color-grey panel-lightgrey mt18 fl">
<span className="mr50">
<a href={`/users/${discussMessage.author.login}`} className="panel-name-small hide fl mr15 mr30 color-grey3">{discussMessage.author.name}</a>
<a href={`/users/${discussMessage.author.login}`} className="panel-name-small hide fl mr15 mr30 color-grey3 font-14">{discussMessage.author.name}</a>
{ discussMessage.total_replies_count != 0 && <span className="mr15 color-grey9">{discussMessage.total_replies_count} 回复</span> }
{ discussMessage.total_praises_count != 0 && <span className="mr15 color-grey9">{discussMessage.total_praises_count} 点赞</span> }
{ discussMessage.visits != 0 && <span className="mr15 color-grey9">{discussMessage.visits} 浏览</span> }
{ discussMessage.total_replies_count != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.total_replies_count} 回复</span> }
{ discussMessage.total_praises_count != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.total_praises_count} 点赞</span> }
{ discussMessage.visits != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.visits} 浏览</span> }
<span className="mr15 color-light-grey-C">{moment(discussMessage.created_on).fromNow()} </span>
<span className="mr15 color-light-grey-C font-14">{moment(discussMessage.created_on).fromNow()} </span>
</span>
{/* <span className="mr10">最后回复<span className="ml10 mr10">社区导师</span>10个月前</span> */}
</p>
<div className="fr mt15">
{(isAdmin || discussMessage.author.login == current_user.login) &&
<WordsBtn style="blue" className="fl font-16 ml28"
onClick={(e) => { this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} }>编辑</WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="fl font-16 ml28"
onClick={(e) => { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();}}>
{ discussMessage.sticky ? '取消置顶' : '置顶' }</WordsBtn> }
</div>
{/* <span className="mr10"><i className="fa fa-eye color-grey mr5 "></i>473</span> */}
{/* <p className="fr panel-lightgrey mt10">
<span className="mr10"><i className="fa fa-eye color-grey mr5" data-tip-down="浏览数"></i>82</span>
<span className="mr10"><i className="fa fa-thumbs-up color-grey mr5" data-tip-down="点赞数"></i>1</span>
<span className="mr10"><i className="fa fa-comments-o color-grey mr5" data-tip-down="回复数"></i>4</span>
</p> */}
{ (isAdmin || discussMessage.author.login == current_user.login) &&
{/* { (isAdmin || discussMessage.author.login == current_user.login) &&
<div className="homepagePostSetting" style={{"right":"4px","top":"5px","display":"block"}}>
<ul>
<li className="edu-position edu-position-hidebox">
<i className="fa fa-bars color-grey-b"></i>
<ul className="edu-position-hide undis">
{/* <li><a href="javascript:void(0)" onclick="show_send(34255, 1, 'message');">发送</a></li> */}
{(isAdmin || discussMessage.author.login == current_user.login) && <li><a href="javascript:void(0)" onClick={(e) => {
this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} } >编辑</a></li>
}
@ -96,14 +99,13 @@ class BoardsListItem extends Component{
{ discussMessage.sticky ? '取消置顶' : '置顶' }
</a></li>
}
{/* <li>
<a href="javascript:void(0);" onclick="delete_confirm_box_3('/boards/5464/topics/34255/destroy', '确定要删除该帖子吗?')">删除</a>
</li> */}
</ul>
</li>
</ul>
</div>
}
} */}
</div>
</div>
)

@ -280,7 +280,7 @@ class BoardsNew extends Component{
{ name: this.isEdit ? '帖子编辑' : '帖子新建'}
]}></CBreadcrumb>
<p className="clearfix mt30 mb30">
<p className="clearfix mt20 mb20">
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}帖子</span>
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
onClick={() => this.props.history.goBack()}>

@ -227,15 +227,30 @@ class TopicDetail extends Component {
// filesize = bytesToSize(item.filesize)
}
attachments.push(
<p className="clearfix" key={index} >
<a href={item.url} className="color-green clearfix notefileDownload">
<i className="iconfont icon-xiazai color-green ml5 fl"></i>
{fileName && <ConditionToolTip title={fileName} condition={fileName.length > 30 }>
<span className="fl task-hide upload_item" style={{ color: '#333'}}>{fileName}</span>
</ConditionToolTip>}
<span className="fl" style={{ color: '#999', marginLeft: '6px'}}>{filesize? ` ${filesize.replace(' ', '')}` : ''}</span>
// <p className="clearfix" key={index} >
// <a href={item.url} className="color-green clearfix notefileDownload">
// <i className="iconfont icon-fujian color-green ml5 fl"></i>
// {fileName && <ConditionToolTip title={fileName} condition={fileName.length > 30 }>
// <span className="fl task-hide upload_item" style={{ color: '#333'}}>{fileName}</span>
// </ConditionToolTip>}
// <span className="fl" style={{ color: '#999', marginLeft: '6px'}}>{filesize? ` ${filesize.replace(' ', '')}` : ''}</span>
// </a>
// </p>
<div className="color-grey" key={index}>
<a className="color-grey ml20">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
</p>
{fileName && <ConditionToolTip title={fileName} condition={fileName.length > 30 }>
<a href={item.url}
className="mr12 color9B9B" length="58">
{fileName}
</a>
</ConditionToolTip>}
<span className="color656565 mt2 color-grey-6 font-12 mr8">{item.filesize}</span>
</div>
)
})
return attachments;
@ -542,7 +557,7 @@ class TopicDetail extends Component {
</span> }
{/* || current_user.user_id === author_info.user_id */}
{ current_user && (isAdmin || isCurrentUserTheAuthor) &&
<div className="edu-position-hidebox" style={{position: 'absolute', right: '18px',top:'4px'}}>
<div className="edu-position-hidebox" style={{position: 'absolute', right: '2px',top:'4px'}}>
<a href="javascript:void(0);"><i className="fa fa-bars font-16"></i></a>
<ul className="edu-position-hide undis">
@ -619,10 +634,10 @@ class TopicDetail extends Component {
</div>
<div className="padding40 memoContent new_li">
<div className="padding30 memoContent new_li" style={{ paddingBottom: '10px'}}>
<MarkdownToHtml content={memo.content}></MarkdownToHtml>
</div>
<div className="padding40 bor-bottom-greyE" >
<div className="padding40 bor-bottom-greyE" style={{paddingTop: '2px'}}>
<div className="mt10 mb20">
{/* ${memo.user_praise ? '' : ''} */}
<Tooltip title={`${memo.liked ? '取消点赞' : '点赞'}`}>

@ -156,7 +156,7 @@ class CommonWorkItem extends Component{
<span className="fl">
<CoursesListType typelist={item.status} />
</span>
{
{/* {
mainList && isAdmin &&
<li className="fr drop_down">
<i className="iconfont icon-caidan font-16 color-grey-c"></i>
@ -170,7 +170,7 @@ class CommonWorkItem extends Component{
</li>
</ul>
</li>
}
} */}
</p>
<p className="color-grey-9 clearfix">
{item.commit_count===undefined?"":<span className="mr20 fl">{item.commit_count} 已交</span>}
@ -184,6 +184,12 @@ class CommonWorkItem extends Component{
<span className="mr20 fl">{item.status_time}</span>
</Tooltip>
}
{isAdmin && <div className="fr">
<WordsBtn style="blue" className="fl font-16 ml28" onClick={ () => { this.props.toEditPage(this.props.match.params, item.homework_id) }}>编辑</WordsBtn>
<WordsBtn style="blue" className="fl font-16 ml28" onClick={ () => { this.props.toWorkSettingPage(this.props.match.params, item.homework_id) }}>设置</WordsBtn>
</div>}
{
//
isStudent &&

@ -70,10 +70,10 @@ function buildColumns(that, student_works) {
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap'
}}>
<Tooltip placement="bottom" title={text}>
}} title={text}>
{/* <Tooltip placement="bottom" title={text}>
</Tooltip> */}
{text}
</Tooltip>
</div>
),
}, {

@ -271,8 +271,8 @@ class CommonWorkSetting extends Component{
absence_penalty = 2
}
} else {
evaluation_start = ''
evaluation_end = ''
evaluation_start = null
evaluation_end = null
evaluation_num = 0
absence_penalty = 0
}
@ -484,6 +484,7 @@ class CommonWorkSetting extends Component{
publish_time_type, end_time_type
} = this.state;
let group_settings_param = []
let max_un_unified_setting_end_time = null
if (!unified_setting) {
const result = this.refs.pollDetailTabForthRules.notUnifiedSettingCheck(this.state.rules);
this.setState({
@ -494,6 +495,9 @@ class CommonWorkSetting extends Component{
return false;
}
group_settings_param = result.rules.map(item => {
if (!max_un_unified_setting_end_time || moment(item.end_time) > moment(max_un_unified_setting_end_time)) {
max_un_unified_setting_end_time = item.end_time;
}
return {
group_id: item.course_group_id,
publish_time: item.publish_time,
@ -517,16 +521,22 @@ class CommonWorkSetting extends Component{
return false
}
let temp_publish_time = publish_time
let temp_end_time = end_time
if (!temp_publish_time) {
const publish_time_moment = getNextHalfHourOfMoment(moment());
temp_publish_time = publish_time_moment.format(dateFormat);
}
if (!temp_end_time) {
temp_end_time = moment(handleDateString(temp_publish_time)).add(1, 'months').format(dateFormat)
let temp_publish_time
let temp_end_time
if (unified_setting) {
let temp_publish_time = publish_time
let temp_end_time = end_time
if (!temp_publish_time) {
const publish_time_moment = getNextHalfHourOfMoment(moment());
temp_publish_time = publish_time_moment.format(dateFormat);
}
if (!temp_end_time) {
temp_end_time = moment(handleDateString(temp_publish_time)).add(1, 'months').format(dateFormat)
}
} else {
temp_end_time = max_un_unified_setting_end_time
}
// 已发布的不检查
const isUnPublish= homework_status.indexOf(STATUS_UN_PUBLISH) != -1
const isAdmin = this.props.isAdmin()
@ -534,20 +544,22 @@ class CommonWorkSetting extends Component{
const publish_time_editable = isUnPublish;
const end_time_editable = isAdmin || !end_time || moment(end_time) > current;
if (publish_time_editable && temp_publish_time && moment(temp_publish_time) < moment()) {
this.setState({
publicTimeTip: '发布时间不能小于当前时间'
})
scrollTo('.publicTimeTip')
return false
}
// 已截止的不检查
if (end_time_editable && temp_end_time && moment(temp_end_time) <= moment(temp_publish_time)) {
this.setState({
publicTimeTip: '截止时间必须晚于发布时间'
})
scrollTo('.publicTimeTip')
return false
if (unified_setting) {
if (publish_time_editable && temp_publish_time && moment(temp_publish_time) < moment()) {
this.setState({
publicTimeTip: '发布时间不能小于当前时间'
})
scrollTo('.publicTimeTip')
return false
}
// 已截止的不检查
if (end_time_editable && temp_end_time && moment(temp_end_time) <= moment(temp_publish_time)) {
this.setState({
publicTimeTip: '截止时间必须晚于发布时间'
})
scrollTo('.publicTimeTip')
return false
}
}
this.setState({
publicTimeTip: ''
@ -1006,7 +1018,7 @@ class CommonWorkSetting extends Component{
placeholder="请选择发布时间"
id={"startime"}
width={"210px"}
value={publish_time===null||publish_time===""?"":moment(publish_time, dateFormat)}
value={!publish_time?"":moment(publish_time, dateFormat)}
onChange={this.onChangeTimepublish}
// disabled={this.props.isSuperAdmin()?false:publish_time_type===true?true:false}
disabled={moment(this.state.init_publish_time) < moment() || noAuth}
@ -1036,7 +1048,7 @@ class CommonWorkSetting extends Component{
placeholder="请选择截止时间"
id={"endTime"}
width={"210px"}
value={end_time===null||end_time===""?"":moment(end_time, dateFormat)}
value={!end_time?"":moment(end_time, dateFormat)}
onChange={this.onChangeTimeend}
disabled={this.props.isSuperAdmin()?false:end_time_type===true?true:false}
disabled={moment(this.state.init_end_time) < moment() || noAuth}
@ -1105,7 +1117,7 @@ class CommonWorkSetting extends Component{
placeholder="请选择结束时间"
id={"enTime"}
width={"210px"}
value={late_time===null||late_time===""? undefined :moment(late_time, dateFormat)}
value={!late_time ? undefined :moment(late_time, dateFormat)}
onChange={this.onChangeTimelatetime}
disabledTime={disabledDateTime}
disabled={!allow_late || noAuth || moment(init_late_time) < moment()}
@ -1153,7 +1165,7 @@ class CommonWorkSetting extends Component{
placeholder="请选择匿名开启时间"
id={"startime"}
width={"210px"}
value={evaluation_start===null||evaluation_start===""?"":moment(evaluation_start, dateFormat)}
value={!evaluation_start ?"":moment(evaluation_start, dateFormat)}
onChange={this.onChangeEvaluationStart}
disabled={ (anonymous_comment && !noAuth ? false : true) || moment(init_evaluation_start) < moment() }
// disabledDate={ (evaluation_start) =>
@ -1182,7 +1194,7 @@ class CommonWorkSetting extends Component{
placeholder="请选择匿名结束时间"
id={"endtime"}
width={"210px"}
value={evaluation_end===null||evaluation_end===""?"":moment(evaluation_end, dateFormat)}
value={!evaluation_end ?"":moment(evaluation_end, dateFormat)}
onChange={this.onChangeEvaluationEnd}
disabledTime={disabledDateTime}
disabled={(anonymous_comment && !noAuth ? false : true) || moment(init_evaluation_end) < moment()}
@ -1201,7 +1213,7 @@ class CommonWorkSetting extends Component{
<span className={"font-14 color-grey-9 ml10"}></span>
</div>
{anonymous_comment_time_tip && <div className={" anonymous_comment_time_tip color-red ml60"} style={{marginTop: '-6px'}}>{anonymous_comment_time_tip}</div>}
{<div className={" anonymous_comment_time_tip color-red ml60"} style={{marginTop: '-6px'}}>{anonymous_comment_time_tip}</div>}
{/* 匿评数量 */}
<div className={"h20 mb30 ml60"}>
@ -1277,7 +1289,7 @@ class CommonWorkSetting extends Component{
placeholder="请选择申诉结束时间"
id={"endtime"}
width={"210px"}
value={appeal_time===null||appeal_time===""?"":moment(appeal_time, dateFormat)}
value={!appeal_time?"":moment(appeal_time, dateFormat)}
onChange={this.appeal_time_change}
disabled={ (anonymous_appeal && !noAuth ? false : true) || moment(init_appeal_time) < moment()}
/>

@ -36,6 +36,10 @@ const CommonWorkAnswer = Loadable({
loader: () => import('./CommonWorkAnswer'),
loading:Loading,
})
const CommonWorkAppraise = Loadable({
loader: () => import('./CommonWorkAppraise'),
loading:Loading,
})
const CommonWork = Loadable({
@ -87,6 +91,12 @@ class CoursesWorkIndex extends Component{
(props) => (<CommonWorkDetailIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/* 评阅 */}
<Route exact path="/courses/:coursesId/group_homeworks/:workId/:studentWorkId/appraise"
render={
(props) => (<CommonWorkAppraise {...this.props} {...props} {...this.state} />)
}
></Route>
<Route exact path="/courses/:coursesId/group_homeworks/:workId/post"

@ -373,7 +373,7 @@ class NewWork extends Component{
{ name: `${ this.isEdit ? '编辑' : '新建'}` }
]}></CBreadcrumb>
<p className="clearfix mt30 mb30">
<p className="clearfix mt20 mb20">
<span className="fl font-24 color-grey-3">{this.isEdit ?"编辑":"新建"}{ moduleName }</span>
{/* history.goBack()
this.props.toListPage(this.props.match.params, category.category_id)}

@ -25,7 +25,7 @@
} */
#forum_list .return_btn.no_mr {
margin-right: 15px
/* margin-right: 15px */
}
/* md编辑器拖拽调整 */

@ -405,10 +405,10 @@ class ExerciceNew extends Component{
{ name: this.isEdit ? '编辑试卷' : '新建试卷'}
]}></CBreadcrumb>
<p className="clearfix mt30 mb30">
<p className="clearfix mt20 mb20">
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}试卷</span>
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
onClick={() => this.props.history.goBack()}>
onClick={() => this.props.history.length == 1 ? this.props.history.push(`/courses/${courseId}/exercises/${left_banner_id}`): this.props.history.goBack()}>
返回
</a>
</p>

@ -79,7 +79,12 @@ class GraduationTasksedit extends Component{
let listid=[]
let graduation_id=this.state.data.graduation_id;
for(var list of fileList){
listid.push(list.response.id)
if(list.response!=undefined){
listid.push(list.response.id)
}else{
listid.push(list.uid)
}
}
// console.log(listid)
@ -125,7 +130,7 @@ class GraduationTasksedit extends Component{
GraduationTasksedittype=false;
// window.location.href="/courses/"+course_id+"/graduation/"+graduationId+"/graduation_tasks/"+category_id+"/questions";
// this.goback()
window.location.href="/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting";
this.props.history.push("/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting");
}
}).catch((error) => {
console.log(error)

@ -1,297 +1,327 @@
import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd";
import React, {Component} from "React";
import {Form, Select, Input, Button, Checkbox, Upload, Icon, message, Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { WordsBtn,getUrl} from 'educoder';
import {WordsBtn, getUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
const { Option} = Select;
const {Option} = Select;
const CheckboxGroup = Checkbox.Group;
const confirm = Modal.confirm;
let GraduationTasksnewtype=true;
class GraduationTasksnew extends Component{
constructor(props){
super(props)
this.state={
coursename:"",
coursesearch:"",
title_num:60,
title_value:"",
fileList: [],
contents: [{val:"",id:1}],
type:true
}
}
componentDidMount(){
// const query =this.props.location.search;
//
// const type = query.split('&');
// let name = type[1].split("name=")
// name = String(name).split(",")
// name = decodeURI(name[1])
//
// this.setState({
// coursename:name,
// coursesearch:this.props.location.search
// })
}
scrollToAnchors=(anchorName)=>{
this.setState({
anchor:anchorName
})
}
handleSubmit=(e) => {
let {fileList}=this.state;
let listid=[]
for(var list of fileList){
listid.push(list.response.id)
}
e.preventDefault();
if( GraduationTasksnewtype===true){
this.props.form.validateFields((err, values) => {
if (!err) {
if(values.tasktype===undefined){
this.scrollToAnchors("tasktypes");
return
let GraduationTasksnewtype = true;
class GraduationTasksnew extends Component {
constructor(props) {
super(props)
this.state = {
coursename: "",
coursesearch: "",
title_num: 60,
title_value: "",
fileList: [],
contents: [{val: "", id: 1}],
type: true
}
}
componentDidMount() {
// const query =this.props.location.search;
//
// const type = query.split('&');
// let name = type[1].split("name=")
// name = String(name).split(",")
// name = decodeURI(name[1])
//
// this.setState({
// coursename:name,
// coursesearch:this.props.location.search
// })
}
scrollToAnchors = (anchorName) => {
this.setState({
anchor: anchorName
})
}
handleSubmit = (e) => {
let {fileList} = this.state;
let listid = []
for (var list of fileList) {
listid.push(list.response.id)
}
e.preventDefault();
if (GraduationTasksnewtype === true) {
this.props.form.validateFields((err, values) => {
if (!err) {
if (values.tasktype === undefined) {
this.scrollToAnchors("tasktypes");
return
}
if (values.name === undefined) {
this.scrollToAnchors("nametypes");
return
}
if (values.description === undefined) {
this.scrollToAnchors("descriptiontypes");
return
} else if (values.description.length > 5000) {
this.scrollToAnchors("descriptiontypes");
return
}
console.log('Received values of form: ', values);
console.log(fileList);
const course_id = this.props.match.params.coursesId;
let url = "/courses/" + course_id + "/graduation_tasks.json"
axios.post(url, {
task_type: parseInt(values.tasktype),
name: values.name,
description: values.description,
attachment_ids: listid,
}
).then((response) => {
if (response.status === 200) {
GraduationTasksnewtype = false;
// this.goback();
this.props.history.push("/courses/" + this.props.match.params.coursesId + "/graduation_tasks/" + this.props.match.params.category_id + "/" + response.data.task_id + "/setting");
}
}).catch((error) => {
console.log(error)
})
}
});
}
}
goback = () => {
let courseId = this.props.match.params.coursesId;
let category_id = this.props.match.params.category_id;
window.location.href = "/courses/" + courseId + "/graduation_tasks/" + category_id;
}
// 输入title
changeTitle = (e) => {
this.setState({
title_num: 60 - parseInt(e.target.value.length),
title_value: e.target.value
})
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
// for(var list of fileList ){
// console.log(list)
// }
this.setState({fileList});
}
onAttachmentRemove = (file) => {
// confirm({
// title: '确定要删除这个附件吗?',
// okText: '确定',
// cancelText: '取消',
// // content: 'Some descriptions',
// onOk: () => {
// this.deleteAttachment(file)
// },
// onCancel() {
// console.log('Cancel');
// },
// });
// return false;
this.setState({
Modalstype: true,
Modalstopval: '确定要删除这个附件吗?',
ModalSave: () => this.deleteAttachment(file),
ModalCancel: this.cancelAttachment
})
return false;
}
cancelAttachment = () => {
this.setState({
Modalstype: false,
Modalstopval: '确定要删除这个附件吗?',
ModalSave: "",
ModalCancel: ""
})
}
deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {})
.then((response) => {
if (response.data) {
const {status} = response.data;
if (status == 0) {
console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
//滚动
ifHasAnchorJustScorll() {
// let anchor = this.getURLStuff("anchor");
let anchor = this.state.anchor;
// console.log("anchor ", anchor);
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementById(anchor);
if (anchorElement) {
window.scrollTo(0, anchorElement.offsetTop - window.innerHeight / 2);
}
}
// 没有的话,滚动到头部
else {
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
render() {
const {getFieldDecorator} = this.props.form;
let {
coursename, coursesearch, title_num, title_value, pageType, fileList, contents, type,
Modalstype, Modalstopval, ModalCancel, ModalSave
} = this.state;
let {coursedata} = this.props;
let courseId = this.props.match.params.coursesId;
let position = this.props.match.params.position;
let category_id = this.props.match.params.category_id;
const uploadProps = {
width: 600,
fileList,
multiple: true,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
message.error('文件大小必须小于150MB!');
}
return isLt150M;
},
};
// this.ifHasAnchorJustScorll();
// console.log(this.props.current_user.course_name)
return (
<React.Fragment>
<div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
/>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
<WordsBtn style="grey" className="fl"> <Link to={"/courses/" + courseId + "/students"}
className="color-grey-6">{this.props.current_user && this.props.current_user.course_name}</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl"> <Link
to={"/courses/" + courseId + "/graduation_tasks/" + category_id} className="color-grey-6">毕设任务</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>{"新建"}</span>
</p>
<div style={{width: '100%', height: '60px'}}>
<p className=" fl color-black mt20 summaryname">新建毕设任务</p>
<a className="color-grey-6 fr font-16 ml30 mt10 mr20" onClick={this.goback}>返回</a>
</div>
<Form labelCol={{span: 5}} wrapperCol={{span: 12}}
onSubmit={GraduationTasksnewtype === true ? this.handleSubmit : ""}>
<style>
{
`.ant-form-item-label{
text-align: right;
vertical-align: middle;
padding: 0px 0px 20px 0px;
display: inline-block;
overflow: hidden;
white-space: nowrap;
line-height: 20px; */
}
if(values.name===undefined){
this.scrollToAnchors("nametypes");
return
.ant-form-item-control{
line-height: 39.9999px;
position: relative;
zoom: 1;
}
if(values.description===undefined){
this.scrollToAnchors("descriptiontypes");
return
}else if(values.description.length>5000){
this.scrollToAnchors("descriptiontypes");
return
}
console.log('Received values of form: ', values);
console.log(fileList);
const course_id=this.props.match.params.coursesId;
let url="/courses/"+course_id+"/graduation_tasks.json"
axios.post(url, {
task_type:parseInt(values.tasktype),
name:values.name,
description:values.description,
attachment_ids:listid,
}
).then((response) => {
if(response.status===200) {
GraduationTasksnewtype=false;
// this.goback();
this.props.history.push("/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+this.props.match.params.category_id+"/"+response.data.task_id+"/setting");
}
}).catch((error) => {
console.log(error)
})
}
});
}
}
goback=()=>{
let courseId=this.props.match.params.coursesId;
let category_id=this.props.match.params.category_id;
window.location.href="/courses/"+courseId+"/graduation_tasks/"+category_id;
}
// 输入title
changeTitle=(e)=>{
this.setState({
title_num:60-parseInt(e.target.value.length),
title_value:e.target.value
})
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
// for(var list of fileList ){
// console.log(list)
// }
this.setState({ fileList });
}
onAttachmentRemove = (file) => {
// confirm({
// title: '确定要删除这个附件吗?',
// okText: '确定',
// cancelText: '取消',
// // content: 'Some descriptions',
// onOk: () => {
// this.deleteAttachment(file)
// },
// onCancel() {
// console.log('Cancel');
// },
// });
// return false;
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachment(file),
ModalCancel:this.cancelAttachment
})
return false;
}
cancelAttachment=()=>{
this.setState({
Modalstype:false,
Modalstopval:'确定要删除这个附件吗?',
ModalSave:"",
ModalCancel:""
})
}
deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
//滚动
ifHasAnchorJustScorll() {
// let anchor = this.getURLStuff("anchor");
let anchor = this.state.anchor;
console.log("anchor ", anchor);
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementById(anchor);
if (anchorElement) {
window.scrollTo(0, anchorElement.offsetTop - window.innerHeight / 2);
}
}
// 没有的话,滚动到头部
else {
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
}
render(){
const { getFieldDecorator } = this.props.form;
let {coursename,coursesearch,title_num,title_value,pageType,fileList,contents,type,
Modalstype,Modalstopval,ModalCancel,ModalSave} =this.state;
let {coursedata}=this.props;
let courseId=this.props.match.params.coursesId;
let position=this.props.match.params.position;
let category_id=this.props.match.params.category_id;
const uploadProps = {
width: 600,
fileList,
multiple: true,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
message.error('文件大小必须小于150MB!');
}
return isLt150M;
},
};
this.ifHasAnchorJustScorll();
// console.log(this.props.current_user.course_name)
return(
<React.Fragment>
<div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
/>
<div className="newMain clearfix">
<div className={"educontent mb20"}>
<p className="clearfix mt10">
<WordsBtn style="grey" className="fl"> <Link to={"/courses/"+courseId+"/students"} className="color-grey-6">{this.props.current_user&&this.props.current_user.course_name}</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl"> <Link to={"/courses/"+courseId+"/graduation_tasks/"+category_id} className="color-grey-6">毕设任务</Link></WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>{"新建"}</span>
</p>
<div style={{ width:'100%',height:'75px'}} >
<p className=" fl color-black mt25 summaryname">新建毕设任务</p>
<a className="color-grey-6 fr font-16 ml30 mt10 mr20" onClick={this.goback}>返回</a>
</div>
<Form labelCol={{ span: 5 }} wrapperCol={{ span: 12 }} onSubmit={GraduationTasksnewtype===true?this.handleSubmit:""} >
{/*内容*/}
<div className="stud-class-set bor-bottom-greyE pd20 edu-back-white">
<Form.Item label="类型">
{getFieldDecorator('tasktype', {
rules: [{ required: true, message: "请选择任务类型" }],
})(<Select className={"greyInput"}
style={{width:'20%'}}
placeholder="请选择任务类型">
<Option value="1">普通</Option>
<Option value="2">分组</Option>
</Select>)}
<input type="hidden" id='tasktypes' />
<span className={"newcoursestitle"}>选择确认后无法修改</span>
</Form.Item>
<Form.Item label="任务标题" >
{getFieldDecorator('name', {
rules: [{ required: true, message: "不能为空" }],
})(<Input placeholder="请输入任务名称最大限制60个字符" value={title_value} onInput={this.changeTitle} className="searchView searchViewAfter" style={{"width":"100%"}} maxLength="60" addonAfter={String(title_num)}/>)}
</Form.Item>
<input type="hidden" id='nametypes' />
</div>
<div className="stud-class-set pd20 coursenavbox edu-back-white">
<style>{`
`
}
</style>
{/*内容*/}
<div className="stud-class-set bor-bottom-greyE pt20 pl20 pr20 edu-back-white">
<Form.Item label="类型" >
{getFieldDecorator('tasktype', {
rules: [{required: true, message: "请选择任务类型"}],
})(<Select className={"greyInput mb20"}
style={{width: '20%'}}
placeholder="请选择任务类型">
<Option value="1">普通</Option>
<Option value="2">分组</Option>
</Select>)}
<input type="hidden" id='tasktypes'/>
<span className={"newcoursestitle"}>选择确认后无法修改</span>
</Form.Item>
<Form.Item label="任务标题" >
{getFieldDecorator('name', {
rules: [{required: true, message: "不能为空"}],
})(<Input placeholder="请输入任务名称最大限制60个字符" value={title_value} onInput={this.changeTitle}
className="searchView searchViewAfter mb20 h40" style={{"width": "100%"}} maxLength="60"
addonAfter={String(title_num)}/>)}
</Form.Item>
<input type="hidden" id='nametypes'/>
</div>
<div className="stud-class-set pt20 pl20 pr20 coursenavbox edu-back-white">
<style>{`
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
@ -309,47 +339,48 @@ render(){
margin-bottom:0px
}
`}</style>
<Form.Item
label="内容"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入帖子内容',
}, {
max: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请输入任务内容说明最大限制5000个字符'}
mdID={'courseMessageMD'} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<input type="hidden" id='descriptiontypes' />
<Upload {...uploadProps} className="upload_1 ml5">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>
</Form>
</div>
</div>
</div>
</React.Fragment>
)
}
<Form.Item
label="内容"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请输入帖子内容',
}, {
max: 5000, message: '最大限制为5000个字符',
}],
})(
<TPMMDEditor ref={this.mdRef} placeholder={'请输入任务内容说明最大限制5000个字符'}
mdID={'courseMessageMD'} className="courseMessageMD"></TPMMDEditor>
)}
</Form.Item>
<input type="hidden" id='descriptiontypes'/>
<Upload {...uploadProps} className="upload_1 ml5">
<Button className="uploadBtn">
<Icon type="upload"/> 上传附件
</Button>
(单个文件150M以内)
</Upload>
</div>
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>
</Form>
</div>
</div>
</div>
</React.Fragment>
)
}
}
const GraduationTasksnewApp = Form.create({ name: 'coursesNew' })(GraduationTasksnew);
const GraduationTasksnewApp = Form.create({name: 'coursesNew'})(GraduationTasksnew);
export default GraduationTasksnewApp;

@ -49,7 +49,7 @@ function buildColumns(that) {
width: 160,
key: 'name',
render: (name, record) => {
return <a href={`login/${record.login}`} target="_blank">{name}</a>
return <a href={`/login/${record.login}`} target="_blank">{name}</a>
}
}, {
title: '角色',

@ -314,7 +314,7 @@ class CoursesNew extends Component {
}
}).then((result)=>{
this.setState({
searchlistscholl:result.data.shools_name,
searchlistscholl:result.data.school_names,
scholl:value
})
this.props.form.setFieldsValue({

@ -44,18 +44,14 @@ class Trialapplication extends Component {
componentWillReceiveProps(nextProps) {
// this.setState({
// isRenders:nextProps.isRenders
// })
// console.log("componentWillReceiveProps");
// console.log(nextProps);
}
//初始化数据
componentDidMount() {
// console.log("53");
console.log("53");
// console.log(this.props.isRenders);
console.log(this.props.isRenders);
if (this.props.isRenders != undefined) {
this.setState({
@ -78,12 +74,13 @@ class Trialapplication extends Component {
}
return response;
}, (error) => {
// // // TODO 这里如果样式变了会出现css不加载的情况
//TODO 这里如果样式变了会出现css不加载的情况
});
// console.log("89");
console.log("89");
try {
// console.log(this.state.props.user && this.state.props.user.user_phone_binded);
if (this.state.props.user !== undefined) {
console.log(this.state.props.user && this.state.props.user.user_phone_binded);
this.setState({
user_phone_binded: this.state.props.user.user_phone_binded,
})

@ -173,6 +173,8 @@ class NewHeader extends Component {
showTrial:false,
user:undefined,
}
console.log("176")
console.log(props);
}
componentDidMount() {
@ -570,7 +572,7 @@ submittojoinclass=(value)=>{
// join_course_url: "https://www.educoder.net/courses/join_course_multi_role"
// join_project_url: "https://www.educoder.net/applied_project/applied_project_info"
// rolearr:["",""],
console.log(this.props)
// console.log()
return (
<div className="newHeader" id="nHeader">
@ -581,7 +583,7 @@ submittojoinclass=(value)=>{
/>
{/* :""*/}
{/*}*/}
<Trialapplication></Trialapplication>
<Trialapplication {...this.state}></Trialapplication>
{/*{*/}
{/* isRenders&&isRenders===true?*/}

Loading…
Cancel
Save