|
@@ -19,6 +19,8 @@ Page({
|
|
|
json.currentAnswer = e.detail.value;
|
|
|
json.id = e.currentTarget.dataset.idx;
|
|
|
json.questType = e.currentTarget.dataset.questtypes;
|
|
|
+ console.log(json, "josnsosjosjdosdjsodjsod");
|
|
|
+
|
|
|
this.data.chooseValue[this.data.index] = json;
|
|
|
const items = this.data.questionList[this.data.index].QuestChoice
|
|
|
for (let i = 0, len = items.length; i < len; ++i) {
|
|
@@ -38,16 +40,15 @@ Page({
|
|
|
checkboxChange: function (e) {
|
|
|
console.log(e)
|
|
|
const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
|
|
|
- console.log(questionList,'我是选项');
|
|
|
+ console.log(questionList, '我是选项');
|
|
|
console.log(this.data.index)
|
|
|
- let data=questionList[this.data.index].QuestChoice;
|
|
|
+ let data = questionList[this.data.index].QuestChoice;
|
|
|
let json = {};
|
|
|
- let list=e.detail.value;
|
|
|
- let valueData=[];
|
|
|
- data.map(ite=>{
|
|
|
- list.map(items=>{
|
|
|
- if(ite.name==items)
|
|
|
- {
|
|
|
+ let list = e.detail.value;
|
|
|
+ let valueData = [];
|
|
|
+ data.map(ite => {
|
|
|
+ list.map(items => {
|
|
|
+ if (ite.name == items) {
|
|
|
valueData.push(ite.name)
|
|
|
}
|
|
|
})
|
|
@@ -56,6 +57,8 @@ Page({
|
|
|
json.currentAnswer = aa;
|
|
|
json.questType = e.currentTarget.dataset.questtypes;
|
|
|
json.id = e.currentTarget.dataset.idx;
|
|
|
+ console.log(json, "chexboxsssssssssssssssssss");
|
|
|
+
|
|
|
this.data.chooseValue[this.data.index] = json;
|
|
|
const items = this.data.questionList[this.data.index].QuestChoice
|
|
|
const values = e.detail.value
|
|
@@ -135,8 +138,8 @@ Page({
|
|
|
})
|
|
|
if (wx.getStorageSync('questionList' + wx.getStorageSync('answersId'))) {
|
|
|
const questionList = wx.getStorageSync('questionList' + wx.getStorageSync('answersId'));
|
|
|
- console.log(questionList,"大阪烧");
|
|
|
-
|
|
|
+ console.log(questionList, "大阪烧");
|
|
|
+
|
|
|
const titleINDEX = wx.getStorageSync('titleINDEX' + wx.getStorageSync('answersId'));
|
|
|
const chooseValue = wx.getStorageSync('chooseValue' + wx.getStorageSync('answersId'));
|
|
|
console.log(wx.getStorageSync('questionList' + wx.getStorageSync('answersId')))
|
|
@@ -214,7 +217,7 @@ Page({
|
|
|
console.log(this.data.questionList)
|
|
|
wx.setStorageSync('titleINDEX' + wx.getStorageSync('answersId'), 0);
|
|
|
wx.setStorageSync('chooseValue' + wx.getStorageSync('answersId'), []),
|
|
|
- wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
|
|
|
+ wx.setStorageSync('questionList' + wx.getStorageSync('answersId'), this.data.questionList);
|
|
|
},
|
|
|
fail: () => {
|
|
|
wx.hideLoading()
|
|
@@ -226,87 +229,101 @@ Page({
|
|
|
mask: true,
|
|
|
title: '加载中',
|
|
|
})
|
|
|
- if (currentAnswerTemp.length == 0) {
|
|
|
- let arr = this.data.questionList.map(item => {
|
|
|
- let json = {};
|
|
|
- json.currentAnswer = '';
|
|
|
- json.questType = item.QuestType;
|
|
|
- json.id = item.id;
|
|
|
- return json
|
|
|
- });
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/paper/commit',
|
|
|
- method: "post",
|
|
|
- data: {
|
|
|
- sessionKey: this.data.sessionKey,
|
|
|
- currentAnswerTemp: arr,
|
|
|
- answersId: wx.getStorageSync('answersId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- wx.hideLoading();
|
|
|
- if (res.data.code == 0) {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: '恭喜您,提交答案成功,请耐心等待老师判卷',
|
|
|
- success() {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: res.data.msg,
|
|
|
- success() {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ console.log(currentAnswerTemp, "传值");
|
|
|
+ let indexs = currentAnswerTemp.findIndex(item => {
|
|
|
+ return !item
|
|
|
+ })
|
|
|
+ console.log(indexs, "sssssss");
|
|
|
+ if (indexs == -1) {
|
|
|
+ if (currentAnswerTemp.length == 0) {
|
|
|
+ let arr = this.data.questionList.map(item => {
|
|
|
+ let json = {};
|
|
|
+ json.currentAnswer = '';
|
|
|
+ json.questType = item.QuestType;
|
|
|
+ json.id = item.id;
|
|
|
+ return json
|
|
|
+ });
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/wx/paper/commit',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: this.data.sessionKey,
|
|
|
+ currentAnswerTemp: arr,
|
|
|
+ answersId: wx.getStorageSync('answersId')
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ wx.hideLoading();
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '恭喜您,提交答案成功,请耐心等待老师判卷',
|
|
|
+ success() {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: res.data.msg,
|
|
|
+ success() {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ wx.hideLoading()
|
|
|
}
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- wx.hideLoading()
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/paper/commit',
|
|
|
- method: "post",
|
|
|
- data: {
|
|
|
- sessionKey: this.data.sessionKey,
|
|
|
- currentAnswerTemp: currentAnswerTemp,
|
|
|
- answersId: wx.getStorageSync('answersId')
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- wx.hideLoading();
|
|
|
- if (res.data.code == 0) {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: '恭喜您,提交答案成功,请耐心等待老师判卷',
|
|
|
- success() {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: res.data.msg,
|
|
|
- success() {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/wx/paper/commit',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: this.data.sessionKey,
|
|
|
+ currentAnswerTemp: currentAnswerTemp,
|
|
|
+ answersId: wx.getStorageSync('answersId')
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ wx.hideLoading();
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '恭喜您,提交答案成功,请耐心等待老师判卷',
|
|
|
+ success() {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: res.data.msg,
|
|
|
+ success() {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ wx.hideLoading()
|
|
|
}
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- wx.hideLoading()
|
|
|
- }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("撒大声地所");
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: '当前第' + Number(indexs+1) + '没答,请答题',
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
})
|