Browse Source

修改录音

master
战立标 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;
}
}
.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">
<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-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">
{{ formatTime(voiceList.duration) }}
</div>
@ -37,7 +40,7 @@ export default {
watch: {
audioSrc(val) {
console.log(val, 'valvalval')
this.voiceList = this.val
this.voiceList = val
}
},
mounted() {

17
src/components/Recording/index.vue

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

64
src/views/userInfo/index.vue

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

Loading…
Cancel
Save