diff --git a/app.js b/app.js index e64aaf7..6a15227 100644 --- a/app.js +++ b/app.js @@ -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"]) + } } }); }, diff --git a/pages/examtest/index.wxml b/pages/examtest/index.wxml index b52faf9..cd84568 100644 --- a/pages/examtest/index.wxml +++ b/pages/examtest/index.wxml @@ -13,7 +13,7 @@ 共{{todototal}}条考试 - + {{item.examtest__name}} diff --git a/pages/main/main.js b/pages/main/main.js index 44b1cf6..5fb84fa 100644 --- a/pages/main/main.js +++ b/pages/main/main.js @@ -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() + }, /** * 生命周期函数--监听页面隐藏 */ diff --git a/pages/trouble/addtrouble.js b/pages/trouble/addtrouble.js index 69b356f..13a2117 100644 --- a/pages/trouble/addtrouble.js +++ b/pages/trouble/addtrouble.js @@ -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//默认检查类型 }) } }