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
ff156406
Commit
ff156406
authored
Sep 26, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 列表出来了
parent
8bad1ccb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
5773 additions
and
5744 deletions
+5773
-5744
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+5732
-5729
HomePage.ts
assets/middleLayer_for_kyxq/script/HomePage.ts
+21
-8
LoginPage.ts
assets/middleLayer_for_kyxq/script/LoginPage.ts
+2
-1
PageViewer.ts
assets/middleLayer_for_kyxq/script/PageViewer.ts
+11
-6
middleLayer.ts
assets/middleLayer_for_kyxq/script/middleLayer.ts
+7
-0
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
ff156406
This source diff could not be displayed because it is too large. You can
view the blob
instead.
assets/middleLayer_for_kyxq/script/HomePage.ts
View file @
ff156406
...
@@ -17,6 +17,9 @@ export default class NewClass extends cc.Component {
...
@@ -17,6 +17,9 @@ export default class NewClass extends cc.Component {
@
property
(
cc
.
Node
)
@
property
(
cc
.
Node
)
SvContent
:
cc
.
Node
=
null
;
SvContent
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
loading
:
cc
.
Node
=
null
;
_inited
=
false
;
_inited
=
false
;
// 点击用户中心
// 点击用户中心
...
@@ -27,7 +30,7 @@ export default class NewClass extends cc.Component {
...
@@ -27,7 +30,7 @@ export default class NewClass extends cc.Component {
// vc.toView("UserPage", "topIn")
// vc.toView("UserPage", "topIn")
}
}
// 点击
用户中心
// 点击
资源库
handleClickLibrary
()
{
handleClickLibrary
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
bottomIn
"
)
vc
.
toView
(
"
LibraryPage
"
,
"
bottomIn
"
)
...
@@ -41,29 +44,39 @@ export default class NewClass extends cc.Component {
...
@@ -41,29 +44,39 @@ export default class NewClass extends cc.Component {
}
}
// 获取课程清单
// 获取课程清单
getCourseList
()
{
async
getCourseList
()
{
this
.
SvContent
.
removeAllChildren
();
this
.
SvContent
.
removeAllChildren
();
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
this
.
loading
.
active
=
true
;
const
userInfo
=
await
global
.
middleLayer
.
getUserInfo
();
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
'
/api/kyxq/v1/user/jclist
'
,
{
jc_arr
:
userInfo
.
jc_arr
,
});
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
row
=
rows
[
i
];
const
ci
=
cc
.
instantiate
(
this
.
CourseItem
)
const
ci
=
cc
.
instantiate
(
this
.
CourseItem
)
ci
.
active
=
true
;
ci
.
active
=
true
;
ci
.
attr
({
syllabus_id
:
row
.
id
});
ci
.
on
(
"
click
"
,
()
=>
{
ci
.
on
(
"
click
"
,
()
=>
{
this
.
handleClickCourseItem
()
this
.
handleClickCourseItem
()
;
})
})
this
.
SvContent
.
addChild
(
ci
)
this
.
SvContent
.
addChild
(
ci
)
;
}
}
this
.
loading
.
active
=
false
;
}
}
// onLoad () {}
// onLoad () {}
_canTouch
=
false
;
_canTouch
=
false
;
async
start
()
{
async
start
()
{
await
this
.
getCourseList
();
this
.
_canTouch
=
true
;
this
.
_canTouch
=
true
;
this
.
getCourseList
();
this
.
_inited
=
true
;
this
.
_inited
=
true
;
}
}
onEnable
()
{
async
onEnable
()
{
this
.
_canTouch
=
false
;
if
(
this
.
_inited
)
{
if
(
this
.
_inited
)
{
this
.
getCourseList
();
await
this
.
getCourseList
();
this
.
_canTouch
=
true
;
}
}
}
}
// update (dt) {}
// update (dt) {}
...
...
assets/middleLayer_for_kyxq/script/LoginPage.ts
View file @
ff156406
...
@@ -79,13 +79,14 @@ export default class NewClass extends cc.Component {
...
@@ -79,13 +79,14 @@ export default class NewClass extends cc.Component {
const
res
=
await
asyncCallNetworkApiPost
(
'
/api/kyxq/v1/login
'
,
{
const
res
=
await
asyncCallNetworkApiPost
(
'
/api/kyxq/v1/login
'
,
{
phone
:
phone
,
phone
:
phone
,
});
});
console
.
log
(
res
);
if
(
res
.
code
!=
'
200
'
)
{
if
(
res
.
code
!=
'
200
'
)
{
global
.
middleLayer
.
showTips
(
res
.
msg
);
global
.
middleLayer
.
showTips
(
res
.
msg
);
this
.
showEnterFail
();
this
.
showEnterFail
();
return
;
return
;
}
}
global
.
middleLayer
.
isLogin
=
true
;
global
.
middleLayer
.
isLogin
=
true
;
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
res
.
token
);
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
res
.
data
.
token
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
phone
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
phone
);
this
.
showEnterSuccess
();
this
.
showEnterSuccess
();
...
...
assets/middleLayer_for_kyxq/script/PageViewer.ts
View file @
ff156406
...
@@ -36,13 +36,18 @@ export default class NewClass extends cc.Component {
...
@@ -36,13 +36,18 @@ export default class NewClass extends cc.Component {
// onLoad () {}
// onLoad () {}
start
()
{
async
start
()
{
const
userInfo
=
await
global
.
middleLayer
.
getUserInfo
();
// this._currentViewNode = this.loginPage;
if
(
!
userInfo
)
{
// this._currentViewName = "LoginPage"
this
.
_currentViewNode
=
this
.
loginPage
;
this
.
_currentViewName
=
"
LoginPage
"
}
else
{
this
.
_currentViewNode
=
this
.
homePage
;
this
.
_currentViewName
=
"
HomePage
"
;
}
this
.
_currentViewNode
=
this
.
missionPage
;
//
this._currentViewNode = this.missionPage;
this
.
_currentViewName
=
"
MissionPage
"
//
this._currentViewName = "MissionPage"
this
.
_currentViewNode
.
active
=
true
;
this
.
_currentViewNode
.
active
=
true
;
}
}
...
...
assets/middleLayer_for_kyxq/script/middleLayer.ts
View file @
ff156406
...
@@ -126,6 +126,13 @@ export default class NewClass extends middleLayerBase {
...
@@ -126,6 +126,13 @@ export default class NewClass extends middleLayerBase {
cc
.
director
[
'
_scene
'
].
height
=
frameSize
.
height
;
cc
.
director
[
'
_scene
'
].
height
=
frameSize
.
height
;
}
}
async
getUserInfo
()
{
const
{
code
,
data
}
=
await
this
.
asyncCallNetworkApiGet
(
"
/api/kyxq/v1/user/info
"
,
null
);
if
(
code
==
200
)
{
return
data
;
}
return
null
;
}
initListener
()
{
initListener
()
{
const
exitBtn
=
cc
.
find
(
'
middleLayer/ExitBtn
'
);
const
exitBtn
=
cc
.
find
(
'
middleLayer/ExitBtn
'
);
...
...
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