Browse Source

[公众号链接][新增]:用户授权后跳转

tags/湖南版5.1.4
Stormeye Wu 6 years ago
parent
commit
d2a5c7912a
2 changed files with 101 additions and 22 deletions
  1. +92
    -8
      pages/getuserinfo/index.js
  2. +9
    -14
      pages/index/index.js

+ 92
- 8
pages/getuserinfo/index.js View File

@@ -91,44 +91,111 @@ Page({
} else {
//返回主页
if (that.data.couponChannelId && !that.data.cuserId&&app.globalData.type == 'cd') {
// 跳转普通券/消费卡/限时秒杀/砍价详情
wx.navigateTo({
url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}}`
});
} else if (that.data.couponChannelId && that.data.cuserId) {
/**
* 来自转赠
*/
// 来自转赠
wx.reLaunch({
url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&cuserId=${that.data.cuserId}&coverImg=${that.data.coverImg}&userName=${that.data.userName}&avatarUrl=${that.data.avatarUrl}&couponOrderId=${that.data.couponOrderId}&updateDate=${that.data.updateDate}`
});
} else if (that.data.orderId&&app.globalData.type=='bg') {
} else if (that.data.couponChannelId && app.globalData.type == 'sd') {
// 拼团详情页
wx.redirectTo({
url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelId}`,
})
} else if (that.data.optionData.id && app.globalData.type == 'gm') {
// 游戏页面
that.getGameOne(app.globalData.token, that.data.optionData.id)
} else if (that.data.optionData.bt && that.data.optionData.id && app.globalData.type == 'bd') {
// 宣传页详情
if (that.data.optionData.bt == '2') {
// 自由图文
wx.redirectTo({
url: `/pages/freeBannerDetail/index?id=${that.data.optionData.id}`,
})
} else {
// 标准格式
wx.redirectTo({
url: `/pages/bannerdetail/index?id=${that.data.optionData.id}`,
})
}
} else if (that.data.orderId&&app.globalData.type=='bg') {
// 参与砍价
wx.navigateTo({
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.orderId}&from=${"friend"}`
});
} else if (app.globalData.type == 'uc') {
// 我的
wx.switchTab({
url: '/pages/user/index'
});
} else if (app.globalData.type == 'pc') {
// 停车
wx.switchTab({
url: '/pages/passCar/passCar'
});
} else if (app.globalData.type == 'co') {
} else if (app.globalData.type == 'mc') {
// 我的券包
wx.redirectTo({
url: '/pages/couponorder/index/index'
});
} else if (app.globalData.type == 'or') {
} else if (app.globalData.type == 'mo') {
// 我的订单
wx.redirectTo({
url: '/pages/couponorder/index/index'
url: '/pages/order/index/index?id=all'
});
} else if (app.globalData.type == 'ca') {
// 我的卡包
wx.redirectTo({
url: '/pages/cardorder/index/index'
});
} else if (app.globalData.type == 'sc') {
// 特享礼遇
wx.redirectTo({
url: '/pages/specialcourtesy/specialcourtesy'
});
} else if (app.globalData.type == 'rb') {
// 限时秒杀
wx.redirectTo({
url: '/pages/rushToBuy/index'
});
} else if (app.globalData.type == 'bl') {
// 砍价专场
wx.redirectTo({
url: '/pages/bargain/bargain'
});
} else if (app.globalData.type == 'mb') {
// 我的砍价
wx.redirectTo({
url: '/pages/bargain/bargain?from=myhtml'
});
} else if (app.globalData.type == 'sl') {
// 我的拼团
wx.redirectTo({
url: '/pages/spellGroup/spellGroup'
});
} else if (app.globalData.type == 'ms') {
// 我的拼团
wx.redirectTo({
url: '/pages/spellGroup/spellGroup?from=myhtml'
});
} else if (app.globalData.type == 'dc') {
// 消费卡
wx.redirectTo({
url: '/pages/discountCardList/discountCardList'
});
} else if (app.globalData.type == 'td') {
// 专题活动页
wx.redirectTo({
url: '/pages/topicDetail/index'
});
} else if (app.globalData.type == 'ml') {
// 门店
wx.redirectTo({
url: '/pages/index/searchbar/index'
});
} else {
wx.switchTab({
url: "/pages/main/index"
@@ -152,5 +219,22 @@ Page({
mask: false
});
})
}
},
getGameOne: function (token, id) {
let _this = this;
Http.get({
url: config.api.getOneGame,
data: {
token: token,
id: id
}
}).then(res => {
wx.redirectTo({
url: '/pages/game/index?url=' + res.data.url + "&id=" + res.data.id + "&gameId=" + res.data.gameId,
})
})
.catch(err => {
this.alphaClick();
})
},
});

+ 9
- 14
pages/index/index.js View File

@@ -57,7 +57,7 @@ Page({
wx.setStorageSync('options', JSON.stringify(options))
wx.setStorageSync('imgurl', imgurl)
app.getLocation();
if (options.couponChannelId || options.orderId) {
if (options.couponChannelId || options.orderId || options.id) {
console.log(options, 33333333333)
that.userLogin(options);
} else {
@@ -101,29 +101,24 @@ Page({
return;
}

if (options && options.couponChannelId && options.cuserId) {
// 转赠判断
wx.redirectTo({
url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}&cuserId=${options.cuserId}&coverImg=${options.coverImg}&userName=${options.userName}&avatarUrl=${options.avatarUrl}&couponOrderId=${options.couponOrderId}&updateDate=${options.updateDate}`,
})
} else if (options && options.couponChannelId && app.globalData.type == 'cd') {
if (options && options.couponChannelId && app.globalData.type == 'cd') {
// 跳转普通券/消费卡/限时秒杀/砍价详情
wx.redirectTo({
url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}`,
})
} else if (options && options.couponChannelId && options.id && app.globalData.type == 'bd') {
// 砍价详情页
} else if (options && options.couponChannelId && options.cuserId) {
// 转赠判断
wx.redirectTo({
url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}&couponId=${options.id}`,
url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}&cuserId=${options.cuserId}&coverImg=${options.coverImg}&userName=${options.userName}&avatarUrl=${options.avatarUrl}&couponOrderId=${options.couponOrderId}&updateDate=${options.updateDate}`,
})
} else if (options && options.couponChannelId && options.id && app.globalData.type == 'sd') {
} else if (options && options.couponChannelId && app.globalData.type == 'sd') {
// 拼团详情页
wx.redirectTo({
url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${options.couponChannelId}&couponId=${options.id}`,
url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${options.couponChannelId}`,
})
} else if (options && options.id && app.globalData.type == 'gm') {
// 游戏页面
that.getGameOne(token, )
that.getGameOne(app.globalData.token, options.id)
} else if (options && options.bt && options.id && app.globalData.type == 'bd') {
// 宣传页详情
if (options.bt == '2') {
@@ -316,7 +311,7 @@ Page({
}
}
Http.setToken(res.data.token);
if (options && (options.couponChannelId || options.orderId)) {
if (options && (options.couponChannelId || options.orderId || options.id)) {
that.checkuserstatus(options);
} else {
that.checkuserstatus();


Loading…
Cancel
Save