Commit af5e403c authored by ziyu's avatar ziyu

improvement: 优化奖品列表

parent 42097f7b
......@@ -8,8 +8,14 @@ if (env === 'test') {
// baseUrl = 'https://luckiiapi.q-gp.com/yapi/mock/325';
}
const request = async (url, options) => {
const pages = getCurrentPages();
const safeAreaInsetTop = pages && pages.length > 0 ? pages[pages.length - 1].route === 'pages/index' : false;
const pages = getCurrentPages() || [];
let safeAreaInsetTop = false;
if(pages.length === 0) {
// 如果页面还没加载出来,只能说明现在刚进入首页
safeAreaInsetTop = true;
}else if(pages[pages.length - 1].route === 'pages/index') {
safeAreaInsetTop = true;
}
const defaultOptions = {
method: 'post',
header: { 'content-type': 'application/x-www-form-urlencoded' }
......
<template>
<div class="loading-wrapper">
<van-popup show="{{show}}" overlay="{{showoverLay}}" close-on-click-overlay="{{false}}" round>
<view class="loading" v-show="showoverLay">
<van-popup show="{{show}}" close-on-click-overlay="{{false}}" overlay-style="{{overLayStyle}}" round>
<view class="loading" v-show="!overLayStyle">
<van-loading type="spinner">跳转中...</van-loading>
</view>
</van-popup>
......@@ -18,14 +18,14 @@
}
},
data: {
showoverLay: false,
overLayStyle: 'background-color:transparent',
},
watch: {
show(val) {
if(val){
this.showoverLay = false;
this.overLayStyle = 'background-color:transparent';
setTimeout(()=>{
this.showoverLay = true;
this.overLayStyle = '';
},500)
}
}
......
......@@ -103,9 +103,8 @@
},
toViewPage(e) {
let item = e.$wx.currentTarget.dataset.item;
if(this.showLoading) return;
this.showLoading = true;
getGoodsUrl({skuId:item.sourceId}).then(data=>{
getGoodsUrl({skuId:item.sourceId,couponUrl:item.couponUrl||null}).then(data=>{
this.showLoading = false;
wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74',
......
......@@ -15,8 +15,7 @@
class="video-item"
id="video_{{index}}"
loop
enable-play-gesture
enable-progress-gesture
enable-progress-gesture="{{false}}"
show-center-play-btn="{{false}}"
controls="{{false}}"
src="{{item.videoUrl}}"
......@@ -43,6 +42,7 @@
</view>
</swiper-item>
</swiper>
<van-popup show="{{showPopup}}" close-on-click-overlay="{{false}}" overlay-style="background-color:transparent"></van-popup>
</view>
</template>
<script>
......@@ -74,7 +74,7 @@
_videoContexts: [],
currentIndex:1,
videoPause: false,
videoLoading: false,
showPopup: false,
},
watch: {
videoList (list) {
......@@ -140,6 +140,10 @@
moveSwiper(e) {
this.videoPause = false;
if (e.$wx.detail.source === 'touch') {
this.showPopup = true;
setTimeout(()=>{
this.showPopup = false
},500);
const current = e.$wx.detail.current;
this.currentIndex = current;
//如果next中如果就剩下4个了,请求下一页
......@@ -213,7 +217,12 @@
//滑动到当前元素时,其他video都暂停,只播放当前video
this._videoContexts.forEach(function (ctx, index) {
if(ctx) {
index !== current ? ctx.pause() : ctx.play();
if(index !== current) {
ctx.pause()
}else {
ctx.seek(0);
ctx.play();
}
}
});
this.updateAwardsInfo(current)
......@@ -269,7 +278,8 @@
'video-loading': '~@/components/custom/loading',
"van-loading": "~@/components/vant/loading/index",
"van-image": "~@/components/vant/image/index",
"image-loading":"~@/components/custom/loading"
"image-loading":"~@/components/custom/loading",
'van-popup':'~@/components/vant/popup/index',
},
}
</config>
......@@ -340,5 +350,8 @@
background-color: rgba(0,0,0,0.7);
}
}
.container .van-overlay {
background-color: transparent;
}
</style>
......@@ -78,7 +78,7 @@
<view class="prize-info">中奖概率: {{chance}}</view>
<view class="prize-info">中奖结果: <text class="red">已中奖</text></view>
</view>
<view class="prize-address" v-show="!prize.cash">
<view class="prize-address" v-show="!prize.cash&&prize.cash!==undefined">
<view class="address-title">添加收货地址</view>
<view class="address-cont">
<van-field value="{{name}}" data-form="name" placeholder="收货人" bind:input ="setValue"></van-field>
......
......@@ -291,7 +291,7 @@
updateUserPhone(detail).then(() => {
wx.setStorageSync('hasPhone', true);
that.btnfont = '立即参与';
this.hasPhone = true;
that.hasPhone = true;
that.joinin();
}).catch(() => {
that.btnfont = '立即参与';
......
......@@ -7,7 +7,7 @@
<view class="search-cancel" bindtap="backUrl">取消</view>
</view>
<view class="search-list" v-show="list.length">
<view class="search-item" wx:for="{{list}}" wx:key="index" bindtap="toJingdong" data-id="{{item.sourceId}}">
<view class="search-item" wx:for="{{list}}" wx:key="index" bindtap="toJingdong" data-item="{{item}}">
<view class="image-left">
<van-image use-loading-slot src="{{item.images}}" class="img" width="240rpx" height="240rpx" radius="10rpx" fit="cover">
<van-loading slot="loading" type="spinner" size="20" vertical />
......@@ -19,7 +19,7 @@
{{item.title}}
</view>
<view class="cont-price"><text class="dollar">¥</text>{{item.price}}</view>
<view class="cont-count">{{item.shopName}}</view>
<view class="cont-count">{{item.shopName || '京东自营店'}}</view>
</view>
</view>
</view>
......@@ -70,11 +70,10 @@
});
},
toJingdong(event) {
const sourceId = event.$wx.currentTarget.dataset.id;
if(sourceId === undefined) return;
if(this.showLoading) return;
const item = event.$wx.currentTarget.dataset.item;
if(item === undefined) return;
this.showLoading = true;
getGoodsUrl({skuId:sourceId}).then(data=>{
getGoodsUrl({skuId:item.sourceId,couponUrl:item.couponUrl||null}).then(data=>{
this.showLoading = false;
wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment