Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
163d32b4
Commit
163d32b4
authored
Jun 23, 2020
by
ziyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvement: 商品点击增加loading
parent
b047f4b7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
33 deletions
+102
-33
goloading.wpy
src/components/custom/goloading.wpy
+53
-0
goodsList.wpy
src/components/custom/goodsList.wpy
+39
-31
video.wpy
src/components/custom/video.wpy
+2
-2
search.wpy
src/pages/search.wpy
+8
-0
No files found.
src/components/custom/goloading.wpy
0 → 100644
View file @
163d32b4
<template>
<div class="loading-wrapper">
<van-popup show="{{show}}" overlay="{{showoverLay}}" close-on-click-overlay="{{false}}" round>
<view class="loading" v-show="showoverLay">
<van-loading type="spinner">跳转中...</van-loading>
</view>
</van-popup>
</div>
</template>
<script>
import wepy from '@wepy/core';
wepy.component({
props: {
show:{
type:Boolean,
default: false,
}
},
data: {
showoverLay: false,
},
watch: {
show(val) {
if(val){
this.showoverLay = false;
setTimeout(()=>{
this.showoverLay = true;
},500)
}
}
},
created() {
},
methods: {
}
});
</script>
<style lang="less">
.loading{
padding:40rpx;
}
</style>
<config>
{
usingComponents: {
'van-popup':'~@/components/vant/popup/index',
'van-loading': '~@/components/vant/loading/index'
}
}
</config>
src/components/custom/goodsList.wpy
View file @
163d32b4
<wxs module="tools" src="../../common/common.wxs"></wxs>
<template>
<view class="footer">
<swiper
class="footswiper"
display-multiple-items="{{swiperItem}}"
duration="300"
current="{{current}}"
bindchange="moveSwiper"
circular="{{circular}}"
previous-margin="140rpx"
next-margin="120rpx"
catch:touchmove
bindanimationfinish="swipermoveDone"
>
<!--bindtouchstart="touchStart"
bindtouchend="touchEnd"-->
<!-- {{item.select?'delete':''}} -->
<swiper-item wx:for="{{list}}" wx:key="index">
<view
data-itemid="{{index}}"
bindtap="toViewPage"
data-item="{{item}}"
class="list-item {{tools.computClass(currentIndex,index,list.length,circular)}}"
>
<image src="{{item.images}}" class="img"></image>
<view class="title">{{item.title}}</view>
<p class="price">¥{{item.price}}</p>
<p class="buy">{{item.saleCount}}人购买</p>
</view>
</swiper-item>
</swiper>
<view>
<view class="footer">
<swiper
class="footswiper"
display-multiple-items="{{swiperItem}}"
duration="300"
current="{{current}}"
bindchange="moveSwiper"
circular="{{circular}}"
previous-margin="140rpx"
next-margin="120rpx"
catch:touchmove
bindanimationfinish="swipermoveDone"
>
<!--bindtouchstart="touchStart"
bindtouchend="touchEnd"-->
<!-- {{item.select?'delete':''}} -->
<swiper-item wx:for="{{list}}" wx:key="index">
<view
data-itemid="{{index}}"
bindtap="toViewPage"
data-item="{{item}}"
class="list-item {{tools.computClass(currentIndex,index,list.length,circular)}}"
>
<image src="{{item.images}}" class="img"></image>
<view class="title">{{item.title}}</view>
<p class="price">¥{{item.price}}</p>
<p class="buy">{{item.saleCount}}人购买</p>
</view>
</swiper-item>
</swiper>
</view>
<go-loading show="{{showLoading}}"></go-loading>
</view>
</template>
<script>
...
...
@@ -100,7 +103,10 @@
},
toViewPage(e) {
let item = e.$wx.currentTarget.dataset.item;
if(this.showLoading) return;
this.showLoading = true;
getGoodsUrl({skuId:item.sourceId}).then(data=>{
this.showLoading = false;
wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74',
path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径
...
...
@@ -109,6 +115,8 @@
success(res) {
}
});
}).catch(()=>{
this.showLoading = false;
})
},
touchStart (event) {
...
...
@@ -264,7 +272,7 @@
<config>
{
"usingComponents": {
'goods-loading': '~@/components/custom/loading',
"go-loading": "~@/components/custom/goloading"
}
}
</config>
src/components/custom/video.wpy
View file @
163d32b4
...
...
@@ -67,12 +67,12 @@
nextQueue: [],
prevQueue: [],
curQueue: [],
circular:
tru
e,
circular:
fals
e,
_last: 1,
_invalidUp: 0,
_invalidDown: 0,
_videoContexts: [],
currentIndex:
0
,
currentIndex:
1
,
videoPause: false,
videoLoading: false,
},
...
...
src/pages/search.wpy
View file @
163d32b4
...
...
@@ -26,6 +26,7 @@
</view>
<view class="search-last" v-show="isLoading"><van-loading type="spinner" text-size="26rpx">加载中</van-loading></view>
<view class="search-last" v-show="isDone">没有更多了~</view>
<go-loading show="{{showLoading}}"></go-loading>
</view>
</template>
<script>
...
...
@@ -37,6 +38,7 @@
list:[],
isDone:false,
isLoading:false,
showLoading:false,
},
methods:{
backUrl() {
...
...
@@ -70,7 +72,10 @@
toJingdong(event) {
const sourceId = event.$wx.currentTarget.dataset.id;
if(sourceId === undefined) return;
if(this.showLoading) return;
this.showLoading = true;
getGoodsUrl({skuId:sourceId}).then(data=>{
this.showLoading = false;
wx.navigateToMiniProgram({
appId: 'wx91d27dbf599dff74',
path: 'pages/union/proxy/proxy?spreadUrl=' + encodeURIComponent(data), // 跳转小程序的路径
...
...
@@ -79,6 +84,8 @@
success(res) {
}
});
}).catch(()=>{
this.showLoading = false;
})
}
},
...
...
@@ -96,6 +103,7 @@
"van-field": "../components/vant/field/index",
"van-image": "../components/vant/image/index",
"van-loading": "../components/vant/loading/index",
"go-loading": "~@/components/custom/goloading",
}
}
</config>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment