tanxue 2 ヶ月 前
コミット
a967f127e8
1 ファイル変更17 行追加4 行削除
  1. 17 4
      pages/wordList/wordList.vue

+ 17 - 4
pages/wordList/wordList.vue

@@ -94,6 +94,9 @@
 		routerOpt = options;
 		info.levelId = routerOpt.levelId;
 		info.zhangId = routerOpt.zhangId;
+		// 获取缓存
+		console.log(cacheManager.get('auth').levelId,'cacheManager.get');
+		
 		if (!cacheManager.get('auth')) {
 			// 游客
 			const youkeData = JSON.parse(routerOpt.youkePageData)
@@ -108,10 +111,13 @@
 
 	function handleSwiperChange(e) {
 		currentIndex.value = e.detail.current + 1;
+		// unit滚动到指定位置
+		findWordLeft(e.detail.current)
+		// 修改缓存zid  用于定位岛
+		// updataCache(item.zhangZid)
 	}
 
 	// 游客弹窗---确定
-
 	function ykConfirm() {
 		uni.redirectTo({
 			url: '/pages/login/index'
@@ -155,12 +161,19 @@
 
 	function findIndexByJieId(list, jieId) {
 		const findIndex = list.findIndex(item => item.jieId == jieId)
-		wordLeft.value = findIndex * 40;
+		// unit滚动到指定位置
+		findWordLeft(findIndex)
 		return findIndex;
 	}
+	
+	// 获取滚动距离
+	function findWordLeft(data){
+		wordLeft.value = data * 40;
+		return wordLeft.value;
+	}
 
 	function getWordListData() {
-		/*const opt = {
+		/* const opt = {
         jieId: wordJieId
     };
     getWordList(opt).then(res => {
@@ -174,7 +187,7 @@
         }
     }).catch(err => {
         toast("获取单词列表数据失败");
-    });*/
+    }); */
 		
 		const opt = {
 			levelId: info.levelId,