Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
z_05_xcx
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
z_05_xcx
Commits
1db83d81
Commit
1db83d81
authored
Sep 24, 2020
by
Li Mingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: test
parent
19f4c54b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
40 deletions
+65
-40
n_xuan1.js
play/assets/tmpGame/scene/n_xuan1.js
+53
-26
scene.js
play/assets/tmpGame/scene/scene.js
+1
-0
utils.js
play/assets/tmpGame/script/utils.js
+9
-12
builder.json
play/settings/builder.json
+1
-1
wechatgame.json
play/settings/wechatgame.json
+1
-1
No files found.
play/assets/tmpGame/scene/n_xuan1.js
View file @
1db83d81
...
@@ -13,7 +13,7 @@ import {
...
@@ -13,7 +13,7 @@ import {
asyncPlayDragonBoneAnimation
,
asyncPlayDragonBoneAnimation
,
asyncPlayEffectByUrl
,
asyncPlayEffectByUrl
,
RandomInt
,
RandomInt
,
http
Post
,
http
,
dateFormat
,
dateFormat
,
formatSeconds
,
formatSeconds
,
jelly
jelly
...
@@ -277,10 +277,11 @@ cc.Class({
...
@@ -277,10 +277,11 @@ cc.Class({
// LIFE-CYCLE CALLBACKS:
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
// onLoad () {},
courseid
:
null
,
ctor
()
{
ctor
()
{
this
.
_imageResList
=
[];
this
.
_imageResList
=
[];
this
.
_audioResList
=
[];
this
.
_audioResList
=
[];
this
.
courseid
=
'
111444
'
;
},
},
start
()
{
start
()
{
...
@@ -295,11 +296,19 @@ cc.Class({
...
@@ -295,11 +296,19 @@ cc.Class({
},
},
getData
(
func
)
{
getData
(
func
)
{
if
(
window
&&
window
.
courseware
)
{
window
.
courseware
.
getData
(
func
,
'
Z_05_nxuan1
'
);
http
(
'
GET
'
,
'
http://staging-teach.ireadabc.com/api/courseware/v1/getdata?courseid=
'
+
this
.
courseid
,
{}).
then
((
resStr
)
=>
{
}
else
{
const
res
=
JSON
.
parse
(
resStr
)
func
(
defaultData
);
console
.
log
(
'
res:
'
,
res
);
}
console
.
log
(
'
data:
'
,
JSON
.
parse
(
res
.
data
));
func
(
JSON
.
parse
(
res
.
data
));
});
// if (window && window.courseware) {
// window.courseware.getData(func, 'Z_05_nxuan1');
// } else {
// func(defaultData);
// }
},
},
_imageResList
:
null
,
_imageResList
:
null
,
...
@@ -412,6 +421,10 @@ cc.Class({
...
@@ -412,6 +421,10 @@ cc.Class({
},
},
onLoadFinish
()
{
onLoadFinish
()
{
this
.
initScrollView
();
this
.
getUserInfo
();
this
.
initListeners
();
this
.
initListeners
();
this
.
_status
=
{
this
.
_status
=
{
...
@@ -420,11 +433,6 @@ cc.Class({
...
@@ -420,11 +433,6 @@ cc.Class({
currentStrokeStageIdx
:
0
currentStrokeStageIdx
:
0
}
}
this
.
updateLetter
();
this
.
updateLetter
();
this
.
initScrollView
();
this
.
getUserInfo
();
},
},
...
@@ -1143,10 +1151,14 @@ cc.Class({
...
@@ -1143,10 +1151,14 @@ cc.Class({
finishLabel
:
null
,
finishLabel
:
null
,
startTime
:
null
,
startTime
:
null
,
rankLabel
:
null
,
rankLabel
:
null
,
rankData
:
null
,
initScrollView
()
{
initScrollView
()
{
this
.
rankData
=
[];
this
.
receiveData
(
this
.
courseid
,
(
rankData
)
=>
{
this
.
rankData
=
rankData
;
});
const
rankData
=
this
.
receiveData
(
'
1
'
);
console
.
log
(
'
rankData:
'
,
rankData
);
this
.
svItemArr
=
[];
this
.
svItemArr
=
[];
this
.
topH
=
60
;
this
.
topH
=
60
;
this
.
rankLineH
=
60
;
this
.
rankLineH
=
60
;
...
@@ -1213,7 +1225,7 @@ cc.Class({
...
@@ -1213,7 +1225,7 @@ cc.Class({
setScrollView
()
{
setScrollView
()
{
const
rankData
=
this
.
r
eceiveData
(
'
1
'
)
;
const
rankData
=
this
.
r
ankData
;
console
.
log
(
'
rankData:
'
,
rankData
);
console
.
log
(
'
rankData:
'
,
rankData
);
for
(
let
i
=
0
;
i
<
rankData
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
rankData
.
length
;
i
++
)
{
this
.
addScrollViewItem
(
rankData
[
i
],
i
+
1
);
this
.
addScrollViewItem
(
rankData
[
i
],
i
+
1
);
...
@@ -1275,7 +1287,7 @@ cc.Class({
...
@@ -1275,7 +1287,7 @@ cc.Class({
date
:
curTime
date
:
curTime
}
}
const
rankData
=
this
.
r
eceiveData
(
'
1
'
)
;
const
rankData
=
this
.
r
ankData
;
const
isExist
=
rankData
.
some
((
item
,
i
)
=>
{
const
isExist
=
rankData
.
some
((
item
,
i
)
=>
{
if
(
item
.
id
==
newData
.
id
)
{
if
(
item
.
id
==
newData
.
id
)
{
if
(
item
.
score
>
newData
.
score
)
{
if
(
item
.
score
>
newData
.
score
)
{
...
@@ -1293,28 +1305,43 @@ cc.Class({
...
@@ -1293,28 +1305,43 @@ cc.Class({
return
a
.
score
-
b
.
score
;
return
a
.
score
-
b
.
score
;
})
})
const
newRankData
=
[]
//
const newRankData = []
for
(
let
i
=
0
;
i
<
rankData
.
length
;
i
++
)
{
//
for( let i = 0; i < rankData.length; i ++) {
if
(
rankData
[
i
].
score
)
{
//
if (rankData[i].score) {
newRankData
.
push
(
rankData
[
i
]);
//
newRankData.push(rankData[i]);
}
//
}
}
//
}
this
.
sendData
(
'
1
'
,
newR
ankData
);
this
.
sendData
(
this
.
courseid
,
r
ankData
);
this
.
setScrollView
();
this
.
setScrollView
();
cc
.
find
(
'
Canvas/scrollview
'
).
active
=
true
;
cc
.
find
(
'
Canvas/scrollview
'
).
active
=
true
;
},
},
sendData
(
id
,
data
)
{
sendData
(
id
,
data
)
{
localStorage
.
setItem
(
id
,
JSON
.
stringify
(
data
));
// localStorage.setItem(id, JSON.stringify(data));
http
(
'
GET
'
,
'
http://staging-teach.ireadabc.com/api/dashboard/v1/studyinfo?courseid=
'
+
this
.
courseid
,
data
).
then
((
resStr
)
=>
{
const
res
=
JSON
.
parse
(
resStr
)
console
.
log
(
'
res:
'
,
res
);
});
},
},
receiveData
(
id
)
{
receiveData
(
id
,
cb
)
{
http
(
'
GET
'
,
'
http://staging-teach.ireadabc.com/api/dashboard/v1/studyinfo?courseid=
'
+
this
.
courseid
,
{}).
then
((
resStr
)
=>
{
const
res
=
JSON
.
parse
(
resStr
)
console
.
log
(
'
res:
'
,
res
);
});
let
strData
=
localStorage
.
getItem
(
id
);
let
strData
=
localStorage
.
getItem
(
id
);
if
(
!
strData
)
{
if
(
!
strData
)
{
strData
=
'
[]
'
strData
=
'
[]
'
}
}
return
JSON
.
parse
(
strData
);
if
(
cb
)
{
cb
(
JSON
.
parse
(
strData
));
}
},
},
getLabel
()
{
getLabel
()
{
const
node
=
new
cc
.
Node
();
const
node
=
new
cc
.
Node
();
...
...
play/assets/tmpGame/scene/scene.js
View file @
1db83d81
...
@@ -33,6 +33,7 @@ cc.Class({
...
@@ -33,6 +33,7 @@ cc.Class({
start
()
{
start
()
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
cc
.
director
.
loadScene
(
'
n_xuan1
'
)
cc
.
director
.
loadScene
(
'
n_xuan1
'
)
console
.
log
(
'
aaa
'
);
},
1000
);
},
1000
);
},
},
...
...
play/assets/tmpGame/script/utils.js
View file @
1db83d81
...
@@ -157,15 +157,12 @@ export function formatSeconds(value) {
...
@@ -157,15 +157,12 @@ export function formatSeconds(value) {
return
result
;
return
result
;
}
}
export
async
function
httpPost
(
url
)
{
export
async
function
http
(
type
,
url
,
data
)
{
console
.
log
(
'
in httpPost
'
);
console
.
log
(
'
in http
'
);
console
.
log
(
'
type:
'
,
type
);
url
=
"
http://localhost:1338/
"
+
'
cps
'
+
"
/getView/
"
console
.
log
(
'
url:
'
,
url
);
const
data
=
{
console
.
log
(
'
data:
'
,
data
);
service
:
'
service
'
,
method
:
'
getCoursewareData
'
,
parms
:
{
id
:
'
1
'
}
}
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
xhr
=
new
XMLHttpRequest
();
let
xhr
=
new
XMLHttpRequest
();
...
@@ -178,8 +175,8 @@ export async function httpPost(url) {
...
@@ -178,8 +175,8 @@ export async function httpPost(url) {
console
.
log
(
'
xhr:
'
,
xhr
);
console
.
log
(
'
xhr:
'
,
xhr
);
}
}
};
};
xhr
.
open
(
"
POST
"
,
url
,
true
);
xhr
.
open
(
type
,
url
,
true
);
//
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
xhr
.
setRequestHeader
(
"
Content-Type
"
,
"
application/x-www-form-urlencoded; charset=utf-8
"
);
xhr
.
send
(
'
service=service&method=getCoursewareData&parms={"id":1}
'
);
xhr
.
send
(
data
);
});
});
}
}
play/settings/builder.json
View file @
1db83d81
{
{
"title"
:
"play"
,
"title"
:
"play"
,
"packageName"
:
"org.cocos2d.demo"
,
"packageName"
:
"org.cocos2d.demo"
,
"startScene"
:
"
47e552a5-ddf7-471f-8f5b-c13cdfbd30e5
"
,
"startScene"
:
"
22b2dba2-ea25-4168-92a5-4a6d94152917
"
,
"excludeScenes"
:
[],
"excludeScenes"
:
[],
"includeSDKBox"
:
false
,
"includeSDKBox"
:
false
,
"orientation"
:
{
"orientation"
:
{
...
...
play/settings/wechatgame.json
View file @
1db83d81
...
@@ -4,5 +4,5 @@
...
@@ -4,5 +4,5 @@
"separate_engine"
:
false
,
"separate_engine"
:
false
,
"REMOTE_SERVER_ROOT"
:
""
,
"REMOTE_SERVER_ROOT"
:
""
,
"subContext"
:
""
,
"subContext"
:
""
,
"startSceneAssetBundle"
:
fals
e
"startSceneAssetBundle"
:
tru
e
}
}
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