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

This commit is contained in:
杨航
2025-08-08 17:46:34 +08:00
7 changed files with 543 additions and 40 deletions
+206 -21
View File
@@ -25,14 +25,18 @@
</view>
<view class="scroll_div">
<swiper class="swiper" :indicator-dots="false" @change="swiperChange" :current="questionNumber" easing-function="linear">
<swiper class="swiper" :indicator-dots="false" @change="swiperChange" :current="questionNumber"
easing-function="linear">
<swiper-item v-for="(item,index) in topicList">
<view class="content">
<view class="expose_shadow"></view>
<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>
@@ -40,26 +44,59 @@
</swiper>
</view>
<view class="fixed-btn-box font_pf">
<view class="sheet">
<image :src="examinationSheetIcon()" class="img"></image>
<view class="sheet_text">答题卡</view>
<view class="fixed-box font_pf">
<view class="fixed-btn-box">
<view class="sheet_button" @click="openSheet()">
<image :src="examinationSheetIcon()" class="img"></image>
<view class="sheet_text">答题卡</view>
</view>
<view class="button_div">
<uv-button class="button" type="primary" :throttleTime="100" text="上一题" color="#E2EDFF"
custom-style="color:#0066FF;borderRadius:16rpx;height:92rpx;"
@click="button_tab(-1)"></uv-button>
<view style="width:46rpx"></view>
<uv-button class="button" type="primary" :throttleTime="100" text="下一题" color="#0066FF"
custom-style="color:#FFFFFF;borderRadius:16rpx;height:92rpx;"
@click="button_tab(1)"></uv-button>
</view>
</view>
<view class="button_div">
<uv-button class="button" type="primary" :throttleTime="100" text="上一题" color="#E2EDFF"
custom-style="color:#0066FF;borderRadius:16rpx;height:92rpx;" @click="button_tab(-1)"></uv-button>
<view style="width:46rpx"></view>
<uv-button class="button" type="primary" :throttleTime="100" text="下一题" color="#0066FF"
custom-style="color:#FFFFFF;borderRadius:16rpx;height:92rpx;" @click="button_tab(1)"></uv-button>
<view class="touch-btn-div" :class="{'show':showTouchBtn}">
<TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow"
:loadingText="sendLoadingText" :isLoading="!answerIsOver" :isDisabled="false" />
</view>
</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>
<script setup>
import RadioSubject from '@/components/examination/radio-subject.vue'
import CharactersSubject from '@/components/examination/characters-subject.vue'
import TouchBtn from '@/pages/course/components/touchBtn.vue'
import {
ref,
reactive,
@@ -78,25 +115,37 @@
import {
getPageCache
} from '@/common/common';
import {
commonUploadVoiceFile
} from "@/api/common.js"
const sendLoadingText = ref('问题回答中,请在问题回答结束后重试!')
const answerIsOver = ref(true)
const examId = ref('')
const popup = ref(null)
const mode = ref('examination') // 考试 examination 练习practice
const paperData = reactive({
papersId: '',
limitTm: 0,
papersName: '',
}) // 试卷信息
const topicList = reactive([]) // 问题列表
const questionNumber = ref(0) // 题号
const showTouchBtn = computed(() => {
return topicList[questionNumber.value]['qnsTyp'] === 'ES'
})
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 topicList = reactive([]) // 问题列表
const questionNumber = ref(0) // 题号
const activeVoiceId = ref('')
const swiperChange = (item) => {
questionNumber.value = item.detail.current
}
// 按上一题下一题
const button_tab = (num) => {
let newNumber = questionNumber.value + num;
@@ -108,6 +157,71 @@
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',
// talkingText: '',
// isLoading: true
// })
// scrollToBottomNow()
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {}).then(res => {
let _res = JSON.parse(res.data)
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,
// intrctWay: '02', //01-文本;02-语音;03-图片
// intrctContent: _res.body.transContent,
// bucketKey: _res.body.fileId,
// ossFileAddr: _res.body.ossFileAddr,
// talkingVoice: voicePath
// }
// sendMessage({
// "commond": 'ASK',
// "body": askData.value
// })
// } else {
// // talkingList.value.pop()
// uni.showToast({
// title: '未识别到文字!',
// icon: "none",
// duration: 1000
// });
// }
} else {}
}).catch(err => {
// talkingList.value.pop()
uni.showToast({
title: '系统异常,请联系管理员',
icon: "none",
duration: 1000
});
})
// #endif
}
// 发送文本
const submitAnswerNow = (val, cb = null) => {
}
// 初始化时检查
onLoad(() => {
const examination = getPageCache('examination')
@@ -125,28 +239,99 @@
})))
});
const hand_in_paper = () => {
console.log('点击交卷', topicList);
console.log('点击交卷', showTouchBtn.value);
showTouchBtn.value = !showTouchBtn.value
}
</script>
<style scoped lang="scss">
$bg-margin-left: 30rpx;
.fixed-btn-box {
.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%;
left: 0;
bottom: 0;
height: 154rpx;
background: #FFFFFF;
border-radius: 16rpx 16rpx 0px 0px;
border: 2rpx solid #E5E5E5;
background: #FFFFFF;
}
.touch-btn-div {
height: 0;
overflow: hidden;
transition: height 0.2s ease-out;
}
.touch-btn-div.show {
height: 150rpx;
}
.fixed-btn-box {
height: 154rpx;
display: flex;
justify-content: space-between;
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