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
0a284ed9
Commit
0a284ed9
authored
Oct 09, 2019
by
lvtz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix + add 学员详情音视频播放
parent
09b2e9fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
7 deletions
+183
-7
studentdetail.js
business/pages/studentcenter/studentdetail.js
+176
-4
studentdetail.wxml
business/pages/studentcenter/studentdetail.wxml
+4
-0
studentadd.js
src/pages/signup/studentadd.js
+3
-3
No files found.
business/pages/studentcenter/studentdetail.js
View file @
0a284ed9
...
...
@@ -13,7 +13,8 @@ import {
newCommentIndex
}
from
'../../../service/customer/circleindex.js'
;
import
{
LocalStorage
LocalStorage
,
audioorigin
,
}
from
'../../../utilities/index.js'
;
function
compare
(
property
)
{
...
...
@@ -76,13 +77,22 @@ Page({
tid
:
0
,
cid
:
0
,
}
}
},
audioStorage
:
{},
videostatus
:
{
preSrc
:
''
,
currentSrc
:
''
,
videoShow
:
false
,
videoId
:
''
,
src
:
''
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
this
.
innerAudioContext
=
wx
.
createInnerAudioContext
();
// 当前页面唯一的一个音频容器
const
{
sid
,
studentId
...
...
@@ -123,14 +133,20 @@ Page({
* 生命周期函数--监听页面隐藏
*/
onHide
:
function
()
{
this
.
innerAudioContext
.
pause
();
this
.
resetAudiosPlayStatus
()
clearInterval
(
this
.
data
.
voiceInterval
);
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
:
function
()
{
this
.
innerAudioContext
.
pause
();
this
.
setData
({
audioStorage
:
{}
})
clearInterval
(
this
.
data
.
voiceInterval
);
},
/**
...
...
@@ -624,6 +640,162 @@ Page({
[
`clockList[
${
listindex
}
][
${
index
}
]`
]:
_clockList
[
listindex
][
index
]
})
},
// 跟录音相关的操作
// 跟录音相关的操作
// 播放录音的相关操作
// 格式是以录音名字为key value为{play: true || false, currentTime: 0}的一个对象
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
;
this
.
innerAudioContext
.
src
=
audioorigin
(
value
);
this
.
innerAudioContext
.
obeyMuteSwitch
=
false
;
this
.
resetAudiosPlayStatus
();
clearInterval
(
this
.
data
.
voiceInterval
);
let
audioStorage
=
this
.
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
();
this
.
voiceIntervalPlay
(
value
);
this
.
setData
({
audioStorage
,
})
},
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
.
pause
();
clearInterval
(
this
.
data
.
voiceInterval
);
}
this
.
setData
({
audioStorage
,
})
},
// 跟录音相关的操作
// 视频播放相关代码
playvideo
(
e
)
{
console
.
log
(
e
)
const
that
=
this
;
const
{
src
,
from
,
mode
}
=
e
.
detail
;
this
.
setData
({
'videostatus.videoId'
:
src
,
'videostatus.videoShow'
:
true
,
'videostatus.src'
:
src
,
'videostatus.mode'
:
mode
||
'mp4'
,
})
setTimeout
(()
=>
{
that
.
videoContext
=
wx
.
createVideoContext
(
src
);
that
.
videoContext
.
play
();
that
.
videoContext
.
requestFullScreen
();
},
500
)
},
screenchange
(
e
)
{
const
{
fullScreen
}
=
e
.
detail
;
if
(
!
fullScreen
)
{
// 退出全屏时的操作
this
.
setData
({
'videostatus.videoId'
:
''
,
'videostatus.videoShow'
:
false
,
'videostatus.src'
:
''
,
})
}
},
closeVideo
()
{
this
.
setData
({
'videostatus.videoId'
:
''
,
'videostatus.videoShow'
:
false
,
'videostatus.src'
:
''
,
})
},
// 视频播放相关代码
showcommenteditor
(
e
)
{
const
{
listindex
,
index
}
=
e
.
currentTarget
.
dataset
;
Object
.
assign
(
this
.
data
,{
...
...
business/pages/studentcenter/studentdetail.wxml
View file @
0a284ed9
...
...
@@ -242,6 +242,10 @@
</view>
</view>
<view class="videodialog" wx:if="{{videostatus.videoShow}}">
<view class="videodialogmask" bindtap="closeVideo"></view>
<video class="" src="{{filter.transformOssVideofy(videostatus.src,videostatus.mode)}}" id="{{videostatus.videoId}}" initial-time="0" autoplay="false" loop="false" direction="0" bindplay="" bindpause="" bindended="" bindtimeupdate="" bindwaiting="" binderror="" bindfullscreenchange="screenchange"></video>
</view>
<view class="" data-editor="commenteditor">
<comment-editor wx:if="{{commenteditor}}" prams="{{commentclock}}" bind:hidecommenteditor="hidecommenteditor" type="2b"></comment-editor>
</view>
...
...
src/pages/signup/studentadd.js
View file @
0a284ed9
...
...
@@ -32,7 +32,7 @@ Page({
onLoad
:
function
(
options
)
{
// 页面需要的参数sid
let
that
=
this
;
options
.
scene
=
's=3&uuid=298bbb84'
;
//
options.scene = 's=3&uuid=298bbb84';
if
(
options
.
scene
){
let
sceneQuery
=
scenQueryGet
(
options
.
scene
);
const
{
s
,
uuid
}
=
sceneQuery
;
...
...
@@ -43,9 +43,9 @@ Page({
that
.
schoolInfoGet
();
})
}
else
{
const
{
s
id
,
uuid
}
=
options
;
const
{
s
,
uuid
}
=
options
;
that
.
setData
({
sid
:
s
id
,
sid
:
s
,
uuid
:
uuid
,
},()
=>
{
that
.
schoolInfoGet
()
...
...
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