Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
wildfirecode13
xiaoxiaole
Commits
41e902d4
Commit
41e902d4
authored
Oct 12, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
b1675f08
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
20 deletions
+125
-20
NetName.ts
egret/libs/tw/enum/NetName.ts
+2
-1
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+19
-1
MapScene.ts
egret/src/mapScene/MapScene.ts
+72
-1
InviteCutTimePanel.ts
egret/src/panels/InviteCutTimePanel.ts
+16
-7
InvitePrizePanel.ts
egret/src/panels/InvitePrizePanel.ts
+14
-8
getInviteInfo.json
mock/happyclear/getInviteInfo.json
+2
-2
No files found.
egret/libs/tw/enum/NetName.ts
View file @
41e902d4
...
...
@@ -76,6 +76,7 @@ export enum NetName {
// 邀请有礼
GET_SHARECODE
,
DO_HELP
,
GET_INVATE_INFO
GET_INVATE_INFO
,
ACCEPT_INVITATION
}
\ No newline at end of file
egret/libs/tw/manager/NetManager.ts
View file @
41e902d4
...
...
@@ -1983,7 +1983,7 @@ export class NetManager extends ABNetManager {
* 获取邀请详情
* @param callback
*/
public
getInv
a
teInfo
(
callback
:
Function
):
void
{
public
getInv
i
teInfo
(
callback
:
Function
):
void
{
const
net
:
INetData
=
{
name
:
NetName
.
GET_INVATE_INFO
,
uri
:
'/customActivity/happyclear/invitationInfo'
,
...
...
@@ -1996,5 +1996,23 @@ export class NetManager extends ABNetManager {
};
this
.
send
(
net
);
}
/**
* 接受任务
* @param callback
*/
public
acceptInvitationInfo
(
callback
:
Function
):
void
{
const
net
:
INetData
=
{
name
:
NetName
.
ACCEPT_INVITATION
,
uri
:
'/customActivity/happyclear/acceptInvitationInfo'
,
type
:
'post'
,
dataType
:
'json'
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
},
callback
:
callback
};
this
.
send
(
net
);
}
///////////////////////////////////////////////////////////////////////////////////
}
\ No newline at end of file
egret/src/mapScene/MapScene.ts
View file @
41e902d4
...
...
@@ -32,11 +32,16 @@ export default class MapScene extends Scene {
static
starHash
:
any
=
{};
_data
;
// 邀请有礼角标倒计时
private
timer
:
egret
.
Timer
;
private
cutTime
:
number
;
async
start
(
data
?)
{
super
.
start
();
this
.
updateMyInfo
();
this
.
updateAdData
();
this
.
getInviteInfo
();
// 查询邀请信息,控制邀请有礼角标
this
[
'avatar'
].
mask
=
this
[
'avatarMask'
];
setTimeout
(()
=>
{
...
...
@@ -368,7 +373,7 @@ export default class MapScene extends Scene {
}
onTap_inviteBtn
()
{
NetManager
.
ins
.
getInv
a
teInfo
((
success
,
res
)
=>
{
NetManager
.
ins
.
getInv
i
teInfo
((
success
,
res
)
=>
{
if
(
!
success
||
!
res
.
data
)
{
return
;
}
...
...
@@ -395,6 +400,72 @@ export default class MapScene extends Scene {
});
}
//////////////////////////////////////// 邀请有礼角标 //////////////////////////////////////////////
/**
* 查询邀请信息
*/
getInviteInfo
(){
NetManager
.
ins
.
getInviteInfo
((
success
,
res
)
=>
{
if
(
!
success
||
!
res
.
data
)
{
return
;
}
let
flag
=
res
.
data
.
completeFlag
;
switch
(
true
)
{
case
(
flag
==
0
):
// 未完成 显示倒计时
this
.
cutTime
=
res
.
data
.
endTime
-
res
.
data
.
sysTime
+
1000
;
console
.
log
(
this
.
cutTime
);
this
.
timer
=
new
egret
.
Timer
(
1000
,
0
);
this
.
timer
.
addEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
cutTimer
,
this
);
this
.
timer
.
start
();
this
.
cutTimer
();
break
;
case
(
flag
==
1
):
// 完成未开奖 待领奖 显示待领奖
this
[
"inviteTips"
].
text
=
"待领奖"
;
break
;
case
(
flag
==
2
):
// 领奖成功
break
;
case
(
flag
==
3
):
// 领奖失败
break
;
case
(
flag
==
4
):
// 可以开启下一次发任务
break
;
default
:
break
;
}
});
}
// 倒计时
private
cutTimer
()
{
let
timer
=
this
.
convertTime
(
this
.
cutTime
-=
1000
);
if
(
timer
.
hour
===
"00"
&&
timer
.
min
===
"00"
&&
timer
.
sec
===
"00"
)
{
this
.
timer
.
stop
();
this
.
getInviteInfo
();
}
this
[
"inviteTips"
].
text
=
`
${
timer
.
hour
}
:
${
timer
.
min
}
:
${
timer
.
sec
}
`
;
}
// 通过时间戳获取时间计数(时,分,秒)
private
convertTime
(
time
:
number
)
{
let
hour
=
~~
(
time
/
3600000
);
// 小时
let
min
=
~~
((
time
-
hour
*
3600000
)
/
60000
);
// 分
let
sec
=
~~
((
time
-
hour
*
3600000
-
min
*
60000
)
/
1000
);
// 秒
return
{
hour
:
this
.
prefixInteger
(
hour
,
2
),
min
:
this
.
prefixInteger
(
min
,
2
),
sec
:
this
.
prefixInteger
(
sec
,
2
)
}
}
// 截取数字补0
prefixInteger
(
num
,
length
)
{
return
(
Array
(
length
).
join
(
'0'
)
+
num
).
slice
(
-
length
);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
onTap_friendBtn
()
{
PanelCtrl
.
instance
.
show
(
'friend'
);
}
...
...
egret/src/panels/InviteCutTimePanel.ts
View file @
41e902d4
import
Panel
from
"../../libs/new_wx/components/Panel"
;
import
{
changeMapScene
}
from
"../startScene/StartScene"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
getHomeData
from
"../getHomeData"
;
import
{
ModuleTypes
}
from
"../../libs/new_wx/types/sceneTypes"
;
/**
* 邀请规则面板
*/
export
default
class
InviteCutTimePanel
extends
Panel
{
public
cutTimeLabel
:
eui
.
BitmapLabel
;
public
closeBtn
:
eui
.
Button
;
public
ok_btn
:
eui
.
Button
;
public
cutTimeLabel
:
eui
.
BitmapLabel
;
public
closeBtn
:
eui
.
Button
;
public
ok_btn
:
eui
.
Button
;
private
timer
:
egret
.
Timer
;
private
cutTime
:
number
;
...
...
@@ -26,17 +30,22 @@ export default class InviteCutTimePanel extends Panel {
initEvents
()
{
super
.
initEvents
();
this
.
ok_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
Tap_closeBtn
,
this
);
this
.
ok_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
OK
,
this
);
}
removeEvents
()
{
super
.
removeEvents
();
this
.
ok_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
Tap_closeBtn
,
this
);
this
.
ok_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
OK
,
this
);
}
initUI
()
{
this
.
cutTime
=
this
.
data
.
endTime
-
this
.
data
.
sysTime
+
1000
;
onTouchOK
()
{
PanelCtrl
.
instance
.
show
(
"StartPanel"
,
getHomeData
().
levels
.
length
+
1
);
}
initUI
()
{
// 到第二天0点的倒计时
let
endTime
=
this
.
data
.
sysTime
+
86400000
-
((
this
.
data
.
sysTime
+
86400000
)
%
86400000
)
-
8
*
3600000
;
this
.
cutTime
=
endTime
-
this
.
data
.
sysTime
+
1000
;
this
.
timer
=
new
egret
.
Timer
(
1000
,
0
);
this
.
timer
.
addEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
cutTimer
,
this
);
this
.
timer
.
start
();
...
...
egret/src/panels/InvitePrizePanel.ts
View file @
41e902d4
import
Panel
from
"../../libs/new_wx/components/Panel"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
getHomeData
from
"../getHomeData"
;
/**
* 邀请规则面板
*/
export
default
class
InvitePrizePanel
extends
Panel
{
public
prizeImg
:
eui
.
Image
;
public
closeBtn
:
eui
.
Button
;
public
ok_btn
:
eui
.
Button
;
public
game_btn
:
eui
.
Button
;
public
prizeImg
:
eui
.
Image
;
public
closeBtn
:
eui
.
Button
;
public
ok_btn
:
eui
.
Button
;
public
game_btn
:
eui
.
Button
;
constructor
(
data
){
constructor
(
data
)
{
super
();
this
.
data
=
data
;
}
...
...
@@ -25,17 +27,21 @@ export default class InvitePrizePanel extends Panel {
initEvents
()
{
super
.
initEvents
();
this
.
ok_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTapGoPrize
,
this
);
this
.
game_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
Tap_closeBtn
,
this
);
this
.
game_btn
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
OK
,
this
);
}
removeEvents
()
{
super
.
removeEvents
();
this
.
ok_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTapGoPrize
,
this
);
this
.
game_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
Tap_closeBtn
,
this
);
this
.
game_btn
.
removeEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
this
.
onTouch
OK
,
this
);
}
onTapGoPrize
(){
onTouchOK
()
{
PanelCtrl
.
instance
.
show
(
"StartPanel"
,
getHomeData
().
levels
.
length
+
1
);
}
onTapGoPrize
()
{
window
.
location
.
href
=
window
[
'__link__'
];
}
initUI
()
{
...
...
mock/happyclear/getInviteInfo.json
View file @
41e902d4
...
...
@@ -7,7 +7,7 @@
"invitationId"
:
"活动id"
,
"invitationCount"
:
4
,
"img"
:
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg"
,
"sysTime"
:
1570
597800
000
,
"sysTime"
:
1570
630215
000
,
"endTime"
:
1570672800000
,
"invitationUser"
:
[
{
...
...
@@ -15,7 +15,7 @@
"avatar"
:
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg"
}
],
"completeFlag"
:
2
,
"completeFlag"
:
0
,
"openPrizeMsg"
:
"图片"
,
"prizeType"
:
"nickname"
,
"prizeName"
:
"nickname"
,
...
...
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