xuqiang 4 лет назад
Родитель
Сommit
f0757a9a67
1 измененных файлов с 28 добавлено и 17 удалено
  1. 28 17
      src/pages/Home.vue

+ 28 - 17
src/pages/Home.vue

@@ -9,7 +9,8 @@
 </config>
 <template>
     <div class="container">
-        <van-sticky @scroll="e => debounce(() => touchmove(e), 500)">
+        <!-- @scroll="e => debounce(() => touchmove(e), 500)" -->
+        <van-sticky>
             <div class="container-bg">
                 <div class="mytest">
                     <img class="mytest" :src="bgImg" alt="" />
@@ -114,20 +115,24 @@ export default {
             return info ? info.image : '';
         }
     },
+    onReachBottom() {
+        this.page++;
+        this.getData();
+    },
     methods: {
-        touchmove(e) {
-            const query = wx.createSelectorQuery();
-            query.select('#boxWrap').boundingClientRect();
-            query.selectViewport().scrollOffset();
-            query.exec(res => {
-                // console.log(res[0]);
-                if (res[0].top == this.scroll_top) {
-                    this.scroll_top = this.scroll_top - 830;
-                    this.page++;
-                    this.getData();
-                }
-            });
-        },
+        // touchmove(e) {
+        //     const query = wx.createSelectorQuery();
+        //     query.select('#boxWrap').boundingClientRect();
+        //     query.selectViewport().scrollOffset();
+        //     query.exec(res => {
+        //         // console.log(res[0]);
+        //         if (res[0].top == this.scroll_top) {
+        //             this.scroll_top = this.scroll_top - 830;
+        //             this.page++;
+        //             this.getData();
+        //         }
+        //     });
+        // },
         getSeries() {
             return this.$http
                 .post(
@@ -174,12 +179,18 @@ export default {
             data.size = this.size;
             data.page = this.page;
             this.$http
-                .get('/cardCase/showCasesMA', data)
+                .get('/cardCase/showCasesMA2', data)
                 .then(res => {
                     // console.log(res);
+                    let array = [];
                     this.hideLoading();
-                    this.list = [...this.list, ...res.content];
-                    if (this.list === 0) {
+                    array = [...this.list, ...res.content];
+                    let temp = {};
+                    this.list = array.reduce((total, item) => {
+                        temp[item.cardCaseId] ? '' : (temp[item.cardCaseId] = total.push(item));
+                        return total;
+                    }, []);
+                    if (this.list.length === 0) {
                         this.empty = true;
                     }
                 })