This commit is contained in:
caoqianming 2019-11-20 22:00:06 +08:00
parent 64ce37cd83
commit df7e4fb698
4 changed files with 41 additions and 21 deletions

8
app.js
View File

@ -3,7 +3,7 @@ App({
onLaunch: function () {
var that = this
that.mplogin()
setInterval(that.reflesh,20*60*1000)
setInterval(that.reflesh,10*1000)
},
mplogin: function () {
var that = this;
@ -82,6 +82,7 @@ App({
},
reflesh: function(){//刷新session
var that = this
console.log(wx.getStorageSync("sessionid"))
wx.request({
url: that.globalData.serverUrl + 'api/check_session',
header: {
@ -90,6 +91,11 @@ App({
},
data: {},
success: res => {
if (res.header.hasOwnProperty('Set-Cookie')) {
wx.setStorageSync('sessionid', res.header["Set-Cookie"])
} else {
wx.setStorageSync('sessionid', res.header["set-cookie"])
}
}
});
},

View File

@ -13,7 +13,7 @@
共{{todototal}}条考试</view>
<view class="weui-cells weui-cells_after-title">
<block wx:for="{{todokslist}}" wx:key="unique">
<navigator url="note?examtestid={{item.examtest__id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
<navigator url="note?id={{item.examtest__id}}" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active">
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
<view class="weui-media-box__title">{{item.examtest__name}}
</view>

View File

@ -66,30 +66,43 @@ Page({
//获取待阅读通知数目
//console.log(wx.getStorageSync('sessionid'))
if (wx.getStorageSync("sessionid").indexOf('sessionid')!=-1) {
this.getnoread()
this.getyhtodonum()
this.getzytodonum()
this.getpxqdnum()
this.getdknum() //待考
this.getgcnoreadnum()
this.getwsnoreadnum()//未遂未读
this.getjytodonum()
this.gettasknum()
wx.request({
url: getApp().globalData.serverUrl + 'api/check_session',
header: {
'content-type': 'application/json', // 默认值
'Cookie': wx.getStorageSync("sessionid"),
},
data: {},
success: res => {
if(res.data.code==1){
this.getNew()
}else{
getApp().callback = () => {
this.getNew()
};
}
}
});
} else {
getApp().callback = () => {
this.getnoread()
this.getyhtodonum()
this.getzytodonum()
this.getpxqdnum()
this.getdknum()
this.getgcnoreadnum()
this.getjytodonum()
this.gettasknum()
this.getNew()
};
}
},
getNew:function(){
this.getnoread()
this.getyhtodonum()
this.getzytodonum()
this.getpxqdnum()
this.getdknum() //待考
this.getgcnoreadnum()
this.getwsnoreadnum()//未遂未读
this.getjytodonum()
this.gettasknum()
},
/**
* 生命周期函数--监听页面隐藏
*/

View File

@ -348,11 +348,12 @@ Page({
data: {},
success: res => {
if (res.statusCode === 200) {
//console.log(res.data)
console.log(res.data)
this.data.jclxArray = res.data;
this.setData({
jclxArray: res.data,
jclx:res.data[0]//默认检查类型
jclxIndex:0,
jclx:res.data[0].value//默认检查类型
})
}
}