This commit is contained in:
zhangjing
2021-06-15 13:32:20 +08:00
parent e3b1e0fe99
commit ffdf4bb529
9 changed files with 151 additions and 17 deletions

View File

@@ -181,9 +181,11 @@ Page({
* 周五福利抢购
*/
Snapup(e) {
let canBuy = e.currentTarget.dataset.can,
canText = e.currentTarget.dataset.text,
canId = e.currentTarget.dataset.id
let canBuy = e.currentTarget.dataset.can,
canText = e.currentTarget.dataset.text,
canId = e.currentTarget.dataset.id,
canFrom = e.currentTarget.dataset.from,
canRightid = e.currentTarget.dataset.rightid
if(!canBuy) {
wx.showToast({
title : canText,
@@ -193,23 +195,76 @@ Page({
return
}
// 跳转分类页
wx.navigateTo({
url: '/pages/welfare/welfare?id=' + canId
wx.getStorage({
key : 'token',
success:res=>{
if(canFrom == 'washcar') {
wx.$api.index.washcarUrl(canId, canRightid).then(res=>{
const newUrl = res.data
let url= encodeURIComponent(newUrl)
wx.redirectTo({
// 跳转到webview页面
url: `/pages/washcar/washcar?url=${url}`
});
}).catch(err=>{
if(!err.login){
// 写入缓存
wx.setStorage({
key : 'token',
data : ''
})
}
})
} else {
// 跳转分类页
wx.navigateTo({
url: '/pages/welfare/welfare?id=' + canId
})
}
},
fail: (err) => {
wx.navigateTo({
url: "/pages/login/login"
})
}
})
},
/**
* 活动中心权益跳转详情
*/
rightNav(e) {
let id = e.currentTarget.dataset.id
let id = e.currentTarget.dataset.id,
from = e.currentTarget.dataset.from,
rightid = e.currentTarget.dataset.rightid
wx.getStorage({
key : 'token',
success:res=>{
wx.navigateTo({
url: '/pages/rights/rights?id=' + id
})
if(from == 'washcar') {
wx.$api.index.washcarUrl(id, rightid).then(res=>{
const newUrl = res.data
let url= encodeURIComponent(newUrl)
wx.redirectTo({
// 跳转到webview页面
url: `/pages/washcar/washcar?url=${url}`
});
}).catch(err=>{
if(!err.login){
// 写入缓存
wx.setStorage({
key : 'token',
data : ''
})
}
})
} else {
// 跳转分类页
wx.navigateTo({
url: '/pages/rights/rights?id=' + id
})
}
},
fail: (err) => {
wx.navigateTo({