Commit 7187387a authored by Mac's avatar Mac

1

parent 624cc72e
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 10px;
} }
.release .audio-o{ .release .audio-o{
display: flex; display: flex;
...@@ -131,6 +132,12 @@ ...@@ -131,6 +132,12 @@
color: #40766E; color: #40766E;
border: 1px solid #40766E; border: 1px solid #40766E;
} }
.release .audio-ot{
width: 1;flex:1;margin-right: 20px;display: flex;flex-direction: row;align-items: center;padding: 0 10px;justify-content: space-between;
height: 20px;
background: #EBEBEB;
border-radius: 4px;
}
</style> </style>
<template> <template>
...@@ -150,11 +157,21 @@ ...@@ -150,11 +157,21 @@
</u-upload> </u-upload>
<!-- 音频 --> <!-- 音频 -->
<view class="audio" v-if='addMsg.FileType==3'> <view class="audio" v-if='addMsg.FileType==3'>
<view class="audio-o" @click="statraudio()"> <view class="audio-o" @click="statraudio()" v-if="addMsg.FileList.length==0">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound2.png" mode="widthFix" style="width: 20px;height: auto;"></image> <image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound2.png" mode="widthFix" style="width: 20px;height: auto;"></image>
<text style="margin-left: 10px;">语音录制</text> <text style="margin-left: 10px;">语音录制</text>
<text style="color: #BBBBBB;">(点击进入录制页面)</text> <text style="color: #BBBBBB;">(点击进入录制页面)</text>
</view> </view>
<view v-if="addMsg.FileList.length>0" class="audio-o" style="justify-content: space-around;width: 100%;">
<view class="audio-ot" @click="playVoice">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound2.png" mode="widthFix" style="width: 20px;height: auto;"></image>
<text>{{reDate}}</text>
</view>
<view style="font-size: 14px;color: #40766E;">
重新录制
</view>
</view>
</view> </view>
<view class="option-box" @click="getAddress()" style="margin-top: 10px;"> <view class="option-box" @click="getAddress()" style="margin-top: 10px;">
...@@ -195,6 +212,7 @@ ...@@ -195,6 +212,7 @@
<u-popup v-model="audioshow" mode="bottom" > <u-popup v-model="audioshow" mode="bottom" >
<view class="as-box"> <view class="as-box">
<view class="as-yuyin" <view class="as-yuyin"
@click="aa"
@longpress="onStartRecoder" @longpress="onStartRecoder"
@touchend="onEndRecoder" @touchend="onEndRecoder"
> >
...@@ -388,15 +406,28 @@ ...@@ -388,15 +406,28 @@
}) })
}, },
// 开始录制 // 开始录制
onStartRecoder () { onStartRecoder () {
console.log('长按')
recorderManager.start({ recorderManager.start({
duration: 600000 duration: 600000,
format:'mp3'
}) })
}, },
// 录制结束 // 录制结束
onEndRecoder () { onEndRecoder () {
recorderManager.stop() recorderManager.stop()
}, },
// 播放暂停录音
playVoice() {
innerAudioContext.src = this.voicePath;
if (innerAudioContext.paused) {
innerAudioContext.play()
} else {
innerAudioContext.stop();
}
},
// 监听 // 监听
onMonitorEvents(){ onMonitorEvents(){
// 录制开始 // 录制开始
...@@ -434,7 +465,7 @@ ...@@ -434,7 +465,7 @@
this.reDate = _m + ':' + _s this.reDate = _m + ':' + _s
}, },
asupload(){ asupload(){
console.log(2)
let that = this let that = this
uni.uploadFile({ uni.uploadFile({
url: that.action, url: that.action,
...@@ -445,7 +476,9 @@ ...@@ -445,7 +476,9 @@
}, },
success: (uploadFileRes) => { success: (uploadFileRes) => {
if(uploadFileRes.statusCode==200) if(uploadFileRes.statusCode==200)
console.log(uploadFileRes); console.log(JSON.parse(uploadFileRes.data));
that.addMsg.FileList=[]
that.addMsg.FileList.push(JSON.parse(uploadFileRes.data).data)
}, },
fail: function(res) { fail: function(res) {
console.log(res) console.log(res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment