活动:弹出商店添加条件判断

This commit is contained in:
qiaoxin
2021-05-31 20:39:05 +08:00
parent b4b1c9321a
commit 9cb06b4736
9 changed files with 145 additions and 42 deletions

View File

@@ -1,7 +1,9 @@
import { ActivityPopUpShopModelType } from "../../db/ActivityPopUpShop";
// 弹框商店
export class PopUpShopData {
activityId: number; // 活动id
id: number; // 第几个从1开始
name: string; //名字
consume: string; //消耗资源(这里优先rmb的price价格其次资源消耗)
@@ -13,18 +15,22 @@ export class PopUpShopData {
taskType: number; // 任务类型
taskParam: number; // 任务参数
condition: number; // 任务条件
isBuy: boolean = false; //购买过
totalCount: number; //一共完成次数
// //解析玩家购买记录
// public setPlayerRecords(data: ActivityPopUpShopModelType) {
// if (!data) {
// return;
// }
// for (let item of this.list) {
// let buyRecords = data.records.filter(obj => { return obj && obj.id === item.id });
// item.buyCount = buyRecords.length;
// }
// }
isBuy: boolean = false; //购买过
beginTime: Date = null;//开始时间
endTime: Date = null;//结束时间
//解析玩家购买记录
public setPlayerRecords(data: ActivityPopUpShopModelType) {
if (!data) {
return;
}
this.isBuy = data.isBuy ? data.isBuy : false;
this.beginTime = data.beginTime;
this.endTime = data.endTime;
this.totalCount = data.totalCount;
}
public initData(data: any) {
@@ -40,9 +46,13 @@ export class PopUpShopData {
this.taskParam = data.taskParam;
this.condition = data.condition;
this.isBuy = false;
this.beginTime = null;
this.endTime = null;
this.totalCount = 0;
}
constructor(activityData: any) {
constructor(activityData: any, activityId: number) {
this.activityId = activityId;
this.initData(activityData)
}
}