修改错题本bug

This commit is contained in:
田岩
2025-09-15 08:35:09 +08:00
parent 354aa5b041
commit c8216c5cb6
14 changed files with 253 additions and 228 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ ENV = 'development'
# VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786'
# DEV
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# app入口
#VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
@@ -24,7 +24,7 @@ VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# dev
VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
#VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
# sit
#VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
+3
View File
@@ -4,3 +4,6 @@ npm 淘宝源下载 npm config set registry https://registry.npmmirror.com
npm config set registry http://25.12.10.69:8081/repository/aliyun-npm/
npm install --registry=https://registry.npmmirror.com
+1 -1
View File
@@ -51,7 +51,7 @@
});
const keywords = computed(() => {
if (!props.value.relKeyword) return [];
return props.value.relKeyword.split(',').map((key) => key.trim());
return props.value.relKeyword.split(/[,、]/).map((key) => key.trim());
});
const highlightedText = computed(() => {
+2 -1
View File
@@ -6,13 +6,13 @@ import {
} from 'vue';
export default function useZpaging({
pagingRef, // 必传:z-paging组件的ref
fetchFunction, // 必传:接口请求函数
searchKey = '' // 可选:搜索参数名,默认'searchText'
}) {
const total = ref(-1);
const data_list = ref([]);
const searchText = ref('');
const pagingRef = ref(null);
const queryList = async (pageNo, pageSize) => {
try {
const requestParams = {
@@ -52,6 +52,7 @@ export default function useZpaging({
}
};
return {
pagingRef,
queryList,
reload,
search,
+1
View File
@@ -195,6 +195,7 @@
"path": "pages/wrongQuestionRecord/correct",
"style": {
"navigationBarTitleText": "错题本做题页",
"disableSwipeBack": true,
"app-plus": {
"titleNView": false
}
+2 -1
View File
@@ -156,7 +156,7 @@
import Subject from '@/components/examination/subject.vue';
import TouchBtn from '@/components/examination/touchBtn.vue';
import { ref, reactive, computed, onMounted, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { onLoad, onBackPress } from '@dcloudio/uni-app';
import common from '@/common/common';
import { getPageCache, setupKeyboardHeightListener } from '@/common/common';
import { commonUploadVoiceFile } from '@/api/common.js';
@@ -663,6 +663,7 @@
}
});
};
onBackPress((res) => res.from === 'backbutton');
</script>
<style scoped lang="scss">
-3
View File
@@ -1,9 +1,6 @@
<!-- 滑动切换选项卡演示(标准写法) -->
<template>
<!-- 使用z-paging-swiper为根节点可以免计算高度 -->
<z-paging-swiper>
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中 -->
<!-- 注意此处的z-tabs为独立的组件可替换为第三方的tabs若需要使用z-tabs请在插件市场搜索z-tabs并引入否则会报插件找不到的错误 -->
<template #top>
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
+13 -14
View File
@@ -1,6 +1,13 @@
<template>
<view class="main_div max_page">
<view v-html="ysxi_text"></view>
<!-- <view v-html="ysxi_text"></view> -->
<web-view
:src="ysxi_text"
:fullscreen="true"
:webview-styles="{
width: '100%',
height: '100%'
}"></web-view>
</view>
</template>
@@ -12,24 +19,16 @@
onLoad
} from '@dcloudio/uni-app'
import common from '@/common/common'
import { get_base_url } from '@/api/request.js'
import {
getYsxy,
getFutk
} from '@/api/login.js'
const ysxi_text = ref('')
onLoad((e) => {
common.loading()
if (e.page == 1) {
getFutk().then(res => {
ysxi_text.value = res.body.agtContt
common.hideLoading()
});
} else {
getYsxy().then(res => {
ysxi_text.value = res.body.agtContt
common.hideLoading()
});
}
onLoad(() => {
const base_url = get_base_url()
ysxi_text.value = base_url + '/traapp/dfAgtInfo/queryValidDfAgtHtml'
console.log('ysxi_text.value', ysxi_text.value);
})
</script>
+5 -3
View File
@@ -81,7 +81,7 @@
<script setup>
import { ref, reactive, computed, onMounted, nextTick, onUnmounted } from 'vue';
import { onLoad, onHide, onShow, onUnload } from '@dcloudio/uni-app';
import { onLoad, onHide, onShow, onUnload, onBackPress } from '@dcloudio/uni-app';
import Feedback from '@/pages/examination/components/feedback.vue';
import Dialog from '@/pages/examination/components/dialog.vue';
@@ -119,7 +119,7 @@
get: () => topicList[questionNumber.value],
set: (val) => (topicList[questionNumber.value] = val)
});
const showTouchBtn = computed(() => {
return topic.value?.qnsTyp === 'ES' && !topic.value?.my_answer.anserResult;
});
@@ -298,7 +298,8 @@
};
// 录音组件提交
const touchBtnSubmit = (type, submitObj) => {1
const touchBtnSubmit = (type, submitObj) => {
1;
touchBtnRef.value?.clearinputText(); // 清除发送框数据
if (type === 'voice') {
topic.value.es_status = '00'; // 00转圈
@@ -479,6 +480,7 @@
onUnload(() => {
stopTimer();
});
onBackPress((res) => res.from === 'backbutton');
</script>
<style scoped lang="scss">
@@ -1,5 +1,19 @@
<template>
<view class="max_page detail-main">
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
:fixed="false"
:auto="false"
class="scroll_div"
empty-view-text="暂无错题"
>
<view class="scroll-Y">
<view class="content" v-for="(item, index) in data_list">
<subject :item="item" mode="mistake" :isPreview="true" :clearResult="false"></subject>
</view>
</view>
<!-- <view class="max_page detail-main">
<scroll-view :scroll-y="true" class="scroll-Y" :show-scrollbar="false" @scrolltolower="scrolltolower">
<view class="content" v-for="(item, index) in data_list">
<subject :item="item" mode="mistake" :isPreview="true" :clearResult="false"></subject>
@@ -7,71 +21,57 @@
<list-no-data v-if="total === 0 && status == 'nomore'">暂无错题</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</view> -->
</z-paging>
</template>
<script setup>
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
import { ref, reactive, onMounted, nextTick } from 'vue';
import {onMounted, watch} from 'vue'
import { queryTraCrsBbsInfoByCrsId } from '@/api/courseDetail.js';
import { queryTraMistakesCollectionPaging } from '@/api/wrongQuestionRecord.js';
import Subject from '@/components/examination/subject.vue';
const getData = (from = '') => {
if (from == 'first') {
if (total.value !== -1) {
return;
import useZpaging from '@/composables/useZpaging.js';
const fetchFunction = (params) => queryTraMistakesCollectionPaging({ isCorrect: 'Y', ...params });
const { pagingRef, queryList, data_list, reload, search, total, clear } = useZpaging({
fetchFunction
});
const props = defineProps({
tabIndex: {
type: Number,
default: function () {
return 0;
}
},
currentIndex: {
type: Number,
default: function () {
return 0;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
setTimeout(() => {
queryTraMistakesCollectionPaging({
isCorrect: 'Y',
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
}, 200);
};
const scrolltolower = (item) => {
getData();
};
defineExpose({
getData
});
onMounted(() => {
watch(
() => props.currentIndex,
(newVal) => {
if (newVal === props.tabIndex && total.value === -1) {
reload();
}
},
{
immediate: true
}
);
});
</script>
<style scoped lang="scss">
$bg-margin-left: 30rpx;
.content {
position: relative;
margin: 32rpx $bg-margin-left;
margin: 32rpx 30rpx;
border-radius: 16rpx;
padding: 34rpx 30rpx 34rpx 36rpx;
background-color: #fff;
}
.scroll-Y {
background-color: #f1f5fa;
max-height: calc(100vh - var(--status-bar-height) - 78rpx - 88rpx - 156rpx);
}
</style>
@@ -1,77 +1,92 @@
<template>
<view class="max_page detail-main">
<scroll-view :scroll-y="true" class="scroll-Y" :show-scrollbar="false" @scrolltolower="scrolltolower">
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
:fixed="false"
:auto="false"
class="scroll_div"
empty-view-text="暂无错题"
>
<view class="scroll-Y">
<view class="content" v-for="(item, index) in data_list">
<subject :item="item" mode="mistake" :isPreview="true" :clearResult="false"></subject>
</view>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无错题</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</view>
<!-- <view class="max_page detail-main">
<scroll-view :scroll-y="true" class="scroll-Y" :show-scrollbar="false" @scrolltolower="scrolltolower"> -->
<!-- <view class="content" v-for="(item, index) in data_list">
<subject :item="item" mode="mistake" :isPreview="true" :clearResult="false"></subject>
</view> -->
<!-- <list-no-data v-if="total === 0 && status == 'nomore'">暂无错题</list-no-data> -->
<!-- <uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more> -->
<!-- </scroll-view>
</view> -->
<template #bottom>
<view class="fixed-box" v-if="show_fixed_button_statue"></view>
</template>
</z-paging>
</template>
<script setup>
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
import { ref, reactive, onMounted, nextTick } from 'vue';
import { queryTraCrsBbsInfoByCrsId } from '@/api/courseDetail.js';
import { ref, reactive, onMounted, nextTick, watch } from 'vue';
import { onShow} from '@dcloudio/uni-app';
import { queryTraMistakesCollectionPaging } from '@/api/wrongQuestionRecord.js';
import Subject from '@/components/examination/subject.vue';
const getData = (from = '') => {
if (from == 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
setTimeout(() => {
queryTraMistakesCollectionPaging({
isCorrect: 'N',
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
}, 200);
};
const scrolltolower = (item) => {
getData();
};
defineExpose({
getData
import useZpaging from '@/composables/useZpaging.js';
const fetchFunction = (params) => queryTraMistakesCollectionPaging({ isCorrect: 'N', ...params });
const { pagingRef, queryList, data_list, reload, search, total, clear } = useZpaging({
fetchFunction
});
const show_fixed_button_statue = ref(false)
const emit = defineEmits(['emit_show_fixed_button_statue']);
watch(data_list, (newVal) => {
show_fixed_button_statue.value = !!newVal.length
emit('emit_show_fixed_button_statue', show_fixed_button_statue.value)
})
const props = defineProps({
tabIndex: {
type: Number,
default: function () {
return 0;
}
},
currentIndex: {
type: Number,
default: function () {
return 0;
}
}
});
onMounted(() => {
watch(
() => props.currentIndex,
(newVal) => {
if (newVal === props.tabIndex && total.value === -1) {
reload();
}
},
{
immediate: true
}
);
});
defineExpose({reload})
</script>
<style scoped lang="scss">
$bg-margin-left: 30rpx;
.content {
position: relative;
margin: 32rpx $bg-margin-left;
margin: 32rpx 30rpx;
border-radius: 16rpx;
padding: 34rpx 30rpx 34rpx 36rpx;
background-color: #fff;
}
.scroll-Y {
background-color: #f1f5fa;
max-height: calc(100vh - var(--status-bar-height) - 78rpx - 88rpx - 156rpx);
}
.fixed-box {
height: 156rpx;
}
</style>
+32 -17
View File
@@ -80,7 +80,7 @@
<script setup>
import { ref, reactive, computed, nextTick } from 'vue';
import { onLoad, onHide, onShow, onUnload } from '@dcloudio/uni-app';
import { onLoad, onHide, onShow, onUnload, onBackPress } from '@dcloudio/uni-app';
import Feedback from '@/pages/examination/components/feedback.vue';
import Dialog from '@/pages/examination/components/dialog.vue';
import Subject from '@/components/examination/subject.vue';
@@ -109,11 +109,11 @@
get: () => topicList[questionNumber.value],
set: (val) => (topicList[questionNumber.value] = val)
});
const showTouchBtn = computed(() => {
return topic.value?.qnsTyp === 'ES' && !topic.value?.my_answer.anserResult;
});
// 下面语音组件的禁用状态判断
const touchIsDisabled = computed(() => topic.value?.es_status !== '' && topic.value?.es_status !== undefined);
@@ -138,7 +138,7 @@
};
// 判断是否滑动结束
const isLastTopic = computed(
() => topicList.length === finishCurrent.value + 1 && finishCurrent.value === questionNumber.value
() => storageIdList.value.length === finishCurrent.value + 1 && finishCurrent.value === questionNumber.value
);
const transition = (event) => {
@@ -179,7 +179,7 @@
topic.value.es_status = ''; // 取消转圈
}
};
// 单题回答
const submitProblem = (answer) => {
console.log('答题内容', answer);
@@ -254,7 +254,7 @@
if (maxRetries <= 0) {
return Promise.reject(new Error('超过最大重试次数,查询失败'));
}
return queryMistakesCorrectByMisId({ misId:execLogId })
return queryMistakesCorrectByMisId({ misId: execLogId })
.then((res) => {
console.log('queryMistakesCorrectByMisId', maxRetries, res.body);
const isWait = res.body.isWait;
@@ -321,11 +321,11 @@
};
// 添加下一道题
const addProblem = async (index) => {
const addProblem = (index) => {
// index 要加载的题号
if (topicList.length >= storageIdList.value.length) return false; // 说明已经加载所有题了
if (index < topicList.length) return true; // 说明此题已经加载
console.log('xxx', topicList.length, storageIdList.value.length);
if (topicList.length >= storageIdList.value.length) return false; // 说明已经加载所有题了
const id = storageIdList.value[index]; // 找到id
if (storageIdDict.value[id] === undefined) {
@@ -345,7 +345,7 @@
return true;
};
// 网络加载题,并且放
// 网络加载题,并且放起来
const addRequestProblem = async (index, success = () => {}) => {
const id = storageIdList.value[index];
const preload = () => {
@@ -377,7 +377,9 @@
isPreview: false,
clearResult: true,
es_status: '', // 预设一下问答题的状态,'' 空为没有 00 转圈 01 播放,其他暂定
my_answer: []
my_answer: [],
// 这里是给后端擦屁股的代码,都是些新题不该存在的数据
judgeResult: ''
};
storageIdDict.value[id] = {
state: '01',
@@ -405,7 +407,7 @@
setupKeyboardHeightListener((height) => {
popup_input_bottom.value = `${height}px`;
});
setTimeout(() => {
addRequestProblem(0, () => {
addProblem(0);
@@ -413,18 +415,20 @@
}, 10);
});
const result_click = async ({ key }) => {
const result_click = ({ key }) => {
isTriggered.value = false; // 恢复
if (key === 'return') {
// 返回
dialogRef.value.close();
await nextTick();
// await nextTick();
common.navigateBack();
} else if (key === 'exit') {
// 中途退出
dialogRef.value.close();
await nextTick();
// dialogRef.value.close();
// await nextTick();
console.log('下11', '退出');
common.navigateBack();
console.log('下1', '退出');
} else if (key === 'revert') {
// 返回
dialogRef.value.close();
@@ -469,10 +473,21 @@
]
});
};
onShow(() => {});
onHide(() => {});
onUnload(() => {});
onUnload(() => {
const pages = getCurrentPages();
if (pages.length >= 2) {
const prevPage = pages[pages.length - 2];
if (prevPage.route === 'pages/wrongQuestionRecord/index') {
if (prevPage.$vm && typeof prevPage.$vm.$?.exposed?.reload === 'function') {
prevPage.$vm.$?.exposed?.reload();
}
}
}
});
onBackPress((res) => res.from === 'backbutton');
</script>
<style scoped lang="scss">
+72 -82
View File
@@ -1,74 +1,77 @@
<template>
<view class="max_page detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
<z-paging-swiper>
<template #top>
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="title font_pf">错题本</view>
</view>
<view class="title font_pf">错题本</view>
</view>
<view class="detail-body">
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
<view class="detail-body">
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
</view>
</view>
<view class="uni-margin-wrap no-overflow">
<swiper
class="swiper"
:current="tabAct"
:indicator-dots="false"
:disable-touch="true"
@change="swiperChange"
>
<swiper-item>
<FavoritesCourse ref="courseRef"></FavoritesCourse>
</swiper-item>
<swiper-item>
<Correct ref="correctRef"></Correct>
</swiper-item>
</swiper>
</template>
<swiper class="swiper" :current="tabAct" @change="swiperChange">
<swiper-item class="swiper-item">
<FavoritesCourse
:ref="(el) => (listItemRefs[0] = el)"
:tabIndex="0"
:currentIndex="tabAct"
@emit_show_fixed_button_statue="emit_show_fixed_button_statue"
></FavoritesCourse>
</swiper-item>
<swiper-item class="swiper-item">
<Correct :ref="(el) => (listItemRefs[1] = el)" :tabIndex="1" :currentIndex="tabAct"></Correct>
</swiper-item>
</swiper>
<template #bottom>
<view class="fixed-box" :class="{ 'fixed-box-hidden': tabAct === 1 || !show_fixed_button_statue }">
<uv-button
@click="redo_subject"
type="primary"
class="send_evaluate"
color="#0066FF"
:throttleTime="100"
:loading="fixed_button_loading"
text="重做错题"
loadingText="正在加载错题"
:custom-style="customStyle"
></uv-button>
</view>
</view>
<view class="fixed-box" :class="{ 'fixed-box-hidden': tabAct === 1 }">
<uv-button
@click="redo_subject"
type="primary"
class="send_evaluate"
color="#0066FF"
:throttleTime="100"
text="重做错题"
:custom-style="customStyle"
></uv-button>
</view>
</view>
</template>
</z-paging-swiper>
</template>
<script setup>
import Correct from './components/correct.vue';
import FavoritesCourse from './components/favorites-course.vue';
// 我的收藏
import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue';
import { LineBg } from '@/enum.js';
import { queryTraMistakesCollection } from '@/api/wrongQuestionRecord.js';
import common from '@/common/common';
import { setPageCache } from '@/common/common';
import useIndexList from '@/composables/useIndexList.js';
const { listItemRefs, tabChange, swiperChange, tabAct } = useIndexList();
const customStyle = {
borderRadius: '16rpx'
};
const fixed_button_loading = ref(false);
const courseRef = ref(null);
const correctRef = ref(null);
const tabAct = ref(0);
const tabList = ref([
{
name: '当前错题'
@@ -78,16 +81,10 @@
}
]);
const tabChange = (item) => {
tabAct.value = item.index;
};
const swiperChange = (item) => {
tabAct.value = item.detail.current;
};
const redo_subject = async () => {
// 重做错题
common.loading();
// common.loading();
fixed_button_loading.value = true;
queryTraMistakesCollection()
.then((res) => {
setPageCache('correct', {
@@ -97,25 +94,20 @@
common.navigateTo('/pages/wrongQuestionRecord/correct');
})
.finally(() => {
common.hideLoading();
fixed_button_loading.value = false;
// common.hideLoading();
});
};
onMounted(() => {
watch(
tabAct,
(newValue, oldValue) => {
if (newValue === 0) {
courseRef.value?.getData('first');
} else if (newValue === 1) {
correctRef.value?.getData('first');
}
},
{
immediate: true
}
); // 这里的immediate会在onMounted之后执行
});
const show_fixed_button_statue = ref(false);
const emit_show_fixed_button_statue = (status) => {
show_fixed_button_statue.value = status;
};
const reload = () => {
listItemRefs.value[0]?.reload(true);
};
defineExpose({ reload });
</script>
<style lang="scss" scoped>
@@ -154,14 +146,12 @@
}
.swiper {
height: calc(100vh - var(--status-bar-height) - 78rpx - 88rpx - 156rpx);
height: 100%;
}
.swiper-item {
display: block;
height: 100%;
line-height: 300rpx;
text-align: center;
background-color: #f1f5fa;
}
.detail-body {
+2 -1
View File
@@ -123,7 +123,7 @@
"style": {
"navigationBarTitleText": "错题本",
"app-plus": {
"titleNView": false
"titleNView": false
}
}
},
@@ -131,6 +131,7 @@
"path": "pages/wrongQuestionRecord/correct",
"style": {
"navigationBarTitleText": "错题本做题页",
"disableSwipeBack": true,
"app-plus": {
"titleNView": false
}