x1ongzhu 2 yıl önce
ebeveyn
işleme
dd09b4a66e
2 değiştirilmiş dosya ile 14 ekleme ve 16 silme
  1. 1 1
      src/plugins/updater_meta.json
  2. 13 15
      src/views/HomePage.vue

+ 1 - 1
src/plugins/updater_meta.json

@@ -1 +1 @@
-{"version":37}
+{"version":38}

+ 13 - 15
src/views/HomePage.vue

@@ -5,8 +5,13 @@
             <div class="title p-[18px] text-white text-[26px] AlimamaShuHeiTi">{{ $t('zouma') }}.</div>
 
             <van-swipe ref="swiperRef" class="my-swipe" :width="315" touchable :stop-propagation="false">
-                <van-swipe-item v-for="(item, index) in banners" :key="index" class="pl-[18px]" @click="goVideo(item)">
-                    <van-image width="300" height="180" :radius="18" :src="getImg(item)" fit="cover" />
+                <van-swipe-item
+                    v-for="(item, index) in banners"
+                    :key="index"
+                    class="pl-[18px]"
+                    @click="bannerClick(item)"
+                >
+                    <van-image width="300" height="180" :radius="18" :src="item.img" fit="cover" />
                 </van-swipe-item>
             </van-swipe>
 
@@ -113,12 +118,8 @@ http.get('/api/categories').then(res => {
 })
 
 const banners = ref([])
-getSeries({ pageSize: 5 }).then(res => {
-    banners.value = res
-    console.log(banners.value)
-    nextTick(() => {
-        swiperRef.value.resize()
-    })
+http.get('/api/banners').then(res => {
+    banners.value = res.data
 })
 
 function getImg(series) {
@@ -132,13 +133,10 @@ function getImg(series) {
 const swiperRef = ref(null)
 
 const router = useRouter()
-function goVideo(info) {
-    router.push({
-        name: 'video',
-        query: {
-            id: info.id
-        }
-    })
+function bannerClick(info) {
+    if (info.link) {
+        router.push(info.link)
+    }
 }
 </script>