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
66c730f0
Commit
66c730f0
authored
Dec 14, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6f00a0d1
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
45 deletions
+147
-45
NetName.ts
egret/libs/tw/enum/NetName.ts
+2
-0
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+87
-43
RechargePanel.ts
egret/src/panels/RechargePanel.ts
+33
-2
config.js
mock/config.js
+7
-0
exchangeCoin.json
mock/happyclear/exchangeCoin.json
+11
-0
getCloudNum.json
mock/happyclear/getCloudNum.json
+7
-0
No files found.
egret/libs/tw/enum/NetName.ts
View file @
66c730f0
...
...
@@ -84,6 +84,8 @@ export enum NetName {
SCRATCH_DOHELP
,
HBRAIN_BASEINFO
,
GET_TASKINFO
,
EXCHANGE_COIN
,
GET_CLOUD_NUM
,
}
\ No newline at end of file
egret/libs/tw/manager/NetManager.ts
View file @
66c730f0
This diff is collapsed.
Click to expand it.
egret/src/panels/RechargePanel.ts
View file @
66c730f0
...
...
@@ -3,6 +3,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
getlogItem
}
from
"../Main"
;
import
Utils
from
"../Utils"
;
import
{
showToast
}
from
"../../libs/new_wx/ctrls/toastCtrl"
;
const
MIN
:
number
=
1
;
const
MAX
:
number
=
100
;
...
...
@@ -24,7 +25,7 @@ export default class RechargePanel extends Panel {
private
nowNumber
:
number
=
MIN
;
// 当前显示的数值
// private totalNum:
number = 0; // 总共的数值
private
totalNum
:
number
=
0
;
// 总共的数值
private
holdTimer
=
null
;
private
setNumTimer
=
null
;
...
...
@@ -134,7 +135,29 @@ export default class RechargePanel extends Panel {
private
onTouchBtn
(
e
:
egret
.
TouchEvent
)
{
/// TODO 发接口兑换
NetManager
.
ins
.
clickLog
(
getlogItem
(
73
));
if
(
this
.
nowNumber
*
10
>
this
.
totalNum
)
{
showToast
(
'抱歉,您的云钻不足哦'
);
return
;
}
this
.
btn
.
touchEnabled
=
false
;
try
{
if
(
window
[
'getRST'
])
window
[
'getRST'
]();
}
catch
(
error
)
{
console
.
warn
(
error
)
}
NetManager
.
ins
.
exchangeCoin
((
success
,
res
)
=>
{
this
.
btn
.
touchEnabled
=
true
;
if
(
!
success
)
{
showToast
(
'网络开小差啦,请稍后再试'
);
return
;
}
const
data
=
res
.
data
;
showToast
(
'兑换成功,继续闯关吧'
);
PanelCtrl
.
instance
.
show
(
'Shop'
);
NetManager
.
ins
.
hc_home
(()
=>
{
},
window
[
'collectRuleId'
]);
},
this
.
nowNumber
);
}
onTouchTap_closeBtn
()
{
...
...
@@ -145,6 +168,14 @@ export default class RechargePanel extends Panel {
private
getYunZuan
()
{
/// TODO 通过接口获取云钻数量并显示
this
.
zuanLabel
.
text
=
'我的云钻:0'
;
NetManager
.
ins
.
getCloudNum
((
success
,
res
)
=>
{
if
(
!
success
)
{
return
;
}
const
data
=
res
.
data
;
this
.
totalNum
=
data
;
this
.
zuanLabel
.
text
=
`我的云钻:
${
data
}
`
;
})
}
initEvents
()
{
...
...
mock/config.js
View file @
66c730f0
...
...
@@ -179,6 +179,13 @@ const config = {
'/customActivity/happyclear/taskSystem/award'
:{
data
:
'./happyclear/taskAward.json'
},
//////////////////// 消消乐云钻兑换 ////////////////////
'/customActivity/happyclear/cloudDrill/getCloudDrillBalance'
:{
data
:
'./happyclear/getCloudNum.json'
},
'/customActivity/happyclear/cloudDrill/exchangeCoin'
:{
data
:
'./happyclear/exchangeCoin.json'
}
};
for
(
let
item
in
config
)
{
...
...
mock/happyclear/exchangeCoin.json
0 → 100644
View file @
66c730f0
{
"code"
:
"0000000000"
,
"data"
:
{
"changeCoin"
:
0
,
"cloudDrillCost"
:
0
,
"coinBalance"
:
0
},
"desc"
:
"OK"
,
"success"
:
true
,
"timestamp"
:
1576225291430
}
\ No newline at end of file
mock/happyclear/getCloudNum.json
0 → 100644
View file @
66c730f0
{
"code"
:
"0000000000"
,
"data"
:
999
,
"desc"
:
"OK"
,
"success"
:
true
,
"timestamp"
:
1576225291348
}
\ No newline at end of file
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