Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_iplayabc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
middleLayer_for_iplayabc
Commits
422fc2a3
Commit
422fc2a3
authored
Mar 31, 2022
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 循环播放
parent
cd54f7c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
19 deletions
+29
-19
middleLayer.js
assets/middleLayer_for_iplayabc/script/middleLayer.js
+29
-19
No files found.
assets/middleLayer_for_iplayabc/script/middleLayer.js
View file @
422fc2a3
...
...
@@ -72,6 +72,7 @@ cc.Class({
name
:
null
,
// 用户取的英文名
birthday
:
null
,
// 用户的生日
courseIds
:
null
,
// 根据推荐生成的课件ID数组
currentIndex
:
null
,
// 当前进行的是courseIds里第几个课件
// 统一释放异步资源的方法
onLoad
()
{
...
...
@@ -195,6 +196,7 @@ cc.Class({
return
;
}
this
.
courseIds
=
res
.
data
;
this
.
currentIndex
=
0
;
this
.
loadOnlineCourseWare
(
this
.
courseIds
[
0
],
false
);
});
},
...
...
@@ -495,6 +497,24 @@ cc.Class({
});
},
goNextCourseware
()
{
this
.
currentIndex
++
;
if
(
!
this
.
courseIds
[
this
.
currentIndex
]){
this
.
currentIndex
=
0
;
}
this
.
callNetworkApiGet
(
`http://iteachabc.com`
,
`/api/courseware/v1/
${
this
.
courseIds
[
this
.
currentIndex
]}
/list`
,
{},
(
data
)
=>
{
if
(
data
.
rows
&&
data
.
rows
.
length
>
0
)
{
this
.
courses
=
data
.
rows
;
this
.
courseIndex
=
0
;
this
.
courseItem
=
data
.
rows
[
0
];
this
.
loadPageBundle
();
}
else
{
// 没有制作课件页,直接切换到下一个课件
this
.
goNextCourseware
();
}
});
},
goPrePage
()
{
this
.
goTarIndexPage
(
this
.
courseIndex
-
1
);
},
...
...
@@ -502,24 +522,20 @@ cc.Class({
this
.
goTarIndexPage
(
this
.
courseIndex
+
1
);
},
goTarIndexPage
(
index
)
{
if
(
!
this
.
courses
||
index
==
this
.
courseIndex
||
index
<
0
||
index
>
this
.
courses
.
length
-
1
)
{
if
(
!
this
.
courses
||
index
==
this
.
courseIndex
||
index
<
0
)
{
return
;
}
this
.
showMask
();
this
.
showWaitingLetters
();
window
.
courseware
.
freeAllOcMethod
();
if
(
index
>
this
.
courses
.
length
-
1
)
{
// 本课件播放完了,切换到下一个课件
this
.
goNextCourseware
();
return
;
}
this
.
courseIndex
=
index
;
this
.
courseItem
=
this
.
courses
[
this
.
courseIndex
];
if
(
this
.
courseIndex
==
0
)
{
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
}
else
{
cc
.
find
(
'
middleLayer/BtnLeft
'
).
active
=
false
;
}
if
(
this
.
courseIndex
==
this
.
courses
.
length
-
1
)
{
cc
.
find
(
'
middleLayer/BtnRight
'
).
active
=
false
;
}
else
{
// cc.find('middleLayer/BtnRight').active = true;
}
this
.
loadPageBundle
();
},
log
(
str
)
{
...
...
@@ -558,6 +574,7 @@ cc.Class({
courseItem
:
null
,
loadOnlineCourseWare
(
courseId
,
linkFlag
)
{
this
.
hideUI
();
this
.
showMask
();
this
.
showWaitingLetters
();
let
api
=
`/api/courseware/v1/
${
courseId
}
/list`
;
...
...
@@ -622,8 +639,6 @@ cc.Class({
},
loadBundle
(
sceneName
,
version
,
bondleUrl
)
{
this
.
currentBundleInfo
=
{
sceneName
,
version
,
bondleUrl
};
this
.
showMask
();
this
.
showWaitingLetters
();
cc
.
assetManager
.
loadBundle
(
bondleUrl
,
{
version
:
version
},
async
(
err
,
bundle
)
=>
{
if
(
err
)
{
return
this
.
asyncDelayLog
(
err
);
...
...
@@ -648,11 +663,6 @@ cc.Class({
});
},
reloadBundle
()
{
const
{
sceneName
,
version
,
bondleUrl
}
=
this
.
currentBundleInfo
;
this
.
loadBundle
(
sceneName
,
version
,
bondleUrl
);
},
showMask
()
{
const
mask
=
cc
.
find
(
'
middleLayer/mask
'
);
mask
.
active
=
true
;
...
...
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