Merge branch 'sit' into 'uat'
Sit See merge request K17_AITS/tra-app!58
This commit is contained in:
+1
-1
@@ -17,4 +17,4 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
|
||||
#VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
|
||||
|
||||
# h5专用地址
|
||||
VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7001'
|
||||
VITE_APP_BASE_H5_API_Url = 'http://aitstest.jlbank.com.cn:7001'
|
||||
@@ -9,13 +9,16 @@
|
||||
>按住说话
|
||||
</view>
|
||||
<view class="touch-btn" v-if="keyboardIsShow">
|
||||
<uv-input class="input-box" ref="inputRef" v-model.trim="answerValue" maxlength="500"
|
||||
placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入答案">
|
||||
<uv-input class="input-box" ref="inputRef" v-model="answerValue" maxlength="500"
|
||||
placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入文字">
|
||||
</uv-input>
|
||||
</view>
|
||||
<view class="talk-btn-box" @click.stop="showKeyboard" v-show="!onlyVoice">
|
||||
<image class="talk-btn-icon" v-show="!keyboardIsShow" src="/src/static/images/course/jianpan.png" mode=""></image>
|
||||
<image class="talk-btn-icon" v-show="keyboardIsShow" src="/src/static/images/course/send.png" mode=""></image>
|
||||
<view class="talk-btn-box" v-show="!onlyVoice">
|
||||
<image class="talk-btn-icon" v-show="!keyboardIsShow" src="/src/static/images/course/jianpan.png" mode="" @click="changeBtn"></image>
|
||||
<image class="talk-btn-icon" v-show="keyboardIsShow && !answerValue" src="/src/static/images/course/record.png" mode="" @click="changeBtn"></image>
|
||||
<image class="talk-btn-icon" v-show="keyboardIsShow && !!answerValue" src="/src/static/images/course/send.png" mode=""
|
||||
@click.stop="showKeyboard"
|
||||
></image>
|
||||
</view>
|
||||
<uv-overlay :show="showTalkingModel" opacity=".9" @click="showTalkingModel = false">
|
||||
<view class="overlay-box">
|
||||
@@ -83,6 +86,8 @@ watch(()=>props.onlyVoice,()=>{},{
|
||||
})
|
||||
const showTalkingModel = ref(false)
|
||||
const keyboardIsShow = ref(false)
|
||||
|
||||
|
||||
const answerValue = ref('')
|
||||
const talkBtnRef = ref()
|
||||
// 录音
|
||||
@@ -98,13 +103,27 @@ const initRecord = () => {
|
||||
// stopRecord()
|
||||
unref(recordObjCom)?.onStop((res, duration)=>{
|
||||
audioPath.value = res.tempFilePath
|
||||
showTalkingModel.value = false
|
||||
if(!isOut.value){
|
||||
if(startFlag.value !== 2){
|
||||
common.msg('说话时间太短,没有听清!')
|
||||
return
|
||||
// setTimeout(() => {
|
||||
// showTalkingModel.value = false
|
||||
// nextTick(() => {
|
||||
// // showTalkingModel.value = false
|
||||
// common.msg('说话时间太短,没有听清!')
|
||||
// })
|
||||
// },100)
|
||||
closeModel(()=>{
|
||||
nextTick(() => {
|
||||
// showTalkingModel.value = false
|
||||
common.msg('说话时间太短,没有听清!')
|
||||
})
|
||||
})
|
||||
}else{
|
||||
closeModel()
|
||||
emit('uploadVoice', audioPath.value)
|
||||
}
|
||||
emit('uploadVoice', audioPath.value)
|
||||
}else{
|
||||
closeModel()
|
||||
}
|
||||
})
|
||||
unref(recordObjCom).onStart(() => {
|
||||
@@ -115,7 +134,6 @@ const initRecord = () => {
|
||||
let _recordPerm = uni.getAppAuthorizeSetting()
|
||||
let _state = _recordPerm.microphoneAuthorized
|
||||
if(_state === 'authorized'){
|
||||
console.log('大大大大大');
|
||||
showTalkingModel.value = true
|
||||
}
|
||||
})
|
||||
@@ -126,15 +144,21 @@ const startRecord = () => {
|
||||
}
|
||||
|
||||
const stopRecord = () => {
|
||||
if(unref(recordObjCom).stop){
|
||||
try{
|
||||
unref(recordObjCom)?.stop()
|
||||
if(unref(recordObjCom).stop){
|
||||
unref(recordObjCom).stop()
|
||||
}else{
|
||||
closeModel()
|
||||
}
|
||||
}catch{
|
||||
showTalkingModel.value = false
|
||||
closeModel()
|
||||
}
|
||||
}else{
|
||||
}
|
||||
const closeModel = (cb = () => {}) => {
|
||||
setTimeout(() => {
|
||||
showTalkingModel.value = false
|
||||
}
|
||||
cb && cb()
|
||||
},100)
|
||||
}
|
||||
// #endif
|
||||
//#ifndef APP-PLUS
|
||||
@@ -201,6 +225,7 @@ const getRecordPermission = (obj) => {
|
||||
}
|
||||
const isMoving = ref(false)
|
||||
const showOverlayTalking = (obj) => {
|
||||
if(showTalkingModel.value) return
|
||||
if(isLoadingState.value){
|
||||
uni.showToast({
|
||||
title: props.loadingText,
|
||||
@@ -268,17 +293,15 @@ const showKeyboard = () => {
|
||||
}
|
||||
if(!isDisabled.value){
|
||||
if(keyboardIsShow.value){
|
||||
if(answerValue.value){
|
||||
if(answerValue.value.trim()){
|
||||
emit(
|
||||
'submitAnswer',
|
||||
answerValue.value,
|
||||
() => {
|
||||
keyboardIsShow.value = !keyboardIsShow.value
|
||||
answerValue.value = ''
|
||||
}
|
||||
changeBtn
|
||||
)
|
||||
}else{
|
||||
keyboardIsShow.value = !keyboardIsShow.value
|
||||
// keyboardIsShow.value = !keyboardIsShow.value
|
||||
common.msg("不能发送空白消息!")
|
||||
}
|
||||
}else{
|
||||
keyboardIsShow.value = !keyboardIsShow.value
|
||||
@@ -291,6 +314,10 @@ const showKeyboard = () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
const changeBtn = () => {
|
||||
keyboardIsShow.value = !keyboardIsShow.value
|
||||
answerValue.value = ''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -426,5 +453,7 @@ const showKeyboard = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::v-deep .uv-input__content__field-wrapper__field{
|
||||
padding-right: 60rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
<view class="filter-type" v-for="item in tagsTree" :key="item.value">
|
||||
<!-- .filter(t=>(t.children||[]).length>0) -->
|
||||
<view class="filter-type-title">{{item.label}}</view>
|
||||
<view class="filter-type-list">
|
||||
<scroll-view :scroll-x="true" class="filter-type-list">
|
||||
<view :class="['filter-type-item', activeTag===itemT.value?'is-active':'']" v-for="itemT in (item.children||[])" @click="chooseTag(itemT)">
|
||||
{{itemT.label}}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
<uv-scroll-list class="tags-view" :indicator="false">
|
||||
@@ -290,6 +290,10 @@ import { onShow } from "@dcloudio/uni-app"
|
||||
changeTab({name:'全部'})
|
||||
})
|
||||
onActivated(() => {
|
||||
// 重新获取标签信息
|
||||
getTraTagListApi().then(res=>{
|
||||
tagsTree.value = res.body||[]
|
||||
})
|
||||
changeTab({name:activeTab.value || '全部'})
|
||||
});
|
||||
</script>
|
||||
@@ -368,7 +372,8 @@ import { onShow } from "@dcloudio/uni-app"
|
||||
overflow-y: auto;
|
||||
z-index: 2;
|
||||
background-color: #f9f9f9;
|
||||
box-shadow: 0rpx 3.85rpx 38rpx rgba(0,0,0,.05);
|
||||
box-shadow: 0rpx 12rpx 20rpx rgba(160,160,160,.25);
|
||||
border-radius: 0 0 0rpx 0rpx;
|
||||
padding: 0rpx 25rpx;
|
||||
box-sizing: border-box;
|
||||
.filter-type{
|
||||
@@ -383,7 +388,8 @@ import { onShow } from "@dcloudio/uni-app"
|
||||
.filter-type-list{
|
||||
overflow: hidden;
|
||||
.filter-type-item{
|
||||
width: calc(25% - 18rpx);
|
||||
// width: calc(25% - 18rpx);
|
||||
display: inline-block;
|
||||
font-size: 29rpx;
|
||||
box-sizing: border-box;
|
||||
padding:0 20rpx;
|
||||
@@ -399,7 +405,7 @@ import { onShow } from "@dcloudio/uni-app"
|
||||
border-radius: 6rpx;
|
||||
margin-bottom: 20rpx;
|
||||
&:nth-child(4n){
|
||||
margin-right: 0;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
&.is-active{
|
||||
color: #06f;
|
||||
|
||||
@@ -953,6 +953,7 @@ const chooseRateNow = (item) => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.body-title{
|
||||
|
||||
height: 150rpx;
|
||||
text-align: center;
|
||||
font-size: 33rpx;
|
||||
@@ -965,9 +966,11 @@ const chooseRateNow = (item) => {
|
||||
// margin-bottom: 23rpx;
|
||||
.arrow-icon{
|
||||
position: absolute;
|
||||
left:36rpx;
|
||||
top:80rpx;
|
||||
left:21rpx;
|
||||
top:65rpx;
|
||||
color: #000;
|
||||
padding: 15rpx;
|
||||
// background-color: red;
|
||||
}
|
||||
}
|
||||
.study-num{
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
@click="common.navigateTo('/pages/courseDetail/submit?crsNum='+props.crsNum+'&imgId='+props.imgId)">发布评价</uv-button>
|
||||
</view>
|
||||
|
||||
<uni-popup ref="popup" background-color="red">
|
||||
<uni-popup ref="popup">
|
||||
<view class="bottom_reply_input_div">
|
||||
<uv-input v-model="reply_data.bbsContent" placeholderStyle='color:#999999;font-size:26rpx'
|
||||
:placeholder="reply_data.placeholder" :focus="true" :maxlength="100">
|
||||
|
||||
@@ -148,9 +148,12 @@
|
||||
.back_div {
|
||||
margin-right: 10rpx;
|
||||
position: fixed;
|
||||
left: 46rpx;
|
||||
top: 64rpx;
|
||||
|
||||
left: 25rpx;
|
||||
top: 45rpx;
|
||||
// background-color: red;
|
||||
// width: 60rpx;
|
||||
// height: 60rpx;
|
||||
padding: 20rpx;
|
||||
.back-icon {
|
||||
position: relative;
|
||||
width: 40rpx;
|
||||
|
||||
@@ -251,8 +251,9 @@
|
||||
align-items: center;
|
||||
|
||||
.back_div {
|
||||
margin-right: 10rpx;
|
||||
|
||||
// margin-right: 10rpx;
|
||||
padding: 15rpx;
|
||||
// background-color: red;
|
||||
.back-icon {
|
||||
position: relative;
|
||||
width: 40rpx;
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<style scoped lang="scss">
|
||||
.talking-item{
|
||||
overflow: hidden;
|
||||
margin-top: 30rpx;
|
||||
margin-top: 0rpx;
|
||||
&+.talking-item{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
+231
-165
@@ -3,7 +3,8 @@
|
||||
<!-- <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="seek-setting">
|
||||
<image src="@/static/images/dialog/new-dialog.png" alt="" class="image-icon-new"></image>
|
||||
<image src="@/static/images/dialog/history.png" alt="" class="image-icon"></image>
|
||||
@@ -25,36 +26,23 @@
|
||||
<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])"
|
||||
>{{questionList[item-1]}}</view>
|
||||
<view class="question-item" v-for="item in Math.ceil(questionList.length/2)"
|
||||
@click="sendText(questionList[item-1])">{{questionList[item-1]}}</view>
|
||||
</view>
|
||||
<view class="question-row">
|
||||
<view
|
||||
class="question-item"
|
||||
<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])"
|
||||
>{{questionList[item + Math.ceil(questionList.length/2)-1]}}</view>
|
||||
@click="sendText(questionList[item + Math.ceil(questionList.length/2)-1])">
|
||||
{{questionList[item + Math.ceil(questionList.length/2)-1]}}
|
||||
</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 in talkingList"
|
||||
:talkingType="item.type"
|
||||
:talkingInfo="item"
|
||||
:activeVoiceId="activeVoiceTalkingItemId"
|
||||
@handleEvents="talkItemEvents"
|
||||
>
|
||||
<scroll-view class="talking-scroll-list" :scroll-y="true" :scroll-top="scrollTop"
|
||||
:show-scrollbar="false" :scroll-with-animation="false">
|
||||
<TalkingItem v-for="item in talkingList" :talkingType="item.type" :talkingInfo="item"
|
||||
:activeVoiceId="activeVoiceTalkingItemId" @handleEvents="talkItemEvents">
|
||||
</TalkingItem>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -90,36 +78,56 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<TouchBtn
|
||||
class="talk-btns"
|
||||
@uploadVoice="uploadRecordNow"
|
||||
@submitAnswer="submitAnswerNow"
|
||||
@startRecord="startRecordCallback"
|
||||
:loadingText="sendLoadingText"
|
||||
:isLoading="!answerIsOver"
|
||||
:isDisabled="false"
|
||||
/>
|
||||
<TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow"
|
||||
@startRecord="startRecordCallback" :loadingText="sendLoadingText" :isLoading="!answerIsOver"
|
||||
:isDisabled="false" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, unref, onMounted, watch, nextTick, computed } from 'vue'
|
||||
import {
|
||||
ref,
|
||||
unref,
|
||||
onMounted,
|
||||
watch,
|
||||
nextTick,
|
||||
computed
|
||||
} from 'vue'
|
||||
import common from '@/common/common';
|
||||
import TouchBtn from '@/pages/course/components/touchBtn.vue'
|
||||
import TalkingItem from './components/talking-item.vue';
|
||||
import { useSocketStore } from "@/store/socket.js"
|
||||
import { useStorageStore } from "@/store/storage.js"
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { onLoad, onShow, onUnload, onHide } from '@dcloudio/uni-app';
|
||||
import { get_base_url, goto_login_fun } from '@/api/request'
|
||||
import { getUserInfo } from '@/common/common';
|
||||
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
|
||||
} from '@/common/common';
|
||||
import {
|
||||
commonUploadVoiceFile
|
||||
} from "@/api/common.js"
|
||||
|
||||
const socketStore = useSocketStore()
|
||||
const { SocketObj } = storeToRefs(socketStore)
|
||||
const {
|
||||
SocketObj
|
||||
} = storeToRefs(socketStore)
|
||||
const userInfo = computed(() => getUserInfo())
|
||||
console.log('userInfoxxx', getUserInfo());
|
||||
const questionList = ref([
|
||||
@@ -137,11 +145,11 @@
|
||||
const scrollBoxRef = ref()
|
||||
const scrollTop = ref(99999)
|
||||
const scrollToBottomNow = (time = 100) => {
|
||||
nextTick(()=>{
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
scrollTop.value += 100
|
||||
scrollTop.value += 100
|
||||
},time)
|
||||
}, time)
|
||||
})
|
||||
}
|
||||
const activeVoiceTalkingItemId = ref('')
|
||||
@@ -154,7 +162,7 @@
|
||||
return unref(userInfo).mascotInfo?.mascotId || 'Tst00001'
|
||||
})
|
||||
const answerText = ref('')
|
||||
const answerIsOver = ref(true)
|
||||
const answerIsOver = ref(true)
|
||||
const talkingList = ref([])
|
||||
|
||||
const showModelComfirm = ref(false)
|
||||
@@ -173,34 +181,38 @@
|
||||
// }
|
||||
// })
|
||||
unref(SocketObj).on('error', () => {
|
||||
if((watchFlag.value === 1) || showModelComfirm.value) return
|
||||
if ((watchFlag.value === 1) || showModelComfirm.value) return
|
||||
showModelComfirm.value = true
|
||||
common.show('提示信息', '网络环境不稳定,请重试!',false, '','确认').then((res) => {
|
||||
common.show('提示信息', '网络环境不稳定,请重试!', false, '', '确认').then((res) => {
|
||||
common.redirectTo(`/pages/index/dialog`)
|
||||
}).finally(() => {
|
||||
showModelComfirm.value = false
|
||||
})
|
||||
})
|
||||
unref(SocketObj).on('message', (res)=>{
|
||||
const { rtnCode, body, commond } = JSON.parse(res.data)
|
||||
unref(SocketObj).on('message', (res) => {
|
||||
const {
|
||||
rtnCode,
|
||||
body,
|
||||
commond
|
||||
} = JSON.parse(res.data)
|
||||
let _id = new Date().getTime() + 'id'
|
||||
if(rtnCode === '0000'){
|
||||
if(commond === 'ASK-OPEN'){
|
||||
if(!answerIsOver.value){
|
||||
if (rtnCode === '0000') {
|
||||
if (commond === 'ASK-OPEN') {
|
||||
if (!answerIsOver.value) {
|
||||
// 问题没完成, 重新尝试回答
|
||||
sendMessage({
|
||||
"commond" : 'ASK-RE-START',
|
||||
"body" : {
|
||||
"commond": 'ASK-RE-START',
|
||||
"body": {
|
||||
reqBatch: reqBatch.value,
|
||||
seqNo: seqNo.value,
|
||||
answerContent: answerText.value
|
||||
}
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
// 新连接
|
||||
sendMessage({
|
||||
"commond" : 'ASK-START',
|
||||
"body" : {
|
||||
"commond": 'ASK-START',
|
||||
"body": {
|
||||
mascotId: mascotId.value,
|
||||
deviceImei: ''
|
||||
}
|
||||
@@ -208,14 +220,15 @@
|
||||
}
|
||||
return
|
||||
}
|
||||
if(commond === 'ASK-START'){
|
||||
if (commond === 'ASK-START') {
|
||||
// console.log('开启对话!')
|
||||
reqBatch.value = body.reqBatch
|
||||
return
|
||||
}
|
||||
if(commond === 'ASK'){
|
||||
if (commond === 'ASK') {
|
||||
console.log('发送问题成功!')
|
||||
if((talkingList.value.length > 0) && talkingList.value[talkingList.value.length-1].isLoading){
|
||||
if ((talkingList.value.length > 0) && talkingList.value[talkingList.value.length - 1]
|
||||
.isLoading) {
|
||||
talkingList.value.pop()
|
||||
}
|
||||
seqNo.value = body.seqNo
|
||||
@@ -231,19 +244,19 @@
|
||||
})
|
||||
return
|
||||
}
|
||||
if(commond === 'ASK-STOP'){
|
||||
if (commond === 'ASK-STOP') {
|
||||
// console.log('停止回答标记!')
|
||||
stopAnswerCallBack.value && stopAnswerCallBack.value(askData.value)
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
stopAnswerCallBack.value = null
|
||||
},10)
|
||||
}, 10)
|
||||
return
|
||||
}
|
||||
if(commond === 'ASK-ANSWER'){
|
||||
if(body.event === 'start'){
|
||||
if (commond === 'ASK-ANSWER') {
|
||||
if (body.event === 'start') {
|
||||
console.log('开始回答!')
|
||||
answerIsOver.value = false
|
||||
answerText.value = ''
|
||||
answerText.value = ''
|
||||
talkingList.value.push({
|
||||
type: 'answer',
|
||||
talkingText: answerText.value,
|
||||
@@ -251,112 +264,112 @@
|
||||
id: _id,
|
||||
...body
|
||||
})
|
||||
}else if(body.event === 'token'){
|
||||
} else if (body.event === 'token') {
|
||||
answerIsOver.value = false
|
||||
answerText.value += body.data
|
||||
}else if(body.event === 'end'){
|
||||
} else if (body.event === 'end') {
|
||||
console.log('完成回答!')
|
||||
answerIsOver.value = true
|
||||
}
|
||||
return
|
||||
}
|
||||
if(commond === 'ASK-RE-ANSWER'){
|
||||
if (commond === 'ASK-RE-ANSWER') {
|
||||
// console.log('开始继续回答!')
|
||||
if(body.event === 'start'){
|
||||
if (body.event === 'start') {
|
||||
answerIsOver.value = false
|
||||
answerText.value = ''
|
||||
}else if(body.event === 'token'){
|
||||
answerText.value = ''
|
||||
} else if (body.event === 'token') {
|
||||
answerIsOver.value = false
|
||||
answerText.value = body.data
|
||||
}else if(body.event === 'end'){
|
||||
} else if (body.event === 'end') {
|
||||
answerIsOver.value = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if(commond === 'ASK-ERR'){
|
||||
if (commond === 'ASK-ERR') {
|
||||
console.log('提问失败,系统异常!')
|
||||
return
|
||||
}
|
||||
}else{
|
||||
if(['0005', 'QQ0005'].includes(res.rtnCode)) {
|
||||
goto_login_fun();
|
||||
} else {
|
||||
if (['0005', 'QQ0005'].includes(res.rtnCode)) {
|
||||
goto_login_fun();
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
watchFlag.value += 1
|
||||
}
|
||||
const sendLoadingText = ref('问题回答中,请在问题回答结束后重试!')
|
||||
const reconnect = ()=> {
|
||||
if(reconnectTimer || isManualClose.value) return
|
||||
reconnectTimer = setTimeout(()=>{
|
||||
const reconnect = () => {
|
||||
if (reconnectTimer || isManualClose.value) return
|
||||
reconnectTimer = setTimeout(() => {
|
||||
initsocketTask()
|
||||
},3000)
|
||||
}, 3000)
|
||||
}
|
||||
const sendMessage = (data) => {
|
||||
unref(SocketObj).send(data)
|
||||
}
|
||||
watch(() => answerText.value,(val) => {
|
||||
if(val){
|
||||
watch(() => answerText.value, (val) => {
|
||||
if (val) {
|
||||
changeText(val)
|
||||
scrollToBottomNow()
|
||||
}
|
||||
})
|
||||
|
||||
const changeText = () => {
|
||||
if(talkingList.value.length === 0) return
|
||||
talkingList.value[talkingList.value.length-1].talkingText = answerText.value
|
||||
if (talkingList.value.length === 0) return
|
||||
talkingList.value[talkingList.value.length - 1].talkingText = answerText.value
|
||||
}
|
||||
|
||||
const stopAnswerCallBack = ref(null)
|
||||
const talkItemEvents = (type, data, id = '') => {
|
||||
switch (type){
|
||||
switch (type) {
|
||||
case 'reAnswer':
|
||||
console.log('重新获取数据')
|
||||
// 设置停止回调
|
||||
stopAnswerCallBack.value = ($data) => {
|
||||
sendMessage({
|
||||
"commond" : 'ASK',
|
||||
"body" : $data
|
||||
"commond": 'ASK',
|
||||
"body": $data
|
||||
})
|
||||
}
|
||||
// 停止获取
|
||||
sendMessage({
|
||||
"commond" : 'ASK-STOP',
|
||||
"body" : {
|
||||
"commond": 'ASK-STOP',
|
||||
"body": {
|
||||
reqBatch: reqBatch.value,
|
||||
seqNo: seqNo.value,
|
||||
}
|
||||
})
|
||||
break;
|
||||
break;
|
||||
case 'stop':
|
||||
console.log('停止获取数据')
|
||||
stopAnswerCallBack.value = null
|
||||
// ASK-STOP
|
||||
sendMessage({
|
||||
"commond" : 'ASK-STOP',
|
||||
"body" : {
|
||||
"commond": 'ASK-STOP',
|
||||
"body": {
|
||||
reqBatch: reqBatch.value,
|
||||
seqNo: seqNo.value,
|
||||
}
|
||||
})
|
||||
break;
|
||||
break;
|
||||
case 'changePlay':
|
||||
console.log('播放/暂停')
|
||||
activeVoiceTalkingItemId.value = id
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const routerTo = (type) => {
|
||||
switch(type){
|
||||
switch (type) {
|
||||
case 'AI学':
|
||||
common.switchTab('/pages/course/index')
|
||||
break;
|
||||
default:
|
||||
common.msg('页面建设中,敬请期待!')
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const scrolltolower = () => {
|
||||
@@ -371,7 +384,7 @@
|
||||
const uploadRecordNow = (voicePath) => {
|
||||
// /traask/traAskchat/voiceTrans
|
||||
//#ifndef APP-PLUS
|
||||
// h5 假数据
|
||||
// h5 假数据
|
||||
// #endif
|
||||
//#ifdef APP-PLUS
|
||||
talkingList.value.push({
|
||||
@@ -380,68 +393,90 @@
|
||||
isLoading: true
|
||||
})
|
||||
scrollToBottomNow()
|
||||
console.log(voicePath,111111111)
|
||||
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {}).then(res=>{
|
||||
console.log(voicePath, 111111111)
|
||||
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {}).then(res => {
|
||||
let _res = JSON.parse(res.data)
|
||||
if(_res.rtnCode === '0000'){
|
||||
if(!!(_res.body.transContent || '').trim()){
|
||||
if (_res.rtnCode === '0000') {
|
||||
if (!!(_res.body.transContent || '').trim()) {
|
||||
askData.value = {
|
||||
reqBatch: reqBatch.value,
|
||||
intrctWay: '02',//01-文本;02-语音;03-图片
|
||||
intrctWay: '02', //01-文本;02-语音;03-图片
|
||||
intrctContent: _res.body.transContent,
|
||||
bucketKey: _res.body.fileId,
|
||||
bucketKey: _res.body.fileId,
|
||||
ossFileAddr: _res.body.ossFileAddr,
|
||||
talkingVoice: voicePath
|
||||
}
|
||||
sendMessage({
|
||||
"commond" : 'ASK',
|
||||
"commond": 'ASK',
|
||||
"body": askData.value
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
talkingList.value.pop()
|
||||
uni.showToast({
|
||||
title: '语音内容不能为空!',
|
||||
title: '未识别到文字!',
|
||||
icon: "none",
|
||||
duration:1000
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
}else{}
|
||||
}).catch(err=>{
|
||||
} else {}
|
||||
}).catch(err => {
|
||||
talkingList.value.pop()
|
||||
uni.showToast({
|
||||
title: '系统异常,请联系管理员',
|
||||
icon: "none",
|
||||
duration:1000
|
||||
duration: 1000
|
||||
});
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
// 发送文本
|
||||
const submitAnswerNow = (val, cb = null) => {
|
||||
if(!answerIsOver.value){
|
||||
if (!answerIsOver.value) {
|
||||
// 问题回答中
|
||||
return
|
||||
}
|
||||
touchBtnCallBack.value = cb
|
||||
askData.value = {
|
||||
reqBatch: reqBatch.value,
|
||||
intrctWay: '01',//01-文本;02-语音;03-图片
|
||||
intrctWay: '01', //01-文本;02-语音;03-图片
|
||||
intrctContent: val,
|
||||
bucketKey:''
|
||||
bucketKey: ''
|
||||
}
|
||||
sendMessage({
|
||||
"commond" : 'ASK',
|
||||
"body" : askData.value
|
||||
"commond": 'ASK',
|
||||
"body": askData.value
|
||||
})
|
||||
}
|
||||
const startRecordCallback = () => {
|
||||
// 开始录音回调
|
||||
}
|
||||
const watchFlag = ref(1)
|
||||
onMounted(()=>{
|
||||
|
||||
onBackPress((options) => {
|
||||
const from = options.from
|
||||
if (from === 'backbutton') {
|
||||
// 判断上一级是否是登录,是登录就返回两层跳过登录页
|
||||
const pages = getCurrentPages();
|
||||
if (pages && pages.length > 1) {
|
||||
const page = pages[pages.length - 2];
|
||||
if (page.route === 'pages/login/login') {
|
||||
console.log('进来了');
|
||||
if (pages.length == 2) {
|
||||
common.switchTab('/pages/index/index');
|
||||
} else {
|
||||
common.navigateBack(2)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
initsocketTask()
|
||||
})
|
||||
onHide(()=>{
|
||||
onHide(() => {
|
||||
// if(watchFlag.value === 1) return
|
||||
// // 停止获取
|
||||
// sendMessage({
|
||||
@@ -453,46 +488,52 @@
|
||||
// })
|
||||
// socketStore?.closeSocket()
|
||||
})
|
||||
onShow(()=>{
|
||||
if(watchFlag.value === 1) return
|
||||
onShow(() => {
|
||||
if (watchFlag.value === 1) return
|
||||
// initsocketTask()
|
||||
|
||||
})
|
||||
onUnload(()=>{
|
||||
onUnload(() => {
|
||||
watchFlag.value = 1
|
||||
socketStore?.closeSocket()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.index-dialog-page{
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
.top-bg{
|
||||
background: linear-gradient(16deg,rgba(234,246,255,0) 0%,#c3e6ff 100%);
|
||||
.index-dialog-page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.top-bg {
|
||||
background: linear-gradient(16deg, rgba(234, 246, 255, 0) 0%, #c3e6ff 100%);
|
||||
height: 480rpx;
|
||||
width: 100%;
|
||||
}
|
||||
.bot-bg{
|
||||
|
||||
.bot-bg {
|
||||
// background-color: #F6F8FF;
|
||||
background: linear-gradient(136deg,rgba(234,246,255,0) 0%,#c3e6ff 100%);
|
||||
background: linear-gradient(136deg, rgba(234, 246, 255, 0) 0%, #c3e6ff 100%);
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
.index-dialog-body{
|
||||
|
||||
.index-dialog-body {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
left:0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
top: 0%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
.body-title{
|
||||
.body-title {
|
||||
height: 140rpx;
|
||||
text-align: center;
|
||||
font-size: 33rpx;
|
||||
@@ -500,18 +541,19 @@
|
||||
line-height: 46rpx;
|
||||
box-sizing: border-box;
|
||||
font-weight: 500;
|
||||
color:#000;
|
||||
color: #000;
|
||||
position: relative;
|
||||
|
||||
// margin-bottom: 23rpx;
|
||||
.arrow-icon{
|
||||
.arrow-icon {
|
||||
position: absolute;
|
||||
left:36rpx;
|
||||
top:80rpx;
|
||||
left: 36rpx;
|
||||
top: 80rpx;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
.seek-setting{
|
||||
.seek-setting {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
right: 45rpx;
|
||||
@@ -525,14 +567,15 @@
|
||||
text-align: right;
|
||||
padding-right: 48rpx;
|
||||
|
||||
.image-icon{
|
||||
.image-icon {
|
||||
width: 30rpx;
|
||||
height: 32rpx;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 10rpx;
|
||||
}
|
||||
.image-icon-new{
|
||||
|
||||
.image-icon-new {
|
||||
right: 50rpx;
|
||||
width: 30rpx;
|
||||
height: 32rpx;
|
||||
@@ -541,7 +584,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.ai-info{
|
||||
.ai-info {
|
||||
padding: 0 24rpx;
|
||||
height: 250rpx;
|
||||
overflow: hidden;
|
||||
@@ -549,7 +592,8 @@
|
||||
margin-bottom: 24rpx;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
.image-pet{
|
||||
|
||||
.image-pet {
|
||||
width: 230rpx;
|
||||
height: 235rpx;
|
||||
position: absolute;
|
||||
@@ -557,7 +601,8 @@
|
||||
top: 15rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.image-pet-bg{
|
||||
|
||||
.image-pet-bg {
|
||||
position: absolute;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
@@ -567,7 +612,8 @@
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
.ai-info-bg-box{
|
||||
|
||||
.ai-info-bg-box {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
left: 0;
|
||||
@@ -576,20 +622,23 @@
|
||||
// background-color: #ccc;
|
||||
padding: 0 64rpx;
|
||||
height: 178rpx;
|
||||
.hello-text{
|
||||
|
||||
.hello-text {
|
||||
height: 54rpx;
|
||||
line-height: 44rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
.info-text{
|
||||
|
||||
.info-text {
|
||||
height: 44rpx;
|
||||
line-height: 44rpx;
|
||||
font-size: 32rpx;
|
||||
color: #000;
|
||||
font-weight: 600;
|
||||
}
|
||||
.info-btn{
|
||||
|
||||
.info-btn {
|
||||
width: 220rpx;
|
||||
font-size: 29rpx;
|
||||
height: 54rpx;
|
||||
@@ -605,39 +654,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
.questions-view{
|
||||
.questions-view {
|
||||
padding-left: 24rpx;
|
||||
padding-right: 24rpx;
|
||||
height: 184rpx;
|
||||
box-sizing: border-box;
|
||||
.question-row{
|
||||
|
||||
.question-row {
|
||||
white-space: nowrap;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.question-item{
|
||||
|
||||
.question-item {
|
||||
white-space: nowrap;
|
||||
height: 76rpx;
|
||||
line-height: 74rpx;
|
||||
height: 66rpx;
|
||||
line-height: 66rpx;
|
||||
background-color: #fff;
|
||||
border: 2rpx solid #e0dede;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 11rpx;
|
||||
margin-right: 16rpx;
|
||||
display: inline-block;
|
||||
&:last-child{
|
||||
font-size: 26rpx;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.router-list{
|
||||
.router-list {
|
||||
height: 84rpx;
|
||||
padding: 22rpx 30rpx 0;
|
||||
background-color: #fff;
|
||||
border-radius: 15rpx 15rpx 0 0;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
.btns-item{
|
||||
|
||||
.btns-item {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
height: 62rpx;
|
||||
@@ -648,28 +701,41 @@
|
||||
line-height: 58rpx;
|
||||
font-size: 29rpx;
|
||||
position: relative;
|
||||
.image-icon{
|
||||
|
||||
.image-icon {
|
||||
position: absolute;
|
||||
width: 31rpx;
|
||||
height: 31rpx;
|
||||
top:50%;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
left: 24rpx;
|
||||
}
|
||||
&:last-child{
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.talking-list{
|
||||
height: calc(100% - 834rpx);
|
||||
.talking-list {
|
||||
height: calc(100% - 832rpx);
|
||||
padding: 12rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
.talking-scroll-list{
|
||||
|
||||
.talking-scroll-list {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.talking-list {
|
||||
height: calc(100% - 832rpx);
|
||||
padding: 12rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.talking-scroll-list {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -225,6 +225,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {
|
||||
computed,
|
||||
onBeforeMount,
|
||||
@@ -255,6 +256,7 @@
|
||||
queryCrsInfoByPopular,
|
||||
queryCrsInfoByRecmd,
|
||||
} from '@/api/index.js'
|
||||
|
||||
const scrollTop = ref(0);
|
||||
const stdtTmLenRef = ref(null);
|
||||
const accmPracticeCntRef = ref(null);
|
||||
@@ -275,6 +277,9 @@
|
||||
onPageScroll((e) => {
|
||||
scrollTop.value = e.scrollTop
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 滚动消息
|
||||
const notice_text = ref(['绿色金融政策解析与商业银行绿色水水水水水水水水水水水水水', '绿色金融政策解析与商业银行红色'])
|
||||
const init_class_data = [{
|
||||
@@ -377,18 +382,17 @@
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
setMascot()
|
||||
const userInfo = getUserInfo()
|
||||
if(userInfo) {
|
||||
mascotInfo.value = userInfo?.mascotInfo
|
||||
console.log('是', mascotInfo.value);
|
||||
}
|
||||
if (!common.isLogin()) {
|
||||
common.navigateTo('/pages/login/login')
|
||||
return
|
||||
}
|
||||
|
||||
setMascot()
|
||||
const userInfo = getUserInfo()
|
||||
if(userInfo) {
|
||||
mascotInfo.value = userInfo?.mascotInfo
|
||||
}
|
||||
statistics_data['get_statistics_data']() // 获取统计数据
|
||||
if (!common.isLogin()) return;
|
||||
queryCrsInfoByLastnew().then(res => {
|
||||
new_class_list.value = res.body
|
||||
})
|
||||
@@ -708,6 +712,7 @@
|
||||
.study_duration_div {
|
||||
height: 162rpx;
|
||||
background: linear-gradient(180deg, rgba(238, 246, 255, 0.65) 0%, #C5DFFD 4%, #FFFFFF 100%);
|
||||
|
||||
border-radius: 23rpx;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
@@ -719,7 +724,6 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.top {
|
||||
font-family: PingFangSC, PingFang SC;
|
||||
font-weight: 400;
|
||||
|
||||
@@ -116,13 +116,23 @@ const login_fun = (): void => {
|
||||
// 页面栈只有一页,没有返回页,那就返回首页
|
||||
console.log('返回登录的上一页');
|
||||
back_state.value = false;
|
||||
common.navigateBack(); // 返回登录的上一页
|
||||
//如果上一页是首页,就返回弹出页
|
||||
const page = pages[pages.length - 2];
|
||||
console.log('page.route', page.route);
|
||||
if (page.route === 'pages/index/index') {
|
||||
common.navigateTo('/pages/index/dialog', {animationType: 'slide-in-bottom'});
|
||||
} else {
|
||||
common.navigateBack(); // 返回登录的上一页
|
||||
}
|
||||
|
||||
} else {
|
||||
common.switchTab('/pages/index/index');
|
||||
// common.switchTab('/pages/index/index');
|
||||
|
||||
common.navigateTo('/pages/index/dialog', {animationType: 'slide-in-bottom'});
|
||||
// common.redirectTo('/pages/index/dialog', {animationType: 'slide-in-bottom'});
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((res) => {
|
||||
}).catch((res) => {
|
||||
console.log(res);
|
||||
common.hideLoading();
|
||||
if (res.rtnCode === '0002') {
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
</view>
|
||||
<!-- 4个导航 -->
|
||||
<view class="navigation_div">
|
||||
<!-- <scroll-view class="scroll-view" :scroll-x="true" :show-scrollbar="false"> -->
|
||||
<view class="group">
|
||||
<view class="item">
|
||||
<image class="icon" src="@/static/images/me/study.png"></image>
|
||||
@@ -77,6 +78,7 @@
|
||||
<view class="title">我的报告</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- </scroll-view> -->
|
||||
</view>
|
||||
<view class="cell_div">
|
||||
<uv-cell-group :border="false">
|
||||
|
||||
@@ -62,14 +62,15 @@
|
||||
}
|
||||
|
||||
.fixed_search_div {
|
||||
padding: calc(10rpx + var(--status-bar-height)) 15rpx 24rpx 30rpx;
|
||||
padding: calc(10rpx + var(--status-bar-height)) 15rpx 24rpx 10rpx;
|
||||
background: linear-gradient(90deg, #F1F7FF 0%, #D8EDFF 50%, #C3E6FF 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.back_div {
|
||||
margin-right: 10rpx;
|
||||
|
||||
// margin-right: 10rpx;
|
||||
padding: 10rpx 10rpx 10rpx 20rpx;
|
||||
// background-color: red;
|
||||
.back-icon {
|
||||
position: relative;
|
||||
width: 40rpx;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.6 KiB |
Reference in New Issue
Block a user