看题模式

This commit is contained in:
caoqianming 2020-05-28 15:32:30 +08:00
parent 7aea984e34
commit a86b6e1197
5 changed files with 47 additions and 13 deletions

View File

@ -11,7 +11,8 @@ Page({
tm_index: 0,
isright:false,
answerP:false,
tmtotal:0
tmtotal:0,
moShi:'看题模式'
},
radioChange: function (e) {
var that = this
@ -23,6 +24,7 @@ Page({
var that = this
that.data.currentTm['user_answer'] = e.detail.value
that.data.ctms[that.data.tm_index] = that.data.currentTm
},
/**
* 生命周期函数--监听页面加载
@ -127,7 +129,7 @@ Page({
'currentTm': currentTm
})
that.showOptions()
if (currentTm.user_answer) {
if (currentTm.user_answer && that.data.moShi=='看题模式') {
that.showAnswer()
}
},
@ -145,13 +147,6 @@ Page({
} else {
isright = currentTm.right == currentTm.user_answer
}
// if (isright == false && currentTm.user_answer != undefined) {
// currentTm.dtime = util.formatTime(new Date())
// that.data.ctms.unshift(currentTm)
// if (that.data.ctms.length > 40) {
// that.data.ctms.length = 40
// }
// }
return isright
},
showAnswer: function () {
@ -166,11 +161,13 @@ Page({
var that = this
var tm_index = that.data.tm_index + 1
that.showTm(tm_index)
that.showAnswerP()
},
previous: function () {
var that = this
var tm_index = that.data.tm_index - 1
that.showTm(tm_index)
that.showAnswerP()
},
showOptions: function () {
let currentTm = this.data.currentTm
@ -179,7 +176,7 @@ Page({
let option = {}
option.key = key
option.value = key + ':' + currentTm.options[key]
if (currentTm.user_answer) {
if (currentTm.user_answer && this.data.moShi == '看题模式') {
if (key == currentTm.user_answer || currentTm.user_answer.indexOf(key) != -1) {
option.checked = true
}
@ -205,5 +202,31 @@ Page({
wx.navigateBack({
})
}
},
changeM: function () {
var that = this
if(that.data.moShi=='看题模式'){
that.setData({
moShi:'背题模式',
answerP:false
})
that.showOptions()
}else{
that.setData({
moShi: '看题模式'
})
}
},
showAnswerP:function(){
var that = this
if (that.data.moShi == '背题模式') {
that.setData({
answerP:false
})
}else{
that.setData({
answerP: true
})
}
}
})

View File

@ -1,6 +1,12 @@
<view class="head">
<view style="width:50%">
题量: {{tm_index+1}}/{{tmtotal}}
</view>
<view style="width:50%;text-align:right" bindtap="changeM">
<span style="font-weight:bold;">{{moShi}}</span>
(点击切换)
</view>
</view>
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
<view class="weui-article">
<view class="weui-article__h2">{{tm_index+1}}.

View File

@ -3,7 +3,9 @@
height:30px;
color:#fff;
background-color: cornflowerblue;
text-align: center;
text-align: left;
display:flex;
flex-direction: row;
}
.btns{
height:40px;

View File

@ -13,6 +13,9 @@
<view class="weui-media-box__desc">
已答
<span style="color:darkblue;font-weight:bold">{{item.ydtmtotal}}</span>
道,
<span style="color:darkblue;font-weight:bold">{{item.tmtotal}}</span>
</view>
<view class="weui-media-box__desc">

View File

@ -1,5 +1,5 @@
<view class="head">
<!-- 题量: {{tm_index+1}}/{{tmtotal}} -->
题量: {{tm_index+1}}/{{tmtotal}}
</view>
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
<view class="weui-article">