JLBA202505130001_关于吉林银行新建AI智能培训系统的需求_fix: bug

This commit is contained in:
杨航
2026-03-12 19:10:03 +08:00
parent 509b0b0017
commit 64c7ef9329
2 changed files with 100 additions and 69 deletions
@@ -159,6 +159,7 @@
}
}
}
// https://cms-emer-res.cctvnews.cctv.com/video/1005/p/39450b1263cf4be8b258bdf38995d2fb-023f0694178843bca3845de46aca7bbf-4.mp4
this.videoContext = uni.createVideoContext(`video` + this.fileId)
},
initSrc(newval, oldval) {
+99 -69
View File
@@ -3,31 +3,17 @@
<!-- <MarkdownPreview/> -->
<view class="top-bg"></view>
<view class="bot-bg"></view>
<scroll-view
class="index-dialog-body"
:scroll-y="true"
upper-threshold="0"
refresher-enabled="true"
refresher-default-style="none"
@refresherrefresh="scrolltolower"
>
<scroll-view class="index-dialog-body" :scroll-y="true" upper-threshold="0" refresher-enabled="true"
refresher-default-style="none" @refresherrefresh="scrolltolower">
<view class="body-title">
<!-- <uv-icon class="arrow-icon" name="arrow-left" @click="common.navigateBack()"/> -->
AI问答
<view class="top-desc">内容由AI生成</view>
<view class="seek-setting">
<image
src="@/static/images/dialog/new-dialog.png"
alt=""
class="image-icon-new"
@click="createNewDialog"
></image>
<image
src="@/static/images/dialog/history.png"
alt=""
class="image-icon"
@click="showMenuList = !showMenuList"
></image>
<image src="@/static/images/dialog/new-dialog.png" alt="" class="image-icon-new" @click="createNewDialog">
</image>
<image src="@/static/images/dialog/history.png" alt="" class="image-icon"
@click="showMenuList = !showMenuList"></image>
<view :class="['more-list', showMenuList ? 'show' : '']">
<view class="more-item" @click.stop="showHistory">历史</view>
<view class="more-item" @click.stop="toMessage">消息</view>
@@ -79,22 +65,11 @@
</scroll-view>
</view> -->
<view class="talking-list" v-show="talkingList.length > 0">
<scroll-view
class="talking-scroll-list"
:scroll-y="true"
:scroll-top="scrollTop"
:show-scrollbar="false"
:scroll-with-animation="false"
>
<TalkingItem
v-for="(item, index) in talkingList"
:talkingType="item.type"
:talkingInfo="item"
:isLast="index + 1 === talkingList.length"
:isAnswering="!answerIsOver"
:activeVoiceId="activeVoiceTalkingItemId"
@handleEvents="talkItemEvents"
></TalkingItem>
<scroll-view class="talking-scroll-list" :scroll-y="true" :scroll-top="scrollTop" :show-scrollbar="false"
:scroll-with-animation="false">
<TalkingItem v-for="(item, index) in talkingList" :talkingType="item.type" :talkingInfo="item"
:isLast="index + 1 === talkingList.length" :isAnswering="!answerIsOver"
:activeVoiceId="activeVoiceTalkingItemId" @handleEvents="talkItemEvents"></TalkingItem>
<view class="question-item-box mt-16" v-for="item in talkQnsList">
<view class="question-item" @click="sendText(item)">
@@ -147,7 +122,7 @@
/> -->
<touch-btn @submitVoice="submitVoice" @sendLoading="sendLoading" @submitAnswer="submitAnswer"
@startRecord="startRecordCallback" :loadingText="sendLoadingText" :isLoading="!answerIsOver"
:adjustPosition="true" :isDisabled="isHistory" :disabledText="''"/>
:adjustPosition="true" :isDisabled="isHistory || isSending" :disabledText="''" />
<History ref="historyRef" @showDetail="showHistoryDetail"></History>
<PreviewVue ref="previewRef" />
@@ -164,19 +139,50 @@
</template>
<script setup>
import { ref, unref, onMounted, watch, nextTick, computed, onActivated } from 'vue';
import {
ref,
unref,
onMounted,
watch,
nextTick,
computed,
onActivated
} from 'vue';
import common from '@/common/common';
import { setupKeyboardHeightListener } from '@/common/common';
import {
setupKeyboardHeightListener
} from '@/common/common';
// import TouchBtn from '@/pages/course/components/touchBtn.vue';
import TalkingItem from './components/talking-item.vue';
import PreviewVue from './components/preview.vue';
import { useSocketStore } from '@/store/socket.js';
import { useStorageStore } from '@/store/storage.js';
import { storeToRefs } from 'pinia';
import { onLoad, onShow, onUnload, onHide, onBackPress, onLaunch } from '@dcloudio/uni-app';
import { get_base_url, goto_login_fun } from '@/api/request';
import { getUserInfo, getPhoneEnvBool } from '@/common/common';
import { commonUploadVoiceFile } from '@/api/common.js';
import {
useSocketStore
} from '@/store/socket.js';
import {
useStorageStore
} from '@/store/storage.js';
import {
storeToRefs
} from 'pinia';
import {
onLoad,
onShow,
onUnload,
onHide,
onBackPress,
onLaunch
} from '@dcloudio/uni-app';
import {
get_base_url,
goto_login_fun
} from '@/api/request';
import {
getUserInfo,
getPhoneEnvBool
} from '@/common/common';
import {
commonUploadVoiceFile
} from '@/api/common.js';
import {
queryHotQuestionApi,
insertTraAskFeedback,
@@ -189,14 +195,22 @@
import badge from '@/components/points-and-badge/badge';
import points from '@/components/points-and-badge/points';
import usePointsAndBadge from '@/components/points-and-badge/usePointsAndBadge';
const { pointAndBadgesRun, badgeRef, pointsRef } = usePointsAndBadge();
const {
pointAndBadgesRun,
badgeRef,
pointsRef
} = usePointsAndBadge();
const { statusBarHeight } = uni.getWindowInfo();
const {
statusBarHeight
} = uni.getWindowInfo();
const pageTopPadding = computed(() => statusBarHeight + 'px');
const socketStore = useSocketStore();
const { SocketObj } = storeToRefs(socketStore);
const {
SocketObj
} = storeToRefs(socketStore);
const feedbackRef = ref();
const watermarkRef = ref();
@@ -283,7 +297,11 @@
});
});
unref(SocketObj).on('message', (res) => {
const { rtnCode, body, commond } = JSON.parse(res.data);
const {
rtnCode,
body,
commond
} = JSON.parse(res.data);
let _id = new Date().getTime() + 'id';
if (rtnCode === '0000') {
if (commond === 'ASK-OPEN') {
@@ -322,7 +340,7 @@
seqNo.value = body.seqNo;
touchBtnCallBack.value && touchBtnCallBack.value();
touchBtnCallBack.value = null;
console.log('body',body);
console.log('body', body);
talkingList.value.push({
type: 'question',
talkingText: body.intrctContent,
@@ -331,7 +349,8 @@
...body,
...askData.value
});
console.log('talkingList',talkingList.value);
isSending.value = false
console.log('talkingList', talkingList.value);
talkingList.value.push({
type: 'answer',
isLoading: true,
@@ -448,7 +467,12 @@
const isDownloading = ref(false);
const stopAnswerCallBack = ref(null);
const talkItemEvents = ({ type, data, id, info = {} }) => {
const talkItemEvents = ({
type,
data,
id,
info = {}
}) => {
switch (type) {
case 'reAnswer':
console.log('重新提问回答');
@@ -561,8 +585,7 @@
return new Promise((resolve, reject) => {
console.log('开始下载:', fileUrl);
const dtask = plus.downloader.createDownload(
fileUrl,
{
fileUrl, {
filename: localFilePath
},
(d, status) => {
@@ -694,6 +717,8 @@
};
// 新发送语音前loading动画
const sendLoading = () => {
isSending.value = true
talkQnsList.value = [];
talkingList.value.push({
type: 'question',
talkingText: '',
@@ -701,21 +726,25 @@
});
scrollToBottomNow();
}
const isSending = ref(false)
// 新发送语音
const submitVoice = ({ossKey, text}) => {
console.log('新发送语音',ossKey,text);
// if (talkingList.value.length > 0 && talkingList.value[talkingList.value.length - 1].isLoading) {
// return
// }
if(!ossKey) {
const submitVoice = ({
ossKey,
text
}) => {
console.log('新发送语音', ossKey, text);
// if (talkingList.value.length > 0 && talkingList.value[talkingList.value.length - 1].isLoading) {
// return
// }
if (!ossKey) {
talkingList.value.pop();
isSending.value = false
uni.showToast({
title: '系统异常,请联系管理员',
icon: 'none',
duration: 1000
});
}else if(text) {
} else if (text) {
askData.value = {
reqBatch: reqBatch.value,
intrctWay: '02', //01-文本;02-语音;03-图片
@@ -728,6 +757,7 @@
});
} else {
talkingList.value.pop();
isSending.value = false
uni.showToast({
title: '未识别到文字',
icon: 'none',
@@ -738,7 +768,7 @@
// 发送语音
const uploadRecordNow = (voicePath, voiceTime) => {
//#ifdef APP-PLUS
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {})
.then((_res) => {
if (!!(_res.body.transContent || '').trim()) {
@@ -774,7 +804,7 @@
});
// #endif
};
// 新录音组件文本提交
const submitAnswer = (val, cb = null) => {
if (!answerIsOver.value) {
@@ -796,7 +826,7 @@
height: 0
});
}
// 发送文本
const submitAnswerNow = (val, cb = null) => {
if (!answerIsOver.value) {
@@ -944,9 +974,9 @@
const deleteFolder = () => {
//#ifdef APP-PLUS
plus.io.resolveLocalFileSystemURL('_doc/pdf_view', function (entry) {
plus.io.resolveLocalFileSystemURL('_doc/pdf_view', function(entry) {
console.log('entry', entry);
entry.removeRecursively(function (res) {
entry.removeRecursively(function(res) {
console.log('删除成功');
});
});
@@ -1299,4 +1329,4 @@
// height: 100%;
// }
// }
</style>
</style>