Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
japan3-square
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanse
japan3-square
Commits
9571389a
Commit
9571389a
authored
Jun 30, 2025
by
GiottoMaster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
978199b8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
39 deletions
+49
-39
common.ts
src/common/common.ts
+25
-16
message.vue
src/subPackages/message/message.vue
+24
-23
No files found.
src/common/common.ts
View file @
9571389a
...
@@ -37,24 +37,33 @@ export const timestempToDate = (timestamp: number, n: string = '-') => {
...
@@ -37,24 +37,33 @@ export const timestempToDate = (timestamp: number, n: string = '-') => {
return
`
${
year
}${
n
}${
month
}${
n
}${
day
}
${
hour
}
:
${
minute
}
`
return
`
${
year
}${
n
}${
month
}${
n
}${
day
}
${
hour
}
:
${
minute
}
`
}
}
export
function
timestampToDate2
(
timestamp
:
number
)
{
export
function
timestampToDate2
(
input
:
number
|
string
):
string
{
const
date
=
new
Date
(
timestamp
+
3600000
*
9
)
let
date
:
Date
const
year
=
date
.
getUTCFullYear
()
// 获取年份
let
month
=
date
.
getUTCMonth
()
+
1
// 获取月份,需要+1因为月份从0开始
if
(
typeof
input
===
'number'
)
{
let
day
=
date
.
getUTCDate
()
// 获取日
// 判断是否为秒级时间戳(小于13位)
let
hours
=
date
.
getUTCHours
()
// 获取小时
if
(
input
.
toString
().
length
<=
10
)
{
let
minutes
=
date
.
getUTCMinutes
()
// 获取分钟
input
=
input
*
1000
let
seconds
=
date
.
getUTCSeconds
()
// 获取秒钟
}
date
=
new
Date
(
input
+
3600000
*
9
)
// 加 9 小时
}
else
if
(
typeof
input
===
'string'
)
{
const
parsed
=
new
Date
(
input
)
if
(
isNaN
(
parsed
.
getTime
()))
{
return
'Invalid Date'
}
date
=
new
Date
(
parsed
.
getTime
()
+
3600000
*
9
)
}
else
{
return
'Invalid Input'
}
// 格式化月份、日期、小时、分钟和秒
const
year
=
date
.
getUTCFullYear
()
month
=
month
<
10
?
'0'
+
month
:
month
const
month
=
String
(
date
.
getUTCMonth
()
+
1
).
padStart
(
2
,
'0'
)
day
=
day
<
10
?
'0'
+
day
:
day
const
day
=
String
(
date
.
getUTCDate
()).
padStart
(
2
,
'0'
)
hours
=
hours
<
10
?
'0'
+
hours
:
hours
const
hours
=
String
(
date
.
getUTCHours
()).
padStart
(
2
,
'0'
)
minutes
=
minutes
<
10
?
'0'
+
minutes
:
minutes
const
minutes
=
String
(
date
.
getUTCMinutes
()).
padStart
(
2
,
'0'
)
seconds
=
seconds
<
10
?
'0'
+
seconds
:
seconds
const
seconds
=
String
(
date
.
getUTCSeconds
()).
padStart
(
2
,
'0'
)
// 组合成日期时间字符串
return
`
${
year
}
-
${
month
}
-
${
day
}
${
hours
}
:
${
minutes
}
:
${
seconds
}
`
return
year
+
'-'
+
month
+
'-'
+
day
+
' '
+
hours
+
':'
+
minutes
+
':'
+
seconds
}
}
// 获取股票颜色
// 获取股票颜色
...
...
src/subPackages/message/message.vue
View file @
9571389a
...
@@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n'
...
@@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n'
import
{
ref
}
from
'vue'
import
{
ref
}
from
'vue'
import
{
getUserMessageApi
,
getUserMessageDetailApi
}
from
'@/api/message'
import
{
getUserMessageApi
,
getUserMessageDetailApi
}
from
'@/api/message'
import
{
onShow
}
from
'@dcloudio/uni-app'
import
{
onShow
}
from
'@dcloudio/uni-app'
import
{
timestampToDate2
}
from
'@/common/common'
const
{
t
}
=
useI18n
()
const
{
t
}
=
useI18n
()
const
UserMessageList
=
ref
([])
const
UserMessageList
=
ref
([])
...
@@ -21,35 +22,35 @@ const getUserMessageDetail = async () => {
...
@@ -21,35 +22,35 @@ const getUserMessageDetail = async () => {
await
getUserMessageDetailApi
()
await
getUserMessageDetailApi
()
}
}
const
getData
=
(
dataString
:
any
)
=>
{
//
const getData = (dataString: any) => {
const
time
=
new
Date
(
dataString
*
1000
)
//
const time = new Date(dataString * 1000)
const
year
=
time
.
getFullYear
()
//
const year = time.getFullYear()
const
month
=
time
.
getMonth
()
+
1
//
const month = time.getMonth() + 1
const
day
=
time
.
getDate
()
//
const day = time.getDate()
const
hour
=
time
.
getHours
()
//
const hour = time.getHours()
const
minute
=
time
.
getMinutes
()
//
const minute = time.getMinutes()
const
second
=
time
.
getSeconds
()
//
const second = time.getSeconds()
return
(
//
return (
year
+
//
year +
'-'
+
//
'-' +
(
month
<
10
?
'0'
+
month
:
month
)
+
//
(month
<
10
?
'0'
+
month
:
month
)
+
'-'
+
//
'-' +
(
day
<
10
?
'0'
+
day
:
day
)
+
//
(day
<
10
?
'0'
+
day
:
day
)
+
' '
+
//
' ' +
(
hour
<
10
?
'0'
+
hour
:
hour
)
+
//
(hour
<
10
?
'0'
+
hour
:
hour
)
+
':'
+
//
':' +
(
minute
<
10
?
'0'
+
minute
:
minute
)
+
//
(minute
<
10
?
'0'
+
minute
:
minute
)
+
':'
+
//
':' +
(
second
<
10
?
'0'
+
second
:
second
)
//
(second
<
10
?
'0'
+
second
:
second
)
)
//
)
}
//
}
</
script
>
</
script
>
<
template
>
<
template
>
<Navigater
:title=
"t('message.xiaoxi')"
/>
<Navigater
:title=
"t('message.xiaoxi')"
/>
<view>
<view>
<scroll-view
scroll-y
:style=
"
{ height: 'calc(100vh - 48px)' }">
<scroll-view
scroll-y
:style=
"
{ height: 'calc(100vh - 48px)' }">
<view
v-for=
"(item, index) in UserMessageList"
:key=
"index"
>
<view
v-for=
"(item, index) in UserMessageList"
:key=
"index"
>
<view
class=
"createtime"
>
{{
getData
(
item
.
createtime
)
}}
</view>
<view
class=
"createtime"
>
{{
timestampToDate2
(
item
.
createtime
)
}}
</view>
<view
class=
"content"
>
{{
item
.
content
}}
</view>
<view
class=
"content"
>
{{
item
.
content
}}
</view>
</view>
</view>
<NotData
v-if=
"UserMessageList.length === 0"
/>
<NotData
v-if=
"UserMessageList.length === 0"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment