Commit 5bbb7e44 authored by songrui's avatar songrui

mp3播放修改

parent 417f673e
......@@ -93,7 +93,7 @@ export default {
let date = Math.ceil(value)
let minutes = Math.floor(date / 60)
let seconds = date % 60
let format = '' + (minutes >= 10 ? minutes : '0' + minutes) + ':' + (seconds >= 10 ? seconds : '0' + seconds)
let format = `${minutes >= 10 ? minutes : '0' + minutes.toString()}:${seconds >= 10 ? seconds : '0' + seconds.toString()}`
return format
},
onProgress(value) {
......@@ -106,7 +106,6 @@ export default {
},
watch: {
activeMediaUrl(val) {
console.log('activeMediaUrl', val)
if (val !== this.file.annexUrl) {
this.stop()
}
......
......@@ -23,7 +23,7 @@
</van-popup> -->
<van-overlay :show="visible">
<div class="h-full flex items-center justify-center wrapper" @click.stop>
<video controls v-if="visible">
<video controls v-if="visible" ref="video">
<source :src="activeVideo.annexUrl" type="video/mp4" />
播放失败!
</video>
......@@ -37,6 +37,7 @@
export default {
props: {
files: { default: () => [] },
activeMediaUrl: { default: '' },
remove: Boolean
},
emits: ['play', 'onRemove'],
......@@ -55,6 +56,14 @@ export default {
removeBtn(item) {
this.$emit('onRemove', item)
}
},
watch: {
activeMediaUrl(val) {
if (val !== this.activeVideo.annexUrl) {
const dom = this.$refs.video
dom && dom.pause()
}
}
}
}
</script>
......
......@@ -147,7 +147,7 @@
</div>
</div>
<div class='card mt-2' v-if='detailInfo?.publicizeType?.includes(3)'>
<Mp4 :files='mp4List' :activeMediaUrl='activeMediaUrl'
<Mp4 :files='mp4List' :activeMediaUrl="activeMediaUrl"
@play='e => activeMediaUrl = e.annexUrl' />
</div>
<div class='card flex flex-col mt-2' style='row-gap: .06rem;'
......@@ -240,8 +240,8 @@
<script>
import { showToast } from 'vant'
import Mp3 from '@/residentWX/components/mediaPlay/Mp3.vue'
import Mp4 from '@/residentWX/components/mediaPlay/Mp4'
import Mp3 from '@/doctor/components/mediaPlay/Mp3.vue'
import Mp4 from '@/doctor/components/mediaPlay/Mp4.vue'
import ImagePreview from '@/residentWX/components/imagePreview/imagePreview'
import { fetchCurrencyById, messageResend } from '@/api/doctor/generalFU'
import { getTemplateDetail } from '@/api/doctor/workbench'
......@@ -293,7 +293,9 @@ export default {
{ title: '随访科室', key: 'visitOfficeName' },
{ title: '随访医生', key: 'visitDoctorName' }
],
activeMediaUrl: ''
// 控制音频同一时间只播放一个
activeMediaUrl: '',
hideActiveMediaUrl: '',
}
},
computed: {
......@@ -361,6 +363,7 @@ export default {
created() {
document.title = '通用随访详情'
this.load()
document.addEventListener('visibilitychange', this.visibilitychange)
},
methods: {
async load() {
......@@ -426,8 +429,19 @@ export default {
},
onBack() {
this.$router.back()
},
visibilitychange() {
if (document.hidden) {
this.hideActiveMediaUrl = this.activeMediaUrl
this.activeMediaUrl = ''
} else {
this.activeMediaUrl = this.hideActiveMediaUrl
}
}
},
beforeUnmount() {
document.removeEventListener('visibilitychange', this.visibilitychange)
}
}
</script>
......
......@@ -133,6 +133,8 @@
@changeValue='showTime1 = false'
:showPicker='showTime1'
@confirm='timeConfirm1'
:min-date='startDateRange.min'
:max-date='startDateRange.max'
/>
</div>
......@@ -240,7 +242,12 @@ export default {
min: undefined,
max: undefined
},
startTime: ''
startTime: '',
// 催检时间范围
startDateRange: {
min: undefined,
max: undefined
},
}
},
watch: {
......@@ -303,6 +310,9 @@ export default {
this.form._nextVisitDate = [date.year(), date.month(), date.date() + 1]
let time = new dayjs().add(1, 'day').format('YYYY-MM-DD')
this.currentTime1 = time.split('-')
this.startTime = new dayjs().add(1, 'day').format('YYYY-MM-DD HH:mm:ss')
this.startDateRange.max = new Date(date.year() + 10, date.month(), date.date())
this.startDateRange.min = new Date(date.year(), date.month(), date.date())
},
methods: {
setForm(data = {}) {
......
......@@ -192,7 +192,7 @@ import { fetchDataHandle } from '@/utils/common'
import { useStore } from '@/doctor/store'
import DocDrug from '@/doctor/components/docDrug/DocDrug'
import Mp3 from '@/doctor/components/mediaPlay/Mp3.vue'
import Mp4 from '@/doctor/components/mediaPlay/Mp4'
import Mp4 from '@/doctor/components/mediaPlay/Mp4.vue'
import CheckBtn from '@/doctor/components/checkBtn/CheckBtn'
export default {
......@@ -229,7 +229,9 @@ export default {
showUsageMethod: false,
form: {},
selectData: {},
// 控制音频同一时间只播放一个
activeMediaUrl: '',
hideActiveMediaUrl: '',
rules: {
templateContent: [{ required: true, message: '请输入' }],
dose: [{ required: true, message: '请输入' }],
......
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