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

This commit is contained in:
杨航
2026-01-12 17:17:50 +08:00
parent baa1b8d2dd
commit 70a53f7524
+137 -113
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>
@@ -49,42 +35,25 @@
<view class="questions-view">
<scroll-view :scroll-x="true" :show-scrollbar="false">
<view class="question-row">
<view
class="question-item"
v-for="item in Math.ceil(questionList.length / 2)"
@click="sendText(questionList[item - 1].hotContent)"
>
<view class="question-item" v-for="item in Math.ceil(questionList.length / 2)"
@click="sendText(questionList[item - 1].hotContent)">
{{ questionList[item - 1].hotContent }}
</view>
</view>
<view class="question-row">
<view
class="question-item"
v-for="item in questionList.length - Math.ceil(questionList.length / 2)"
@click="sendText(questionList[item + Math.ceil(questionList.length / 2) - 1].hotContent)"
>
<view class="question-item" v-for="item in questionList.length - Math.ceil(questionList.length / 2)"
@click="sendText(questionList[item + Math.ceil(questionList.length / 2) - 1].hotContent)">
{{ questionList[item + Math.ceil(questionList.length / 2) - 1].hotContent }}
</view>
</view>
</scroll-view>
</view>
<view class="talking-list">
<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>
</scroll-view>
</view>
<view class="router-list">
@@ -119,23 +88,16 @@
</view>
</scroll-view>
</view>
<TouchBtn
class="talk-btns"
@uploadVoice="uploadRecordNow"
@submitAnswer="submitAnswerNow"
@startRecord="startRecordCallback"
:loadingText="sendLoadingText"
:isLoading="!answerIsOver"
:adjustPosition="true"
:isDisabled="isHistory"
/>
<TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow"
@startRecord="startRecordCallback" :loadingText="sendLoadingText" :isLoading="!answerIsOver"
:adjustPosition="true" :isDisabled="isHistory" />
<History ref="historyRef" @showDetail="showHistoryDetail"></History>
<PreviewVue ref="previewRef" />
</scroll-view>
</view>
<badge ref="badgeRef"></badge>
<points ref="pointsRef"></points>
<badge ref="badgeRef"></badge>
<points ref="pointsRef"></points>
<!-- 反馈组件 -->
<Feedback ref="feedbackRef" @feedbackAnswer="feedbackAnswer"></Feedback>
<!-- <file-preview ref="previewFileRef" :file-id="'603058d8-88e0-43d2-8242-3132b85bc91c'" v-model="showPreview" /> -->
@@ -144,19 +106,49 @@
</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 } 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
} 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,
@@ -166,23 +158,31 @@
} from '@/api/dialog.js';
import Feedback from './components/feedback.vue';
import History from './components/history.vue';
import badge from '@/components/points-and-badge/badge';
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();
const userInfo = ref(getUserInfo());
const luimgAddr = computed(()=> unref(userInfo)?.mascotInfo?.imgAddr || '')
const userParams = '/' + (unref(userInfo)?.loginName??'')
const luimgAddr = computed(() => unref(userInfo)?.mascotInfo?.imgAddr || '')
const userParams = '/' + (unref(userInfo)?.loginName ?? '')
const questionList = ref([
// '对公小程序开户流程?',
// '厅堂服务经理2025年管理办法?',
@@ -262,7 +262,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') {
@@ -296,7 +300,8 @@
if (commond === 'ASK') {
console.log('发送问题成功!');
if (talkingList.value.length > 0 && talkingList.value[talkingList.value.length - 1].isLoading) {
talkingList.value.pop();
// talkingList.value.pop();
talkingList.value = talkingList.value.filter(t => !t.isLoading)
}
seqNo.value = body.seqNo;
touchBtnCallBack.value && touchBtnCallBack.value();
@@ -314,6 +319,7 @@
isLoading: true,
id: _id + 'loading'
});
answerIsOver.value = false;
scrollToBottomNow();
return;
}
@@ -329,13 +335,14 @@
if (commond === 'ASK-ANSWER') {
if (body.event === 'start') {
console.log('开始回答!');
if (askTime.value === 0){
if (askTime.value === 0) {
pointAndBadgesRun('06')
askTime.value = 1
}
answerIsOver.value = false;
answerText.value = '';
talkingList.value.pop();
talkingList.value = talkingList.value.filter(t => !t.isLoading)
talkingList.value.push({
type: 'answer',
talkingText: answerText.value,
@@ -380,6 +387,7 @@
if (commond === 'ASK-ERR') {
console.log('提问失败,系统异常!');
answerIsOver.value = true;
return;
}
} else {
@@ -417,7 +425,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('重新提问回答');
@@ -492,7 +505,7 @@
});
break;
case 'preview':
common.navigateTo('/pages/index/preview?fileId=' + info.docId);
common.navigateTo('/pages/index/preview?fileId=' + info.docId);
// if (getPhoneEnvBool('AND')) {
// common.navigateTo('/pages/index/preview?fileId=' + info.docId);
// } else {
@@ -530,8 +543,7 @@
return new Promise((resolve, reject) => {
console.log('开始下载:', fileUrl);
const dtask = plus.downloader.createDownload(
fileUrl,
{
fileUrl, {
filename: localFilePath
},
(d, status) => {
@@ -676,31 +688,33 @@
scrollToBottomNow();
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {})
.then((_res) => {
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,
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,
voiceTime: voiceTime
};
sendMessage({
commond: 'ASK',
body: askData.value
});
} else {
talkingList.value.pop();
uni.showToast({
title: '未识别到文字',
icon: 'none',
duration: 1000
});
}
};
sendMessage({
commond: 'ASK',
body: askData.value
});
} else {
talkingList.value.pop();
talkingList.value = talkingList.value.filter(t => !t.isLoading)
uni.showToast({
title: '未识别到文字',
icon: 'none',
duration: 1000
});
}
})
.catch((err) => {
talkingList.value.pop();
talkingList.value = talkingList.value.filter(t => !t.isLoading)
uni.showToast({
title: '系统异常,请联系管理员',
icon: 'none',
@@ -726,7 +740,9 @@
commond: 'ASK',
body: askData.value
});
setHeight({height: 0})
setHeight({
height: 0
})
};
const startRecordCallback = () => {
// 开始录音回调
@@ -793,7 +809,7 @@
};
onLoad(() => {
//#ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary')
plus.screen.lockOrientation('portrait-primary')
// #endif
changeAppHeightBottom();
if (!common.isLogin()) {
@@ -824,9 +840,9 @@
const keyboardHeight = ref('0px');
const setHeight = (res) => {
keyboardHeight.value = (res.height || 0) + 'px';
setTimeout(()=>{
setTimeout(() => {
console.log(totalBotHeight.value)
},1000)
}, 1000)
};
const keyBoardIsHide = computed(() => {
return parseInt(keyboardHeight.value) == 0;
@@ -837,7 +853,8 @@
// #ifdef APP-PLUS
isIos = (plus.os.name == "iOS")
// #endif
return isIos || keyBoardIsHide.value ? 0 + 'px' : parseInt(keyboardHeight.value) + parseInt(bottomHeight.value) + 'px';
return isIos || keyBoardIsHide.value ? 0 + 'px' : parseInt(keyboardHeight.value) + parseInt(bottomHeight.value) +
'px';
});
const changeAppHeightBottom = (height) => {
//#ifdef APP-PLUS
@@ -846,15 +863,15 @@
// 计算安全区域底部高度
bottomHeight.value = systemInfo.screenHeight - systemInfo.safeArea.bottom + 'px';
console.log(systemInfo)
console.log(systemInfo.screenHeight , systemInfo.safeArea.bottom )
console.log(systemInfo.screenHeight, systemInfo.safeArea.bottom)
// #endif
};
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('删除成功');
});
});
@@ -871,7 +888,7 @@
nextTick(() => {
watermarkRef.value?.updateWatermarkText();
});
});
// #endif
onUnload(() => {
@@ -932,7 +949,8 @@
font-weight: 500;
color: #000;
position: relative;
.top-desc{
.top-desc {
position: absolute;
bottom: -10rpx;
font-size: 18rpx;
@@ -941,7 +959,7 @@
transform: translateX(-50%);
}
.top-desc{
.top-desc {
position: absolute;
bottom: -10rpx;
font-size: 18rpx;
@@ -949,6 +967,7 @@
left: 50%;
transform: translateX(-50%);
}
// margin-bottom: 23rpx;
.arrow-icon {
position: absolute;
@@ -971,6 +990,7 @@
line-height: 32rpx;
text-align: right;
padding-right: 48rpx;
.more-list {
position: absolute;
top: 100%;
@@ -982,9 +1002,11 @@
padding: 16rpx 0;
display: none;
z-index: 21;
&.show {
display: block;
}
.more-item {
line-height: 60rpx;
font-size: 29rpx;
@@ -993,6 +1015,7 @@
z-index: 22;
}
}
.image-icon {
width: 30rpx;
height: 32rpx;
@@ -1150,6 +1173,7 @@
padding: 12rpx 24rpx;
box-sizing: border-box;
min-height: 300rpx;
.talking-scroll-list {
height: 100%;
}
@@ -1165,4 +1189,4 @@
// height: 100%;
// }
// }
</style>
</style>