root 3 anni fa
parent
commit
d20490c0a9
1 ha cambiato i file con 26 aggiunte e 25 eliminazioni
  1. 26 25
      src/views/dashboard/admin/index.vue

+ 26 - 25
src/views/dashboard/admin/index.vue

@@ -1,17 +1,17 @@
 <template>
   <div class="dashboard-editor-container">
     <!-- <github-corner class="github-corner" /> -->
-    <el-row :gutter="38" class="system-carousel">
-      <el-carousel indicator-position="outside">
+    <el-row  class="system-carousel">
+      <el-carousel indicator-position="none" :height="bannerHeight+'px'">
         <el-carousel-item v-for="(item,key) in slides" :key="key">
           <template v-if="item.TYPE==='1'">
             <router-link :to="`/shop/index`" target="_self">
-            <img style="width: 100%; height: 100%;"  src="http://ndsupload.ekhkad.com/files/2022/0526/573c9560dca111eca0a40ae051ba5350.jpg" alt="" >
+            <img ref="bannerHeight"  @load="imgLoad" style="width:100%"  src="http://ndsupload.ekhkad.com/files/2022/0526/573c9560dca111eca0a40ae051ba5350.jpg" alt="" >
           </router-link>
           </template>
           <template v-else>
             <router-link :to="`/article/detail/${item.CONTENT}`" target="_blank">
-            <img style="width: 100%; height: 100%;"  src="http://ndsupload.ekhkad.com/files/2022/0526/573c9560dca111eca0a40ae051ba5350.jpg" alt="" >
+            <img ref="bannerHeight" @load="imgLoad"  style="width:100%" src="http://ndsupload.ekhkad.com/files/2022/0526/573c9560dca111eca0a40ae051ba5350.jpg" alt="" >
           </router-link>
           </template>
           
@@ -82,6 +82,7 @@ export default {
     return {
       lineChartData: lineChartData.newVisitis,
       myEmpLv: {'ID': 0, 'LEVEL_NAME': null, 'ICON_TYPE': 0, 'ICON_NUM': 0},
+      bannerHeight: '',
       slides: [],
       news: [],
       periodNum: '',
@@ -98,6 +99,22 @@ export default {
     }
   },
   created(){
+    
+  },
+  methods: {
+    handleSetLineChartData(type) {
+      this.lineChartData = lineChartData[type]
+    },
+    imgLoad () {
+      let _this = this
+      if (_this.$refs.bannerHeight) {
+        _this.$nextTick(function () {
+          _this.bannerHeight = _this.$refs.bannerHeight[0].height
+        })
+      }
+    }
+  },
+  mounted() {
     this.$store.dispatch('dashboard/getIndex', {})
     .then(response => {
       this.num++
@@ -113,15 +130,13 @@ export default {
       this.cycle = ret.periodNum
       this.rmBv = ret.myRemainPv
       this.endTime = ret.activeEnd
-      console.log(this.slides)
+      this.imgLoad();
     })
     .catch((error) => {
     })
-  },
-  methods: {
-    handleSetLineChartData(type) {
-      this.lineChartData = lineChartData[type]
-    }
+    window.addEventListener('resize', () => {
+      this.imgLoad()
+    }, false)
   }
 }
 </script>
@@ -150,21 +165,7 @@ export default {
 .system-carousel {
   margin-left: 0px !important;
   margin-right: 0px !important;
-}
-.el-carousel__item h3 {
-  color: #475669;
-  font-size: 18px;
-  opacity: 0.75;
-  line-height: 300px;
-  margin: 0;
-}
-  
-.el-carousel__item:nth-child(2n) {
-  background-color: #99a9bf;
-}
-
-.el-carousel__item:nth-child(2n+1) {
-  background-color: #d3dce6;
+  margin-top: -10px;
 }
 // carousel