Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BCDH-APP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
首开风险隐患双控平台
BCDH-APP
Commits
5cf8525e
Commit
5cf8525e
authored
Nov 10, 2021
by
13841799530
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
封装时间戳
解润东 20211110
parent
fe551eb6
Pipeline
#7075
passed with stage
in 10 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
1 deletion
+55
-1
src/api/util.js
src/api/util.js
+52
-0
src/main.js
src/main.js
+2
-0
src/views/notice/noticeList/index.vue
src/views/notice/noticeList/index.vue
+1
-1
No files found.
src/api/util.js
0 → 100644
View file @
5cf8525e
export
default
{
//转换日期格式
//time : 要转换的时间
//type : DT1 转换为 2019-01-01 8:12:42格式
//type : DT2 转换为 2019-01-01格式
//type : DT3 转换为 2019/01/01 8:12:42格式
//type : DT4 转换为 2019/01/01格式
//type : DT5 转换为 时间戳格式
//type : DT6 转换为 2019年01月01日 8时12分42秒
//type : DT7 转换为 2019年01月01日
//zero : 时分秒是否补零(2000-01-01 08:02:06)
//num : 要加的天数,正数为加,负数为减,不加不减就不用传
timestampToTime
(
time
,
type
,
zero
,
num
)
{
if
(
!
time
){
return
''
}
try
{
var
date
=
new
Date
(
time
)
if
(
num
&&
typeof
parseInt
(
num
)
==
"
number
"
){
date
=
new
Date
(
new
Date
(
time
).
getTime
()
+
num
*
60
*
60
*
24
*
1000
)
//时间戳以毫秒为单位,也可用其他日期格式
}
let
yy
=
date
.
getFullYear
();
//年
let
mm
=
date
.
getMonth
()
+
1
;
//月
let
dd
=
date
.
getDate
();
//日
let
hh
=
date
.
getHours
();
//小时
let
mf
=
date
.
getMinutes
()
<
10
?
'
0
'
+
date
.
getMinutes
()
:
date
.
getMinutes
();
//分钟
let
ss
=
date
.
getSeconds
()
<
10
?
'
0
'
+
date
.
getSeconds
()
:
date
.
getSeconds
();
//秒
if
(
zero
){
if
(
mm
<
10
){
mm
=
'
0
'
+
mm
}
if
(
dd
<
10
){
dd
=
'
0
'
+
dd
}
if
(
hh
<
10
){
hh
=
'
0
'
+
hh
}
}
if
(
type
==
"
DT1
"
){
return
yy
+
'
-
'
+
mm
+
'
-
'
+
dd
+
'
'
+
hh
+
'
:
'
+
mf
+
'
:
'
+
ss
;
//yyyy-mm-dd hh:mf:ss
}
else
if
(
type
==
"
DT2
"
){
return
yy
+
'
-
'
+
mm
+
'
-
'
+
dd
;
//yyyy-mm-dd
}
else
if
(
type
==
"
DT3
"
){
return
yy
+
'
/
'
+
mm
+
'
/
'
+
dd
+
'
'
+
hh
+
'
:
'
+
mf
+
'
:
'
+
ss
;
//yyyy/mm/dd hh:mf:ss
}
else
if
(
type
==
"
DT4
"
){
return
yy
+
'
-
'
+
mm
+
'
-
'
+
dd
;
//yyyy/mm/dd
}
else
if
(
type
==
"
DT5
"
){
return
date
.
getTime
();
//时间戳 秒数
}
else
if
(
type
==
"
DT6
"
){
return
yy
+
'
年
'
+
mm
+
'
月
'
+
dd
+
'
日
'
+
hh
+
'
时
'
+
mf
+
'
分
'
+
ss
+
'
秒
'
;
//yyyy年mm月dd日 hh时mf分ss秒
}
else
if
(
type
==
"
DT7
"
){
return
yy
+
'
年
'
+
mm
+
'
月
'
+
dd
+
'
日
'
;
//yyyy年mm月dd日
}
else
if
(
type
==
"
DT8
"
){
return
yy
+
'
-
'
+
mm
+
'
-
'
+
dd
+
'
'
+
'
00
'
+
'
:
'
+
'
00
'
+
'
:
'
+
'
00
'
;
//yyyy-mm-dd hh:mf:ss
}
}
catch
(
e
){
console
.
log
(
"
timestampToTime Error
"
);
return
""
}
},
}
\ No newline at end of file
src/main.js
View file @
5cf8525e
...
@@ -12,6 +12,7 @@ import md5 from 'js-md5';
...
@@ -12,6 +12,7 @@ import md5 from 'js-md5';
import
App
from
'
./App.vue
'
import
App
from
'
./App.vue
'
import
router
from
'
./router
'
import
router
from
'
./router
'
import
store
from
'
./store
'
import
store
from
'
./store
'
import
util
from
'
./api/util.js
'
import
'
./permission
'
import
'
./permission
'
import
Cookies
from
'
js-cookie
'
import
Cookies
from
'
js-cookie
'
import
{
prefix
}
from
'
@/common/js/utils
'
import
{
prefix
}
from
'
@/common/js/utils
'
...
@@ -20,6 +21,7 @@ Step, Steps } from 'vant'
...
@@ -20,6 +21,7 @@ Step, Steps } from 'vant'
import
'
lib-flexible/flexible
'
import
'
lib-flexible/flexible
'
import
vueEsign
from
'
vue-esign
'
import
vueEsign
from
'
vue-esign
'
Vue
.
use
(
vueEsign
)
Vue
.
use
(
vueEsign
)
Vue
.
prototype
.
util
=
util
Vue
.
use
(
Divider
).
use
(
Popup
).
use
(
Overlay
).
use
(
Loading
).
use
(
Dialog
).
use
(
Toast
).
use
(
ContactCard
).
use
(
Form
).
use
(
AddressEdit
).
use
(
AddressList
).
use
(
Field
).
use
(
CellGroup
).
use
(
Cell
).
use
(
SwipeCell
).
use
(
Icon
).
use
(
Stepper
).
use
(
Card
).
use
(
Button
).
use
(
Swipe
).
use
(
SwipeItem
).
use
(
PullRefresh
).
use
(
List
).
use
(
Tab
).
use
(
Tabs
).
use
(
GoodsAction
).
use
(
GoodsActionIcon
).
use
(
GoodsActionButton
).
use
(
SubmitBar
).
use
(
Checkbox
).
use
(
CheckboxGroup
).
use
(
Search
).
use
(
Picker
).
use
(
Uploader
).
use
(
Notify
)
Vue
.
use
(
Divider
).
use
(
Popup
).
use
(
Overlay
).
use
(
Loading
).
use
(
Dialog
).
use
(
Toast
).
use
(
ContactCard
).
use
(
Form
).
use
(
AddressEdit
).
use
(
AddressList
).
use
(
Field
).
use
(
CellGroup
).
use
(
Cell
).
use
(
SwipeCell
).
use
(
Icon
).
use
(
Stepper
).
use
(
Card
).
use
(
Button
).
use
(
Swipe
).
use
(
SwipeItem
).
use
(
PullRefresh
).
use
(
List
).
use
(
Tab
).
use
(
Tabs
).
use
(
GoodsAction
).
use
(
GoodsActionIcon
).
use
(
GoodsActionButton
).
use
(
SubmitBar
).
use
(
Checkbox
).
use
(
CheckboxGroup
).
use
(
Search
).
use
(
Picker
).
use
(
Uploader
).
use
(
Notify
)
.
use
(
ContactList
).
use
(
Calendar
).
use
(
Radio
).
use
(
RadioGroup
).
use
(
Tag
).
use
(
Tabbar
).
use
(
TabbarItem
).
use
(
Sticky
)
.
use
(
ContactList
).
use
(
Calendar
).
use
(
Radio
).
use
(
RadioGroup
).
use
(
Tag
).
use
(
Tabbar
).
use
(
TabbarItem
).
use
(
Sticky
)
.
use
(
Grid
).
use
(
GridItem
).
use
(
Skeleton
).
use
(
Col
).
use
(
Row
).
use
(
VanImage
).
use
(
Badge
).
use
(
NoticeBar
).
use
(
DatetimePicker
).
use
(
Step
).
use
(
Steps
)
.
use
(
Grid
).
use
(
GridItem
).
use
(
Skeleton
).
use
(
Col
).
use
(
Row
).
use
(
VanImage
).
use
(
Badge
).
use
(
NoticeBar
).
use
(
DatetimePicker
).
use
(
Step
).
use
(
Steps
)
...
...
src/views/notice/noticeList/index.vue
View file @
5cf8525e
...
@@ -293,7 +293,7 @@ export default {
...
@@ -293,7 +293,7 @@ export default {
},
},
/* 时间戳转换 */
/* 时间戳转换 */
onConfirm
(
date
)
{
onConfirm
(
date
)
{
this
.
value
=
`
${
date
.
getFullYear
()}
-
${
date
.
getMonth
()
+
1
}
-
${
date
.
getDate
()}
${
date
.
getHours
()
+
'
:00:00
'
}
`
;
this
.
value
=
this
.
util
.
timestampToTime
(
date
,
'
DT1
'
,
true
)
this
.
showCalendar
=
false
;
this
.
showCalendar
=
false
;
},
},
//日期输入框点击事件
//日期输入框点击事件
...
...
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