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({

View File

@@ -68,7 +68,7 @@
<view class="cardArr-top">
<block wx:if="{{cardArr.length > 0}}">
<view bindtap="rightNav" wx:for="{{cardArr}}" wx:key="cardArr" class="indexCard"
data-id="{{item.right_config_id}}">
data-id="{{item.right_config_id}}" data-from="{{item.from}}" data-rightid="{{item.right_config_id}}">
<image class="indexCard-img" src="{{item.cover}}"></image>
<view class="nowrap indexCard-title">{{item.title}}</view>
<view class="nowrap activity-remark" wx:if="{{item.subtitle != null}}">
@@ -90,7 +90,7 @@
<view class="WelfareTitle"><text>周五会员福利日</text></view>
<view class="WelfareList">
<view class="WelfareList-back" bindtap="Snapup" wx:for="{{activities}}" wx:key="activities"
data-text="{{item.code_text}}" data-can="{{item.canBuy}}" data-id="{{item.welfare_id}}">
data-text="{{item.code_text}}" data-can="{{item.canBuy}}" data-id="{{item.welfare_id}}" data-from="{{item.right.from}}" data-rightId="{{item.right.right_config_id}}">
<image class="WelfareList-img {{item.surplus == 0 ? 'active' : ''}}"
src="/static/img/welfare_back.png"></image>
<view class="WelfareList-left">

69
pages/washcar/washcar.js Normal file
View File

@@ -0,0 +1,69 @@
// pages/webView/webView.js
Page({
/**
* 页面的初始数据
*/
data: {
url:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
console.log(options.url)
this.setData({
url : decodeURIComponent(options.url)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<web-view src="{{url}}"></web-view>

View File

@@ -0,0 +1 @@
/* pages/washcar/washcar.wxss */