Commit 0009e911 authored by haiyoucuv's avatar haiyoucuv

1

parent 6e4e6a56
This diff is collapsed.
{
"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
This diff is collapsed.
This diff is collapsed.
......@@ -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