test part2
This commit is contained in:
parent
e11d011c7f
commit
8d68e1cf92
|
@ -35,7 +35,7 @@ Page({
|
||||||
})
|
})
|
||||||
that.showTm(that.data.tmIndex)
|
that.showTm(that.data.tmIndex)
|
||||||
}
|
}
|
||||||
} catch (e) { }
|
} catch (e) { wx.navigateBack({}) }
|
||||||
try {
|
try {
|
||||||
const res = wx.getSystemInfoSync()
|
const res = wx.getSystemInfoSync()
|
||||||
that.setData({
|
that.setData({
|
||||||
|
@ -43,6 +43,14 @@ Page({
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
let mil = that.data.monitest.limit * 60 * 1000
|
||||||
|
let starttimes = (new Date()).getTime() //时间戳
|
||||||
|
let endtimes = starttimes + mil
|
||||||
|
that.data.starttimes = starttimes
|
||||||
|
that.data.endtimes = endtimes
|
||||||
|
getApp().globalData.timer = setInterval(function () {
|
||||||
|
that.startpass()
|
||||||
|
}, 1000)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
@ -69,6 +77,7 @@ Page({
|
||||||
* 生命周期函数--监听页面卸载
|
* 生命周期函数--监听页面卸载
|
||||||
*/
|
*/
|
||||||
onUnload: function () {
|
onUnload: function () {
|
||||||
|
clearInterval(getApp().globalData.timer)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +100,18 @@ Page({
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
startpass: function () {
|
||||||
|
var mil = this.data.endtimes - (new Date()).getTime()
|
||||||
|
if (mil < 2000) {
|
||||||
|
clearInterval(getApp().globalData.timer)
|
||||||
|
this.handtest()
|
||||||
|
};
|
||||||
|
var temp = util.formatmil(mil);
|
||||||
|
this.setData({
|
||||||
|
countdown: temp,
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
showTm: function (index) {
|
showTm: function (index) {
|
||||||
var that = this
|
var that = this
|
||||||
var currentTm = that.data.tms[index]
|
var currentTm = that.data.tms[index]
|
||||||
|
@ -101,29 +121,27 @@ Page({
|
||||||
})
|
})
|
||||||
that.showOptions()
|
that.showOptions()
|
||||||
},
|
},
|
||||||
// panTi: function () {
|
panTi: function (currentTm) {
|
||||||
// var that = this
|
let isright = false
|
||||||
// let currentTm = that.data.currentTm
|
if (currentTm.type == 2) {
|
||||||
// let isright = false
|
if (currentTm.userChecked) {
|
||||||
// if (currentTm.type == 2) {
|
if (currentTm.userChecked.sort().toString() == currentTm.right.sort().toString()) {
|
||||||
// if (currentTm.userChecked) {
|
isright = true
|
||||||
// if (currentTm.userChecked.sort().toString() == currentTm.right.sort().toString()) {
|
}
|
||||||
// isright = true
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// } else {
|
} else {
|
||||||
// isright = currentTm.right == currentTm.userChecked
|
isright = currentTm.right == currentTm.userChecked
|
||||||
// }
|
}
|
||||||
// if (isright == false && currentTm.userChecked != undefined) {
|
if (isright == false && currentTm.userChecked != undefined) {
|
||||||
// currentTm.dtime = util.formatTime(new Date())
|
currentTm.dtime = util.formatTime(new Date())
|
||||||
// that.data.ctms.unshift(currentTm)
|
that.data.ctms.unshift(currentTm)
|
||||||
// if (that.data.ctms.length > 40) {
|
if (that.data.ctms.length > 40) {
|
||||||
// that.data.ctms.length = 40
|
that.data.ctms.length = 40
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return isright
|
return isright
|
||||||
// },
|
},
|
||||||
next: function () {
|
next: function () {
|
||||||
var that = this
|
var that = this
|
||||||
var tmIndex = that.data.tmIndex + 1
|
var tmIndex = that.data.tmIndex + 1
|
||||||
|
@ -154,4 +172,41 @@ Page({
|
||||||
options: options
|
options: options
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
hand: function () {
|
||||||
|
var that = this
|
||||||
|
for (i = 0, len = that.data.tms.length; i < len; i++) {
|
||||||
|
let tm = that.data.tms[i]
|
||||||
|
if (tm.userChecked == undefined || tm.length == 0){
|
||||||
|
wx.showModal({
|
||||||
|
title: '警告',
|
||||||
|
content: '答卷未完成,可点击答题卡复查!',
|
||||||
|
confirmText: "仍旧提交",
|
||||||
|
cancelText: "取消",
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.handtest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wx.showModal({
|
||||||
|
content: '确定提交?',
|
||||||
|
confirmText: "确定",
|
||||||
|
cancelText: "取消",
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
that.handtest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handtest: function (){
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在判卷中...',
|
||||||
|
mask:true
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
|
@ -1,5 +1,11 @@
|
||||||
<view class="head">
|
<view class="head">
|
||||||
题量: {{tmIndex+1}}/{{tmtotal}}
|
<view style="width:50%">
|
||||||
|
倒计时 {{countdown}}
|
||||||
|
</view>
|
||||||
|
<view style="width:50%;text-align:right">
|
||||||
|
题量:{{tmIndex+1}}/{{tmtotal}}
|
||||||
|
</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;
|
||||||
|
|
|
@ -14,6 +14,25 @@ const formatNumber = n => {
|
||||||
return n[1] ? n : '0' + n
|
return n[1] ? n : '0' + n
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
function formatmil(mil) {
|
||||||
formatTime: formatTime
|
var allSecond = Math.floor(mil / 1000);
|
||||||
|
var h = Math.floor(allSecond / 3600);
|
||||||
|
var m = Math.floor((allSecond - h * 3600) / 60);
|
||||||
|
var s = Math.floor(allSecond - h * 3600 - m * 60);
|
||||||
|
h = toTow(h);
|
||||||
|
m = toTow(m);
|
||||||
|
s = toTow(s);
|
||||||
|
return h + ":" + m + ":" + s;
|
||||||
|
}
|
||||||
|
function toTow(num) {
|
||||||
|
if (num < 10) {
|
||||||
|
return "0" + num;
|
||||||
|
} else {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
formatTime: formatTime,
|
||||||
|
formatmil: formatmil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue