|
@@ -70,6 +70,7 @@ export function useExam() {
|
|
|
nianji: null,
|
|
|
xueke: null,
|
|
|
haveFlag: false, // 是否有下一章
|
|
|
+ activeZhang: null
|
|
|
})
|
|
|
onLoad((options) => {
|
|
|
const jieId = options.jieId
|
|
@@ -84,8 +85,8 @@ export function useExam() {
|
|
|
data.zhangId = zhangId; // 需要路由参数 章Id
|
|
|
data.nianji = nianji; // 需要年纪Id 来执行返回页面
|
|
|
data.xueke = cardId; // 需要年纪Id 来执行返回页面
|
|
|
- const activeZhang = getZhangInfoByJieId(cacheZhangInfo.zhangList,jieId);
|
|
|
- data.haveFlag = activeZhang ? activeZhang.haveFlag: 0;
|
|
|
+ data.activeZhang = getZhangInfoByJieId(cacheZhangInfo.zhangList,jieId);
|
|
|
+ data.haveFlag = data.activeZhang.curZhang ? data.activeZhang.curZhang.haveFlag: 0;
|
|
|
|
|
|
// 初始化页面数据
|
|
|
initPage();
|
|
@@ -227,6 +228,17 @@ function useTishiLeftRight() {
|
|
|
}
|
|
|
|
|
|
function getZhangInfoByJieId(list, jieId) {
|
|
|
- return list.find(item => item.jieList.some(cite => cite.jieId == jieId)) || null;
|
|
|
+ const curZhang = list.find(item => item.jieList.some(cite => cite.jieId == jieId)) || null;
|
|
|
+ let nextZhang = null;
|
|
|
+ if (curZhang) {
|
|
|
+ const nextIndex = list.findIndex(item => curZhang.zhangId == item.zhangId);
|
|
|
+ if (nextIndex+1<list.length) {
|
|
|
+ nextZhang = list[nextIndex+1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ curZhang,
|
|
|
+ nextZhang
|
|
|
+ };
|
|
|
|
|
|
}
|