Merge branch 'develop' into 'sit'

Develop

See merge request K17_AITS/tra-app!31
This commit is contained in:
田岩
2025-07-16 09:51:23 +08:00
14 changed files with 170 additions and 67 deletions
-4
View File
@@ -2,10 +2,6 @@
ENV = 'development'
# 'development'
VITE_APP_ENV = 'AND'
# base api
# 苗扬
# VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786'
-3
View File
@@ -1,8 +1,5 @@
# 生产环境
ENV = 'production'
VITE_APP_ENV = 'AND'
# base api
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
-2
View File
@@ -1,8 +1,6 @@
# SIT环境
ENV = 'sit'
VITE_APP_ENV = 'AND'
# base api
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
-8
View File
@@ -1,8 +0,0 @@
# SIT环境
ENV = 'sit'
VITE_APP_ENV = 'IOS'
# base api
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
-3
View File
@@ -1,8 +1,5 @@
# UAT环境
ENV = 'uat'
VITE_APP_ENV = 'AND'
# base api
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7003'
-8
View File
@@ -1,8 +0,0 @@
# UAT环境
ENV = 'uat'
VITE_APP_ENV = 'IOS'
# base api
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7003'
+2 -1
View File
@@ -2,4 +2,5 @@ npm install --registry=http://25.12.10.69:8081/repository/aliyun-npm/
npm 淘宝源下载 npm config set registry https://registry.npmmirror.com
npm config set registry http://25.12.10.69:8081/repository/aliyun-npm/
npm config set registry http://25.12.10.69:8081/repository/aliyun-npm/
+1 -1
View File
@@ -144,7 +144,7 @@ export function downloadVoiceFile(url) {
let baseUrl = get_base_url();
return new Promise((resolve, reject) => {
uni.downloadFile({
url: `${baseUrl}${url}`,
url: `${baseUrl}${url}`,
header,
success(result) {
console.log(result)
+10
View File
@@ -156,4 +156,14 @@ export const textChartApi = (data) => {
toastErrors: true,
data
});
};
// 设置学习顾问音色/traStdyTeacher/setStudyTeacher
export const setStudyTeacherApi = (data) => {
return request({
url: base_url + '/traStdyTeacher/setStudyTeacher',
method: 'post',
toastErrors: true,
data
});
};
+18 -3
View File
@@ -1,6 +1,4 @@
const _ENV = import.meta.env
function msg(title, duration = 1000) {
uni.showToast({
title: title,
@@ -116,7 +114,24 @@ export const getUserInfo = (key = '') => {
const userInfo = uni.getStorageSync('userInfo')
return '' === key ? userInfo : userInfo[key];
}
export const getPhoneEnvBool = (flag) => _ENV.VITE_APP_ENV === flag
/**
* 判断当前运行平台是否匹配指定标识
* @param {string} flag - 平台标识:'IOS' 表示苹果iOS平台,'AND' 表示安卓平台
* @returns {boolean} 如果当前平台匹配指定标识返回true,否则返回false
*/
export const getPhoneEnvBool = (flag) => {
// 获取当前设备的平台信息
const { platform } = uni.getSystemInfoSync();
// 平台与标识的映射关系
const platformMap = {
ios: 'IOS',
android: 'AND',
};
// 根据当前平台返回匹配结果
return platformMap[platform] === flag;
};
// 将对象和字符串相互转换
+25 -13
View File
@@ -3,11 +3,11 @@
<view :class="['ai-answer', props.class]" :id="props.id" v-if="[3,4,5].indexOf(type) >= 0">
<view class="user-info">
<view class="avatar-box">
<ImagePreview class="img-box" :imgId="dataInfo?.userInfo?.imgAddr"></ImagePreview>
<ImagePreview class="img-box" :imgId="teacherInfo?.imgAddr"></ImagePreview>
</view>
<view class="ai-name">
{{ dataInfo?.userInfo?.teacherName }}
<view class="ai-name-desc">{{dataInfo?.userInfo?.teacherDesc}}</view>
{{ teacherInfo?.teacherName }}
<view class="ai-name-desc">{{teacherInfo?.teacherDesc}}</view>
</view>
</view>
<view :class="['talking-info', [4].indexOf(type) >= 0 ? 'talking-info-less':''] ">
@@ -88,11 +88,11 @@
<view :class="['ai-answer', props.class]" :id="props.id" v-if="[7].indexOf(type) >= 0">
<view class="user-info">
<view class="avatar-box">
<ImagePreview class="img-box" :imgId="dataInfo?.userInfo?.imgAddr"></ImagePreview>
<ImagePreview class="img-box" :imgId="teacherInfo?.imgAddr"></ImagePreview>
</view>
<view class="ai-name">
{{ dataInfo?.userInfo?.teacherName }}
<view class="ai-name-desc">{{dataInfo?.userInfo?.teacherDesc}}</view>
{{ teacherInfo?.teacherName }}
<view class="ai-name-desc">{{teacherInfo?.teacherDesc}}</view>
</view>
</view>
<view :class="['talking-info', [4,7].indexOf(type) >= 0 ? 'talking-info-less':''] ">
@@ -205,6 +205,10 @@ const audioCacheObj = computed(() => storageStore.audioObj)
default: () => ({}),
type: Object
},
teacherInfo: {
default: () => ({}),
type: Object
},
activeVoiceId:{
default:'',
type: String
@@ -239,12 +243,13 @@ const audioCacheObj = computed(() => storageStore.audioObj)
}
})
const { type, dataInfo, activeVoiceId, isPlaying, isLast, lastQuestionInfo} = toRefs(props)
const { type, dataInfo, activeVoiceId, isPlaying, isLast, lastQuestionInfo, teacherInfo} = toRefs(props)
const emit = defineEmits(['changePlay', 'nextQuestion', 'withdraw', 'finishQuestion'])
// 声音播放初始化
const talkVoiceObj = ref(uni.createInnerAudioContext())
talkVoiceObj.value.playbackRate = Number(props.voiceRate)
const userInfo = computed(() => getUserInfo())
const itemVoice = ref('')
const showWithdraw = computed(()=>{
let _isMe = unref(lastQuestionInfo).qnsLogId === unref(dataInfo).qnsLogId
@@ -253,6 +258,13 @@ const audioCacheObj = computed(() => storageStore.audioObj)
})
const voiceLoading = ref(false)
watch(() => props.teacherInfo,(val) => {
itemVoice.value = ''
talkVoiceObj.value.src = ''
},{
deep: true,
immediate: true
})
watch(() => props.isPlaying,(val) => {
if(!val){
talkVoiceObj.value?.pause()
@@ -311,7 +323,6 @@ const audioCacheObj = computed(() => storageStore.audioObj)
talkVoiceObj.value.src = ''
})
talkVoiceObj.value.onError(()=>{
emit('changePlay', '')
talkVoiceObj.value.src = ''
})
const pauseVoice = () => {
@@ -333,19 +344,20 @@ const audioCacheObj = computed(() => storageStore.audioObj)
playVoice()
}
}
const itemVoice = ref('')
const playVoice = (readType = 'pgth') =>{
let _content = showContent.value
if(!_content){
common.msg('没有可以播放的文字信息!')
return
}
emit('changePlay', unref(dataInfo)?.id)
// readType 阅读内容类型pgrh段落/qns问题
emit('changePlay', unref(dataInfo)?.id)
if(talkVoiceObj.value.src && talkVoiceObj.value.src === itemVoice.value) {
emit('changePlay', unref(dataInfo)?.id)
talkVoiceObj.value.play()
return
}
talkVoiceObj.value.src = ''
if(itemVoice.value){
setTimeout(()=>{
talkVoiceObj.value.src = itemVoice.value
@@ -358,14 +370,14 @@ const audioCacheObj = computed(() => storageStore.audioObj)
pgrphId: unref(dataInfo)?.pgrphId || '',
qnsId: unref(dataInfo)?.qnsId || '',
readType: readType,
teachNo: unref(dataInfo)?.userInfo?.teacherNo, // 必填
teachNo: unref(teacherInfo)?.teacherNo, // 必填
content: _content
}
let _url = '/trastudy/traStdyInfo/readContent?' + Object.keys(_params).map(t=>{
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t])
}).join('&')
storageStore.getStorageById('audio', _url, (url)=>{
storageStore.getStorageById('audio', _url + _params.teachNo, (url)=>{
if(url){
voiceLoading.value = false
itemVoice.value = url
@@ -381,7 +393,7 @@ const audioCacheObj = computed(() => storageStore.audioObj)
itemVoice.value = res.tempFilePath
talkVoiceObj.value.src = res.tempFilePath
talkVoiceObj.value.play()
storageStore.setStorage('audio', _url, itemVoice.value)
storageStore.setStorage('audio', _url + _params.teachNo, itemVoice.value)
}).catch((err)=>{
voiceLoading.value = false
})
+13 -6
View File
@@ -13,7 +13,7 @@
placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入答案">
</uv-input>
</view>
<view class="talk-btn-box" @click.stop="showKeyboard">
<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>
@@ -46,19 +46,26 @@ const proxy = getCurrentInstance()
const emit = defineEmits(['uploadVoice', 'submitAnswer','startRecord'])
const props = defineProps({
isDisabled:{
default: Boolean,
type: true
default: true,
type: Boolean
},
isLoading:{
default: false,
type: Boolean
},
onlyVoice:{
default: false,
type: Boolean
}
},
})
const { isDisabled } = toRefs(props)
const { isDisabled, onlyVoice } = toRefs(props)
const isLoadingState = computed(() => props.isLoading)
watch(()=>props.isLoading,()=>{},{
deep:true,immediate:true
})
watch(()=>props.onlyVoice,()=>{},{
deep:true,immediate:true
})
const showTalkingModel = ref(false)
const keyboardIsShow = ref(false)
const answerValue = ref('')
@@ -235,7 +242,7 @@ const showKeyboard = () => {
}
}else{
uni.showToast({
title: '请先获取问题信息',
title: '暂无问题需要回答',
icon: "none",
duration:1000
})
+100 -14
View File
@@ -5,7 +5,7 @@
<view class="course-study-body" v-show="step === 1">
<view class="seek-setting">
<view class="inline-block" @click="showChangeSeekModelNow">{{chooseRate}}</view>
<image src="@/static/images/course/setting.png" alt="" class="image-icon" @click.stop="showChangeBgModelNow"></image>
<!-- <image src="@/static/images/course/setting.png" alt="" class="image-icon" @click.stop="showChangeBgModelNow"></image> -->
</view>
<view class="body-title">
<uv-icon class="arrow-icon" name="arrow-left" @click="backRouter()"/>
@@ -67,6 +67,7 @@
:isPlaying="activeVoiceTalkingItemId === item.id"
:voiceRate="chooseRate"
:lastQuestionInfo="lastTalkingInfo"
:teacherInfo="choiceTeacherInfo"
@changePlay="changePlayItemId"
@nextQuestion="nextQuestionSuccess"
@withdraw="withdrawNow"
@@ -83,6 +84,7 @@
@submitAnswer="submitAnswerNow"
@startRecord="changePlayItemId('')"
:isLoading="isUploadingVoice"
:onlyVoice="answerOnlyVoice"
:isDisabled="((lastTalkingInfo.type||0) !== 4)"
/>
</view>
@@ -103,15 +105,22 @@
</uv-overlay>
<uv-overlay :show="showBgModel" opacity=".6" @click="showBgModel = false">
<view class="overlay-box">
<view class="white-bg-box">
<view class="white-bg-box-setting white-bg-box">
<view class="box-title">设置
</view>
<view class="box-btns">
<view
v-for="item in rateList"
:class="{'is-active':item === chooseRate}"
@click="chooseRateNow(item)"
>{{item}}</view>
<view class="box-items" @click.stop>
<view class="box-item">
<view class="box-item-title">音色</view>
<uv-radio-group v-model="choiceTeacher" class="box-item-cont">
<view class="overlay-voice-item" v-for="item in teacherList" :key="item.teacherNo" @click="changeTeacherVoiceNow(item)">
<view class="overlay-avatar-box">
<ImagePreview class="overlay-img-box" :src="item.imgAddr" :isCache="true" :width="120" :height="160"></ImagePreview>
</view>
<view class="overlay-teacher-name">{{item.teacherName}}</view>
<uv-radio :name="item.teacherNo" class="overlay-radio-box" @click.stop/>
</view>
</uv-radio-group>
</view>
</view>
</view>
</view>
@@ -135,7 +144,8 @@ import {
getCourseStudyInfoApi,
afreshStudyCourseApi,
queryQuestionEvalateApi,
textChartApi
textChartApi,
setStudyTeacherApi
} from "@/api/study.js"
import common from '@/common/common';
import TalkingItem from '@/pages/course/components/talkingItem.vue'
@@ -244,20 +254,38 @@ const showChangeSeekModelNow = () => {
}
const showBgModel = ref(false)
const showChangeBgModelNow = () => {
changePlayItemId()
showBgModel.value = true
}
// 关闭播放状态
const changePlayItemId = (id = '') => {
if(activeVoiceTalkingItemId.value === id){
activeVoiceTalkingItemId.value = ''
}else{
activeVoiceTalkingItemId.value = id
}
activeVoiceTalkingItemId.value = id
// if(activeVoiceTalkingItemId.value === id){
// activeVoiceTalkingItemId.value = ''
// }else{
// activeVoiceTalkingItemId.value = id
// }
}
// 选择的教师对象信息
const choiceTeacherInfo = computed(()=>{
return teacherList.value.find(t=> t.teacherNo === choiceTeacher.value)
})
const changeTeacherVoiceNow = async (item) => {
if(item.teacherNo === choiceTeacher.value) return
try{
const res = await setStudyTeacherApi({
stdyId: stdyId.value,
teacherNo: item.teacherNo
})
console.log(res)
if(res.rtnCode === '0000'){
choiceTeacher.value = item.teacherNo
showBgModel.value = false
}
}catch{} finally{}
}
// 选择教师语音对象
const activeVoiceTeachNo = ref('')
let teacherVoiceObj = uni.createInnerAudioContext()
@@ -322,6 +350,11 @@ const isLastPgrph = ref(false)
const backRouter = ()=>{
common.redirectTo(`/pages/courseDetail/index?crsId=${crsId.value}&crsNum=${crsNum.value}&from=study`)
}
const answerOnlyVoice = computed(()=>{
return lastTalkingInfo.value.answerWay === 'V'
})
// 获取段落
const getGraphInfoUnStudy = (flag = 0) => {
console.log(isLastPgrph.value)
@@ -1162,6 +1195,10 @@ const chooseRateNow = (item) => {
overflow: hidden;
border-radius: 32rpx 32rpx 0 0;
padding: 58rpx 36rpx;
&.white-bg-box-setting{
height: auto;
min-height: 400rpx;
}
.box-title{
font-size: 32rpx;
font-weight: bold;
@@ -1178,6 +1215,55 @@ const chooseRateNow = (item) => {
color: #06f;
}
}
.box-items{
.box-item{
margin-bottom: 20rpx;
overflow: hidden;
.box-item-title{
width: 86rpx;
height: 100%;
float: left;
overflow: hidden;
color: #666;
font-size: 28rpx;
}
.box-item-cont{
display: block;
float: left;
width: calc(100% - 86rpx);
overflow: hidden;
.overlay-voice-item{
width: 123rpx;
float: left;
position: relative;
margin-bottom: 30rpx;
&:not(:nth-child(3n)){
margin-right: 100rpx;
}
.overlay-avatar-box{
width: 123rpx;
height: 123rpx;
border-radius: 50%;
overflow: hidden;
box-shadow: 1rpx 0rpx 5rpx #ccc;
}
.overlay-teacher-name{
width: 123rpx;
text-align: center;
height: 58rpx;
line-height: 58rpx;
font-size: 28rpx;
}
.overlay-radio-box{
position: absolute;
left: 100rpx;
top: 5rpx;
pointer-events: none;
}
}
}
}
}
}
}
+1 -1
View File
@@ -60,7 +60,7 @@ import { encryptByAES } from '@/api/encryptAndDecryptData.js';
import { useSocketStore } from '@/store/socket.js';
import { storeToRefs } from 'pinia';
import {getPhoneEnvBool} from '@/common/common.js'
const socketStore = useSocketStore();
const { taskSocket } = storeToRefs(socketStore);