|
@@ -23,7 +23,6 @@ function useJifen() {
|
|
|
rightAnswer: 0, // 答对
|
|
|
wrongAnswer: 0, // 答错
|
|
|
jifen: 0, // 积分
|
|
|
- zhangType: '' // 当前章类型 'last' 代表最后一章,最后一章无继续
|
|
|
})
|
|
|
|
|
|
function updateJifen({rightAnswer,wrongAnswer,jifen}) {
|
|
@@ -54,24 +53,37 @@ export function useExam() {
|
|
|
zhangId: null,
|
|
|
nianji: null,
|
|
|
xueke: null,
|
|
|
+ haveFlag: false, // 是否有下一章
|
|
|
})
|
|
|
onLoad((options) => {
|
|
|
- const { cardId } = cacheManager.get('auth');
|
|
|
- const {
|
|
|
- jieId,zhangId,nianji
|
|
|
- } = options;
|
|
|
- data.jieId = jieId; // 需要路由参数 节Id
|
|
|
+ const jieNumber = options.jieNumber
|
|
|
+ if (!(cacheManager.get('zhangInfo') && options.jieNumber)) {
|
|
|
+ toast('数据错误,缓存丢失/ number丢失')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const cacheZhangInfo = cacheManager.get('zhangInfo');
|
|
|
+ let currentObject = cacheZhangInfo.jieList.find(item => item.number == options.jieNumber);
|
|
|
+ const { cardId,zhangId,nianji } = cacheManager.get('auth');
|
|
|
+
|
|
|
+ data.jieId = currentObject.jieId; // 需要路由参数 节Id
|
|
|
data.zhangId = zhangId;// 需要路由参数 章Id
|
|
|
data.nianji = nianji; // 需要年纪Id 来执行返回页面
|
|
|
data.xueke = cardId; // 需要年纪Id 来执行返回页面
|
|
|
-
|
|
|
+ data.haveFlag = cacheZhangInfo.haveFlag
|
|
|
|
|
|
// 初始化页面数据
|
|
|
initPage();
|
|
|
})
|
|
|
|
|
|
watch(() => data.list, (val) => {
|
|
|
- const list = data.list.filter(item => item.reply!==null);
|
|
|
+ const list = data.list.filter(item => {
|
|
|
+ if (item.type == 3) {
|
|
|
+ // 填空题 所有试题答完
|
|
|
+ return !item.reply.some(citem => citem.trim() == '');
|
|
|
+ } else {
|
|
|
+ return item.reply!==null
|
|
|
+ }
|
|
|
+ });
|
|
|
data.count = list.length;
|
|
|
},{deep: true})
|
|
|
|
|
@@ -92,6 +104,11 @@ export function useExam() {
|
|
|
list.forEach((item, index) => {
|
|
|
item.mta_show = false;
|
|
|
item.reply = null;
|
|
|
+ if (item.type == 3) {
|
|
|
+ item.result = JSON.parse(item.result);
|
|
|
+ item.placeholders = item.result.map((item,cindex) => `[bank${cindex}]`)
|
|
|
+ item.reply = item.result.map(() => '');
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -109,7 +126,7 @@ export function useExam() {
|
|
|
async function handleSubmit(dom) {
|
|
|
const result = [];
|
|
|
data.list.forEach(item => {
|
|
|
- result.push({reply: item.reply,stId: item.stId})
|
|
|
+ result.push({reply: item.reply ? JSON.stringify(item.reply):'',stId: item.stId})
|
|
|
})
|
|
|
|
|
|
const [error, cdata] =await catchError(httpUnit.getExamSubmit({
|