扫码打开优化
This commit is contained in:
parent
c1d6efe796
commit
b80ed4c5c9
5
app.js
5
app.js
|
@ -39,8 +39,11 @@ App({
|
||||||
/**** KEY PART START ****/
|
/**** KEY PART START ****/
|
||||||
var pages = getCurrentPages() // get all current pages
|
var pages = getCurrentPages() // get all current pages
|
||||||
var currentPage = pages[pages.length - 1] // Get current loading page
|
var currentPage = pages[pages.length - 1] // Get current loading page
|
||||||
|
if (currentPage.callback){
|
||||||
currentPage.callback(); // Callback
|
currentPage.callback(); // Callback
|
||||||
that.oncallback = false; // Callback called
|
that.oncallback = false; // Callback called
|
||||||
|
}
|
||||||
|
|
||||||
/**** KEY PART END ****/
|
/**** KEY PART END ****/
|
||||||
|
|
||||||
//获取是否是安全员
|
//获取是否是安全员
|
||||||
|
@ -95,7 +98,7 @@ App({
|
||||||
openid:null
|
openid:null
|
||||||
},
|
},
|
||||||
serverUrl: 'https://safeyun.ctcshe.com/',
|
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://10.21.28.148:8000/',
|
||||||
//serverUrl: 'http://192.168.0.103:8000/',
|
//serverUrl: 'http://192.168.0.103:8000/',
|
||||||
//serverUrl:'http://10.0.11.195:8000/',
|
//serverUrl:'http://10.0.11.195:8000/',
|
||||||
|
|
|
@ -15,28 +15,36 @@ Page({
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
var examtestid
|
var examtestid
|
||||||
if (options.id) {
|
var that = this
|
||||||
examtestid = options.id
|
|
||||||
} 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()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
mask: true
|
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')
|
||||||
|
that.setData({
|
||||||
|
examtestid:examtestid,
|
||||||
|
fromWx: true
|
||||||
|
})
|
||||||
|
setTimeout(function () {
|
||||||
|
that.getTest()
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
getTest: function(){
|
||||||
|
|
||||||
wx.request({
|
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: {
|
header: {
|
||||||
'content-type': 'application/json', // 默认值
|
'content-type': 'application/json', // 默认值
|
||||||
'Cookie': getApp().globalData.sessionId,
|
'Cookie': getApp().globalData.sessionId,
|
||||||
|
@ -61,7 +69,6 @@ Page({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,13 +16,19 @@ Page({
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
// let pxid = options.pxid
|
// let pxid = options.pxid
|
||||||
console.log(options)
|
console.log(options)
|
||||||
|
var that = this
|
||||||
|
wx.showLoading({
|
||||||
|
title: '加载中',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
let pxid
|
let pxid
|
||||||
if(options.pxid){
|
if(options.pxid){
|
||||||
pxid = options.pxid
|
pxid = options.pxid
|
||||||
this.setData({
|
that.setData({
|
||||||
pxid: pxid,
|
pxid: pxid,
|
||||||
isfrom:1
|
isfrom:1
|
||||||
})
|
})
|
||||||
|
that.getPx(pxid)
|
||||||
}else{
|
}else{
|
||||||
let q = decodeURIComponent(options.q)
|
let q = decodeURIComponent(options.q)
|
||||||
|
|
||||||
|
@ -30,16 +36,19 @@ Page({
|
||||||
// console.log("index 生命周期 onload url=" + q)
|
// console.log("index 生命周期 onload url=" + q)
|
||||||
// console.log("index 生命周期 onload 参数 trainid=" + util.getQueryString(q, 'trainid'))
|
// console.log("index 生命周期 onload 参数 trainid=" + util.getQueryString(q, 'trainid'))
|
||||||
pxid = util.getQueryString(q, 'trainid')
|
pxid = util.getQueryString(q, 'trainid')
|
||||||
this.setData({
|
that.setData({
|
||||||
pxid: pxid,
|
pxid: pxid,
|
||||||
isfrom: 0
|
isfrom: 0
|
||||||
})
|
})
|
||||||
|
setTimeout(function () {
|
||||||
|
that.getPx(pxid)
|
||||||
|
}, 1500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(pxid)
|
console.log(pxid)
|
||||||
|
|
||||||
this.getPx(pxid)
|
|
||||||
},
|
},
|
||||||
getPx: function (id) {
|
getPx: function (id) {
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
|
@ -90,7 +99,7 @@ Page({
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
title: '签到成功!',
|
title: '签到成功!',
|
||||||
})
|
})
|
||||||
wx.navigateTo({
|
wx.redirectTo({
|
||||||
url: '../train/train',
|
url: '../train/train',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue