Commit af5e403c authored by ziyu's avatar ziyu

improvement: 优化奖品列表

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