|
@@ -64,6 +64,7 @@ import Tool, { ToolItem, ToolType } from './component/tool'
|
|
|
import Tools from './component/tools/pen'
|
|
|
import Pen from './component/tools/pen'
|
|
|
import iconPen from './image/icon-pen.png'
|
|
|
+import { useThrottle, useThrottleFn, useDebounceFn } from '@vueuse/core'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'CoursewarePlay',
|
|
@@ -625,6 +626,18 @@ export default defineComponent({
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ const onChangeSwiper = useDebounceFn((type: string, itemActive?: any) => {
|
|
|
+ if (type === 'up') {
|
|
|
+ handlePreAndNext('up')
|
|
|
+ }
|
|
|
+ if (type === 'down') {
|
|
|
+ handlePreAndNext('down')
|
|
|
+ }
|
|
|
+ if (type === 'change') {
|
|
|
+ popupData.open = false
|
|
|
+ toggleMaterial(itemActive)
|
|
|
+ }
|
|
|
+ }, 200)
|
|
|
/** 是否有转场动画 */
|
|
|
const checkedAnimation = (index: number, nextIndex?: number) => {
|
|
|
const item = data.itemList[index]
|
|
@@ -717,8 +730,8 @@ export default defineComponent({
|
|
|
>
|
|
|
<div class={styles.wraps}>
|
|
|
{data.itemList.map((m: any, mIndex: number) => {
|
|
|
- const isRender = Math.abs(popupData.activeIndex - mIndex) < 5
|
|
|
- const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 3
|
|
|
+ const isRender = Math.abs(popupData.activeIndex - mIndex) < 4
|
|
|
+ const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 2
|
|
|
// if (isRender) {
|
|
|
// m.isRender = true
|
|
|
// }
|
|
@@ -871,7 +884,15 @@ export default defineComponent({
|
|
|
<div class={styles.leftFixedBtns} onClick={(e: Event) => e.stopPropagation()}>
|
|
|
{popupData.activeIndex != 0 && (
|
|
|
<div class={[styles.btnsWrap, styles.prePoint]}>
|
|
|
- <div class={styles.fullBtn} onClick={() => handlePreAndNext('up')}>
|
|
|
+ <div
|
|
|
+ class={styles.fullBtn}
|
|
|
+ onClick={() => {
|
|
|
+ // useThrottleFn(() => {
|
|
|
+ // handlePreAndNext('up')
|
|
|
+ // }, 300)
|
|
|
+ onChangeSwiper('up')
|
|
|
+ }}
|
|
|
+ >
|
|
|
<img src={iconUp} />
|
|
|
<span style={{ textAlign: 'center' }}>上一个</span>
|
|
|
</div>
|
|
@@ -879,7 +900,17 @@ export default defineComponent({
|
|
|
)}
|
|
|
{popupData.activeIndex != data.itemList.length - 1 && (
|
|
|
<div class={styles.btnsWrap}>
|
|
|
- <div class={styles.fullBtn} onClick={() => handlePreAndNext('down')}>
|
|
|
+ <div
|
|
|
+ class={styles.fullBtn}
|
|
|
+ onClick={() => {
|
|
|
+ // console.log('click down')
|
|
|
+ // useThrottleFn(() => {
|
|
|
+ // console.log('click down pass')
|
|
|
+ // handlePreAndNext('down')
|
|
|
+ // }, 300)
|
|
|
+ onChangeSwiper('down')
|
|
|
+ }}
|
|
|
+ >
|
|
|
<span style={{ textAlign: 'center' }}>下一个</span>
|
|
|
<img src={iconDown} />
|
|
|
</div>
|
|
@@ -969,8 +1000,9 @@ export default defineComponent({
|
|
|
tabActive={popupData.tabActive}
|
|
|
itemActive={popupData.itemActive}
|
|
|
onHandleSelect={(res: any) => {
|
|
|
- popupData.open = false
|
|
|
- toggleMaterial(res.itemActive)
|
|
|
+ onChangeSwiper('change', res.itemActive)
|
|
|
+ // popupData.open = false
|
|
|
+ // toggleMaterial(res.itemActive)
|
|
|
}}
|
|
|
/>
|
|
|
</Popup>
|