big-white-calendar
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -0,1 +1,3 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
@@ -14,3 +16,4 @@ | ||
text: '', | ||
toTime: '' | ||
toTime: '', | ||
items: [] | ||
}, | ||
@@ -30,3 +33,3 @@ didMount: function didMount() { | ||
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { | ||
var currentTime, _this$getWeekStartAnd, start, end, startDate, openBool; | ||
var dataArr, currentTime, items, _this$getWeekStartAnd, start, end, text, toTime, startDate, openBool; | ||
@@ -37,18 +40,63 @@ return regeneratorRuntime.wrap(function _callee$(_context) { | ||
case 0: | ||
dataArr = _this.props.dataArr; | ||
_context.t0 = time; | ||
if (_context.t0) { | ||
_context.next = 5; | ||
_context.next = 6; | ||
break; | ||
} | ||
_context.next = 4; | ||
_context.next = 5; | ||
return getServerTime(); | ||
case 4: | ||
case 5: | ||
_context.t0 = _context.sent; | ||
case 5: | ||
case 6: | ||
currentTime = _context.t0; | ||
items = dataArr.map(function (item) { | ||
var coupon_statue_text = '待开启'; | ||
var statue = item.statue; | ||
switch (statue) { | ||
case '1001': | ||
coupon_statue_text = '去使用'; | ||
break; | ||
case '1002': | ||
coupon_statue_text = '已使用'; | ||
break; | ||
case '1003': | ||
coupon_statue_text = '已过期'; | ||
break; | ||
default: | ||
{ | ||
var s = new Date(dateToCorrectFormat(item.issue_start_time)).getTime(); | ||
var e = new Date(dateToCorrectFormat(item.issue_end_time)).getTime(); | ||
if (currentTime > e) { | ||
coupon_statue_text = '已过期'; | ||
statue = '1003'; | ||
} else if (currentTime >= s && currentTime <= e) { | ||
coupon_statue_text = '待领取'; | ||
statue = '1004'; | ||
} else { | ||
coupon_statue_text = '待开启'; | ||
statue = '1005'; | ||
} | ||
break; | ||
} | ||
} | ||
return _extends({}, item, { | ||
statue: statue, | ||
coupon_statue_text: coupon_statue_text | ||
}); | ||
}); | ||
_this$getWeekStartAnd = _this.getWeekStartAndEnd(currentTime), start = _this$getWeekStartAnd.start, end = _this$getWeekStartAnd.end; | ||
text = '本周活动结束,请下周一再来'; | ||
toTime = ''; | ||
@@ -58,17 +106,14 @@ if (start) { | ||
openBool = currentTime < startDate.getTime(); | ||
_this.setData({ | ||
text: openBool ? '距开始' : '距结束', | ||
toTime: openBool ? start : end, | ||
currentTime: currentTime | ||
}); | ||
} else { | ||
_this.setData({ | ||
text: '本周活动结束,请下周一再来', | ||
currentTime: currentTime, | ||
toTime: '' | ||
}); | ||
text = openBool ? '距开始' : '距结束'; | ||
toTime = openBool ? start : end; | ||
} | ||
case 8: | ||
_this.setData({ | ||
text: text, | ||
currentTime: currentTime, | ||
toTime: toTime, | ||
items: items | ||
}); | ||
case 13: | ||
case "end": | ||
@@ -89,2 +134,3 @@ return _context.stop(); | ||
}); | ||
console.log(currentWeek); | ||
return { | ||
@@ -91,0 +137,0 @@ start: currentWeek ? dateToCorrectFormat(currentWeek.issue_start_time) : '', |
{ | ||
"name": "big-white-calendar", | ||
"description": "big-white-calendar", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40147
517