Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
Project
Project
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
lihuizhen
ec-report-refactor
Commits
c34d1b2d
Commit
c34d1b2d
authored
May 10, 2022
by
lxm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:日期选择器
parent
d1ed8df0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
2 deletions
+66
-2
.gitignore
.gitignore
+2
-1
DatePicker.vue
components/DatePicker/DatePicker.vue
+44
-0
index.vue
pages/index/index.vue
+20
-1
No files found.
.gitignore
View file @
c34d1b2d
unpackage
unpackage/dist
\ No newline at end of file
unpackage/dist
uni_modules
\ No newline at end of file
components/DatePicker/DatePicker.vue
0 → 100644
View file @
c34d1b2d
<
template
>
<view
class=
"timer"
>
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<uni-datetime-picker
:type=
"elementInfo.option.dateTime.showTime ? 'datetime' : 'date'"
v-model=
"elementInfo.option.dateTime.date"
/>
</view>
</
template
>
<
script
>
export
default
{
name
:
"DatePicker"
,
props
:
{
elementInfo
:
{
type
:
Object
,
required
:
true
}
},
data
()
{
return
{
};
},
onReady
()
{
},
onUnLoad
()
{
},
methods
:
{
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.timer
{
display
:
flex
;
flex-flow
:
column
;
justify-content
:
center
;
width
:
100%
;
color
:
#fff
;
}
</
style
>
pages/index/index.vue
View file @
c34d1b2d
...
...
@@ -14,6 +14,7 @@
zIndex: `${element.type == 'NormalTabs' ? 999999 : index + 1}`
}"
>
<DatePicker
v-if=
"element.type == 'DateTimePicker'"
:elementInfo=
"element"
></DatePicker>
<!-- 普通柱状图 -->
<NormalBar
v-if=
"element.type == 'NormalBar'"
:elementInfo=
"element"
></NormalBar>
<!-- 普通折线图 -->
...
...
@@ -139,6 +140,19 @@
clearInterval
(
this
.
timename
)
},
methods
:
{
// 日期时间格式化
dateTimeFormat
(
val
){
let
date
=
new
Date
(
val
)
let
year
=
date
.
getFullYear
()
// 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
let
month
=
date
.
getMonth
()
+
1
<
10
?
"0"
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
;
let
day
=
date
.
getDate
()
<
10
?
"0"
+
date
.
getDate
()
:
date
.
getDate
();
let
hours
=
date
.
getHours
()
<
10
?
"0"
+
date
.
getHours
()
:
date
.
getHours
();
let
minutes
=
date
.
getMinutes
()
<
10
?
"0"
+
date
.
getMinutes
()
:
date
.
getMinutes
();
let
seconds
=
date
.
getSeconds
()
<
10
?
"0"
+
date
.
getSeconds
()
:
date
.
getSeconds
();
// 拼接
return
year
+
"-"
+
month
+
"-"
+
day
+
" "
+
hours
+
":"
+
minutes
+
":"
+
seconds
;
},
//检查是否登录
userAuthCheck
()
{
var
userId
=
uni
.
getStorageSync
(
'userId'
)
...
...
@@ -176,7 +190,7 @@
async
getReportCharts
()
{
clearInterval
(
this
.
timename
)
const
that
=
this
let
res
=
await
that
.
$u
.
api
.
getReportCharts
({
id
:
'6
1cd2ba1c06bffbdae442c4f
'
})
let
res
=
await
that
.
$u
.
api
.
getReportCharts
({
id
:
'6
274e2f24606335014054b2c
'
})
uni
.
stopPullDownRefresh
()
const
{
Status
,
Result
:
{
info
,
list
}
}
=
res
.
data
if
(
Status
===
'true'
)
{
...
...
@@ -188,6 +202,11 @@
},
parseInt
(
info
.
dataPollingInterval
)
*
1000
)
}
}
res
.
data
.
Result
.
list
.
forEach
(
item
=>
{
if
(
item
.
type
===
'DateTimePicker'
)
{
item
.
option
.
dateTime
.
date
=
this
.
dateTimeFormat
(
item
.
option
.
dateTime
.
date
)
}
})
that
.
reportInfo
=
res
.
data
.
Result
}
},
...
...
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