Browse Source

添加公众号分享跳转

master
chenxuhui 7 years ago
parent
commit
4689ad02e2
6 changed files with 56 additions and 22 deletions
  1. +18
    -3
      app.js
  2. +14
    -1
      pages/homePage/homePage.js
  3. +17
    -12
      pages/orderList/orderDetail/orderDetail.js
  4. +0
    -1
      pages/orderList/orderDetail/orderDetail.wxml
  5. +0
    -1
      pages/orderList/orderDetail/orderDetail.wxss
  6. +7
    -4
      project.config.json

+ 18
- 3
app.js View File

@ -1,8 +1,7 @@
//app.js //app.js
var app = getApp(); var app = getApp();
App({ App({
onShow: function (options) {
onLaunch: function () {
var that = this; var that = this;
wx.getSystemInfo({ wx.getSystemInfo({
success: function (res) { success: function (res) {
@ -10,7 +9,20 @@ App({
that.globalData.winHeight = res.windowHeight; 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; var extraData = null;
//options.referrerInfo.extraData = { orderID: 33 }; //options.referrerInfo.extraData = { orderID: 33 };
// 判断是否点击其他小程序分享进入 // 判断是否点击其他小程序分享进入
@ -21,6 +33,9 @@ App({
}, },
globalData: { globalData: {
shareInPath: "",
shareInParameter: {},
shareInState: 1,
winHeight: 0, winHeight: 0,
winWidth: 0, winWidth: 0,
UserName:"", UserName:"",


+ 14
- 1
pages/homePage/homePage.js View File

@ -1,4 +1,7 @@
// pages/homePage/homePage.js // pages/homePage/homePage.js
var app = getApp()
Page({ Page({
data: { data: {
@ -6,7 +9,17 @@ Page({
}, },
onLoad: function (options) { 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) { transBtnClicked: function (event) {


+ 17
- 12
pages/orderList/orderDetail/orderDetail.js View File

@ -1,4 +1,3 @@
// pages/orderList/orderBaseInfo/orderBaseInfo.js
const app = getApp(); const app = getApp();
var network = require("../../../utils/net.js"); var network = require("../../../utils/net.js");
@ -9,24 +8,30 @@ Page({
data: { data: {
currentTab: 0, currentTab: 0,
winHeight: 0,
winHeight: app.globalData.winHeight,
orderInfo:{}, orderInfo:{},
}, },
onLoad: function(options) { 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; 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 method = LoadOrder;
var params = [ID];
var params = [detailItemID];
network.transfer_request(method, params, function (res) { 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.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'); res.result.OrderDate = timechage.formatTimeTwo(res.result.OrderDate.substring(6, 19), 'Y-M-D h:m');
that.setData({ that.setData({


+ 0
- 1
pages/orderList/orderDetail/orderDetail.wxml View File

@ -1,4 +1,3 @@
<!--pages/orderList/orderBaseInfo/orderBaseInfo.wxml-->
<view class="swiper-tab"> <view class="swiper-tab">
<view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">基本信息</view> <view class="swiper-tab-list {{currentTab==0 ? 'on' : ''}}" data-current="0" bindtap="swichNav">基本信息</view>


+ 0
- 1
pages/orderList/orderDetail/orderDetail.wxss View File

@ -1,4 +1,3 @@
/* pages/orderList/orderBaseInfo/orderBaseInfo.wxss */
page { page {
background:#EAF1F8; background:#EAF1F8;


+ 7
- 4
project.config.json View File

@ -48,10 +48,13 @@
}, },
{ {
"id": 1, "id": 1,
"name": "测试",
"pathName": "pages/login/login",
"query": "",
"scene": "1011"
"name": "公众号消息模版进入",
"pathName": "pages/orderList/orderDetail/orderDetail",
"query": "id=12",
"scene": "1043",
"referrerInfo": {
"appId": "wx246fd8f3a0273f2f"
}
} }
] ]
} }


Loading…
Cancel
Save