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
ac625c57
Commit
ac625c57
authored
Sep 28, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
299b7f9b
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
4884 additions
and
218 deletions
+4884
-218
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+4537
-210
LibraryAudioPage.ts
assets/middleLayer_for_kyxq/script/LibraryAudioPage.ts
+141
-0
LibraryAudioPage.ts.meta
assets/middleLayer_for_kyxq/script/LibraryAudioPage.ts.meta
+9
-0
LibraryPage.ts
assets/middleLayer_for_kyxq/script/LibraryPage.ts
+4
-4
LibraryReadPage.ts
assets/middleLayer_for_kyxq/script/LibraryReadPage.ts
+3
-3
LibraryVideoPage.ts
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts
+141
-0
LibraryVideoPage.ts.meta
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts.meta
+9
-0
LoginPage.ts
assets/middleLayer_for_kyxq/script/LoginPage.ts
+0
-1
PageViewer.ts
assets/middleLayer_for_kyxq/script/PageViewer.ts
+16
-0
audio.meta
assets/middleLayer_for_kyxq/textures/libraryPage/audio.meta
+12
-0
video.meta
assets/middleLayer_for_kyxq/textures/libraryPage/video.meta
+12
-0
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
ac625c57
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_kyxq/script/LibraryAudioPage.ts
0 → 100644
View file @
ac625c57
import
{
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
Viewer
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
scrollView
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
loading
:
cc
.
Node
=
null
;
data
;
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
}
// onLoad () {}
async
start
()
{
this
.
loading
.
active
=
true
;
await
this
.
initData
();
await
this
.
initView
();
this
.
loading
.
active
=
false
;
}
async
initData
()
{
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
:
this
.
node
[
'
syllabus_pid
'
]});
this
.
data
=
rows
;
}
initView
()
{
this
.
initListView
();
}
initListView
()
{
const
svNode
=
this
.
scrollView
;
const
view
=
cc
.
find
(
"
view
"
,
svNode
);
view
.
width
=
svNode
.
width
;
view
.
height
=
svNode
.
height
;
const
itemArr
=
this
.
getItemArr
(
this
.
data
);
const
sv
=
svNode
.
getComponent
(
cc
.
ScrollView
);
this
.
initScrollViewItem
(
sv
,
itemArr
,
1
);
}
getItemArr
(
dataArr
)
{
const
listItem
=
cc
.
find
(
"
view/content/item
"
,
this
.
scrollView
);
const
itemArr
=
[];
for
(
let
i
=
0
;
i
<
dataArr
.
length
;
i
++
)
{
const
data
=
dataArr
[
i
];
const
itemNode
=
cc
.
instantiate
(
listItem
);
itemNode
[
'
data
'
]
=
data
;
getSprNodeByUrl
(
data
.
cover
,
(
spr
)
=>
{
const
sprNode
=
spr
.
node
;
const
picLayer
=
cc
.
find
(
"
mask/pic_layer
"
,
itemNode
);
picLayer
.
addChild
(
sprNode
);
setSprNodeMaxLen
(
sprNode
,
picLayer
.
width
,
picLayer
.
height
,
true
);
})
cc
.
find
(
"
title_label
"
,
itemNode
).
getComponent
(
cc
.
Label
).
string
=
data
.
name
;
itemNode
.
addComponent
(
cc
.
Button
);
itemNode
.
on
(
"
click
"
,
()
=>
{
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
data
.
id
);
})
itemArr
.
push
(
itemNode
);
}
return
itemArr
;
}
initScrollViewItem
(
sv
,
itemArr
,
row
=
1
)
{
if
(
!
itemArr
||
itemArr
.
length
==
0
)
{
return
;
}
sv
.
scrollToTop
();
const
content
=
sv
.
content
;
content
.
width
=
sv
.
node
.
width
;
content
.
height
=
sv
.
node
.
height
;
content
.
removeAllChildren
();
const
tempH
=
content
.
height
/
row
;
const
disY
=
tempH
*
0.95
;
const
baseY
=
(
row
-
1
)
*
0.5
*
disY
;
let
rowCount
=
0
;
const
disX
=
40
;
const
baseX
=
itemArr
[
0
].
width
/
2
*
itemArr
[
0
].
scaleX
+
disX
;
let
colCount
=
0
;
let
lastX
=
baseX
;
for
(
let
i
=
0
;
i
<
itemArr
.
length
;
i
++
)
{
const
item
=
itemArr
[
i
];
item
.
x
=
lastX
+
disX
;
item
.
y
=
baseY
-
rowCount
*
disY
;
lastX
=
item
.
x
+
item
.
width
*
item
.
scale
;
content
.
addChild
(
itemArr
[
i
]);
const
tempW
=
Math
.
abs
(
item
.
x
+
disX
+
item
.
width
/
2
*
item
.
scale
);
content
.
width
=
lastX
-
item
.
width
/
2
*
item
.
scaleX
+
disX
*
2
;
rowCount
++
;
if
(
rowCount
>=
row
)
{
rowCount
=
0
;
colCount
++
;
}
}
}
// update (dt) {}
}
assets/middleLayer_for_kyxq/script/LibraryAudioPage.ts.meta
0 → 100644
View file @
ac625c57
{
"ver": "1.0.8",
"uuid": "19d74af8-e981-4f91-831f-a15412164bc2",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/script/LibraryPage.ts
View file @
ac625c57
...
...
@@ -23,18 +23,18 @@ export default class NewClass extends cc.Component {
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
HomePage
"
,
"
topIn
"
)
vc
.
toView
(
"
HomePage
"
,
"
topIn
"
)
;
}
handleClickReadBook
(
evt
:
cc
.
Event
)
{
handleClickReadBook
(
evt
:
cc
.
Event
,
data
)
{
const
syllabusId
=
evt
.
currentTarget
.
syllabus_id
;
if
(
!
syllabusId
)
{
global
.
middleLayer
.
showTips
(
`未制作`
);
return
;
}
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
libraryReadPage
.
attr
({
syllabus_pid
:
syllabusId
});
vc
.
toView
(
"
LibraryReadPage
"
,
"
rightIn
"
)
vc
[
`library
${
data
}
Page`
]
.
attr
({
syllabus_pid
:
syllabusId
});
vc
.
toView
(
`Library
${
data
}
Page`
,
"
rightIn
"
);
}
// LIFE-CYCLE CALLBACKS:
...
...
assets/middleLayer_for_kyxq/script/LibraryReadPage.ts
View file @
ac625c57
...
...
@@ -100,11 +100,11 @@ export default class NewClass extends cc.Component {
return
itemArr
;
}
initScrollViewItem
(
sv
,
itemArr
,
row
=
1
)
{
if
(
!
itemArr
||
itemArr
.
length
==
0
)
{
return
;
}
sv
.
scrollToTop
();
const
content
=
sv
.
content
;
content
.
width
=
sv
.
node
.
width
;
...
...
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts
0 → 100644
View file @
ac625c57
import
{
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
Viewer
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
scrollView
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
loading
:
cc
.
Node
=
null
;
data
;
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
}
// onLoad () {}
async
start
()
{
this
.
loading
.
active
=
true
;
await
this
.
initData
();
await
this
.
initView
();
this
.
loading
.
active
=
false
;
}
async
initData
()
{
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
:
this
.
node
[
'
syllabus_pid
'
]});
this
.
data
=
rows
;
}
initView
()
{
this
.
initListView
();
}
initListView
()
{
const
svNode
=
this
.
scrollView
;
const
view
=
cc
.
find
(
"
view
"
,
svNode
);
view
.
width
=
svNode
.
width
;
view
.
height
=
svNode
.
height
;
const
itemArr
=
this
.
getItemArr
(
this
.
data
);
const
sv
=
svNode
.
getComponent
(
cc
.
ScrollView
);
this
.
initScrollViewItem
(
sv
,
itemArr
,
1
);
}
getItemArr
(
dataArr
)
{
const
listItem
=
cc
.
find
(
"
view/content/item
"
,
this
.
scrollView
);
const
itemArr
=
[];
for
(
let
i
=
0
;
i
<
dataArr
.
length
;
i
++
)
{
const
data
=
dataArr
[
i
];
const
itemNode
=
cc
.
instantiate
(
listItem
);
itemNode
[
'
data
'
]
=
data
;
getSprNodeByUrl
(
data
.
cover
,
(
spr
)
=>
{
const
sprNode
=
spr
.
node
;
const
picLayer
=
cc
.
find
(
"
mask/pic_layer
"
,
itemNode
);
picLayer
.
addChild
(
sprNode
);
setSprNodeMaxLen
(
sprNode
,
picLayer
.
width
,
picLayer
.
height
,
true
);
})
cc
.
find
(
"
title_label
"
,
itemNode
).
getComponent
(
cc
.
Label
).
string
=
data
.
name
;
itemNode
.
addComponent
(
cc
.
Button
);
itemNode
.
on
(
"
click
"
,
()
=>
{
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
data
.
id
);
})
itemArr
.
push
(
itemNode
);
}
return
itemArr
;
}
initScrollViewItem
(
sv
,
itemArr
,
row
=
1
)
{
if
(
!
itemArr
||
itemArr
.
length
==
0
)
{
return
;
}
sv
.
scrollToTop
();
const
content
=
sv
.
content
;
content
.
width
=
sv
.
node
.
width
;
content
.
height
=
sv
.
node
.
height
;
content
.
removeAllChildren
();
const
tempH
=
content
.
height
/
row
;
const
disY
=
tempH
*
0.95
;
const
baseY
=
(
row
-
1
)
*
0.5
*
disY
;
let
rowCount
=
0
;
const
disX
=
40
;
const
baseX
=
itemArr
[
0
].
width
/
2
*
itemArr
[
0
].
scaleX
+
disX
;
let
colCount
=
0
;
let
lastX
=
baseX
;
for
(
let
i
=
0
;
i
<
itemArr
.
length
;
i
++
)
{
const
item
=
itemArr
[
i
];
item
.
x
=
lastX
+
disX
;
item
.
y
=
baseY
-
rowCount
*
disY
;
lastX
=
item
.
x
+
item
.
width
*
item
.
scale
;
content
.
addChild
(
itemArr
[
i
]);
const
tempW
=
Math
.
abs
(
item
.
x
+
disX
+
item
.
width
/
2
*
item
.
scale
);
content
.
width
=
lastX
-
item
.
width
/
2
*
item
.
scaleX
+
disX
*
2
;
rowCount
++
;
if
(
rowCount
>=
row
)
{
rowCount
=
0
;
colCount
++
;
}
}
}
// update (dt) {}
}
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts.meta
0 → 100644
View file @
ac625c57
{
"ver": "1.0.8",
"uuid": "be21372b-e856-477a-a44a-0bee18129d16",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/script/LoginPage.ts
View file @
ac625c57
...
...
@@ -79,7 +79,6 @@ export default class NewClass extends cc.Component {
const
res
=
await
asyncCallNetworkApiPost
(
'
/api/kyxq/v1/login
'
,
{
phone
:
phone
,
});
console
.
log
(
res
);
if
(
res
.
code
!=
'
200
'
)
{
global
.
middleLayer
.
showTips
(
res
.
msg
);
this
.
showEnterFail
();
...
...
assets/middleLayer_for_kyxq/script/PageViewer.ts
View file @
ac625c57
...
...
@@ -26,6 +26,12 @@ export default class NewClass extends cc.Component {
@
property
(
cc
.
Node
)
libraryReadDetailPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
libraryAudioPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
libraryVideoPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
unitPage
:
cc
.
Node
=
null
;
...
...
@@ -80,6 +86,16 @@ export default class NewClass extends cc.Component {
this
.
_currentViewName
=
'
LibraryReadPage
'
;
this
.
_currentViewNode
=
this
.
libraryReadPage
;
break
;
case
'
LibraryAudioPage
'
:
await
this
.
switchView
(
this
.
libraryAudioPage
,
this
.
_currentViewNode
,
aniType
);
this
.
_currentViewName
=
'
LibraryAudioPage
'
;
this
.
_currentViewNode
=
this
.
libraryAudioPage
;
break
;
case
'
LibraryVideoPage
'
:
await
this
.
switchView
(
this
.
libraryVideoPage
,
this
.
_currentViewNode
,
aniType
);
this
.
_currentViewName
=
'
LibraryVideoPage
'
;
this
.
_currentViewNode
=
this
.
libraryVideoPage
;
break
;
case
'
LibraryReadDetailPage
'
:
await
this
.
switchView
(
this
.
libraryReadDetailPage
,
this
.
_currentViewNode
,
aniType
);
this
.
_currentViewName
=
'
LibraryReadDetailPage
'
;
...
...
assets/middleLayer_for_kyxq/textures/libraryPage/audio.meta
0 → 100644
View file @
ac625c57
{
"ver": "1.1.2",
"uuid": "166d3d9d-a393-45ad-b904-44288faecb55",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/textures/libraryPage/video.meta
0 → 100644
View file @
ac625c57
{
"ver": "1.1.2",
"uuid": "7a071770-0b56-4d5a-9f25-1c3bb16aa603",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ 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