Browse Source

修改录音

feature
战立标 2 years ago
parent
commit
3c082ccc84
  1. 12
      src/components/Audio/index.less
  2. 7
      src/components/Audio/index.vue
  3. 17
      src/components/Recording/index.vue
  4. 64
      src/views/userInfo/index.vue

12
src/components/Audio/index.less

@ -16,3 +16,15 @@
font-size: 16px; font-size: 16px;
} }
} }
.progress-bar {
background: #f6f6f6;
width: calc(100% - 10px);
margin: 0 10px;
height: 4px;
border-radius: 100px;
overflow: hidden;
.progress-bar-con {
background: rgb(62, 146, 255);
height: 100%;
}
}

7
src/components/Audio/index.vue

@ -2,7 +2,10 @@
<div class="progress"> <div class="progress">
<van-icon name="play-circle-o" @click="onPlayVoice" v-if="playTime === 0 || playTime === voiceList.duration" /> <van-icon name="play-circle-o" @click="onPlayVoice" v-if="playTime === 0 || playTime === voiceList.duration" />
<van-icon name="stop-circle-o" @click="stopPlayHandle" v-else /> <van-icon name="stop-circle-o" @click="stopPlayHandle" v-else />
<van-progress :show-pivot="false" :percentage="voiceList.duration ? (playTime / voiceList.duration) * 100 : 0" /> <div class="progress-bar">
<div class="progress-bar-con" :style="{ width: (playTime / voiceList.duration) * 100 + '%' }"></div>
</div>
<!-- <van-progress :show-pivot="false" :percentage="(playTime / voiceList.duration) * 100" /> -->
<div class="time"> <div class="time">
{{ formatTime(voiceList.duration) }} {{ formatTime(voiceList.duration) }}
</div> </div>
@ -37,7 +40,7 @@ export default {
watch: { watch: {
audioSrc(val) { audioSrc(val) {
console.log(val, 'valvalval') console.log(val, 'valvalval')
this.voiceList = this.val this.voiceList = val
} }
}, },
mounted() { mounted() {

17
src/components/Recording/index.vue

@ -84,12 +84,15 @@ export default {
clearTimeout(this.timeOutEvent) clearTimeout(this.timeOutEvent)
clearInterval(this.btnDurationTimer) clearInterval(this.btnDurationTimer)
this.btnDuration = 1 this.btnDuration = 1
wx.stopRecord({ if (this.voiceList.localId) {
fail: function (res) {}, wx.stopRecord({
success: function (res) { fail: function (res) {},
// this.localId = res.localId success: function (res) {
} // this.localId = res.localId
}) }
})
}
// 500ms // 500ms
this.timeOutEvent = 0 this.timeOutEvent = 0
this.isRecording = true this.isRecording = true
@ -118,6 +121,7 @@ export default {
if (timeOutEvent === 0) { if (timeOutEvent === 0) {
wx.stopRecord({ wx.stopRecord({
success: res => { success: res => {
console.log(res, 'res')
this.onRecorded(res.localId) this.onRecorded(res.localId)
} }
}) })
@ -126,6 +130,7 @@ export default {
}, },
// //
onRecorded(localId) { onRecorded(localId) {
console.log(localId, 'localId')
const { recordStartTime } = this const { recordStartTime } = this
const endTime = new Date().getTime() const endTime = new Date().getTime()
const arrItem = { const arrItem = {

64
src/views/userInfo/index.vue

@ -337,12 +337,12 @@ export default {
getAllAgencyStreet({}).then(res => { getAllAgencyStreet({}).then(res => {
this.streetOptions = res this.streetOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.organizationName, label: item.organizationName,
value: item.id, value: item.id,
customerId: item.customerId customerId: item.customerId
} }
}) })
: [] : []
this.communityOptions = [] this.communityOptions = []
console.log(this.city) console.log(this.city)
@ -365,11 +365,11 @@ export default {
}).then(res => { }).then(res => {
this.communityOptions = res this.communityOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.organizationName, label: item.organizationName,
value: item.id value: item.id
} }
}) })
: [] : []
// this.quarterOptions = [] // this.quarterOptions = []
}) })
@ -381,12 +381,12 @@ export default {
}).then(res => { }).then(res => {
this.quarterOptions = res this.quarterOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value, value: item.value,
gridId: item.pid gridId: item.pid
} }
}) })
: [] : []
// this.buildingOptions = [] // this.buildingOptions = []
}) })
@ -398,11 +398,11 @@ export default {
}).then(res => { }).then(res => {
this.buildingOptions = res this.buildingOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value value: item.value
} }
}) })
: [] : []
// this.unitOptions = [] // this.unitOptions = []
}) })
@ -414,11 +414,11 @@ export default {
}).then(res => { }).then(res => {
this.unitOptions = res this.unitOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value value: item.value
} }
}) })
: [] : []
// this.houseOptions = [] // this.houseOptions = []
}) })
@ -430,11 +430,11 @@ export default {
}).then(res => { }).then(res => {
this.houseOptions = res this.houseOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value value: item.value
} }
}) })
: [] : []
}) })
} }

Loading…
Cancel
Save