Commit 3a9c0c89 authored by wjf's avatar wjf

l

parents cb1970a5 3bcda420
This diff is collapsed.
......@@ -2,11 +2,12 @@
"code": "000000",
"data": [
{
"taskType": "member",
"times": 1,
"taskType": "browseGoods",
"times": 3,
"todayCompleteTimes": 0,
"waitReceive": 0,
"rewards": 65
"value": "",
"rewards": 10
},
{
"taskType": "invites",
......@@ -25,12 +26,11 @@
"rewards": 7
},
{
"taskType": "browseGoods",
"times": 3,
"todayCompleteTimes": 0,
"taskType": "member",
"times": 1,
"todayCompleteTimes": 1,
"waitReceive": 0,
"value": "",
"rewards": 10
"rewards": 65
}
],
"success": true,
......
This diff is collapsed.
This diff is collapsed.
export enum G_EVENT {
ON_SHOW = 'onShow', // 页面显示
ON_HIDE = 'onHide', // 页面隐藏
UPDATE_BAG = 'UpdateBag', // 更新背包
UPDATE_SHOP = 'UpdateShop', // 更新商店
UPDATE_TASK = 'UpdateTask', // 更新任务
UPDATE_SIGN = 'UpdateSign', // 更新签到
}
......@@ -9,6 +9,9 @@ import Container = FYGE.Container;
import { PropType } from "../something/enum/PropType";
import { RES } from "../../module/RES";
import TextField = FYGE.TextField;
import { changeScene } from "../../module/ctrls";
import { MapScene } from "../scene/map/MapScene";
import MouseEvent = FYGE.MouseEvent;
export class SuccessPrizePanel extends Panel {
get groupNames() {
......@@ -110,8 +113,39 @@ export class SuccessPrizePanel extends Panel {
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() {
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() {
......
......@@ -4,6 +4,10 @@ import { sendTbNet, TbNetName } from "../TaoBaoNet";
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
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 {
get groupNames() {
......@@ -27,26 +31,74 @@ export class TaskPanel extends Panel {
}
closeBtn: Button;
taskBtn1: Button;
taskBtn2: Button;
taskBtn3: Button;
taskBtn4: Button;
taskBtn1: Button; // 浏览商品
taskBtn2: Button; // 邀请
taskBtn3: Button; // 关注
taskBtn4: Button; // 加入会员
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() {
// const _bd: { string: Button } = {
// 'browseGoods': this.taskBtn1,
// 'invites': this.taskBtn2,
// 'follow': this.taskBtn3,
// 'member': this.taskBtn4,
// }
const taskData = {
'browseGoods': this.taskBtn1,
'invites': this.taskBtn2,
'follow': this.taskBtn3,
'member': this.taskBtn4,
}
sendTbNet(TbNetName.getTaskList, {},
(success, res) => {
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 {
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() {
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 {
// score: 666,
// stars: 3,
// isVisitSuccess: true,
// isPrizeLevel: true,
// tool: {
// type: 'HAMMERS',
// },
// // prize: {
// // image: 'https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png',
// // }
// isPrizeLevel: false,
// // tool: {
// // type: 'HAMMERS',
// // },
// prize: {
// 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