活动:添加切换显示

This commit is contained in:
luying
2022-04-14 11:46:46 +08:00
parent 4cb5db0de6
commit e9c8b3db7e
4 changed files with 37 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ export abstract class ActivityBase {
todayIndex: number = 0;//从1开始
delayDay: number = 0;//延迟多少天开启0表示按照原计划开启
hideDayByServer: number = 0;
isEnable: boolean = false;
roundIndex: number = 0;//周期活动第几个周期从1开始
nextRefreshTime: number = 0;//周期活动下次刷新时间
@@ -27,7 +28,7 @@ export abstract class ActivityBase {
public canShow() {
console.log('#### canShow', this.beginTime <= Date.now(), this.endTime >= Date.now())
return this.beginTime <= Date.now() && this.endTime >= Date.now()
return this.isEnable && this.beginTime <= Date.now() && this.endTime >= Date.now()
}
/**
@@ -58,6 +59,7 @@ export abstract class ActivityBase {
this.roundIndex = 1;
this.nextRefreshTime = this.endTime;
this.name = activityData.name;
this.isEnable = activityData.isEnable;
this.type = activityData.type;
console.log('今天是活动第几天', activityData.beginTime, new Date, this.todayIndex)
@@ -125,6 +127,7 @@ export class ActivityInRemote {
delayDay: number; // 迟几天开启活动0表示按照规定时间开启
interval: number; // 周期性活动时间间隔,秒
hideDayByServer: number;
isEnable: boolean;
name: string;
constructor(activity?: ActivityModelType) {
@@ -139,6 +142,7 @@ export class ActivityInRemote {
this.delayDay = activity.delayDay;
this.interval = activity.interval;
this.hideDayByServer = activity.hideDayByServer;
this.isEnable = activity.isEnable;
this.name = activity.name;
}
}