session
This commit is contained in:
parent
64ce37cd83
commit
df7e4fb698
8
app.js
8
app.js
|
@ -3,7 +3,7 @@ App({
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
var that = this
|
var that = this
|
||||||
that.mplogin()
|
that.mplogin()
|
||||||
setInterval(that.reflesh,20*60*1000)
|
setInterval(that.reflesh,10*1000)
|
||||||
},
|
},
|
||||||
mplogin: function () {
|
mplogin: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
@ -82,6 +82,7 @@ App({
|
||||||
},
|
},
|
||||||
reflesh: function(){//刷新session
|
reflesh: function(){//刷新session
|
||||||
var that = this
|
var that = this
|
||||||
|
console.log(wx.getStorageSync("sessionid"))
|
||||||
wx.request({
|
wx.request({
|
||||||
url: that.globalData.serverUrl + 'api/check_session',
|
url: that.globalData.serverUrl + 'api/check_session',
|
||||||
header: {
|
header: {
|
||||||
|
@ -90,6 +91,11 @@ App({
|
||||||
},
|
},
|
||||||
data: {},
|
data: {},
|
||||||
success: res => {
|
success: res => {
|
||||||
|
if (res.header.hasOwnProperty('Set-Cookie')) {
|
||||||
|
wx.setStorageSync('sessionid', res.header["Set-Cookie"])
|
||||||
|
} else {
|
||||||
|
wx.setStorageSync('sessionid', res.header["set-cookie"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
共{{todototal}}条考试</view>
|
共{{todototal}}条考试</view>
|
||||||
<view class="weui-cells weui-cells_after-title">
|
<view class="weui-cells weui-cells_after-title">
|
||||||
<block wx:for="{{todokslist}}" wx:key="unique">
|
<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__bd weui-media-box__bd_in-appmsg">
|
||||||
<view class="weui-media-box__title">{{item.examtest__name}}
|
<view class="weui-media-box__title">{{item.examtest__name}}
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -66,30 +66,43 @@ Page({
|
||||||
//获取待阅读通知数目
|
//获取待阅读通知数目
|
||||||
//console.log(wx.getStorageSync('sessionid'))
|
//console.log(wx.getStorageSync('sessionid'))
|
||||||
if (wx.getStorageSync("sessionid").indexOf('sessionid')!=-1) {
|
if (wx.getStorageSync("sessionid").indexOf('sessionid')!=-1) {
|
||||||
this.getnoread()
|
wx.request({
|
||||||
this.getyhtodonum()
|
url: getApp().globalData.serverUrl + 'api/check_session',
|
||||||
this.getzytodonum()
|
header: {
|
||||||
this.getpxqdnum()
|
'content-type': 'application/json', // 默认值
|
||||||
this.getdknum() //待考
|
'Cookie': wx.getStorageSync("sessionid"),
|
||||||
this.getgcnoreadnum()
|
},
|
||||||
this.getwsnoreadnum()//未遂未读
|
data: {},
|
||||||
this.getjytodonum()
|
success: res => {
|
||||||
this.gettasknum()
|
if(res.data.code==1){
|
||||||
|
this.getNew()
|
||||||
|
}else{
|
||||||
|
getApp().callback = () => {
|
||||||
|
this.getNew()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
getApp().callback = () => {
|
getApp().callback = () => {
|
||||||
this.getnoread()
|
this.getNew()
|
||||||
this.getyhtodonum()
|
|
||||||
this.getzytodonum()
|
|
||||||
this.getpxqdnum()
|
|
||||||
this.getdknum()
|
|
||||||
this.getgcnoreadnum()
|
|
||||||
this.getjytodonum()
|
|
||||||
this.gettasknum()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getNew:function(){
|
||||||
|
this.getnoread()
|
||||||
|
this.getyhtodonum()
|
||||||
|
this.getzytodonum()
|
||||||
|
this.getpxqdnum()
|
||||||
|
this.getdknum() //待考
|
||||||
|
this.getgcnoreadnum()
|
||||||
|
this.getwsnoreadnum()//未遂未读
|
||||||
|
this.getjytodonum()
|
||||||
|
this.gettasknum()
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -348,11 +348,12 @@ Page({
|
||||||
data: {},
|
data: {},
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.statusCode === 200) {
|
if (res.statusCode === 200) {
|
||||||
//console.log(res.data)
|
console.log(res.data)
|
||||||
this.data.jclxArray = res.data;
|
this.data.jclxArray = res.data;
|
||||||
this.setData({
|
this.setData({
|
||||||
jclxArray: res.data,
|
jclxArray: res.data,
|
||||||
jclx:res.data[0]//默认检查类型
|
jclxIndex:0,
|
||||||
|
jclx:res.data[0].value//默认检查类型
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue