diff --git a/.env.development b/.env.development index 4750d846..83cf2831 100644 --- a/.env.development +++ b/.env.development @@ -2,10 +2,6 @@ ENV = 'development' # 'development' -VITE_APP_ENV = 'AND' - -# base api - # 苗扬 # VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786' diff --git a/.env.production b/.env.production index c5649d8c..22641718 100644 --- a/.env.production +++ b/.env.production @@ -1,8 +1,5 @@ # 生产环境 ENV = 'production' -VITE_APP_ENV = 'AND' - # base api - VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' diff --git a/.env.sit b/.env.sit index 4b66d147..9623af29 100644 --- a/.env.sit +++ b/.env.sit @@ -1,8 +1,6 @@ # SIT环境 ENV = 'sit' -VITE_APP_ENV = 'AND' # base api - VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' diff --git a/.env.sit-ios b/.env.sit-ios deleted file mode 100644 index 2bd04f76..00000000 --- a/.env.sit-ios +++ /dev/null @@ -1,8 +0,0 @@ -# SIT环境 -ENV = 'sit' - -VITE_APP_ENV = 'IOS' - -# base api - -VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' diff --git a/.env.uat b/.env.uat index b953bca8..c0c4b2ff 100644 --- a/.env.uat +++ b/.env.uat @@ -1,8 +1,5 @@ # UAT环境 ENV = 'uat' -VITE_APP_ENV = 'AND' - # base api - VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7003' diff --git a/.env.uat-ios b/.env.uat-ios deleted file mode 100644 index cbf3ee5a..00000000 --- a/.env.uat-ios +++ /dev/null @@ -1,8 +0,0 @@ -# UAT环境 -ENV = 'uat' - -VITE_APP_ENV = 'IOS' - -# base api - -VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7003' diff --git a/README.en.md b/README.en.md index 85462a72..53639d47 100644 --- a/README.en.md +++ b/README.en.md @@ -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/ \ No newline at end of file +npm config set registry http://25.12.10.69:8081/repository/aliyun-npm/ + diff --git a/src/api/common.js b/src/api/common.js index baf0375f..61154a68 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -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) diff --git a/src/api/study.js b/src/api/study.js index df818e4e..ef123a57 100644 --- a/src/api/study.js +++ b/src/api/study.js @@ -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 + }); }; \ No newline at end of file diff --git a/src/common/common.js b/src/common/common.js index 582e668e..3f621653 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -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; +}; // 将对象和字符串相互转换 diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index 43b5ec4e..b2d61564 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -3,11 +3,11 @@ - + - {{ dataInfo?.userInfo?.teacherName }} - {{dataInfo?.userInfo?.teacherDesc}} + {{ teacherInfo?.teacherName }} + {{teacherInfo?.teacherDesc}} @@ -88,11 +88,11 @@ @@ -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 }) diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index 2aa9db6b..6e957d9d 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -13,7 +13,7 @@ placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入答案"> - + @@ -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 }) diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index c9c8a447..5c19da10 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -5,7 +5,7 @@ {{chooseRate}}倍 - + @@ -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)" /> @@ -103,15 +105,22 @@ - + 设置 - - {{item}} + + + 音色 + + + + + + {{item.teacherName}} + + + + @@ -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; + } + } + } + } + } } } diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index 64a244e7..6c0ded28 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -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);