|
|
@ -65,6 +65,8 @@ class PollNew extends Component {
|
|
|
|
cancellation: false,
|
|
|
|
cancellation: false,
|
|
|
|
bindingid:undefined,
|
|
|
|
bindingid:undefined,
|
|
|
|
Newdisplay:false,
|
|
|
|
Newdisplay:false,
|
|
|
|
|
|
|
|
first_category_url:"",
|
|
|
|
|
|
|
|
left_banner_id:"",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// console.log("试卷新建和编辑");
|
|
|
|
// console.log("试卷新建和编辑");
|
|
|
|
// console.log(JSON.stringify(props));
|
|
|
|
// console.log(JSON.stringify(props));
|
|
|
@ -72,6 +74,7 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
changeTopicName = (e) => {
|
|
|
|
changeTopicName = (e) => {
|
|
|
|
|
|
|
|
console.log("调用了changeTopicName");
|
|
|
|
let num = 60 - parseInt(e.target.value.length);
|
|
|
|
let num = 60 - parseInt(e.target.value.length);
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
addonAfter: num < 0 ? 0 : num
|
|
|
|
addonAfter: num < 0 ? 0 : num
|
|
|
@ -124,8 +127,35 @@ class PollNew extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
console.log("问卷返回");
|
|
|
|
console.log("问卷返回");
|
|
|
|
console.log(this.props);
|
|
|
|
console.log(this.props);
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if(this.props.current_user!==undefined){
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
first_category_url :this.props.current_user.first_category_url,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log("=======================");
|
|
|
|
|
|
|
|
console.log(this.props.current_user.first_category_url);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
console.log("12312312312")
|
|
|
|
|
|
|
|
console.log(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
componentDidUpdate = (prevProps) => {
|
|
|
|
|
|
|
|
// console.log("componentDidUpdate");
|
|
|
|
|
|
|
|
// console.log(prevProps);
|
|
|
|
|
|
|
|
// console.log(this.props);
|
|
|
|
|
|
|
|
if(prevProps.current_user!=this.props.current_user){
|
|
|
|
|
|
|
|
if(this.props.current_user!==undefined){
|
|
|
|
|
|
|
|
// console.log(this.props.current_user.login);
|
|
|
|
|
|
|
|
// console.log(prevProps.current_user.login);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
first_category_url :this.props.current_user.first_category_url,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取权限
|
|
|
|
//获取权限
|
|
|
|
// getPollInfo(){
|
|
|
|
// getPollInfo(){
|
|
|
|
// // console.log(this.props.match);
|
|
|
|
// // console.log(this.props.match);
|
|
|
@ -144,12 +174,12 @@ class PollNew extends Component {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//初始化请求网络
|
|
|
|
//初始化请求网络
|
|
|
|
Initializatio_data = () => {
|
|
|
|
Initializatio_data = () => {
|
|
|
|
// console.log("Initializatio_data 582")
|
|
|
|
console.log("Initializatio_data 582")
|
|
|
|
//课堂id
|
|
|
|
//课堂id
|
|
|
|
let coursesId = this.props.match.params.coursesId;
|
|
|
|
let coursesId = this.props.match.params.coursesId;
|
|
|
|
//时间id
|
|
|
|
//时间id
|
|
|
|
let pollid = this.props.match.params.pollid;
|
|
|
|
let pollid = this.props.match.params.pollid;
|
|
|
|
// console.log(pollid);
|
|
|
|
console.log(pollid);
|
|
|
|
// let coursesId = 557;
|
|
|
|
// let coursesId = 557;
|
|
|
|
if (pollid === undefined) {
|
|
|
|
if (pollid === undefined) {
|
|
|
|
// console.log("没有问卷新建问卷~~~")
|
|
|
|
// console.log("没有问卷新建问卷~~~")
|
|
|
@ -215,6 +245,19 @@ class PollNew extends Component {
|
|
|
|
polls_nametest: result.data.poll.polls_name,
|
|
|
|
polls_nametest: result.data.poll.polls_name,
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(result.data){
|
|
|
|
|
|
|
|
if(result.data.poll){
|
|
|
|
|
|
|
|
if(result.data.poll.polls_name){
|
|
|
|
|
|
|
|
let num = 60 - parseInt(result.data.poll.polls_name.length);
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
addonAfter: num < 0 ? 0 : num
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
projects: result.data,
|
|
|
|
projects: result.data,
|
|
|
|
pollid: pollid,
|
|
|
|
pollid: pollid,
|
|
|
@ -229,6 +272,7 @@ class PollNew extends Component {
|
|
|
|
polls_nametest: result.data.poll.polls_name,
|
|
|
|
polls_nametest: result.data.poll.polls_name,
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
polls_descriptiontest: result.data.poll.polls_description,
|
|
|
|
questionnair: true,
|
|
|
|
questionnair: true,
|
|
|
|
|
|
|
|
left_banner_id:result.data.left_banner_id
|
|
|
|
})
|
|
|
|
})
|
|
|
|
// console.log(this.state.polls_nametest)
|
|
|
|
// console.log(this.state.polls_nametest)
|
|
|
|
// console.log(this.state.polls_descriptiontest)
|
|
|
|
// console.log(this.state.polls_descriptiontest)
|
|
|
@ -2338,10 +2382,13 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gotohome=()=>{
|
|
|
|
gotohome=()=>{
|
|
|
|
// const { current_user} = this.props
|
|
|
|
// const { current_user} = this.props
|
|
|
|
|
|
|
|
if(this.state.first_category_url){
|
|
|
|
|
|
|
|
window.location.href=this.state.first_category_url;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.props.history.goBack();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// this.props.history.push(current_user && current_user.first_category_url);
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
this.props.history.goBack()
|
|
|
|
|
|
|
|
// let courseId=this.props.match.params.coursesId;
|
|
|
|
// let courseId=this.props.match.params.coursesId;
|
|
|
|
// if(courseId===undefined){
|
|
|
|
// if(courseId===undefined){
|
|
|
|
// this.props.history.push("/courses");
|
|
|
|
// this.props.history.push("/courses");
|
|
|
@ -2360,6 +2407,7 @@ class PollNew extends Component {
|
|
|
|
readOnlys,
|
|
|
|
readOnlys,
|
|
|
|
newoption,
|
|
|
|
newoption,
|
|
|
|
cancellation,
|
|
|
|
cancellation,
|
|
|
|
|
|
|
|
left_banner_id
|
|
|
|
} = this.state
|
|
|
|
} = this.state
|
|
|
|
//获取老师权限
|
|
|
|
//获取老师权限
|
|
|
|
// console.log("[`${maps[polls_status && polls_status]}`]]");
|
|
|
|
// console.log("[`${maps[polls_status && polls_status]}`]]");
|
|
|
@ -2404,16 +2452,30 @@ class PollNew extends Component {
|
|
|
|
<p className="clearfix mb20 mt10">
|
|
|
|
<p className="clearfix mb20 mt10">
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this.props.match.params.news === "new"?
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue"
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue"
|
|
|
|
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
|
|
|
|
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
<a className=" btn colorgrey fl hovercolorblue"
|
|
|
|
|
|
|
|
href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}>问卷</a>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
|
|
|
<span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span>
|
|
|
|
<span>{this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}</span>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
<div className="clearfix mb30">
|
|
|
|
<div className="clearfix mb30">
|
|
|
|
<p
|
|
|
|
<p
|
|
|
|
className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>
|
|
|
|
className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>
|
|
|
|
<a onClick={()=>this.gotohome()}
|
|
|
|
{
|
|
|
|
|
|
|
|
this.props.match.params.news === "new" ?
|
|
|
|
|
|
|
|
<a href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}
|
|
|
|
|
|
|
|
className=" fr font-16">返回</a>
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
<a href={`/courses/${this.props.match.params.coursesId}/polls/${left_banner_id}`}
|
|
|
|
className=" fr font-16">返回</a>
|
|
|
|
className=" fr font-16">返回</a>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
|
|
|
|
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
|
|
|
@ -2461,12 +2523,13 @@ class PollNew extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/*addonAfter={String(addonAfter)}*/}
|
|
|
|
<Input placeholder="请输入问卷标题,最大限制60个字符" maxLength="60"
|
|
|
|
<Input placeholder="请输入问卷标题,最大限制60个字符" maxLength="60"
|
|
|
|
style={{"margin-top": "15px", "text-align": "left"}}
|
|
|
|
style={{"margin-top": "15px", "text-align": "left"}}
|
|
|
|
onInput={this.changeTopicName}
|
|
|
|
onInput={this.changeTopicName}
|
|
|
|
readOnly={readOnlys}
|
|
|
|
readOnly={readOnlys}
|
|
|
|
autoComplete="off" addonAfter={String(addonAfter)}
|
|
|
|
autoComplete="off"
|
|
|
|
|
|
|
|
suffix={String(addonAfter)+"/60"}
|
|
|
|
value={this.state.polls_nametest}
|
|
|
|
value={this.state.polls_nametest}
|
|
|
|
className="searchViewAfter"></Input>
|
|
|
|
className="searchViewAfter"></Input>
|
|
|
|
|
|
|
|
|
|
|
|