소스 검색

快讯页分页问题处理

yangc 8 년 전
부모
커밋
3fba68cae3
5개의 변경된 파일18개의 추가작업 그리고 23개의 파일을 삭제
  1. 1 1
      components/common/image-upload/imageUpload.vue
  2. 1 1
      components/news/Right.vue
  3. 3 9
      components/product/ComponentGoods.vue
  4. 12 12
      components/provider/Suppliers.vue
  5. 1 0
      pages/news/index.vue

+ 1 - 1
components/common/image-upload/imageUpload.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-upload
-      action = "https://jsonplaceholder.typicode.com/posts/"
+      action = "/api/images"
       :on-preview="handlePictureCardPreview"
       :on-remove="handleRemove"
       list-type="picture-card"

+ 1 - 1
components/news/Right.vue

@@ -63,7 +63,7 @@
     methods: {
       listenPage: function (changedPage) {
         this.nowPage = changedPage
-        this.$emit('childEvent', this.nowPage)
+        this.$emit('pageEvent', this.nowPage)
       }
     }
   }

+ 3 - 9
components/product/ComponentGoods.vue

@@ -147,8 +147,7 @@
         this.pageParams.page = 1
         this.pageCmpGoods(this.pageParams)
       },
-//      async pageCmpGoods (pageParams) {
-      pageCmpGoods (pageParams) {
+      async pageCmpGoods (pageParams) {
         let params = {}
         params.filter = { kindid: pageParams.filter.kindid }
         if (pageParams.filter.brandid && pageParams.filter.brandid !== '') {
@@ -159,19 +158,14 @@
         }
         params.page = pageParams.page
         params.count = pageParams.count
-//        let { data } = await this.$http.get('/api/product/product/getCompGoodsByKindid', { params })
-//        this.$store.commit('product/component/GET_CMPGOODS_SUCCESS', data)
-        this.$http.get('/api/product/product/getCompGoodsByKindid', { params })
-          .then(response => {
-            this.$store.commit('product/component/GET_CMPGOODS_SUCCESS', response.data)
-          })
+        let { data } = await this.$http.get('/api/product/product/getCompGoodsByKindid', { params })
+        this.$store.commit('product/component/GET_CMPGOODS_SUCCESS', data)
       },
       handleCurrentChange (page) {
         this.pageParams.page = page
         this.pageParams.filter.brandid = this.brandid
         this.pageParams.filter.propertyJSON = this.propertyJSON
         this.pageParams.filter.kindid = this.$route.params.id
-        console.log(this.pageParams)
         this.pageCmpGoods(this.pageParams)
       }
     }

+ 12 - 12
components/provider/Suppliers.vue

@@ -87,21 +87,21 @@ export default {
       }
       return description.slice(0, 160)
     },
-//    async pageCommodity (pageParams) {
-    pageCommodity (pageParams) {
+    async pageCommodity (pageParams) {
+//    pageCommodity (pageParams) {
       pageParams.op = 'pageByType'
 
-//      try {
-//        let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
-//        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
-//      } catch (err) {
-//        this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
-//      }
-      this.$http.get('/api/store-service/stores', { params: pageParams }).then(response => {
-        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', response)
-      }, err => {
+      try {
+        let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
+        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
+      } catch (err) {
         this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
-      })
+      }
+//      this.$http.get('/api/store-service/stores', { params: pageParams }).then(response => {
+//        this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', response)
+//      }, err => {
+//        this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)
+//      })
     },
     handleCurrentChange (page) {
       this.pageParams.page = page

+ 1 - 0
pages/news/index.vue

@@ -28,6 +28,7 @@
     methods: {
       listenChild: function (nPage) {
         this.nowPage = nPage
+        console.log(this.nowPage)
         this.$store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize })
       }
     }