|
@@ -10,7 +10,7 @@
|
|
<scroll-view scroll-x="true" :scroll-left='wordLeft' class="word-title-box"
|
|
<scroll-view scroll-x="true" :scroll-left='wordLeft' class="word-title-box"
|
|
v-if="listData.jieNumberList && listData.jieNumberList.length >0">
|
|
v-if="listData.jieNumberList && listData.jieNumberList.length >0">
|
|
<view :id="'item-' + item.jieId" class="title-item" v-for="(item,index) in listData.jieNumberList"
|
|
<view :id="'item-' + item.jieId" class="title-item" v-for="(item,index) in listData.jieNumberList"
|
|
- :key="item.jieId" @click="handleTitleClick(item)"
|
|
|
|
|
|
+ :key="item.jieId"
|
|
:class="{active: listData.activeIndex == index}">Unit{{item.number}}</view>
|
|
:class="{active: listData.activeIndex == index}">Unit{{item.number}}</view>
|
|
</scroll-view>
|
|
</scroll-view>
|
|
|
|
|
|
@@ -61,7 +61,8 @@
|
|
ref
|
|
ref
|
|
} from "vue";
|
|
} from "vue";
|
|
import {
|
|
import {
|
|
- toast
|
|
|
|
|
|
+ toast,
|
|
|
|
+ getDataFromStr
|
|
} from "@/utils/common";
|
|
} from "@/utils/common";
|
|
import {
|
|
import {
|
|
onLoad
|
|
onLoad
|
|
@@ -83,26 +84,25 @@
|
|
let routerOpt = ref(false);
|
|
let routerOpt = ref(false);
|
|
let wordLeft = ref(0);
|
|
let wordLeft = ref(0);
|
|
const youkeDialogRef = ref(null);
|
|
const youkeDialogRef = ref(null);
|
|
- const currentIndex = ref(null)
|
|
|
|
const unitList = ref([])
|
|
const unitList = ref([])
|
|
- const info= reactive({
|
|
|
|
|
|
+ const info = reactive({
|
|
levelId: null,
|
|
levelId: null,
|
|
zhangId: null,
|
|
zhangId: null,
|
|
})
|
|
})
|
|
|
|
|
|
onLoad((options) => {
|
|
onLoad((options) => {
|
|
routerOpt = options;
|
|
routerOpt = options;
|
|
- info.levelId = routerOpt.levelId;
|
|
|
|
- info.zhangId = routerOpt.zhangId;
|
|
|
|
- // 获取缓存
|
|
|
|
- console.log(cacheManager.get('auth').levelId,'cacheManager.get');
|
|
|
|
-
|
|
|
|
if (!cacheManager.get('auth')) {
|
|
if (!cacheManager.get('auth')) {
|
|
|
|
+ info.levelId = routerOpt.levelId;
|
|
|
|
+ info.zhangId = routerOpt.zhangId;
|
|
// 游客
|
|
// 游客
|
|
const youkeData = JSON.parse(routerOpt.youkePageData)
|
|
const youkeData = JSON.parse(routerOpt.youkePageData)
|
|
wordJieId = youkeData.jieId
|
|
wordJieId = youkeData.jieId
|
|
getWordListDataYk();
|
|
getWordListDataYk();
|
|
} else {
|
|
} else {
|
|
|
|
+ // 获取缓存
|
|
|
|
+ [info.levelId, info.zhangId ] = getDataFromStr(cacheManager.get('auth').levelId)
|
|
|
|
+
|
|
// 非游客
|
|
// 非游客
|
|
wordJieId = routerOpt.jieId
|
|
wordJieId = routerOpt.jieId
|
|
getWordListData();
|
|
getWordListData();
|
|
@@ -110,12 +110,13 @@
|
|
});
|
|
});
|
|
|
|
|
|
function handleSwiperChange(e) {
|
|
function handleSwiperChange(e) {
|
|
- currentIndex.value = e.detail.current + 1;
|
|
|
|
|
|
+ listData.activeIndex = e.detail.current;
|
|
// unit滚动到指定位置
|
|
// unit滚动到指定位置
|
|
- findWordLeft(e.detail.current)
|
|
|
|
- // 修改缓存zid 用于定位岛
|
|
|
|
- // updataCache(item.zhangZid)
|
|
|
|
|
|
+ findWordLeft(listData.activeIndex)
|
|
|
|
+ handleTitleClick(listData.jieNumberList[listData.activeIndex])
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
// 游客弹窗---确定
|
|
// 游客弹窗---确定
|
|
function ykConfirm() {
|
|
function ykConfirm() {
|
|
@@ -165,9 +166,9 @@
|
|
findWordLeft(findIndex)
|
|
findWordLeft(findIndex)
|
|
return findIndex;
|
|
return findIndex;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// 获取滚动距离
|
|
// 获取滚动距离
|
|
- function findWordLeft(data){
|
|
|
|
|
|
+ function findWordLeft(data) {
|
|
wordLeft.value = data * 40;
|
|
wordLeft.value = data * 40;
|
|
return wordLeft.value;
|
|
return wordLeft.value;
|
|
}
|
|
}
|
|
@@ -188,7 +189,7 @@
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
toast("获取单词列表数据失败");
|
|
toast("获取单词列表数据失败");
|
|
}); */
|
|
}); */
|
|
-
|
|
|
|
|
|
+
|
|
const opt = {
|
|
const opt = {
|
|
levelId: info.levelId,
|
|
levelId: info.levelId,
|
|
zhangId: info.zhangId,
|
|
zhangId: info.zhangId,
|
|
@@ -199,10 +200,10 @@
|
|
unitList.value = res.data;
|
|
unitList.value = res.data;
|
|
unitList.value.forEach(item => {
|
|
unitList.value.forEach(item => {
|
|
if (item.jieId == wordJieId.value) {
|
|
if (item.jieId == wordJieId.value) {
|
|
- listData.activeIndex = findIndexByJieId(listData.jieNumberList,wordJieId);
|
|
|
|
|
|
+ listData.activeIndex = findIndexByJieId(listData.jieNumberList, wordJieId);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
toast("获取单词列表数据失败");
|
|
toast("获取单词列表数据失败");
|
|
@@ -224,7 +225,7 @@
|
|
unitList.value = res.data;
|
|
unitList.value = res.data;
|
|
unitList.value.forEach(item => {
|
|
unitList.value.forEach(item => {
|
|
if (item.jieId == wordJieId.value) {
|
|
if (item.jieId == wordJieId.value) {
|
|
- listData.activeIndex = findIndexByJieId(listData.jieNumberList,wordJieId);
|
|
|
|
|
|
+ listData.activeIndex = findIndexByJieId(listData.jieNumberList, wordJieId);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|