Commit 5bbb7e44 authored by songrui's avatar songrui

mp3播放修改

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