修复重新登陆练习错题本bug
This commit is contained in:
@@ -78,7 +78,10 @@
|
||||
|
||||
<view
|
||||
class="analysis_div"
|
||||
v-if="!clearResult && ['study', 'mistake', 'settlement', 'practice', 'practice_record'].includes(props.mode)"
|
||||
v-if="
|
||||
!clearResult &&
|
||||
['study', 'mistake', 'settlement', 'practice', 'practice_record'].includes(props.mode)
|
||||
"
|
||||
>
|
||||
<view class="analysis_title" v-if="qnsTyp !== 'ES'">
|
||||
<view class="success_answer">正确答案:{{ correctResultLabel.join('') }}</view>
|
||||
@@ -106,7 +109,7 @@
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, nextTick, computed, getCurrentInstance, watch } from 'vue';
|
||||
import { ref, reactive, onMounted, nextTick, computed, getCurrentInstance, watch } from 'vue';
|
||||
import radioSubjectItem from './radio-subject-item.vue';
|
||||
import esAnalysis from './es-analysis.vue';
|
||||
import questionVue from './question.vue';
|
||||
@@ -171,15 +174,31 @@
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val)
|
||||
});
|
||||
// result.anserResult
|
||||
|
||||
|
||||
let answerText = props.item?.my_answer || props.item.anserResult || [];
|
||||
// item_answer 是答题结果,可以是对象 数组 字符串类型
|
||||
const item_answer = ref(typeof answerText === 'string' ? answerText.split(',') : answerText);
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
console.log('modelValue', newVal);
|
||||
item_answer.value = typeof newVal === 'string' ? newVal.split(',') : newVal;
|
||||
}
|
||||
);
|
||||
watch(
|
||||
item_answer,
|
||||
(newVal) => {
|
||||
console.log('item_answer', newVal);
|
||||
emit('update:modelValue', newVal);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const feedback_click = () => {
|
||||
emit('subject_click', 'feedback', props.item);
|
||||
};
|
||||
|
||||
const instance = getCurrentInstance(); // 获取当前组件实例
|
||||
|
||||
// 切换展开/折叠状态(兼容H5和App)
|
||||
@@ -223,7 +242,7 @@
|
||||
const anserResultArray = props.item.anserResult.split(',');
|
||||
return subject_data.value.itemVos.filter((res) => anserResultArray.includes(res.itemId)).map((res) => res.itemNo);
|
||||
});
|
||||
|
||||
|
||||
// 判断选项是否完全正确
|
||||
const right_or_wrong_class = computed(
|
||||
() =>
|
||||
@@ -271,11 +290,11 @@
|
||||
// 点击答题
|
||||
const click_option = (analysisVo) => {
|
||||
if (props.isPreview || !props.clearResult) return;
|
||||
|
||||
|
||||
// 无论什么类型如果表里已经有了,再次点击就是弹出
|
||||
if (item_answer.value.includes(analysisVo.itemId)) {
|
||||
item_answer.value = item_answer.value.filter((id) => id !== analysisVo.itemId);
|
||||
modelValue.value = item_answer.value;
|
||||
// modelValue.value = item_answer.value;
|
||||
if (!['study'].includes(props.mode)) {
|
||||
muCheckbox('choose');
|
||||
}
|
||||
@@ -283,33 +302,33 @@
|
||||
// 单选
|
||||
// 单选插入,并且移除其他
|
||||
item_answer.value[0] = analysisVo.itemId;
|
||||
modelValue.value = item_answer.value;
|
||||
// modelValue.value = item_answer.value;
|
||||
muCheckbox('choose');
|
||||
} else if (props.item.qnsTyp === 'MU') {
|
||||
// 多选题
|
||||
// 多选直接插入
|
||||
item_answer.value.push(analysisVo.itemId);
|
||||
modelValue.value = item_answer.value;
|
||||
// modelValue.value = item_answer.value;
|
||||
if (!['study'].includes(props.mode)) {
|
||||
muCheckbox('choose');
|
||||
}
|
||||
|
||||
} else if (props.item.qnsTyp === 'JD') {
|
||||
// 判断题
|
||||
// 判断插入,并且移除其他
|
||||
item_answer.value = [analysisVo.itemId];
|
||||
modelValue.value = item_answer.value;
|
||||
// modelValue.value = item_answer.value;
|
||||
muCheckbox('choose');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const muBtnClick = () => {
|
||||
if(item_answer.value.length === 0){
|
||||
common.msg('请至少选择一个选项!')
|
||||
return
|
||||
if (item_answer.value.length === 0) {
|
||||
common.msg('请至少选择一个选项!');
|
||||
return;
|
||||
}
|
||||
muCheckbox('answer')
|
||||
}
|
||||
muCheckbox('answer');
|
||||
};
|
||||
|
||||
const muCheckbox = (type = 'answer') => {
|
||||
emit('subject_click', type, {
|
||||
qnsTyp: props.item.qnsTyp,
|
||||
@@ -318,6 +337,7 @@
|
||||
answerItems: subject_data.value.itemVos.filter((t) => item_answer.value.includes(t.itemId))
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化动画
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
|
||||
@@ -70,7 +70,8 @@
|
||||
});
|
||||
const item = computed(() => props.item);
|
||||
const fetchFunction = (params) => queryCrsExamHisByExamId({ examId: item.value.examId, ...params });
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData } = useItemList(fetchFunction);
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData, clear } =
|
||||
useItemList(fetchFunction);
|
||||
|
||||
// 跳转到详情
|
||||
const click_list_item = (list_item) => {
|
||||
@@ -79,6 +80,7 @@
|
||||
`/pages/examination/result?execId=${list_item.execId}&papersName=${papersName}&mode=record&flagQuery=Y&flagQueryDetail=Y`
|
||||
);
|
||||
};
|
||||
defineExpose({ clear });
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
class="scroll_div"
|
||||
:auto="false"
|
||||
empty-view-text="暂无记录"
|
||||
@refresherTouchend="refresherTouchend"
|
||||
>
|
||||
<view class="scroll-Y">
|
||||
<itemVue :item="item" v-for="item in data_list"></itemVue>
|
||||
<itemVue ref="itemVueRef" :item="item" v-for="item in data_list"></itemVue>
|
||||
</view>
|
||||
</z-paging>
|
||||
</template>
|
||||
@@ -17,9 +18,20 @@
|
||||
import { ref, reactive, onMounted, watch } from 'vue';
|
||||
import { queryCrsExamRecordPaging } from '@/api/courseRecord.js';
|
||||
import useZpaging from '@/composables/useZpaging';
|
||||
const itemVueRef = ref([]);
|
||||
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
|
||||
fetchFunction: queryCrsExamRecordPaging
|
||||
});
|
||||
const clearAll = () => {
|
||||
itemVueRef.value.forEach((child) => {
|
||||
if (child && typeof child.clear === 'function') {
|
||||
child.clear();
|
||||
}
|
||||
});
|
||||
};
|
||||
const refresherTouchend = () => {
|
||||
clearAll();
|
||||
};
|
||||
const props = defineProps<{
|
||||
tabIndex: number;
|
||||
currentIndex: number;
|
||||
|
||||
@@ -70,15 +70,16 @@
|
||||
}
|
||||
});
|
||||
const item = computed(() => props.item);
|
||||
|
||||
|
||||
const fetchFunction = (params) => queryPracticeHis({ crsId: item.value.crsId, ...params });
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData } = useItemList(fetchFunction);
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData, clear } =
|
||||
useItemList(fetchFunction);
|
||||
|
||||
// 跳转到详情
|
||||
const click_list_item = (list_item) => {
|
||||
common.navigateTo(`/pages/courseRecord/coursePracticeRecordDetail?exrId=${list_item.exrId}`);
|
||||
};
|
||||
|
||||
defineExpose({ clear });
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
class="scroll_div"
|
||||
:auto="false"
|
||||
empty-view-text="暂无记录"
|
||||
@refresherTouchend="refresherTouchend"
|
||||
>
|
||||
<view class="scroll-Y">
|
||||
<itemVue :item="item" v-for="item in data_list"></itemVue>
|
||||
<itemVue ref="itemVueRef" :item="item" v-for="item in data_list"></itemVue>
|
||||
</view>
|
||||
</z-paging>
|
||||
</template>
|
||||
@@ -17,9 +18,20 @@
|
||||
import { ref, reactive, onMounted, watch } from 'vue';
|
||||
import useZpaging from '@/composables/useZpaging';
|
||||
import { queryPracticeRecordPaging } from '@/api/courseRecord.js';
|
||||
const itemVueRef = ref([]);
|
||||
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
|
||||
fetchFunction: queryPracticeRecordPaging
|
||||
});
|
||||
const clearAll = () => {
|
||||
itemVueRef.value.forEach((child) => {
|
||||
if (child && typeof child.clear === 'function') {
|
||||
child.clear();
|
||||
}
|
||||
});
|
||||
};
|
||||
const refresherTouchend = () => {
|
||||
clearAll();
|
||||
};
|
||||
const props = defineProps<{
|
||||
tabIndex: number;
|
||||
currentIndex: number;
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
console.log('学习组件');
|
||||
import { computed } from 'vue';
|
||||
import common from '@/common/common';
|
||||
import { queryStdyBatchByCrsId } from '@/api/courseRecord.js';
|
||||
@@ -72,7 +71,7 @@
|
||||
const item = computed(() => props.item);
|
||||
|
||||
const fetchFunction = (params) => queryStdyBatchByCrsId({ crsId: item.value.crsId, ...params });
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData } = useItemList(fetchFunction);
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData, clear } = useItemList(fetchFunction);
|
||||
|
||||
// 跳转到详情
|
||||
const click_list_item = (list_item) => {
|
||||
@@ -80,6 +79,8 @@
|
||||
`/pages/courseRecord/courseStudyRecordDetail?stdyId=${list_item.stdyId}&crsName=${item.value.crsName || ''}`
|
||||
);
|
||||
};
|
||||
|
||||
defineExpose({clear})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
class="scroll_div"
|
||||
:auto="false"
|
||||
empty-view-text="暂无记录"
|
||||
@refresherTouchend="refresherTouchend"
|
||||
>
|
||||
<view class="scroll-Y">
|
||||
<itemVue :item="item" v-for="item in data_list"></itemVue>
|
||||
<itemVue ref="itemVueRef" :item="item" v-for="item in data_list"></itemVue>
|
||||
</view>
|
||||
</z-paging>
|
||||
</template>
|
||||
@@ -17,9 +18,20 @@
|
||||
import { ref, reactive, onMounted, watch } from 'vue';
|
||||
import { queryStdyRecordPaging } from '@/api/courseRecord.js';
|
||||
import useZpaging from '@/composables/useZpaging';
|
||||
const itemVueRef = ref([]);
|
||||
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
|
||||
fetchFunction: queryStdyRecordPaging
|
||||
});
|
||||
const clearAll = () => {
|
||||
itemVueRef.value.forEach((child) => {
|
||||
if (child && typeof child.clear === 'function') {
|
||||
child.clear();
|
||||
}
|
||||
});
|
||||
};
|
||||
const refresherTouchend = () => {
|
||||
clearAll();
|
||||
};
|
||||
const props = defineProps<{
|
||||
tabIndex: number;
|
||||
currentIndex: number;
|
||||
@@ -38,5 +50,4 @@
|
||||
background-color: #f1f5fa;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -95,13 +95,17 @@ export function useItemList(fetchFunction, item) {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const clear = () => {
|
||||
total.value = -1
|
||||
data_list.length = 0
|
||||
}
|
||||
return {
|
||||
status,
|
||||
data_list,
|
||||
show_list_state,
|
||||
list_div_height,
|
||||
show_list_click,
|
||||
getData
|
||||
getData,
|
||||
clear
|
||||
};
|
||||
}
|
||||
@@ -67,7 +67,7 @@
|
||||
});
|
||||
const item = computed(() => props.item);
|
||||
const fetchFunction = (params) => queryExamHisByExamId({ examId: item.value.examId, ...params });
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData } = useItemList(fetchFunction);
|
||||
const { status, data_list, show_list_state, list_div_height, show_list_click, getData, clear } = useItemList(fetchFunction);
|
||||
|
||||
// 跳转到详情
|
||||
const click_list_item = (list_item) => {
|
||||
@@ -77,6 +77,7 @@
|
||||
`/pages/examination/result?execId=${list_item.execId}&papersName=${papersName}&mode=record&flagQuery=${list_item.flagQuery}&flagQueryDetail=${flagQueryDetail}`
|
||||
);
|
||||
};
|
||||
defineExpose({clear})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<z-paging ref="pagingRef" v-model="data_list" @query="queryList" class="scroll_div" empty-view-text="暂无记录">
|
||||
<z-paging
|
||||
ref="pagingRef"
|
||||
v-model="data_list"
|
||||
@query="queryList"
|
||||
class="scroll_div"
|
||||
empty-view-text="暂无记录"
|
||||
@refresherTouchend="refresherTouchend"
|
||||
>
|
||||
<template #top>
|
||||
<view class="detail-main">
|
||||
<nav-bar :is_seat="false"></nav-bar>
|
||||
@@ -12,19 +19,31 @@
|
||||
</view>
|
||||
</template>
|
||||
<view class="scroll-Y">
|
||||
<itemVue :item="item" v-for="item in data_list"></itemVue>
|
||||
<itemVue ref="itemVueRef" :item="item" v-for="item in data_list"></itemVue>
|
||||
</view>
|
||||
</z-paging>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import itemVue from './components/examRecordItem.vue';
|
||||
import { queryExamRecordPaging } from '@/api/courseRecord.js';
|
||||
import useZpaging from '@/composables/useZpaging.js';
|
||||
import common from '@/common/common.js';
|
||||
const itemVueRef = ref([]);
|
||||
const { pagingRef, queryList, data_list, reload, search, total, clear } = useZpaging({
|
||||
fetchFunction: queryExamRecordPaging
|
||||
});
|
||||
const clearAll = () => {
|
||||
itemVueRef.value.forEach((child) => {
|
||||
if (child && typeof child.clear === 'function') {
|
||||
child.clear();
|
||||
}
|
||||
});
|
||||
};
|
||||
const refresherTouchend = () => {
|
||||
clearAll();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -258,6 +258,10 @@
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 单选和判断需要清除已点击的按钮
|
||||
if(['JD', 'SN'].includes(topic.value.qnsTyp)) {
|
||||
topic.value.my_answer = [];
|
||||
}
|
||||
common.hideLoading();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -182,44 +182,43 @@
|
||||
|
||||
// 单题回答
|
||||
const submitProblem = (answer) => {
|
||||
console.log('答题内容', answer);
|
||||
console.log('答单题', topic);
|
||||
const topic = topicList[questionNumber.value];
|
||||
common.loading('答题中');
|
||||
mistakesCorrect({
|
||||
misId: topic.value.misId,
|
||||
misId: topic.misId,
|
||||
ossKey: '',
|
||||
...answer
|
||||
})
|
||||
.then(async (res) => {
|
||||
let traQnsInfoVo;
|
||||
// 是问答题
|
||||
if (topic.value.qnsTyp === 'ES') {
|
||||
if (topic.qnsTyp === 'ES') {
|
||||
try {
|
||||
const result = await queryWithRetry(topic.value.misId);
|
||||
const result = await queryWithRetry(topic.misId);
|
||||
console.log(result, 'result');
|
||||
traQnsInfoVo = result.body.traQnsInfoVo;
|
||||
} catch (e) {
|
||||
common.hideLoading();
|
||||
topic.value.isPreview = false;
|
||||
topic.isPreview = false;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
traQnsInfoVo = res.body;
|
||||
}
|
||||
topic.value.isPreview = true; // 不能在点击了,打开预览模式
|
||||
topic.isPreview = true; // 不能在点击了,打开预览模式
|
||||
common.hideLoading();
|
||||
topic.value.clearResult = false; // 不清除正确答案
|
||||
topic.value.analyContent = traQnsInfoVo.analyContent; // 答案解析
|
||||
topic.clearResult = false; // 不清除正确答案
|
||||
topic.analyContent = traQnsInfoVo.analyContent; // 答案解析
|
||||
// 更新选项正确项目
|
||||
topic.value.itemVos = traQnsInfoVo.itemVos; // 答案选项(todo应该不这样替换)
|
||||
topic.value.anserResult = traQnsInfoVo.anserResult; // 正确答案字符串分割
|
||||
topic.value.judgeResult = traQnsInfoVo.judgeResult; // 正确答案字符串分割
|
||||
topic.itemVos = traQnsInfoVo.itemVos; // 答案选项(todo应该不这样替换)
|
||||
topic.anserResult = traQnsInfoVo.anserResult; // 正确答案字符串分割
|
||||
topic.judgeResult = traQnsInfoVo.judgeResult; // 正确答案字符串分割
|
||||
const judgeResultStatus = traQnsInfoVo.judgeResult === 'P'; // P为正确U为错误
|
||||
// 加载下一题
|
||||
if (!addProblem(questionNumber.value + 1)) {
|
||||
// 返回false说明到了最后一题
|
||||
console.log('最后一题', topic.value.qnsTyp, !judgeResultStatus);
|
||||
if (topic.value.qnsTyp === 'ES' || !judgeResultStatus) {
|
||||
console.log('最后一题', topic.qnsTyp, !judgeResultStatus);
|
||||
if (topic.qnsTyp === 'ES' || !judgeResultStatus) {
|
||||
// 最后一题是问答题,或者答错了,都不自动弹出
|
||||
return;
|
||||
} else {
|
||||
@@ -230,7 +229,7 @@
|
||||
// 自动切换下一题的条件
|
||||
if (
|
||||
judgeResultStatus && // 条件1.答题正确
|
||||
topic.value.qnsTyp !== 'ES' // 问答题答对打答错都不切换
|
||||
topic.qnsTyp !== 'ES' // 问答题答对打答错都不切换
|
||||
) {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
@@ -239,11 +238,15 @@
|
||||
});
|
||||
} else {
|
||||
console.log('为什么不跳转2', judgeResultStatus);
|
||||
console.log('为什么不跳转3', topic.value.qnsTyp !== 'ES');
|
||||
console.log('为什么不跳转3', topic.qnsTyp !== 'ES');
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 单选和判断需要清除已点击的按钮
|
||||
if(['JD', 'SN'].includes(topic.qnsTyp)) {
|
||||
topic.my_answer = [];
|
||||
}
|
||||
common.hideLoading();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user