Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_kyxq
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_kyxq
Commits
ec01bf30
Commit
ec01bf30
authored
Sep 28, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 二级页面
parent
e977c6c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
93 deletions
+15
-93
LibraryReadPage.ts
assets/middleLayer_for_kyxq/script/LibraryReadPage.ts
+15
-93
No files found.
assets/middleLayer_for_kyxq/script/LibraryReadPage.ts
View file @
ec01bf30
// Learn TypeScript:
import
{
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
}
from
"
./util
"
;
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
getSprNodeByUrl
,
setSprNodeMaxLen
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
...
@@ -19,86 +12,28 @@ export default class NewClass extends cc.Component {
...
@@ -19,86 +12,28 @@ export default class NewClass extends cc.Component {
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
scrollView
:
cc
.
Node
=
null
;
scrollView
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
loading
:
cc
.
Node
=
null
;
data
;
data
;
handleClickBackBtn
()
{
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
}
}
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
// onLoad () {}
start
()
{
async
start
()
{
this
.
initData
();
this
.
loading
.
active
=
true
;
this
.
initView
();
await
this
.
initData
();
await
this
.
initView
();
this
.
loading
.
active
=
false
;
}
}
initData
()
{
async
initData
()
{
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
:
this
.
node
[
'
syllabus_pid
'
]});
this
.
data
=
[
this
.
data
=
rows
;
{
type
:
"
music
"
,
iconRes
:
"
btn_music
"
,
text_cn
:
"
拼读儿歌
"
,
text_en
:
"
Music
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/5b4a2228deee47ef6ca2029a7a6adfa4.png
"
,
},
{
type
:
"
class
"
,
iconRes
:
"
btn_class
"
,
text_cn
:
"
外教课堂
"
,
text_en
:
"
Class
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/7d83d91717e64ebe7474be1c5278eb44.png
"
,
},
{
type
:
"
chant
"
,
iconRes
:
"
btn_chant
"
,
text_cn
:
"
律动时光
"
,
text_en
:
"
Chant
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/ed98242b08679b8b39f9ce34578ee614.png
"
,
},
{
type
:
"
practice
"
,
iconRes
:
"
btn_practice
"
,
text_cn
:
"
闯关练习
"
,
text_en
:
"
Practice
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/5b4a2228deee47ef6ca2029a7a6adfa4.png
"
,
},
{
type
:
"
video
"
,
iconRes
:
"
btn_video
"
,
text_cn
:
"
场景动画
"
,
text_en
:
"
Video
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/100c6b50e6c846c712f12332a05446cc.png
"
,
},
{
type
:
"
review
"
,
iconRes
:
"
btn_review
"
,
text_cn
:
"
故事复述
"
,
text_en
:
"
Review
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/cdbfca8e7db0e05e0d776594e7872296.png
"
,
},
{
type
:
"
speaking
"
,
iconRes
:
"
btn_speaking
"
,
text_cn
:
"
外教带读
"
,
text_en
:
"
Speaking
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/cdbfca8e7db0e05e0d776594e7872296.png
"
,
},
{
type
:
"
show
"
,
iconRes
:
"
btn_show
"
,
text_cn
:
"
外教带读
"
,
text_en
:
"
My Show
"
,
pic_url
:
"
https://staging-teach.cdn.ireadabc.com/100c6b50e6c846c712f12332a05446cc.png
"
,
},
]
}
}
initView
()
{
initView
()
{
...
@@ -134,21 +69,7 @@ export default class NewClass extends cc.Component {
...
@@ -134,21 +69,7 @@ export default class NewClass extends cc.Component {
const
itemNode
=
cc
.
instantiate
(
listItem
);
const
itemNode
=
cc
.
instantiate
(
listItem
);
itemNode
[
'
data
'
]
=
data
;
itemNode
[
'
data
'
]
=
data
;
getSprNodeByUrl
(
data
.
cover
,
(
spr
)
=>
{
// const iconNodeBase = cc.find(data.iconRes , this.resNode);
// const iconLockedBase = cc.find(data.iconRes + "_locked" , this.resNode);
// const iconNode = cc.instantiate( iconNodeBase );
// const iconLocked = cc.instantiate( iconLockedBase );
// const picLayer = cc.find("pic_layer", itemNode);
// // console.log("picLayer: " , picLayer);
// picLayer.addChild(iconNode);
// setSprNodeMaxLen(iconNode, picLayer.width, picLayer.height);
getSprNodeByUrl
(
data
.
pic_url
,
(
spr
)
=>
{
const
sprNode
=
spr
.
node
;
const
sprNode
=
spr
.
node
;
const
picLayer
=
cc
.
find
(
"
mask/pic_layer
"
,
itemNode
);
const
picLayer
=
cc
.
find
(
"
mask/pic_layer
"
,
itemNode
);
...
@@ -163,13 +84,14 @@ export default class NewClass extends cc.Component {
...
@@ -163,13 +84,14 @@ export default class NewClass extends cc.Component {
const
labelCn
=
labelNodeCn
.
getComponent
(
cc
.
Label
);
const
labelCn
=
labelNodeCn
.
getComponent
(
cc
.
Label
);
const
labelEn
=
labelNodeEn
.
getComponent
(
cc
.
Label
);
const
labelEn
=
labelNodeEn
.
getComponent
(
cc
.
Label
);
labelCn
.
string
=
data
.
text_cn
;
labelCn
.
string
=
data
.
name
;
labelEn
.
string
=
data
.
t
ext_en
;
labelEn
.
string
=
data
.
t
ag
;
itemNode
.
addComponent
(
cc
.
Button
);
itemNode
.
addComponent
(
cc
.
Button
);
itemNode
.
on
(
"
click
"
,
()
=>
{
itemNode
.
on
(
"
click
"
,
()
=>
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
libraryReadDetailPage
.
attr
({
syllabus_pid
:
data
.
id
});
vc
.
toView
(
"
LibraryReadDetailPage
"
,
"
rightIn
"
)
vc
.
toView
(
"
LibraryReadDetailPage
"
,
"
rightIn
"
)
})
})
...
...
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