Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0f0378d6
authored
Oct 31, 2022
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
访问时间公用方法bug修改
1 parent
f1b6aa6e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
utils/format.js
utils/format.js
View file @
0f0378d
...
@@ -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
/
yearTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
yearTime
)
+
'年前'
}
else
if
(
parseInt
(
timeDifference
/
monthTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
monthTime
)
+
'月前'
}
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
)
{
result
=
parseInt
(
timeDifference
/
hourTime
)
+
'小时前'
}
else
if
(
parseInt
(
timeDifference
/
minTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
minTime
)
+
'分钟前'
if
(
parseInt
(
timeDifference
/
minTime
)
<=
5
)
{
if
(
parseInt
(
timeDifference
/
minTime
)
<=
5
)
{
//五分钟内就是刚刚
//五分钟内就是刚刚
result
=
'刚刚'
result
=
'刚刚'
}
}
else
if
(
parseInt
(
timeDifference
/
minTime
)
>
5
)
{
result
=
parseInt
(
timeDifference
/
minTime
)
+
'分钟前'
}
else
if
(
parseInt
(
timeDifference
/
hourTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
hourTime
)
+
'小时前'
}
else
if
(
parseInt
(
timeDifference
/
dayTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
dayTime
)
+
'天前'
}
else
if
(
parseInt
(
timeDifference
/
weektTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
weektTime
)
+
'周前'
}
else
if
(
parseInt
(
timeDifference
/
monthTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
monthTime
)
+
'月前'
}
else
if
(
parseInt
(
timeDifference
/
yearTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
yearTime
)
+
'年前'
}
}
return
result
return
result
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment