Commit d50014c0 authored by linwenqing's avatar linwenqing

fix:我的题库,题库到期时间错误

parent 4c48c94c
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
case 5: case 5:
status = '已绑定' status = '已绑定'
data[i].statusStyle = { color: '#2953FF' } data[i].statusStyle = { color: '#2953FF' }
data[i].subtitle = '请前往首页答题联系吧' data[i].subtitle = '请前往首页答题练习吧'
break break
case 10: case 10:
status = '已激活' status = '已激活'
...@@ -95,7 +95,10 @@ export default { ...@@ -95,7 +95,10 @@ export default {
res[i].echoMap.cardId && res[i].echoMap.cardId &&
res[i].echoMap.cardId.activationTime res[i].echoMap.cardId.activationTime
) { ) {
let diff = this.datedifference(sDate1, sDate2) let diff = this.datedifference(
res[i].echoMap.cardId.activationTime.split(' ')[0],
this.getTodayDate()
)
leaveDay = res[i].echoMap.cardId.effectiveDay - diff leaveDay = res[i].echoMap.cardId.effectiveDay - diff
leaveDay = leaveDay > 0 ? leaveDay : 0 leaveDay = leaveDay > 0 ? leaveDay : 0
} }
...@@ -118,6 +121,19 @@ export default { ...@@ -118,6 +121,19 @@ export default {
} }
}) })
}, },
getTodayDate() {
let day = new Date()
day.setTime(day.getTime())
let m = day.getMonth() + 1
let d = day.getDate()
return (
day.getFullYear() +
'-' +
(String(m).length < 2 ? '0' + m : m) +
'-' +
(String(d).length < 2 ? '0' + d : d)
)
},
datedifference(sDate1, sDate2) { datedifference(sDate1, sDate2) {
//2021-01-01,2020-02-01,31 //2021-01-01,2020-02-01,31
var dateSpan, tempDate, iDays var dateSpan, tempDate, iDays
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment