Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
babycare_xiaoxiao
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
翁阳
babycare_xiaoxiao
Commits
7f61c84e
Commit
7f61c84e
authored
Jul 30, 2020
by
wjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l
parent
a1d2fb41
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
195 additions
and
153 deletions
+195
-153
babycare.getPrizesByLevel.json
mock/miniTb/babycare.getPrizesByLevel.json
+138
-117
babycare.luckyDraw.json
mock/miniTb/babycare.luckyDraw.json
+2
-2
output.js
output.js
+30
-17
output.js.map
output.js.map
+1
-1
PrizePanel.ts
src/panels/PrizePanel.ts
+2
-2
LotteryScene.ts
src/scene/LotteryScene.ts
+22
-14
No files found.
mock/miniTb/babycare.getPrizesByLevel.json
View file @
7f61c84e
{
"code"
:
"000000"
,
"data"
:
[
{
"switchStock"
:
2
,
"isBackUp"
:
false
,
"openId"
:
"AAEaCvE-ALiIWXQsJuac30pr"
,
"type"
:
3
,
"properiodfrom"
:
1
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
""
,
"id"
:
""
,
"stock"
:
""
,
"image"
:
"https://img.alicdn.com/imgextra/i2/2275046294/O1CN01Zzj1FL1wMhS845iJp_!!2275046294-2-miniprogram.png"
,
"properiodto"
:
5000
,
"amount"
:
""
,
"level"
:
1
,
"probability"
:
"50"
,
"prizeType"
:
10
,
"updateTime"
:
1596078351399
,
"ename"
:
""
,
"createTime"
:
1596014583758
,
"name"
:
"实物1实物1实物1实"
,
"useStock"
:
0
,
"_id"
:
"5f213ff7738989c8b3f46f4b"
,
"endTime"
:
""
},
{
"switchStock"
:
2
,
"isBackUp"
:
false
,
"openId"
:
"AAEaCvE-ALiIWXQsJuac30pr"
,
"type"
:
1
,
"properiodfrom"
:
5001
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
1593475200000
,
"id"
:
""
,
"stock"
:
""
,
"image"
:
"https://img.alicdn.com/imgextra/i2/2275046294/O1CN01fcO2aS1wMhS2wKUZO_!!2275046294-0-miniprogram.jpg"
,
"amount"
:
"1"
,
"properiodto"
:
10000
,
"level"
:
2
,
"probability"
:
"50"
,
"prizeType"
:
10
,
"updateTime"
:
1596078351410
,
"ename"
:
"18c738e4b1de4de3b481885b0d5e0936"
,
"createTime"
:
1596014583758
,
"name"
:
"优惠券1"
,
"useStock"
:
0
,
"_id"
:
"5f213ff7738989c8b3f46f4c"
,
"endTime"
:
1596239999000
},
{
"switchStock"
:
2
,
"isBackUp"
:
false
,
"openId"
:
"AAEaCvE-ALiIWXQsJuac30pr"
,
"type"
:
3
,
"properiodfrom"
:
10001
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
""
,
"id"
:
""
,
"stock"
:
""
,
"image"
:
"https://img.alicdn.com/imgextra/i4/2275046294/O1CN01avEmL01wMhS5Wxd63_!!2275046294-2-miniprogram.png"
,
"properiodto"
:
10000
,
"amount"
:
""
,
"level"
:
3
,
"probability"
:
"0"
,
"prizeType"
:
10
,
"updateTime"
:
1596078351423
,
"ename"
:
""
,
"createTime"
:
1596014583758
,
"name"
:
"实物11"
,
"useStock"
:
0
,
"_id"
:
"5f213ff7738989c8b3f46f4d"
,
"endTime"
:
""
},
{
"switchStock"
:
2
,
"isBackUp"
:
false
,
"type"
:
3
,
"properiodfrom"
:
10001
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
""
,
"id"
:
""
,
"stock"
:
""
,
"image"
:
"https://img.alicdn.com/imgextra/i3/2275046294/O1CN01KWxBt41wMhS7Oiham_!!2275046294-2-miniprogram.png"
,
"properiodto"
:
10000
,
"amount"
:
""
,
"level"
:
4
,
"probability"
:
"0"
,
"prizeType"
:
10
,
"updateTime"
:
1596078351428
,
"ename"
:
""
,
"createTime"
:
1596078351428
,
"name"
:
"实物测试名称过长的啦"
,
"useStock"
:
0
,
"_id"
:
"5f22390fe5c0d7361f1e6b59"
,
"endTime"
:
""
}
],
"success"
:
true
,
"message"
:
"成功"
}
\ No newline at end of file
"code"
:
"000000"
,
"data"
:
[
{
"switchStock"
:
2
,
"isBackUp"
:
false
,
"openId"
:
"AAEaCvE-ALiIWXQsJuac30pr"
,
"type"
:
3
,
"properiodfrom"
:
1
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
""
,
"id"
:
""
,
"stock"
:
""
,
"image"
:
"https://img.alicdn.com/imgextra/i4/2275046294/O1CN01avEmL01wMhS5Wxd63_!!2275046294-2-miniprogram.png"
,
"properiodto"
:
0
,
"amount"
:
""
,
"level"
:
3
,
"probability"
:
"0"
,
"prizeType"
:
10
,
"updateTime"
:
1596093227570
,
"ename"
:
""
,
"createTime"
:
1596014583758
,
"name"
:
"实物11"
,
"useStock"
:
0
,
"_id"
:
"5f213ff7738989c8b3f46f4d"
,
"endTime"
:
""
},
{
"switchStock"
:
1
,
"isBackUp"
:
false
,
"openId"
:
"AAEaCvE-ALiIWXQsJuac30pr"
,
"type"
:
3
,
"properiodfrom"
:
1
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
""
,
"id"
:
""
,
"stock"
:
10
,
"image"
:
"https://img.alicdn.com/imgextra/i2/2275046294/O1CN01Zzj1FL1wMhS845iJp_!!2275046294-2-miniprogram.png"
,
"properiodto"
:
0
,
"amount"
:
""
,
"level"
:
1
,
"probability"
:
"0"
,
"prizeType"
:
10
,
"updateTime"
:
1596093227546
,
"ename"
:
""
,
"createTime"
:
1596014583758
,
"name"
:
"实物1实物1实物1实"
,
"useStock"
:
1
,
"_id"
:
"5f213ff7738989c8b3f46f4b"
,
"endTime"
:
""
},
{
"switchStock"
:
2
,
"isBackUp"
:
false
,
"openId"
:
"AAEaCvE-ALiIWXQsJuac30pr"
,
"type"
:
1
,
"properiodfrom"
:
1
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
1593475200000
,
"id"
:
""
,
"stock"
:
""
,
"image"
:
"https://img.alicdn.com/imgextra/i2/2275046294/O1CN01fcO2aS1wMhS2wKUZO_!!2275046294-0-miniprogram.jpg"
,
"amount"
:
"1"
,
"properiodto"
:
0
,
"level"
:
2
,
"probability"
:
"0"
,
"prizeType"
:
10
,
"updateTime"
:
1596093227558
,
"ename"
:
"18c738e4b1de4de3b481885b0d5e0936"
,
"createTime"
:
1596014583758
,
"name"
:
"优惠券1"
,
"useStock"
:
0
,
"_id"
:
"5f213ff7738989c8b3f46f4c"
,
"endTime"
:
1596239999000
},
{
"switchStock"
:
2
,
"isBackUp"
:
false
,
"type"
:
3
,
"properiodfrom"
:
1
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"lockStatus"
:
1
,
"credits"
:
""
,
"deleteStatus"
:
1
,
"rank"
:
""
,
"startTime"
:
""
,
"id"
:
""
,
"stock"
:
""
,
"image"
:
"https://img.alicdn.com/imgextra/i3/2275046294/O1CN01KWxBt41wMhS7Oiham_!!2275046294-2-miniprogram.png"
,
"properiodto"
:
0
,
"amount"
:
""
,
"level"
:
4
,
"probability"
:
"0"
,
"prizeType"
:
10
,
"updateTime"
:
1596093227581
,
"ename"
:
""
,
"createTime"
:
1596078351428
,
"name"
:
"实物测试名称过长的啦"
,
"useStock"
:
0
,
"_id"
:
"5f22390fe5c0d7361f1e6b59"
,
"endTime"
:
""
},
{
"isBackUp"
:
true
,
"properiodto"
:
10000
,
"amount"
:
""
,
"level"
:
5
,
"probability"
:
"100"
,
"prizeType"
:
10
,
"updateTime"
:
1596093227586
,
"type"
:
5
,
"properiodfrom"
:
1
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"ename"
:
""
,
"lockStatus"
:
1
,
"createTime"
:
1596093227586
,
"deleteStatus"
:
1
,
"name"
:
"谢谢参与"
,
"useStock"
:
0
,
"startTime"
:
""
,
"_id"
:
"5f22732b738989c8b3f6d7c2"
,
"endTime"
:
""
}
],
"success"
:
true
,
"message"
:
"成功"
}
\ No newline at end of file
mock/miniTb/babycare.luckyDraw.json
View file @
7f61c84e
...
...
@@ -8,8 +8,8 @@
"openId"
:
"AAFgCvE-ALiIWXYsJuSLKdVt"
,
"createDay"
:
"2020/07/30"
,
"avatar"
:
"http://wwc.alicdn.com/avatar/getAvatar.do?userIdStr=XFvSvGH0XmQGOFNWMCQyP08yX8cYPFgLXH*IXFMHvHcT&width=80&height=80&type=sns"
,
"type"
:
3
,
"prizeId"
:
"5f2
13ff7738989c8b3f46f4b
"
,
"type"
:
5
,
"prizeId"
:
"5f2
2732b738989c8b3f6d7c2
"
,
"activityId"
:
"5f213ff79897b44ce1d2925d"
,
"ename"
:
""
,
"userNick"
:
"lpf468169313"
,
...
...
output.js
View file @
7f61c84e
...
...
@@ -16784,6 +16784,11 @@ var FailedPanel = (function (_super) {
this.tipsTex.textAlign = TEXT_ALIGN.CENTER;
this.tipsTex.textWidth = 750;
this.tipsTex.x = 0;
if (Tools_1.Tools.gameData.currentLevel == 120
&& MapScene_1.MapScene.checkArr && MapScene_1.MapScene.checkArr[120]
&& MapScene_1.MapScene.checkArr[120].checkData.isVisitSuccess) {
this.tipsTex.text = '';
}
};
FailedPanel.prototype.start = function (data) {
_super.prototype.start.call(this);
...
...
@@ -17167,7 +17172,7 @@ var PrizePanel = (function (_super) {
this.btnDelay(this.prizeBtn);
switch (this.data.type) {
case 1:
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.receiveEnamePrize, {
id: this.data.
id }, function (success, res) {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.receiveEnamePrize, {
_id: this.data._
id }, function (success, res) {
if (!success || !res) {
ctrls_1.showToast('奖品发放失败\n请前往我的奖品处进行处理');
_this.hidePanel();
...
...
@@ -17183,7 +17188,7 @@ var PrizePanel = (function (_super) {
}, true);
break;
case 3:
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getUserAddress, { prizeId: this.data.id }, function (success, res) {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getUserAddress, { prizeId: this.data.
_
id }, function (success, res) {
if (!success) {
return;
}
...
...
@@ -17637,7 +17642,12 @@ var SuccessNoPrizePanel = (function (_super) {
else {
this.totalContinueBtn.visible = false;
}
if (MapScene_1.MapScene.checkArr && MapScene_1.MapScene.checkArr[this.data.level] && MapScene_1.MapScene.checkArr[this.data.level].sendAwardType) {
if (Tools_1.Tools.gameData.currentLevel == 120
&& MapScene_1.MapScene.checkArr && MapScene_1.MapScene.checkArr[120]
&& MapScene_1.MapScene.checkArr[120].checkData.isVisitSuccess) {
this.tipsTex.text = '';
}
else if (MapScene_1.MapScene.checkArr && MapScene_1.MapScene.checkArr[this.data.level] && MapScene_1.MapScene.checkArr[this.data.level].sendAwardType) {
var curLevel_1 = Tools_1.Tools.gameData.currentLevel;
var upLevel_1 = 120;
var dLevel_1 = 120;
...
...
@@ -17653,7 +17663,7 @@ var SuccessNoPrizePanel = (function (_super) {
}
}
});
this.tipsTex.text = "\t\t\t\u592A\u5389\u5BB3\u4E86\uFF01\n\u518D\u89E3\u9501" + dLevel_1 + "\u5173\u53EF\u4EE5\u
5F00\u7EA2\u5305
\u4E86";
this.tipsTex.text = "\t\t\t\u592A\u5389\u5BB3\u4E86\uFF01\n\u518D\u89E3\u9501" + dLevel_1 + "\u5173\u53EF\u4EE5\u
62BD\u5956
\u4E86";
this.tipsTex.textAlign = TEXT_ALIGN.CENTER;
this.tipsTex.textWidth = 750;
this.tipsTex.x = 0;
...
...
@@ -18690,7 +18700,7 @@ var LotteryScene = (function (_super) {
};
LotteryScene.prototype.updatePrizes = function () {
return __awaiter(this, void 0, void 0, function () {
var prizeList, scroll, p;
var prizeList,
list,
scroll, p;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
...
...
@@ -18698,11 +18708,12 @@ var LotteryScene = (function (_super) {
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getPrizesByLevel, { level: this.data.level })];
case 1:
prizeList = (_a.sent()).data;
list = prizeList.slice().filter(function (e) { return e.type != 5; });
scroll = this.addChild(new FYGE.ScrollList(PrizeItem, 122, 140, 345, 152, false));
scroll.position.set(195, 1013);
scroll.updateData(
prizeL
ist || []);
scroll.updateData(
l
ist || []);
p = [201, 620];
this.lotScroll = this.addChild(new LotteryScroll(
prizeL
ist));
this.lotScroll = this.addChild(new LotteryScroll(
l
ist));
this.lotScroll.position.set(p[0], p[1]);
return [2];
}
...
...
@@ -18718,12 +18729,18 @@ var LotteryScene = (function (_super) {
if (!res.success)
return;
var id;
if (res.data && res.data.
_i
d)
id = res.data.
_i
d;
if (res.data && res.data.
prizeI
d)
id = res.data.
prizeI
d;
_this.enableMouseEvt(false);
console.log(id);
_this.lotScroll.lot(id, function () {
_this.enableMouseEvt(true);
ctrls_1.showPanel(id ? PrizePanel_1.PrizePanel : NoPrizePanel_1.NoPrizePanel, id ? res.data : null);
if (!id || res.data.type == 5) {
ctrls_1.showPanel(NoPrizePanel_1.NoPrizePanel);
}
else {
ctrls_1.showPanel(PrizePanel_1.PrizePanel, res.data);
}
});
});
};
...
...
@@ -18749,7 +18766,8 @@ var PrizeItem = (function (_super) {
PrizeItem.prototype.initData = function (id, data) {
if (id < 0 || !data)
return;
this.prizeImage.texture = FYGE.Texture.from(data.image);
if (data.image)
this.prizeImage.texture = FYGE.Texture.from(data.image);
this.nameTxt.text = data.name;
};
return PrizeItem;
...
...
@@ -18859,11 +18877,7 @@ var LotteryScroll = (function (_super) {
}
LotteryScroll.prototype.lot = function (id, callback) {
var _this = this;
if (id) {
if (this.ids.indexOf(id) == -1) {
console.error("中奖id不存在");
return;
}
if (id && this.ids.indexOf(id) != -1) {
var count_1 = 0;
var countAll_1 = this.scrollItems.length;
this.scrollItems.forEach(function (c, i) {
...
...
@@ -18885,7 +18899,6 @@ var LotteryScroll = (function (_super) {
arr.splice(_this.ids.indexOf(ids[0]), 1);
return arr;
})())) : ids.push(GTool_1.GTool.randomT(this.ids));
console.log(ids);
var count_2 = 0;
var countAll_2 = this.scrollItems.length;
this.scrollItems.forEach(function (c, i) {
output.js.map
View file @
7f61c84e
This diff is collapsed.
Click to expand it.
src/panels/PrizePanel.ts
View file @
7f61c84e
...
...
@@ -43,7 +43,7 @@ export class PrizePanel extends Panel {
this
.
btnDelay
(
this
.
prizeBtn
);
switch
(
this
.
data
.
type
)
{
case
1
:
// 权益
sendTbNet
(
TbNetName
.
receiveEnamePrize
,
{
id
:
this
.
data
.
id
},
sendTbNet
(
TbNetName
.
receiveEnamePrize
,
{
_id
:
this
.
data
.
_
id
},
(
success
,
res
)
=>
{
if
(
!
success
||
!
res
)
{
showToast
(
'奖品发放失败
\
n请前往我的奖品处进行处理'
);
...
...
@@ -60,7 +60,7 @@ export class PrizePanel extends Panel {
);
break
;
case
3
:
// 实物
sendTbNet
(
TbNetName
.
getUserAddress
,
{
prizeId
:
this
.
data
.
id
},
sendTbNet
(
TbNetName
.
getUserAddress
,
{
prizeId
:
this
.
data
.
_
id
},
(
success
,
res
)
=>
{
if
(
!
success
)
{
// showToast('奖品发放失败\n请前往我的奖品处进行处理');
...
...
src/scene/LotteryScene.ts
View file @
7f61c84e
...
...
@@ -73,30 +73,37 @@ export class LotteryScene extends Scene {
async
updatePrizes
()
{
showWaiting
();
const
{
data
:
prizeList
}
=
await
sendTbNet
(
TbNetName
.
getPrizesByLevel
,
{
level
:
this
.
data
.
level
});
//去掉type为5的谢谢参与
var
list
=
prizeList
.
slice
().
filter
((
e
)
=>
{
return
e
.
type
!=
5
});
//滚动列表
// console.log(prizeList)
var
scroll
=
this
.
addChild
(
new
FYGE
.
ScrollList
(
PrizeItem
,
122
,
140
,
345
,
152
,
false
))
scroll
.
position
.
set
(
195
,
1013
);
scroll
.
updateData
(
prizeL
ist
||
[])
scroll
.
updateData
(
l
ist
||
[])
//摇奖部分
var
p
=
[
201
,
620
]
this
.
lotScroll
=
this
.
addChild
(
new
LotteryScroll
(
prizeL
ist
))
this
.
lotScroll
=
this
.
addChild
(
new
LotteryScroll
(
l
ist
))
this
.
lotScroll
.
position
.
set
(
p
[
0
],
p
[
1
]);
}
lottery
()
{
showWaiting
()
sendTbNet
(
TbNetName
.
luckyDraw
)
sendTbNet
(
TbNetName
.
luckyDraw
,
{
level
:
this
.
data
.
level
}
)
.
then
((
res
)
=>
{
hideWaiting
();
//如果是失败
if
(
!
res
.
success
)
return
;
let
id
;
let
id
;
//待考虑,谢谢参与要进哪?是否进列表,下面id不存在时当作无奖励,(如果谢谢参与不进列表)
if
(
res
.
data
&&
res
.
data
.
prizeId
)
id
=
res
.
data
.
prizeId
;
this
.
enableMouseEvt
(
false
);
console
.
log
(
id
)
this
.
lotScroll
.
lot
(
id
,
()
=>
{
this
.
enableMouseEvt
(
true
)
//弹框
showPanel
(
id
?
PrizePanel
:
NoPrizePanel
,
id
?
res
.
data
:
null
)
//无奖
if
(
!
id
||
res
.
data
.
type
==
5
)
{
showPanel
(
NoPrizePanel
);
}
else
{
showPanel
(
PrizePanel
,
res
.
data
)
}
// showPanel(id ? PrizePanel : NoPrizePanel, id ? res.data : null)
})
})
}
...
...
@@ -133,7 +140,7 @@ class PrizeItem extends FYGE.Container implements FYGE.IScrollListItem {
}
initData
(
id
:
number
,
data
:
PrizeInt
)
{
if
(
id
<
0
||
!
data
)
return
;
this
.
prizeImage
.
texture
=
FYGE
.
Texture
.
from
(
data
.
image
);
if
(
data
.
image
)
this
.
prizeImage
.
texture
=
FYGE
.
Texture
.
from
(
data
.
image
);
this
.
nameTxt
.
text
=
data
.
name
;
}
id
;
...
...
@@ -260,12 +267,13 @@ class LotteryScroll extends FYGE.Container {
.
position
.
set
(
0
,
h
)
}
lot
(
id
?:
string
,
callback
?:
()
=>
void
)
{
if
(
id
)
{
//有id且在中奖列表里
if
(
id
&&
this
.
ids
.
indexOf
(
id
)
!=
-
1
)
{
//确保得是ids里的id。否则无效
if
(
this
.
ids
.
indexOf
(
id
)
==
-
1
)
{
console
.
error
(
"中奖id不存在"
)
return
;
}
//
if (this.ids.indexOf(id) == -1) {
//
console.error("中奖id不存在")
//
return;
//
}
let
count
=
0
;
let
countAll
=
this
.
scrollItems
.
length
;
this
.
scrollItems
.
forEach
((
c
:
LotteryScrollItem
,
i
)
=>
{
...
...
@@ -294,7 +302,7 @@ class LotteryScroll extends FYGE.Container {
return
arr
})())
)
:
ids
.
push
(
GTool
.
randomT
(
this
.
ids
));
console
.
log
(
ids
)
//
console.log(ids)
let
count
=
0
;
let
countAll
=
this
.
scrollItems
.
length
;
this
.
scrollItems
.
forEach
((
c
:
LotteryScrollItem
,
i
)
=>
{
...
...
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