浏览代码

需求调整

yangc 7 年之前
父节点
当前提交
9705e299f6

+ 53 - 3
components/mobile/Home.vue

@@ -53,7 +53,7 @@
         <span>最新求购信息</span>
         <nuxt-link to="/mobile/applyPurchase/list">查看更多 <img src="/images/mobile/@2x/applyPurchase/home/arrow-right.png" alt=""></nuxt-link>
       </div>
-      <seek-list :purchaseManList="purchaseManList"></seek-list>
+      <seek-list :purchaseManList="purchaseManListData" :isDataChange="isDataChange"></seek-list>
     </div>
     <div class="mobile-modal" v-if="showStoreInfo">
       <div class="mobile-modal-box">
@@ -96,7 +96,13 @@
         },
         remindText: '',
         timeoutCount: 0,
-        showLoginBox: false
+        showLoginBox: false,
+        isSearchSearchingMore: false,
+        page: 1,
+        size: 5,
+        purchaseManListData: [],
+        isChange: false,
+        isDataChange: false
       }
     },
     components: {
@@ -105,12 +111,48 @@
       RemindBox,
       LoginBox
     },
+    mounted: function () {
+      this.$nextTick(() => {
+        window.addEventListener('scroll', this.scroll, false)
+      })
+    },
+    watch: {
+      '$store.state.applyPurchase.purchaseManList.purchaseHomeList.data': {
+        handler: function (val) {
+          if (this.isChange) {
+            this.purchaseManListData = []
+            this.page = 1
+            this.isChange = false
+            this.isDataChange = false
+          } else {
+            this.purchaseManListData = this.purchaseManListData.concat(val.content)
+            this.isSearchSearchingMore = false
+            this.isDataChange = true
+          }
+        },
+        immediate: true
+      }
+//      $route: {
+//        handler: function (val) {
+//          window.removeEventListener('scroll', this.scroll)
+//        }
+//      }
+    },
     computed: {
       purchaseManList () {
-        return this.$store.state.applyPurchase.purchaseManList.purchaseHomeList.data.content
+        return this.$store.state.applyPurchase.purchaseManList.purchaseHomeList.data
+      },
+      allPage () {
+        return Math.floor(this.purchaseManList.totalElements / this.purchaseManList.size) + Math.floor(this.purchaseManList.totalElements % this.purchaseManList.size > 0 ? 1 : 0)
       }
     },
     methods: {
+      scroll: function () {
+        let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
+        if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchSearchingMore && this.page < this.allPage) {
+          this.getMoreSearch()
+        }
+      },
       onHomeSearchClick () {
         this.showMainSearch = true
         this.$store.dispatch('searchData/getSearchHistory')
@@ -132,6 +174,14 @@
       onRemind: function (str) {
         this.remindText = str
         this.timeoutCount ++
+      },
+      reloadData: function () {
+        this.$store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: this.page, pageSize: this.size, sorting: {'releaseDate': 'DESC'}, enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null, isLogin: this.user.logged ? '1' : '0'})
+      },
+      getMoreSearch: function () {
+        this.page++
+        this.isSearchSearchingMore = true
+        this.reloadData()
       }
     }
   }

+ 0 - 1
components/mobile/applyPurchase/PublishSupplierSeek.vue

@@ -63,7 +63,6 @@
 //      },
       product: {
         handler (val, oldVal) {
-          console.log(val)
           if (val) {
             let isStandard = val.standard === 1
             this.applyObj.code = val.cmpCode

+ 13 - 8
components/mobile/common/userHeader.vue

@@ -4,7 +4,7 @@
       <img src="/images/component/default.png"/>
       <div class="user-info">
         <p v-text="userInfo.data.userName"></p>
-        <p>
+        <p :class="{'long': !isShow}">
           <span class="en-name">{{enterpriseInfo.enName}}</span>
         </p>
         <div class="switch" v-if="isShow">
@@ -159,6 +159,12 @@
             padding-right: .7rem;
             overflow: unset;
             max-width: unset;
+            &.long {
+              padding-right: 0;
+              span {
+                max-width: 5rem;
+              }
+            }
             .en-name {
               overflow: hidden;
               text-overflow: ellipsis;
@@ -170,13 +176,6 @@
               position: absolute;
               right: 0;
             }
-            .exit {
-              right: -.8rem;
-            }
-            .vir {
-              position: absolute;
-              right: -.14rem;
-            }
           }
         }
         .switch {
@@ -209,6 +208,12 @@
             }
 
           }
+          .exit {
+            right: -.8rem;
+          }
+          .vir {
+            margin: 0 .1rem;
+          }
         }
       }
       > a {

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://192.168.253.121:9090/platform-b2c')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://api.usoftmall.com/' : 'http://10.1.51.124:8080/platform-b2c')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
 const materialUrl = process.env.MATERIAL_URL || (isProdMode ? 'https://api-product.usoftmall.com/' : 'http://218.17.158.219:24000/')
 

+ 1 - 1
pages/mobile/applyPurchase/list/index.vue

@@ -59,7 +59,7 @@
         let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
         if (this.isChange) {
           this.purchaseManListData = []
-          this.seekPage = 1
+          this.page = 1
           this.isChange = false
           this.isDataChange = true
         } else {

+ 3 - 3
pages/mobile/center/index.vue

@@ -439,7 +439,7 @@
     watch: {
       '$route.query': {
         handler: function (val, old) {
-          this.switchSeek('wait')
+//          this.switchSeek('wait')
           if (val.type === 'saler' && !this.shopuuid.uuid) {
             this.$store.dispatch('loadStoreStatus', { op: 'check' })
           }
@@ -557,8 +557,8 @@
         let type = this.seekType
         let user = this.$store.state.option.user.data
         let params = {
-          pageNumber: 1,
-          pageSize: 10,
+          pageNumber: this.seekPage,
+          pageSize: this.seekSize,
           keyword: this.seekKeyword || null
         }
         if (user.enterprise.uu) {

+ 10 - 0
pages/mobile/shop/index.vue

@@ -78,6 +78,16 @@
       Loading,
       LoginBox
     },
+    watch: {
+      '$route.query.keyword': {
+        handler: function (val) {
+          this.page = 1
+          this.type = 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT'
+          this.$store.dispatch('provider/findStoreListInMobil', { page: this.page, count: this.count, types: this.types, keyword: this.$route.query.keyword || null })
+        },
+        immediate: true
+      }
+    },
     fetch ({ store, query }) {
       return Promise.all([
         store.dispatch('provider/findStoreListInMobil', { page: 1, count: 10, types: 'ORIGINAL_FACTORY-DISTRIBUTION-AGENCY-CONSIGNMENT', keyword: query.keyword || null })