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
ac16d70f
Commit
ac16d70f
authored
Nov 08, 2023
by
曲世俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--feat 课前导读界面开发、个人作品、看动画界面优化、上报界面
parent
be973413
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
5296 additions
and
3812 deletions
+5296
-3812
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+5091
-3760
LessonBrief.ts
assets/middleLayer_for_kyxq/script/LessonBrief.ts
+38
-0
LessonBrief.ts.meta
assets/middleLayer_for_kyxq/script/LessonBrief.ts.meta
+9
-0
LessonReport.ts
assets/middleLayer_for_kyxq/script/LessonReport.ts
+60
-23
LibraryPage.ts
assets/middleLayer_for_kyxq/script/LibraryPage.ts
+1
-1
LibraryVideoPage.ts
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts
+52
-22
MissionPage.ts
assets/middleLayer_for_kyxq/script/MissionPage.ts
+24
-0
UnitPage.ts
assets/middleLayer_for_kyxq/script/UnitPage.ts
+21
-6
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
ac16d70f
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_kyxq/script/LessonBrief.ts
0 → 100644
View file @
ac16d70f
// Learn TypeScript:
// - 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
{
playAudioByUrl
,
getSprNodeByUrl
,
setSprNodeMaxLen
,
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
getSpriteFrimeByUrl
,
asyncDelay
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
LessonBrief
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
content
:
cc
.
Node
=
null
;
onClickClose
(){
this
.
node
.
active
=
false
}
data
setData
(
data
){
this
.
data
=
data
}
refreshUI
(){
if
(
!
this
.
data
)
return
this
.
content
.
removeAllChildren
()
getSprNodeByUrl
(
this
.
data
.
image
,
(
spr
)
=>
{
this
.
content
.
addChild
(
spr
.
node
);
spr
.
srcBlendFactor
=
cc
.
macro
.
BlendFactor
.
ONE
});
}
}
assets/middleLayer_for_kyxq/script/LessonBrief.ts.meta
0 → 100644
View file @
ac16d70f
{
"ver": "1.0.8",
"uuid": "311f6161-5121-4629-b683-0e33dd1c1b98",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/script/LessonReport.ts
View file @
ac16d70f
...
...
@@ -49,8 +49,13 @@ export default class NewClass extends cc.Component {
@
property
(
cc
.
Label
)
storyStory
:
cc
.
Label
=
null
;
@
property
(
cc
.
ScrollView
)
reportSV
:
cc
.
ScrollView
=
null
;
// LIFE-CYCLE CALLBACKS:
m_sentenceNodeList
=
[]
onLoad
()
{
this
.
scentenceItem
.
active
=
false
this
.
storyItem
.
zIndex
=
111
...
...
@@ -65,10 +70,8 @@ export default class NewClass extends cc.Component {
playAudioId
refreshUI
(){
this
.
stopAudio
()
for
(
let
v
of
this
.
content
.
children
){
if
(
v
.
name
!=
"
itemCnt
"
&&
v
.
name
!=
"
storyItem
"
){
v
.
removeFromParent
()
}
for
(
let
v
of
this
.
m_sentenceNodeList
){
v
.
removeFromParent
()
}
if
(
!
this
.
data
)
return
...
...
@@ -83,7 +86,7 @@ export default class NewClass extends cc.Component {
this
.
title
.
string
=
_data
.
name
this
.
unit
.
string
=
_data
.
unitName
this
.
study_duration
.
string
=
_data
.
study_duration
this
.
last_play
.
string
=
_data
.
last_play
&&
_data
.
last_play
||
""
this
.
last_play
.
string
=
_data
.
last_play
&&
new
Date
(
_data
.
last_play
).
toString
()
||
""
this
.
question_right_percent1
.
string
=
_data
.
question_right_percent
this
.
question_right_percent2
.
string
=
_data
.
question_right_percent
this
.
record_times
.
string
=
_data
.
record_times
...
...
@@ -94,12 +97,13 @@ export default class NewClass extends cc.Component {
_star
.
active
=
_data
.
question_right_percent
>=
20
*
i
}
this
.
m_sentenceNodeList
=
[]
for
(
let
v
of
_data
.
excellents
){
this
.
createItem
(
v
,
"
优秀发音
"
)
this
.
m_sentenceNodeList
.
push
(
this
.
createItem
(
v
,
"
优秀发音
"
)
)
}
for
(
let
v
of
_data
.
tryagains
){
this
.
createItem
(
v
,
"
薄弱跟读
"
)
this
.
m_sentenceNodeList
.
push
(
this
.
createItem
(
v
,
"
薄弱跟读
"
)
)
}
// 句子
...
...
@@ -111,39 +115,72 @@ export default class NewClass extends cc.Component {
}
else
{
this
.
storyItem
.
active
=
false
}
this
.
reportSV
.
scrollToTop
()
}
createItem
(
v
,
titleStr
){
let
_node
=
cc
.
instantiate
(
this
.
scentenceItem
)
_node
.
active
=
true
this
.
content
.
addChild
(
_node
)
// 星星的判定标准需要改
for
(
let
i
=
1
;
i
<=
3
;
i
++
){
_node
.
getChildByName
(
`star
${
i
}
`
).
active
=
v
.
overall
>=
i
*
33
}
_node
.
getChildByName
(
"
lbl
"
).
getComponent
(
cc
.
Label
).
string
=
v
.
test_text
_node
.
getChildByName
(
"
btn_listen
"
).
on
(
"
click
"
,
()
=>
{
if
(
this
.
isAudioPlaying
&&
v
.
record_url
)
{
return
;
}
_node
.
getChildByName
(
"
title
"
).
getComponent
(
cc
.
Label
).
string
=
titleStr
let
btn_stop
=
_node
.
getChildByName
(
"
btn_stop
"
)
let
btn_play
=
_node
.
getChildByName
(
"
btn_play
"
)
let
btn_listen
=
_node
.
getChildByName
(
"
btn_listen
"
)
btn_stop
.
active
=
false
btn_play
.
active
=
true
btn_listen
.
active
=
true
btn_listen
.
on
(
"
click
"
,
()
=>
{
if
(
!
v
.
example_url
)
return
this
.
stopAudio
()
this
.
isAudioPlaying
=
true
;
if
(
v
.
record_url
)
{
cc
.
assetManager
.
loadRemote
(
v
.
record_url
,
(
err
,
audioClip
)
=>
{
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
this
.
playAudioId
=
null
this
.
isAudioPlaying
=
false
;
});
})
}
cc
.
assetManager
.
loadRemote
(
v
.
example_url
,
(
err
,
audioClip
)
=>
{
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
this
.
playAudioId
=
null
this
.
isAudioPlaying
=
false
;
});
})
})
_node
.
getChildByName
(
"
title
"
).
getComponent
(
cc
.
Label
).
string
=
v
.
titleStr
btn_play
.
on
(
"
click
"
,
()
=>
{
if
(
!
v
.
record_url
)
return
this
.
stopAudio
()
btn_play
.
active
=
false
btn_stop
.
active
=
true
this
.
isAudioPlaying
=
true
;
cc
.
assetManager
.
loadRemote
(
v
.
record_url
,
(
err
,
audioClip
)
=>
{
this
.
playAudioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
playAudioId
,
()
=>
{
this
.
playAudioId
=
null
this
.
isAudioPlaying
=
false
;
});
})
})
btn_stop
.
on
(
"
click
"
,
()
=>
{
this
.
stopAudio
()
})
_node
.
on
(
"
stop_audio
"
,
()
=>
{
btn_play
.
active
=
true
btn_stop
.
active
=
false
})
return
_node
}
stopAudio
(){
if
(
this
.
playAudioId
!=
null
)
cc
.
audioEngine
.
stop
(
this
.
playAudioId
)
this
.
playAudioId
=
null
this
.
isAudioPlaying
=
false
for
(
let
v
of
this
.
m_sentenceNodeList
){
v
.
emit
(
"
stop_audio
"
)
}
}
onClickClose
(){
...
...
assets/middleLayer_for_kyxq/script/LibraryPage.ts
View file @
ac16d70f
...
...
@@ -33,7 +33,7 @@ export default class NewClass extends cc.Component {
return
;
}
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
[
`library
${
data
}
Page`
].
attr
({
syllabus_pid
:
syllabusId
});
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
"
);
}
...
...
assets/middleLayer_for_kyxq/script/LibraryVideoPage.ts
View file @
ac16d70f
...
...
@@ -20,8 +20,13 @@ export default class NewClass extends cc.Component {
data
;
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
if
(
this
.
node
[
'
fromPage
'
]){
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
this
.
node
[
'
fromPage
'
],
"
leftIn
"
)
}
else
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LibraryPage
"
,
"
leftIn
"
)
}
}
// onLoad () {}
...
...
@@ -34,13 +39,27 @@ export default class NewClass extends cc.Component {
this
.
loading
.
active
=
false
;
}
async
onEnable
()
{
this
.
initUI
()
this
.
loading
.
active
=
true
;
await
this
.
initData
();
await
this
.
initView
();
this
.
loading
.
active
=
false
;
}
initUI
(){
this
.
svItem
.
active
=
false
}
async
initData
()
{
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
:
this
.
node
[
'
syllabus_pid
'
]});
this
.
data
=
rows
;
if
(
this
.
node
[
'
showMyWork
'
]){
let
_id
=
this
.
node
[
'
syllabus_pid
'
]
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
"
/api/kyxq/v1/user/myshow
"
,
{
jc_id
:
_id
});
this
.
data
=
rows
;
}
else
{
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
:
this
.
node
[
'
syllabus_pid
'
]});
this
.
data
=
rows
;
}
}
initView
()
{
...
...
@@ -48,7 +67,10 @@ export default class NewClass extends cc.Component {
}
initListView
()
{
if
(
!
this
.
data
)
{
global
.
middleLayer
.
showTips
(
"
动画未制作
"
);
return
}
const
svNode
=
this
.
scrollView
;
...
...
@@ -60,7 +82,7 @@ export default class NewClass extends cc.Component {
const
sv
=
svNode
.
getComponent
(
cc
.
ScrollView
);
sv
.
content
.
removeAllChildren
()
sv
.
content
.
height
=
0
//
sv.content.height=0
let
_rowCnt
=
3
for
(
let
i
=
0
;
i
<
Math
.
ceil
(
itemArr
.
length
/
_rowCnt
);
i
++
){
let
_node
=
new
cc
.
Node
()
...
...
@@ -80,8 +102,11 @@ export default class NewClass extends cc.Component {
itemArr
[
_index
].
y
=
0
}
}
sv
.
content
.
height
+=
440
//
sv.content.height+=440
}
console
.
log
(
"
qsj!!
"
,
sv
.
content
.
height
)
sv
.
scrollToTop
()
// this.initScrollViewItemRow(sv, itemArr, 4);
...
...
@@ -110,22 +135,27 @@ export default class NewClass extends cc.Component {
cc
.
find
(
"
title_label
"
,
itemNode
).
getComponent
(
cc
.
Label
).
string
=
data
.
name
;
itemNode
.
addComponent
(
cc
.
Button
);
itemNode
.
on
(
"
click
"
,
async
()
=>
{
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
data
.
id
,
null
,
(
flag
)
=>
{
this
.
node
.
active
=!
flag
if
(
data
.
id
){
itemNode
.
addComponent
(
cc
.
Button
);
itemNode
.
on
(
"
click
"
,
async
()
=>
{
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
data
.
id
,
null
,
(
flag
)
=>
{
this
.
node
.
active
=!
flag
});
})
global
.
middleLayer
.
callNetworkApiGet
(
`/api/courseware/v2/
${
data
.
id
}
/list`
,
{},
(
data
)
=>
{
if
(
itemNode
&&
data
.
rows
&&
data
.
rows
[
0
]
&&
data
.
rows
[
0
].
data
){
let
_data
=
JSON
.
parse
(
data
.
rows
[
0
].
data
)
if
(
_data
&&
_data
.
dataArr
){
itemNode
.
getChildByName
(
"
cntLbl
"
).
getComponent
(
cc
.
Label
).
string
=
String
(
_data
.
dataArr
.
length
)
}
}
});
})
global
.
middleLayer
.
callNetworkApiGet
(
`/api/courseware/v2/
${
data
.
id
}
/list`
,
{},
(
data
)
=>
{
if
(
itemNode
&&
data
.
rows
&&
data
.
rows
[
0
]
&&
data
.
rows
[
0
].
data
){
let
_data
=
JSON
.
parse
(
data
.
rows
[
0
].
data
)
if
(
_data
&&
_data
.
dataArr
){
itemNode
.
getChildByName
(
"
cntLbl
"
).
getComponent
(
cc
.
Label
).
string
=
String
(
_data
.
dataArr
.
length
)
}
}
});
}
else
{
itemNode
.
getChildByName
(
"
cntLbl
"
).
active
=
false
itemNode
.
getChildByName
(
"
icon_video
"
).
active
=
false
}
itemArr
.
push
(
itemNode
);
}
...
...
assets/middleLayer_for_kyxq/script/MissionPage.ts
View file @
ac16d70f
...
...
@@ -339,6 +339,30 @@ export default class NewClass extends cc.Component {
async
onClickDebug
(){
const
{
code
,
msg
,
results
}
=
await
asyncCallNetworkApiGet
(
`/api/kyxq/v1/user/course/report`
,
{
syllabusid
:
34396
})
this
.
LessonReport
.
active
=
true
results
.
excellents
.
push
({
overall
:
94
,
record_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
example_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
test_text
:
"
one two three
"
,
})
results
.
excellents
.
push
({
overall
:
80
,
record_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
example_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
test_text
:
"
what's is your name
"
,
})
results
.
tryagains
.
push
({
overall
:
55
,
record_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
example_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
test_text
:
"
what's is your name
"
,
})
results
.
tryagains
.
push
({
overall
:
23
,
record_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
example_url
:
"
https://teach.cdn.ireadabc.com/157bd8b61f0fc7e9fb04f8a143be80b4.mp3
"
,
test_text
:
"
what's is your name
"
,
})
this
.
LessonReport
.
getComponent
(
"
LessonReport
"
).
setData
(
results
)
this
.
LessonReport
.
getComponent
(
"
LessonReport
"
).
refreshUI
()
}
...
...
assets/middleLayer_for_kyxq/script/UnitPage.ts
View file @
ac16d70f
...
...
@@ -28,7 +28,7 @@ export default class NewClass extends cc.Component {
btn_works
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
Lesson
Preview
:
cc
.
Node
=
null
;
Lesson
Brief
:
cc
.
Node
=
null
;
handleClickBackBtn
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
...
...
@@ -129,12 +129,11 @@ export default class NewClass extends cc.Component {
this
.
configData
=
[]
for
(
let
v
of
resData
.
rows
){
if
(
v
.
name
==
"
config
"
){
console
.
log
(
"
qsj??
"
,
v
)
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/courseware/v2/
${
v
.
id
}
/list`
,
{});
console
.
log
(
"
qsj!!
"
,
rows
)
if
(
rows
&&
rows
[
0
]
&&
rows
[
0
].
data
){
let
_data
=
JSON
.
parse
(
rows
[
0
].
data
)
this
.
configData
=
_data
.
pages
console
.
log
(
"
config data
"
,
this
.
configData
)
}
}
else
{
rows
.
push
(
v
)
...
...
@@ -343,10 +342,26 @@ export default class NewClass extends cc.Component {
}
onClickPreview
(){
this
.
LessonPreview
.
active
=
true
this
.
LessonPreview
.
getComponent
(
"
LessonPreview
"
).
setData
(
this
.
configData
)
this
.
LessonPreview
.
getComponent
(
"
LessonPreview
"
).
refreshUI
()
this
.
LessonBrief
.
active
=
true
let
_data
=
this
.
configData
if
(
_data
&&
_data
[
0
]){
this
.
LessonBrief
.
getComponent
(
"
LessonBrief
"
).
setData
(
_data
[
0
])
}
this
.
LessonBrief
.
getComponent
(
"
LessonBrief
"
).
refreshUI
()
}
onClickMyWork
(
evt
:
cc
.
Event
)
{
const
syllabusId
=
this
.
node
[
'
syllabus_pid
'
]
if
(
!
syllabusId
)
{
global
.
middleLayer
.
showTips
(
`未制作`
);
return
;
}
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
"
);
}
// update (dt) {}
}
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