Browse Source

花里胡哨

liushengqiang 2 years ago
parent
commit
109245c57d
1 changed files with 8 additions and 7 deletions
  1. 8 7
      src/views/coursewarePlay/index.tsx

+ 8 - 7
src/views/coursewarePlay/index.tsx

@@ -199,7 +199,6 @@ export default defineComponent({
       const browserInfo = browser()
       for (let i = 0; i < data.knowledgePointList.length; i++) {
         const item = data.knowledgePointList[i]
-        const itemLength = item.materialList.length - 1
         for (let j = 0; j < item.materialList.length; j++) {
           const material = item.materialList[j]
           //请求本地缓存
@@ -219,7 +218,8 @@ export default defineComponent({
             isAnimation: true, // 当前知识点
             autoPlay: false, //加载完成是否自动播放
             isprepare: false, // 视频是否加载完成
-            isRender: false // 是否渲染了
+            isRender: false, // 是否渲染了
+            effectIndex: Math.round(Math.random() * (effects.length - 1))
           })
         }
       }
@@ -547,7 +547,7 @@ export default defineComponent({
       animationTimer.value = setTimeout(() => {
         const index = effectIndex.value + 1
         requestAnimationFrame(() => {
-          effectIndex.value = index >= effects.length - 1 ? 0 : index
+          // effectIndex.value = index >= effects.length - 1 ? 0 : index
         })
         // effectIndex.value = Math.round(Math.random() * (effects.length - 1))
       }, 1000)
@@ -601,11 +601,12 @@ export default defineComponent({
                     class={[styles.itemDiv, popupData.activeIndex === mIndex && styles.itemActive]}
                     style={{
                       ...(mIndex < popupData.activeIndex
-                        ? effects[effectIndex.value].prev
+                        ? effects[m.effectIndex].prev
                         : mIndex > popupData.activeIndex
-                        ? effects[effectIndex.value].next
-                        : (effects[effectIndex.value] as any).current),
-                      ...(m.isAnimation ? {} : { 'transition-duration': '0s'})
+                        ? effects[m.effectIndex].next
+                        : (effects[m.effectIndex] as any).current),
+                      ...(m.isAnimation ? {} : { 'transition-duration': '0s'}),
+                      opacity: Math.abs(popupData.activeIndex - mIndex) > 1 ? 0 : 1 
                     }}
                     onClick={(e: Event) => {
                       e.stopPropagation()