panhui 5 年之前
父節點
當前提交
bece84bf1d

+ 4 - 1
src/components/Banner.vue

@@ -13,7 +13,7 @@
                         @click="goDetail"
                         @click="goDetail"
                     />
                     />
                     <div class="video" v-else>
                     <div class="video" v-else>
-                        <video class="video-content" id="swiperVideo" :src="item.img"></video>
+                        <video class="video-content" id="swiperVideo" @play="playVideo" :src="item.img"></video>
                     </div>
                     </div>
                 </swiper-item>
                 </swiper-item>
             </swiper>
             </swiper>
@@ -131,6 +131,9 @@ export default {
                 video.pause();
                 video.pause();
             }
             }
             this.current = e.detail.current;
             this.current = e.detail.current;
+        },
+        playVideo() {
+            this.$emit('update:autoplay', false);
         }
         }
     },
     },
     onPageScroll(e) {
     onPageScroll(e) {

+ 25 - 16
src/mixins/searchList.js

@@ -173,20 +173,24 @@ export default {
                 this.page = 1;
                 this.page = 1;
                 this.search = this.searchKey;
                 this.search = this.searchKey;
                 this.getData();
                 this.getData();
-                wx.pageScrollTo({
-                    scrollTop: this.searchTop,
-                    duration: 300
-                });
+                if (this.searchTop != -1) {
+                    wx.pageScrollTo({
+                        scrollTop: this.searchTop,
+                        duration: 300
+                    });
+                }
             });
             });
         },
         },
         refreash() {
         refreash() {
             this.list = [];
             this.list = [];
             this.page = 1;
             this.page = 1;
             this.getData();
             this.getData();
-            wx.pageScrollTo({
-                scrollTop: this.searchTop,
-                duration: 300
-            });
+            if (this.searchTop != -1) {
+                wx.pageScrollTo({
+                    scrollTop: this.searchTop,
+                    duration: 300
+                });
+            }
         },
         },
         showFilter() {
         showFilter() {
             const _query = { ...this.filterQuery };
             const _query = { ...this.filterQuery };
@@ -202,18 +206,23 @@ export default {
         },
         },
         changeShowType() {
         changeShowType() {
             this.showType = this.showType === 'grid' ? 'row' : 'grid';
             this.showType = this.showType === 'grid' ? 'row' : 'grid';
-            wx.pageScrollTo({
-                scrollTop: this.searchTop,
-                duration: 300
-            });
+            if (this.searchTop != -1) {
+                wx.pageScrollTo({
+                    scrollTop: this.searchTop,
+                    duration: 300
+                });
+            }
         }
         }
     },
     },
     watch: {
     watch: {
         sort() {
         sort() {
-            wx.pageScrollTo({
-                scrollTop: this.searchTop,
-                duration: 300
-            });
+            if (this.searchTop != -1) {
+                wx.pageScrollTo({
+                    scrollTop: this.searchTop,
+                    duration: 300
+                });
+            }
+
             this.page = 1;
             this.page = 1;
             this.getData();
             this.getData();
         },
         },

+ 5 - 5
src/pagesProduct/Detail.vue

@@ -702,21 +702,21 @@ export default {
 }
 }
 
 
 .fixed-bottom {
 .fixed-bottom {
-    height: 60px;
+    height: calc(60px + constant(safe-area-inset-bottom));
+    height: calc(60px + env(safe-area-inset-bottom));
     padding-bottom: calc(8px + constant(safe-area-inset-bottom));
     padding-bottom: calc(8px + constant(safe-area-inset-bottom));
     padding-bottom: calc(8px + env(safe-area-inset-bottom));
     padding-bottom: calc(8px + env(safe-area-inset-bottom));
 
 
     .fixed-bottom-content {
     .fixed-bottom-content {
         background-color: @bgw;
         background-color: @bgw;
         padding: 0px 16px;
         padding: 0px 16px;
-        padding-bottom: calc(0px + constant(safe-area-inset-bottom));
-        padding-bottom: calc(0px + env(safe-area-inset-bottom));
-
+        height: 59px;
+        padding-bottom: calc(1px + constant(safe-area-inset-bottom));
+        padding-bottom: calc(1px + env(safe-area-inset-bottom));
         position: fixed;
         position: fixed;
         left: 0;
         left: 0;
         right: 0;
         right: 0;
         bottom: 0;
         bottom: 0;
-        height: 60px;
         display: flex;
         display: flex;
         z-index: 200;
         z-index: 200;
         // box-sizing: border-box;
         // box-sizing: border-box;

+ 3 - 2
src/pagesVendor/About.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
     <div>
     <div>
-        <banner v-if="info.img" :banners="banners" :height="180" :autoplay="false"></banner>
+        <banner v-if="info.img" :banners="banners" :height="180" :autoplay.sync="autoplay"></banner>
 
 
         <div class="auto-content">
         <div class="auto-content">
             <div class="box" :style="{ order: decorationInfo.introductionOrder }">
             <div class="box" :style="{ order: decorationInfo.introductionOrder }">
@@ -98,7 +98,8 @@ export default {
         return {
         return {
             productList: [],
             productList: [],
             colors: ['#6060B3', '#607CB3', '#A2B360', '#B3A260', '#60B397', '#6097B3'],
             colors: ['#6060B3', '#607CB3', '#A2B360', '#B3A260', '#60B397', '#6097B3'],
-            decorationInfo: {}
+            decorationInfo: {},
+            autoplay: true
         };
         };
     },
     },
     mixins: [vendorInfo],
     mixins: [vendorInfo],

+ 23 - 8
src/pagesVendor/Detail.vue

@@ -45,8 +45,8 @@
                     <div class="text">{{ isCollection ? '已关注' : '关注' }}</div>
                     <div class="text">{{ isCollection ? '已关注' : '关注' }}</div>
                 </div>
                 </div>
             </div>
             </div>
-            <div class="line" id="top"></div>
-            <div class="main">
+            <div class="line"></div>
+            <div class="main" id="top">
                 <van-sticky :scroll-top="scrollTop" :offset-top="offsetTop">
                 <van-sticky :scroll-top="scrollTop" :offset-top="offsetTop">
                     <van-tabs :sticky="false" :active="active" :line-height="0" @change="active = $event.detail.index">
                     <van-tabs :sticky="false" :active="active" :line-height="0" @change="active = $event.detail.index">
                         <van-tab title="关于展商"> </van-tab>
                         <van-tab title="关于展商"> </van-tab>
@@ -63,7 +63,13 @@
                     :showConnect="showConnect"
                     :showConnect="showConnect"
                     @changeActive="changeActive"
                     @changeActive="changeActive"
                 ></about>
                 ></about>
-                <product v-else-if="active === 1" :vendorInfo="vendorInfo" :fixedTop="searchTop"></product>
+                <product
+                    ref="product"
+                    v-else-if="active === 1"
+                    :vendorInfo="vendorInfo"
+                    :fixedTop="headerTop"
+                    :scrollEnabled="scrollEnabled"
+                ></product>
                 <news v-else-if="active === 2" :vendorInfo="vendorInfo"></news>
                 <news v-else-if="active === 2" :vendorInfo="vendorInfo"></news>
             </div>
             </div>
         </scroll-view>
         </scroll-view>
@@ -112,7 +118,9 @@ export default {
             main: null,
             main: null,
             scrollTop: 0,
             scrollTop: 0,
             offsetTop: 0,
             offsetTop: 0,
-            scrollId: ''
+            scrollId: '',
+            scrollEnabled: false,
+            headerTop: 0
         };
         };
     },
     },
     computed: {
     computed: {
@@ -143,6 +151,11 @@ export default {
             } else {
             } else {
                 this.showConnect = true;
                 this.showConnect = true;
             }
             }
+            if (event.detail.scrollTop < this.offsetTop - 44) {
+                this.scrollEnabled = false;
+            } else {
+                this.scrollEnabled = true;
+            }
         },
         },
         changeActive(index) {
         changeActive(index) {
             this.active = index;
             this.active = index;
@@ -176,13 +189,13 @@ export default {
                     .select('#vendor')
                     .select('#vendor')
                     .boundingClientRect(rect => {
                     .boundingClientRect(rect => {
                         this.searchTop = this.searchTop - rect.height;
                         this.searchTop = this.searchTop - rect.height;
+                        this.headerTop = rect.height;
                     })
                     })
                     .exec();
                     .exec();
             })
             })
             .exec();
             .exec();
     },
     },
     onPageScroll(e) {
     onPageScroll(e) {
-        console.log(e);
         if (e.scrollTop < 115) {
         if (e.scrollTop < 115) {
             this.showConnect = false;
             this.showConnect = false;
         } else {
         } else {
@@ -198,10 +211,12 @@ export default {
     },
     },
     watch: {
     watch: {
         active() {
         active() {
-            this.scrollId = 'top';
             setTimeout(() => {
             setTimeout(() => {
-                this.scrollId = '';
-            }, 200);
+                this.scrollId = 'top';
+                setTimeout(() => {
+                    this.scrollId = '';
+                }, 200);
+            }, 100);
         }
         }
     }
     }
 };
 };

+ 39 - 11
src/pagesVendor/Product.vue

@@ -1,19 +1,30 @@
 <template>
 <template>
-    <div class="productPage" :style="{ minHeight: ` calc(100vh - ${barHeight}px - 44px)` }">
-        <scroll-view :scroll-top="scrollTop" :scroll-y="true" class="left-side" v-if="menus.length > 0">
+    <div class="productPage" :style="{ minHeight: ` calc( 100vh - ${fixedTop}px - ${barHeight}px + 44px )` }">
+        <scroll-view
+            :style="{ height: `calc( 100vh - ${fixedTop}px - ${barHeight}px  + 44px )` }"
+            :scroll-y="scrollEnabled"
+            class="left-side"
+            v-if="menus.length > 0"
+        >
             <van-sidebar :active-key="activeKey" @change="changeCustomCate">
             <van-sidebar :active-key="activeKey" @change="changeCustomCate">
                 <van-sidebar-item title="全部产品" />
                 <van-sidebar-item title="全部产品" />
                 <van-sidebar-item :title="getName(item)" :key="item.id" v-for="item in menus" />
                 <van-sidebar-item :title="getName(item)" :key="item.id" v-for="item in menus" />
             </van-sidebar>
             </van-sidebar>
         </scroll-view>
         </scroll-view>
-
-        <div class="right">
-            <sort-list :empty="empty" :loading="loading" :finish="finish" top="0px">
-                <div class="product-row-list">
-                    <product-row v-for="item in list" :key="item.id" :info="item"></product-row>
-                </div>
-            </sort-list>
-        </div>
+        <scroll-view
+            :style="{ height: `calc( 100vh - ${fixedTop}px - ${barHeight}px + 44px )` }"
+            :scroll-y="scrollEnabled"
+            class="right-side"
+            @scrolltolower="getMore"
+        >
+            <div class="right">
+                <sort-list :empty="empty" :loading="loading" :finish="finish" :top="`${fixedTop}px`">
+                    <div class="product-row-list">
+                        <product-row v-for="(item, index) in list" :key="index" :info="item"></product-row>
+                    </div>
+                </sort-list>
+            </div>
+        </scroll-view>
     </div>
     </div>
 </template>
 </template>
 <script>
 <script>
@@ -27,7 +38,8 @@ export default {
         return {
         return {
             menus: [],
             menus: [],
             activeKey: 0,
             activeKey: 0,
-            url: '/product/show'
+            url: '/product/show',
+            searchTop: -1
         };
         };
     },
     },
     mixins: [searchList],
     mixins: [searchList],
@@ -37,6 +49,14 @@ export default {
             default: () => {
             default: () => {
                 return {};
                 return {};
             }
             }
+        },
+        fixedTop: {
+            type: Number,
+            default: 0
+        },
+        scrollEnabled: {
+            type: Boolean,
+            default: false
         }
         }
     },
     },
     computed: {
     computed: {
@@ -75,6 +95,12 @@ export default {
         changeCustomCate(e) {
         changeCustomCate(e) {
             this.activeKey = e.detail;
             this.activeKey = e.detail;
             this.refreash();
             this.refreash();
+        },
+        getMore() {
+            if (!this.loading && !this.finish) {
+                this.page++;
+                this.getData();
+            }
         }
         }
     },
     },
     components: {
     components: {
@@ -96,6 +122,8 @@ export default {
     --sidebar-selected-font-weight: bolder;
     --sidebar-selected-font-weight: bolder;
     background: @bg;
     background: @bg;
     flex-shrink: 0;
     flex-shrink: 0;
+    position: sticky;
+    top: 0px;
     .van-sidebar-item {
     .van-sidebar-item {
         width: 121px;
         width: 121px;
     }
     }

+ 12 - 13
src/styles/fonts.less

@@ -4,13 +4,13 @@
 }
 }
 
 
 @font-face {
 @font-face {
-  font-family: 'iconfont';  /* project id 2026145 */
-  src: url('//at.alicdn.com/t/font_2026145_8twjl7d6y4v.eot');
-  src: url('//at.alicdn.com/t/font_2026145_8twjl7d6y4v.eot?#iefix') format('embedded-opentype'),
-  url('//at.alicdn.com/t/font_2026145_8twjl7d6y4v.woff2') format('woff2'),
-  url('//at.alicdn.com/t/font_2026145_8twjl7d6y4v.woff') format('woff'),
-  url('//at.alicdn.com/t/font_2026145_8twjl7d6y4v.ttf') format('truetype'),
-  url('//at.alicdn.com/t/font_2026145_8twjl7d6y4v.svg#iconfont') format('svg');
+    font-family: 'iconfont'; /* project id 2026145 */
+    src: url('//at.alicdn.com/t/font_2026145_4u7r1eyezx9.eot');
+    src: url('//at.alicdn.com/t/font_2026145_4u7r1eyezx9.eot?#iefix') format('embedded-opentype'),
+        url('//at.alicdn.com/t/font_2026145_4u7r1eyezx9.woff2') format('woff2'),
+        url('//at.alicdn.com/t/font_2026145_4u7r1eyezx9.woff') format('woff'),
+        url('//at.alicdn.com/t/font_2026145_4u7r1eyezx9.ttf') format('truetype'),
+        url('//at.alicdn.com/t/font_2026145_4u7r1eyezx9.svg#iconfont') format('svg');
 }
 }
 .iconfont {
 .iconfont {
     font-family: 'iconfont' !important;
     font-family: 'iconfont' !important;
@@ -18,8 +18,8 @@
     font-style: normal;
     font-style: normal;
     -webkit-font-smoothing: antialiased;
     -webkit-font-smoothing: antialiased;
     -moz-osx-font-smoothing: grayscale;
     -moz-osx-font-smoothing: grayscale;
-		position: relative;
-		font-weight: normal;
+    position: relative;
+    font-weight: normal;
 }
 }
 .iconfont-icon-aixin:before {
 .iconfont-icon-aixin:before {
     content: '\e8c3';
     content: '\e8c3';
@@ -39,9 +39,8 @@
     content: '\e61b';
     content: '\e61b';
 }
 }
 
 
-.iconfont-icon-home:before{
-	 content: '\e674';
-
+.iconfont-icon-home:before {
+    content: '\e61c';
 }
 }
 
 
 .iconfont-icon-arrow-up-filling:before {
 .iconfont-icon-arrow-up-filling:before {
@@ -50,4 +49,4 @@
 
 
 .iconfont-icon-arrow-down-filling:before {
 .iconfont-icon-arrow-down-filling:before {
     content: '\e689';
     content: '\e689';
-}
+}