From 793c3ce7dc524a578d613cb1673c4326069abc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=9E=E5=85=B4=E6=9C=88?= <120277894@qq.com> Date: Tue, 6 Apr 2021 18:12:12 +0800 Subject: [PATCH] =?UTF-8?q?feature/GFRS-2301=E3=80=90=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E3=80=91=E5=81=A5=E5=BA=B7=E9=99=A9=E6=B8=A0=E9=81=93=E5=9B=BD?= =?UTF-8?q?=E5=AF=8C=E6=97=A0=E5=BF=A7=E5=8D=A1=E9=87=91=E6=8E=8C=E6=A1=82?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=9A=84=E9=9C=80=E6=B1=82--=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=9C=89=E6=95=88=E6=97=B6=E9=97=B4--=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=BA=BA=E5=BA=9E=E5=85=B4=E6=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/cardList/information.vue | 33 +++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/views/ebiz/cardList/information.vue b/src/views/ebiz/cardList/information.vue index 6206291f2..8c7244b38 100644 --- a/src/views/ebiz/cardList/information.vue +++ b/src/views/ebiz/cardList/information.vue @@ -722,25 +722,38 @@ export default { let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日' let insuYear = JSON.parse(localStorage.insuYear) let insuYearM, productDate, productDateTime - let insuYearD,hoDate + let insuYearD, hoDate switch (insuYear.insuYearFlag) { case 'D': - hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 + hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 break - case 'Y': - var y = new Date().getFullYear(),isLeap = (0 === y % 4 && 0 === y % 100) || 0 === y % 400,days = isLeap ? 366 : 365; - hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (days - 1) + case 'Y': + hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * 364 break } - productDate = new Date(parseInt(hoDate) * 1000) - insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 - insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() - productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' - this.productDate = currentData + '0时至' + productDateTime + '24时止' + productDate = new Date(parseInt(hoDate) * 1000) + insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 + insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() + productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' + this.productDate = currentData + '0时至' + productDateTime + '24时止' } break } }, + isLeapYear(year) { + var cond1 = year % 4 == 0 //条件1:年份必须要能被4整除 + var cond2 = year % 100 != 0 //条件2:年份不能是整百数 + var cond3 = year % 400 == 0 //条件3:年份是400的倍数 + //当条件1和条件2同时成立时,就肯定是闰年,所以条件1和条件2之间为“与”的关系。 + //如果条件1和条件2不能同时成立,但如果条件3能成立,则仍然是闰年。所以条件3与前2项为“或”的关系。 + //所以得出判断闰年的表达式: + var cond = (cond1 && cond2) || cond3 + if (cond) { + return 366 + } else { + return 365 + } + }, GetNextMonthDay(date, monthNum) { var dateArr = date.split('-') var year = dateArr[0] //获取当前日期的年份