考试页

This commit is contained in:
田岩
2025-08-08 17:37:14 +08:00
parent e0946cbbfd
commit 2f73406430
7 changed files with 186 additions and 39 deletions
+5 -3
View File
@@ -21,15 +21,17 @@ export default {
<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
// @import "@/uni_modules/uview-ui/index.scss";
view {
box-sizing: border-box;
}
@font-face {
font-family: 'PingFangSC';
src: url('@/static/font/PingFang-SC.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
view {
box-sizing: border-box;
font-family: "PingFangSC";
}
// 解决uview离线环境下没有图标
@font-face {
@@ -19,13 +19,9 @@
{{subject_data.qnsContent}}
</view>
<view class="option_div">
<questionVue
@changePlay="changePlay"
:dataInfo="talkingInfo"
:activeVoiceId="activeVoiceId"
></questionVue>
<questionVue @changePlay="changePlay" :dataInfo="talkingInfo" :activeVoiceId="questionValue"></questionVue>
</view>
</view>
</template>
<script setup>
@@ -35,21 +31,15 @@
onMounted,
nextTick,
computed,
toRaw
toRaw,
watch
} from 'vue'
import questionVue from './question.vue';
import radioSubjectItem from './radio-subject-item.vue'
import {
SUBJECT_TYPE
} from '@/enum.js'
const talkingInfo = reactive({})
const customStyle = {
borderRadius: '16rpx',
width: '292rpx',
backgroundColor: '#0066FF',
border: '1rpx solid rgb(12, 123, 245)',
}
const emit = defineEmits(['click_option'])
const questionValue = ref('')
const props = defineProps({
item: {
type: Object,
@@ -58,9 +48,52 @@
mode: {
type: String,
required: true,
}
},
activeVoiceId: {
type: String,
required: true,
},
voicePathValue: {
type: String,
required: true,
},
});
const talkingInfo = ref({
id: '3',
intrctWay: "",
intrctContent: "中的i id一二三。",
talkingText: '中的i id一二三。',
talkingVoice: ''
})
watch(() => props.voicePathValue, (val) => {
if (val) {
talkingInfo.value = {
id: '3',
intrctWay: "02",
intrctContent: "中的i id一二三。",
talkingText: '中的i id一二三。',
talkingVoice: val
}
}
})
// "chatId": "CHAT025018122068202508081709060000000000000000000000000000000098",
// "fileId": "S3F0250181220722025080817090600000476885",
// "ossFileAddr": "http://25.18.122.66::9786/traoss/show//S3F0250181220722025080817090600000476885",
// "transContent": "一二三四。"
// const activeVoiceId = ref()
const customStyle = {
borderRadius: '16rpx',
width: '292rpx',
backgroundColor: '#0066FF',
border: '1rpx solid rgb(12, 123, 245)',
}
const emit = defineEmits(['click_option'])
const subject_data = reactive({
qnsId: '',
qnsContent: '',
@@ -74,11 +107,17 @@
// 题类型
const subject_type_text = computed(() => SUBJECT_TYPE.find(res => subject_data.qnsTyp === res.value)?.label || '')
const changePlay = (id) => {
console.log('changePlay');
questionValue.value = id
// emit('handleEvents', 'changePlay', props.talkingInfo, id)
}
</script>
<style scoped lang="scss">
.option_div {
padding-top: 46rpx;
}
.item {
// height: 170rpx;
+1
View File
@@ -120,6 +120,7 @@ import { onUnload } from '@dcloudio/uni-app';
if(unref(dataInfo).intrctWay === '02'){
itemVoice.value = unref(dataInfo).talkingVoice
talkVoiceObj.value.src = itemVoice.value
console.log(talkVoiceObj.value.src,1111)
setTimeout(()=>{
setVoiceTime(0)
},100)
+119 -16
View File
@@ -33,7 +33,10 @@
<scroll-view :scroll-y="true" class="scroll-Y" :show-scrollbar="false" :refresher-threshold="0">
<RadioSubject :item="item" v-if="item.qnsTyp !== 'ES'" :mode="mode">
</RadioSubject>
<CharactersSubject :item="item" v-if="item.qnsTyp === 'ES'" :mode="mode">
<CharactersSubject :item="item" v-if="item.qnsTyp === 'ES'" :mode="mode"
:activeVoiceId="activeVoiceId"
:voicePathValue="voicePathValue"
>
</CharactersSubject>
</scroll-view>
</view>
@@ -43,7 +46,7 @@
<view class="fixed-box font_pf">
<view class="fixed-btn-box">
<view class="sheet">
<view class="sheet_button" @click="openSheet()">
<image :src="examinationSheetIcon()" class="img"></image>
<view class="sheet_text">答题卡</view>
</view>
@@ -58,11 +61,35 @@
</view>
</view>
<view class="touch-btn-div" :class="{'show':showTouchBtn}">
<TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow"
@submitAnswer="submitAnswerNow" :loadingText="sendLoadingText" :isLoading="!answerIsOver"
:isDisabled="false" />
<TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow"
:loadingText="sendLoadingText" :isLoading="!answerIsOver" :isDisabled="false" />
</view>
</view>
<uni-popup ref="popup" class="popup">
<view class="sheet_popup_div">
<view class="title_div">
<view class="text">
答题卡
</view>
<view class="popup_back_div">
</view>
</view>
<view class="sheet_table">
<view class="sheet_table_item" v-for="(item,index) in [1,2,3,4,5,67,8,9,10,11,12,13,14,15]">
<view class="circle">
{{index + 1}}
</view>
</view>
</view>
<view class="sheet_button">
<uv-button class="button" type="primary" :throttleTime="100" text="交卷" color="#0066FF"
custom-style="color:#FFFFFF;borderRadius:16rpx;height:92rpx;"
></uv-button>
</view>
</view>
</uni-popup>
</view>
</template>
@@ -94,6 +121,7 @@
const sendLoadingText = ref('问题回答中,请在问题回答结束后重试!')
const answerIsOver = ref(true)
const examId = ref('')
const popup = ref(null)
const mode = ref('examination') // 考试 examination 练习practice
const paperData = reactive({
papersId: '',
@@ -106,16 +134,18 @@
const showTouchBtn = computed(() => {
return topicList[questionNumber.value]['qnsTyp'] === 'ES'
})
// const showTouchBtn = ref(true)
const progress = computed(() => { // 计算进度百分比(保留两位小数)
const total = topicList.length;
if (total === 0) return 0;
const completed = questionNumber.value + 1;
return Math.min(Math.round((completed / total) * 10000) / 100, 100);
})
const activeVoiceId = ref('')
const swiperChange = (item) => {
questionNumber.value = item.detail.current
}
// 按上一题下一题
const button_tab = (num) => {
let newNumber = questionNumber.value + num;
@@ -126,8 +156,16 @@
}
questionNumber.value = newNumber;
}
// 打开答题卡
const openSheet = () => {
popup.value.open('bottom');
}
const voicePathValue = ref('')
// 发送语音
const uploadRecordNow = (voicePath) => {
console.log('voicePath',voicePath);
//#ifdef APP-PLUS
// talkingList.value.push({
// type: 'question',
@@ -137,8 +175,17 @@
// scrollToBottomNow()
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {}).then(res => {
let _res = JSON.parse(res.data)
console.log('_res', _res);
voicePathValue.value = voicePath
console.log('_res', _res, voicePath);
if (_res.rtnCode === '0000') {
// "chatId": "CHAT025018122068202508081537410000000000000000000000000000000088",
// "fileId": "S3F0250181220722025080815374100000456565",
// "ossFileAddr": "http://25.18.122.66::9786/traoss/show//S3F0250181220722025080815374100000456565",
// "transContent": "下面那几个跟。"
// activeVoiceId.value =
// if (!!(_res.body.transContent || '').trim()) {
// askData.value = {
// reqBatch: reqBatch.value,
@@ -173,7 +220,7 @@
}
// 发送文本
const submitAnswerNow = (val, cb = null) => {
}
// 初始化时检查
onLoad(() => {
@@ -199,7 +246,63 @@
<style scoped lang="scss">
$bg-margin-left: 30rpx;
.popup {
//答题卡
z-index: 1800;
padding: 0 38rpx;
.sheet_popup_div {
width: 100%;
height: 100%;
background-color: #FFFFFF;
padding: 10rpx 34rpx;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 16rpx 16rpx 0px 0px;
.title_div {
width: 100%;
text-align: center;
padding: 30rpx 0;
font-family: PingFangSC;
font-weight: 600;
font-size: 34rpx;
color: #000000;
text-align: center;
font-style: normal;
border-bottom: 2rpx solid #EFEFEF;
}
.sheet_table {
margin-top: 48rpx;
margin-bottom: 48rpx;
display: flex;
/* 启用 Flex 布局 */
flex-wrap: wrap;
/* 超出宽度时自动换行 */
width: calc(100vw - 108rpx);
align-content: space-between;
.sheet_table_item {
width: calc((100vw - 108rpx) / 5 - 16rpx);
height: calc((100vw - 108rpx) / 5 - 16rpx);
margin: 8rpx;
border: 2rpx solid #E5E5E5;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
}
}
.sheet_button{
width: 100%;
}
}
}
.fixed-box {
position: fixed;
width: 100%;
@@ -212,15 +315,15 @@
.touch-btn-div {
height: 0;
overflow: hidden;
transition: height 0.2s ease-out;
height: 0;
overflow: hidden;
transition: height 0.2s ease-out;
}
.touch-btn-div.show {
height: 150rpx;
height: 150rpx;
}
.fixed-btn-box {
height: 154rpx;
display: flex;
@@ -228,7 +331,7 @@
align-items: center;
padding: 0 20rpx 20rpx 20rpx;
.sheet {
.sheet_button {
display: flex;
flex-direction: column;
align-items: center;
+1
View File
@@ -252,6 +252,7 @@
seqNo.value = body.seqNo
touchBtnCallBack.value && touchBtnCallBack.value()
touchBtnCallBack.value = null
console.log('嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻', body);
talkingList.value.push({
type: 'question',
talkingText: body.intrctContent,
+1 -1
View File
@@ -5,7 +5,7 @@
<!-- 主体 -->
<view class="content">
<view class="drop-down-div"> 下拉显示</view>
<view class="item" v-for="(item,index) in data_list" :class="index % 2?'completed':'incomplete'"
<view class="item" v-for="(item,index) in data_list" :class="item.examStatText=='Y'?'completed':'incomplete'"
@click="gotoDetails(item)">
<view class="subscript" v-if="item.examStatText==='N'">未完成</view>
<view class="subscript" v-if="item.examStatText==='Y'">已完成</view>
+4 -3
View File
@@ -6,11 +6,12 @@
</view>
<view>考试详情</view>
</view>
<view class="detail_div completed incomplete">
<view class="subscript">完成</view>
<view class="detail_div" :class="detailData.examStatText=='Y'?'completed':'incomplete'">
<view class="subscript" v-if="detailData.examStatText==='N'">完成</view>
<view class="subscript" v-if="detailData.examStatText==='Y'">已完成</view>
<view class="title_div">
<view class="title ellipsis-text">{{detailData.papersName}}</view>
<!-- <view class="subscript" >未完成</view> -->
</view>
<view class="time">
<text class="color_3">起止时间</text><text