Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
wechatapp.shangjiadao.com
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
wangxuelai
wechatapp.shangjiadao.com
Commits
5f7083d7
Commit
5f7083d7
authored
Mar 04, 2020
by
sujie@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
c6c4ebbb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
92 deletions
+90
-92
index.js
src/pages/clockeditor/index.js
+35
-43
index.js
src/pages/morethemeindex/index.js
+35
-42
index.js
src/pages/websiteindex/index.js
+20
-7
No files found.
src/pages/clockeditor/index.js
View file @
5f7083d7
...
...
@@ -152,7 +152,36 @@ Page({
},
},
onLoad
:
function
(
options
)
{
// Do some initialize when page load.
this
.
innerAudioContext
=
wx
.
createInnerAudioContext
();
const
that
=
this
;
this
.
innerAudioContext
=
wx
.
getBackgroundAudioManager
();
// 当前页面唯一的一个音频容器
this
.
innerAudioContext
.
onWaiting
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
){
return
}
audioStorage
[
actPalyaudioValue
].
isWaiting
=
true
that
.
setData
({
audioStorage
,
})
setTimeout
((
e
)
=>
{
this
.
data
.
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
;
this
.
setData
({
audioStorage
:
this
.
data
.
audioStorage
})
},
5000
)
})
this
.
innerAudioContext
.
onTimeUpdate
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
)
{
clearInterval
(
that
.
data
.
voiceInterval
);
that
.
voiceIntervalPlay
(
actPalyaudioValue
);
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
that
.
setData
({
audioStorage
,
})
}
})
const
{
id
,
tid
,
cid
,
pagefrom
,
clockdate
,
sub
}
=
options
;
this
.
setData
({
tid
,
...
...
@@ -1091,12 +1120,13 @@ audioStorage[value].isWaiting = true;
const
{
value
,
duration
}
=
e
.
currentTarget
.
dataset
;
const
that
=
this
;
let
audioStorage
=
that
.
data
.
audioStorage
;
this
.
innerAudioContext
.
src
=
audioorigin
(
value
);
this
.
innerAudioContext
.
title
=
'正在播放'
;
this
.
innerAudioContext
.
startTime
=
audioStorage
[
value
]
?
audioStorage
[
value
].
currentTime
:
0
;
this
.
innerAudioContext
.
obeyMuteSwitch
=
false
;
that
.
resetAudiosPlayStatus
();
clearInterval
(
that
.
data
.
voiceInterval
);
let
audioStorage
=
that
.
data
.
audioStorage
;
if
(
!
audioStorage
[
value
])
{
audioStorage
[
value
]
=
{
play
:
true
,
...
...
@@ -1113,46 +1143,8 @@ audioStorage[value].isWaiting = true;
audioStorage
[
value
].
play
=
true
;
}
}
this
.
innerAudioContext
.
onWaiting
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
){
return
}
audioStorage
[
actPalyaudioValue
].
isWaiting
=
true
that
.
setData
({
audioStorage
,
})
setTimeout
((
e
)
=>
{
this
.
data
.
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
;
this
.
setData
({
audioStorage
:
this
.
data
.
audioStorage
})
},
5000
)
})
this
.
innerAudioContext
.
onTimeUpdate
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
)
{
clearInterval
(
that
.
data
.
voiceInterval
);
that
.
voiceIntervalPlay
(
actPalyaudioValue
);
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
that
.
setData
({
audioStorage
,
})
}
})
this
.
innerAudioContext
.
onCanplay
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
)
{
clearInterval
(
that
.
data
.
voiceInterval
);
that
.
voiceIntervalPlay
(
actPalyaudioValue
);
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
that
.
setData
({
audioStorage
,
})
}
})
this
.
innerAudioContext
.
seek
(
audioStorage
[
value
].
currentTime
)
//this.innerAudioContext.seek(audioStorage[value].currentTime)
this
.
innerAudioContext
.
play
();
this
.
innerAudioContext
.
onError
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
...
...
src/pages/morethemeindex/index.js
View file @
5f7083d7
...
...
@@ -191,7 +191,35 @@ Page({
hasBack
:
false
},
onLoad
:
function
(
options
)
{
// Do some initialize when page load.
this
.
innerAudioContext
=
wx
.
createInnerAudioContext
();
// 当前页面唯一的一个音频容器
const
that
=
this
;
this
.
innerAudioContext
=
wx
.
getBackgroundAudioManager
();
// 当前页面唯一的一个音频容器
this
.
innerAudioContext
.
onWaiting
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
){
return
}
audioStorage
[
actPalyaudioValue
].
isWaiting
=
true
that
.
setData
({
audioStorage
,
})
setTimeout
((
e
)
=>
{
this
.
data
.
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
;
this
.
setData
({
audioStorage
:
this
.
data
.
audioStorage
})
},
5000
)
})
this
.
innerAudioContext
.
onTimeUpdate
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
)
{
clearInterval
(
that
.
data
.
voiceInterval
);
that
.
voiceIntervalPlay
(
actPalyaudioValue
);
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
that
.
setData
({
audioStorage
,
})
}
})
const
visitor
=
LocalStorage
.
getItem
(
'visitor'
);
if
(
options
.
scene
)
{
let
sceneQuery
=
scenQueryGet
(
options
.
scene
);
...
...
@@ -1861,11 +1889,13 @@ Page({
duration
}
=
e
.
detail
;
const
that
=
this
;
let
audioStorage
=
that
.
data
.
audioStorage
;
this
.
innerAudioContext
.
src
=
audioorigin
(
value
);
this
.
innerAudioContext
.
title
=
'正在播放'
;
this
.
innerAudioContext
.
startTime
=
audioStorage
[
value
]
?
audioStorage
[
value
].
currentTime
:
0
;
this
.
innerAudioContext
.
obeyMuteSwitch
=
false
;
that
.
resetAudiosPlayStatus
();
clearInterval
(
that
.
data
.
voiceInterval
);
let
audioStorage
=
that
.
data
.
audioStorage
;
if
(
!
audioStorage
[
value
])
{
audioStorage
[
value
]
=
{
play
:
true
,
...
...
@@ -1874,6 +1904,7 @@ Page({
isWaiting
:
true
}
}
else
{
audioStorage
[
value
].
isWaiting
=
true
if
(
audioStorage
[
value
].
currentTime
==
audioStorage
[
value
].
duration
)
{
audioStorage
[
value
].
currentTime
=
0
;
audioStorage
[
value
].
play
=
true
;
...
...
@@ -1881,46 +1912,8 @@ Page({
audioStorage
[
value
].
play
=
true
;
}
}
this
.
innerAudioContext
.
onWaiting
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
){
return
}
audioStorage
[
actPalyaudioValue
].
isWaiting
=
true
that
.
setData
({
audioStorage
,
})
setTimeout
((
e
)
=>
{
this
.
data
.
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
;
this
.
setData
({
audioStorage
:
this
.
data
.
audioStorage
})
},
5000
)
})
this
.
innerAudioContext
.
onTimeUpdate
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
)
{
clearInterval
(
that
.
data
.
voiceInterval
);
that
.
voiceIntervalPlay
(
actPalyaudioValue
);
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
that
.
setData
({
audioStorage
,
})
}
})
this
.
innerAudioContext
.
onCanplay
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
)
{
clearInterval
(
that
.
data
.
voiceInterval
);
that
.
voiceIntervalPlay
(
actPalyaudioValue
);
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
that
.
setData
({
audioStorage
,
})
}
})
this
.
innerAudioContext
.
seek
(
audioStorage
[
value
].
currentTime
)
// this.innerAudioContext.seek(audioStorage[value].currentTime)
this
.
innerAudioContext
.
play
();
this
.
innerAudioContext
.
onError
((
e
)
=>
{
const
audioStorage
=
this
.
data
.
audioStorage
;
...
...
src/pages/websiteindex/index.js
View file @
5f7083d7
...
...
@@ -154,7 +154,7 @@ Page({
loginCode
:
''
,
},
onLoad
:
function
(
options
)
{
// Do some initialize when page load.
this
.
innerAudioContext
=
wx
.
createInnerAudioContext
();
// 当前页面唯一的一个音频容器
this
.
innerAudioContext
=
wx
.
getBackgroundAudioManager
();
// 当前页面唯一的一个音频容器
this
.
innerAudioContext
.
onWaiting
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
){
...
...
@@ -174,15 +174,26 @@ Page({
this
.
innerAudioContext
.
onTimeUpdate
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
if
(
audioStorage
[
actPalyaudioValue
].
isWaiting
)
{
//this.innerAudioContext.seek(audioStorage[actPalyaudioValue].currentTime || 0)
clearInterval
(
this
.
data
.
voiceInterval
);
this
.
voiceIntervalPlay
(
actPalyaudioValue
);
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
this
.
setData
({
[
`audioStorage.
${
actPalyaudioValue
}
`
]
:
audioStorage
[
actPalyaudioValue
],
})
}
})
// this.innerAudioContext.onPlay(()=>{
// const { actPalyaudioValue, audioStorage} = this.data;
// console.log(audioStorage[actPalyaudioValue], 'audioStorage[actPalyaudioValue]')
// if(audioStorage[actPalyaudioValue]){
// this.innerAudioContext.seek(audioStorage[actPalyaudioValue].currentTime || 0)
// }
// this.data.audioStorage[actPalyaudioValue].isFirst = true;
// })
if
(
options
.
scene
)
{
let
sceneQuery
=
scenQueryGet
(
options
.
scene
);
const
{
...
...
@@ -1391,11 +1402,15 @@ Page({
duration
}
=
e
.
detail
;
const
that
=
this
;
let
audioStorage
=
that
.
data
.
audioStorage
;
this
.
innerAudioContext
.
src
=
audioorigin
(
value
);
this
.
innerAudioContext
.
title
=
'正在播放'
;
this
.
innerAudioContext
.
startTime
=
audioStorage
[
value
]
?
audioStorage
[
value
].
currentTime
:
0
;
this
.
innerAudioContext
.
obeyMuteSwitch
=
false
;
that
.
resetAudiosPlayStatus
();
clearInterval
(
that
.
data
.
voiceInterval
);
let
audioStorage
=
that
.
data
.
audioStorage
;
if
(
!
audioStorage
[
value
])
{
audioStorage
[
value
]
=
{
play
:
true
,
...
...
@@ -1411,11 +1426,9 @@ Page({
}
else
{
audioStorage
[
value
].
play
=
true
;
}
}
this
.
innerAudioContext
.
seek
(
audioStorage
[
value
].
currentTime
)
}
this
.
innerAudioContext
.
play
();
this
.
innerAudioContext
.
onError
((
e
)
=>
{
const
{
actPalyaudioValue
,
audioStorage
}
=
this
.
data
audioStorage
[
actPalyaudioValue
].
isWaiting
=
false
;
...
...
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