|
@@ -7,11 +7,10 @@
|
|
|
</view>
|
|
|
<view class="ezy-tab-border">
|
|
|
<view class="ezy-border-body">
|
|
|
- <scroll-view scroll-x="true" :scroll-left='wordLeft' class="word-title-box"
|
|
|
- v-if="listData.jieNumberList && listData.jieNumberList.length >0">
|
|
|
+ <view class="word-title-box" style="display: flex;overflow-x: auto;" v-if="listData.jieNumberList && listData.jieNumberList.length >0">
|
|
|
<view :id="'item-' + item.jieId" class="title-item" v-for="(item,index) in listData.jieNumberList" @click="handleTitleClick(item)"
|
|
|
:key="item.jieId" :class="{active: listData.activeIndex == index}">Unit{{item.number}}</view>
|
|
|
- </scroll-view>
|
|
|
+ </view>
|
|
|
|
|
|
<swiper class="word-list-swiper-box" :indicator-dots="false" :autoplay="false" :circular="false" :current="listData.activeIndex"
|
|
|
@change="handleSwiperChange" :disable-touch="!swiperData.isAllowed">
|
|
@@ -22,7 +21,7 @@
|
|
|
<view class="word-num-box">
|
|
|
<icon></icon><text>{{citem.studyCount || 0}}/{{citem.count || 0}}词</text>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
<!-- 单词 -->
|
|
|
<view class="word-list-item" v-for="(item,index) in citem.wordList" :key="index"
|
|
|
@click="toWord(item)" :class="{active: item.wcFlag == 1}">
|
|
@@ -64,7 +63,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import {reactive,ref,nextTick} from "vue";
|
|
|
- import {toast,getDataFromStr} from "@/utils/common";
|
|
|
+ import {toast,getDataFromStr,useActiveDomIntoView} from "@/utils/common";
|
|
|
import {onLoad} from "@dcloudio/uni-app";
|
|
|
import {getWordZhangList,getWordZhangListYK,} from "@/api/word.js";
|
|
|
import cacheManager from '@/utils/cacheManager.js';
|
|
@@ -127,6 +126,7 @@
|
|
|
|
|
|
// Swiper 切换
|
|
|
function handleSwiperChange(e) {
|
|
|
+ useActiveDomIntoView('.word-title-box','.title-item.active')
|
|
|
listData.activeIndex = e.detail.current;
|
|
|
if (!swiperData.isAllowed) {
|
|
|
// 不满足条件时回退到原索引
|
|
@@ -164,7 +164,7 @@
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 修改缓存zid 用于定位岛
|
|
|
function updataCache(data) {
|
|
|
cacheManager.updateObject('zhangInfo', {
|
|
@@ -189,7 +189,7 @@
|
|
|
updataCache(data.zhangZid)
|
|
|
getWordListData();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 返回节index
|
|
|
function findIndexByJieId(list, jieId) {
|
|
|
const findIndex = list.findIndex(item => item.jieId == jieId)
|
|
@@ -221,7 +221,6 @@
|
|
|
listData.activeIndex = findIndexByJieId(listData.jieNumberList, wordJieId);
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
toast("获取单词列表数据失败");
|