活动:签到活动添加开启关闭配置

This commit is contained in:
qiaoxin
2021-05-31 14:49:28 +08:00
parent 45126d296f
commit 758587ef29
3 changed files with 31 additions and 34 deletions

View File

@@ -32,6 +32,8 @@ export class SignInData extends ActivityBase {
productID: string = '';//商品ID
consume: string = ''//补签消耗
isVip: boolean = false;//是否购买了当前的vip活动
startDate: number = 1;//月卡开启
endDate: number = 30;//月卡关闭
//第几天的签到奖励
public findDayItem(dayIndex: number) {
@@ -56,16 +58,19 @@ export class SignInData extends ActivityBase {
}
public initData(data: string) {
let date = new Date();
this.beginTime = moment(date.setDate(SIGNIN_OPEN)).startOf('day').valueOf();
this.endTime = moment(date.setDate(SIGNIN_CLOSE)).endOf('day').valueOf();
let dataObj = JSON.parse(data);
this.startDate = dataObj.startDate ? dataObj.startDate : SIGNIN_OPEN;
this.endDate = dataObj.endDate ? dataObj.endDate : SIGNIN_CLOSE;
let date = new Date();
this.beginTime = moment(date.setDate(this.startDate)).startOf('day').valueOf();
this.endTime = moment(date.setDate(this.endDate)).endOf('day').valueOf();
this.price = dataObj.price;
this.productID = dataObj.productID;
this.consume = dataObj.consume;
this.roundIndex = moment().diff(moment(this.beginTime).startOf('months'), 'months') + 1;
this.todayIndex = moment(Date.now()).date() - SIGNIN_OPEN + 1;
this.todayIndex = moment(Date.now()).date() - this.startDate + 1;
let arr = dataObj.data
for (let obj of arr) {