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
01d98f5d
Commit
01d98f5d
authored
Jul 12, 2019
by
wangxuelai
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/sj-dev-v5' into develop-officialweb
parents
ecba467b
af275c73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
2 deletions
+142
-2
clocklist.js
src/pages/websiteindex/clocklist.js
+142
-2
No files found.
src/pages/websiteindex/clocklist.js
View file @
01d98f5d
// src/pages/websiteindex/clocklist.js
import
{
LocalStorage
LocalStorage
,
audioorigin
,
scenQueryGet
,
}
from
'../../../utilities/index.js'
;
import
{
clockList
,
...
...
@@ -53,7 +55,8 @@ Page({
this
.
setData
({
sid
:
sid
||
0
});
this
.
websitehomeGet
()
this
.
websitehomeGet
();
this
.
innerAudioContext
=
wx
.
createInnerAudioContext
();
// 当前页面唯一的一个音频容器
},
/**
...
...
@@ -479,4 +482,141 @@ Page({
})
},
voiceIntervalPlay
(
value
)
{
// 初始化录音的状态
let
voiceInterval
=
setInterval
(()
=>
{
let
audioStorage
=
this
.
data
.
audioStorage
;
let
currentTime
=
++
audioStorage
[
value
].
currentTime
;
this
.
setData
({
audioStorage
})
if
(
currentTime
>=
this
.
data
.
audioStorage
[
value
].
duration
)
{
audioStorage
[
value
].
play
=
false
;
audioStorage
[
value
].
currentTime
=
0
;
this
.
setData
({
audioStorage
})
clearInterval
(
this
.
data
.
voiceInterval
);
}
},
1000
);
this
.
setData
({
voiceInterval
})
},
playvoice
(
e
)
{
const
{
value
,
duration
}
=
e
.
detail
;
const
that
=
this
;
this
.
innerAudioContext
.
src
=
audioorigin
(
value
);
this
.
innerAudioContext
.
obeyMuteSwitch
=
false
;
that
.
resetAudiosPlayStatus
();
clearInterval
(
that
.
data
.
voiceInterval
);
let
audioStorage
=
that
.
data
.
audioStorage
;
if
(
!
audioStorage
[
value
])
{
audioStorage
[
value
]
=
{
play
:
true
,
currentTime
:
0
,
duration
}
}
else
{
if
(
audioStorage
[
value
].
currentTime
==
audioStorage
[
value
].
duration
)
{
audioStorage
[
value
].
currentTime
=
0
;
audioStorage
[
value
].
play
=
true
;
}
else
{
audioStorage
[
value
].
play
=
true
;
}
}
this
.
innerAudioContext
.
seek
(
audioStorage
[
value
].
currentTime
)
this
.
innerAudioContext
.
play
();
that
.
voiceIntervalPlay
(
value
);
that
.
setData
({
audioStorage
,
})
this
.
innerAudioContext
.
onCanplay
(
function
(
e
)
{
console
.
log
(
'可以播放'
)
})
},
pausevoice
(
e
)
{
const
{
value
}
=
e
.
detail
;
let
audioStorage
=
this
.
data
.
audioStorage
;
audioStorage
[
value
].
play
=
false
;
this
.
setData
({
audioStorage
,
})
this
.
innerAudioContext
.
pause
();
clearInterval
(
this
.
data
.
voiceInterval
);
},
voiceslide
(
e
)
{
const
{
value
,
slide
,
duration
}
=
e
.
detail
;
let
audioStorage
=
this
.
data
.
audioStorage
;
if
(
!
audioStorage
[
value
])
{
audioStorage
[
value
]
=
{
play
:
false
,
currentTime
:
slide
,
duration
}
}
else
{
audioStorage
[
value
].
currentTime
=
slide
;
}
this
.
innerAudioContext
.
seek
(
slide
);
this
.
setData
({
audioStorage
,
})
},
slidestart
(
e
)
{
const
{
value
,
slide
}
=
e
.
detail
;
let
audioStorage
=
this
.
data
.
audioStorage
;
if
(
audioStorage
[
value
]
&&
audioStorage
[
value
].
play
)
{
// 如果当前是播放状态 则先暂停音乐盒计时器 播放按钮状态不需要改
this
.
innerAudioContext
.
pause
();
clearInterval
(
this
.
data
.
voiceInterval
);
}
else
{
// 如果当前不是播放状态 则该干嘛干嘛
}
},
slideend
(
e
)
{
const
{
value
,
slide
}
=
e
.
detail
;
let
audioStorage
=
this
.
data
.
audioStorage
;
if
(
audioStorage
[
value
]
&&
audioStorage
[
value
].
play
)
{
// 如果当前是播放状态 则启用定时器 播放按钮状态不需要改
// clearInterval(this.data.voiceInterval);
this
.
innerAudioContext
.
play
();
this
.
voiceIntervalPlay
(
value
);
}
else
{
// 如果当前不是播放状态 则该干嘛干嘛
}
},
resetAudiosPlayStatus
()
{
// 点击一个录音的时候把其他的录音状态改成暂停状态
let
audioStorage
=
this
.
data
.
audioStorage
;
Object
.
keys
(
audioStorage
).
forEach
((
key
)
=>
{
audioStorage
[
key
].
play
=
false
});
this
.
setData
({
audioStorage
,
})
},
delvoice
(
e
)
{
const
{
value
}
=
e
.
detail
;
let
audioStorage
=
this
.
data
.
audioStorage
;
if
(
audioStorage
[
value
]
&&
audioStorage
[
value
].
play
)
{
// 如果当前是播放状态 删除录音的操作要把录音销毁掉
delete
audioStorage
[
value
]
this
.
innerAudioContext
.
destroy
();
clearInterval
(
this
.
data
.
voiceInterval
);
}
this
.
setData
({
audioStorage
,
})
},
})
\ No newline at end of file
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