diff --git a/test_mini/pages/lianxi/main.js b/test_mini/pages/lianxi/main.js index a7f5fe9..cc7975d 100644 --- a/test_mini/pages/lianxi/main.js +++ b/test_mini/pages/lianxi/main.js @@ -16,13 +16,27 @@ Page({ answerP: false, page:1, domain:getApp().globalData.mediahost, + moShi:'背题模式', + }, + changeM: function () { + var that = this + if(that.data.moShi=='看题模式'){ + that.setData({ + moShi:'背题模式', + }) + that.showOptions() + }else{ + that.setData({ + moShi: '看题模式', + }) + } }, radioChange: function(e) { var that = this that.data.tm_current['user_answer'] = e.detail.value that.data.tms[that.data.tm_index] = that.data.tm_current that.showAnswer() - if (that.data.ydtms.indexOf(that.data.tm_current.id) == -1) { + if (that.data.moShi=='背题模式' && that.data.ydtms.indexOf(that.data.tm_current.id) == -1) { that.data.ydtms.push(that.data.tm_current.id) } }, @@ -30,7 +44,7 @@ Page({ var that = this that.data.tm_current['user_answer'] = e.detail.value that.data.tms[that.data.tm_index] = that.data.tm_current - if (that.data.ydtms.indexOf(that.data.tm_current.id) == -1) { + if (that.data.moShi=='背题模式' && that.data.ydtms.indexOf(that.data.tm_current.id) == -1) { that.data.ydtms.push(that.data.tm_current.id) } }, @@ -156,6 +170,14 @@ Page({ if (tm_current.user_answer) { that.showAnswer() } + else{ + that.setData({ + isright:false + }) + } + if (that.data.moShi=='看题模式' && that.data.ydtms.indexOf(that.data.tm_current.id) == -1) { + that.data.ydtms.push(that.data.tm_current.id) + } } }, @@ -230,15 +252,19 @@ Page({ let option = {} option.key = key option.value = tm_current.options[key].toString() + option.checked = false + option.right = false + if(option.key == tm_current.right||tm_current.right.indexOf(option.key)!=-1){ + option.right = true + } if (tm_current.user_answer) { if (key == tm_current.user_answer || tm_current.user_answer.indexOf(key) != -1) { option.checked = true } - } else { - option.checked = false } options.push(option) } + console.log(options) this.setData({ options: options }) diff --git a/test_mini/pages/lianxi/main.wxml b/test_mini/pages/lianxi/main.wxml index 911cb8d..0f09f70 100644 --- a/test_mini/pages/lianxi/main.wxml +++ b/test_mini/pages/lianxi/main.wxml @@ -1,5 +1,11 @@ - 题量: {{tm_index+1}}/{{tmtotal}} + + 题量: {{tm_index+1}}/{{tmtotal}} + + + {{moShi}} + (点击切换) + @@ -14,9 +20,15 @@