瀏覽代碼

修改单词列表 改为可以滑动的

tanxue 2 月之前
父節點
當前提交
d1d34e554f
共有 2 個文件被更改,包括 10 次插入21 次删除
  1. 4 0
      common/styles/global/pages.scss
  2. 6 21
      pages/wordList/wordList.vue

+ 4 - 0
common/styles/global/pages.scss

@@ -1925,6 +1925,10 @@
 	.ezy-border-body{
 		width: 94%;height: calc(100vh - 170rpx - var(--status-bar-height));margin: 3% 3%;display: flex;flex-direction: column;
 		background-color: rgba(255, 255, 255, 0.6);border-radius:0 0 8rpx 8rpx;}
+	.word-list-swiper-box{
+		height: calc(100vh - 200rpx - var(--status-bar-height));
+		.word-list-swiper-item{display: flex;flex-direction: column;}
+	}
 	.word-title-box{
 		flex-shrink: 0;margin: 0 2%;width: 96%;
 		line-height: 1.4;box-sizing: border-box;border-bottom: 1rpx dashed #068aea;

+ 6 - 21
pages/wordList/wordList.vue

@@ -13,9 +13,9 @@
 						:key="item.jieId" :class="{active: listData.activeIndex == index}">Unit{{item.number}}</view>
 				</scroll-view>
 
-				<swiper class="word-view-swiper-box" :indicator-dots="false" :autoplay="false" :circular="false"
+				<swiper class="word-list-swiper-box" :indicator-dots="false" :autoplay="false" :circular="false"
 					@change="handleSwiperChange" :disable-touch="!swiperData.isAllowed">
-					<swiper-item v-for="citem in unitList" :key="citem.jieId" @touchstart="handleTouchStart"
+					<swiper-item class="word-list-swiper-item" v-for="citem in unitList" :key="citem.jieId" @touchstart="handleTouchStart"
 						@touchend="handleTouchEnd">
 						<view class="word-list-body" v-if="citem.wordList && citem.wordList.length > 0">
 							<view class="word-num-box">
@@ -112,7 +112,6 @@
 	onLoad((options) => {
 		routerOpt = options;
 		if (!cacheManager.get('auth')) {
-
 			// 游客
 			const youkeData = JSON.parse(routerOpt.youkePageData)
 			info.levelId = youkeData.levelId;
@@ -122,9 +121,9 @@
 		} else {
 			// 获取缓存
 			[info.levelId, info.zhangId] = getDataFromStr(cacheManager.get('auth').levelId)
-
 			// 非游客
 			wordJieId = routerOpt.jieId
+			console.log(wordJieId,'routerOpt.jieId');
 			getWordListData();
 		}
 	});
@@ -178,6 +177,7 @@
 	}
 
 	function handleTitleClick(item) {
+		console.log(item,'item');
 		if (!cacheManager.get('auth')) {
 			youkeDialogRef.value.handleShow();
 		} else {
@@ -203,22 +203,7 @@
 	}
 
 	function getWordListData() {
-		/* const opt = {
-        jieId: wordJieId
-    };
-    getWordList(opt).then(res => {
-        if (res.code === 0) {
-            listData.count = res.data.count;
-            listData.studyCount = res.data.studyCount;
-            listData.jieNumberList = res.data.jieNumberList;
-            listData.title = res.data.title;
-            listData.wordList = res.data.wordList;
-			listData.activeIndex = findIndexByJieId(listData.jieNumberList,wordJieId);
-        }
-    }).catch(err => {
-        toast("获取单词列表数据失败");
-    }); */
-
+		console.log('wordJieId.value',wordJieId.value);
 		const opt = {
 			levelId: info.levelId,
 			zhangId: info.zhangId,
@@ -230,7 +215,7 @@
 				unitList.value = res.data.jieWordsList;
 				listData.jieNumberList = res.data.jieNumberList;
 				unitList.value.forEach(item => {
-					if (item.jieId == wordJieId.value) {
+					if (item.jieId == wordJieId) {
 						listData.activeIndex = findIndexByJieId(listData.jieNumberList, wordJieId);
 					}
 				})