修改考试记录,考试得语音按钮等bug

This commit is contained in:
田岩
2025-09-15 20:14:24 +08:00
parent 548fa82bc9
commit 31a0f3c099
8 changed files with 192 additions and 154 deletions
+1
View File
@@ -4,6 +4,7 @@
"path": "pages/index/dialog",
"style": {
"navigationBarTitleText": "AI问答",
"disableSwipeBack": true,
"app-plus": {
"titleNView": false,
"animationType": "fade-in"
+28 -25
View File
@@ -169,6 +169,7 @@
const touchBtnRef = ref(null);
const countDownRef = ref(null);
let examinationStartTime = 0; // 考试开始时间
let examinationAnswerCacheKey;
const style_button_1 = {
color: '#FFFFFF',
fontSize: '30rpx',
@@ -189,7 +190,10 @@
papersId: '', // 试卷ID
limitTm: 0, // 考试限制时间
papersName: '', // 试卷名称
isCacheExam: '' // 是否是缓存试卷(继续答题试卷)
isCacheExam: '' ,// 是否是缓存试卷(继续答题试卷)
flagQuery: '' ,
flagQueryDetail: '' ,
}); // 试卷信息
const topicList = reactive([]); // 问题列表
const popup_input_bottom = ref('0px');
@@ -244,7 +248,15 @@
// 倒计时结束
const finish = (item) => {
hand_in_paper('倒计时结束自动交卷');
// 交卷成功,清除缓存
examinationAnswerCacheKey && common.setValue(examinationAnswerCacheKey, null);
// 考试完成事件
uni.$emit('exam_completed');
// 判断是否需要查分
const flagQueryDetail = paperData.flagQueryDetail === '' ? paperData.flagQuery : paperData.flagQueryDetail;
common.redirectTo(
`/pages/examination/result?execId=${paperData.execId}&flagQuery=${paperData.flagQuery}&flagQueryDetail=${flagQueryDetail}&papersName=${paperData.papersName}&papersId=${paperData.papersId}&mode=examination&crsId=${paperData.crsId}`
);
};
// 按上一题下一题
@@ -289,9 +301,10 @@
// 录音按钮提交
const touchBtnSubmit = (type, submitObj) => {
const topic = topicList[questionNumber.value];
touchBtnRef.value?.clearinputText(); // 清除发送框数据
if (type === 'voice') {
topic.value.es_status = '00'; // 00转圈
topic.es_status = '00'; // 00转圈
const voicePath = submitObj;
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {})
.then((res) => {
@@ -299,11 +312,11 @@
if (_res.rtnCode === '0000') {
const _content = _res.body.transContent.trim();
if (_content === '') {
topic.value.es_status = ''; // 取消转圈
topic.es_status = ''; // 取消转圈
return common.msg('未识别到文字');
} else {
topic.value.es_status = '02';
topic.value.my_answer = {
topic.es_status = '02';
topic.my_answer = {
anserResult: _res.body.transContent,
ossKey: _res.body.fileId,
ossAddr: _res.body.ossFileAddr,
@@ -314,37 +327,26 @@
}
})
.catch((err) => {
topic.value.es_status = ''; // 取消转圈
topic.es_status = ''; // 取消转圈
common.msg('系统异常,请联系管理员');
});
} else if (type === 'text') {
topic.value.es_status = '01';
topic.value.my_answer = {
topic.es_status = '01';
topic.my_answer = {
anserResult: submitObj // 正确答案文字内容
};
hand_in_paper_cache();
}
};
let examinationAnswerCacheKey;
const answerCacheList = ref({});
const setAnswerCacheList = (value) => {
console.log('触发变化', value);
answerCacheList.value = value;
common.setValue(examinationAnswerCacheKey, value);
};
// const answerCacheList = computed({
// get() {
// const cacheList = common.getValue(examinationAnswerCacheKey);
// if (cacheList) return cacheList;
// return {};
// },
// set(value) {
// console.log('触发变化', value);
// common.setValue(examinationAnswerCacheKey, value); // 补充键参数
// }
// });
// 添加试题答案缓存
const addTopicAnswerCache = () => {
const my_answer = topic.value.my_answer;
@@ -363,7 +365,6 @@
}
setAnswerCacheList(newCache);
// answerCacheList.value = newCache;
};
// 初始化时检查
@@ -382,6 +383,8 @@
paperData.limitTm = examination.limitTm;
paperData.papersName = examination.papersName;
paperData.isCacheExam = examination.isCacheExam || 'N';
paperData.flagQuery = examination.flagQuery || 'Y';
paperData.flagQueryDetail = examination.flagQueryDetail || 'Y';
mode = paperData.examId ? 'PAPERS' : 'CRS'; // 课程考试CRS,考试中心考试PAPERS
// 设置缓存的键的名称
const suffix = mode === 'PAPERS' ? paperData.examId : paperData.crsId;
@@ -648,9 +651,9 @@
// 考试完成事件
uni.$emit('exam_completed');
// 判断是否需要查分
const flagQueryDetail = res.body.flagQueryDetail === '' ? res.body.flagQuery : res.body.flagQueryDetail;
const flagQueryDetail = paperData.flagQueryDetail === '' ? paperData.flagQuery : paperData.flagQueryDetail;
common.redirectTo(
`/pages/examination/result?execId=${res.body.execId}&flagQuery=${res.body.flagQuery}&flagQueryDetail=${flagQueryDetail}&papersName=${paperData.papersName}&papersId=${paperData.papersId}&mode=examination&crsId=${paperData.crsId}`
`/pages/examination/result?execId=${res.body.execId}&flagQuery=${paperData.flagQuery}&flagQueryDetail=${flagQueryDetail}&papersName=${paperData.papersName}&papersId=${paperData.papersId}&mode=examination&crsId=${paperData.crsId}`
);
})
.catch((res) => {
@@ -10,7 +10,7 @@
</view>
<view class="prompt_div">
<view class="prompt_div_left">
<view class="top">{{ item.highestGrade || 0 }}</view>
<view class="top">{{ item.flagQuery === 'Y'?item.highestGrade:'--' || 0 }}</view>
<view class="bottom">历史最高分</view>
</view>
<view class="prompt_div_line"></view>
+1 -1
View File
@@ -650,7 +650,7 @@ onBackPress(options => {
}
}
}
return false
return true
})
const getQuestionList = () => {
+82 -93
View File
@@ -19,7 +19,9 @@
<view class="message_div" @click="common.navigateTo('/pages/messageNotification/index')">
<image src="@/static/images/index/message_b.png" class="message_img"></image>
<view class="message_text">消息</view>
<view class="message_num message_num_font" v-if="no_read_message_num>0">{{no_read_message_num}}</view>
<view class="message_num message_num_font" :class="messageNumberClass" v-if="no_read_message_num > 0">
{{ messageDisplayText }}
</view>
</view>
</view>
<!-- 文字logo -->
@@ -42,7 +44,9 @@
<view class="message_div" @click="common.navigateTo('/pages/messageNotification/index')">
<image src="@/static/images/index/message.png" class="message_img"></image>
<view class="message_text">消息</view>
<view class="message_num message_num_font" v-if="no_read_message_num>0">{{no_read_message_num}}</view>
<view class="message_num message_num_font" :class="messageNumberClass" v-if="no_read_message_num > 0">
{{ messageDisplayText }}
</view>
</view>
</view>
<!-- 滚动通知 -->
@@ -79,19 +83,7 @@
</view>
</view>
<view class="item">
<view class="top">累计训练次数</view>
<view class="bottom">
<uv-count-to
:startVal="statistics_data['startAccmExamCnt']"
:endVal="statistics_data['accmExamCnt']"
:useEasing="true"
ref="accmExamCntRef"
></uv-count-to>
<span class="number"></span>
</view>
</view>
<view class="item">
<view class="top">累计考试次数</view>
<view class="top">本年陪练次数</view>
<view class="bottom">
<uv-count-to
:startVal="statistics_data['starAccmPracticeCnt']"
@@ -99,6 +91,20 @@
:useEasing="true"
ref="accmPracticeCntRef"
></uv-count-to>
<span class="number"></span>
</view>
</view>
<view class="item">
<view class="top">本年考试次数</view>
<view class="bottom">
<uv-count-to
:startVal="statistics_data['startAccmExamCnt']"
:endVal="statistics_data['accmExamCnt']"
:useEasing="true"
ref="accmExamCntRef"
></uv-count-to>
<span class="number"></span>
</view>
</view>
@@ -285,6 +291,16 @@
const scrollTop = ref(0);
const no_read_message_num = ref(0);
// 处理显示的消息数量文本
const messageDisplayText = computed(() => {
return no_read_message_num.value > 99 ? '99+' : no_read_message_num.value;
});
// 处理消息数量的样式类
const messageNumberClass = computed(() => ({
message_num_big: no_read_message_num.value > 99,
message_num_small: no_read_message_num.value <= 99
}));
const mascotShow = ref(false);
const stdtTmLenRef = ref(null);
const accmPracticeCntRef = ref(null);
@@ -407,7 +423,7 @@
}
});
};
// 进入搜索页
const goto_search_page = () => {
common.navigateTo('/pages/search/search?from=index');
@@ -453,9 +469,10 @@
queryCrsInfoByRecmd().then((res) => {
recommend_class_list.value = res.body;
});
noticeMessageCount().then(res => {
no_read_message_num.value = res.body
})
noticeMessageCount().then((res) => {
no_read_message_num.value = res.body;
// no_read_message_num.value = 109;
});
});
onHide(() => {});
</script>
@@ -468,7 +485,7 @@
width: 146rpx !important;
border-radius: 16rpx;
}
// 底线样式
.bottom_line {
margin: 0 auto;
@@ -613,47 +630,11 @@
.message_div {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
margin-left: 33rpx;
.message_img {
width: 32rpx;
height: 36rpx;
}
.message_text {
margin-top: 4rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 22rpx;
color: #333333;
line-height: 24rpx;
white-space: nowrap;
}
.message_num {
position: absolute;
top: 2rpx;
right: -4rpx;
padding: 2rpx 3rpx 2rpx 3rpx;
background-color: #ff1926;
border-radius: 10rpx;
// width: 22rpx;
// height: 20rpx;
// font-size: 10rpx;
// font-size: 30rpx;
color: #ffffff;
}
.message_num_font {
width: 22rpx;
height: 22rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 16rpx;
}
}
}
@@ -672,46 +653,54 @@
position: absolute;
top: 4rpx;
right: -56rpx;
display: flex;
flex-direction: column;
align-items: center;
.message_img {
width: 32rpx;
height: 36rpx;
}
.message_text {
margin-top: 4rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 22rpx;
color: #ffffff;
line-height: 24rpx;
white-space: nowrap;
}
.message_num {
position: absolute;
top: 2rpx;
right: -4rpx;
padding: 2rpx 3rpx 2rpx 3rpx;
background-color: #ff1926;
border-radius: 20rpx;
// width: 22rpx;
// height: 20rpx;
// font-size: 10rpx;
color: #ffffff;
}
}
}
.message_num_font {
width: 22rpx;
height: 22rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 16rpx;
}
.message_div {
display: flex;
flex-direction: column;
align-items: center;
min-width: 60rpx;
.message_img {
width: 32rpx;
height: 36rpx;
}
.message_text {
margin-top: 4rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 22rpx;
line-height: 24rpx;
white-space: nowrap;
}
.message_num {
position: absolute;
top: 2rpx;
right: 16rpx;
padding: 1rpx 2rpx 1rpx 2rpx;
background-color: #ff1926;
border-radius: 10rpx;
color: #ffffff;
}
.message_num_big {
right: 0rpx;
}
.message_num_small {
right: 8rpx;
min-width: 24rpx;
}
.message_num_font {
height: 22rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 16rpx;
}
}
@@ -728,7 +717,7 @@
font-style: normal;
display: flex;
align-items: center;
:deep(.uv-notice-bar) {
padding: 9px 2px;
}
+63 -19
View File
@@ -2,6 +2,10 @@
<view class="main_div max_page">
<!-- <view v-html="ysxi_text"></view> -->
<view class="top_view"></view>
<view class="body-title">
<uv-icon class="arrow-icon" name="arrow-left" @click="backRouter()" />
隐私协议
</view>
<web-view
:src="ysxi_text"
:fullscreen="true"
@@ -27,30 +31,45 @@
const base_url = get_base_url();
this.ysxi_text = base_url + '/traapp/dfAgtInfo/queryValidDfAgtHtml';
},
onShow() {},
onReady() {
//#ifdef APP-PLUS
var currentWebview = this.$scope.$getAppWebview();
function checkAndSetStyle(topHeight) {
const wv = currentWebview.children()[0];
if (wv !== undefined) {
// 当wv存在时设置样式
wv.setStyle({
top: topHeight,
scalable:false
});
} else {
// 不存在则短暂延迟后再次检查
setTimeout(checkAndSetStyle(topHeight), 20); // 每20毫秒检查一次
}
const currentWebview = this.$scope.$getAppWebview();
function checkAndSetStyle(topHeight, retryCount = 0) {
// 设置最大重试次数,避免无限循环
const MAX_RETRY = 20;
if (retryCount >= MAX_RETRY) {
console.warn('超过最大重试次数,未能设置Webview样式');
return;
}
let webviewChild;
try {
webviewChild = currentWebview.children()[0];
} catch (error) {
console.error('获取Webview子元素失败:', error);
}
if (webviewChild && typeof webviewChild.setStyle === 'function') {
webviewChild.setStyle({
top: topHeight,
scalable: false
});
} else {
setTimeout(() => checkAndSetStyle(topHeight, retryCount + 1), retryCount * 40);
}
}
uni.getSystemInfo({
success: function (res) {
checkAndSetStyle(res.statusBarHeight);
}
success: (res) => {
// 计算顶部高度并设置
const topHeight = res.statusBarHeight + 45;
checkAndSetStyle(topHeight, 1);
},
fail: (error) => {
console.error('获取系统信息失败:', error);
}
});
// #endif
},
methods: {
@@ -72,4 +91,29 @@
width: 100%;
height: var(--status-bar-height);
}
.body-title {
height: 90rpx;
text-align: center;
font-size: 33rpx;
padding-top: 10rpx;
line-height: 46rpx;
box-sizing: border-box;
background-color: #fff;
font-weight: 500;
color: #000;
position: fixed;
top: var(--status-bar-height);
left: 0;
width: 100vw;
z-index: 10000;
// margin-bottom: 23rpx;
.arrow-icon {
position: absolute;
left: 21rpx;
top: 5rpx;
color: #000;
padding: 15rpx;
// background-color: red;
}
}
</style>
+8 -8
View File
@@ -299,10 +299,10 @@
// 录音组件提交
const touchBtnSubmit = (type, submitObj) => {
1;
const topic = topicList[questionNumber.value]
touchBtnRef.value?.clearinputText(); // 清除发送框数据
if (type === 'voice') {
topic.value.es_status = '00'; // 00转圈
topic.es_status = '00'; // 00转圈
const voicePath = submitObj;
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {})
.then((res) => {
@@ -310,11 +310,11 @@
if (_res.rtnCode === '0000') {
const _content = _res.body.transContent.trim();
if (_content === '') {
topic.value.es_status = ''; // 取消转圈
topic.es_status = ''; // 取消转圈
return common.msg('未识别到文字');
} else {
topic.value.es_status = '02';
topic.value.my_answer = {
topic.es_status = '02';
topic.my_answer = {
anserResult: _res.body.transContent,
ossKey: _res.body.fileId,
ossAddr: _res.body.ossFileAddr,
@@ -324,12 +324,12 @@
}
})
.catch((err) => {
topic.value.es_status = ''; // 取消转圈
topic.es_status = ''; // 取消转圈
common.msg('系统异常,请联系管理员');
});
} else if (type === 'text') {
topic.value.es_status = '01';
topic.value.my_answer = {
topic.es_status = '01';
topic.my_answer = {
anserResult: submitObj // 正确答案文字内容
};
}
+8 -7
View File
@@ -285,9 +285,10 @@
// 录音组件提交
const touchBtnSubmit = (type, submitObj) => {
const topic = topicList[questionNumber.value];
touchBtnRef.value?.clearinputText(); // 清除发送框数据
if (type === 'voice') {
topic.value.es_status = '00'; // 00转圈
topic.es_status = '00'; // 00转圈
const voicePath = submitObj;
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {})
.then((res) => {
@@ -295,11 +296,11 @@
if (_res.rtnCode === '0000') {
const _content = _res.body.transContent.trim();
if (_content === '') {
topic.value.es_status = ''; // 取消转圈
topic.es_status = ''; // 取消转圈
return common.msg('未识别到文字');
} else {
topic.value.es_status = '02';
topic.value.my_answer = {
topic.es_status = '02';
topic.my_answer = {
anserResult: _res.body.transContent,
ossKey: _res.body.fileId,
ossAddr: _res.body.ossFileAddr,
@@ -309,12 +310,12 @@
}
})
.catch((err) => {
topic.value.es_status = ''; // 取消转圈
topic.es_status = ''; // 取消转圈
common.msg('系统异常,请联系管理员');
});
} else if (type === 'text') {
topic.value.es_status = '01';
topic.value.my_answer = {
topic.es_status = '01';
topic.my_answer = {
anserResult: submitObj // 正确答案文字内容
};
}