Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop
This commit is contained in:
Generated
+32
-119
@@ -25,7 +25,7 @@
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4060620250520001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4060620250520001",
|
||||
"crypto-js": "^3.1.9-1",
|
||||
"pinia": "^3.0.3",
|
||||
"pinia": "^2.3.1",
|
||||
"terser": "^5.42.0",
|
||||
"uuid": "^11.1.0",
|
||||
"vue": "^3.5.11",
|
||||
@@ -4696,30 +4696,6 @@
|
||||
"integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@vue/devtools-kit": {
|
||||
"version": "7.7.7",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/@vue/devtools-kit/-/devtools-kit-7.7.7.tgz",
|
||||
"integrity": "sha512-wgoZtxcTta65cnZ1Q6MbAfePVFxfM+gq0saaeytoph7nEa7yMXoi6sCPy4ufO111B9msnw0VOWjPEFCXuAKRHA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-shared": "^7.7.7",
|
||||
"birpc": "^2.3.0",
|
||||
"hookable": "^5.5.3",
|
||||
"mitt": "^3.0.1",
|
||||
"perfect-debounce": "^1.0.0",
|
||||
"speakingurl": "^14.0.1",
|
||||
"superjson": "^2.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/devtools-shared": {
|
||||
"version": "7.7.7",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/@vue/devtools-shared/-/devtools-shared-7.7.7.tgz",
|
||||
"integrity": "sha512-+udSj47aRl5aKb0memBvcUG9koarqnxNM5yjuREvqwK6T3ap4mn3Zqqc17QrBFTqSMjr3HK1cvStEZpMDpfdyw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"rfdc": "^1.4.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/reactivity": {
|
||||
"version": "3.5.17",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/@vue/reactivity/-/reactivity-3.5.17.tgz",
|
||||
@@ -5267,15 +5243,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/birpc": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/birpc/-/birpc-2.4.0.tgz",
|
||||
"integrity": "sha512-5IdNxTyhXHv2UlgnPHQ0h+5ypVmkrYHzL8QT+DwFZ//2N/oNV8Ch+BCRmTJ3x6/z9Axo/cXYBc9eprsUVK/Jsg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
}
|
||||
},
|
||||
"node_modules/bmp-js": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/bmp-js/-/bmp-js-0.1.0.tgz",
|
||||
@@ -5778,21 +5745,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/copy-anything": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/copy-anything/-/copy-anything-3.0.5.tgz",
|
||||
"integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-what": "^4.1.8"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.13"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/mesqueeb"
|
||||
}
|
||||
},
|
||||
"node_modules/core-js": {
|
||||
"version": "3.43.0",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/core-js/-/core-js-3.43.0.tgz",
|
||||
@@ -6961,12 +6913,6 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/hookable": {
|
||||
"version": "5.5.3",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/hookable/-/hookable-5.5.3.tgz",
|
||||
"integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/html-encoding-sniffer": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz",
|
||||
@@ -7294,18 +7240,6 @@
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/is-what": {
|
||||
"version": "4.1.16",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/is-what/-/is-what-4.1.16.tgz",
|
||||
"integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.13"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/mesqueeb"
|
||||
}
|
||||
},
|
||||
"node_modules/isbinaryfile": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/isbinaryfile/-/isbinaryfile-5.0.4.tgz",
|
||||
@@ -8687,12 +8621,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/mitt": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/mitt/-/mitt-3.0.1.tgz",
|
||||
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/mkdirp/-/mkdirp-0.5.6.tgz",
|
||||
@@ -9078,12 +9006,6 @@
|
||||
"integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/perfect-debounce": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
|
||||
"integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/phin": {
|
||||
"version": "2.9.3",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/phin/-/phin-2.9.3.tgz",
|
||||
@@ -9119,12 +9041,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/pinia": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/pinia/-/pinia-3.0.3.tgz",
|
||||
"integrity": "sha512-ttXO/InUULUXkMHpTdp9Fj4hLpD/2AoJdmAbAeW2yu1iy1k+pkFekQXw5VpC0/5p51IOR/jDaDRfRWRnMMsGOA==",
|
||||
"version": "2.3.1",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/pinia/-/pinia-2.3.1.tgz",
|
||||
"integrity": "sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-api": "^7.7.2"
|
||||
"@vue/devtools-api": "^6.6.3",
|
||||
"vue-demi": "^0.14.10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/posva"
|
||||
@@ -9139,15 +9062,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pinia/node_modules/@vue/devtools-api": {
|
||||
"version": "7.7.7",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/@vue/devtools-api/-/devtools-api-7.7.7.tgz",
|
||||
"integrity": "sha512-lwOnNBH2e7x1fIIbVT7yF5D+YWhqELm55/4ZKf45R9T8r9dE2AIOy8HKjfqzGsoTHFbWbr337O4E0A0QADnjBg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-kit": "^7.7.7"
|
||||
}
|
||||
},
|
||||
"node_modules/pirates": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/pirates/-/pirates-4.0.7.tgz",
|
||||
@@ -9798,12 +9712,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/rfdc": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/rfdc/-/rfdc-1.4.1.tgz",
|
||||
"integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/rimraf/-/rimraf-3.0.2.tgz",
|
||||
@@ -10216,15 +10124,6 @@
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/speakingurl": {
|
||||
"version": "14.0.1",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/speakingurl/-/speakingurl-14.0.1.tgz",
|
||||
"integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
@@ -10372,18 +10271,6 @@
|
||||
"integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/superjson": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/superjson/-/superjson-2.2.2.tgz",
|
||||
"integrity": "sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"copy-anything": "^3.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/supports-color/-/supports-color-7.2.0.tgz",
|
||||
@@ -11023,6 +10910,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vue-demi": {
|
||||
"version": "0.14.10",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/vue-demi/-/vue-demi-0.14.10.tgz",
|
||||
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"vue-demi-fix": "bin/vue-demi-fix.js",
|
||||
"vue-demi-switch": "bin/vue-demi-switch.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/composition-api": "^1.0.0-rc.1",
|
||||
"vue": "^3.0.0-0 || ^2.6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vue/composition-api": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vue-i18n": {
|
||||
"version": "9.14.4",
|
||||
"resolved": "http://25.12.10.69:8081/repository/aliyun-npm/vue-i18n/-/vue-i18n-9.14.4.tgz",
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@
|
||||
"@dcloudio/uni-mp-xhs": "3.0.0-4060620250520001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4060620250520001",
|
||||
"crypto-js": "^3.1.9-1",
|
||||
"pinia": "^3.0.3",
|
||||
"pinia": "^2.3.1",
|
||||
"terser": "^5.42.0",
|
||||
"uuid": "^11.1.0",
|
||||
"vue": "^3.5.11",
|
||||
|
||||
+21
-2
@@ -79,7 +79,17 @@ export const commonUploadVoiceFile = (file, url, data = {}, fileKey='voice') =>
|
||||
name: fileKey,
|
||||
formData: data,
|
||||
success(result) {
|
||||
resolve(result)
|
||||
try {
|
||||
const res = JSON.parse(result.data);
|
||||
console.log(res)
|
||||
if (res.rtnCode === '0000') {
|
||||
resolve(result);
|
||||
} else {
|
||||
reject(new Error(res.message));
|
||||
}
|
||||
} catch (error) {
|
||||
reject(new Error('Failed to parse response'));
|
||||
}
|
||||
},
|
||||
fail(error) {
|
||||
reject(new Error('Upload failed'));
|
||||
@@ -104,7 +114,16 @@ export const uploadVoiceFile = (file) => {
|
||||
filePath: file,
|
||||
name: 'voice',
|
||||
success(result) {
|
||||
resolve(result)
|
||||
try {
|
||||
const res = JSON.parse(result.data);
|
||||
if (res.rtnCode === '0000') {
|
||||
resolve(result);
|
||||
} else {
|
||||
reject(new Error(res.message));
|
||||
}
|
||||
} catch (error) {
|
||||
reject(new Error('Failed to parse response'));
|
||||
}
|
||||
},
|
||||
fail(error) {
|
||||
reject(new Error('Upload failed'));
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import App from './App'
|
||||
import { createSSRApp } from 'vue'
|
||||
import pinia from './store'
|
||||
import pinia from './store.js'
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
|
||||
@@ -43,12 +43,12 @@
|
||||
class="icon"
|
||||
src="@/static/images/course/play.png"
|
||||
style="width: 100%;height: 100%;"
|
||||
@click="playVoice"
|
||||
v-show="props.activeVoiceId !== dataInfo.id"
|
||||
@click="playVoice()"
|
||||
v-show="!isPlaying"
|
||||
></image>
|
||||
<image
|
||||
class="icon"
|
||||
v-show="props.activeVoiceId === dataInfo.id"
|
||||
v-show="isPlaying"
|
||||
src="@/static/images/course/pause.png"
|
||||
style="width: 100%;height: 100%;"
|
||||
@click="pauseVoice"
|
||||
@@ -65,7 +65,7 @@
|
||||
<view class="user-info">
|
||||
<view class="avatar-box">
|
||||
<!-- <ImagePreview class="img-box" :imgId="''"></ImagePreview> -->
|
||||
<img class="img-box" :src="userInfo.imageAddr" alt="" fit="contain" style="width: 100%; height: 100%;"/>
|
||||
<img class="img-box" :src="userInfo.imagePath" alt="" fit="contain" style="width: 100%; height: 100%;"/>
|
||||
</view>
|
||||
<view class="ai-name">
|
||||
{{ userInfo.userName }}
|
||||
@@ -85,21 +85,21 @@
|
||||
</view> -->
|
||||
<view class="play-btn">
|
||||
<image class="icon"
|
||||
@click="playQnsVoice('qns', item)"
|
||||
v-show="props.activeVoiceId !== dataInfo.id"
|
||||
@click="playQnsVoice('qns', dataInfo)"
|
||||
v-show="!isPlaying"
|
||||
src="@/static/images/course/play-blue.png"
|
||||
style="width: 100%;height: 100%;"
|
||||
></image>
|
||||
<image class="icon"
|
||||
v-show="props.activeVoiceId === dataInfo.id"
|
||||
v-show="isPlaying"
|
||||
@click="pauseVoice"
|
||||
src="@/static/images/course/stop-blue.png"
|
||||
style="width: 100%;height: 100%;"
|
||||
></image>
|
||||
</view>
|
||||
<view class="icon text-btn" @click="translateVoice(item)">文</view>
|
||||
<view class="icon text-right-btn" @click="translateVoice(item)">完成</view>
|
||||
<view class="icon text-right-btn" @click="translateVoice(item)">撤回</view>
|
||||
<view class="icon text-btn" v-if="type === 1" @click="translateVoice(dataInfo)">文</view>
|
||||
<view class="icon text-right-btn" @click="translateVoice(dataInfo)" v-if="isLast">完成</view>
|
||||
<view class="icon text-right-btn" @click="translateVoice(dataInfo)">撤回</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -107,7 +107,7 @@
|
||||
<view class="user-info">
|
||||
<view class="avatar-box">
|
||||
<!-- <ImagePreview class="img-box" :imgId="''"></ImagePreview> -->
|
||||
<img class="img-box" :src="userInfo.imageAddr" alt="" fit="contain" style="width: 100%; height: 100%;"/>
|
||||
<img class="img-box" :src="userInfo.imagePath" alt="" fit="contain" style="width: 100%; height: 100%;"/>
|
||||
</view>
|
||||
<view class="ai-name">
|
||||
{{ userInfo.userName }}
|
||||
@@ -123,10 +123,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { watch, unref, ref, toRefs, computed } from 'vue'
|
||||
import { watch, unref, ref, toRefs, computed, nextTick } from 'vue'
|
||||
import ImagePreview from '@/components/image-preview/image-preview.vue'
|
||||
import VideoPreview from '@/components/image-preview/video-preview.vue'
|
||||
import { downloadVoiceFile } from "@/api/common.js"
|
||||
import { downloadVoiceFile, uploadVoiceFile, } from "@/api/common.js"
|
||||
import { studyParagraphOverApi } from "@/api/study.js"
|
||||
import ChartFour from "./chartFour.vue"
|
||||
import ChartThree from "./chartThree.vue"
|
||||
@@ -144,81 +144,101 @@ import { getUserInfo } from '@/common/common';
|
||||
activeVoiceId:{
|
||||
default:'',
|
||||
type: String
|
||||
}
|
||||
},
|
||||
isLast:{
|
||||
default:false,
|
||||
type: Boolean
|
||||
},
|
||||
isPlaying:{
|
||||
default:false,
|
||||
type: Boolean
|
||||
},
|
||||
})
|
||||
const { type, dataInfo, activeVoiceId } = toRefs(props)
|
||||
const { type, dataInfo, activeVoiceId, isPlaying, isLast} = toRefs(props)
|
||||
const emit = defineEmits(['changePlay', 'nextQuestion'])
|
||||
const talkVoiceObj = uni.createInnerAudioContext()
|
||||
// 声音播放初始化
|
||||
const talkVoiceObj = ref(uni.createInnerAudioContext())
|
||||
const userInfo = computed(() => getUserInfo())
|
||||
watch(() => props.activeVoiceId,(val) => {
|
||||
if(val && (val !== unref(dataInfo).id)){
|
||||
talkVoiceObj?.stop()
|
||||
watch(() => props.isPlaying,(val) => {
|
||||
if(!val){
|
||||
talkVoiceObj.value?.stop()
|
||||
}
|
||||
},{
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
talkVoiceObj.onEnded(()=>{
|
||||
// talkVoiceObj.src = ''
|
||||
emit('changePlay',unref(dataInfo)?.id)
|
||||
talkVoiceObj.value.onEnded(()=>{
|
||||
emit('changePlay', '')
|
||||
talkVoiceObj.value.src = ''
|
||||
})
|
||||
talkVoiceObj.onError(()=>{
|
||||
emit('changePlay',unref(dataInfo)?.id)
|
||||
talkVoiceObj.value.onError(()=>{
|
||||
emit('changePlay', '')
|
||||
talkVoiceObj.value.src = ''
|
||||
})
|
||||
const pauseVoice = () => {
|
||||
if(!talkVoiceObj) return
|
||||
talkVoiceObj.pause()
|
||||
emit('changePlay',unref(dataInfo)?.id)
|
||||
if(!talkVoiceObj.value) return
|
||||
talkVoiceObj.value.pause()
|
||||
emit('changePlay', '')
|
||||
}
|
||||
// 重播
|
||||
const restartPlay = () => {
|
||||
console.log(userInfo)
|
||||
if(talkVoiceObj.src){
|
||||
talkVoiceObj.seek(0)
|
||||
talkVoiceObj.play()
|
||||
emit('changePlay', unref(dataInfo)?.id)
|
||||
if(itemVoice.value){
|
||||
setTimeout(()=>{
|
||||
talkVoiceObj.value.src = itemVoice.value
|
||||
talkVoiceObj.value.play()
|
||||
},100)
|
||||
}else{
|
||||
playVoice()
|
||||
}
|
||||
}
|
||||
|
||||
const itemVoice = ref('')
|
||||
const playVoice = (readType = 'pgth') =>{
|
||||
// readType 阅读内容类型pgrh段落/qns问题
|
||||
emit('changePlay', unref(dataInfo)?.id)
|
||||
if(talkVoiceObj.src){
|
||||
talkVoiceObj.play()
|
||||
if(itemVoice.value){
|
||||
console.log(1111111,itemVoice.value)
|
||||
setTimeout(()=>{
|
||||
talkVoiceObj.value.src = itemVoice.value
|
||||
talkVoiceObj.value.play()
|
||||
},100)
|
||||
}else{
|
||||
console.log(2,itemVoice.value)
|
||||
let _params = {
|
||||
crsId: unref(dataInfo)?.crsId || '',
|
||||
pgrphId: unref(dataInfo)?.pgrphId || '',
|
||||
qnsId: unref(dataInfo)?.qnsId || '',
|
||||
readType: readType,
|
||||
teachNo: unref(dataInfo)?.userInfo?.teacherNo, // 必填
|
||||
content: unref(dataInfo)?.pgrphContent || unref(dataInfo)?.talkingContent,
|
||||
content: unref(dataInfo)?.pgrphContent || unref(dataInfo)?.qnsContent || unref(dataInfo)?.talkingContent,
|
||||
}
|
||||
let _url = '/trastudy/traStdyInfo/readContent?' + Object.keys(_params).map(t=>{
|
||||
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t])
|
||||
}).join('&')
|
||||
downloadVoiceFile(_url).then(res=>{
|
||||
talkVoiceObj.src = res.tempFilePath
|
||||
talkVoiceObj.play()
|
||||
itemVoice.value = res.tempFilePath
|
||||
talkVoiceObj.value.src = res.tempFilePath
|
||||
talkVoiceObj.value.play()
|
||||
})
|
||||
}
|
||||
}
|
||||
const playQnsVoice = (readType = 'qns', item) =>{
|
||||
if(item.type === 2){
|
||||
if(type.value === 2){
|
||||
// 文本转语音
|
||||
playVoice(readType)
|
||||
return
|
||||
}
|
||||
// readType 阅读内容类型pgrh段落/qns问题
|
||||
emit('changePlay', unref(dataInfo)?.id)
|
||||
if(talkVoiceObj.src){
|
||||
talkVoiceObj.play()
|
||||
}else{
|
||||
talkVoiceObj.src = item.talkingVoice
|
||||
talkVoiceObj.play()
|
||||
}
|
||||
setTimeout(()=>{
|
||||
itemVoice.value = item.talkingVoice
|
||||
talkVoiceObj.value.src = item.talkingVoice
|
||||
talkVoiceObj.value.play()
|
||||
},100)
|
||||
}
|
||||
const translateVoice = (item) =>{
|
||||
if(!item.talkingVoice) return
|
||||
uploadVoiceFile(item.talkingVoice,{}).then(res=>{
|
||||
let _data = JSON.parse(res.data)
|
||||
item.talkingContent = _data.body
|
||||
@@ -226,14 +246,13 @@ import { getUserInfo } from '@/common/common';
|
||||
}
|
||||
const showNextBtn = ref(true)
|
||||
const goOnGetQues = () => {
|
||||
// studyParagraphOverApi({
|
||||
// pgrphId:unref(dataInfo)?.pgrphId
|
||||
// }).then(res=>{
|
||||
// showNextBtn.value = false
|
||||
// emit('nextQuestion', unref(dataInfo))
|
||||
// })
|
||||
showNextBtn.value = false
|
||||
emit('nextQuestion', unref(dataInfo))
|
||||
studyParagraphOverApi({
|
||||
pgrphId:unref(dataInfo)?.pgrphId,
|
||||
logId:unref(dataInfo)?.logId,
|
||||
}).then(res=>{
|
||||
showNextBtn.value = false
|
||||
emit('nextQuestion', unref(dataInfo))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -449,7 +468,7 @@ import { getUserInfo } from '@/common/common';
|
||||
background-size: 100%;
|
||||
margin-bottom: 16rpx;
|
||||
&.is-play{
|
||||
background: url(@/static/images/course/voice-gif.gif) no-repeat;
|
||||
background: url(@/static/images/course/voice-white.gif) no-repeat;
|
||||
background-size: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
+76
-39
@@ -33,26 +33,31 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="course-study-body" v-show="step === 2" @click="playRecord">
|
||||
<view class="body-title">
|
||||
<view class="body-title" @click="scrollToBottomNow">
|
||||
<uv-icon class="arrow-icon" name="arrow-left" @click="common.navigateBack()"/>
|
||||
课程学习
|
||||
</view>
|
||||
<view class="talking-list">
|
||||
<scroll-view class="talking-list" :scroll-y="true">
|
||||
<!-- <view class="talking-list-cont" id="scroll-box" ref="scrollBoxRef"> -->
|
||||
<view class="study-num">
|
||||
<view class="color-blue">{{ showOrder }}</view> / {{ pgrphNum }}
|
||||
</view>
|
||||
<TalkingItem
|
||||
class="talking-item"
|
||||
v-for="item in talkingList"
|
||||
v-for="item,index in talkingList"
|
||||
:key="'item' + item.id"
|
||||
:type="item.type"
|
||||
:dataInfo="item"
|
||||
:activeVoiceId="activeVoiceTalkingItemId"
|
||||
:isPlaying="activeVoiceTalkingItemId === item.id"
|
||||
@changePlay="changePlayItemId"
|
||||
@nextQuestion="nextQuestionSuccess"
|
||||
:id="'item' + item.id"
|
||||
:isLast="talkingList.length === (index+1)"
|
||||
></TalkingItem>
|
||||
<!-- <video v-if="videoUrlShow" :src="videoUrlShow" controls></video> -->
|
||||
</view>
|
||||
<!-- </view> -->
|
||||
</scroll-view>
|
||||
<view class="talk-btns">
|
||||
<view
|
||||
class="touch-btn"
|
||||
@@ -95,7 +100,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, computed, unref, onMounted, onUnmounted, getCurrentInstance } from 'vue';
|
||||
import { reactive, ref, computed, unref, onMounted, onUnmounted, getCurrentInstance, nextTick } from 'vue';
|
||||
import { onLoad,onShow,onHide } from '@dcloudio/uni-app';
|
||||
import {
|
||||
previewFile,
|
||||
@@ -135,28 +140,24 @@ const talkingList = ref([])
|
||||
const activeVoiceTalkingItemId = ref('')
|
||||
const answerValue = ref('')
|
||||
const inputRef = ref('')
|
||||
|
||||
// 初始化数据
|
||||
const getData = async () => {
|
||||
try{
|
||||
const { body } = await getCourseStudyInfoApi({crsId: crsId.value})
|
||||
console.log(3)
|
||||
initsocketTask()
|
||||
teacherList.value = body.teacheList.map(t=>({
|
||||
...t,
|
||||
voicePath: '',
|
||||
voiceObj: null
|
||||
}))
|
||||
if(body.stdyProgressFlag === 'N'){
|
||||
step.value = 1
|
||||
teacherList.value = body.teacheList.map(t=>({
|
||||
...t,
|
||||
voicePath: '',
|
||||
voiceObj: null
|
||||
}))
|
||||
}else{
|
||||
console.log(2)
|
||||
common.show('提示信息', '此门课程已有学习历史,请选择是否继续学习?',true, '重新开始','继续学习').then((res) => {
|
||||
console.log(res)
|
||||
if(res) {
|
||||
// 继续学习 , 获取学习历史接口
|
||||
// 滚动到最下面
|
||||
scrollToBottomNow()
|
||||
|
||||
choiceTeacher.value = body.choiceTeacher
|
||||
sendMessage({
|
||||
"commond" : 'STDY',
|
||||
@@ -205,18 +206,19 @@ const changePlayItemId = (id) => {
|
||||
activeVoiceTalkingItemId.value = id
|
||||
}
|
||||
}
|
||||
|
||||
// 选择的教师对象信息
|
||||
const choiceTeacherInfo = computed(()=>{
|
||||
return teacherList.value.find(t=> t.teacherNo === choiceTeacher.value)
|
||||
})
|
||||
const keyboardIsShow = ref(false)
|
||||
|
||||
// 发送文本
|
||||
const showKeyboard = () => {
|
||||
if(keyboardIsShow.value){
|
||||
if(answerValue.value){
|
||||
let _data = {
|
||||
qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String
|
||||
pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String
|
||||
qstLogId: unref(qstLogId),// 段落ID 必输项:true 类型:String
|
||||
crsId: crsId.value,// 课程ID 必输项:true 类型:String
|
||||
stdyBatch: stdyBatch.value,// 学习批次 必输项:true 类型:String
|
||||
ansterContent: answerValue.value // 回答文本内容 必输项:false 类型:String
|
||||
@@ -227,9 +229,11 @@ const showKeyboard = () => {
|
||||
talkingList.value.push({
|
||||
crsId: crsId.value,
|
||||
pgrphId: unref(lastTalkingInfo).pgrphId,
|
||||
qnsId: unref(lastTalkingInfo).qnsId,
|
||||
talkingContent: answerValue.value,
|
||||
talkingVoice: '',
|
||||
type: 2,
|
||||
userInfo: {...choiceTeacherInfo.value},
|
||||
id: _id
|
||||
})
|
||||
scrollToBottomNow()
|
||||
@@ -292,13 +296,13 @@ const nextStep = () => {
|
||||
|
||||
const pgrphNum = ref(1)
|
||||
const showOrder = ref(0)
|
||||
// 获取段落
|
||||
const getGraphInfoUnStudy = () => {
|
||||
queryTraStdyBatchWaitParagraphInfoApi({
|
||||
crsId: crsId.value,
|
||||
stdyId: unref(stdyId),
|
||||
stdyBatch: unref(stdyBatch)
|
||||
}).then(res=>{
|
||||
console.log(res)
|
||||
let _id = new Date().getTime() + 'id'
|
||||
lastTalkingInfo.value = {
|
||||
...res.body,
|
||||
@@ -310,19 +314,21 @@ const getGraphInfoUnStudy = () => {
|
||||
|
||||
pgrphNum.value = res.body.pgrphNum
|
||||
showOrder.value = res.body.showOrder
|
||||
logId.value = res.body.logId || ''
|
||||
scrollToBottomNow()
|
||||
})
|
||||
}
|
||||
const lastTalkingInfo = ref({})
|
||||
const qstLogId = ref('')
|
||||
// 获取问题
|
||||
const getQuestionInfoUnStudy = (pgrphId) => {
|
||||
queryTraStdyBatchWaitQuestionInfoApi({
|
||||
crsId: crsId.value,
|
||||
stdyId: unref(stdyId),
|
||||
stdyBatch: unref(stdyBatch),
|
||||
logId: unref(logId),
|
||||
pgrphId
|
||||
}).then(res=>{
|
||||
console.log(res)
|
||||
let _id = new Date().getTime() + 'id'
|
||||
lastTalkingInfo.value = {
|
||||
...res.body,
|
||||
@@ -331,6 +337,7 @@ const getQuestionInfoUnStudy = (pgrphId) => {
|
||||
id: _id
|
||||
}
|
||||
talkingList.value.push(lastTalkingInfo.value)
|
||||
qstLogId.value = res.body.qstLogId
|
||||
scrollToBottomNow()
|
||||
})
|
||||
}
|
||||
@@ -349,15 +356,26 @@ const nextQuestionSuccess = (info) => {
|
||||
// getGraphInfoUnStudy()
|
||||
getQuestionInfoUnStudy(info.pgrphId)
|
||||
}
|
||||
const scrollBoxRef = ref()
|
||||
const scrollToBottomNow = () => {
|
||||
let _arr = talkingList.value || []
|
||||
if(_arr.length && _arr.length > 0){
|
||||
let _last = talkingList.value[talkingList.value.length - 1]
|
||||
uni.pageScrollTo({
|
||||
selector: '#item' + _last.id,
|
||||
duration: 300
|
||||
})
|
||||
}
|
||||
nextTick(()=>{
|
||||
setTimeout(() => {
|
||||
// let scrollElem = scrollBoxRef.value.$el
|
||||
// // let scrollElem = document.getElementById('scroll-box')
|
||||
// scrollElem.scrollTo({
|
||||
// top: scrollElem.scrollHeight, behavior: 'smooth'
|
||||
// })
|
||||
let _arr = talkingList.value || []
|
||||
if(_arr.length && _arr.length > 0){
|
||||
let _last = talkingList.value[talkingList.value.length - 1]
|
||||
console.log('#item' + _last.id)
|
||||
uni.pageScrollTo({
|
||||
selector: '#item' + _last.id,
|
||||
duration: 300
|
||||
})
|
||||
}
|
||||
},200)
|
||||
})
|
||||
}
|
||||
|
||||
const reconnectTimer = null // 重连timer
|
||||
@@ -365,7 +383,8 @@ const isManualClose = ref(false) // 是否手动关闭
|
||||
|
||||
const stdyId = ref('')
|
||||
const stdyBatch = ref('')
|
||||
|
||||
const logId = ref('')
|
||||
// ws 初始化逻辑
|
||||
const initsocketTask = () => {
|
||||
socketStore.creatSocket()
|
||||
unref(SocketObj).on('message', (res)=>{
|
||||
@@ -374,6 +393,7 @@ const initsocketTask = () => {
|
||||
if(commond === 'STDYBTH' && !stdyId.value){
|
||||
stdyId.value = body.stdyId || ''
|
||||
stdyBatch.value = body.stdyBatch || ''
|
||||
logId.value = body.logId || ''
|
||||
getGraphInfoUnStudy()
|
||||
}
|
||||
}else{
|
||||
@@ -400,6 +420,7 @@ const closeWebSocket = () => {
|
||||
uni.closeSocket({})
|
||||
}
|
||||
}
|
||||
// ws 结束
|
||||
|
||||
onLoad((params) => {
|
||||
crsId.value = params.crsId||'';
|
||||
@@ -421,7 +442,7 @@ const startRecord = () => {
|
||||
unref(recordObj).start({format:'mp3'})
|
||||
}
|
||||
const stopRecord = () => {
|
||||
unref(recordObj).stop()
|
||||
unref(recordObj)?.stop?.()
|
||||
}
|
||||
// #endif
|
||||
//#ifndef APP-PLUS
|
||||
@@ -429,20 +450,20 @@ const recordObj = {}
|
||||
const initRecord = () => {}
|
||||
// #endif
|
||||
onMounted(()=>{
|
||||
// getData();
|
||||
getData();
|
||||
initRecord?.()
|
||||
})
|
||||
onShow(()=>{
|
||||
getData();
|
||||
// getData();
|
||||
})
|
||||
onHide(()=>{
|
||||
closeWebSocket()
|
||||
teacherVoiceObj.stop()
|
||||
// onHide(()=>{
|
||||
// teacherVoiceObj.stop()
|
||||
// teacherVoiceObj.src = ''
|
||||
// })
|
||||
onUnmounted(()=>{
|
||||
teacherVoiceObj?.stop?.()
|
||||
teacherVoiceObj.src = ''
|
||||
})
|
||||
// onUnmounted(()=>{
|
||||
// closeWebSocket()
|
||||
// })
|
||||
const playRecord = () => {
|
||||
audioObj.src = audioPath.value
|
||||
unref(audioObj).play()
|
||||
@@ -475,11 +496,11 @@ const hideOverlayTalking = (obj) => {
|
||||
stopRecord()
|
||||
// #endif
|
||||
if(!isOut.value){
|
||||
// audioPath.value /traStdyInfo/studyAnswerVoiceUp
|
||||
setTimeout(()=>{
|
||||
let _data = {
|
||||
qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String
|
||||
pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String
|
||||
qstLogId: unref(qstLogId),// 段落ID 必输项:true 类型:String
|
||||
crsId: crsId.value,// 课程ID 必输项:true 类型:String
|
||||
stdyBatch: stdyBatch.value,// 学习批次 必输项:true 类型:String
|
||||
ansterContent: '',// 回答文本内容 必输项:false 类型:String
|
||||
@@ -490,28 +511,39 @@ const hideOverlayTalking = (obj) => {
|
||||
talkingList.value.push({
|
||||
crsId: crsId.value,
|
||||
pgrphId: unref(lastTalkingInfo).pgrphId,
|
||||
qnsId: unref(lastTalkingInfo).qnsId,
|
||||
talkingContent: '',
|
||||
talkingVoice: audioPath.value,
|
||||
type: 1,
|
||||
userInfo: {...choiceTeacherInfo.value},
|
||||
id: _id
|
||||
})
|
||||
// #endif
|
||||
//#ifdef APP-PLUS
|
||||
console.log(222)
|
||||
commonUploadVoiceFile(audioPath.value, '/trastudy/traStdyInfo/studyAnswerVoiceUp', _data).then(res=>{
|
||||
console.log(JSON.parse(res.data))
|
||||
console.log(res.data)
|
||||
let _res = JSON.parse(res.data)
|
||||
if(_res.rtnCode === '0000'){
|
||||
let _id = new Date().getTime() + 'id'
|
||||
talkingList.value.push({
|
||||
crsId: crsId.value,
|
||||
pgrphId: unref(lastTalkingInfo).pgrphId,
|
||||
qnsId: unref(lastTalkingInfo).qnsId,
|
||||
talkingContent: '',
|
||||
talkingVoice: audioPath.value,
|
||||
type: 1,
|
||||
userInfo: {...choiceTeacherInfo.value},
|
||||
id: _id
|
||||
})
|
||||
scrollToBottomNow()
|
||||
}
|
||||
}).catch(err=>{
|
||||
uni.showToast({
|
||||
title: err||'系统异常,请联系管理员',
|
||||
icon: "none",
|
||||
duration:1000
|
||||
});
|
||||
})
|
||||
// #endif
|
||||
},1000)
|
||||
@@ -576,6 +608,11 @@ const handleMove = (obj) => {
|
||||
background: url(@/static/images/course/study-bg.png) no-repeat;
|
||||
background-size: cover;
|
||||
border-radius: 30rpx 30rpx 0 0;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
.talking-list-cont{
|
||||
padding: 0;
|
||||
}
|
||||
.study-num{
|
||||
height: 36rpx;
|
||||
line-height: 36rpx;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@@ -1,3 +1,3 @@
|
||||
import { createPinia } from 'pinia';
|
||||
const store = createPinia();;
|
||||
const store = createPinia();
|
||||
export default store;
|
||||
+4
-4
@@ -19,11 +19,11 @@ export const useSocketStore = defineStore('socketStore',{
|
||||
if(this.SocketObj && this.SocketObj?.close) return
|
||||
this.SocketObj = new SocketClass(_baseUrl + '/trastudy/trasoket/open?summary=' + getToken());
|
||||
},
|
||||
closeSocket: () => {
|
||||
if(!this.SocketObj || !this.SocketObj?.close) return
|
||||
this.SocketObj && this.SocketObj?.close?.()
|
||||
closeSocket() {
|
||||
if(!(this.SocketObj && this.SocketObj?.close)) return
|
||||
this.SocketObj && this.SocketObj.close()
|
||||
},
|
||||
setOnmessageCb: (cb) => {
|
||||
setOnmessageCb(cb){
|
||||
if(!this.SocketObj || !this.SocketObj?.on) return
|
||||
this.SocketObj.on('message', cb)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user