综合演练仿真 聊天 发送语音消息
This commit is contained in:
parent
26f59a4e4e
commit
545dc4a62e
@ -29,8 +29,20 @@ export default {
|
|||||||
const t = e.clientY - disY;
|
const t = e.clientY - disY;
|
||||||
|
|
||||||
/** 移动当前元素*/
|
/** 移动当前元素*/
|
||||||
|
if (l + styL < 0) {
|
||||||
|
dragDom.style.left = `0px`;
|
||||||
|
} else if (l + styL > document.body.clientWidth - dragDom.clientWidth - 10) {
|
||||||
|
dragDom.style.left = `${document.body.clientWidth - dragDom.clientWidth - 10}px`;
|
||||||
|
} else {
|
||||||
dragDom.style.left = `${l + styL}px`;
|
dragDom.style.left = `${l + styL}px`;
|
||||||
|
}
|
||||||
|
if (t + styT < 0) {
|
||||||
|
dragDom.style.top = `0px`;
|
||||||
|
} else if (t + styT > document.body.clientHeight - dragDom.clientHeight - 10) {
|
||||||
|
dragDom.style.top = `${document.body.clientHeight - dragDom.clientHeight - 10}px`;
|
||||||
|
} else {
|
||||||
dragDom.style.top = `${t + styT}px`;
|
dragDom.style.top = `${t + styT}px`;
|
||||||
|
}
|
||||||
|
|
||||||
/** 将此时的位置传出去*/
|
/** 将此时的位置传出去*/
|
||||||
// binding.value({ x: e.pageX, y: e.pageY });
|
// binding.value({ x: e.pageX, y: e.pageY });
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="chatBox">
|
<div v-quickMenuDrag class="chatBox">
|
||||||
<div v-show="!minimize" class="chat-box">
|
<div v-show="!minimize" class="chat-box">
|
||||||
<div :class="showMembers?'memberAnimate chat-box-members':'chat-box-members'">
|
<div :class="showMembers?'memberAnimate chat-box-members':'chat-box-members'">
|
||||||
<div class="chat-member-title">成员列表</div>
|
<div class="chat-member-title">成员列表</div>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="coversition in coversitionList"
|
v-for="coversition in coversitionList"
|
||||||
:key="coversition.id"
|
:key="coversition.id"
|
||||||
:class="coversition.id==currentCoversition?'coversition-active each-coversition':'each-coversition'"
|
:class="coversition.id==currentCoversition.id?'coversition-active each-coversition':'each-coversition'"
|
||||||
@click="changeCoversition(coversition)"
|
@click="changeCoversition(coversition)"
|
||||||
>{{ coversition.name }}</div>
|
>{{ coversition.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<div class="minimality" @click="handleMinimality('min')">
|
<div class="minimality" @click="handleMinimality('min')">
|
||||||
<i class="el-icon-remove" />
|
<i class="el-icon-remove" />
|
||||||
</div>
|
</div>
|
||||||
<div class="showMembers" @click="handleMembers()">
|
<div v-show="currentCoversition.group==undefined?true:currentCoversition.group" class="showMembers" @click="handleMembers()">
|
||||||
<i class="el-icon-user-solid" />
|
<i class="el-icon-user-solid" />
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-setting" @click="handleSetting()">
|
<div class="chat-setting" @click="handleSetting()">
|
||||||
@ -33,6 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-box-content">
|
<div class="chat-box-content">
|
||||||
|
<audio src="http://192.168.3.6:9000/2020/4/23/1587636830913-ReWF1got.wav" autoplay preload="preload" />
|
||||||
<div v-if="recordSending" class="chat_record_tip">
|
<div v-if="recordSending" class="chat_record_tip">
|
||||||
<div id="record_progress_bar" :style="'width:'+100/60*seconds+'%'" />
|
<div id="record_progress_bar" :style="'width:'+100/60*seconds+'%'" />
|
||||||
<div class="record_icon" />
|
<div class="record_icon" />
|
||||||
@ -62,7 +63,7 @@ import { getToken } from '@/utils/auth';
|
|||||||
import { creatSubscribe, clearSubscribe, assistant} from '@/utils/stomp';
|
import { creatSubscribe, clearSubscribe, assistant} from '@/utils/stomp';
|
||||||
import ChatSetting from './chatSetting';
|
import ChatSetting from './chatSetting';
|
||||||
import RecordRTC from 'recordrtc';
|
import RecordRTC from 'recordrtc';
|
||||||
import {getSimulationMembersNew, getSimulationConversationListNew, getSimulationConversationIdNew} from '@/api/chat';
|
import {getSimulationMembersNew, getSimulationConversationListNew, getSimulationConversationIdNew, uploadAudioFileNew} from '@/api/chat';
|
||||||
import ConstConfig from '@/scripts/ConstConfig';
|
import ConstConfig from '@/scripts/ConstConfig';
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
export default {
|
export default {
|
||||||
@ -91,7 +92,7 @@ export default {
|
|||||||
language:'zh',
|
language:'zh',
|
||||||
sex:'1'
|
sex:'1'
|
||||||
},
|
},
|
||||||
currentCoversition:'',
|
currentCoversition:{id:'all', name:'所有人', group:true},
|
||||||
headerTitle:'所有人'
|
headerTitle:'所有人'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -108,6 +109,7 @@ export default {
|
|||||||
getSimulationConversationListNew(this.$route.query.group).then(resp=>{
|
getSimulationConversationListNew(this.$route.query.group).then(resp=>{
|
||||||
if (resp.data) {
|
if (resp.data) {
|
||||||
this.coversitionList = resp.data;
|
this.coversitionList = resp.data;
|
||||||
|
this.coversitionList.unshift({id:'all', name:'所有人', group:true});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -127,13 +129,15 @@ export default {
|
|||||||
const that = this;
|
const that = this;
|
||||||
if (!this.recordSending && !this.recorders && !this.microphone) {
|
if (!this.recordSending && !this.recorders && !this.microphone) {
|
||||||
this.$refs.chatSetting.doClose();
|
this.$refs.chatSetting.doClose();
|
||||||
|
const StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
|
||||||
navigator.getUserMedia(
|
navigator.getUserMedia(
|
||||||
{ audio: true } // 只启用音频
|
{ audio: true } // 只启用音频
|
||||||
, function (stream) {
|
, function (stream) {
|
||||||
that.microphone = stream;
|
that.microphone = stream;
|
||||||
that.recorders = new RecordRTC(that.microphone, {
|
that.recorders = new RecordRTC(that.microphone, {
|
||||||
type: 'audio',
|
type: 'audio',
|
||||||
checkForInactiveTracks: true
|
recorderType: StereoAudioRecorder,
|
||||||
|
numberOfAudioChannels: 2
|
||||||
});
|
});
|
||||||
that.recorders.startRecording();
|
that.recorders.startRecording();
|
||||||
that.recordSending = true;
|
that.recordSending = true;
|
||||||
@ -203,6 +207,13 @@ export default {
|
|||||||
const blob = that.recorders.getBlob();
|
const blob = that.recorders.getBlob();
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('file', blob);
|
fd.append('file', blob);
|
||||||
|
uploadAudioFileNew(that.group, that.form.language, that.form.sex, that.currentCoversition.id, fd)
|
||||||
|
.then((data) => {
|
||||||
|
debugger;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
// 调用接口(待添加)
|
// 调用接口(待添加)
|
||||||
if (that.microphone) {
|
if (that.microphone) {
|
||||||
that.microphone.stop();
|
that.microphone.stop();
|
||||||
@ -259,18 +270,18 @@ export default {
|
|||||||
const data = resp.data;
|
const data = resp.data;
|
||||||
const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; });
|
const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; });
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
this.coversitionList.push({id:data.id, name:data.name});
|
this.coversitionList.push(data);
|
||||||
}
|
}
|
||||||
this.currentCoversition = data.id;
|
this.currentCoversition = {id:data.id, group:data.group};
|
||||||
this.headerTitle = data.name;
|
this.headerTitle = data.name;
|
||||||
|
this.showMembers = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeCoversition(coversition) {
|
changeCoversition(coversition) {
|
||||||
this.currentCoversition = coversition.id;
|
|
||||||
this.headerTitle = coversition.name;
|
this.headerTitle = coversition.name;
|
||||||
|
this.currentCoversition = {id:coversition.id, group:coversition.group};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -283,6 +294,7 @@ export default {
|
|||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom:28px;
|
bottom:28px;
|
||||||
|
z-index:22;
|
||||||
}
|
}
|
||||||
.chat-box{
|
.chat-box{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -75,7 +75,7 @@ export default {
|
|||||||
width: 54%;
|
width: 54%;
|
||||||
height: 143px;
|
height: 143px;
|
||||||
border: 1px #dedede solid;
|
border: 1px #dedede solid;
|
||||||
left: 23%;
|
left: 33%;
|
||||||
top: 24%;
|
top: 24%;
|
||||||
z-index: 7;
|
z-index: 7;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
Loading…
Reference in New Issue
Block a user