修复练习答题,开发课程记录页,创建学习记录页

This commit is contained in:
田岩
2025-08-26 15:20:39 +08:00
parent 346f318515
commit 0d3c87d0eb
16 changed files with 721 additions and 219 deletions
+20
View File
@@ -27,6 +27,26 @@ export const queryPracticeHis = (data) => {
};
/**考试*/
export const queryCrsExamRecordPaging = (data) => {
return request({
url: base_url + '/traRecord/queryCrsExamRecordPaging',
method: 'post',
toastErrors: true,
data
});
};
// 考试每一项列表
export const queryCrsExamHisByExamId = (data) => {
return request({
url: base_url + '/traRecord/queryCrsExamHisByExamId',
method: 'post',
toastErrors: true,
data
});
};
/**考试中心考试*/
// 考试列表页
export const queryExamRecordPaging = (data) => {
return request({
+139 -112
View File
@@ -3,7 +3,7 @@
<view :class="['talking-gif', 'is-play']">
<CommonLoading color="#fff" v-show="voiceLoading" />
</view>
<view class="right-time">{{voiceTime}}</view>
<view class="right-time">{{ voiceTime }}</view>
<view class="talking-cont">
<text :class="['talking-text translate-text loading']" v-show="!translateLoading">
{{ showContent }}
@@ -14,13 +14,25 @@
</view>
<view class="btns-cont">
<view class="play-btn">
<!-- <image class="icon" v-show="!(props.activeVoiceId === dataInfo.id)" @click="playVoice"
src="@/static/images/course/play-blue.png" style="width: 100%;height: 100%;"></image> -->
<image class="icon"
@click.stop="pauseVoice" src="@/static/images/course/stop-blue.png"
style="width: 100%;height: 100%;"></image>
<!-- <view class="icon text-btn" v-if="type === 1" @click.stop="translateVoice(dataInfo)"></view> -->
<image
class="icon"
@click="playVoice"
src="@/static/images/course/play-blue.png"
style="width: 100%; height: 100%"
></image>
<!-- <image
class="icon"
@click.stop="pauseVoice"
src="@/static/images/course/stop-blue.png"
style="width: 100%; height: 100%"
></image> -->
</view>
<view class="text-btn" @click.stop="translateVoice()"></view>
<view class="fl1"></view>
<view class="btns-cont-button-text" @click.stop="buutton_click('again')">重答</view>
<view class="btns-cont-button-text" @click.stop="buutton_click('complete')">完成</view>
<!-- <view class="icon text-btn" v-if="type === 1" @click.stop="translateVoice(dataInfo)"></view> -->
</view>
</view>
<!-- 01纯文字 -->
@@ -31,14 +43,23 @@
</text>
</view>
<view class="btns-cont">
<view class="play-btn">
<!-- <image class="icon" v-show="!(props.activeVoiceId === dataInfo.id)" @click="playVoice"
src="@/static/images/course/play-blue.png" style="width: 100%;height: 100%;"></image> -->
<image class="icon"
@click.stop="pauseVoice" src="@/static/images/course/stop-blue.png"
style="width: 100%;height: 100%;"></image>
<view class="icon text-btn" @click.stop="buutton_click(dataInfo)">重答</view>
</view>
<!-- <view class="play-btn">
<image
class="icon"
@click="playVoice"
src="@/static/images/course/play-blue.png"
style="width: 100%; height: 100%"
></image>
<image
class="icon"
@click.stop="pauseVoice"
src="@/static/images/course/stop-blue.png"
style="width: 100%; height: 100%"
></image>
</view> -->
<view class="fl1"></view>
<view class="btns-cont-button-text" @click.stop="buutton_click('again')">重答</view>
<view class="btns-cont-button-text" @click.stop="buutton_click('complete')">完成</view>
</view>
</view>
<view class="talking-info talking-info-loading" v-else-if="intrctWay === '00'">
@@ -49,143 +70,142 @@
</template>
<script setup>
import {
computed,
unref,
ref,
toRefs,
watch,
onMounted
} from "vue"
import {
onUnload
} from '@dcloudio/uni-app';
import { computed, unref, ref, toRefs, watch, onMounted } from 'vue';
import { onUnload } from '@dcloudio/uni-app';
const props = defineProps({
dataInfo: {
default: () => ({
talkingText:'',
talkingVoice:'',
talkingText: '',
talkingVoice: ''
}),
type: Object
},
text: { // 当前激活的语音
text: {
// 当前激活的语音
default: '',
type: String
},
voice: { // 当前激活的语音
voice: {
// 当前激活的语音
default: '',
type: String
},
activeVoiceId: { // 当前激活的语音
activeVoiceId: {
// 当前激活的语音
default: '',
type: String
},
intrctWay: {
default: '',
type: String
},
})
const {
dataInfo
} = toRefs(props)
}
});
const { dataInfo } = toRefs(props);
const intrctWay = computed(() => {
console.log('props.intrctWay', props.intrctWay);
return props.intrctWay
})
const emit = defineEmits(['changePlay'])
watch(() => props.dataInfo, () => {}, {
deep: true,
immediate: true
})
return props.intrctWay;
});
const emit = defineEmits(['changePlay', 'buutton_click']);
watch(
() => props.dataInfo,
() => {},
{
deep: true,
immediate: true
}
);
// 声音播放初始化
const talkVoiceObj = ref(null)
const talkVoiceObj = ref(null);
const isPlaying = ref(false)
const voiceLoading = ref(false)
const translateLoading = ref(false)
const isPlaying = ref(false);
const voiceLoading = ref(false);
const translateLoading = ref(false);
const voiceTime = ref('');
const itemVoice = ref('');
const voiceTime = ref('')
const itemVoice = ref('')
// 中间显示的文字
const showContent = computed(() => {
return props.text || ''
})
return props.text || props.dataInfo.anserResult || '';
});
onMounted(() => {
initVoice()
})
initVoice();
});
onUnload(() => {
pauseVoice()
})
watch(() => props.dataInfo.talkingVoice, (val) => {
if (val) {
initVoice()
pauseVoice();
});
watch(
() => props.dataInfo.talkingVoice,
(val) => {
if (val) {
initVoice();
}
},
{
deep: true,
immediate: true
}
}, {
deep: true,
immediate: true
})
);
// 按钮点击
const buutton_click = (type) => {
}
emit('buutton_click', type, props.dataInfo);
};
const pauseVoice = () => {
if (!talkVoiceObj.value) return
talkVoiceObj.value.pause()
isPlaying.value = false
emit('changePlay', '')
}
if (!talkVoiceObj.value) return;
talkVoiceObj.value.pause();
isPlaying.value = false;
emit('changePlay', '');
};
const playVoice = () => {
emit('changePlay', unref(dataInfo)?.id)
emit('changePlay', unref(dataInfo)?.id);
if (talkVoiceObj.value && talkVoiceObj.value.src) {
talkVoiceObj.value.play()
return
talkVoiceObj.value.play();
return;
} else {
talkVoiceObj.value.src = ''
talkVoiceObj.value.src = '';
if (unref(dataInfo).talkingVoice) {
setTimeout(() => {
talkVoiceObj.value.src = unref(dataInfo).talkingVoice
talkVoiceObj.value.play()
isPlaying.value = true
}, 100)
talkVoiceObj.value.src = unref(dataInfo).talkingVoice;
talkVoiceObj.value.play();
isPlaying.value = true;
}, 100);
}
}
}
};
const initVoice = () => {
talkVoiceObj.value = uni.createInnerAudioContext()
talkVoiceObj.value = uni.createInnerAudioContext();
talkVoiceObj.value.onEnded(() => {
emit('changePlay', '')
talkVoiceObj.value.src = ''
})
emit('changePlay', '');
talkVoiceObj.value.src = '';
});
talkVoiceObj.value.onError(() => {
talkVoiceObj.value.src = ''
})
talkVoiceObj.value.src = '';
});
if (unref(dataInfo).intrctWay === '02') {
itemVoice.value = unref(dataInfo).talkingVoice
talkVoiceObj.value.src = itemVoice.value
itemVoice.value = unref(dataInfo).talkingVoice;
talkVoiceObj.value.src = itemVoice.value;
setTimeout(() => {
setVoiceTime(0)
}, 100)
setVoiceTime(0);
}, 100);
}
}
};
const setVoiceTime = (sum) => {
sum += 1
sum += 1;
if (Math.ceil(talkVoiceObj.value.duration) > 0) {
voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 1) + 's'
voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 1) + 's';
} else {
if (sum === 20) {
voiceTime.value = 0 + 's'
return
voiceTime.value = 0 + 's';
return;
}
setTimeout(() => {
setVoiceTime(sum)
}, 200)
setVoiceTime(sum);
}, 200);
}
}
};
</script>
<style scoped lang="scss">
@@ -228,12 +248,11 @@
&.talking-info-text {
padding-bottom: 20rpx;
width: auto;
min-width: calc(100vw * 0.45);
float: right;
.talking-cont {
margin-top: 0rpx;
}
}
.talking-cont {
@@ -256,8 +275,11 @@
.btns-cont {
overflow: hidden;
border-top: 3rpx solid #eee;
border-top: 3rpx solid #1f79ff;
display: flex;
justify-content: space-between;
padding-top: 20rpx;
margin-top: 22rpx;
.replay-btn {
float: left;
width: 46rpx;
@@ -268,16 +290,12 @@
}
.play-btn {
float: left;
width: 46rpx;
height: 46rpx;
overflow: hidden;
margin-right: 16rpx;
margin-top: 25rpx;
}
.text-btn {
float: left;
width: 46rpx;
height: 46rpx;
overflow: hidden;
@@ -285,8 +303,7 @@
text-align: center;
color: #fff;
margin-right: 16rpx;
margin-top: 25rpx;
background-color: #67A4ff;
background-color: #67a4ff;
font-size: 24rpx;
font-weight: bold;
border-radius: 20rpx;
@@ -324,6 +341,16 @@
margin-top: -12rpx;
}
}
.btns-cont-button-text {
font-weight: 400;
font-size: 30rpx;
color: #ffffff;
line-height: 30rpx;
text-align: left;
font-style: normal;
margin-left: 10rpx;
}
}
}
</style>
</style>
+21 -14
View File
@@ -28,9 +28,9 @@
<template v-if="qnsTyp === 'ES'">
<questionVue
:intrctWay="subject_data.es_status"
:dataInfo="{}"
:text="subject_data.anserResult"
:dataInfo="item_answer"
:activeVoiceId="subject_data.qnsId"
@buutton_click="questionBuuttonClick"
></questionVue>
</template>
<template v-else>
@@ -119,8 +119,10 @@
// result.anserResult
let answerText = props.item?.my_answer || props.item.anserResult || [];
console.log('answerText', props.item.anserResult);
const item_answer = ref(typeof answerText === 'string' ? answerText.split(',') : []);
// item_answer 是答题结果,可以是对象 数组 字符串类型
const item_answer = ref(typeof answerText === 'string' ? answerText.split(',') : answerText);
const feedback_click = () => {
emit('subject_click', 'feedback', props.item);
};
@@ -163,17 +165,22 @@
},
set: (val) => {}
});
// const subject_data = reactive({
// qnsId: props.item.qnsId,
// qnsContent: props.item.qnsContent,
// qnsTyp: props.item.qnsTyp,
// analyContent: props.item.analyContent,
// itemVos: (props.item.itemVos ?? []).map((res) => ({
// ...res,
// correctFlag: props.clearResult ? '' : res.correctFlag
// }))
// });
// 按钮
const questionBuuttonClick = (type, submitObj) => {
console.log('type', type, submitObj);
// 判断点击的是什么
if(type === 'complete') { // 完成
}else if(type === 'again') { // 重答
}
emit('subject_click', type, {
qnsTyp: props.item.qnsTyp,
qnsId: props.item.qnsId,
answer: item_answer.value,
answerItems: []
});
};
// 题类型
const subject_type_text = computed(() => SUBJECT_TYPE.find((res) => qnsTyp.value === res.value)?.label || '');
+41 -22
View File
@@ -1,17 +1,20 @@
<template>
<view class="talk-btns">
<uv-button
class="touch-btn"
@touchstart="startRecord"
@touchend="stopRecord"
@touchmove="handleMove"
v-if="!keyboardIsShow"
:customStyle="{ height: '92rpx' }"
>
按住说话
</uv-button>
<view class="touch-btn" v-if="keyboardIsShow">
<view class="touch-btn" @click="disabled_click">
<uv-button
class="touch-btn"
@touchstart="startRecord"
@touchend="stopRecord"
@touchmove="handleMove"
v-if="!keyboardIsShow"
:customStyle="{ height: '92rpx' }"
>
按住说话
</uv-button>
<uv-input
v-if="keyboardIsShow"
class="input-box"
ref="inputRef"
v-model="inputText"
@@ -19,8 +22,10 @@
:adjustPosition="false"
placeholderStyle="color:#999999;font-size:26rpx"
placeholder="请输入文字"
:disabled="props.isDisabled"
></uv-input>
</view>
<view class="talk-btn-box">
<image
class="talk-btn-icon"
@@ -78,7 +83,7 @@
const emit = defineEmits(['submit']);
const props = defineProps({
isDisabled: {
default: true,
default: false,
type: Boolean
},
isLoading: {
@@ -89,6 +94,11 @@
default: '发送回答中,请稍后再试!',
type: String
},
disabledText: {
default: '请稍后再试!',
type: String
},
canAnswer: {
default: true,
type: Boolean
@@ -107,23 +117,21 @@
default: 1000
}
});
const { isDisabled } = toRefs(props);
// 键盘还是语音
const keyboardIsShow = ref(false);
const popupRef = ref(null);
const inputText = ref('');
let startTime = 0;
// not_started 未开始, preparing 准备中, in_recording 录音中,ending 结束中
const recordingStatus = ref('not_started');
// 获取全局唯一的录音管理器 recorderManager
// #ifdef APP-PLUS
const recorderManager = uni.getRecorderManager();
// #endif
// const innerAudioContext = uni.createInnerAudioContext();
const startTimer = ref(null); // 延迟启动的定时器ID
const startFlag = ref(1);
@@ -155,9 +163,9 @@
recorderManager.stop();
});
}, times);
nextTick(() => recordingStatus.value = 'not_started');
nextTick(() => (recordingStatus.value = 'not_started'));
};
onMounted(async () => {
// #ifdef APP-PLUS
recorderManager.onStop(function (res) {
@@ -168,8 +176,8 @@
const recordDuration = endTime - startTime;
console.log('说话时长', recordDuration);
if (props.minRecordDuration > recordDuration) {
nextTick(()=>common.msg('说话时间太短,没有听清!'))
return ;
nextTick(() => common.msg('说话时间太短,没有听清!'));
return;
}
console.log('录音结束,时长:', recordDuration, '秒');
emit('submit', 'voice', res.tempFilePath);
@@ -185,7 +193,7 @@
});
// #endif
});
const touchY = ref(0);
const windowInfo = uni.getWindowInfo();
// 安全区域信息
@@ -199,6 +207,12 @@
const handleMove = (obj) => {
touchY.value = obj.changedTouches[0].pageY;
};
const clearinputText = (text = '') => {
const old_text = inputText.value;
inputText.value = text;
return old_text;
};
defineExpose({ clearinputText });
// 发送文本
const showKeyboard = () => {
if (keyboardIsShow.value) {
@@ -218,6 +232,11 @@
keyboardIsShow.value = !keyboardIsShow.value;
inputText.value = '';
};
// 禁用时点击给的提示
const disabled_click = () => {
console.log('禁用时点击给的提示');
if (props.isDisabled) common.msg(props.disabledText);
};
</script>
<style lang="scss" scoped>
@@ -16,7 +16,6 @@
ref,
onMounted,
computed,
defineProps,
watch
} from 'vue'
import {
+9
View File
@@ -262,6 +262,15 @@
}
}
},
{
"path": "pages/courseRecord/courseStudyRecordDetail",
"style": {
"navigationBarTitleText": "课程记录学习记录详情",
"app-plus": {
"titleNView": false
}
}
},
{
"path": "pages/course/index",
"style": {
@@ -1,8 +1,85 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list" ></itemVue>
<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>
<script setup>
import itemVue from './item.vue';
<script>
import { setPageCache } from '@/common/common';
import common from '@/common/common';
import { ref, reactive, onMounted, nextTick } from 'vue';
import { queryPracticeRecordPaging, queryPracticeHis, queryCrsExamRecordPaging } from '@/api/courseRecord.js';
import { studyDurationIcon, studyTimeIcon } from '@/common/imgSvg';
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
const props = defineProps({});
const getData = (from = '', searchText = '') => {
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(() => {
queryCrsExamRecordPaging({
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 getStatusClass = (isFinish) => {
// 00进行中、01已完成、02已超时
if (isFinish === '00') return 'in_progress';
if (isFinish === '01') return 'completed';
return 'expired';
};
const scrolltolower = (item) => {
getData();
};
const search = (value) => {
total.value = -1;
getData('first', value);
};
defineExpose({
getData,
search
});
</script>
<style>
</style>
<style scoped lang="scss">
.scroll_div {
background-color: #f1f5fa;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
}
</style>
+290
View File
@@ -0,0 +1,290 @@
<template>
<view class="item" @click="click_item(item)">
<view class="details_div">
<view class="img_div" v-if="props.mode === 'testingHall'">
<image-preview class="img" :src="item.ossAddr" mode="scaleToFill"></image-preview>
</view>
<view class="right_div">
<view class="title ellipsis-text">
{{ item.examName }}
</view>
<view class="prompt_div">
<view class="prompt_div_left">
<view class="top">{{ item.highestGrade || 0 }}</view>
<view class="bottom">历史最高分</view>
</view>
<view class="prompt_div_line"></view>
<view class="prompt_div_right" @click="show_list_click">
<view class="click_text">
{{ item.examCnt || 0 }}
<uv-icon
class="click_text_icon"
:name="show_list_state ? 'arrow-down' : 'arrow-right'"
color="#0066FF"
size="12"
:bold="true"
></uv-icon>
</view>
<view class="bottom">考试次数</view>
</view>
</view>
</view>
</view>
<view class="list_div" :class="{ loaded: isLoaded }" :style="{ height: list_div_height }">
<view class="list_item" v-for="item_list in data_list">
<view class="list_content">
<view class="list_small_item">
<image src="@/static/images/courseRecord/time.png" class="icon_img"></image>
<view class="prompt">考试时间{{ item_list.examStartTm }}</view>
</view>
<view class="list_small_item">
<image src="@/static/images/courseRecord/duration.png" class="icon_img"></image>
<view class="prompt">考试得分{{ item_list.examGrade }}</view>
</view>
</view>
<view class="fl1"></view>
<uv-icon name="arrow-right" color="#979797" size="17" :bold="true"></uv-icon>
</view>
<uv-load-more
v-if="status === 'loading'"
:status="status"
loadmore-text="轻轻上拉加载"
:height="30"
></uv-load-more>
</view>
</view>
</template>
<script setup>
import { computed, ref, reactive, nextTick } from 'vue';
import { setPageCache } from '@/common/common';
import common from '@/common/common';
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const props = defineProps({
item: {
type: Object,
default: () => {}
},
mode: {
type: String,
default: 'testingHall',
validator: (value) => {
// 考试: examination
// 练习: practice
// 错题本: mistake
// 学习: study
// 考试结算页 settlement
// 考试中心 testingHall
return ['examination', 'practice', 'mistake', 'study', 'settlement', 'testingHall'].includes(value);
}
}
});
import { queryCrsExamHisByExamId } from '@/api/courseRecord.js';
const item = computed(() => props.item);
const data_list = reactive([]);
const isLoaded = ref(false);
const total = ref(-1);
const show_list_state = ref(false);
const list_div_height = computed(() => {
if (!show_list_state.value) {
return '0';
} else if (status.value === 'loading') {
return '100rpx';
} else {
return data_list.length * 136 + 'rpx';
}
});
// 点击获取考试详情
const show_list_click = () => {
show_list_state.value = !show_list_state.value;
if (total.value === -1) {
//加载数据
status.value = 'loading';
data_list.length = 0;
queryCrsExamHisByExamId({ examId: item.value.examId }).then((res) => {
console.log('queryCrsExamHisByExamId', res);
data_list.push(...res.body);
total.value = data_list.length;
status.value = 'loadmore';
// // 数据更新后触发动画
// // 使用$nextTick确保DOM已更新
nextTick(() => {
// isLoaded.value = true;
});
});
}
};
// 跳转到详情
const click_item = () => {};
</script>
<style scoped lang="scss">
.icon_img {
width: 24rpx;
height: 24rpx;
}
.list_div {
overflow: hidden; /* 确保内容不会溢出容器 */
transition: height 0.2s ease-out; /* 高度动画 */
.list_item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 18rpx 32rpx 18rpx 28rpx;
background-color: #f9fbff;
border-radius: 8rpx;
margin: 20rpx 0 0 0;
.list_content {
.list_small_item {
display: flex;
align-items: center;
font-weight: 400;
font-size: 24rpx;
color: #666666;
line-height: 40rpx;
text-align: left;
font-style: normal;
.prompt {
margin-left: 16rpx;
}
}
}
}
}
.item {
margin: 17rpx 20rpx;
background-color: #fff;
border-radius: 16rpx;
padding: 32rpx 22rpx;
.details_div {
display: flex;
.img_div {
position: relative;
width: 226rpx;
height: 168rpx;
overflow: hidden;
border-radius: 22rpx;
.img {
width: 226rpx;
height: 168rpx;
}
.subscript {
position: absolute;
right: 0;
top: 0;
width: 92rpx;
height: 46rpx;
border-radius: 0px 0px 0px 22rpx;
font-family: PingFangSC;
font-weight: 400;
font-size: 22rpx;
line-height: 32px;
display: flex;
align-items: center;
justify-content: center;
}
}
.right_div {
flex: 1;
overflow: hidden;
margin-left: 24rpx;
display: flex;
flex-direction: column;
.title {
font-family: PingFangSC;
color: #333333;
text-align: left;
font-style: normal;
font-weight: 600;
font-size: 28rpx; /* 字体大小30rpx */
overflow: hidden; /* 超出部分隐藏 */
margin-bottom: 8rpx;
min-height: 40rpx;
}
.prompt_div {
font-family: PingFangSC;
font-weight: 400;
font-size: 22rpx;
color: #666;
line-height: 34rpx;
display: flex;
align-items: center;
overflow: hidden;
height: 116rpx;
background-color: #f9fbff;
border-radius: 8rpx;
justify-content: space-around;
.prompt_div_line {
width: 4rpx;
height: 30rpx;
background: linear-gradient(
to bottom,
RGBA(242, 244, 248, 1) 0%,
RGBA(230, 232, 238, 1) 30%,
/* 中间开始 */ RGBA(230, 232, 238, 1) 70%,
/* 中间结束 */ RGBA(242, 244, 248, 1) 100%
);
}
.prompt_div_left,
.prompt_div_right {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
.top,
.click_text {
font-family: Arial;
font-weight: 700;
font-size: 30rpx;
color: #333333;
line-height: 34rpx;
text-align: center;
font-style: normal;
}
.bottom {
}
.click_text {
position: relative;
.click_text_icon {
position: absolute;
margin-left: 18rpx;
top: calc(50% - 12rpx);
right: -220%;
}
}
}
}
.people_progress_div {
display: flex;
font-family: PingFangSC;
font-weight: 400;
font-size: 23rpx;
color: #666;
margin-bottom: 23rpx;
line-height: 23rpx;
flex-wrap: nowrap;
height: 23rpx;
overflow: hidden;
}
}
}
}
</style>
@@ -17,7 +17,7 @@
}}阿斯顿萨达萨达阿斯顿萨达萨达萨达萨达萨达萨达
</view>
<view class="prompt_div">
<image :src="studyDurationIcon()" class="img"></image>
<image src="@/static/images/courseRecord/time.png" class="img"></image>
<view class="prompt">答题正确率30</view>
</view>
<view class="prompt_div">
@@ -40,11 +40,11 @@
import { setPageCache } from '@/common/common';
import common from '@/common/common';
import { ref, reactive, onMounted, nextTick } from 'vue';
import { queryPracticeRecordPaging, queryPracticeHis } from '@/api/courseRecord.js';
import { queryPracticeRecordPaging, queryPracticeHis, queryCrsExamRecordPaging } from '@/api/courseRecord.js';
import { studyDurationIcon, studyTimeIcon } from '@/common/imgSvg';
const props = defineProps({});
const getData = (from = '', searchText = '') => {
if (from == 'first') {
if (total.value !== -1) {
@@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>
+2 -3
View File
@@ -49,7 +49,7 @@
import common from '@/common/common.js';
const listItemRefs = ref([]);
const taskRef = ref(null);
const tabAct = ref(1);
const tabAct = ref(2);
const tabList = ref([
{
name: '学习记录'
@@ -103,12 +103,11 @@
/*
状态栏 var(--status-bar-height)
标题高度88rpx
搜索栏高度80rpx
tab切换栏高度88rpx
下方滑动区域上下边距各10共20rpx
**/
height: calc(100vh - var(--status-bar-height) - 88rpx - 80rpx - 88rpx - 20rpx);
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
}
.swiper-item {
+98 -60
View File
@@ -61,11 +61,13 @@
<view class="fixed-box font_pf" :style="{ marginBottom: popup_input_bottom }">
<view class="touch-btn-div" :class="{ show: showTouchBtn }">
<TouchBtn
ref="touchBtnRef"
class="talk-btns"
@submit="touchBtnSubmit"
loadingText="问题回答中,请在问题回答结束后重试!"
disabledText="只能进行一条回答"
:isLoading="!answerIsOver"
:isDisabled="topicList[questionNumber]?.isPreview"
:isDisabled="touchIsDisabled"
/>
</view>
</view>
@@ -92,7 +94,7 @@
const answerIsOver = ref(true);
const feedbackRef = ref(null);
const dialogRef = ref(null);
const popupRef = ref(null);
const touchBtnRef = ref(null);
const mode = ref('practice'); // 考试 examination 练习practice
const paperData = reactive({
@@ -105,11 +107,22 @@
const popup_input_bottom = ref('0px');
const questionNumber = ref(0); // 题号
const systemInfo = uni.getSystemInfoSync();
const topic = computed({
get: () => topicList[questionNumber.value],
set: (val) => topicList[questionNumber.value] = val
});
const showTouchBtn = computed(() => {
return topicList[questionNumber.value]['qnsTyp'] === 'ES';
return topic.value?.qnsTyp === 'ES';
});
const progress = computed(() => {
// 下面语音组件的禁用状态判断
const touchIsDisabled = computed(() => {
return topic.value?.es_status !== '' && topic.value?.es_status !== undefined
})
const progress = computed(() => {
// 计算进度百分比(保留两位小数)
const total = storageTopicList.value.length;
if (total === 0) return 0;
@@ -141,33 +154,39 @@
if (['JD', 'SN'].includes(params.qnsTyp)) {
submitProblem({ anserResult: params.answer.join(',') });
}
} else if (type === 'complete') {
// 问答题点击完成
} else if (type === 'again') {
// 问答题点击重答
// const topic = topicList[questionNumber.value];
topic.value.isPreview = false;
topic.value.es_status = ''; // 取消转圈
}
};
// 单题回答(没有问答题)
const submitProblem = (answer) => {
const topic = topicList[questionNumber.value];
console.log('答题内容', answer);
console.log('答单题', topic);
common.loading('答题中');
practiceAnswer({
exrId: paperData.exrId,
ossKey: '',
qnsId: topic.qnsId,
qnsId: topic.value.qnsId,
...answer
})
.then((res) => {
common.hideLoading();
const body = res.body;
console.log('body', body);
topic.isPreview = true; // 不能在点击了,打开预览模式
topic.clearResult = false; // 不清除正确答案了
topic.value.isPreview = true; // 不能在点击了,打开预览模式
topic.value.clearResult = false; // 不清除正确答案了
const traQnsInfoVo = body.traQnsInfoVo;
topic.analyContent = traQnsInfoVo.analyContent; // 答案解析
topic.value.analyContent = traQnsInfoVo.analyContent; // 答案解析
console.log('答题结果', traQnsInfoVo);
// 更新选项正确项目
topic.itemVos = traQnsInfoVo.itemVos; // 答案选项(todo应该不这样替换)
topic.anserResult = traQnsInfoVo.anserResult; // 正确答案字符串分割
topic.value.itemVos = traQnsInfoVo.itemVos; // 答案选项(todo应该不这样替换)
topic.value.anserResult = traQnsInfoVo.anserResult; // 正确答案字符串分割
const judgeResultStatus = traQnsInfoVo.judgeResult === 'P'; // P为正确U为错误
if (!addProblem()) {
// 返回false说明到了最后一题
@@ -179,13 +198,16 @@
// ['JD', 'SN', 'MU'].includes(topic.qnsTyp) && // 条件2.单选多选判断(这里改成了单选多选判断专属,所有不用判断这一条了)
topicList.length < storageTopicList.value.length // 条件3.不是最后一题(暂定这样判断)
) {
questionNumber.value++;
} else {
console.log('为什么没自动跳转', judgeResultStatus);
console.log('22', topicList.length < storageTopicList.value.length, topicList.length , storageTopicList.value.length);
console.log(
'22',
topicList.length < storageTopicList.value.length,
topicList.length,
storageTopicList.value.length
);
}
})
.catch(() => {
common.hideLoading();
@@ -197,10 +219,10 @@
if (maxRetries <= 0) {
return Promise.reject(new Error('超过最大重试次数,查询失败'));
}
return queryCrsPracticeAnswerResult({ execLogId }).then((resl) => {
const isWait = resl.body.isWait;
if (isWait === 'Y') {
if (isWait === 'N') {
// 如果是Y,延迟2秒后重试,重试次数减1
return new Promise((resolve) => {
setTimeout(() => {
@@ -217,7 +239,9 @@
// 单题回答(问答题专属)
const submitProblemEssayQuestion = (answer) => {
const topic = topicList[questionNumber.value];
const old_text = touchBtnRef.value?.clearinputText(); // 清除发送框数据
console.log('答题内容', answer);
console.log('答单题问答题专属', topic);
practiceAnswer({
exrId: paperData.exrId,
@@ -227,6 +251,8 @@
})
.then((res) => {
topic.isPreview = true; // 不能在点击了,打开预览模式
// touchBtnRef.value.clearinputText()
// topic.clearResult = false; // 不清除正确答案了
// 使用方式
queryWithRetry(res.body.execLogId)
@@ -234,31 +260,31 @@
console.log('查询成功', result);
const body = result.body;
const traQnsInfoVo = body.traQnsInfoVo;
topic.analyContent = traQnsInfoVo.analyContent; // 答案解析
topic.anserResult = traQnsInfoVo.anserResult // 正确答案文字内容
const judgeResultStatus = traQnsInfoVo.judgeResult === 'P'; // P为正确U为错误
topic.analyContent = traQnsInfoVo?.analyContent || ''; // 答案解析
topic.anserResult = traQnsInfoVo?.anserResult || answer.anserResult; // 正确答案文字内容
const judgeResultStatus = traQnsInfoVo?.judgeResult === 'P'; // P为正确U为错误
// 判断是语音回答还是文字回答, 通过是否存在语音地址判断 // todo 后续可能改成ossid判断
if (answer.voicePath) {
topic.es_status = '02'
} else { // 纯文字
topic.es_status = '01'
topic.es_status = '02';
} else {
// 纯文字
topic.es_status = '01';
}
// 处理成功结果
})
.catch((error) => {
console.log('查询失败', error);
topic.isPreview = false
topic.es_status = ''
topic.isPreview = false;
topic.es_status = ''; // 取消转圈
touchBtnRef.value?.clearinputText(old_text); // 清除发送框数据
// 处理失败情况
});
// const traQnsInfoVo = body.traQnsInfoVo;
// topic.analyContent = traQnsInfoVo.analyContent; // 答案解析
// console.log('答题结果', traQnsInfoVo);
// const judgeResultStatus = traQnsInfoVo.judgeResult === 'P'; // P为正确U为错误
// if (!addProblem()) {
@@ -268,44 +294,55 @@
})
.catch(() => {
topic.es_status = ''; // 取消转圈
});
};
// 录音按钮提交
// 录音组件提交
const touchBtnSubmit = (type, submitObj) => {
const topic = topicList[questionNumber.value];
topic.es_status = '00'; // 00转圈
const old_text = touchBtnRef.value?.clearinputText(); // 清除发送框数据
if (type === 'voice') {
uploadRecordNow(submitObj);
topic.value.es_status = '00'; // 00转圈
const voicePath = submitObj;
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {})
.then((res) => {
let _res = JSON.parse(res.data);
console.log('res小行星', _res);
if (_res.rtnCode === '0000') {
topic.value.es_status = '02'
topic.value.my_answer = {
anserResult: _res.body.transContent,
ossKey: _res.body.fileId,
ossAddr: _res.body.ossFileAddr,
voicePath: voicePath
}
// {
// "chatId":"CHAT025018122068202508232000590000000000000000000000000000000060",
// "fileId":"S3F0250181220722025082320005900000676612",
// "ossFileAddr":"http://25.18.122.66::9786/traoss/show//S3F0250181220722025082320005900000676612",
// "transContent":"一二三四。"
// }
// submitProblemEssayQuestion({
// anserResult: _res.body.transContent,
// ossKey: _res.body.fileId,
// ossAddr: _res.body.ossFileAddr,
// voicePath: voicePath
// });
}
})
.catch((err) => {
topic.value.es_status = ''; // 取消转圈
// 失败了再把发送框数据还原回去
touchBtnRef.value?.clearinputText(old_text); // 清除发送框数据
common.msg('系统异常,请联系管理员');
});
} else if (type === 'text') {
submitProblemEssayQuestion({ anserResult: submitObj });
topic.value.es_status = '01';
topic.value.anserResult = submitObj; // 正确答案文字内容
// submitProblemEssayQuestion({ anserResult: submitObj });
}
};
// 发送语音
const uploadRecordNow = (voicePath) => {
//发送语音的时候就应该拿出转圈
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {})
.then((res) => {
let _res = JSON.parse(res.data);
if (_res.rtnCode === '0000') {
// {
// "chatId":"CHAT025018122068202508232000590000000000000000000000000000000060",
// "fileId":"S3F0250181220722025082320005900000676612",
// "ossFileAddr":"http://25.18.122.66::9786/traoss/show//S3F0250181220722025082320005900000676612",
// "transContent":"一二三四。"
// }
submitProblemEssayQuestion({
anserResult: _res.body.transContent,
ossKey: _res.body.fileId,
ossAddr: _res.body.ossFileAddr,
voicePath: voicePath
});
}
})
.catch((err) => {
topic.es_status = ''; // 取消转圈
common.msg('系统异常,请联系管理员');
});
};
// 发送文本
const submitAnswerNow = (val, cb = null) => {};
@@ -314,6 +351,7 @@
const addProblem = () => {
if (topicList.length >= storageTopicList.value.length) return false;
topicList.push(storageTopicList.value[topicList.length]);
console.log('topicList', topicList);
return true;
};
// 初始化时检查
@@ -330,7 +368,7 @@
...res,
isPreview: false,
clearResult: true,
es_status: '', // 预设一下问答题的结果'' 空为没有 00 转圈 01 播放,其他暂定
es_status: '', // 预设一下问答题的状态'' 空为没有 00 转圈 01 播放,其他暂定
my_answer: []
}));
addProblem();
+9
View File
@@ -197,6 +197,15 @@
"titleNView": false
}
}
},
{
"path": "pages/courseRecord/courseStudyRecordDetail",
"style": {
"navigationBarTitleText": "课程记录学习记录详情",
"app-plus": {
"titleNView": false
}
}
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B