Commit 3a9c0c89 authored by wjf's avatar wjf

l

parents cb1970a5 3bcda420
This diff is collapsed.
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
"code": "000000", "code": "000000",
"data": [ "data": [
{ {
"taskType": "member", "taskType": "browseGoods",
"times": 1, "times": 3,
"todayCompleteTimes": 0, "todayCompleteTimes": 0,
"waitReceive": 0, "waitReceive": 0,
"rewards": 65 "value": "",
"rewards": 10
}, },
{ {
"taskType": "invites", "taskType": "invites",
...@@ -25,12 +26,11 @@ ...@@ -25,12 +26,11 @@
"rewards": 7 "rewards": 7
}, },
{ {
"taskType": "browseGoods", "taskType": "member",
"times": 3, "times": 1,
"todayCompleteTimes": 0, "todayCompleteTimes": 1,
"waitReceive": 0, "waitReceive": 0,
"value": "", "rewards": 65
"rewards": 10
} }
], ],
"success": true, "success": true,
......
This diff is collapsed.
This diff is collapsed.
export enum G_EVENT { export enum G_EVENT {
ON_SHOW = 'onShow', // 页面显示 ON_SHOW = 'onShow', // 页面显示
ON_HIDE = 'onHide', // 页面隐藏 ON_HIDE = 'onHide', // 页面隐藏
UPDATE_BAG = 'UpdateBag', // 更新背包
UPDATE_SHOP = 'UpdateShop', // 更新商店
UPDATE_TASK = 'UpdateTask', // 更新任务 UPDATE_TASK = 'UpdateTask', // 更新任务
UPDATE_SIGN = 'UpdateSign', // 更新签到
} }
...@@ -9,6 +9,9 @@ import Container = FYGE.Container; ...@@ -9,6 +9,9 @@ import Container = FYGE.Container;
import { PropType } from "../something/enum/PropType"; import { PropType } from "../something/enum/PropType";
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import TextField = FYGE.TextField; import TextField = FYGE.TextField;
import { changeScene } from "../../module/ctrls";
import { MapScene } from "../scene/map/MapScene";
import MouseEvent = FYGE.MouseEvent;
export class SuccessPrizePanel extends Panel { export class SuccessPrizePanel extends Panel {
get groupNames() { get groupNames() {
...@@ -110,8 +113,39 @@ export class SuccessPrizePanel extends Panel { ...@@ -110,8 +113,39 @@ export class SuccessPrizePanel extends Panel {
super.start(); super.start();
} }
/**
* 挑战满星
*/
private again() {
changeScene(MapScene, {level: this.data.level});
super.hidePanel();
}
/**
* 继续闯关
*/
private continue() {
console.log(1);
changeScene(MapScene, {level: this.data.level + 1});
super.hidePanel();
}
public goPrize(){
/// TODO 去抽奖
}
public hidePanel() {
changeScene(MapScene);
super.hidePanel();
}
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
this.againBtn.addEventListener(MouseEvent.CLICK, this.again, this);
this.noPrizeAgainBtn.addEventListener(MouseEvent.CLICK, this.continue, this);
this.goPrizeBtn.addEventListener(MouseEvent.CLICK, this.goPrize, this);
} }
removeEvents() { removeEvents() {
......
...@@ -4,6 +4,10 @@ import { sendTbNet, TbNetName } from "../TaoBaoNet"; ...@@ -4,6 +4,10 @@ import { sendTbNet, TbNetName } from "../TaoBaoNet";
import Tween = FYGE.Tween; import Tween = FYGE.Tween;
import Ease = FYGE.Ease; import Ease = FYGE.Ease;
import Button = FYGE.Button; import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
import { Tools } from "../Tools";
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
export class TaskPanel extends Panel { export class TaskPanel extends Panel {
get groupNames() { get groupNames() {
...@@ -27,26 +31,74 @@ export class TaskPanel extends Panel { ...@@ -27,26 +31,74 @@ export class TaskPanel extends Panel {
} }
closeBtn: Button; closeBtn: Button;
taskBtn1: Button; taskBtn1: Button; // 浏览商品
taskBtn2: Button; taskBtn2: Button; // 邀请
taskBtn3: Button; taskBtn3: Button; // 关注
taskBtn4: Button; taskBtn4: Button; // 加入会员
initUi() { initUi() {
this.updateTask();
}
private follow() {
GDispatcher.removeAllEventListenerByType(TbNetName.favorShop);
sendTbNet(TbNetName.favorShop, {},
(success, res) => {
if (!success) {
return;
}
sendTbNet(TbNetName.completeTask, {taskName: 'follow'},
(success, res) => {
GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK);
if (!success) return;
}
);
}, true
);
}
private invite() {
sendTbNet(TbNetName.showSharePanel, {openId: Tools.globalData.openId},
(success, res) => {
}
);
} }
private browseGoods() {
/// TODO 浏览商品
console.log('浏览商品');
}
private memberUrl: string;
private member() {
/// TODO 加入会员
sendTbNet(TbNetName.showSharePanel, {openId: Tools.globalData.openId},
(success, res) => {
}
);
}
public updateTask() { public updateTask() {
// const _bd: { string: Button } = { const taskData = {
// 'browseGoods': this.taskBtn1, 'browseGoods': this.taskBtn1,
// 'invites': this.taskBtn2, 'invites': this.taskBtn2,
// 'follow': this.taskBtn3, 'follow': this.taskBtn3,
// 'member': this.taskBtn4, 'member': this.taskBtn4,
// } }
sendTbNet(TbNetName.getTaskList, {}, sendTbNet(TbNetName.getTaskList, {},
(success, res) => { (success, res) => {
if (!success) return; if (!success) return;
res.data.forEach((v) => {
taskData[v.taskType].enabled = (v.todayCompleteTimes < v.times);
if (v.taskType == 'member') {
this.memberUrl = v.value;
}
});
} }
); );
} }
...@@ -57,9 +109,21 @@ export class TaskPanel extends Panel { ...@@ -57,9 +109,21 @@ export class TaskPanel extends Panel {
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
GDispatcher.addEventListener(G_EVENT.UPDATE_TASK, this.updateTask, this);
GDispatcher.addEventListener(G_EVENT.ON_SHOW, this.updateTask, this);
this.taskBtn1.addEventListener(MouseEvent.CLICK, this.browseGoods, this);
this.taskBtn2.addEventListener(MouseEvent.CLICK, this.invite, this);
this.taskBtn3.addEventListener(MouseEvent.CLICK, this.follow, this);
this.taskBtn4.addEventListener(MouseEvent.CLICK, this.member, this);
} }
removeEvents() { removeEvents() {
super.removeEvents(); super.removeEvents();
GDispatcher.removeEventListener(G_EVENT.UPDATE_TASK, this.updateTask, this);
GDispatcher.removeEventListener(G_EVENT.ON_SHOW, this.updateTask, this);
this.taskBtn1.removeEventListener(MouseEvent.CLICK, this.browseGoods, this);
this.taskBtn2.removeEventListener(MouseEvent.CLICK, this.invite, this);
this.taskBtn3.removeEventListener(MouseEvent.CLICK, this.follow, this);
this.taskBtn4.removeEventListener(MouseEvent.CLICK, this.member, this);
} }
} }
...@@ -222,13 +222,13 @@ export class MapScene extends Scene { ...@@ -222,13 +222,13 @@ export class MapScene extends Scene {
// score: 666, // score: 666,
// stars: 3, // stars: 3,
// isVisitSuccess: true, // isVisitSuccess: true,
// isPrizeLevel: true, // isPrizeLevel: false,
// tool: { // // tool: {
// type: 'HAMMERS', // // type: 'HAMMERS',
// }, // // },
// // prize: { // prize: {
// // image: 'https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png', // image: 'https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png',
// // } // }
// }); // });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment