Commit 0009e911 authored by haiyoucuv's avatar haiyoucuv

1

parent 6e4e6a56
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"success": true,
"code": "000000",
"message": "success",
"data": {
"tools": {
"steps": 1,
"booms": 1,
"hammers": 1
}
}
"data": true,
"success": true,
"message": "成功"
}
\ No newline at end of file
{
"success": true,
"code": "000000",
"message": "成功",
"data": {}
}
{
"code": "000000",
"data": {
"openId": "AAFM1op4AMWgvWfIyaTlN0QC",
"currentLevel": 1,
"isFirstLogin": false,
"records": [{
"score": 0,
"level": 1,
"isVisitSuccess": false,
"stars": 0
}],
"loginAddPower": false,
"rule": "泡泡玛特测试游戏2,内部测试",
"updateTime": 1601379026121,
"startTime": 1601379209000,
"power": 5,
"endTime": 1661984009000,
"title": "测试2",
"tools": {
"booms": 1,
"hammers": 1,
"steps": 1
},
"levelPrize": {
"level50": "https://img.alicdn.com/imgextra/i3/2885348004/O1CN014VE1Sa28zsjd1q8HN_!!2885348004-0-miniprogram.jpg",
"level120": "https://img.alicdn.com/imgextra/i2/2885348004/O1CN01pfU3oP28zsjiRN9vs_!!2885348004-0-miniprogram.jpg",
"level100": "https://img.alicdn.com/imgextra/i4/2885348004/O1CN01kZN23Z28zsjkH7Ej6_!!2885348004-0-miniprogram.jpg"
},
"createTime": 1601379026121,
"deleteStatus": 1,
"awardReceiveExpiredTime": 1602243209000,
"startTime": 1601379209000,
"_id": "5f731ad1086e65a41b09fe22",
"endTime": 1661984009000,
"openPrizeStatus": 1,
"tasks": {
"browseGoods": {
"times": 3,
"itemIds": "619104333650,613930168360,626877183520",
"link": "",
"taskRateType": 1,
"title": "",
"type": "",
"value": ""
},
"orderGoods": {
"times": 3,
"itemIds": "623157072617,623772356959,619368430053",
"link": "",
"taskRateType": 1,
"title": "",
"type": "",
"value": ""
}
}
},
"success": true,
......
{
"success": true,
"code": "consectetur ex dolore id commodo",
"message": "aliqua sint commodo",
"data": {
"taskList": [
{
"taskType": "browserGoods",
"beMemberUrl": "https://www.baidu.com",
"rewards": 10,
"todayCompleteTimes": 2,
"totalTimes": 5,
"waitReceiveTimes": 10
},
{
"taskType": "invites",
"beMemberUrl": "https://www.baidu.com",
"rewards": 10,
"todayCompleteTimes": 2,
"totalTimes": 2,
"waitReceiveTimes": 0
},
{
"taskType": "orderGoods",
"beMemberUrl": "https://www.baidu.com",
"rewards": 10,
"todayCompleteTimes": 2,
"totalTimes": 5,
"waitReceiveTimes": 10
},
{
"taskType": "follow",
"beMemberUrl": "https://www.baidu.com",
"rewards": 10,
"todayCompleteTimes": 1,
"totalTimes": 1,
"waitReceiveTimes": 0
},
{
"code": "000000",
"data": [{
"taskType": "member",
"beMemberUrl": "https://www.baidu.com",
"rewards": 10,
"waitReceive": 0,
"taskRateType": 1,
"title": "加入店铺会员",
"url": "https://market.m.taobao.com/app/sj/member-center-rax/pages/pages_index_index?wh_weex=true&sellerId=2885348004&extraInfo=%7B%22source%22%3A%22isvapp%22%2C%22entrance%22%3A%22duiba%22%7D&callbackUrl=%E5%AE%A2%E6%88%B7%E7%AB%AF%E7%94%9F%E6%88%90%E7%9A%84%E9%A2%84%E8%A7%88%E5%9C%B0%E5%9D%80%28C%E7%AB%AF%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%BC%80%E5%8F%91%E6%8F%90%E4%BE%9B%29%26query%3DactivityId%253D5f731ad1086e65a41b09fe22%2526inviteId%253D",
"rewards": 1,
"status": 1
}, {
"taskType": "follow",
"waitReceive": 0,
"taskRateType": 1,
"completeTimes": 9,
"title": "关注店铺",
"rewards": 1,
"status": 3
}, {
"taskType": "orderGoods",
"times": 5,
"todayCompleteTimes": 0,
"itemIds": "623157072617,623772356959,619368430053",
"waitReceive": 0,
"taskRateType": 2,
"completeTimes": 0,
"title": "进行一笔订单消费",
"rewards": 5,
"status": 1
}, {
"taskType": "browseGoods",
"times": 2,
"todayCompleteTimes": 0,
"itemIds": "619104333650,613930168360,626877183520",
"taskRateType": 2,
"completeTimes": 0,
"title": "每日浏览商品",
"rewards": 1,
"status": 1
}, {
"taskType": "invites",
"times": 5,
"todayCompleteTimes": 1,
"totalTimes": 1,
"waitReceiveTimes": 0
}
]
}
"waitReceive": 0,
"taskRateType": 2,
"completeTimes": 1,
"title": "邀请好友参与活动",
"rewards": 2,
"status": 1
}],
"success": true,
"message": "成功"
}
\ No newline at end of file
......@@ -3437,10 +3437,10 @@ exports.ResJson = {
}
},
{
"keys": "browserGoods_btn_dis.png,browserGoods_btn_en.png,browserGoods_icon.png,follow_btn_dis.png,follow_btn_en.png,follow_icon.png,invites_btn_dis.png,invites_btn_en.png,invites_icon.png,member_btn_dis.png,member_btn_en.png,member_icon.png,orderGoods_btn_dis.png,orderGoods_btn_en.png,orderGoods_icon.png,task_get_btn.png,task_item_bg.png,任务背景.png,去完成.png,去完成灰.png",
"keys": "browseGoods_btn_dis.png,browseGoods_btn_en.png,browseGoods_icon.png,follow_btn_dis.png,follow_btn_en.png,follow_icon.png,invites_btn_dis.png,invites_btn_en.png,invites_icon.png,member_btn_dis.png,member_btn_en.png,member_icon.png,orderGoods_btn_dis.png,orderGoods_btn_en.png,orderGoods_icon.png,task_get_btn.png,task_item_bg.png,任务背景.png,去完成.png,去完成灰.png",
"name": "TaskPanel",
"atlas": {
"browserGoods_btn_dis.png": {
"browseGoods_btn_dis.png": {
"x": 2,
"y": 248,
"w": 183,
......@@ -3451,7 +3451,7 @@ exports.ResJson = {
"sh": 80,
"ro": false
},
"browserGoods_btn_en.png": {
"browseGoods_btn_en.png": {
"x": 557,
"y": 166,
"w": 183,
......@@ -3462,7 +3462,7 @@ exports.ResJson = {
"sh": 80,
"ro": false
},
"browserGoods_icon.png": {
"browseGoods_icon.png": {
"x": 595,
"y": 248,
"w": 100,
......@@ -12702,7 +12702,7 @@ exports.ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1602212094/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1602223104/resource/"
};
......@@ -13325,6 +13325,7 @@ var TbNetName;
TbNetName["trackingReport"] = "squirrelsAdoptRest2c.trackingReport";
TbNetName["receiveEnamePrize"] = "popmartXXL2c.receiveEnamePrize";
TbNetName["drawLotteryPrize"] = "popmartXXL2c.drawLotteryPrize";
TbNetName["getToolsInfo"] = "popmartXXL2c.getToolsInfo";
TbNetName["doHelp"] = "popmartXXL2c.doHelp";
TbNetName["getActivityBaseInfoById"] = "popmartXXL2c.getActivityBaseInfoById";
TbNetName["consumerTools"] = "popmartXXL2c.consumerTools";
......@@ -13332,6 +13333,7 @@ var TbNetName;
TbNetName["receiveTaskRewards"] = "popmartXXL2c.receiveTaskRewards";
TbNetName["dojoin"] = "popmartXXL2c.doJoin";
TbNetName["completeTask"] = "popmartXXL2c.completeTask";
TbNetName["doFollowTask"] = "popmartXXL2c.doFollowTask";
TbNetName["getTaskList"] = "popmartXXL2c.getTaskList";
TbNetName["authorize"] = "mine.authorize";
TbNetName["favorShop"] = "mine.favorShop";
......@@ -13372,16 +13374,16 @@ function sendTbNet(netName, parameter, callback, hideMsg) {
var fun = function (e) {
Main_1.GDispatcher.removeEventListener(netName, fun);
var d = e.data;
dataRecord[netName] = d;
if (!hideMsg && !d.success)
ctrls_1.showToast(d.message || "网络超时");
callback && callback(d.success, d);
resolve(d);
console.log("\n%c[ request ]\n"
+ ("NAME : " + netName + " \n")
+ "STATE : %o \n"
+ "PARAM : %o \n"
+ "%cDATA : %o \n", "" + (d.success ? 'color:green' : 'color:red'), d.success, parameter, "" + (d.success ? 'color:green' : 'color:red'), d);
dataRecord[netName] = d;
if (!hideMsg && !d.success)
ctrls_1.showToast(d.message || "网络超时");
callback && callback(d.success, d);
resolve(d);
};
Main_1.GDispatcher.addEventListener(netName, fun);
Main_1.GDispatcher.dispatchEvent({ type: "onMessage" }, { netName: netName, parameter: parameter });
......@@ -13532,9 +13534,14 @@ var Tools = (function () {
return new Promise(function (resolve, reject) {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.consumerTools, { type: type }, function (s, res) {
if (s) {
_this.propInfo.booms = res.data.tools.booms;
_this.propInfo.steps = res.data.tools.steps;
_this.propInfo.hammers = res.data.tools.hammers;
_this.propInfo[type] -= 1;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getToolsInfo, {}, function (st, rt) {
if (!st)
return;
_this.propInfo.booms = +res.data.tools.booms;
_this.propInfo.steps = +res.data.tools.steps;
_this.propInfo.hammers = +res.data.tools.hammers;
});
resolve(true);
}
else {
......@@ -18169,12 +18176,6 @@ var StartPanelPrize = (function (_super) {
isGiftPrizeLevel: res.data.isGiftPrizeLevel
});
_this.hidePanel();
if (Tools_1.Tools.globalData.inviteId) {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.doHelp, { inviteId: Tools_1.Tools.globalData.inviteId }, function (success, res) {
if (success)
Tools_1.Tools.globalData.inviteId = null;
}, true);
}
});
};
StartPanelPrize.prototype.initEvents = function () {
......@@ -18660,7 +18661,7 @@ var TaskType;
TaskType["follow"] = "follow";
TaskType["invites"] = "invites";
TaskType["orderGoods"] = "orderGoods";
TaskType["browserGoods"] = "browserGoods";
TaskType["browseGoods"] = "browseGoods";
})(TaskType = exports.TaskType || (exports.TaskType = {}));
var taskItemData = (_a = {},
_a[TaskType.member] = {
......@@ -18683,8 +18684,8 @@ var taskItemData = (_a = {},
title: '完成下单',
desc: '按成下单即可获得${rewards}体力'
},
_a[TaskType.browserGoods] = {
key: TaskType.browserGoods,
_a[TaskType.browseGoods] = {
key: TaskType.browseGoods,
title: '每日浏览商品(${done}/${total})',
desc: '浏览指定商品即可获得${rewards}体力'
},
......@@ -18736,16 +18737,15 @@ var TaskPanel = (function (_super) {
if (!success)
return;
console.log(res);
for (var i = res.data.taskList.length - 1; i >= 0; i--) {
var v = res.data.taskList[i];
for (var i = res.data.length - 1; i >= 0; i--) {
var v = res.data[i];
if ((v.taskType == TaskType.member || v.taskType == TaskType.follow)
&& v.todayCompleteTimes >= v.totalTimes
&& v.waitReceiveTimes <= 0) {
res.data.taskList.splice(i, 1);
&& v.status == 3) {
res.data.splice(i, 1);
}
}
console.log(res.data.taskList);
_this.scroll.updateData(res.data.taskList, true);
console.log(res.data);
_this.scroll.updateData(res.data, true);
});
};
TaskPanel.prototype.initEvents = function () {
......@@ -18787,24 +18787,24 @@ var TaskItem = (function (_super) {
if (id < 0 || !data)
return;
this.data = data;
var rewards = data.rewards, taskType = data.taskType, totalTimes = data.totalTimes, waitReceiveTimes = data.waitReceiveTimes, todayCompleteTimes = data.todayCompleteTimes;
var rewards = data.rewards, taskType = data.taskType, completeTimes = data.completeTimes, waitReceive = data.waitReceive, todayCompleteTimes = data.todayCompleteTimes, times = data.times, status = data.status;
this.icon.texture = RES_1.RES.getRes(taskType + "_icon.png");
this.title.text = taskItemData[taskType].title
.replace('${done}', todayCompleteTimes)
.replace('${total}', totalTimes);
.replace('${total}', times);
this.desc.text = taskItemData[taskType].desc
.replace('${rewards}', rewards);
this.taskBtn.changeTexture(RES_1.RES.getRes(taskType + "_btn_en.png"), RES_1.RES.getRes(taskType + "_btn_en.png"), RES_1.RES.getRes(taskType + "_btn_dis.png"));
if (+waitReceiveTimes > 0) {
if (+status == 2) {
this.getBtn.visible = true;
this.taskBtn.visible = false;
}
else if (+todayCompleteTimes >= +totalTimes) {
else if (+status == 3) {
this.getBtn.visible = false;
this.taskBtn.visible = true;
this.taskBtn.enabled = false;
}
else {
else if (+status == 1) {
this.getBtn.visible = false;
this.taskBtn.visible = true;
this.taskBtn.enabled = true;
......@@ -18818,6 +18818,8 @@ var TaskItem = (function (_super) {
if (!success)
return;
ctrls_1.showToast("\u4EFB\u52A1\u5B8C\u6210\uFF0C\u4F53\u529B\u503C+" + res.data.power + "\uFF01");
Tools_1.Tools.propInfo.power += res.data.power;
ctrls_1.getCurrentScene().updateScene();
Main_1.GDispatcher.dispatchEvent(G_EVENT_1.G_EVENT.UPDATE_TASK);
});
};
......@@ -18825,16 +18827,16 @@ var TaskItem = (function (_super) {
var _this = this;
switch (this.data.taskType) {
case TaskType.member:
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.navigateToOutside, { url: this.data.beMemberUrl });
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.navigateToOutside, { url: this.data.url });
break;
case TaskType.browserGoods:
case TaskType.browseGoods:
console.log('去浏览页');
break;
case TaskType.follow:
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.favorShop, {}, function (fs, fr) {
if (!fs)
return;
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.completeTask, { taskType: _this.data.taskType }, function (cs, cr) { return Main_1.GDispatcher.dispatchEvent(G_EVENT_1.G_EVENT.UPDATE_TASK); });
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.doFollowTask, { taskType: _this.data.taskType }, function (cs, cr) { return Main_1.GDispatcher.dispatchEvent(G_EVENT_1.G_EVENT.UPDATE_TASK); });
});
break;
case TaskType.invites:
......@@ -19364,10 +19366,10 @@ var PlayScene = (function (_super) {
}
else {
this.enableMouseEvt(true);
if (this.chapter == 1 && Tools_1.Tools.baseInfo.isFristLogin) {
if (this.chapter == 1 && Tools_1.Tools.baseInfo.isFirstLogin) {
this.addChild(new FirstPropGift_1.FirstPropGift())
.once(FYGE.MouseEvent.CLICK, function (e) {
Tools_1.Tools.baseInfo.isFristLogin = false;
Tools_1.Tools.baseInfo.isFirstLogin = false;
_this.removeChild(e.target);
_this.initGuide();
}, this);
......@@ -21994,6 +21996,7 @@ var Tween = FYGE.Tween;
var Ease = FYGE.Ease;
var ctrls_1 = __webpack_require__(/*! ../../../module/ctrls */ "./module/ctrls/index.ts");
var FreePowerPanel_1 = __webpack_require__(/*! ../../panels/FreePowerPanel */ "./src/panels/FreePowerPanel.ts");
var TaoBaoNet_1 = __webpack_require__(/*! ../../TaoBaoNet */ "./src/TaoBaoNet.ts");
var MapScene = (function (_super) {
__extends(MapScene, _super);
function MapScene() {
......@@ -22022,7 +22025,7 @@ var MapScene = (function (_super) {
this.mapContainer = this.scrollPage.view.addChild(new Container());
this.initMap();
this.updateMapCheck();
if (Tools_1.Tools.baseInfo.loginAddPower && !Tools_1.Tools.baseInfo.isFristLogin) {
if (Tools_1.Tools.baseInfo.loginAddPower && !Tools_1.Tools.baseInfo.isFirstLogin) {
ctrls_1.showPanel(FreePowerPanel_1.FreePowerPanel);
Tools_1.Tools.baseInfo.loginAddPower = false;
}
......@@ -22032,7 +22035,7 @@ var MapScene = (function (_super) {
if (this.data && this.data.from == 'loading') {
this.uiLayer = this.addChild(new MapUI_1.default());
this.initMapByData();
if (Tools_1.Tools.baseInfo.isFristLogin) {
if (Tools_1.Tools.baseInfo.isFirstLogin) {
this.initGuide();
}
}
......@@ -22151,6 +22154,12 @@ var MapScene = (function (_super) {
};
MapScene.prototype.start = function (data) {
_super.prototype.start.call(this, data);
if (Tools_1.Tools.globalData.inviteId) {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.doHelp, { inviteId: Tools_1.Tools.globalData.inviteId }, function (success, res) {
if (success)
ctrls_1.showToast('助力成功');
});
}
};
MapScene.prototype.initEvents = function () {
_super.prototype.initEvents.call(this);
......@@ -22345,7 +22354,7 @@ var MapUI = (function (_super) {
break;
case this.myPrizeBtn:
console.log('我的奖品');
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.navigateTo, { url: '/pages/myPrize/myPrize' }, function () {
TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.navigateTo, { url: '/pages/myprize/myprize' }, function () {
}, true);
break;
case this.taskBtn:
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -37,7 +37,7 @@
"name": "SuccessPanel"
},
{
"keys": "browserGoods_btn_dis.png,browserGoods_btn_en.png,browserGoods_icon.png,follow_btn_dis.png,follow_btn_en.png,follow_icon.png,invites_btn_dis.png,invites_btn_en.png,invites_icon.png,member_btn_dis.png,member_btn_en.png,member_icon.png,orderGoods_btn_dis.png,orderGoods_btn_en.png,orderGoods_icon.png,task_get_btn.png,task_item_bg.png,任务背景.png,去完成.png,去完成灰.png",
"keys": "browseGoods_btn_dis.png,browseGoods_btn_en.png,browseGoods_icon.png,follow_btn_dis.png,follow_btn_en.png,follow_icon.png,invites_btn_dis.png,invites_btn_en.png,invites_icon.png,member_btn_dis.png,member_btn_en.png,member_icon.png,orderGoods_btn_dis.png,orderGoods_btn_en.png,orderGoods_icon.png,task_get_btn.png,task_item_bg.png,任务背景.png,去完成.png,去完成灰.png",
"name": "TaskPanel"
},
{
......
......@@ -1243,10 +1243,10 @@ export const ResJson = {
}
},
{
"keys": "browserGoods_btn_dis.png,browserGoods_btn_en.png,browserGoods_icon.png,follow_btn_dis.png,follow_btn_en.png,follow_icon.png,invites_btn_dis.png,invites_btn_en.png,invites_icon.png,member_btn_dis.png,member_btn_en.png,member_icon.png,orderGoods_btn_dis.png,orderGoods_btn_en.png,orderGoods_icon.png,task_get_btn.png,task_item_bg.png,任务背景.png,去完成.png,去完成灰.png",
"keys": "browseGoods_btn_dis.png,browseGoods_btn_en.png,browseGoods_icon.png,follow_btn_dis.png,follow_btn_en.png,follow_icon.png,invites_btn_dis.png,invites_btn_en.png,invites_icon.png,member_btn_dis.png,member_btn_en.png,member_icon.png,orderGoods_btn_dis.png,orderGoods_btn_en.png,orderGoods_icon.png,task_get_btn.png,task_item_bg.png,任务背景.png,去完成.png,去完成灰.png",
"name": "TaskPanel",
"atlas": {
"browserGoods_btn_dis.png": {
"browseGoods_btn_dis.png": {
"x": 2,
"y": 248,
"w": 183,
......@@ -1257,7 +1257,7 @@ export const ResJson = {
"sh": 80,
"ro": false
},
"browserGoods_btn_en.png": {
"browseGoods_btn_en.png": {
"x": 557,
"y": 166,
"w": 183,
......@@ -1268,7 +1268,7 @@ export const ResJson = {
"sh": 80,
"ro": false
},
"browserGoods_icon.png": {
"browseGoods_icon.png": {
"x": 595,
"y": 248,
"w": 100,
......@@ -10508,5 +10508,5 @@ export const ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1602212094/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1602223104/resource/"
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ export enum TbNetName {
receiveEnamePrize = "popmartXXL2c.receiveEnamePrize",
drawLotteryPrize = 'popmartXXL2c.drawLotteryPrize',
getToolsInfo = 'popmartXXL2c.getToolsInfo',
// inviteId
doHelp = 'popmartXXL2c.doHelp',
......@@ -51,6 +52,7 @@ export enum TbNetName {
* activityId taskType
*/
completeTask = "popmartXXL2c.completeTask",
doFollowTask = "popmartXXL2c.doFollowTask",
/**
* 任务列表
* activityId
......@@ -197,13 +199,7 @@ export function sendTbNet(
GDispatcher.removeEventListener(netName, fun);
var d = e.data;
//记录数据
dataRecord[netName] = d;
//统一错误信息提示,d.data为了区分网络超时
if (!hideMsg && !d.success) showToast(d.message || "网络超时")
//执行回调
callback && callback(d.success, d);
resolve(d)
console.log(
`\n%c[ request ]\n`
+ `NAME : ${netName} \n`
......@@ -216,6 +212,14 @@ export function sendTbNet(
, `${d.success ? 'color:green' : 'color:red'}`
, d
);
//记录数据
dataRecord[netName] = d;
//统一错误信息提示,d.data为了区分网络超时
if (!hideMsg && !d.success) showToast(d.message || "网络超时")
//执行回调
callback && callback(d.success, d);
resolve(d);
}
//添加事件接收接口返回信息
GDispatcher.addEventListener(netName, fun);
......
......@@ -34,7 +34,7 @@ export class Tools {
}
public static async getAppData() {
const {data} = await sendTbNet(TbNetName.getAppData);
const { data } = await sendTbNet(TbNetName.getAppData);
Tools.globalData = data;
}
......@@ -50,6 +50,14 @@ export class Tools {
power: 0,
}
// public getPower() {
// sendTbNet(TbNetName.getPower, {},
// (success, res) => {
// });
// }
public static baseInfo: {
inviteFriends: any,
rule: string,
......@@ -69,9 +77,8 @@ export class Tools {
level100: string,
level120: string
},
loginAddPower: boolean,
isFristLogin: boolean, //是否是首次
isFirstLogin: boolean, //是否是首次
};// 活动基本信息
public static getBaseInfo() {
......@@ -97,12 +104,18 @@ export class Tools {
*/
public static consumerTools(type: PropType): Promise<boolean> {
return new Promise((resolve, reject) => {
sendTbNet(TbNetName.consumerTools, {type}, (s, res) => {
sendTbNet(TbNetName.consumerTools, { type }, (s, res) => {
if (s) {
//修改道具数量
this.propInfo.booms = res.data.tools.booms;
this.propInfo.steps = res.data.tools.steps;
this.propInfo.hammers = res.data.tools.hammers;
this.propInfo[type] -= 1;
sendTbNet(TbNetName.getToolsInfo, {},
(st, rt) => {
if (!st) return;
this.propInfo.booms = +res.data.tools.booms;
this.propInfo.steps = +res.data.tools.steps;
this.propInfo.hammers = +res.data.tools.hammers;
}
);
resolve(true)
} else {
// reject()
......@@ -133,11 +146,11 @@ export class Tools {
var tbMy = my
if (!tbMy) return;
//@ts-ignore
const {cloud} = getApp();
const { cloud } = getApp();
//测试地址//到时云存储传一个小json,,改路径
var url = "cloud://B4F0300E5148F478B506DEDC26EA4C6C//butterfly0.svga";
//获取临时地址
var urls = await cloud.file.getTempFileURL({fileId: [url]})
var urls = await cloud.file.getTempFileURL({ fileId: [url] })
url = urls[0].url.replace('-internal', '');
tbMy.downloadFile({
url: url,
......@@ -146,10 +159,10 @@ export class Tools {
tbMy.getFileSystemManager().readFile({
filePath: i,
// encoding: "utf8",
success: function(r) {
success: function (r) {
},
fail: function(res) {
fail: function (res) {
}
})
......@@ -293,11 +306,11 @@ export class Tools {
showTime: number = 300
) {
Tween.get(target)
.set({alpha: 0, visible: true})
.to({alpha: 1}, showTime, Ease.quadIn)
.set({ alpha: 0, visible: true })
.to({ alpha: 1 }, showTime, Ease.quadIn)
.wait(time)
.to({alpha: 0}, showTime, Ease.quadOut)
.set({alpha: 0, visible: false})
.to({ alpha: 0 }, showTime, Ease.quadOut)
.set({ alpha: 0, visible: false })
.call(() => {
call();
});
......
......@@ -94,15 +94,6 @@ export class StartPanelPrize extends Panel {
isGiftPrizeLevel: res.data.isGiftPrizeLevel
});
this.hidePanel();
// 如果有邀请人就去助力
if (Tools.globalData.inviteId) {
sendTbNet(TbNetName.doHelp, { inviteId: Tools.globalData.inviteId },
(success, res) => {
if(success)Tools.globalData.inviteId = null;
}, true
);
}
}
);
}
......
......@@ -6,7 +6,7 @@ import Ease = FYGE.Ease;
import Button = FYGE.Button;
import { GDispatcher } from "../Main";
import { G_EVENT } from "../common/G_EVENT";
import { showWaiting, hideWaiting, showToast } from "../../module/ctrls";
import { showWaiting, hideWaiting, showToast, getCurrentScene } from "../../module/ctrls";
import Container = FYGE.Container;
import { Item } from "../../module/views/Item";
import { Tools } from "../Tools";
......@@ -16,13 +16,13 @@ import TextField = FYGE.TextField;
import { RES } from "../../module/RES";
import MouseEvent = FYGE.MouseEvent;
// 任务类型(invites 、member、follow、browserGoods、orderGoods)
// 任务类型(invites 、member、follow、browseGoods、orderGoods)
export enum TaskType {
member = "member",
follow = "follow",
invites = "invites",
orderGoods = "orderGoods",
browserGoods = "browserGoods",
browseGoods = "browseGoods",
}
interface TaskData {
......@@ -73,8 +73,8 @@ const taskItemData = {
title: '完成下单',
desc: '按成下单即可获得${rewards}体力'
},
[TaskType.browserGoods]: {
key: TaskType.browserGoods,
[TaskType.browseGoods]: {
key: TaskType.browseGoods,
title: '每日浏览商品(${done}/${total})',
desc: '浏览指定商品即可获得${rewards}体力'
},
......@@ -125,18 +125,17 @@ export class TaskPanel extends Panel {
if (!success) return;
console.log(res);
for (let i = res.data.taskList.length - 1; i >= 0; i--) {
const v = res.data.taskList[i];
for (let i = res.data.length - 1; i >= 0; i--) {
const v = res.data[i];
if ((v.taskType == TaskType.member || v.taskType == TaskType.follow)
&& v.todayCompleteTimes >= v.totalTimes
&& v.waitReceiveTimes <= 0) {
res.data.taskList.splice(i, 1);
&& v.status == 3) {
res.data.splice(i, 1);
}
}
console.log(res.data.taskList);
console.log(res.data);
// this.scroll.view.children.length = 0;
this.scroll.updateData(res.data.taskList, true);
this.scroll.updateData(res.data, true);
}
);
......@@ -210,15 +209,17 @@ class TaskItem extends Item {
const {
rewards,
taskType,
totalTimes,
waitReceiveTimes,
completeTimes,
waitReceive,
todayCompleteTimes,
times,
status,
} = data;
this.icon.texture = RES.getRes(`${taskType}_icon.png`);
this.title.text = taskItemData[taskType].title
.replace('${done}', todayCompleteTimes)
.replace('${total}', totalTimes);
.replace('${total}', times);
this.desc.text = taskItemData[taskType].desc
.replace('${rewards}', rewards);
......@@ -228,14 +229,14 @@ class TaskItem extends Item {
RES.getRes(`${taskType}_btn_dis.png`)
);
if (+waitReceiveTimes > 0) {
if (+status == 2) {
this.getBtn.visible = true;
this.taskBtn.visible = false;
} else if (+todayCompleteTimes >= +totalTimes) {
} else if (+status == 3) {
this.getBtn.visible = false;
this.taskBtn.visible = true;
this.taskBtn.enabled = false;
} else {
} else if (+status == 1) {
this.getBtn.visible = false;
this.taskBtn.visible = true;
this.taskBtn.enabled = true;
......@@ -250,6 +251,8 @@ class TaskItem extends Item {
this.getBtn.mouseEnable = true;
if (!success) return;
showToast(`任务完成,体力值+${res.data.power}!`);
Tools.propInfo.power += res.data.power;
getCurrentScene().updateScene();
GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK);
}
);
......@@ -258,9 +261,9 @@ class TaskItem extends Item {
private clickTask() {
switch (this.data.taskType) {
case TaskType.member:
sendTbNet(TbNetName.navigateToOutside, { url: this.data.beMemberUrl });
sendTbNet(TbNetName.navigateToOutside, { url: this.data.url });
break;
case TaskType.browserGoods:
case TaskType.browseGoods:
/// TODO 去浏览页
console.log('去浏览页');
break;
......@@ -268,7 +271,7 @@ class TaskItem extends Item {
sendTbNet(TbNetName.favorShop, {},
(fs, fr) => {
if (!fs) return;
sendTbNet(TbNetName.completeTask, { taskType: this.data.taskType },
sendTbNet(TbNetName.doFollowTask, { taskType: this.data.taskType },
(cs, cr) => GDispatcher.dispatchEvent(G_EVENT.UPDATE_TASK)
);
}
......
......@@ -323,10 +323,10 @@ export class PlayScene extends Scene {
} else {
this.enableMouseEvt(true);
//首次送道具,的动画先出,然后再出引导
if (this.chapter == 1 && Tools.baseInfo.isFristLogin) {
if (this.chapter == 1 && Tools.baseInfo.isFirstLogin) {
this.addChild(new FirstPropGift())
.once(FYGE.MouseEvent.CLICK, (e: FYGE.MouseEvent) => {
Tools.baseInfo.isFristLogin = false;
Tools.baseInfo.isFirstLogin = false;
//移除自己
this.removeChild(e.target)
//游戏引导
......
......@@ -13,8 +13,9 @@ import Sprite = FYGE.Sprite;
import Texture = FYGE.Texture;
import Tween = FYGE.Tween;
import Ease = FYGE.Ease;
import { showPanel } from "../../../module/ctrls";
import { showPanel, showToast } from "../../../module/ctrls";
import { FreePowerPanel } from "../../panels/FreePowerPanel";
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
export class MapScene extends Scene {
private mapContainer: Container = null;
......@@ -48,7 +49,7 @@ export class MapScene extends Scene {
this.initMap();
this.updateMapCheck();
if (Tools.baseInfo.loginAddPower && !Tools.baseInfo.isFristLogin) {
if (Tools.baseInfo.loginAddPower && !Tools.baseInfo.isFirstLogin) {
showPanel(FreePowerPanel);
Tools.baseInfo.loginAddPower = false;
}
......@@ -59,7 +60,7 @@ export class MapScene extends Scene {
if (this.data && this.data.from == 'loading') {
this.uiLayer = this.addChild(new MapUI());
this.initMapByData();
if (Tools.baseInfo.isFristLogin) {
if (Tools.baseInfo.isFirstLogin) {
this.initGuide();
}
} else {
......@@ -74,7 +75,7 @@ export class MapScene extends Scene {
private initGuide() {
//有bug再说
// Tools.gameData.isFristLogin = false;
// Tools.gameData.isFirstLogin = false;
const guide = this.addChild(new Container());
guide.y = -layers.stageOffsetY;
......@@ -238,6 +239,16 @@ export class MapScene extends Scene {
// image: 'https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png',
// }
// });
// 如果有邀请人就去助力
if (Tools.globalData.inviteId) {
sendTbNet(TbNetName.doHelp, { inviteId: Tools.globalData.inviteId },
(success, res) => {
if(success)showToast('助力成功');
// if (success) Tools.globalData.inviteId = null;
}
);
}
}
public initEvents() {
......
......@@ -48,7 +48,7 @@ export default class MapUI extends Container {
console.log('我的奖品');
sendTbNet(
TbNetName.navigateTo,
{url: '/pages/myPrize/myPrize'},
{ url: '/pages/myprize/myprize'},
() => {
},
true
......
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