|
|
@ -8,6 +8,8 @@ import Bullsubdirectory from "./Bullsubdirectory";
|
|
|
|
import moment from "../new/CoursesNew";
|
|
|
|
import moment from "../new/CoursesNew";
|
|
|
|
import Fileslistitem from "../Resource/Fileslistitem";
|
|
|
|
import Fileslistitem from "../Resource/Fileslistitem";
|
|
|
|
// 公告栏
|
|
|
|
// 公告栏
|
|
|
|
|
|
|
|
// var isOnComposition = false;
|
|
|
|
|
|
|
|
// const isChrome = !!window.chrome && !!window.chrome.webstore
|
|
|
|
class Eduinforms extends Component{
|
|
|
|
class Eduinforms extends Component{
|
|
|
|
constructor(props){
|
|
|
|
constructor(props){
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
@ -18,7 +20,7 @@ class Eduinforms extends Component{
|
|
|
|
isSpin:true,
|
|
|
|
isSpin:true,
|
|
|
|
whethertoedit:false,
|
|
|
|
whethertoedit:false,
|
|
|
|
addonAfter:0,
|
|
|
|
addonAfter:0,
|
|
|
|
eduintit:"",
|
|
|
|
eduintits:"",
|
|
|
|
informs:[],
|
|
|
|
informs:[],
|
|
|
|
yslbool:false,
|
|
|
|
yslbool:false,
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -90,7 +92,7 @@ class Eduinforms extends Component{
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
whethertoedit:bians,
|
|
|
|
whethertoedit:bians,
|
|
|
|
description:"",
|
|
|
|
description:"",
|
|
|
|
eduintit:"",
|
|
|
|
eduintits:"",
|
|
|
|
addonAfter:0,
|
|
|
|
addonAfter:0,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
@ -106,21 +108,51 @@ class Eduinforms extends Component{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
changeTopicName = (e) => {
|
|
|
|
changeTopicName = (e) => {
|
|
|
|
console.log("调用了changeTopicName");
|
|
|
|
console.log("调用了changeTopicName");
|
|
|
|
let num = parseInt(e.target.value.length);
|
|
|
|
let num = e.target.value.length;
|
|
|
|
if(num>60){
|
|
|
|
if(num>60){
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
addonAfter: num < 0 ? 0 : num
|
|
|
|
addonAfter: num < 0 ? 0 : num
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
if(num<=60){
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
eduintit: e.target.value
|
|
|
|
eduintits: e.target.value
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
this.props.form.setFieldsValue({
|
|
|
|
eduintits: e.target.value,
|
|
|
|
eduintits: e.target.value,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// handleComposition=(e)=>{
|
|
|
|
|
|
|
|
// if (e.type === 'compositionend') {
|
|
|
|
|
|
|
|
// // composition is end
|
|
|
|
|
|
|
|
// isOnComposition = false
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (!isOnComposition && isChrome) {
|
|
|
|
|
|
|
|
// // fire onChange
|
|
|
|
|
|
|
|
// console.log(!isOnComposition);
|
|
|
|
|
|
|
|
// this.changeTopicName(e);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // in composition
|
|
|
|
|
|
|
|
// isOnComposition = true
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// handleComposition = (e) => {
|
|
|
|
|
|
|
|
// console.log(e.type + ": " + e.target.value);
|
|
|
|
|
|
|
|
// if (e.type === 'compositionend') {
|
|
|
|
|
|
|
|
// // composition is end
|
|
|
|
|
|
|
|
// const value = e.target.value;
|
|
|
|
|
|
|
|
// this.setState({ isOnComposition: false },()=>{
|
|
|
|
|
|
|
|
// // this.handleFixedChange(value);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // in composition
|
|
|
|
|
|
|
|
// this.setState({ isOnComposition: true });
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
handleSubmit=(e) => {
|
|
|
|
handleSubmit=(e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
this.props.form.validateFields((err, values) => {
|
|
|
|
this.props.form.validateFields((err, values) => {
|
|
|
@ -137,10 +169,24 @@ class Eduinforms extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var id=this.props.match.params.coursesId
|
|
|
|
var id=this.props.match.params.coursesId
|
|
|
|
|
|
|
|
var titname="";
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if(values.eduintits.length>0){
|
|
|
|
|
|
|
|
if( values.eduintits.length>60){
|
|
|
|
|
|
|
|
var str=values.eduintits;
|
|
|
|
|
|
|
|
titname=str.substring(0,60);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
titname=values.eduintits;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
titname=values.eduintits;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
titname=values.eduintits;
|
|
|
|
|
|
|
|
}
|
|
|
|
var url = `/courses/${id}/new_informs.json`;
|
|
|
|
var url = `/courses/${id}/new_informs.json`;
|
|
|
|
axios.post(url,{
|
|
|
|
axios.post(url,{
|
|
|
|
name:values.eduintits,
|
|
|
|
name:titname,
|
|
|
|
description:values.description,
|
|
|
|
description:values.description,
|
|
|
|
}).then((result) => {
|
|
|
|
}).then((result) => {
|
|
|
|
if(result){
|
|
|
|
if(result){
|
|
|
@ -172,7 +218,7 @@ class Eduinforms extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
render(){
|
|
|
|
let{description,whethertoedit,addonAfter,eduintit,informs,yslbool} =this.state;
|
|
|
|
let{description,whethertoedit,addonAfter,eduintits,informs,yslbool} =this.state;
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
return(
|
|
|
@ -234,8 +280,6 @@ class Eduinforms extends Component{
|
|
|
|
{getFieldDecorator('eduintits', {
|
|
|
|
{getFieldDecorator('eduintits', {
|
|
|
|
rules: [{
|
|
|
|
rules: [{
|
|
|
|
required: true, message: '请在此输入标题,最多60个字符',
|
|
|
|
required: true, message: '请在此输入标题,最多60个字符',
|
|
|
|
}, {
|
|
|
|
|
|
|
|
max: 60, message: '最大限制为60个字符',
|
|
|
|
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
})(
|
|
|
|
})(
|
|
|
|
<div className="ysleduinwh">
|
|
|
|
<div className="ysleduinwh">
|
|
|
@ -243,12 +287,12 @@ class Eduinforms extends Component{
|
|
|
|
<span className="yslduincolorred">*</span>
|
|
|
|
<span className="yslduincolorred">*</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="yslduinleft">
|
|
|
|
<div className="yslduinleft">
|
|
|
|
<Input placeholder="请在此输入标题,最多60个字符" maxLength="60"
|
|
|
|
<Input placeholder="请在此输入标题,最多60个字符" maxLength={60}
|
|
|
|
style={{ textAlign: "left",width:"100%",}}
|
|
|
|
style={{ textAlign: "left",width:"100%",}}
|
|
|
|
onInput={this.changeTopicName}
|
|
|
|
onInput={this.changeTopicName}
|
|
|
|
autoComplete="off"
|
|
|
|
autoComplete="off"
|
|
|
|
suffix={String(addonAfter)+"/60"}
|
|
|
|
suffix={String(addonAfter)+"/60"}
|
|
|
|
value={eduintit}
|
|
|
|
value={eduintits}
|
|
|
|
className="searchViewAfter"></Input>
|
|
|
|
className="searchViewAfter"></Input>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|