Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop

This commit is contained in:
杨航
2025-09-04 09:42:57 +08:00
11 changed files with 86 additions and 77 deletions
+2 -2
View File
@@ -98,12 +98,12 @@ export default function request({
const res = response.data
if (res?.rtnCode === '0000') {
return resolve(res)
} else if (res?.rtnCode === '0001') { // 为前后端约定不公共拦截的码值(王洋洋20250830定)
} else if (res?.rtnCode === '1001') { // 为前后端约定不公共拦截的码值(小树20250903定)
return reject(res)
} else if (res?.rtnCode === '0002' && res?.message) {
if (toastErrors) {
common.msg(res.message)
}
}
return reject(response)
}
//到这里下面全是异常的处理
+4 -2
View File
@@ -261,6 +261,7 @@
}
};
onMounted(async () => {
// 监听评论列表更新
uni.$on('refresh_comment_data', () => {
commentRef.value?.getData('submit');
tabAct.value = 2;
@@ -276,13 +277,14 @@
});
onUnload(() => {
uni.$off('refresh_comment_data');
// 如果收藏变了,并且上一页是收藏页,更新收藏列表
if (form.value.collectId !== collectId.value) {
const pages = getCurrentPages();
if (pages.length >= 2) {
const prevPage = pages[pages.length - 2];
if (prevPage.route === 'pages/favorites/index') {
// 更新
uni.$emit('refresh_favorites_data', {
uni.$emit('refresh_favorites_list', {
type: 'course',
state: !!form.value.collectId, // 最终是收藏了还是取消了
old: collectId.value, // 进入时候的收藏id
+33 -43
View File
@@ -3,7 +3,7 @@
<nav-bar :is_seat="true"></nav-bar>
<view class="nav-div">
<view class="title ellipsis-text">考试结算</view>
<view class="back_div" @click="goto_back()">
<view class="back-icon"></view>
</view>
@@ -105,11 +105,7 @@
<image src="@/static/images/examination/unable_img.png" mode="widthFix" class="img"></image>
<view class="tip">您暂无权限查看此试卷详情</view>
</view>
<view
v-show="index === sheet_index"
:class="getStatusClass(index)"
v-for="(item, index) in topicList"
>
<view v-show="index === sheet_index" :class="getStatusClass(index)" v-for="(item, index) in topicList">
<Subject :item="item" mode="settlement" :clearResult="false" :isPreview="true"></Subject>
</view>
</view>
@@ -125,7 +121,7 @@
import { onLoad, onUnload } from '@dcloudio/uni-app';
import { ref, reactive, computed, onMounted, nextTick, getCurrentInstance } from 'vue';
import { queryPaperExamScore, queryCrsExamScore } from '@/api/examination.js';
import Subject from '@/components/examination/subject.vue';
import common from '@/common/common';
const pass_status = ref(0);
@@ -162,10 +158,10 @@
// 答题卡判断每道题的状态
const completedListStatus = computed(() => {
return topicList.map((res) => {
if(res.judgeResult === 'P') {
return 'success'
}else if(res.judgeResult === 'U' && res.anserResult !== '') {
return 'error'
if (res.judgeResult === 'P') {
return 'success';
} else if (res.judgeResult === 'U' && res.anserResult !== '') {
return 'error';
}
});
});
@@ -220,10 +216,9 @@
}
};
const goto_back = () => {
common.navigateBack()
common.navigateBack();
};
const getStatusClass = (index) => {
const remainder = index % 3;
if (remainder === 0) return 'in_progress';
@@ -239,24 +234,16 @@
const timerId = ref(null);
const get_result = () => {
// 重置计数器(首次调用时)
if (requestCount.value === 0) {
requestCount.value = 0;
}
// 检查是否已达到最大请求次数
if (requestCount.value >= 15) {
console.log('已达到最大请求次数(15次),停止请求');
requestCount.value = 0;
return;
}
let req
if (result.crsId !== '') { // 试卷跳入
req = queryCrsExamScore
} else {
req = queryPaperExamScore
}
timerId.value = setTimeout(() => {
// 确定请求方法
const req = result.crsId !== '' ? queryCrsExamScore : queryPaperExamScore;
// 抽离请求逻辑为单独函数
const fetchData = () => {
// 每次请求前计数器+1
requestCount.value++;
req({
@@ -264,13 +251,14 @@
})
.then(({ body }) => {
console.log(`${requestCount.value}次请求返回`, body);
if (body.isWait === 'Y') {
// 未完成且未达上限,继续请求
if (requestCount.value < 15) {
get_result();
// 这里用定时器延迟下次请求
timerId.value = setTimeout(fetchData, 2000);
} else {
console.log('已达到最大请求次数,停止等待');
requestCount.value = 0;
}
} else if (body.isWait === 'N') {
// 完成请求,处理结果
@@ -282,7 +270,7 @@
result.examLenTm = body.examLenTm;
}
topicList.push(...body.qnsInfoVo);
requestCount.value = 0;
// 触发考试完成事件
}
})
@@ -290,10 +278,15 @@
console.error('请求失败', err);
// 请求失败也计入次数,避免无限重试
if (requestCount.value < 15) {
get_result();
timerId.value = setTimeout(fetchData, 2000);
} else {
// 失败次数达上限,重置计数器
requestCount.value = 0;
}
});
}, 2000);
};
// 立即执行第一次请求
fetchData();
};
// 初始化时检查
@@ -371,7 +364,6 @@
margin-left: $bg-margin-left;
}
.scroll-Y {
// max-height: calc(100vh - var(--status-bar-height) - 70rpx - 70rpx - 40rpx - 64rpx - 68rpx - 60rpx);
height: calc(100vh - var(--status-bar-height) - 70rpx - 10rpx);
@@ -458,7 +450,7 @@
width: 80rpx;
margin: 0 auto;
border-radius: 10rpx;
background-color: #FCE8E9;
background-color: #fce8e9;
}
.sheet_table {
@@ -479,25 +471,23 @@
.circle.success {
// 已完成
background-color: #E7F8ED;
border-color: #15B859;
color: #15B859;
background-color: #e7f8ed;
border-color: #15b859;
color: #15b859;
}
.circle.error {
// 已完成
background-color: #FCE8E9;
border-color: #F5212D;
color: #F5212D;
background-color: #fce8e9;
border-color: #f5212d;
color: #f5212d;
}
.current {
// background-color: rgba(0, 102, 255, 0.6);
// border-color: #0066ff;
// color: #ffffff;
}
}
// 主内容框
@@ -116,8 +116,14 @@
getData('first');
};
const updateData = (item) => {
console.log('收藏的updateData');
};
defineExpose({
getData,
updateData,
refreshData
});
</script>
@@ -144,9 +144,19 @@
console.log('子组件refreshData');
};
const updateData = (item) => {
console.log('收藏的updateData');
const index = data_list.findIndex((res) => res.taskId === item.taskId);
console.log('updateData', index, item);
if (index !== -1) {
data_list[index] = item;
}
};
defineExpose({
getData,
refreshData
refreshData,
updateData
});
</script>
+13 -2
View File
@@ -82,17 +82,28 @@
}
); // 这里的immediate会在onMounted之后执行
});
onLoad(async () => {
uni.$on('refresh_favorites_data', (params) => {
onLoad(() => {
// 里面取消收藏后重新刷新列表
uni.$on('refresh_favorites_list', (params) => {
if (params.type === 'course') {
courseRef.value?.refreshData(params);
} else if (params.type === 'task') {
taskRef.value?.refreshData(params);
}
});
// 完成任务后更新列表单条信息
uni.$on('refresh_favorites_data', (res) => {
console.log('列表监听里面学习完成后更新任务历程', res);
if (tabAct.value === 0) {
courseRef.value?.updateData(res);
} else if (tabAct.value === 1) {
taskRef.value?.updateData(res);
}
});
});
onUnload(() => {
uni.$off('refresh_favorites_data');
uni.$off('refresh_favorites_list');
});
</script>
+2 -6
View File
@@ -438,7 +438,7 @@
return;
}
const userInfo = getUserInfo();
console.log('首页userInfo', userInfo);
// console.log('首页userInfo', userInfo);
if (userInfo) {
mascotInfo.value = userInfo?.mascotInfo;
}
@@ -462,17 +462,13 @@
<style scoped lang="scss">
$bg-margin-left: 30rpx;
// :deep(.uni-scroll-view-content) {
// display: flex;
// }
// 设置骨架屏左侧图片框的大小,设置成和图片大小一致,否则横向滑动会串行(对不齐)
:deep(.uv-skeleton__wrapper__avatar) {
height: 146rpx !important;
width: 146rpx !important;
border-radius: 16rpx;
}
// 底线样式
.bottom_line {
margin: 0 auto;
+13 -17
View File
@@ -210,37 +210,33 @@
...learning_tasks_details
});
getData();
// 监听里面学习完成后更新任务历程
uni.$on('refresh_course_list', () => {
// 继续出去更新列表
const updateFun = () => {
console.log('详情监听里面学习完成后更新任务历程');
queryTraTaskInfoByTaskId({taskId:detailData.taskId}).then(({body}) => {
uni.$emit('refresh_tasks_list', body)
uni.$emit('refresh_favorites_data', body)
Object.assign(detailData, {
...body
});
})
getData();
});
// 监听考试完成事件
uni.$on('exam_completed', () => {
// 继续出去更新列表
console.log('详情监听里面学习完成后更新任务历程');
queryTraTaskInfoByTaskId({taskId:detailData.taskId}).then(({body}) => {
uni.$emit('refresh_tasks_list', body)
})
getData();
});
}
// 监听里面学习完成后更新任务历程,执行更新函数
uni.$on('refresh_course_list', () => updateFun())
// 监听考试完成事件,执行更新函数
uni.$on('exam_completed', () => updateFun())
});
onUnload(() => {
uni.$off('refresh_course_list');
uni.$off('exam_completed');
// 如果收藏变了,并且上一页是收藏页,更新收藏列表
if (detailData.collectionId !== collectId.value) {
const pages = getCurrentPages();
if (pages.length >= 2) {
const prevPage = pages[pages.length - 2];
if (prevPage.route === 'pages/favorites/index') {
// 更新
uni.$emit('refresh_favorites_data', {
uni.$emit('refresh_favorites_list', {
type: 'task',
state: !!detailData.collectionId, // 最终是收藏了还是取消了
old: collectId.value, // 进入时候的收藏id
-1
View File
@@ -90,7 +90,6 @@
if(typeof listItemRefs.value[tabAct.value]?.updateData === 'function') {
listItemRefs.value[tabAct.value]?.updateData(res);
}
});
});
onUnload(() => {
+2 -2
View File
@@ -171,7 +171,7 @@
.catch((res) => {
console.log(res);
common.hideLoading();
if (res.rtnCode === '0002') {
if (res.rtnCode === '1001') {
common.msg('账号或密码错误,如忘记密码,请去统一身份认证平台修改。');
} else if (res.rtnCode !== '0005') {
common.msg('登录出错,请稍后再试');
@@ -183,7 +183,7 @@
};
onLoad(() => {
// fromPagePath.value = e?.path || ''
});
onMounted(() => {
let loginAccountData = common.getValue('loginAccountData');