Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
frontend-h5
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songrui
frontend-h5
Commits
a3aa8cb6
Commit
a3aa8cb6
authored
Dec 17, 2024
by
songrui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app进入后台 音频停止播放
parent
9531287b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
17 deletions
+42
-17
Doctor.vue
src/doctor/Doctor.vue
+13
-3
Mp3.vue
src/doctor/components/mediaPlay/Mp3.vue
+10
-0
Mp4.vue
src/doctor/components/mediaPlay/Mp4.vue
+12
-1
Detail.vue
src/doctor/followUp/generalFU/detail/Detail.vue
+0
-12
index.js
src/doctor/store/index.js
+7
-1
No files found.
src/doctor/Doctor.vue
View file @
a3aa8cb6
...
...
@@ -48,6 +48,8 @@ export default {
},
created
()
{
this
.
init
()
// 监听页面是否隐藏
document
.
addEventListener
(
'visibilitychange'
,
this
.
visibilitychange
)
},
methods
:
{
async
init
()
{
...
...
@@ -55,7 +57,7 @@ export default {
if
(
!
token
)
{
token
=
sessionStorage
.
getItem
(
'token'
)
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
token
=
'
0e47db8c-e9a7-4de9-9d8f-32b3ee256bad
'
token
=
'
80fa0d29-73b2-4593-87b8-fc46b53bf49e
'
}
}
if
(
token
)
{
...
...
@@ -64,13 +66,21 @@ export default {
this
.
store
.
$patch
({
dict
:
res
.
data
||
{}
})
const
user
=
await
getAuthInfo
()
this
.
store
.
$patch
({
authInfo
:
user
.
data
||
{}})
this
.
visible
=
true
}
else
{
backHome
()
}
},
visibilitychange
()
{
if
(
document
.
hidden
)
{
this
.
store
.
onDocumentHidden
(
true
)
}
else
{
this
.
store
.
onDocumentHidden
(
false
)
}
}
},
beforeUnmount
()
{
document
.
removeEventListener
(
'visibilitychange'
,
this
.
visibilitychange
)
}
}
</
script
>
...
...
src/doctor/components/mediaPlay/Mp3.vue
View file @
a3aa8cb6
...
...
@@ -25,6 +25,7 @@
<
script
>
import
{
musicPlayer
}
from
'./mp3.js'
import
{
showToast
}
from
'vant'
import
{
useStore
}
from
'@/doctor/store/index.js'
export
default
{
props
:
{
...
...
@@ -35,6 +36,7 @@ export default {
emits
:
[
'play'
,
'onRemove'
],
data
()
{
return
{
store
:
useStore
(),
player
:
{},
// 正在播放的items
activeAudio
:
{},
...
...
@@ -90,6 +92,7 @@ export default {
if
(
!
value
)
{
return
'00:00'
}
// value = value + ''
let
date
=
Math
.
ceil
(
value
)
let
minutes
=
Math
.
floor
(
date
/
60
)
let
seconds
=
date
%
60
...
...
@@ -109,6 +112,13 @@ export default {
if
(
val
!==
this
.
file
.
annexUrl
)
{
this
.
stop
()
}
},
'store.documentHidden'
:
{
handler
(
val
)
{
if
(
val
&&
this
.
activeMediaUrl
==
this
.
file
.
annexUrl
)
{
this
.
stop
()
}
}
}
}
}
...
...
src/doctor/components/mediaPlay/Mp4.vue
View file @
a3aa8cb6
...
...
@@ -34,6 +34,8 @@
</
template
>
<
script
>
import
{
useStore
}
from
'@/doctor/store/index.js'
export
default
{
props
:
{
files
:
{
default
:
()
=>
[]
},
...
...
@@ -44,7 +46,8 @@ export default {
data
()
{
return
{
visible
:
false
,
activeVideo
:
{}
activeVideo
:
{},
store
:
useStore
()
}
},
methods
:
{
...
...
@@ -63,6 +66,14 @@ export default {
const
dom
=
this
.
$refs
.
video
dom
&&
dom
.
pause
()
}
},
'store.documentHidden'
:
{
handler
(
val
)
{
if
(
val
&&
this
.
activeMediaUrl
==
this
.
activeVideo
.
annexUrl
)
{
const
dom
=
this
.
$refs
.
video
dom
&&
dom
.
pause
()
}
}
}
}
}
...
...
src/doctor/followUp/generalFU/detail/Detail.vue
View file @
a3aa8cb6
...
...
@@ -363,7 +363,6 @@ export default {
created
()
{
document
.
title
=
'通用随访详情'
this
.
load
()
document
.
addEventListener
(
'visibilitychange'
,
this
.
visibilitychange
)
},
methods
:
{
async
load
()
{
...
...
@@ -429,18 +428,7 @@ 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
>
...
...
src/doctor/store/index.js
View file @
a3aa8cb6
...
...
@@ -8,7 +8,9 @@ export const useStore = defineStore('chronic', {
//登录医生相关基本信息
authInfo
:
{},
// 刷新标记
refreshMark
:
1
refreshMark
:
1
,
// 页面是否处于隐藏状态
documentHidden
:
false
}
},
getters
:
{},
...
...
@@ -33,5 +35,9 @@ export const useStore = defineStore('chronic', {
onRefreshMark
()
{
this
.
refreshMark
++
}
,
onDocumentHidden
(
value
)
{
this
.
documentHidden
=
value
}
}
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment