修改样式

dev_aliyun_beta
杨树林 6 years ago
parent fc27a073be
commit ee388f88f3

@ -2101,7 +2101,7 @@ class PollNewQuestbank extends Component {
} }
//上下移到服务器中 //上下移到服务器中
Upanddownmovementof = (bool, poll_question_id) => { Upanddownmovementof = (bool, poll_question_id,index) => {
// console.log("调用了Upanddownmovementofr") // console.log("调用了Upanddownmovementofr")
// console.log(poll_question_id) // console.log(poll_question_id)
var thiss = this; var thiss = this;
@ -2111,11 +2111,22 @@ class PollNewQuestbank extends Component {
opr: "up", opr: "up",
}).then((result) => { }).then((result) => {
try { try {
if (result.data.status === 0) { if(result){
this.props.showNotification(`上移成功`); if(result.data){
thiss.thisinitializationdatanew(); if (result.data.status === 0) {
this.props.showNotification(`上移成功`);
let arr = this.state.poll_questions;
let newarr = [...arr];
let temp = newarr[index - 1];
newarr[index - 1] = newarr[index];
newarr[index] = temp;
this.setState({
poll_questions: newarr,
});
thiss.thisinitializationdatanew();
}
}
} }
// console.log(JSON.stringify(result))
} catch (e) { } catch (e) {
// console.log("上移题目成功 错误") // console.log("上移题目成功 错误")
console.log(e) console.log(e)
@ -2127,13 +2138,25 @@ class PollNewQuestbank extends Component {
axios.put(url, { axios.put(url, {
opr: "down", opr: "down",
}).then((result) => { }).then((result) => {
try { try {
if (result.data.status === 0) { if(result){
// message.success("下移题目成功", 1) if(result.data){
this.props.showNotification(`下移成功`); if (result.data.status === 0) {
thiss.thisinitializationdatanew(); // message.success("下移题目成功", 1)
this.props.showNotification(`下移成功`);
let arr = this.state.poll_questions;
let newarr = [...arr];
let temp = newarr[index + 1];
newarr[index + 1] = newarr[index];
newarr[index] = temp;
this.setState({
poll_questions: newarr,
});
thiss.thisinitializationdatanew();
}
}
} }
// console.log(JSON.stringify(result))
} catch (e) { } catch (e) {
// console.log("下移题目成功 错误") // console.log("下移题目成功 错误")
console.log(e) console.log(e)
@ -2272,17 +2295,11 @@ class PollNewQuestbank extends Component {
//点击向上排序按钮事件 //点击向上排序按钮事件
handleClickBySortUp = (index, object) => { 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) { if (index != 0) {
this.Upanddownmovementof(true, object.question.id); this.Upanddownmovementof(true, object.question.id,index);
let temp = newarr[index - 1];
newarr[index - 1] = newarr[index];
newarr[index] = temp;
this.setState({
poll_questions: newarr,
});
} }
} }
@ -2293,13 +2310,8 @@ class PollNewQuestbank extends Component {
let newarr = [...arr]; let newarr = [...arr];
// //
if (index != newarr.length - 1) { if (index != newarr.length - 1) {
this.Upanddownmovementof(false, object.question.id); this.Upanddownmovementof(false, object.question.id,index);
let temp = newarr[index + 1];
newarr[index + 1] = newarr[index];
newarr[index] = temp;
this.setState({
poll_questions: newarr,
});
} else { } else {
// console.log("2222index==arr.length"); // console.log("2222index==arr.length");
// console.log(this.state.poll_questions); // console.log(this.state.poll_questions);

Loading…
Cancel
Save