diff --git a/app.js b/app.js index 169287b..5aa2d57 100644 --- a/app.js +++ b/app.js @@ -1,8 +1,7 @@ //app.js var app = getApp(); App({ - - onShow: function (options) { + onLaunch: function () { var that = this; wx.getSystemInfo({ success: function (res) { @@ -10,7 +9,20 @@ App({ that.globalData.winHeight = res.windowHeight; } }); - + }, + 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; + }, + }); + } + var extraData = null; //options.referrerInfo.extraData = { orderID: 33 }; // 判断是否点击其他小程序分享进入 @@ -21,6 +33,9 @@ App({ }, globalData: { + shareInPath: "", + shareInParameter: {}, + shareInState: 1, winHeight: 0, winWidth: 0, UserName:"", diff --git a/pages/homePage/homePage.js b/pages/homePage/homePage.js index 06ec034..ccee0f5 100644 --- a/pages/homePage/homePage.js +++ b/pages/homePage/homePage.js @@ -1,4 +1,7 @@ // pages/homePage/homePage.js + +var app = getApp() + Page({ data: { @@ -6,7 +9,17 @@ Page({ }, onLoad: function (options) { - + // 进入过首页 可以由分享进入页面 + app.globalData.shareInState = 0; + var shareURL = app.globalData.shareInPath; + if (shareURL) { + wx.navigateTo({ + url: "../../" + shareURL, + complete: function (res) { + app.globalData.shareInPath = ""; + }, + }) + } }, transBtnClicked: function (event) { diff --git a/pages/orderList/orderDetail/orderDetail.js b/pages/orderList/orderDetail/orderDetail.js index 85cb936..303056d 100644 --- a/pages/orderList/orderDetail/orderDetail.js +++ b/pages/orderList/orderDetail/orderDetail.js @@ -1,4 +1,3 @@ -// pages/orderList/orderBaseInfo/orderBaseInfo.js const app = getApp(); var network = require("../../../utils/net.js"); @@ -9,24 +8,30 @@ Page({ data: { currentTab: 0, - winHeight: 0, + winHeight: app.globalData.winHeight, orderInfo:{}, }, onLoad: function(options) { + //正常登录流程进入值为0,分享页面直接进入值为1 + if (app.globalData.shareInState == 1) { + return; + } + if (app.globalData.shareInParameter.id) { + var detailItemID = parseInt(app.globalData.shareInParameter.id); + wx.showModal({ + title: '看下ID值', + content: '+++' + detailItemID + '+++', + }) + // detailItemType = app.globalData.shareInParameter.detailItemType; + } else { + var detailItemID = parseInt(options.id); + } var that = this; - let ID = Number(options.id); - wx.getSystemInfo({ - success: function (res) { - that.setData({ - winWidth: res.windowWidth, - winHeight: res.windowHeight - }); - } - }); var method = LoadOrder; - var params = [ID]; + var params = [detailItemID]; network.transfer_request(method, params, function (res) { + app.globalData.shareInParameter = {}; res.result.LoadTime = timechage.formatTimeTwo(res.result.LoadTime.substring(6, 19), 'Y-M-D h:m'); res.result.OrderDate = timechage.formatTimeTwo(res.result.OrderDate.substring(6, 19), 'Y-M-D h:m'); that.setData({ diff --git a/pages/orderList/orderDetail/orderDetail.wxml b/pages/orderList/orderDetail/orderDetail.wxml index 4d1ace9..c5a50da 100644 --- a/pages/orderList/orderDetail/orderDetail.wxml +++ b/pages/orderList/orderDetail/orderDetail.wxml @@ -1,4 +1,3 @@ - 基本信息 diff --git a/pages/orderList/orderDetail/orderDetail.wxss b/pages/orderList/orderDetail/orderDetail.wxss index 95ac70b..0a5f07d 100644 --- a/pages/orderList/orderDetail/orderDetail.wxss +++ b/pages/orderList/orderDetail/orderDetail.wxss @@ -1,4 +1,3 @@ -/* pages/orderList/orderBaseInfo/orderBaseInfo.wxss */ page { background:#EAF1F8; diff --git a/project.config.json b/project.config.json index a25057e..faea253 100644 --- a/project.config.json +++ b/project.config.json @@ -48,10 +48,13 @@ }, { "id": 1, - "name": "测试", - "pathName": "pages/login/login", - "query": "", - "scene": "1011" + "name": "公众号消息模版进入", + "pathName": "pages/orderList/orderDetail/orderDetail", + "query": "id=12", + "scene": "1043", + "referrerInfo": { + "appId": "wx246fd8f3a0273f2f" + } } ] }