Commit 0f0378d6 by zhangxw

访问时间公用方法bug修改

1 parent f1b6aa6e
...@@ -55,23 +55,21 @@ export function commentTime(dateTimeStamp) { ...@@ -55,23 +55,21 @@ export function commentTime(dateTimeStamp) {
let weektTime = dayTime * 7 let weektTime = dayTime * 7
let monthTime = dayTime * 30 let monthTime = dayTime * 30
let yearTime = dayTime * 365 let yearTime = dayTime * 365
if (parseInt(timeDifference / minTime) <= 5) {
if (parseInt(timeDifference / yearTime) >= 1) { //五分钟内就是刚刚
result = parseInt(timeDifference / yearTime) + '年前' result = '刚刚'
} else if (parseInt(timeDifference / monthTime) >= 1) { } else if (parseInt(timeDifference / minTime) > 5) {
result = parseInt(timeDifference / monthTime) + '月前' result = parseInt(timeDifference / minTime) + '分钟前'
} else if (parseInt(timeDifference / weektTime) >= 1) {
result = parseInt(timeDifference / weektTime) + '周前'
} else if (parseInt(timeDifference / dayTime) >= 1) {
result = parseInt(timeDifference / dayTime) + '天前'
} else if (parseInt(timeDifference / hourTime) >= 1) { } else if (parseInt(timeDifference / hourTime) >= 1) {
result = parseInt(timeDifference / hourTime) + '小时前' result = parseInt(timeDifference / hourTime) + '小时前'
} else if (parseInt(timeDifference / minTime) >= 1) { } else if (parseInt(timeDifference / dayTime) >= 1) {
result = parseInt(timeDifference / minTime) + '分钟前' result = parseInt(timeDifference / dayTime) + '天前'
if (parseInt(timeDifference / minTime) <= 5) { } else if (parseInt(timeDifference / weektTime) >= 1) {
//五分钟内就是刚刚 result = parseInt(timeDifference / weektTime) + '周前'
result = '刚刚' } else if (parseInt(timeDifference / monthTime) >= 1) {
} result = parseInt(timeDifference / monthTime) + '月前'
} else if (parseInt(timeDifference / yearTime) >= 1) {
result = parseInt(timeDifference / yearTime) + '年前'
} }
return result return result
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!