<view class="cu-list">
<view class="flexs" style='background:#fff;padding:0 30rpx;'>
<view>
<text style='font-size:32rpx;'>{{list.choose}}</text>
</view>
<view>
<view class="text-gray action ma">
<image style="vertical-align:middle" src='/images/stars.png'></image>
<text>收藏此题</text>
<text style="margin-left:20rpx;" class="text-cut"><text style='color:#317AE4;vertical-align: top;'>{{list.id}}</text> /{{data.length}}</text>
</view>
</view>
</view>
</view>
<view class='pm'>
<view>{{list.title}}</view>
<!-- 填空 -->
<view wx:if="{{list.choose=='填空'}}">
<textarea></textarea>
</view>
<!-- 单选 -->
<radio-group class="radio-group" bindchange="radioChanges" wx:if="{{list.choose=='单项选择'}}">
<label class="radio" wx:for="{{list.cont}}" wx:for-item="cell" wx:key="index" style='width:100%;display:block;'>
<radio checked='{{che}}' style='margin-right:40rpx;' value="{{cell}}" bindtap='radio' />{{cell}}
</label>
</radio-group>
<!-- 多选 -->
<checkbox-group bindchange="checkboxChange" wx:if="{{list.choose=='多项选择'}}">
<label class="checkbox" wx:for="{{list.cont}}" wx:for-item="cell">
<view class="tui-menu-list">
<checkbox style='margin-right:40rpx;' value="{{cell}}" checked="{{item.checked}}" />{{cell}}</view>
</label>
</checkbox-group>
<!-- 上一题,下一题 -->
<view bindtap='question' class='nes' data-id="{{list.id}}">上一题</view>
<view bindtap='nextt' class='ne' data-id="{{list.id}}" wx:if="{{list.id<data.length}}">下一题</view>
<view bindtap='' class='ne' data-id="{{list.id}}" wx:if="{{list.id==data.length}}">交卷</view>
</view>
<view class="time">
<image src='/images/miao.png'></image>
<text>答题 剩余时间:{{fen}}分{{miao}}秒</text>
</view>
//浮动开始答题
<view class='piao' wx:if="{{piao}}">
<image class='small' src='/images/xx.png' bindtap='che'></image>
<image class='piaos' src='/images/piao.png'></image>
<view style='background:#fff;padding-bottom:20rpx'>
<view class='one' style='padding:20rpx;'>
本次模拟考试总分100分
</view>
<view style='padding:20rpx;'>70分及格</view>
<view style='padding:20rpx;' class='two'>30分钟后结束</view>
<view class='three' bindtap='dati'>开始答题</view>
</view>
</view>
<view class='bei' wx:if="{{bei}}">
</view>
<!-- <view class='dui'>
<view class='ti'>答案解析</view>
<view class='vv'>正确答案B</view>
<view class='hui'>表征沥青路面材料稳定性你呢个的炉面使用指标是治什摸表征沥青路面材料稳定性你呢个的炉面使用指标是治什摸表征沥青路面材料稳定性你呢</view>
</view> -->
js
data: {
data:[
{
id:1,
choose: '单项选择',
title:'表征沥青路面材料稳定性你呢个的炉面使用指标是治什摸( )。',
cont:['A.王森','B.泰森','C.詹姆斯','D.科比']
},
{
id: 2,
choose: '单项选择',
title: '你叫什么名字',
cont: ['A.王森', 'B.泰森', 'C.詹姆斯', 'D.科比']
},
{
id: 3,
choose: '多项选择',
title: '他叫什么名字',
cont: ['A.王森', 'B.泰森', 'C.詹姆斯', 'D.科比']
},
{
id: 4,
choose:'填空',
title: '他叫什么名字',
},
],
list:{},
time:10,
fen:0,
miao:0,
che: false,
checkArr: ['中国'],
bei:true,
piao:true
},
onLoad: function (options) {
// this.setTimeCount()
if (this.data.data.length > 0){
this.setData({
list:this.data.data[0]
})
}
},
// xx
che(){
wx.navigateTo({
url: '/pages/Examination/Examination',
})
},
dati(){
this.setTimeCount()
this.setData({
bei:false,
piao:false
})
},
// 倒计时
setTimeCount: function () {
let time = this.data.time
var miao = this.data.miao
var second = Math.floor(time % 60);
var minite = Math.floor((time / 60) % 60); //计算分
this.setData({
fen: minite,
miao: second
})
time--;
if (time <= 0) {
time = 0;
this.setData({
miao:0
})
return false;
}
this.setData({
time: time,
})
setTimeout(this.setTimeCount, 1000);
},
// 下一题
nextt:function(e){
var id = e.currentTarget.dataset.id;
//console.log("ID"+(id+1));
this.setData({
list: this.data.data[id-1+1],
che: false
})
},
// 上一题
question: function (e) {
var id = e.currentTarget.dataset.id;
console.log("ID"+(id+1));
this.setData({
list: this.data.data[id-1-1],
che: false
})
},
// 单选框选择
radioChanges: function (e) {
console.log(e)
this.setData({
arrs: e.detail.value
})
console.log(this.data.arrs)
},
// 多选框操作
checkboxChange: function (e) {
var arr = []
this.setData({ checkArr: e.detail.value });
console.log(this.data.checkArr)
},