shaogen1995 3 лет назад
Родитель
Сommit
9a4ea1abe5

+ 44 - 43
src/components/pagination/index.vue

@@ -52,84 +52,85 @@
 
 <script>
 export default {
-  props: ["paging"],
-  data() {
+  props: ['paging'],
+  name: 'Page',
+  data () {
     return {
-      ...this.paging,
-    };
+      ...this.paging
+    }
   },
   computed: {
-    min() {
-      return 1;
+    min () {
+      return 1
     },
-    max() {
-      return Math.ceil(this.total / this.pageSize);
+    max () {
+      return Math.ceil(this.total / this.pageSize)
     },
-    routineMin() {
-      return this.current - Math.ceil(this.showSize / 2);
+    routineMin () {
+      return this.current - Math.ceil(this.showSize / 2)
     },
-    routineMax() {
-      return this.current + Math.floor(this.showSize / 2);
+    routineMax () {
+      return this.current + Math.floor(this.showSize / 2)
     },
-    currMin() {
-      let c = this.max - this.routineMax;
+    currMin () {
+      let c = this.max - this.routineMax
 
       if (this.routineMin <= this.min) {
-        return this.min;
+        return this.min
       } else if (c >= 0) {
-        return this.routineMin;
+        return this.routineMin
       } else if (this.routineMin + c <= this.min) {
-        return this.min;
+        return this.min
       } else {
-        return this.routineMin + c;
+        return this.routineMin + c
       }
     },
-    currMax() {
-      let c = this.min - this.routineMin;
+    currMax () {
+      let c = this.min - this.routineMin
 
       if (this.routineMax >= this.max) {
-        return this.max;
+        return this.max
       } else if (c <= 0) {
-        return this.routineMax;
+        return this.routineMax
       } else if (this.routineMax + c >= this.max) {
-        return this.max;
+        return this.max
       } else {
-        return this.routineMax + c;
+        return this.routineMax + c
       }
     },
-    numbers() {
-      let total = this.currMax - this.currMin;
-      let numbers = [];
+    numbers () {
+      let total = this.currMax - this.currMin
+      let numbers = []
 
       if (total === 0) {
-        numbers.push(1);
+        numbers.push(1)
       } else {
         for (let i = 0; i <= total; i++) {
-          numbers.push(this.currMin + i);
+          numbers.push(this.currMin + i)
         }
       }
-      return numbers;
-    },
+      return numbers
+    }
   },
   watch: {
-    current(val, old) {
+    current (val, old) {
       if (isNaN(this.current)) {
-        return (this.current = old);
+        return (this.current = old)
       } else if (this.current < this.min) {
-        return (this.current = this.min);
+        return (this.current = this.min)
       } else if (this.current > this.max) {
-        return (this.current = this.max);
+        return (this.current = this.max)
       }
-      this.$emit("changeCurrent", this.current);
+      this.$emit('changeCurrent', this.current)
     },
     paging: {
       deep: true,
       handler: function (newVal) {
-        Object.keys(newVal).forEach((k) => (this[k] = newVal[k]));
-      },
-    },
-  },
-};
+        Object.keys(newVal).forEach((k) => (this[k] = newVal[k]))
+      }
+    }
+  }
+}
 </script>
 
 <style lang="less" scoped>
@@ -143,7 +144,7 @@ export default {
     width:39px;
     height:39px;
     line-height:39px;
-    text-align:center;    
+    text-align:center;
     font-family: "Source Han Sans CN";
     &.active {
       border-radius:50%;
@@ -184,4 +185,4 @@ export default {
     color: #fff;
   }
 }
-</style>
+</style>

+ 1 - 1
src/pages/activity/activity-type.vue

@@ -197,7 +197,7 @@ export default {
         pageSize: 10,
         pageNum: 1,
         total: 0,
-        showSize: 10,
+        showSize: 4,
         current: 1
       },
       params: {

+ 1 - 1
src/pages/collection/collection-type.vue

@@ -138,7 +138,7 @@ export default {
         pageSize: 12,
         pageNum: 1,
         total: 0,
-        showSize: 12,
+        showSize: 4,
         current: 1
       },
       params: {

+ 1 - 1
src/pages/exhibition/exhibition-type.vue

@@ -101,7 +101,7 @@ export default {
         pageSize: 9,
         pageNum: 1,
         total: 0,
-        showSize: 9,
+        showSize: 4,
         current: 1
       },
       params: {

+ 12 - 4
src/pages/home/home.vue

@@ -4,9 +4,9 @@
       <swiper-slide v-for="(item, index) in sliceArr" :key="index"
         ><img :src="$cdnUrl+item.ossPath" alt="" @click="skip(item.url)"
       /></swiper-slide>
-      <div class="swiper-pagination" slot="pagination"></div>
-      <div class="swiper-button-prev" slot="button-prev"></div>
-      <div class="swiper-button-next" slot="button-next"></div>
+      <div class="swiper-pagination" slot="pagination" v-if="sliceArr.length>1"></div>
+      <div class="swiper-button-prev" slot="button-prev" v-if="sliceArr.length>1"></div>
+      <div class="swiper-button-next" slot="button-next" v-if="sliceArr.length>1"></div>
     </swiper>
   </div>
 </template>
@@ -42,6 +42,14 @@ export default {
   },
   created () {
     this.getSlideList()
+    this.$nextTick(() => {
+      setTimeout(() => {
+        if (this.sliceArr.length <= 1) {
+          console.log(998)
+          this.$refs.mySwiper.$swiper.autoplay.stop()
+        }
+      }, 100)
+    })
   },
   methods: {
     skip (url) {
@@ -111,5 +119,5 @@ export default {
   .swiper-pagination-bullet-active {
     background: #fff!important;
   }
-  
+
 </style>

+ 2 - 2
src/pages/information/information-type.vue

@@ -125,7 +125,7 @@ export default {
         pageSize: 10,
         pageNum: 1,
         total: 0,
-        showSize: 10,
+        showSize: 4,
         current: 1
       },
       params: {
@@ -205,7 +205,7 @@ export default {
       console.log(val)
       this.paging.current = val
       this.params.pageNum = val
-      if (this.params.type == 'book') {
+      if (this.params.type === 'book') {
         this.getBookList()
       } else {
         this.getList()

+ 1 - 1
src/pages/service/service-detail.vue

@@ -122,7 +122,7 @@ export default {
         pageSize: 8,
         pageNum: 1,
         total: 0,
-        showSize: 8,
+        showSize: 4,
         current: 1
       },
       params: {