wangxy 1 месяц назад
Родитель
Сommit
449c4bfe07
1 измененных файлов с 43 добавлено и 2 удалено
  1. 43 2
      pages/chaojidanci/wordList/wordList.vue

+ 43 - 2
pages/chaojidanci/wordList/wordList.vue

@@ -10,7 +10,7 @@
           v-if="listData.danyuanNumberList && listData.danyuanNumberList.length > 0"
       >
         <!-- disabled-->
-        <icon class="word-jt jt-left" :class="{ disabled: listData.activeIndex === 0 }"/>
+        <icon class="word-jt jt-left" :class="{ disabled: listData.activeIndex === 0 }" @click="handleLeftClick"/>
 		<view class="tab-item-list" id="tab-item-list">
           <!-- active -->
           <ezyActiveVue
@@ -33,7 +33,7 @@
         </view>
         <!-- disabled-->
         <icon class="word-jt jt-right"
-              :class="{ disabled: listData.activeIndex === listData.danyuanNumberList.length - 1 }"/>
+              :class="{ disabled: listData.activeIndex === listData.danyuanNumberList.length - 1 }" @click="handleRightClick"/>
       </view>
 
       <swiper
@@ -176,6 +176,47 @@ const isSwiperDisabled = computed(() => {
 // 记录swiper触摸开始位置
 let startX = 0;
 
+
+
+
+// 处理左侧箭头点击
+function handleLeftClick() {
+  const chunkSize = 4;
+  const currentGroup = Math.floor(listData.activeIndex / chunkSize);
+  if (currentGroup > 0) {
+    const prevGroupStartIndex = (currentGroup - 1) * chunkSize;
+    const item = listData.danyuanNumberList[prevGroupStartIndex];
+    if (item.lock) {
+      // 弹出弹窗让用户确认是否去购买
+      goPayDialogRef.value.handleShow();
+      return;
+    }
+    listData.activeIndex = prevGroupStartIndex;
+    centerActiveTab();
+    updataShuju(listData.danyuanNumberList[prevGroupStartIndex]);
+  }
+}
+
+// 处理右侧箭头点击
+function handleRightClick() {
+  const chunkSize = 4;
+  const currentGroup = Math.floor(listData.activeIndex / chunkSize);
+  const totalGroups = Math.ceil(listData.danyuanNumberList.length / chunkSize);
+  if (currentGroup < totalGroups - 1) {
+    const nextGroupStartIndex = (currentGroup + 1) * chunkSize;
+    const item = listData.danyuanNumberList[nextGroupStartIndex];
+    if (item.lock) {
+      // 弹出弹窗让用户确认是否去购买
+      goPayDialogRef.value.handleShow();
+      return;
+    }
+    listData.activeIndex = nextGroupStartIndex;
+    centerActiveTab();
+    updataShuju(listData.danyuanNumberList[nextGroupStartIndex]);
+  }
+}
+
+
 // 处理swiper触摸开始
 function handleSwiperTouchStart(e) {
   startX = e.touches[0].clientX;