对话
This commit is contained in:
@@ -144,42 +144,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapActions(['autoLogin', 'getUserInfo']),
|
...mapActions(['autoLogin', 'getUserInfo']),
|
||||||
startRecord() {
|
startRecord() {
|
||||||
// if(this.isFlag) return
|
|
||||||
// this.isStart = true
|
|
||||||
// uni.authorize({
|
|
||||||
// scope: 'scope.record',
|
|
||||||
// success() {
|
|
||||||
// // const options = {
|
|
||||||
// // duration: 10000,
|
|
||||||
// // sampleRate: 44100,
|
|
||||||
// // numberOfChannels: 1,
|
|
||||||
// // encodeBitRate: 192000,
|
|
||||||
// // format: 'aac',
|
|
||||||
// // frameSize: 50
|
|
||||||
// // }
|
|
||||||
// const options = {
|
|
||||||
// duration: 60000,
|
|
||||||
// sampleRate: 16000,
|
|
||||||
// format: 'mp3'
|
|
||||||
// }
|
|
||||||
// recorderManager.start(options);
|
|
||||||
|
|
||||||
// },
|
|
||||||
// fail(err) {
|
|
||||||
// this.isStart = false
|
|
||||||
// uni.showModal({
|
|
||||||
// title: "提示",
|
|
||||||
// content: "您的录音权限未开启",
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
this.isStart = true
|
this.isStart = true
|
||||||
this.recorder = Recorder({
|
this.recorder = Recorder({
|
||||||
type: 'mp3',
|
type: 'mp3',
|
||||||
sampleRate: 16000,
|
sampleRate: 16000,
|
||||||
bitRate: 16
|
bitRate: 16
|
||||||
})
|
})
|
||||||
|
|
||||||
this.recorder.open(() => {
|
this.recorder.open(() => {
|
||||||
this.recorder.start()
|
this.recorder.start()
|
||||||
})
|
})
|
||||||
@@ -220,25 +190,6 @@ export default {
|
|||||||
this.type = 'text'
|
this.type = 'text'
|
||||||
this.content = ''
|
this.content = ''
|
||||||
},
|
},
|
||||||
upLoad(filePath) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
uni.uploadFile({
|
|
||||||
url: `${this.$http.defaults.baseURL}/admin/file/add`,
|
|
||||||
filePath,
|
|
||||||
fileType: 'audio',
|
|
||||||
name: 'file',
|
|
||||||
success: uploadFileRes => {
|
|
||||||
this.voiceUrl = JSON.parse(uploadFileRes.data).data[0].split(';')[0]
|
|
||||||
this.voiceId = JSON.parse(uploadFileRes.data).data[0].split(';')[1]
|
|
||||||
this.sendVoice()
|
|
||||||
resolve(uploadFileRes)
|
|
||||||
},
|
|
||||||
fail: err => {
|
|
||||||
reject(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
sendMsg() {
|
sendMsg() {
|
||||||
if(!this.user.token) {
|
if(!this.user.token) {
|
||||||
return this.$u.toast("请先进行登录")
|
return this.$u.toast("请先进行登录")
|
||||||
@@ -308,15 +259,38 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// play(src, index) {
|
||||||
|
// innerAudioContext.stop();
|
||||||
|
// if(this.messageList[index].isPlay) {
|
||||||
|
// innerAudioContext.onStop(() => {
|
||||||
|
// this.messageList[index].isPlay = false
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// this.messageList.map((item) => {
|
||||||
|
// if(item.sdkFileUrl) {
|
||||||
|
// item.isPlay = false
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// this.messageList[index].isPlay = true
|
||||||
|
// innerAudioContext.src = src;
|
||||||
|
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// innerAudioContext.play();
|
||||||
|
// })
|
||||||
|
// innerAudioContext.onEnded(() => {
|
||||||
|
// this.messageList[index].isPlay = false
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// playStop(index) {
|
||||||
|
// innerAudioContext.stop();
|
||||||
|
// innerAudioContext.onStop(() => {
|
||||||
|
// this.messageList[index].isPlay = false
|
||||||
|
// })
|
||||||
|
// },
|
||||||
play(src, index) {
|
play(src, index) {
|
||||||
innerAudioContext.stop();
|
innerAudioContext.stop();
|
||||||
if(this.messageList[index].isPlay) {
|
|
||||||
innerAudioContext.onStop(() => {
|
|
||||||
this.messageList[index].isPlay = false
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.messageList.map((item) => {
|
this.messageList.map((item) => {
|
||||||
if(item.sdkFileUrl) {
|
if(item.sdkFileUrl) {
|
||||||
item.isPlay = false
|
item.isPlay = false
|
||||||
|
|||||||
Reference in New Issue
Block a user