看题模式
This commit is contained in:
parent
7aea984e34
commit
a86b6e1197
|
@ -11,7 +11,8 @@ Page({
|
||||||
tm_index: 0,
|
tm_index: 0,
|
||||||
isright:false,
|
isright:false,
|
||||||
answerP:false,
|
answerP:false,
|
||||||
tmtotal:0
|
tmtotal:0,
|
||||||
|
moShi:'看题模式'
|
||||||
},
|
},
|
||||||
radioChange: function (e) {
|
radioChange: function (e) {
|
||||||
var that = this
|
var that = this
|
||||||
|
@ -23,6 +24,7 @@ Page({
|
||||||
var that = this
|
var that = this
|
||||||
that.data.currentTm['user_answer'] = e.detail.value
|
that.data.currentTm['user_answer'] = e.detail.value
|
||||||
that.data.ctms[that.data.tm_index] = that.data.currentTm
|
that.data.ctms[that.data.tm_index] = that.data.currentTm
|
||||||
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
|
@ -127,7 +129,7 @@ Page({
|
||||||
'currentTm': currentTm
|
'currentTm': currentTm
|
||||||
})
|
})
|
||||||
that.showOptions()
|
that.showOptions()
|
||||||
if (currentTm.user_answer) {
|
if (currentTm.user_answer && that.data.moShi=='看题模式') {
|
||||||
that.showAnswer()
|
that.showAnswer()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -145,13 +147,6 @@ Page({
|
||||||
} else {
|
} else {
|
||||||
isright = currentTm.right == currentTm.user_answer
|
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
|
return isright
|
||||||
},
|
},
|
||||||
showAnswer: function () {
|
showAnswer: function () {
|
||||||
|
@ -166,11 +161,13 @@ Page({
|
||||||
var that = this
|
var that = this
|
||||||
var tm_index = that.data.tm_index + 1
|
var tm_index = that.data.tm_index + 1
|
||||||
that.showTm(tm_index)
|
that.showTm(tm_index)
|
||||||
|
that.showAnswerP()
|
||||||
},
|
},
|
||||||
previous: function () {
|
previous: function () {
|
||||||
var that = this
|
var that = this
|
||||||
var tm_index = that.data.tm_index - 1
|
var tm_index = that.data.tm_index - 1
|
||||||
that.showTm(tm_index)
|
that.showTm(tm_index)
|
||||||
|
that.showAnswerP()
|
||||||
},
|
},
|
||||||
showOptions: function () {
|
showOptions: function () {
|
||||||
let currentTm = this.data.currentTm
|
let currentTm = this.data.currentTm
|
||||||
|
@ -179,7 +176,7 @@ Page({
|
||||||
let option = {}
|
let option = {}
|
||||||
option.key = key
|
option.key = key
|
||||||
option.value = key + ':' + currentTm.options[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) {
|
if (key == currentTm.user_answer || currentTm.user_answer.indexOf(key) != -1) {
|
||||||
option.checked = true
|
option.checked = true
|
||||||
}
|
}
|
||||||
|
@ -205,5 +202,31 @@ Page({
|
||||||
wx.navigateBack({
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -1,5 +1,11 @@
|
||||||
<view class="head">
|
<view class="head">
|
||||||
题量: {{tm_index+1}}/{{tmtotal}}
|
<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>
|
</view>
|
||||||
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
|
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
|
||||||
<view class="weui-article">
|
<view class="weui-article">
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
height:30px;
|
height:30px;
|
||||||
color:#fff;
|
color:#fff;
|
||||||
background-color: cornflowerblue;
|
background-color: cornflowerblue;
|
||||||
text-align: center;
|
text-align: left;
|
||||||
|
display:flex;
|
||||||
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
.btns{
|
.btns{
|
||||||
height:40px;
|
height:40px;
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
<view class="weui-media-box__desc">
|
<view class="weui-media-box__desc">
|
||||||
已答
|
已答
|
||||||
<span style="color:darkblue;font-weight:bold">{{item.ydtmtotal}}</span>
|
<span style="color:darkblue;font-weight:bold">{{item.ydtmtotal}}</span>
|
||||||
|
道,
|
||||||
|
共
|
||||||
|
<span style="color:darkblue;font-weight:bold">{{item.tmtotal}}</span>
|
||||||
道
|
道
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-media-box__desc">
|
<view class="weui-media-box__desc">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<view class="head">
|
<view class="head">
|
||||||
<!-- 题量: {{tm_index+1}}/{{tmtotal}} -->
|
题量: {{tm_index+1}}/{{tmtotal}}
|
||||||
</view>
|
</view>
|
||||||
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
|
<scroll-view scroll-y="true" style="height: {{scrollHeight}}px;">
|
||||||
<view class="weui-article">
|
<view class="weui-article">
|
||||||
|
|
Loading…
Reference in New Issue