Commit 09f1c7a7 authored by ziyu's avatar ziyu

improvement: 优化

parent 1739e3ce
...@@ -109,7 +109,6 @@ ...@@ -109,7 +109,6 @@
if(this.showLoading) return; if(this.showLoading) return;
this.showLoading = true; this.showLoading = true;
getGoodsUrl({skuId:item.sourceId,couponUrl:item.couponUrl||null}).then(data=>{ getGoodsUrl({skuId:item.sourceId,couponUrl:item.couponUrl||null}).then(data=>{
this.showLoading = false;
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74', appId: 'wx91d27dbf599dff74',
path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径 path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径
...@@ -118,6 +117,7 @@ ...@@ -118,6 +117,7 @@
success(res) { success(res) {
} }
}); });
this.showLoading = false;
}).catch(()=>{ }).catch(()=>{
this.showLoading = false; this.showLoading = false;
}) })
......
...@@ -24,8 +24,11 @@ ...@@ -24,8 +24,11 @@
@tap="videoTap" @tap="videoTap"
custom-cache="{{false}}" custom-cache="{{false}}"
wx:if="{{item.showType && item.showType.value ==2}}" wx:if="{{item.showType && item.showType.value ==2}}"
bindplay="loadMedia"
bindloadedmetadata="loadMedia"
> >
<video-pause :pause="videoPause"></video-pause> <video-pause :pause="videoPause"></video-pause>
<van-loading type="spinner" size="40" v-if="videoLoading" custom-class="video-loading"/>
<!--<video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/>--> <!--<video-loading v-if="videoLoading" :snapshot="item.videoSnapUrl"/>-->
</video> </video>
<van-image wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{item.photoUrl}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%"> <van-image wx:if="{{item.showType && item.showType.value ==1}}" use-loading-slot src="{{item.photoUrl}}" class="images" radius="10rpx" fit="contain" width="100%" height="100%">
...@@ -75,6 +78,7 @@ ...@@ -75,6 +78,7 @@
currentIndex:1, currentIndex:1,
videoPause: false, videoPause: false,
showPopup: false, showPopup: false,
videoLoading: true,
}, },
watch: { watch: {
videoList (list) { videoList (list) {
...@@ -141,6 +145,7 @@ ...@@ -141,6 +145,7 @@
}, },
moveSwiper(e) { moveSwiper(e) {
this.videoPause = false; this.videoPause = false;
this.videoLoading = true;
if (e.$wx.detail.source === 'touch') { if (e.$wx.detail.source === 'touch') {
//增加一个透明遮罩层,控制用户滑动速度,500ms内只能滑动一次,解决用户滑动过快,不触发animationfinish的bug //增加一个透明遮罩层,控制用户滑动速度,500ms内只能滑动一次,解决用户滑动过快,不触发animationfinish的bug
this.showPopup = true; this.showPopup = true;
...@@ -270,6 +275,10 @@ ...@@ -270,6 +275,10 @@
this.curQueue = [...this.curQueue]; this.curQueue = [...this.curQueue];
}, },
loadMedia() {
//如果只是视频数据加载完触发,则当再滑到这个视频的视频loading还在,如果只是paly的时候触发,初始化的时候会有问题
this.videoLoading = false;
},
} }
}); });
</script> </script>
...@@ -298,7 +307,14 @@ ...@@ -298,7 +307,14 @@
background-color: #000; background-color: #000;
z-index: 1; z-index: 1;
} }
.video-loading {
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
margin:0 auto;
}
.image-item{ .image-item{
height:100%; height:100%;
width:100%; width:100%;
......
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
border-radius: 4rpx; border-radius: 4rpx;
vertical-align: middle; vertical-align: middle;
position: relative; position: relative;
margin-right:10rpx;
&.checked{ &.checked{
background-color: @maincolor; background-color: @maincolor;
border:3rpx solid @maincolor; border:3rpx solid @maincolor;
...@@ -107,7 +108,6 @@ ...@@ -107,7 +108,6 @@
} }
} }
.checktext{ .checktext{
margin-left:10rpx;
position: relative; position: relative;
top:3rpx; top:3rpx;
&.red { &.red {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<script> <script>
import wepy from '@wepy/core'; import wepy from '@wepy/core';
import { getSearchList, getGoodsUrl } from '../common/api' import { getSearchList, getGoodsUrl } from '../common/api'
let page = 1, keyword = '' ; let page = 1;
wepy.page({ wepy.page({
data: { data: {
list:[], list:[],
...@@ -46,19 +46,14 @@ ...@@ -46,19 +46,14 @@
this.value = event.$wx.detail || ''; this.value = event.$wx.detail || '';
}, },
search() { search() {
if(keyword !== '') { page = 1;
page = 1; this.list = [];
} this.getList();
keyword = this.value;
if(page === 1) {
this.list = [];
}
this.getList(this.value);
}, },
getList(val) { getList() {
this.isLoading = true; this.isLoading = true;
this.isDone = false; this.isDone = false;
getSearchList({keyword:val,page:page}).then(data=>{ getSearchList({keyword:this.value,page:page}).then(data=>{
this.isLoading = false; this.isLoading = false;
if(!data.hasMore) { if(!data.hasMore) {
this.isDone = true; this.isDone = true;
...@@ -75,7 +70,6 @@ ...@@ -75,7 +70,6 @@
if(this.showLoading) return; if(this.showLoading) return;
this.showLoading = true; this.showLoading = true;
getGoodsUrl({skuId:item.sourceId,couponUrl:item.couponUrl||null}).then(data=>{ getGoodsUrl({skuId:item.sourceId,couponUrl:item.couponUrl||null}).then(data=>{
this.showLoading = false;
wx.navigateToMiniProgram({ wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74', appId: 'wx91d27dbf599dff74',
path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径 path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径
...@@ -84,6 +78,7 @@ ...@@ -84,6 +78,7 @@
success(res) { success(res) {
} }
}); });
this.showLoading = false;
}).catch(()=>{ }).catch(()=>{
this.showLoading = false; this.showLoading = false;
}) })
...@@ -92,7 +87,7 @@ ...@@ -92,7 +87,7 @@
onReachBottom() { onReachBottom() {
if(this.isDone) return; if(this.isDone) return;
page++; page++;
this.getList(keyword); this.getList();
}, },
}); });
</script> </script>
......
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