dev_aliyun_beta
杨树林 6 years ago
parent f0215eae80
commit 2087c9c306

@ -32,7 +32,7 @@ module.exports = {
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
// devtool: "cheap-module-eval-source-map",
// 开启调试
devtool: "source-map", // 开启调试
// devtool: "source-map", // 开启调试
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.

@ -466,9 +466,8 @@ class CoursesIndex extends Component{
// console.log(commons)
return (
<Switch {...this.props}>
{/*问卷编辑详情*/}
<Route path="/courses/questreediting/:workid"
{/*题库问卷编辑详情*/}
<Route path="/courses/questreediting/:workid/edit"
render={
(props) => (<PollNewQuestbank {...this.props} {...props} {...this.state} />)
}
@ -479,7 +478,7 @@ class CoursesIndex extends Component{
(props) => (<Completetaskpage {...this.props} {...props} {...this.state} />)
}
></Route>
{/*毕设内容题库详情*/}
{/*毕设选题题库详情*/}
<Route path="/courses/completetopic/:workid"
render={
(props) => (<CompletetopicdePage {...this.props} {...props} {...this.state} />)

@ -112,16 +112,16 @@ class PollNewQuestbank extends Component {
return
}
if (this.props.match.params.news !== undefined) {
if (this.props.match.params.news === "new") {
this.state.Newedit === true;
this.setState({
Newedit: true,
mysave: true,
readOnlys: "",
cancellation: true,
})
} else {
// if (this.props.match.params.news !== undefined) {
// if (this.props.match.params.news === "new") {
// this.state.Newedit === true;
// this.setState({
// Newedit: true,
// mysave: true,
// readOnlys: "",
// cancellation: true,
// })
// } else {
this.Initializatio_data();
this.state.Newedit === false;
this.setState({
@ -129,8 +129,8 @@ class PollNewQuestbank extends Component {
mysave: false,
readOnlys: "readOnly",
})
}
}
// }
// }
console.log("问卷返回");
console.log(this.props);
@ -185,7 +185,7 @@ class PollNewQuestbank extends Component {
//课堂id
let coursesId = this.props.match.params.coursesId;
//时间id
let pollid = this.props.match.params.pollid;
let pollid = this.props.match.params.workid;
console.log(pollid);
// let coursesId = 557;
if (pollid === undefined) {
@ -241,49 +241,41 @@ class PollNewQuestbank extends Component {
questionnair: false
})
} else {
const url = `/polls/${pollid}/edit.json`;
const url = `/exercise_banks/${pollid}.json`;
axios.get(url).then((result) => {
if (result !== undefined)
// console.log("有问卷~~~")
// if (result.status === 200) {
// console.log(JSON.stringify(result.data))
this.props.form.setFieldsValue({
polls_nametest: result.data.poll.polls_name,
polls_descriptiontest: result.data.poll.polls_description,
});
if(result.data){
if(result.data.poll){
if(result.data.poll.polls_name){
let num = parseInt(result.data.poll.polls_name.length);
this.setState({
addonAfter: num < 0 ? 0 : num
})
}
}
}
this.setState({
projects: result.data,
pollid: pollid,
polls_status: result.data.poll.polls_status,
polls_name: result.data.poll.polls_name,
polls_description: result.data.poll.polls_description,
poll_questions: result.data.poll_questions,
question_types: result.data.question_types,
mysingles: result.data.question_types.q_singles,
mydoubles: result.data.question_types.q_doubles,
mymainsint: result.data.question_types.q_mains,
polls_nametest: result.data.poll.polls_name,
polls_descriptiontest: result.data.poll.polls_description,
questionnair: true,
left_banner_id:result.data.left_banner_id
})
// console.log(this.state.polls_nametest)
// console.log(this.state.polls_descriptiontest)
if (result)
console.log("247");
console.log(result);
// if(result.data){
// if(result.data.poll){
// if(result.data.poll.polls_name){
// let num = parseInt(result.data.poll.polls_name.length);
// this.setState({
// addonAfter: num < 0 ? 0 : num
// })
// }
// }
//
// }
//
// this.setState({
// projects: result.data,
// pollid: pollid,
// polls_status: result.data.poll.polls_status,
// polls_name: result.data.poll.polls_name,
// polls_description: result.data.poll.polls_description,
// poll_questions: result.data.poll_questions,
// question_types: result.data.question_types,
// mysingles: result.data.question_types.q_singles,
// mydoubles: result.data.question_types.q_doubles,
// mymainsint: result.data.question_types.q_mains,
// polls_nametest: result.data.poll.polls_name,
// polls_descriptiontest: result.data.poll.polls_description,
// questionnair: true,
// left_banner_id:result.data.left_banner_id
// })
}).catch((error) => {
console.log(error)
})
@ -297,7 +289,7 @@ class PollNewQuestbank extends Component {
if (this.state.pollid !== undefined) {
pollidsy = this.state.pollid;
if (pollidsy === null || pollidsy === undefined) {
pollidsy = this.props.match.params.pollid;
pollidsy = this.props.match.params.workid;
}
}
@ -2195,7 +2187,7 @@ class PollNewQuestbank extends Component {
}
//提交题目//没有就创建新的题库新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
submitQuestionnaire = (mews) => {
submitQuestionnaire = () => {
// console.log("调用了submitQuestionnaire")
if (this.state.Newedit === true) {
@ -2212,7 +2204,7 @@ class PollNewQuestbank extends Component {
}
var pollid;
if (this.state.pollid === undefined) {
pollid = this.props.match.params.pollid;
pollid = this.props.match.params.workid;
} else {
pollid = this.state.pollid;
}
@ -2375,7 +2367,7 @@ class PollNewQuestbank extends Component {
var pollid;
if (this.state.pollid === undefined) {
pollid = this.props.match.params.pollid;
pollid = this.props.match.params.workid;
} else {
pollid = this.state.pollid;
}
@ -2433,7 +2425,7 @@ class PollNewQuestbank extends Component {
// console.log([[`${maps[polls_status && polls_status]}`]] + "");
const IsAdmin = this.props.isAdmin();
const {getFieldDecorator} = this.props.form;
// const {getFieldDecorator} = this.props.form;
const formItemLayout = {
labelCol: {
xs: {span: 24},
@ -2470,29 +2462,31 @@ class PollNewQuestbank extends Component {
<p className="clearfix mb20 mt10">
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
{
this.props.match.params.news === "new"?
<a className=" btn colorgrey fl hovercolorblue"
href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷</a>
:
{/*{*/}
{/* this.props.match.params.news === "new"?*/}
{/* <a className=" btn colorgrey fl hovercolorblue"*/}
{/* 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">&gt;</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>*/}
<span>编辑</span>
</p>
<div className="clearfix mb30">
<p
className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>
{
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>
:
{/*<p className="fl color-black summaryname mt5">{this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}</p>*/}
<p className="fl color-black summaryname mt5">编辑问卷</p>
{/*{*/}
{/* 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>
}
{/*}*/}
</div>
{/*<Form {...formItemLayout} onSubmit={this.handleSubmit}>*/}
@ -2528,15 +2522,16 @@ class PollNewQuestbank extends Component {
style={{"color": "#f5222d"}}>*</span>
</div>
{
this.props.match.params.news === undefined ? "" : this.props.match.params.news === "new" ?
(
// this.props.match.params.news === undefined ? "" : this.props.match.params.news === "new" ?
// (
this.state.mysave === false ?
<div className="fr">
<span><a onClick={() => this.adddomeditit()}><Tooltip title="编辑"><i
className="color-green font-18 iconfont icon-bianjidaibeijing"></i></Tooltip></a></span>
</div>
: "")
:""
: ""
// )
// :""
}
</div>
@ -3474,25 +3469,7 @@ class PollNewQuestbank extends Component {
{polls_status === undefined || polls_status === 1 ?
<div>
{
this.props.match.params.news === "new" ?
this.state.Newedit === false ?
<div>
<div className=" mb10"></div>
<div style={{"padding": "10px 30px 20px 30px"}}>
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
className="iconfont icon-tianjiafangda font-15 mr10"></i></ActionBtn>
<ActionBtn style="green" className="mr20" onClick={() => this.addmydoubles()}><i
className="iconfont icon-tianjiafangda font-15 mr10"></i></ActionBtn>
<ActionBtn style="green" className="mr20" onClick={() => this.addmymainsint()}><i
className="iconfont icon-tianjiafangda font-15 mr10"></i></ActionBtn>
</div>
</div>
: ""
:
<div>
<div>
<div className=" mb10"></div>
<div style={{"padding": "10px 30px 20px 30px"}}>
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
@ -3503,49 +3480,21 @@ class PollNewQuestbank extends Component {
className="iconfont icon-tianjiafangda font-15 mr10"></i></ActionBtn>
</div>
</div>
}
</div>
: <div></div>}
</div>
</div>
{
this.props.match.params.news === "new" ?
(this.state.Newedit === false ?
<div
style={{
"display": "flex",
"justify-content": "center",
"align-items": "center",
"width": "100%",
}}
>
<li className="clearfix mt30 mb50">
<a className="defalutCancelbtn fl mr20" onClick={() => this.props.history.goBack()}>取消</a>
<a type="primary" className="defalutSubmitbtn fl"
onClick={() => this.submitQuestionnaire(this.props.match.params.news)}>提交</a>
</li>
</div>
: "")
:
<div
style={{
"display": "flex",
"justify-content": "center",
"align-items": "center",
"width": "100%",
}}
>
<li className="clearfix mt30 mb50">
<a className="defalutCancelbtn fl mr20"onClick={() => this.props.history.goBack()}>取消</a>
<a type="primary" className=" defalutSubmitbtn fl"
onClick={() => this.submitQuestionnaire(this.props.match.params.news)}>提交</a>
</li>
</div>
}
<div
style={{
"width": "100%",
}}
>
<li className="clearfix mt30 mb50 fl">
<a className="defalutCancelbtn fl mr20"onClick={() => this.props.history.goBack()}>取消</a>
<a type="primary" className=" defalutSubmitbtn fl"
onClick={() => this.submitQuestionnaire()}>提交</a>
</li>
</div>
{/*</Form>*/}
</div>
<div ref='targetElement'></div>
@ -3557,3 +3506,58 @@ class PollNewQuestbank extends Component {
// RouteHOC()
export default PollNewQuestbank
{/*<div>*/}
{/* {*/}
{/* this.props.match.params.news === "new" ?*/}
{/* this.state.Newedit === false ?*/}
{/* <div>*/}
{/* <div className=" mb10"></div>*/}
{/* <div style={{"padding": "10px 30px 20px 30px"}}>*/}
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i*/}
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>*/}
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmydoubles()}><i*/}
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>多选题</ActionBtn>*/}
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmymainsint()}><i*/}
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>主观题</ActionBtn>*/}
{/* </div>*/}
{/* </div>*/}
{/* : ""*/}
{/* :*/}
{/* <div>*/}
{/* <div className=" mb10"></div>*/}
{/* <div style={{"padding": "10px 30px 20px 30px"}}>*/}
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i*/}
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>单选题</ActionBtn>*/}
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmydoubles()}><i*/}
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>多选题</ActionBtn>*/}
{/* <ActionBtn style="green" className="mr20" onClick={() => this.addmymainsint()}><i*/}
{/* className="iconfont icon-tianjiafangda font-15 mr10"></i>主观题</ActionBtn>*/}
{/* </div>*/}
{/* </div>*/}
{/* }*/}
{/*</div>*/}
{/*{*/}
{/* this.props.match.params.news === "new" ?*/}
{/* (this.state.Newedit === false ?*/}
{/* <div*/}
{/* style={{*/}
{/* "display": "flex",*/}
{/* "justify-content": "center",*/}
{/* "align-items": "center",*/}
{/* "width": "100%",*/}
{/* }}*/}
{/* >*/}
{/* <li className="clearfix mt30 mb50">*/}
{/* <a className="defalutCancelbtn fl mr20" onClick={() => this.props.history.goBack()}>取消</a>*/}
{/* <a type="primary" className="defalutSubmitbtn fl"*/}
{/* onClick={() => this.submitQuestionnaire(this.props.match.params.news)}>提交</a>*/}
{/* </li>*/}
{/* </div>*/}
{/* : "")*/}
{/* :*/}
{/* */}
{/*}*/}

@ -457,7 +457,7 @@ class InfosTopics extends Component{
<a className="btn colorblue mr25 font-16 fr"
href={category==="normal"?`/courses/ordinarywork/${item.id}?tab=0`:
category==="group"?`/courses/groupingwork/${item.id}?tab=0`:
category==="poll"?`/courses/poll/${item.id}`:
category==="poll"?`/courses/questreediting/${item.id}/edit`:
category==="exercise"?`/courses/poll/${item.id}`:
category==="gtask"?`/courses/completetask/${item.id}`:
category==="gtopic"?`/courses/completetopic/${item.id}`:""

Loading…
Cancel
Save