Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ireadabcMiddleLayer
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
ireadabcMiddleLayer
Commits
284a85a2
Commit
284a85a2
authored
Dec 17, 2021
by
huoshizhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: bundleType版
parent
f4436818
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
31 deletions
+28
-31
middleLayer.js
assets/ireadabcMiddleLayer/script/middleLayer.js
+28
-31
No files found.
assets/ireadabcMiddleLayer/script/middleLayer.js
View file @
284a85a2
...
@@ -79,12 +79,10 @@ cc.Class({
...
@@ -79,12 +79,10 @@ cc.Class({
this
.
getBundleInfoList
();
this
.
getBundleInfoList
();
//
// /api/syllabus/v1/tree?orgid=483&pid=18567
// /api/syllabus/v1/tree?orgid=483&pid=18567
this
.
baseUrl
=
'
http://staging-teach.ireadabc.com
'
;
this
.
baseUrl
=
'
http://staging-teach.ireadabc.com
'
;
this
.
initStoryBoxView
(
18307
);
this
.
initStoryBoxView
(
{
coursewareId
:
18307
}
);
},
},
asyncDelayLog
(
str
)
{
asyncDelayLog
(
str
)
{
...
@@ -104,41 +102,36 @@ cc.Class({
...
@@ -104,41 +102,36 @@ cc.Class({
return
;
return
;
}
}
const
{
bundleInfoList
,
defaultBundleIdx
,
b
aseUrl
,
coursewareId
,
b
undleType
,
bundleInfo
}
=
JSON
.
parse
(
jsonStr
);
const
{
bundleInfoList
,
defaultBundleIdx
,
bundleType
,
bundleInfo
}
=
JSON
.
parse
(
jsonStr
);
if
(
bundleType
==
'
PetRoom
'
)
{
if
(
bundleType
==
'
PetRoom
'
)
{
// const bundleInfo = {
this
.
baseUrl
=
bundleInfo
.
baseUrl
;
// "sceneName": "dfzx_cocos_T_FT_01",
this
.
token
=
bundleInfo
.
token
;
// "version": "c1a41",
this
.
homework_id
=
bundleInfo
.
homework_id
;
// "bondleUrl": "http://staging-teach.cdn.ireadabc.com//h5template/dfzx_cocos_T_FT_01/v3/android/dfzx_cocos_T_FT_01",
this
.
syllabus_id
=
bundleInfo
.
syllabus_id
;
// "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDYyLCJ1dWlkIjoiZDNlODE0OGItOTNlNC00NzdiLWEyMmEtMjNkYTk4ZWVlMGYwIiwicGhvbmUiOiIxNTk0MDgzMzk1MCIsIm5pY2tfbmFtZSI6IuaZk-aFp-a1i-ivlSIsIm9yZ19pZCI6MTEsInNjaG9vbF9pZCI6MjA0LCJjbGFzc19pZCI6MTQxLCJkZnp4X3VzZXJfdXVpZCI6ImVmMTNhNTI3ZDg2ZDQ1MGY4MWJjMWE1OWQ0NDcyZTQwIiwiZGVsIjowLCJjcmVhdGVkX2RhdGUiOiIyMDIwLTA4LTA2VDA2OjA1OjUxLjAwMFoiLCJ1cGRhdGVkX2RhdGUiOiIyMDIwLTA4LTA3VDA4OjI3OjQwLjAwMFoiLCJhY2NvdW50X3R5cGUiOjIsImVuZF9kYXRlIjoiMjAyMS0xMC0xM1QxNjowMDowMC4wMDBaIiwiY2xhc3NSb2xlIjoic3R1IiwiaWF0IjoxNjI5ODYyMTA2LCJleHAiOjE2MzI0NTQxMDZ9.pKvGgI9yijd57vJBLAM9wuiPV5KkCriezV-FlD8fmLI",
this
.
role
=
bundleInfo
.
role
;
// "baseUrl": "http://staging-teach.ireadabc.com/api/",
// }
this
.
loadBundle
(
bundleInfo
);
}
else
if
(
bundleType
==
"
StoryBox
"
)
{
// this.baseUrl = baseUrl
;
const
descLabel
=
cc
.
find
(
'
middleLayer/storyBox/menu/menuBase/title/name
'
)
;
// this.token = toke
n;
descLabel
.
getComponent
(
cc
.
Label
).
string
=
bundleInfo
.
coursewareDescriptio
n
;
// this.homework_id = homework_id;
// this.syllabus_id = syllabus_id
;
const
nameLabel
=
cc
.
find
(
'
middleLayer/storyBox/menu/menuBase/title/Lession
'
)
;
// this.role = rol
e;
nameLabel
.
getComponent
(
cc
.
Label
).
string
=
bundleInfo
.
coursewareNam
e
;
// cc.find('middleLayer').getComponent('middleLayer').baseUrl
this
.
baseUrl
=
bundleInfo
.
baseUrl
;
this
.
initStoryBoxView
(
bundleInfo
);
}
else
{
}
else
{
if
(
baseUrl
)
{
// WW模板
this
.
baseUrl
=
baseUrl
;
this
.
bundleInfoList
=
bundleInfoList
;
this
.
initStoryBoxView
(
coursewareId
);
this
.
jumpToBundleByIndex
(
defaultBundleIdx
);
}
else
{
// WW模板
this
.
bundleInfoList
=
bundleInfoList
;
this
.
jumpToBundleByIndex
(
defaultBundleIdx
);
}
}
}
},
},
initStoryBoxView
(
coursewareId
)
{
initStoryBoxView
(
bundleInfo
)
{
this
.
hideWWView
();
this
.
hideWWView
();
this
.
callNetworkApiGet
(
'
/api/syllabus/v1/tree
'
,
{
orgid
:
483
,
pid
:
coursewareId
},
(
data
)
=>
{
this
.
callNetworkApiGet
(
'
/api/syllabus/v1/tree
'
,
{
orgid
:
483
,
pid
:
bundleInfo
.
coursewareId
},
(
data
)
=>
{
console
.
log
(
data
);
console
.
log
(
data
);
const
defaultBondle
=
data
.
rows
.
find
(
row
=>
row
.
name
==
'
默认
'
);
const
defaultBondle
=
data
.
rows
.
find
(
row
=>
row
.
name
==
'
默认
'
);
if
(
!
defaultBondle
)
{
if
(
!
defaultBondle
)
{
...
@@ -361,6 +354,10 @@ cc.Class({
...
@@ -361,6 +354,10 @@ cc.Class({
lineBtnHide
.
active
=
true
;
lineBtnHide
.
active
=
true
;
lineBtnShow
.
active
=
false
;
lineBtnShow
.
active
=
false
;
const
canvas
=
cc
.
find
(
'
Canvas
'
);
console
.
log
(
'
canvas.width =
'
+
canvas
.
width
);
console
.
log
(
'
canvas.height =
'
+
canvas
.
height
);
const
menuBase
=
cc
.
find
(
'
middleLayer/storyBox/menu/menuBase
'
);
const
menuBase
=
cc
.
find
(
'
middleLayer/storyBox/menu/menuBase
'
);
cc
.
tween
(
menuBase
)
cc
.
tween
(
menuBase
)
.
to
(
1
,
{
y
:
this
.
storyBoxMenuLength
*
-
105
-
200
},
{
easing
:
'
bounceOut
'
})
.
to
(
1
,
{
y
:
this
.
storyBoxMenuLength
*
-
105
-
200
},
{
easing
:
'
bounceOut
'
})
...
@@ -573,7 +570,7 @@ cc.Class({
...
@@ -573,7 +570,7 @@ cc.Class({
cc
.
game
.
removePersistRootNode
(
this
.
node
);
cc
.
game
.
removePersistRootNode
(
this
.
node
);
cc
.
director
.
loadScene
(
"
emptyScene
"
,
()
=>
{
cc
.
director
.
loadScene
(
"
emptyScene
"
,
()
=>
{
this
.
callNativeFunction
({
name
:
'
exit
'
,
value
:
''
});
this
.
callNativeFunction
({
name
:
'
exit
'
,
value
:
''
});
});
});
},
},
getRainbowColorList
()
{
getRainbowColorList
()
{
...
...
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