diff --git a/app.js b/app.js index 14dbbbb..a2815a7 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ //app.js App({ - onShow: function() { + onLaunch: function() { var that = this; wx.getSystemInfo({ success: function (res) { @@ -9,9 +9,24 @@ App({ } }); }, - + onShow: function (options) { + var that = this; + var path = options.path; + if (options.query.id) { + wx.reLaunch({ + url: '/pages/login/login', + complete: function (res) { + that.globalData.shareInPath = path; + that.globalData.shareInParameter = options.query; + }, + }); + } + }, globalData: { + shareInPath: "", + shareInParameter: {}, + shareInState: 1, customerArray:[], goodsNameArray:[], winHeight: 0, @@ -32,7 +47,6 @@ App({ selectBillState: null, billInfo: [], billInfoUp: [], - shareInState:1, accountingUnit_ID:0, accountingUnit_Name: "请选择会计单位", department_ID:0, diff --git a/pages/homePage/homePage.js b/pages/homePage/homePage.js index d5d14ae..f29327f 100644 --- a/pages/homePage/homePage.js +++ b/pages/homePage/homePage.js @@ -26,7 +26,16 @@ Page({ onLoad: function (options) { GetUserProfile(function (res) { - + var shareURL = app.globalData.shareInPath; + if (shareURL) { + app.globalData.shareInState = 0, + wx.navigateTo({ + url: "../../" + shareURL, + complete: function (res) { + app.globalData.shareInPath = ""; + }, + }) + } }); }, diff --git a/pages/order/detail/detail.js b/pages/order/detail/detail.js index 422763f..91ecc43 100644 --- a/pages/order/detail/detail.js +++ b/pages/order/detail/detail.js @@ -104,8 +104,21 @@ Page({ }, onLoad: function(options) { + //正常登录流程进入值为0,分享页面直接进入值为1 + if (app.globalData.shareInState == 1) { + return; + } + + if (app.globalData.shareInParameter.id) { + var detailItemID = parseInt(app.globalData.shareInParameter.id); + // detailItemType = app.globalData.shareInParameter.detailItemType; + } else { + var detailItemID = parseInt(options.ID); + } + var that = this; - network.transfer_request(load, [Number(options.ID)], function(res) { + network.transfer_request(load, [detailItemID], function(res) { + app.globalData.shareInParameter = {}; res.result.LoadTime = timechage.formatTimeTwo(res.result.LoadTime.substring(6, 19), 'Y-M-D h:m'); console.log(res.result); that.setData({