Merge branch 'develop' into 'sit'
Develop See merge request K17_AITS/tra-app!36
This commit is contained in:
@@ -157,6 +157,38 @@ export function downloadVoiceFile(url) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getAudioByText(data) {
|
||||||
|
const token = getToken();
|
||||||
|
const header = {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||||
|
};
|
||||||
|
if (token)
|
||||||
|
header['summary'] = token
|
||||||
|
let baseUrl = get_base_url();
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.request({
|
||||||
|
url: `${baseUrl}/trastudy/traStdyInfo/readContent`,
|
||||||
|
header,
|
||||||
|
method:"POST",
|
||||||
|
data,
|
||||||
|
responseType: "arraybuffer",
|
||||||
|
success(result) {
|
||||||
|
if(result.statusCode === 200){
|
||||||
|
resolve(result.data)
|
||||||
|
}else{
|
||||||
|
reject(new Error(result))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(error) {
|
||||||
|
reject(new Error(error));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 对象存储预览 /traoss/tras3/show/{文件ID}
|
// 对象存储预览 /traoss/tras3/show/{文件ID}
|
||||||
export function previewFile(id, responseType = 'arraybuffer') {
|
export function previewFile(id, responseType = 'arraybuffer') {
|
||||||
const token = getToken();
|
const token = getToken();
|
||||||
|
|||||||
@@ -155,6 +155,9 @@ export default class WebSocketUtil {
|
|||||||
} else {
|
} else {
|
||||||
console.error('WebSocket连接未打开,无法发送消息');
|
console.error('WebSocket连接未打开,无法发送消息');
|
||||||
this.triggerEvent('error', new Error('WebSocket连接未打开'));
|
this.triggerEvent('error', new Error('WebSocket连接未打开'));
|
||||||
|
setTimeout(()=>{
|
||||||
|
this.send(message)
|
||||||
|
},500)
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="total-score">
|
<view class="total-score">
|
||||||
<view class="score-num">{{props.score}}</view>分
|
<view class="score-num">{{props.score}}</view>分
|
||||||
<img class="total-score-icon" src="@/static/images/course/score.png" alt="" />
|
<image class="total-score-icon" src="@/static/images/course/score.png" alt=""></image>
|
||||||
</view>
|
</view>
|
||||||
<view v-for="item,index in props.dataList" :class="['score-item', 'score-item'+(index+1)]">
|
<view v-for="item,index in props.dataList" :class="['score-item', 'score-item'+(index+1)]">
|
||||||
<view class="score-item-name">{{ item.gradeDimensName }}</view>
|
<view class="score-item-name">{{ item.gradeDimensName }}</view>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="total-score">
|
<view class="total-score">
|
||||||
<view class="score-num">{{props.score}}</view>分
|
<view class="score-num">{{props.score}}</view>分
|
||||||
<img class="total-score-icon" src="@/static/images/course/score.png" alt="" />
|
<image class="total-score-icon" src="@/static/images/course/score.png" alt="" ></image>
|
||||||
</view>
|
</view>
|
||||||
<view v-for="item,index in props.dataList" :class="['score-item', 'score-item'+(index+1)]">
|
<view v-for="item,index in props.dataList" :class="['score-item', 'score-item'+(index+1)]">
|
||||||
<view class="score-item-name">{{ item.gradeDimensName }}</view>
|
<view class="score-item-name">{{ item.gradeDimensName }}</view>
|
||||||
|
|||||||
@@ -185,7 +185,7 @@
|
|||||||
import { watch, unref, ref, toRefs, computed, nextTick,onMounted } from 'vue'
|
import { watch, unref, ref, toRefs, computed, nextTick,onMounted } from 'vue'
|
||||||
import ImagePreview from '@/components/image-preview/image-preview.vue'
|
import ImagePreview from '@/components/image-preview/image-preview.vue'
|
||||||
import VideoPreview from '@/components/image-preview/video-preview.vue'
|
import VideoPreview from '@/components/image-preview/video-preview.vue'
|
||||||
import { downloadVoiceFile, uploadVoiceFile, } from "@/api/common.js"
|
import { downloadVoiceFile, uploadVoiceFile, getAudioByText } from "@/api/common.js"
|
||||||
import { studyParagraphOverApi, getAskAboutRawApi } from "@/api/study.js"
|
import { studyParagraphOverApi, getAskAboutRawApi } from "@/api/study.js"
|
||||||
import ChartFour from "./chartFour.vue"
|
import ChartFour from "./chartFour.vue"
|
||||||
import ChartThree from "./chartThree.vue"
|
import ChartThree from "./chartThree.vue"
|
||||||
@@ -373,6 +373,8 @@ const audioCacheObj = computed(() => storageStore.audioObj)
|
|||||||
teachNo: unref(teacherInfo)?.teacherNo, // 必填
|
teachNo: unref(teacherInfo)?.teacherNo, // 必填
|
||||||
content: _content
|
content: _content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let _url = '/trastudy/traStdyInfo/readContent?' + Object.keys(_params).map(t=>{
|
let _url = '/trastudy/traStdyInfo/readContent?' + Object.keys(_params).map(t=>{
|
||||||
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t])
|
return encodeURIComponent(t) + '=' + encodeURIComponent(_params[t])
|
||||||
}).join('&')
|
}).join('&')
|
||||||
@@ -384,6 +386,19 @@ const audioCacheObj = computed(() => storageStore.audioObj)
|
|||||||
talkVoiceObj.value.src = url
|
talkVoiceObj.value.src = url
|
||||||
talkVoiceObj.value.play()
|
talkVoiceObj.value.play()
|
||||||
}else{
|
}else{
|
||||||
|
// getAudioByText(_params).then(res=>{
|
||||||
|
// // uni.env.USER_DATA_PATH ||
|
||||||
|
// let filePath = `${'/'}/${dataInfo.value.id}.mp3`
|
||||||
|
// saveFile(res, filePath, () => {
|
||||||
|
// voiceLoading.value = false
|
||||||
|
// itemVoice.value = filePath
|
||||||
|
// talkVoiceObj.value.src = filePath
|
||||||
|
// talkVoiceObj.value.play()
|
||||||
|
// storageStore.setStorage('audio', _url + _params.teachNo, itemVoice.value)
|
||||||
|
// })
|
||||||
|
// }).catch(err=>{
|
||||||
|
// console.log(err)
|
||||||
|
// })
|
||||||
downloadVoiceFile(_url).then(res=>{
|
downloadVoiceFile(_url).then(res=>{
|
||||||
if(res?.data){
|
if(res?.data){
|
||||||
common.msg(res.data.message)
|
common.msg(res.data.message)
|
||||||
@@ -401,6 +416,19 @@ const audioCacheObj = computed(() => storageStore.audioObj)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const saveFile = (buffer,filePath, cb = ()=>{}) => {
|
||||||
|
let fileManager = uni.getFileSystemManager()
|
||||||
|
fileManager.writeFile({
|
||||||
|
filePath: filePath,
|
||||||
|
data: buffer,
|
||||||
|
encoding: 'binary',
|
||||||
|
success: cb,
|
||||||
|
file: ()=>{
|
||||||
|
voiceLoading.value = false
|
||||||
|
console.log('文件保存失败!')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
const initVoice = (readType = 'qns', item, isplay=false) => {
|
const initVoice = (readType = 'qns', item, isplay=false) => {
|
||||||
if(unref(dataInfo).talkingVoice){
|
if(unref(dataInfo).talkingVoice){
|
||||||
itemVoice.value = unref(dataInfo).talkingVoice
|
itemVoice.value = unref(dataInfo).talkingVoice
|
||||||
|
|||||||
+24
-17
@@ -176,13 +176,8 @@ const flagVal = ref('1')
|
|||||||
const isUploadingVoice = ref(false)
|
const isUploadingVoice = ref(false)
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
const getData = async (flag) => {
|
const getData = async (flag) => {
|
||||||
// if(flag === flagVal.value){
|
|
||||||
// flagVal.value = '2'
|
|
||||||
// }else{
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
try{
|
try{
|
||||||
await initsocketTask()
|
initsocketTask()
|
||||||
const { body } = await getCourseStudyInfoApi({crsId: crsId.value})
|
const { body } = await getCourseStudyInfoApi({crsId: crsId.value})
|
||||||
teacherList.value = body.teacheList.map(t=>({
|
teacherList.value = body.teacheList.map(t=>({
|
||||||
...t,
|
...t,
|
||||||
@@ -192,8 +187,8 @@ const getData = async (flag) => {
|
|||||||
if(body.stdyProgressFlag === 'N'){
|
if(body.stdyProgressFlag === 'N'){
|
||||||
step.value = 1
|
step.value = 1
|
||||||
}else{
|
}else{
|
||||||
|
choiceTeacher.value = body.choiceTeacher
|
||||||
if(startPgrphId.value){
|
if(startPgrphId.value){
|
||||||
choiceTeacher.value = body.choiceTeacher
|
|
||||||
sendMessage({
|
sendMessage({
|
||||||
"commond" : 'STDY',
|
"commond" : 'STDY',
|
||||||
"body" : {
|
"body" : {
|
||||||
@@ -201,7 +196,6 @@ const getData = async (flag) => {
|
|||||||
teacherNo: choiceTeacher.value
|
teacherNo: choiceTeacher.value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
step.value = 2
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
common.show('提示', '系统检测到您已存在学习记录,要继续学习吗?',true, '重新学习','继续学习').then((res) => {
|
common.show('提示', '系统检测到您已存在学习记录,要继续学习吗?',true, '重新学习','继续学习').then((res) => {
|
||||||
@@ -209,7 +203,6 @@ const getData = async (flag) => {
|
|||||||
// 继续学习 , 获取学习历史接口
|
// 继续学习 , 获取学习历史接口
|
||||||
// 滚动到最下面
|
// 滚动到最下面
|
||||||
scrollToBottomNow()
|
scrollToBottomNow()
|
||||||
choiceTeacher.value = body.choiceTeacher
|
|
||||||
sendMessage({
|
sendMessage({
|
||||||
"commond" : 'STDY',
|
"commond" : 'STDY',
|
||||||
"body" : {
|
"body" : {
|
||||||
@@ -374,7 +367,6 @@ const getGraphInfoUnStudy = (flag = 0) => {
|
|||||||
if(!_body.chatBody) {
|
if(!_body.chatBody) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('prgh', _body)
|
|
||||||
if(Number(_body.bodyTyp) === 7){
|
if(Number(_body.bodyTyp) === 7){
|
||||||
common.show('恭喜你已学完全部知识点', '有什么心得跟我们分享吗?',true, '取消','去评论').then((res) => {
|
common.show('恭喜你已学完全部知识点', '有什么心得跟我们分享吗?',true, '取消','去评论').then((res) => {
|
||||||
if(res) {
|
if(res) {
|
||||||
@@ -587,8 +579,20 @@ const stdyId = ref('')
|
|||||||
const stdyBatch = ref('')
|
const stdyBatch = ref('')
|
||||||
const logId = ref('')
|
const logId = ref('')
|
||||||
// ws 初始化逻辑
|
// ws 初始化逻辑
|
||||||
const initsocketTask = async () => {
|
const initsocketTask = () => {
|
||||||
await socketStore.creatSocket()
|
socketStore.creatSocket()
|
||||||
|
unref(SocketObj).on('open', (res)=>{
|
||||||
|
if(startPgrphId.value){
|
||||||
|
sendMessage({
|
||||||
|
"commond" : 'STDY',
|
||||||
|
"body" : {
|
||||||
|
crsId: crsId.value,
|
||||||
|
teacherNo: choiceTeacher.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
step.value = 2
|
||||||
|
}
|
||||||
|
})
|
||||||
unref(SocketObj).on('message', (res)=>{
|
unref(SocketObj).on('message', (res)=>{
|
||||||
const { rtnCode, body, commond } = JSON.parse(res.data)
|
const { rtnCode, body, commond } = JSON.parse(res.data)
|
||||||
if(rtnCode === '0000'){
|
if(rtnCode === '0000'){
|
||||||
@@ -597,6 +601,7 @@ const initsocketTask = async () => {
|
|||||||
stdyBatch.value = body.stdyBatch || ''
|
stdyBatch.value = body.stdyBatch || ''
|
||||||
logId.value = body.logId || ''
|
logId.value = body.logId || ''
|
||||||
getGraphInfoUnStudy(1)
|
getGraphInfoUnStudy(1)
|
||||||
|
step.value = 2
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// if(['0005', 'QQ0005'].includes(res.rtnCode)) {
|
// if(['0005', 'QQ0005'].includes(res.rtnCode)) {
|
||||||
@@ -622,13 +627,14 @@ onLoad((params) => {
|
|||||||
crsNum.value = params.crsNum||'';
|
crsNum.value = params.crsNum||'';
|
||||||
imageId.value = params.imgId || ''
|
imageId.value = params.imgId || ''
|
||||||
startPgrphId.value = params.pgrphId||'';
|
startPgrphId.value = params.pgrphId||'';
|
||||||
getData('1');
|
console.log('onLoad')
|
||||||
});
|
});
|
||||||
const showTalkingModel = ref(false)
|
const showTalkingModel = ref(false)
|
||||||
// 录音
|
// 录音
|
||||||
// onMounted(()=>{
|
onMounted(()=>{
|
||||||
// getData('1');
|
getData('1');
|
||||||
// })
|
console.log('onMounted')
|
||||||
|
})
|
||||||
onHide(()=>{
|
onHide(()=>{
|
||||||
if(watchFlag.value === 1) return
|
if(watchFlag.value === 1) return
|
||||||
changePlayItemId('')
|
changePlayItemId('')
|
||||||
@@ -638,8 +644,9 @@ onHide(()=>{
|
|||||||
}).finally(() => {})
|
}).finally(() => {})
|
||||||
})
|
})
|
||||||
onShow(()=>{
|
onShow(()=>{
|
||||||
|
console.log('onShow')
|
||||||
if(watchFlag.value === 1) return
|
if(watchFlag.value === 1) return
|
||||||
socketStore.createSocket()
|
getData('1');
|
||||||
})
|
})
|
||||||
const watchFlag = ref(1)
|
const watchFlag = ref(1)
|
||||||
onUnload(()=>{
|
onUnload(()=>{
|
||||||
|
|||||||
@@ -415,6 +415,13 @@ import {
|
|||||||
onShow(()=>{
|
onShow(()=>{
|
||||||
if(watchFlag.value === 1) return
|
if(watchFlag.value === 1) return
|
||||||
socketStore?.createSocket?.()
|
socketStore?.createSocket?.()
|
||||||
|
sendMessage({
|
||||||
|
"commond" : 'ASK-START',
|
||||||
|
"body" : {
|
||||||
|
mascotId: mascotId.value,
|
||||||
|
deviceImei: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
onUnload(()=>{
|
onUnload(()=>{
|
||||||
watchFlag.value = 1
|
watchFlag.value = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user