浏览代码

Merge branch 'dev' of xiongzhu/raex_front into master

panhui 4 年之前
父节点
当前提交
a12646a68d

+ 1 - 0
public/index.html

@@ -30,6 +30,7 @@
             </strong>
         </noscript>
         <div id="app"></div>
+        <script type="text/javascript" src="https://s4.cnzz.com/z_stat.php?id=1281049823&web_id=1281049823"></script>
         <!-- built files will be auto injected -->
     </body>
     <script>

+ 17 - 13
src/components/AppBar.vue

@@ -58,19 +58,7 @@ export default {
             } else {
                 this.show = true;
             }
-            if (this.$route.meta.tabColor) {
-                if (window.cordova && StatusBar && StatusBar.isVisible) {
-                    StatusBar.backgroundColorByHexString(this.$route.meta.tabColor);
-                    StatusBar.styleLightContent();
-                }
-                this.tabColor = this.$route.meta.tabColor;
-            } else {
-                if (window.cordova && StatusBar && StatusBar.isVisible) {
-                    StatusBar.backgroundColorByHexString('#ffffff');
-                    StatusBar.styleDefault();
-                }
-                this.tabColor = '';
-            }
+            this.getColor();
         },
         tabColor() {
             this.$nextTick(() => {
@@ -89,8 +77,24 @@ export default {
         } else {
             this.show = true;
         }
+        this.getColor();
     },
     methods: {
+        getColor() {
+            if (this.$route.meta.tabColor) {
+                if (window.cordova && StatusBar && StatusBar.isVisible) {
+                    StatusBar.backgroundColorByHexString(this.$route.meta.tabColor);
+                    StatusBar.styleLightContent();
+                }
+                this.tabColor = this.$route.meta.tabColor;
+            } else {
+                if (window.cordova && StatusBar && StatusBar.isVisible) {
+                    StatusBar.backgroundColorByHexString('#ffffff');
+                    StatusBar.styleDefault();
+                }
+                this.tabColor = '';
+            }
+        },
         onSelect(val) {
             if (val.value === 'back') {
                 this.$router.go(-1);

+ 7 - 1
src/mixins/common.js

@@ -17,7 +17,8 @@ export default {
                 ['PENDING', '认证中'],
                 ['SUCCESS', '已认证'],
                 ['FAIL', '认证失败']
-            ])
+            ]),
+            isLoading: true
         };
     },
     methods: {
@@ -187,6 +188,11 @@ export default {
             } else {
                 return error;
             }
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+            }, 1000);
         }
     }
 };

+ 27 - 5
src/views/Discover.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="discover">
+    <van-pull-refresh class="discover" v-model="isLoading" @refresh="onRefresh">
         <van-sticky ref="top" :offset-top="bar.value && bar.value.show ? 46 : 0">
             <div class="top">
                 <img src="@assets/nav_logo.png" class="logo" alt="" />
@@ -11,11 +11,17 @@
             </div>
         </van-sticky>
 
-        <swiper pagination class="mySwiper" :autoplay="{ delay: 3500 }" v-if="banners.length > 0">
+        <!-- <swiper
+            pagination
+            @swiper="setSwiperRef"
+            class="mySwiper"
+            :autoplay="{ delay: 3500 }"
+            v-if="banners.length > 0"
+        >
             <swiper-slide v-for="item in banners" :key="item.id">
                 <img :src="item.pic" @click="goNext(item)" />
             </swiper-slide>
-        </swiper>
+        </swiper> -->
 
         <van-grid :border="false" :column-num="$store.state.review || $store.state.reviewPay ? 4 : 5">
             <van-grid-item text="精选推荐" :to="{ path: '/productList' }">
@@ -122,7 +128,7 @@
         </div>
 
         <div class="tabbar-placeholder"></div>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -164,7 +170,8 @@ export default {
             finished: false,
             page: 0,
             empty: false,
-            scrollTop: 0
+            scrollTop: 0,
+            swiperRef: null
         };
     },
     mounted() {
@@ -189,6 +196,9 @@ export default {
             });
             this.getMiner();
         },
+        setSwiperRef(ref) {
+            this.swiperRef = ref;
+        },
         getProduct(type = '', sort = 'sort,desc', source = 'OFFICIAL', size = 4) {
             return this.$http
                 .post(
@@ -226,6 +236,9 @@ export default {
                 .then(res => {
                     this.banners = res.content;
                     this.$toast.clear();
+                    if (this.swiperRef) {
+                        this.swiperRef.update();
+                    }
                 });
         },
         getList() {
@@ -276,6 +289,15 @@ export default {
                     this.miners = res.content;
                     // console.log(this.miners);
                 });
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.$store.dispatch('getUsedBuy');
+                this.getInit();
+                this.page = 0;
+                this.getList();
+            }, 1000);
         }
     },
     activated() {

+ 27 - 8
src/views/Home.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="home">
+    <van-pull-refresh class="home" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <div class="filter-bg" :style="{ backgroundImage: `url(${bgImg})` }"></div>
         <div class="welcom">
             <div class="left">
@@ -21,6 +21,7 @@
             :slidesPerView="'auto'"
             :spaceBetween="20"
             :autoplay="{ delay: 3500 }"
+            @swiper="setSwiperRef"
             v-if="banners.length > 0"
         >
             <swiper-slide v-for="item in banners" :key="item.id">
@@ -46,7 +47,7 @@
                 <news-info v-for="item in news" :key="item.id" :info="item"></news-info>
             </van-list>
         </template>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -91,7 +92,8 @@ export default {
             finished: false,
             page: 0,
             empty: false,
-            bgImg: ''
+            bgImg: '',
+            swiperRef: null
         };
     },
     mounted() {
@@ -138,9 +140,14 @@ export default {
                 message: '加载中...',
                 forbidClick: true
             });
-            this.getBanner();
-            this.getProduct().then(res => {
-                this.products = res;
+            return Promise.all([
+                this.getBanner(),
+                this.getProduct().then(res => {
+                    this.products = res;
+                })
+            ]).then(() => {
+                this.$toast.clear();
+                return Promise.resolve();
             });
             // this.getNews();
         },
@@ -150,7 +157,7 @@ export default {
             });
         },
         getBanner() {
-            this.$http
+            return this.$http
                 .post(
                     '/banner/all',
                     {
@@ -164,7 +171,10 @@ export default {
                 )
                 .then(res => {
                     this.banners = res.content;
-                    this.$toast.clear();
+                    if (this.swiperRef) {
+                        this.swiperRef.update();
+                    }
+                    return Promise.resolve();
                 });
         },
         getList() {
@@ -238,6 +248,15 @@ export default {
                         this.page = this.page + 1;
                     }
                 });
+        },
+        setSwiperRef(ref) {
+            this.swiperRef = ref;
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getInit();
+            }, 1000);
         }
     }
 };

+ 60 - 51
src/views/Mine.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="mine">
+    <van-pull-refresh class="mine" v-model="isLoading" @refresh="onRefresh">
         <div class="userInfo" v-if="isLogin">
             <van-image
                 width="100%"
@@ -184,7 +184,7 @@
 
         <div class="tabbar-placeholder"></div>
         <post ref="post" :info="shareProduct" noButton></post>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -208,60 +208,63 @@ export default {
         ...mapState(['userInfo'])
     },
     mounted() {
-        this.$store.dispatch('getUserInfo');
-        if (this.isLogin) {
-            this.$http
-                .post(
-                    '/identityAuth/all',
-                    {
-                        query: {
-                            userId: this.$store.state.userInfo.id
+        this.getInit();
+    },
+    methods: {
+        getInit() {
+            this.$store.dispatch('getUserInfo');
+            if (this.isLogin) {
+                this.$http
+                    .post(
+                        '/identityAuth/all',
+                        {
+                            query: {
+                                userId: this.$store.state.userInfo.id
+                            }
+                        },
+                        { body: 'json' }
+                    )
+                    .then(res => {
+                        if (!res.empty) {
+                            this.form = res.content[0];
+                            this.org = this.form.org;
                         }
-                    },
-                    { body: 'json' }
-                )
-                .then(res => {
-                    if (!res.empty) {
-                        this.form = res.content[0];
-                        this.org = this.form.org;
-                    }
-                });
+                    });
 
-            this.$http
-                .post(
-                    '/asset/all',
-                    {
-                        query: {
-                            page: 0,
-                            size: 1,
-                            userId: this.$store.state.userInfo.id,
-                            status: 'NORMAL,TRADING,GIFTING,MINTING'
-                        }
-                    },
-                    { body: 'json' }
-                )
-                .then(res => {
-                    this.assetNum = Number(res.totalElements);
+                this.$http
+                    .post(
+                        '/asset/all',
+                        {
+                            query: {
+                                page: 0,
+                                size: 1,
+                                userId: this.$store.state.userInfo.id,
+                                status: 'NORMAL,TRADING,GIFTING,MINTING'
+                            }
+                        },
+                        { body: 'json' }
+                    )
+                    .then(res => {
+                        this.assetNum = Number(res.totalElements);
+                    });
+
+                this.getProduct();
+                this.$http.get('/sysConfig/get/share_lvzhoushi_num').then(res => {
+                    if (res.value) {
+                        this.shareMoney = Number(res.value);
+                    }
                 });
+            }
 
-            this.getProduct();
-            this.$http.get('/sysConfig/get/share_lvzhoushi_num').then(res => {
-                if (res.value) {
-                    this.shareMoney = Number(res.value);
-                }
+            if (window.cordova && StatusBar && StatusBar.isVisible) {
+                StatusBar.backgroundColorByHexString('#222426');
+                StatusBar.styleLightContent();
+            }
+            this.$nextTick(() => {
+                this.$el.parentNode.childNodes[1].className =
+                    this.$el.parentNode.childNodes[1].className.replace(/ bgBack/, '') + ' bgBack';
             });
-        }
-
-        if (window.cordova && StatusBar && StatusBar.isVisible) {
-            StatusBar.backgroundColorByHexString('#222426');
-            StatusBar.styleLightContent();
-        }
-        this.$nextTick(() => {
-            this.$el.parentNode.childNodes[1].className =
-                this.$el.parentNode.childNodes[1].className.replace(/ bgBack/, '') + ' bgBack';
-        });
-    },
-    methods: {
+        },
         copy() {
             this.$copyText(this.userInfo.id).then(
                 e => {
@@ -324,6 +327,12 @@ export default {
                         this.$toast(e);
                     }
                 });
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getInit();
+            }, 1000);
         }
     },
     beforeRouteLeave(to, from, next) {

+ 14 - 3
src/views/Store.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="discover">
+    <van-pull-refresh class="discover" v-model="isLoading" @refresh="onRefresh">
         <van-sticky ref="top" :offset-top="bar.value && bar.value.show ? 46 : 0">
             <div class="top">
                 <div class="top-btn">
@@ -106,7 +106,7 @@
         />
 
         <div class="tabbar-placeholder"></div>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -357,7 +357,11 @@ export default {
                     { body: 'json' }
                 )
                 .then(res => {
-                    this.list = [...this.list, ...res.content];
+                    if (res.first) {
+                        this.list = res.content;
+                    } else {
+                        this.list = [...this.list, ...res.content];
+                    }
                     this.empty = res.empty;
                     this.loading = false;
                     this.finished = res.last;
@@ -426,6 +430,13 @@ export default {
         },
         goTop() {
             this.changeScroll(0, true);
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.page = 0;
+                this.getList();
+            }, 1000);
         }
     }
 };

+ 8 - 2
src/views/activity/List1.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="search">
+    <van-pull-refresh class="search" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <div class="filter-bg" :style="{ backgroundImage: `url(${filterBg})` }"></div>
         <div class="header">铸造活动</div>
         <van-list v-model:loading="loading" :finished="finished" finished-text="" @load="getData">
@@ -34,7 +34,7 @@
 
             <van-empty v-if="empty" description="暂无活动哦~" :image="require('@assets/kong_png_wusousuo.png')" />
         </van-list>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -65,6 +65,12 @@ export default {
                     del: false
                 }
             };
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getData(true);
+            }, 1000);
         }
     }
 };

+ 8 - 2
src/views/asset/Detail.vue

@@ -1,6 +1,6 @@
 /* eslint-disable no-empty */
 <template>
-    <div class="detail">
+    <van-pull-refresh class="detail" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <product-banner :info="info" pageType="asset"></product-banner>
 
         <div class="info">
@@ -327,7 +327,7 @@
             :id="orderInfo.id"
             :imgSrc="getImg(changeImgs(info.pic))"
         ></order-open>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -707,6 +707,12 @@ export default {
                     this.getTime();
                 }, 1000);
             }
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getProduct(true);
+            }, 1000);
         }
     },
     beforeRouteLeave(from, to, next) {

+ 10 - 2
src/views/creator/Detail.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="mine">
+    <van-pull-refresh class="mine" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <div class="userInfo">
             <van-image
                 width="100%"
@@ -133,7 +133,7 @@
                 description="没有任何收藏品哦~"
             />
         </van-list>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -274,6 +274,14 @@ export default {
                 .then(res => {
                     this.hots = res.content;
                 });
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getData(true);
+                this.getInfo();
+                this.getHot();
+            }, 1000);
         }
     }
 };

+ 8 - 2
src/views/creator/List.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="follow">
+    <van-pull-refresh class="follow" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <van-sticky ref="top" :offset-top="bar.value && bar.value.show ? 46 : 0">
             <div class="top">
                 <div class="name">铸造者</div>
@@ -35,7 +35,7 @@
                 description="没有任何藏品哦~"
             />
         </van-list>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -80,6 +80,12 @@ export default {
                 query: { minter: true },
                 sort: this.sort
             };
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getData(true);
+            }, 1000);
         }
     },
     activated() {

+ 10 - 3
src/views/order/ActivityDetail.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="order">
+    <van-pull-refresh class="order" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <div class="order-content">
             <div class="order-top">
                 <div class="text1">{{ getLabelName(info.status, statusOptions) }}</div>
@@ -82,7 +82,7 @@
                 <van-button class="sure" type="primary" block @click.prevent="sure" round> 确认收货 </van-button>
             </div>
         </div>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -182,7 +182,14 @@ export default {
 
                     this.getInfo();
                 });
-        }
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getInfo();
+            }, 1000);
+        },
+        
     },
     beforeRouteLeave() {
         if (this.timer) {

+ 8 - 2
src/views/order/ActivityOrders.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="discover">
+    <van-pull-refresh class="discover" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <van-sticky ref="top" :offset-top="bar.value && bar.value.show ? 46 : 0">
             <!-- <div class="top">
                 <div class="top-btn">
@@ -26,7 +26,7 @@
             ></order-info-act>
             <van-empty v-if="empty" description="你还没有订单哦~" :image="require('@assets/kong_png_wudingdan.png')" />
         </van-list>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -113,6 +113,12 @@ export default {
             });
             this.type = type;
             this.getData(true);
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getData(true);
+            }, 1000);
         }
     }
 };

+ 22 - 13
src/views/order/Detail.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="order">
+    <van-pull-refresh class="order" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <div class="order-content">
             <div class="order-top">
                 <div class="text1">{{ getLabelName(info.status, statusOptions) }}</div>
@@ -70,7 +70,7 @@
             </div>
         </div>
         <order-open ref="box" :id="info.id" :imgSrc="getImg(changeImgs(collection.pic))"></order-open>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -89,19 +89,22 @@ export default {
     },
     mixins: [order, product],
     mounted() {
-        this.$toast.loading({
-            message: '加载中...',
-            forbidClick: true
-        });
-        this.$http.get('/order/get/' + this.$route.query.id).then(res => {
-            this.info = res;
-            this.$toast.clear();
-            if (this.info.type === 'BLIND_BOX' && !this.info.opened) {
-                this.openBlindBox();
-            }
-        });
+        this.getDetail();
     },
     methods: {
+        getDetail() {
+            this.$toast.loading({
+                message: '加载中...',
+                forbidClick: true
+            });
+            this.$http.get('/order/get/' + this.$route.query.id).then(res => {
+                this.info = res;
+                this.$toast.clear();
+                if (this.info.type === 'BLIND_BOX' && !this.info.opened) {
+                    this.openBlindBox();
+                }
+            });
+        },
         copy() {
             this.$copyText(this.info.id).then(
                 e => {
@@ -145,6 +148,12 @@ export default {
                 }
                 this.timeout = null;
             }, 10000);
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getDetail();
+            }, 1000);
         }
     },
     beforeRouteLeave() {

+ 8 - 2
src/views/order/Orders.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="discover">
+    <van-pull-refresh class="discover" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <van-sticky ref="top" :offset-top="bar.value && bar.value.show ? 46 : 0">
             <div class="top">
                 <div class="top-btn">
@@ -24,7 +24,7 @@
             <order-info @delFn="delFn" v-for="item in list" :key="item.id" :info="item"></order-info>
             <van-empty v-if="empty" description="你还没有订单哦~" :image="require('@assets/kong_png_wudingdan.png')" />
         </van-list>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -103,6 +103,12 @@ export default {
             });
             this.type = type;
             this.getData(true);
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getData(true);
+            }, 1000);
         }
     }
 };

+ 24 - 15
src/views/product/Detail.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="detail">
+    <van-pull-refresh class="detail" v-model="isLoading" @refresh="onRefresh">
         <product-banner
             :startTime="startTime"
             :assignment="!!assignment"
@@ -295,7 +295,7 @@
                         >
                             存在未支付无效订单
                         </van-button>
-                        <van-button class="no-btn" v-else-if="!info.totalQuota" block round> 积分结算中 </van-button>
+                        <van-button class="no-btn" v-else-if="!info.totalQuota" block round> 结算中 </van-button>
 
                         <van-button @click="share" v-else type="primary" block round>邀请获取白名单 </van-button>
                     </template>
@@ -325,7 +325,7 @@
         <!-- <driver /> -->
 
         <post ref="post" :info="info" noButton />
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -399,18 +399,7 @@ export default {
         }
     },
     mounted() {
-        this.$store.dispatch('getUsedBuy');
-        // this.$store.dispatch('getTime');
-        this.$store.dispatch('getUserInfo');
-        console.log(this.$route.params);
-        if (this.$route.params.id) {
-            this.collectionId = this.$route.params.id;
-        }
-        this.$http.get('/order/checkLimit', { collectionId: this.collectionId }).then(res => {
-            this.limit = res;
-        });
-
-        this.getProduct();
+        this.getInit();
         // if (this.isLogin) {
         //     this.$http
         //         .post(
@@ -432,6 +421,20 @@ export default {
         // }
     },
     methods: {
+        getInit() {
+            this.$store.dispatch('getUsedBuy');
+            // this.$store.dispatch('getTime');
+            this.$store.dispatch('getUserInfo');
+            console.log(this.$route.params);
+            if (this.$route.params.id) {
+                this.collectionId = this.$route.params.id;
+            }
+            this.$http.get('/order/checkLimit', { collectionId: this.collectionId }).then(res => {
+                this.limit = res;
+            });
+
+            this.getProduct();
+        },
         preview(index = 0, list = []) {
             ImagePreview({
                 images: [...list].map(item => {
@@ -653,6 +656,12 @@ export default {
             } else {
                 this.buy();
             }
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getInit();
+            }, 1000);
         }
     }
 };

+ 22 - 3
src/views/product/List.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="follow">
+    <van-pull-refresh class="follow" v-model="isLoading" @refresh="onRefresh">
         <div class="swiperContent" ref="swiperContent">
             <swiper
                 pagination
@@ -8,6 +8,7 @@
                 :spaceBetween="20"
                 :autoplay="{ delay: 3500 }"
                 v-if="banners.length > 0"
+                @swiper="setSwiperRef"
             >
                 <swiper-slide v-for="item in banners" :key="item.id">
                     <img :src="item.pic" @click="goNext(item, '&source=TRANSFER')" />
@@ -81,7 +82,7 @@
                 description="没有任何藏品哦~"
             />
         </van-list>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -137,7 +138,8 @@ export default {
             salable: '',
             scrollTop: 0,
             showAction: false,
-            banners: []
+            banners: [],
+            swiperRef: null
         };
     },
     computed: {
@@ -224,6 +226,9 @@ export default {
                 )
                 .then(res => {
                     this.banners = res.content;
+                    if (this.swiperRef) {
+                        this.swiperRef.update();
+                    }
                 });
         },
         changeSort() {
@@ -277,6 +282,20 @@ export default {
                 url += '?source=' + this.source;
             }
             this.$router.push(url);
+        },
+        setSwiperRef(ref) {
+            this.swiperRef = ref;
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                if (this.source === 'TRANSFER') {
+                    this.getBanner();
+                } else {
+                    this.banners = [];
+                }
+                this.getData(true);
+            }, 1000);
         }
     },
     activated() {

+ 22 - 2
src/views/product/Search.vue

@@ -1,5 +1,10 @@
 <template>
-    <div class="search" :style="{ backgroundColor: isSearch ? $colors.bg3 : $colors.bg }">
+    <van-pull-refresh
+        class="search"
+        :style="{ backgroundColor: isSearch ? $colors.bg3 : $colors.bg }"
+        v-model="isLoading"
+        @refresh="onRefresh"
+    >
         <van-sticky ref="top" class="list-top" :offset-top="bar.value && bar.value.show ? 46 : 0">
             <van-search
                 ref="top"
@@ -99,7 +104,7 @@
                 </div>
             </div>
         </div>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -232,6 +237,21 @@ export default {
                 search: this.search,
                 sort: this.sort === 'id,desc' ? this.sortOptions[this.title] || sort : sort
             };
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                if (this.isSearch) {
+                    this.getData(true);
+                } else {
+                    this.$http.get('sysConfig/get/hot_search').then(res => {
+                        this.hots = res.value.split(',').filter(item => {
+                            return item !== ' ' && !!item;
+                        });
+                    });
+                    this.getHistory();
+                }
+            }, 1000);
         }
     },
     activated() {

+ 15 - 5
src/views/user/Exchange.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="search">
+    <van-pull-refresh class="search" v-model="isLoading" :head-height="80" @refresh="onRefresh">
         <van-sticky>
             <div class="tabs">
                 <div class="tab-item" :class="{ active: !isBuy }" @click="changeBuy(false)">价值证明</div>
@@ -39,7 +39,7 @@
 
             <van-empty v-if="empty" description="暂无交易历史哦~" :image="require('@assets/kong_png_wusousuo.png')" />
         </van-list>
-    </div>
+    </van-pull-refresh>
 </template>
 
 <script>
@@ -59,11 +59,14 @@ export default {
         };
     },
     mounted() {
-        this.$http.get('/asset/breakdown').then(res => {
-            this.info = res;
-        });
+        this.getMoeny();
     },
     methods: {
+        getMoeny() {
+            this.$http.get('/asset/breakdown').then(res => {
+                this.info = res;
+            });
+        },
         changeBuy(isBuy) {
             this.isBuy = isBuy;
             this.getData(true);
@@ -82,6 +85,13 @@ export default {
                     }
                 };
             }
+        },
+        onRefresh() {
+            setTimeout(() => {
+                this.isLoading = false;
+                this.getMoeny();
+                this.getData(true);
+            }, 1000);
         }
     }
 };