Bläddra i källkod

fix: 视频详情跳转有误

chenlei 3 månader sedan
förälder
incheckning
6e8ba420e3

+ 13 - 0
packages/base/src/media.js

@@ -1,77 +1,90 @@
 export const mediaData = [
   {
+    id: 0,
     img: "/images/video/1.png",
     title: "第一集 川军名将 高举义旗",
     url: "/video/1.mp4",
     type: 0,
   },
   {
+    id: 1,
     img: "/images/video/2.png",
     title: "第二集 红军孙吴 英雄本色",
     url: "/video/2.mp4",
     type: 0,
   },
   {
+    id: 2,
     img: "/images/video/3.png",
     title: "第三集 漫漫征程 军事奇才",
     url: "/video/3.mp4",
     type: 0,
   },
   {
+    id: 3,
     img: "/images/video/4.png",
     title: "第四集 出师抗日 展示锋芒",
     url: "/video/4.mp4",
     type: 0,
   },
   {
+    id: 4,
     img: "/images/video/5.png",
     title: "第五集 游击战略 雄踞太行",
     url: "/video/5.mp4",
     type: 0,
   },
   {
+    id: 5,
     img: "/images/video/6.png",
     title: "第六集 挺进平原 打虎拒狼",
     url: "/video/6.mp4",
     type: 0,
   },
   {
+    id: 6,
     img: "/images/video/7.png",
     title: "第七集 敌进我进 克敌制胜",
     url: "/video/7.mp4",
     type: 0,
   },
   {
+    id: 7,
     img: "/images/video/8.png",
     title: "第八集 争锋相对 寸土必争",
     url: "/video/8.mp4",
     type: 0,
   },
   {
+    id: 8,
     img: "/images/video/9.png",
     title: "第九集 遍地狼烟 常胜将军",
     url: "/video/9.mp4",
     type: 0,
   },
   {
+    id: 9,
     img: "/images/video/10.png",
     title: "第十集 利剑出鞘 中原逐鹿",
     url: "/video/10.mp4",
     type: 0,
   },
   {
+    id: 10,
     img: "/images/video/11.png",
     title: "第十一集 百万雄师 席卷千军",
     url: "/video/11.mp4",
     type: 0,
   },
   {
+    id: 11,
     img: "/images/video/12.png",
     title: "第十二集 虎踞钟山 鞠躬尽瘁",
     url: "/video/12.mp4",
     type: 0,
   },
   {
+    id: 12,
     img: "/images/video/xuanchuan1.png",
     title: "仰望帅星",
     url: "/video/xuanchuan1.mp4",

BIN
packages/base/video/xuanchuan1.mp4


+ 5 - 5
packages/mobile/src/views/Media/index.vue

@@ -17,12 +17,12 @@
 
     <ul class="media-list">
       <li
-        v-for="(item, index) in mediaData.filter(
-          (i) => i.type === TABS[activeTab].id
-        )"
-        :key="index"
+        v-for="item in mediaData.filter((i) => i.type === TABS[activeTab].id)"
+        :key="item.id"
         class="media-item"
-        @click="$router.push({ name: 'mediaDetail', params: { index } })"
+        @click="
+          $router.push({ name: 'mediaDetail', params: { index: item.id } })
+        "
       >
         <VanImage
           class="media-item__cover"

+ 3 - 5
packages/pc/src/views/Media/index.vue

@@ -15,12 +15,10 @@
 
     <ul class="media-list">
       <li
-        v-for="(item, index) in mediaData.filter(
-          (i) => i.type === TABS[activeTab].id
-        )"
-        :key="index"
+        v-for="item in mediaData.filter((i) => i.type === TABS[activeTab].id)"
+        :key="item.id"
         class="media-item"
-        @click="$router.push({ name: 'mediaDetail', params: { id: index } })"
+        @click="$router.push({ name: 'mediaDetail', params: { id: item.id } })"
       >
         <ElImage
           class="media-item__cover"