diff --git a/app.js b/app.js index 1dd55d2..d24175a 100644 --- a/app.js +++ b/app.js @@ -39,8 +39,11 @@ App({ /**** KEY PART START ****/ var pages = getCurrentPages() // get all current pages var currentPage = pages[pages.length - 1] // Get current loading page - currentPage.callback(); // Callback - that.oncallback = false; // Callback called + if (currentPage.callback){ + currentPage.callback(); // Callback + that.oncallback = false; // Callback called + } + /**** KEY PART END ****/ //获取是否是安全员 @@ -95,7 +98,7 @@ App({ openid:null }, serverUrl: 'https://safeyun.ctcshe.com/', - // serverUrl: 'http://121.36.23.77:8000/', + //serverUrl: 'http://127.0.0.1:8000/', //serverUrl: 'http://10.21.28.148:8000/', //serverUrl: 'http://192.168.0.103:8000/', //serverUrl:'http://10.0.11.195:8000/', diff --git a/pages/examtest/note.js b/pages/examtest/note.js index 7765451..538c311 100644 --- a/pages/examtest/note.js +++ b/pages/examtest/note.js @@ -15,38 +15,46 @@ Page({ */ onLoad: function (options) { var examtestid + var that = this + wx.showLoading({ + title: '加载中', + mask: true + }) if (options.id) { examtestid = options.id + that.setData({ + examtestid: examtestid, + }) + that.getTest() } else { let q = decodeURIComponent(options.q) if (q) { examtestid = util.getQueryString(q, 'id') - if (getApp().globalData.sessionId.indexOf('sessinid') != -1) { - this.setData({ - fromWx: true - }) - }else{ - getApp().onLaunch() - } - + that.setData({ + examtestid:examtestid, + fromWx: true + }) + setTimeout(function () { + that.getTest() + }, 1500); } } - wx.showLoading({ - title: '加载中', - mask:true - }) + + }, + getTest: function(){ + wx.request({ - url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id='+examtestid, + url: getApp().globalData.serverUrl + 'api/examtest?a=detail&id=' + this.data.examtestid, header: { 'content-type': 'application/json', // 默认值 'Cookie': getApp().globalData.sessionId, }, success: res => { if (res.statusCode === 200) { - + let ksdata = res.data ksdata['testdisable'] = false - if (ksdata.notinTime == 1){ + if (ksdata.notinTime == 1) { ksdata['testdisable'] = true ksdata['msg'] = '不在考试期限范围内!' } @@ -56,12 +64,11 @@ Page({ } this.setData(ksdata) wx.hideLoading() - + } } }); }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/train/check.js b/pages/train/check.js index 6509b51..46bde5a 100644 --- a/pages/train/check.js +++ b/pages/train/check.js @@ -16,13 +16,19 @@ Page({ onLoad: function (options) { // let pxid = options.pxid console.log(options) + var that = this + wx.showLoading({ + title: '加载中', + mask: true + }) let pxid if(options.pxid){ pxid = options.pxid - this.setData({ + that.setData({ pxid: pxid, isfrom:1 }) + that.getPx(pxid) }else{ let q = decodeURIComponent(options.q) @@ -30,16 +36,19 @@ Page({ // console.log("index 生命周期 onload url=" + q) // console.log("index 生命周期 onload 参数 trainid=" + util.getQueryString(q, 'trainid')) pxid = util.getQueryString(q, 'trainid') - this.setData({ + that.setData({ pxid: pxid, isfrom: 0 }) + setTimeout(function () { + that.getPx(pxid) + }, 1500); } } console.log(pxid) - this.getPx(pxid) + }, getPx: function (id) { wx.showLoading({ @@ -90,7 +99,7 @@ Page({ wx.showToast({ title: '签到成功!', }) - wx.navigateTo({ + wx.redirectTo({ url: '../train/train', }) }