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
c69124d9
Commit
c69124d9
authored
Nov 10, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改ToView方法,支持页面之间传参
parent
e8f4db40
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
90 additions
and
41 deletions
+90
-41
HomePage.ts
assets/middleLayer_for_kyxq/script/HomePage.ts
+12
-3
LessonPreview.ts
assets/middleLayer_for_kyxq/script/LessonPreview.ts
+1
-1
LessonReport.ts
assets/middleLayer_for_kyxq/script/LessonReport.ts
+2
-2
LibraryAudioPage.ts
assets/middleLayer_for_kyxq/script/LibraryAudioPage.ts
+4
-1
LibraryPage.ts
assets/middleLayer_for_kyxq/script/LibraryPage.ts
+8
-4
LibraryReadDetailPage.ts
assets/middleLayer_for_kyxq/script/LibraryReadDetailPage.ts
+4
-5
LibraryReadPage.ts
assets/middleLayer_for_kyxq/script/LibraryReadPage.ts
+8
-2
LibraryVideoPage.ts
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts
+8
-9
LoginPage.ts
assets/middleLayer_for_kyxq/script/LoginPage.ts
+4
-2
MissionPage.ts
assets/middleLayer_for_kyxq/script/MissionPage.ts
+9
-3
PageViewer.ts
assets/middleLayer_for_kyxq/script/PageViewer.ts
+13
-3
UnitPage.ts
assets/middleLayer_for_kyxq/script/UnitPage.ts
+13
-5
userPage.ts
assets/middleLayer_for_kyxq/script/userPage.ts
+4
-1
No files found.
assets/middleLayer_for_kyxq/script/HomePage.ts
View file @
c69124d9
...
...
@@ -45,7 +45,10 @@ export default class HomePageClass extends cc.Component {
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
""
);
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LoginPage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
LoginPage
"
,
animation
:
"
leftIn
"
})
}
userPagePanel
;
...
...
@@ -84,7 +87,10 @@ export default class HomePageClass extends cc.Component {
// 点击资源库
handleClickLibrary
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
bottomIn
"
)
vc
.
toView
({
name
:
"
LibraryPage
"
,
animation
:
"
bottomIn
"
})
}
...
...
@@ -93,7 +99,10 @@ export default class HomePageClass extends cc.Component {
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
unitPage
.
attr
({
syllabus_pid
:
pid
});
vc
.
unitPage
.
attr
({
pData
:
pData
});
vc
.
toView
(
"
UnitPage
"
,
"
rightIn
"
);
vc
.
toView
({
name
:
"
UnitPage
"
,
animation
:
"
rightIn
"
})
}
// 获取课程清单
...
...
assets/middleLayer_for_kyxq/script/LessonPreview.ts
View file @
c69124d9
...
...
@@ -58,7 +58,7 @@ export default class LessonPreviewClass extends cc.Component {
getSprNodeByUrl
(
_data
.
image
,
(
spr
)
=>
{
this
.
mask
.
addChild
(
spr
.
node
);
spr
.
srcBlendFactor
=
cc
.
macro
.
BlendFactor
.
ONE
setSprNodeMaxLen
(
spr
.
node
,
this
.
mask
.
width
,
this
.
mask
.
height
);
setSprNodeMaxLen
(
spr
.
node
,
this
.
mask
.
width
,
this
.
mask
.
height
,
true
);
});
this
.
pageLbl
.
string
=
`
${
this
.
curPageIndex
+
1
}
/
${
this
.
data
.
length
}
`
this
.
strItem
.
string
=
_data
.
text
...
...
assets/middleLayer_for_kyxq/script/LessonReport.ts
View file @
c69124d9
...
...
@@ -103,14 +103,14 @@ export default class LessonReportClass extends cc.Component {
let
_data
=
this
.
data
getSprNodeByUrl
(
_data
.
cover
,
(
spr
)
=>
{
this
.
mask
.
addChild
(
spr
.
node
);
spr
.
srcBlendFactor
=
cc
.
macro
.
BlendFactor
.
ONE
//
spr.srcBlendFactor = cc.macro.BlendFactor.ONE
setSprNodeMaxLen
(
spr
.
node
,
this
.
mask
.
width
,
this
.
mask
.
height
,
true
);
});
const
lastDate
=
_data
.
last_play
?
new
Date
(
_data
.
last_play
)
:
null
;
this
.
title
.
string
=
_data
.
name
this
.
unit
.
string
=
_data
.
unitName
this
.
last_play
.
string
=
lastDate
?
`
${
dateFormate
(
"
yyyy.MM.dd
"
,
lastDate
)}
学习过`
:
"
未学过
1
"
this
.
last_play
.
string
=
lastDate
?
`
${
dateFormate
(
"
yyyy.MM.dd
"
,
lastDate
)}
学习过`
:
"
未学过
"
this
.
question_right_percent1
.
string
=
""
;
// _data.question_right_percent // 正确率 - 白色描边
this
.
question_right_percent2
.
string
=
_data
.
question_right_percent
// 正确率 - 主体红字
this
.
study_duration
.
string
=
_data
.
study_duration
>
999
?
Math
.
floor
(
_data
.
study_duration
/
60
*
10
)
/
10
:
_data
.
study_duration
// 学习时长
...
...
assets/middleLayer_for_kyxq/script/LibraryAudioPage.ts
View file @
c69124d9
...
...
@@ -21,7 +21,10 @@ export default class LibraryAudioPageClass extends cc.Component {
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
LibraryPage
"
,
animation
:
"
leftIn
"
})
}
// onLoad () {}
...
...
assets/middleLayer_for_kyxq/script/LibraryPage.ts
View file @
c69124d9
...
...
@@ -23,7 +23,10 @@ export default class LibraryPageClass extends cc.Component {
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
HomePage
"
,
"
topIn
"
);
vc
.
toView
({
name
:
"
HomePage
"
,
animation
:
"
topIn
"
})
}
handleClickReadBook
(
evt
:
cc
.
Event
,
data
)
{
...
...
@@ -35,7 +38,10 @@ export default class LibraryPageClass extends cc.Component {
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
[
`library
${
data
}
Page`
].
attr
({
syllabus_pid
:
syllabusId
,
showMyWork
:
false
});
vc
[
`library
${
data
}
Page`
].
attr
({
pData
:
this
.
libraryRows
[
0
]});
vc
.
toView
(
`Library
${
data
}
Page`
,
"
rightIn
"
);
vc
.
toView
({
name
:
`Library
${
data
}
Page`
,
animation
:
"
rightIn
"
})
}
// LIFE-CYCLE CALLBACKS:
...
...
@@ -52,8 +58,6 @@ export default class LibraryPageClass extends cc.Component {
async
initView
()
{
const
resData
=
await
asyncCallNetworkApiGet
(
`/api/kyxq/v1/library`
,
{});
const
{
code
,
rows
}
=
resData
;
console
.
log
(
"
resData:
"
,
JSON
.
stringify
(
resData
));
this
.
libraryRows
=
rows
;
this
.
btnReading
[
`syllabus_id`
]
=
rows
[
0
].
id
;
this
.
btnListening
[
`syllabus_id`
]
=
rows
[
1
].
id
;
...
...
assets/middleLayer_for_kyxq/script/LibraryReadDetailPage.ts
View file @
c69124d9
...
...
@@ -38,7 +38,10 @@ export default class LibraryReadDetailPageClass extends cc.Component {
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryReadPage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
LibraryReadPage
"
,
animation
:
"
leftIn
"
})
}
// LIFE-CYCLE CALLBACKS:
...
...
@@ -214,15 +217,11 @@ export default class LibraryReadDetailPageClass extends cc.Component {
content
.
height
=
sv
.
node
.
height
;
content
.
removeAllChildren
();
console
.
log
(
"
content.width :
"
,
content
.
width
);
const
tempW
=
content
.
width
/
col
;
const
disX
=
tempW
*
0.95
//1.05;
const
baseX
=
-
(
col
-
1
)
*
0.5
*
disX
;
let
colCount
=
0
;
console
.
log
(
"
tempW :
"
,
tempW
);
if
(
itemArr
.
length
<=
0
)
return
const
disY
=
80
// this._mapScaleMin;
...
...
assets/middleLayer_for_kyxq/script/LibraryReadPage.ts
View file @
c69124d9
...
...
@@ -19,7 +19,10 @@ export default class LibraryReadPageClass extends cc.Component {
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
LibraryPage
"
,
animation
:
"
leftIn
"
})
}
// onLoad () {}
...
...
@@ -119,7 +122,10 @@ export default class LibraryReadPageClass extends cc.Component {
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
libraryReadDetailPage
.
attr
({
syllabus_pid
:
data
.
id
});
vc
.
libraryReadDetailPage
.
attr
({
pData
:
data
});
vc
.
toView
(
"
LibraryReadDetailPage
"
,
"
rightIn
"
)
vc
.
toView
({
name
:
"
LibraryReadDetailPage
"
,
animation
:
"
rightIn
"
})
})
itemArr
.
push
(
itemNode
);
...
...
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts
View file @
c69124d9
...
...
@@ -22,10 +22,16 @@ export default class LibraryVideoPageClass extends cc.Component {
handleClickBackBtn
()
{
if
(
this
.
node
[
'
fromPage
'
])
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
this
.
node
[
'
fromPage
'
],
"
leftIn
"
)
vc
.
toView
({
name
:
this
.
node
[
'
fromPage
'
],
animation
:
"
leftIn
"
})
}
else
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
LibraryPage
"
,
animation
:
"
leftIn
"
})
}
}
...
...
@@ -102,16 +108,9 @@ export default class LibraryVideoPageClass extends cc.Component {
itemArr
[
_index
].
y
=
0
}
}
// sv.content.height+=440
}
console
.
log
(
"
qsj!!
"
,
sv
.
content
.
height
)
sv
.
scrollToTop
()
// this.initScrollViewItemRow(sv, itemArr, 4);
// sv.content.removeAllChildren()
}
getItemArr
(
dataArr
)
{
...
...
assets/middleLayer_for_kyxq/script/LoginPage.ts
View file @
c69124d9
...
...
@@ -56,7 +56,6 @@ export default class LoginPageClass extends cc.Component {
initListener
()
{
this
.
editBox
.
on
(
'
text-changed
'
,
(
editBox
)
=>
{
// console.log('文本改变1:', editBox.string);
this
.
phoneNum
=
editBox
.
string
;
if
(
this
.
phoneNum
.
length
>=
11
)
{
this
.
showYellowBtn
();
...
...
@@ -253,7 +252,10 @@ export default class LoginPageClass extends cc.Component {
showHomePage
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
HomePage
"
,
"
rightIn
"
)
vc
.
toView
({
name
:
"
HomePage
"
,
animation
:
"
rightIn
"
})
}
onEnable
():
void
{
...
...
assets/middleLayer_for_kyxq/script/MissionPage.ts
View file @
c69124d9
...
...
@@ -48,7 +48,10 @@ export default class MissionPageClass extends cc.Component {
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
UnitPage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
UnitPage
"
,
animation
:
"
leftIn
"
})
}
// LIFE-CYCLE CALLBACKS:
...
...
@@ -70,7 +73,11 @@ export default class MissionPageClass extends cc.Component {
content
.
removeAllChildren
();
}
async
mounted
()
{
async
mounted
(
unitConfigData
)
{
// unitConfigData 是从Unit层传进来的config配置参数,如果是从模板返回到Mission层,这个配置文件是没有的
const
customBgUrl
=
unitConfigData
&&
unitConfigData
.
mission_bg_url
?
unitConfigData
.
mission_bg_url
:
""
;
this
.
initCustomBg
(
customBgUrl
);
this
.
loading
.
active
=
true
;
this
.
scrollView
.
opacity
=
0
;
...
...
@@ -124,7 +131,6 @@ export default class MissionPageClass extends cc.Component {
}
}
this
.
initCustomBg
(
bgImageUrl
);
this
.
refreshConfig
()
// 数据汇报
...
...
assets/middleLayer_for_kyxq/script/PageViewer.ts
View file @
c69124d9
...
...
@@ -130,7 +130,17 @@ export default class PageViewerClass extends cc.Component {
_currentViewName
=
""
_currentViewNode
=
null
async
toView
(
viewName
,
aniType
=
"
fade-in-out
"
)
{
async
toView
(
param
,
data
=
{})
{
let
viewName
=
""
;
let
animation
=
""
;
if
(
typeof
param
==
'
object
'
)
{
viewName
=
param
.
name
?
param
.
name
:
""
;
animation
=
param
.
animation
?
param
.
animation
:
""
;
}
else
if
(
typeof
param
==
'
string
'
)
{
viewName
=
param
;
animation
=
""
}
if
(
viewName
==
this
.
_currentViewName
)
{
cc
.
log
(
`重复跳转页面:
${
this
.
_currentViewName
}
`
);
return
...
...
@@ -144,11 +154,11 @@ export default class PageViewerClass extends cc.Component {
// 触发页面beforeMounted生命周期
this
[
PageMap
[
viewName
]].
emit
(
"
beforeMounted
"
);
// 切换页面
await
this
.
switchView
(
this
[
PageMap
[
viewName
]],
this
.
_currentViewNode
,
ani
Type
);
await
this
.
switchView
(
this
[
PageMap
[
viewName
]],
this
.
_currentViewNode
,
ani
mation
);
this
.
_currentViewName
=
viewName
;
this
.
_currentViewNode
=
this
[
PageMap
[
viewName
]];
// mounted
this
.
_currentViewNode
.
emit
(
"
mounted
"
)
this
.
_currentViewNode
.
emit
(
"
mounted
"
,
data
)
}
switchView
(
inPage
,
outPage
,
aniType
)
{
...
...
assets/middleLayer_for_kyxq/script/UnitPage.ts
View file @
c69124d9
...
...
@@ -32,7 +32,10 @@ export default class UnitPageClass extends cc.Component {
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
HomePage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
HomePage
"
,
animation
:
"
leftIn
"
})
}
// LIFE-CYCLE CALLBACKS:
...
...
@@ -179,8 +182,7 @@ export default class UnitPageClass extends cc.Component {
// 课程配置文件
const
_strData
=
(
v
.
children
&&
v
.
children
[
0
]
&&
v
.
children
[
0
].
template_name
==
"
sn_config
"
&&
v
.
children
[
0
].
data
)
?
v
.
children
&&
v
.
children
[
0
]
&&
v
.
children
[
0
].
data
:
"
{}
"
this
.
configData
=
JSON
.
parse
(
_strData
)
bgImageUrl
=
this
.
configData
.
bg_image_url
bgImageUrl
=
this
.
configData
.
unit_bg_url
;
}
else
{
// 课程数据
rows
.
push
(
v
)
...
...
@@ -305,7 +307,10 @@ export default class UnitPageClass extends cc.Component {
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
missionPage
.
attr
({
syllabus_pid
:
subData
.
id
});
vc
.
missionPage
.
attr
({
pData
:
subData
});
vc
.
toView
(
"
MissionPage
"
,
"
rightIn
"
)
vc
.
toView
({
name
:
"
MissionPage
"
,
animation
:
"
rightIn
"
},
this
.
configData
)
})
}
...
...
@@ -373,7 +378,10 @@ export default class UnitPageClass extends cc.Component {
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
[
`libraryVideoPage`
].
attr
({
syllabus_pid
:
this
.
node
[
'
syllabus_pid
'
],
showMyWork
:
true
});
vc
[
`libraryVideoPage`
].
attr
({
fromPage
:
"
UnitPage
"
});
vc
.
toView
(
`LibraryVideoPage`
,
"
rightIn
"
);
vc
.
toView
({
name
:
"
LibraryVideoPage
"
,
animation
:
"
rightIn
"
})
}
// update (dt) {}
}
...
...
assets/middleLayer_for_kyxq/script/userPage.ts
View file @
c69124d9
...
...
@@ -72,7 +72,10 @@ export default class UserPageClass extends cc.Component {
// 跳转登录页面
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LoginPage
"
,
"
leftIn
"
)
vc
.
toView
({
name
:
"
LoginPage
"
,
animation
:
"
leftIn
"
})
}
clickPopupAccountModal
()
{
...
...
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