dev_forum
杨树林 5 years ago
parent 2d89702df2
commit 7ee531ac47

@ -94,7 +94,7 @@ class PollNew extends Component {
// 初始化数据
componentDidMount = () => {
console.log("componentDidMount 50")
// console.log("componentDidMount 50")
if (this.props.match.params.news !== undefined) {
if (this.props.match.params.news === "new") {
this.state.Newedit === true;
@ -137,12 +137,12 @@ class PollNew extends Component {
// }
//初始化请求网络
Initializatio_data = () => {
console.log("Initializatio_data 582")
// console.log("Initializatio_data 582")
//课堂id
let coursesId = this.props.match.params.coursesId;
//时间id
let pollid = this.props.match.params.pollid;
console.log(pollid);
// console.log(pollid);
// let coursesId = 557;
if (pollid === undefined) {
// console.log("没有问卷新建问卷~~~")
@ -223,8 +223,8 @@ class PollNew extends Component {
polls_descriptiontest: result.data.poll.polls_description,
questionnair: true,
})
console.log(this.state.polls_nametest)
console.log(this.state.polls_descriptiontest)
// console.log(this.state.polls_nametest)
// console.log(this.state.polls_descriptiontest)
// }
}).catch((error) => {
console.log(error)
@ -321,7 +321,7 @@ class PollNew extends Component {
//添加多选题目
addmydoubles = () => {
console.log("addmymainsint 70")
// console.log("addmymainsint 70")
if (this.state.newoption === true) {
this.setState({
newoption: false
@ -361,7 +361,7 @@ class PollNew extends Component {
//编辑方法
adddomedit = (object) => {
console.log("adddomedit 76");
// console.log("adddomedit 76");
if (this.state.q_countst > 0) {
this.props.showNotification(`不能同时编辑两题`);
@ -512,11 +512,12 @@ class PollNew extends Component {
//新增添加题目 有new
addMytopic = (index, pollid, Insertposition, Whether, id) => {
//Whether 是否插入
// console.log("id")
// console.log(id)
// console.log("Whether")
// console.log("addMytopic 90")
// console.log(index)
// console.log(pollid)
// console.log(Insertposition)
// console.log(Whether)
console.log("addMytopic 90")
// console.log(id)
if (this.state.q_countst > 0) {
this.props.showNotification(`不能同时编辑两题`);
@ -718,7 +719,7 @@ class PollNew extends Component {
//删除指定条目
deleteadddom = (indexo) => {
console.log("deleteadddom 259")
// console.log("deleteadddom 259")
var arr = this.state.adddom;
let newarr = [...arr];
@ -758,7 +759,7 @@ class PollNew extends Component {
}
}
} catch (e) {
console.log("PollNew281")
// console.log("PollNew281")
console.log(e)
}
}
@ -1004,7 +1005,7 @@ class PollNew extends Component {
//////////////////////////////////////////////////////////////////////////////////////////////////// 上面是新增
} else {
///////////////////////////////////////////////////////////////////////////////////////////////////修改点了编辑
console.log("点了编辑")
// console.log("点了编辑")
var uuk = -1
//这个地方判断 点了编辑上面题目又把他删除了 保存的时候就只能是插入新增了
for (var uk = 0; uk < newarrpoll.length; uk++) {
@ -1130,15 +1131,15 @@ class PollNew extends Component {
//
// }
if (uuk !== -1) {
console.log("修改")
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
newarrpoll.splice(uuk, 1, question);
} else {
console.log("删除")
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
newarrpoll.push(question);
}
console.log(newarrpoll)
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
} else if (object.question.question_type === 3) {
//插入主观题
@ -1176,15 +1177,15 @@ class PollNew extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
console.log("修改")
// console.log("修改")
this.edittotheserver(object, 3, null, null, 0, 0);
newarrpoll.splice(uuk, 1, question);
} else {
console.log("删除")
// console.log("删除")
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
newarrpoll.push(question);
}
console.log(newarrpoll)
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
}
@ -1453,7 +1454,7 @@ class PollNew extends Component {
for (var uk = 0; uk < newarrpoll.length; uk++) {
if (object.question.id === newarrpoll[uk].question.id) {
uuk = uk;
console.log("删除了数据=-09876543234567890-111111111111")
// console.log("删除了数据=-09876543234567890-111111111111")
}
}
@ -1501,15 +1502,15 @@ class PollNew extends Component {
};
question = {"question": questiontwo};
if (uuk !== -1) {
console.log("修改")
// console.log("修改")
this.edittotheserver(object, 1, arrc, null, 0, 0);
newarrpoll.splice(uuk, 1, question);
} else {
console.log("删除")
// console.log("删除")
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id);
newarrpoll.push(question);
}
console.log(newarrpoll)
// console.log(newarrpoll)
} else if (object.question.question_type === 2) {
//插入多选题
if (object.question.max_choices < object.question.min_choices) {
@ -1557,15 +1558,15 @@ class PollNew extends Component {
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
console.log("修改")
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
newarrpoll.splice(uuk, 1, question);
} else {
console.log("删除")
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
newarrpoll.push(question);
}
console.log(newarrpoll)
// console.log(newarrpoll)
} else if (object.question.question_type === 3) {
//插入主观题
@ -1602,15 +1603,15 @@ class PollNew extends Component {
};
question = {"question": questiontwo};
if (uuk !== -1) {
console.log("修改")
// console.log("修改")
this.edittotheserver(object, 3, null, null, 0, 0);
newarrpoll.splice(uuk, 1, question);
} else {
console.log("删除")
// console.log("删除")
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
newarrpoll.push(question);
}
console.log(newarrpoll)
// console.log(newarrpoll)
}
@ -1693,7 +1694,7 @@ class PollNew extends Component {
}
///编辑修改到服务器当中
edittotheserver = (object, number, option, other, max_choices, min_choices) => {
console.log("调用了edittotheserver")
// console.log("调用了edittotheserver")
var url = `/poll_questions/${object.question.id}.json`
var thiss = this;
axios.put(url, {
@ -1720,7 +1721,7 @@ class PollNew extends Component {
//删除到服务器当中
eletetoserver = (pollid, newarr, type, index) => {
console.log("调用了eletetoserver")
// console.log("调用了eletetoserver")
var id = pollid;
var url = `/poll_questions/${id}.json`
let {mysingles, mydoubles, mymainsint} = this.state
@ -1729,7 +1730,7 @@ class PollNew extends Component {
axios
.delete(url, {})
.then(function (response) {
console.log(response)
// console.log(response)
if (response === undefined) {
return;
}
@ -1774,7 +1775,7 @@ class PollNew extends Component {
}
// console.log(JSON.stringify(result))
} catch (e) {
console.log("上移题目成功 错误")
// console.log("上移题目成功 错误")
console.log(e)
}
@ -1792,7 +1793,7 @@ class PollNew extends Component {
}
// console.log(JSON.stringify(result))
} catch (e) {
console.log("下移题目成功 错误")
// console.log("下移题目成功 错误")
console.log(e)
}
})
@ -1804,8 +1805,8 @@ class PollNew extends Component {
//id 条目的唯一id
//i 为要删除的子条目
deleteentrys = (id, i, stirngname) => {
console.log(id)
console.log(stirngname);
// console.log(id)
// console.log(stirngname);
var arrtwoy = this.state.adddom;
let newarrtwoy = [...arrtwoy];
for (var k = 0; k < newarrtwoy.length; k++) {
@ -1822,14 +1823,14 @@ class PollNew extends Component {
}
}
if (stirngname === true) {
console.log(stirngname);
// console.log(stirngname);
this.setState({
newoption: false,
adddom: newarrtwoy,
})
} else {
console.log(stirngname);
// console.log(stirngname);
this.setState({
adddom: newarrtwoy,
});
@ -1841,8 +1842,8 @@ class PollNew extends Component {
// 新增选项
ewoption = (id, object) => {
console.log("ewoption 440")
console.log("是否是新建题目还是编辑")
// console.log("ewoption 440")
// console.log("是否是新建题目还是编辑")
// console.log(object.question.new)
@ -1903,10 +1904,10 @@ class PollNew extends Component {
//新增其他选项
addanotheroption = (id) => {
console.log("addanotheroption 457")
// console.log("addanotheroption 457")
let arrtwo = this.state.adddom;
let newarrtwo = [...arrtwo];
console.log(newarrtwo)
// console.log(newarrtwo)
for (var k = 0; k < newarrtwo.length; k++) {
if (newarrtwo[k] != undefined) {
if (newarrtwo[k].question.id === id) {
@ -1928,10 +1929,10 @@ class PollNew extends Component {
//点击向上排序按钮事件
handleClickBySortUp = (index, object) => {
console.log("handleClickBySortUp 521")
// console.log("handleClickBySortUp 521")
let arr = this.state.poll_questions;
let newarr = [...arr];
console.log(newarr)
// console.log(newarr)
if (index != 0) {
this.Upanddownmovementof(true, object.question.id);
let temp = newarr[index - 1];
@ -1945,7 +1946,7 @@ class PollNew extends Component {
//点击向下排序按钮事件
handleClickBySortDown = (index, object) => {
console.log("handleClickBySortDown 536")
// console.log("handleClickBySortDown 536")
let arr = this.state.poll_questions;
let newarr = [...arr];
//
@ -1958,16 +1959,16 @@ class PollNew extends Component {
poll_questions: newarr,
});
} else {
console.log("2222index==arr.length");
console.log(this.state.poll_questions);
// console.log("2222index==arr.length");
// console.log(this.state.poll_questions);
}
}
//点击删除按钮事件
handleClickByDelete = (type, index, object) => {
console.log("handleClickByDelete 556")
console.log("object.question.id")
console.log(object.question.id)
// console.log("handleClickByDelete 556")
// console.log("object.question.id")
// console.log(object.question.id)
let arr = this.state.poll_questions;
let newarr = [...arr];
this.eletetoserver(object.question.id, newarr, type, index)
@ -1979,11 +1980,11 @@ class PollNew extends Component {
//i外层数组
//k为内层数组
handleInputChanges = (e, i, k) => {
console.log("handleInputChanges 612")
// console.log("handleInputChanges 612")
let value = e.target.value;//取到input的数据
console.log("handleInputChanges value is :" + value);
console.log(k);
// console.log("handleInputChanges value is :" + value);
// console.log(k);
let arr = this.state.adddom;
let newarr = [...arr];
@ -1996,11 +1997,11 @@ class PollNew extends Component {
//标题输入监听
handleInputTopic = (e, i) => {
console.log("handleInputTopic 633")
// console.log("handleInputTopic 633")
let value = e.target.value;//取到input的数据
console.log("handleInputTopic value is :" + value);
console.log(i);
// console.log("handleInputTopic value is :" + value);
// console.log(i);
let arr = this.state.adddom;
let newarr = [...arr];
newarr[i].question.question_title = value
@ -2063,7 +2064,7 @@ class PollNew extends Component {
//提交题目//没有就创建新的题库新建问newz题和保存题目不一样不能同时保存 这里只是新建 和编辑 标题和须知
submitQuestionnaire = (mews) => {
console.log("调用了submitQuestionnaire")
// console.log("调用了submitQuestionnaire")
if (this.state.Newedit === true) {
this.newword();
@ -2120,7 +2121,7 @@ class PollNew extends Component {
}
savedelete = (question_type, index, item) => {
console.log("savedelete");
// console.log("savedelete");
this.handleClickByDelete(question_type, index, item);
this.setState({
Modalstype: false,
@ -2141,8 +2142,8 @@ class PollNew extends Component {
}
//必答选项
onCheckAllChange = (e, index) => {
console.log("onCheckAllChange");
console.log(e.target.checked);
// console.log("onCheckAllChange");
// console.log(e.target.checked);
// console.log(e.target.value);
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
@ -2536,7 +2537,7 @@ class PollNew extends Component {
{this.state.adddom === undefined ? "" : this.state.adddom.map((itemo, indexo) => {
// console.log('打印this.state.adddom')
// console.log(itemo.question)
// console.log(this.state.adddom);
let arrid = itemo.question.id;
let resultDomtwo;
resultDomtwo =
@ -2769,7 +2770,7 @@ class PollNew extends Component {
this.props.match.params.news === "new" ?
this.state.Newedit === false ?
<div>
<div className=" mb10" style={{"border-bottom": "1px solid #eee"}}></div>
<div className=" mb10" style={this.state.adddom === undefined?{"border-bottom": "0.5px solid #ffffff"}:this.state.adddom.length <1? {"border-bottom": "0.5px solid #ffffff"}:{"border-bottom": "0.5px solid #eee"}}></div>
<div style={{"padding": "10px 30px 20px 30px"}}>
<ActionBtn style="green" className="mr20" onClick={() => this.addmysingles()}><i
@ -2784,7 +2785,7 @@ class PollNew extends Component {
: ""
:
<div>
<div className=" mb10" style={{"border-bottom": "1px solid #eee"}}></div>
<div className=" mb10" style={this.state.adddom === undefined? {"border-bottom": "0.5px solid #ffffff"}:this.state.adddom.length <1? {"border-bottom": "0.5px solid #ffffff"}:{"border-bottom": "0.5px solid #eee"}}></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>

Loading…
Cancel
Save