0225commit
This commit is contained in:
parent
275ad1018a
commit
95adf23028
6
app.js
6
app.js
|
@ -95,11 +95,11 @@ App({
|
||||||
openid:null
|
openid:null
|
||||||
},
|
},
|
||||||
serverUrl: 'https://safeyun.ctcshe.com/',
|
serverUrl: 'https://safeyun.ctcshe.com/',
|
||||||
//serverUrl: 'http://127.0.0.1:8001/',
|
//serverUrl: 'http://127.0.0.1:8000/',
|
||||||
//serverUrl: 'http://10.21.28.148:8000/',
|
//serverUrl: 'http://10.21.28.148:8000/',
|
||||||
//serverUrl: 'http://192.168.0.107:8000/',
|
//serverUrl: 'http://192.168.0.103:8000/',
|
||||||
//serverUrl:'http://10.0.11.195:8000/',
|
//serverUrl:'http://10.0.11.195:8000/',
|
||||||
timepass:null //定时器
|
timer:null //定时器
|
||||||
},
|
},
|
||||||
|
|
||||||
})
|
})
|
|
@ -8,7 +8,9 @@ Page({
|
||||||
data: {
|
data: {
|
||||||
tmIndex: 0,
|
tmIndex: 0,
|
||||||
answerChoices:[],
|
answerChoices:[],
|
||||||
ydtm:0
|
ydtm:0,
|
||||||
|
took:0,
|
||||||
|
handdisable:false
|
||||||
},
|
},
|
||||||
tmdata: {
|
tmdata: {
|
||||||
|
|
||||||
|
@ -63,8 +65,9 @@ Page({
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
|
var that = this
|
||||||
if(options.id){
|
if(options.id){
|
||||||
this.setData({
|
that.setData({
|
||||||
testid:options.id
|
testid:options.id
|
||||||
})
|
})
|
||||||
wx.showLoading({})
|
wx.showLoading({})
|
||||||
|
@ -79,13 +82,20 @@ Page({
|
||||||
|
|
||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
let tms = res.data
|
let tms = res.data
|
||||||
this.tmdata = tms
|
that.tmdata = tms
|
||||||
console.log(tms.duration)
|
console.log(tms.duration)
|
||||||
let mil = tms.duration * 60 * 1000
|
let mil = tms.duration * 60 * 1000
|
||||||
console.log(mil)
|
let starttimes = (new Date()).getTime() //时间戳
|
||||||
this.begin(mil)
|
let endtimes = starttimes + mil
|
||||||
this.showTm(0)
|
// console.log(new Date(endtime))
|
||||||
this.setData({
|
// console.log(mil)
|
||||||
|
that.data.starttimes = starttimes
|
||||||
|
that.data.endtimes = endtimes
|
||||||
|
getApp().globalData.timer = setInterval(function(){
|
||||||
|
that.startpass()
|
||||||
|
}, 1000)
|
||||||
|
that.showTm(0)
|
||||||
|
that.setData({
|
||||||
tmtotal: tms.tms.length,
|
tmtotal: tms.tms.length,
|
||||||
starttime: tms.starttime })
|
starttime: tms.starttime })
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
|
@ -133,6 +143,7 @@ Page({
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
clearInterval(getApp().globalData.timer)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,26 +166,25 @@ Page({
|
||||||
onShareAppMessage: function () {
|
onShareAppMessage: function () {
|
||||||
|
|
||||||
},
|
},
|
||||||
begin: function (mil) {
|
startpass:function(){
|
||||||
|
var mil = this.data.endtimes - (new Date()).getTime()
|
||||||
|
console.log('定时器在走!')
|
||||||
|
if (mil < 2000) {
|
||||||
|
clearInterval(getApp().globalData.timer)
|
||||||
|
wx.showLoading({
|
||||||
|
title: '时间到,正在交卷..',
|
||||||
|
});
|
||||||
|
if( this.data.handdisable == false){
|
||||||
|
this.handtest()
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
};
|
||||||
var temp = formatmil(mil);
|
var temp = formatmil(mil);
|
||||||
this.setData({
|
this.setData({
|
||||||
countdown: temp,
|
countdown: temp,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mil < 1000) {
|
|
||||||
wx.showLoading({
|
|
||||||
title: '时间到,正在交卷..',
|
|
||||||
});
|
|
||||||
this.handtest()
|
|
||||||
return
|
|
||||||
};
|
|
||||||
|
|
||||||
getApp().globalData.timepass=setTimeout(
|
|
||||||
() => {
|
|
||||||
mil -= 1000;
|
|
||||||
this.begin(mil);
|
|
||||||
}, 1000
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
showTm: function (index) {
|
showTm: function (index) {
|
||||||
var that = this
|
var that = this
|
||||||
|
@ -262,33 +272,42 @@ Page({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handtest:function(){
|
handtest:function(){
|
||||||
var data={
|
clearInterval(getApp().globalData.timer)
|
||||||
'testid': this.data.testid,
|
if(this.data.handdisable == false){
|
||||||
'starttime':this.data.starttime,
|
this.setData({
|
||||||
'endtime': util.formatTime(new Date()),
|
handdisable: true
|
||||||
'sheet':this.tmdata.tms
|
})
|
||||||
}
|
var data = {
|
||||||
wx.showLoading({
|
'testid': this.data.testid,
|
||||||
title: '自动判卷中..',
|
'starttime': this.data.starttime, //服务器时间
|
||||||
})
|
'endtime': util.formatTime(new Date()),
|
||||||
wx.request({
|
'sheet': this.tmdata.tms,
|
||||||
url: getApp().globalData.serverUrl + 'api/examtestdetail?a=handtest&id=' + this.data.testid,
|
'took': Math.floor(((new Date()).getTime() - this.data.starttimes) / 1000)
|
||||||
header: {
|
|
||||||
'content-type': 'application/json', // 默认值
|
|
||||||
'Cookie': wx.getStorageSync("sessionid"),
|
|
||||||
},
|
|
||||||
method: 'POST',
|
|
||||||
data: data,
|
|
||||||
success: res => {
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
wx.hideLoading()
|
|
||||||
wx.redirectTo({
|
|
||||||
url: 'result?' + parseParams(res.data.data),
|
|
||||||
})
|
|
||||||
clearTimeout(getApp().globalData.timepass)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
wx.showLoading({
|
||||||
|
title: '自动判卷中..',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
wx.request({
|
||||||
|
url: getApp().globalData.serverUrl + 'api/examtestdetail?a=handtest&id=' + this.data.testid,
|
||||||
|
header: {
|
||||||
|
'content-type': 'application/json', // 默认值
|
||||||
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
data: data,
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
clearInterval(getApp().globalData.timer)
|
||||||
|
wx.hideLoading()
|
||||||
|
wx.redirectTo({
|
||||||
|
url: 'result?' + parseParams(res.data.data),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
function formatmil(mil) {
|
function formatmil(mil) {
|
||||||
|
|
|
@ -45,6 +45,6 @@
|
||||||
<button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button>
|
<button class="weui-btn" type="primary" bindtap="next" disabled="{{tmIndex==tmtotal-1}}">下一题</button>
|
||||||
</view>
|
</view>
|
||||||
<view style="width:30%;float:right">
|
<view style="width:30%;float:right">
|
||||||
<button class="weui-btn" type="primary" bindtap="hand">交卷</button>
|
<button class="weui-btn" type="primary" bindtap="hand" disabled="{{handdisable}}">交卷</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
|
@ -33,6 +33,7 @@ Page({
|
||||||
}
|
}
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
|
mask:true
|
||||||
})
|
})
|
||||||
wx.request({
|
wx.request({
|
||||||
url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id='+examtestid,
|
url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id='+examtestid,
|
||||||
|
|
|
@ -25,6 +25,7 @@ Page({
|
||||||
})
|
})
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
})
|
})
|
||||||
wx.request({
|
wx.request({
|
||||||
url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id=' + examtestid,
|
url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id=' + examtestid,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
人参与 更新时间:{{updatetime}}
|
人参与 更新时间:{{updatetime}}
|
||||||
</view>
|
</view>
|
||||||
<view class='search'>
|
<view class='search'>
|
||||||
<input type='text' placeholder='输入姓名查询' confirm-type='search' value="{{inputValue}}" bindinput='inputBind' bindconfirm='query' style="flex: 1;"></input>
|
<input type='text' placeholder='输入姓名/部门查询' confirm-type='search' value="{{inputValue}}" bindinput='inputBind' bindconfirm='query' style="flex: 1;"></input>
|
||||||
<view style="padding:2rpx">
|
<view style="padding:2rpx">
|
||||||
<button type="primary" bindtap="query" >查询</button>
|
<button type="primary" bindtap="query" >查询</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
Loading…
Reference in New Issue