新增指令接收

This commit is contained in:
weipengfei 2023-10-14 17:05:11 +08:00
parent ec2cfe4b19
commit 455527513a
1 changed files with 40 additions and 11 deletions

View File

@ -45,6 +45,45 @@ const connection = new Push({
//
const recordFalg = ref(0)
/**
* APP端命令目录
* start 开始录音
* end 录音完成
* re 重新录制
* clear 清空对话
* pause 暂停播放
* play 继续播放
* stop 停止播放
* re-play 重新播放
*/
const runOrder = (e)=>{
switch(e){
case 'start': startOrder();break;
case 'end':endOrder();break;
}
}
const startOrder = ()=>{
if (recordFalg.value == 0) {
RecordXunfei()
recordFalg.value = 1
nowStatus.value = 'record'
}else {
console.log('无效指令');
}
}
const endOrder = ()=>{
if(recordFalg.value==1){
RecordXunfei()
recordFalg.value = 0
nowStatus.value = 'loding'
handleSubmit()
}else {
console.log('无效指令');
}
}
// uid1
const uid = 1
// user-1uid1
@ -54,17 +93,7 @@ console.log(user_channel)
user_channel.on('message', (data: any) => {
// data
console.log('收到命令', data)
if (recordFalg.value == 0) {
RecordXunfei()
recordFalg.value = 1
nowStatus.value = 'record'
}
else {
RecordXunfei()
recordFalg.value = 0
nowStatus.value = 'loding'
handleSubmit()
}
runOrder(data.content)
})
const changeRecord = () => {