Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
pingan-life-index-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
69f9df43
authored
2020-02-21 21:08:41 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of 120.27.44.69:dev/pingan-life-index-pro
2 parents
578e5180
9b0ee30e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
112 deletions
src/components/date-picker/date-picker.js
src/components/home/dropdown/dropdown.js
src/components/date-picker/date-picker.js
View file @
69f9df4
...
...
@@ -105,7 +105,14 @@ export default {
// 公历假期,缺少复活节,缺少聖誕節後第一個周日
gl
:
[[
1
,
1
],
[
4
,
10
],
[
4
,
11
],
[
4
,
30
],
[
5
,
1
],
[
7
,
1
],
[
10
,
1
],
[
10
,
2
],
[
12
,
25
]],
// 农历假期,缺少清明节
nl
:
[[
1
,
1
],
[
1
,
2
],
[
1
,
3
],
[
5
,
5
],
[
8
,
15
],
[
9
,
9
]]
nl
:
[[
1
,
1
],
[
1
,
2
],
[
1
,
3
],
[
5
,
5
],
[
8
,
15
],
[
9
,
9
]],
// 清明节
qm
:
[
// 4月4号
[
"2020"
,
"2021"
,
"2024"
,
"2025"
,
"2028"
,
"2029"
,
"2032"
,
"2033"
,
"2036"
,
"2037"
],
// 4月5号
[
"2022"
,
"2023"
,
"2026"
,
"2027"
,
"2030"
,
"2031"
,
"2034"
,
"2035"
,
"2038"
,
"2039"
]
]
},
// 节假日,key是月份,value是日期列表
// holiday: {
...
...
@@ -115,66 +122,78 @@ export default {
},
components
:
{},
computed
:
{
holiday
(){
// 计算新历
let
result
=
{};
let
year
=
this
.
year
;
if
(
!
year
)
{
return
;
}
let
hkHolidayDefine
=
this
.
hkHolidayDefine
;
for
(
let
index
=
0
;
index
<
hkHolidayDefine
.
gl
.
length
;
index
++
)
{
let
m
=
hkHolidayDefine
.
gl
[
index
][
0
];
let
d
=
hkHolidayDefine
.
gl
[
index
][
1
];
holiday
()
{
// 计算新历
let
result
=
{};
let
year
=
this
.
year
;
if
(
!
year
)
{
return
;
}
let
hkHolidayDefine
=
this
.
hkHolidayDefine
;
// 如果是周六/周日,顺延到下周一
let
date
=
Date
.
parse
(
`
${
year
}
.
${
m
}
.
${
d
}
`
);
if
(
date
.
getDay
()
==
6
)
{
// 周六
date
.
addDays
(
2
);
}
else
if
(
date
.
getDay
()
==
0
)
{
date
.
addDays
(
1
);
}
m
=
date
.
getMonth
()
+
1
;
d
=
date
.
getDate
();
let
list
=
result
[
m
];
if
(
!
list
)
{
result
[
m
]
=
[];
list
=
result
[
m
];
}
list
.
push
(
d
);
// 加入清明节
if
(
hkHolidayDefine
.
qm
[
0
].
indexOf
(
year
+
""
)
>=
0
)
{
// 如果是周六/周日,顺延到下周一
let
vals
=
this
.
checkWeeken
(
4
,
4
);
let
m
=
vals
[
0
];
let
d
=
vals
[
1
];
result
[
m
]
=
[
d
];
}
else
if
(
hkHolidayDefine
.
qm
[
1
].
indexOf
(
year
+
""
)
>=
0
)
{
// 如果是周六/周日,顺延到下周一
let
vals
=
this
.
checkWeeken
(
4
,
5
);
let
m
=
vals
[
0
];
let
d
=
vals
[
1
];
result
[
m
]
=
[
d
];
}
else
{
let
mod
=
year
%
4
;
let
d
=
mod
==
0
||
mod
==
1
?
4
:
5
;
let
vals
=
this
.
checkWeeken
(
4
,
d
);
let
m
=
vals
[
0
];
d
=
vals
[
1
];
result
[
m
]
=
[
d
];
}
for
(
let
index
=
0
;
index
<
hkHolidayDefine
.
gl
.
length
;
index
++
)
{
let
m
=
hkHolidayDefine
.
gl
[
index
][
0
];
let
d
=
hkHolidayDefine
.
gl
[
index
][
1
];
// 如果是周六/周日,顺延到下周一
let
vals
=
this
.
checkWeeken
(
m
,
d
);
m
=
vals
[
0
];
d
=
vals
[
1
];
let
list
=
result
[
m
];
if
(
!
list
)
{
result
[
m
]
=
[];
list
=
result
[
m
];
}
list
.
push
(
d
);
}
for
(
let
index
=
0
;
index
<
hkHolidayDefine
.
nl
.
length
;
index
++
)
{
let
m
=
hkHolidayDefine
.
nl
[
index
][
0
];
let
d
=
hkHolidayDefine
.
nl
[
index
][
1
];
let
gl
=
toSolar
(
year
,
m
,
d
);
for
(
let
index
=
0
;
index
<
hkHolidayDefine
.
nl
.
length
;
index
++
)
{
let
m
=
hkHolidayDefine
.
nl
[
index
][
0
];
let
d
=
hkHolidayDefine
.
nl
[
index
][
1
];
let
gl
=
toSolar
(
year
,
m
,
d
);
m
=
gl
[
1
];
d
=
gl
[
2
];
m
=
gl
[
1
];
d
=
gl
[
2
];
// 如果是周六/周日,顺延到下周一
let
date
=
Date
.
parse
(
`
${
year
}
.
${
m
}
.
${
d
}
`
);
if
(
date
.
getDay
()
==
6
)
{
// 周六
date
.
addDays
(
2
);
}
else
if
(
date
.
getDay
()
==
0
)
{
date
.
addDays
(
1
);
}
m
=
date
.
getMonth
()
+
1
;
d
=
date
.
getDate
();
// 如果是周六/周日,顺延到下周一
let
vals
=
this
.
checkWeeken
(
m
,
d
);
m
=
vals
[
0
];
d
=
vals
[
1
];
let
list
=
result
[
m
];
if
(
!
list
)
{
result
[
m
]
=
[];
list
=
result
[
m
];
}
list
.
push
(
d
);
let
list
=
result
[
m
];
if
(
!
list
)
{
result
[
m
]
=
[];
list
=
result
[
m
];
}
return
result
;
list
.
push
(
d
);
}
return
result
;
},
locale
()
{
return
this
.
$i18n
.
locale
||
'tc'
;
...
...
@@ -278,7 +297,7 @@ export default {
if
(
isWeekend
)
{
disable
=
true
;
}
else
{
let
holidayCandidates
=
this
.
holiday
[
month
+
""
];
let
holidayCandidates
=
this
.
holiday
[
month
+
""
];
if
(
holidayCandidates
&&
holidayCandidates
.
indexOf
(
date
)
!=
-
1
)
{
disable
=
true
;
}
...
...
@@ -595,68 +614,21 @@ export default {
},
calculateHolidays
()
{
// 计算新历
let
result
=
{};
let
year
=
this
.
year
;
if
(
!
year
)
{
return
;
}
let
hkHolidayDefine
=
this
.
hkHolidayDefine
;
for
(
let
index
=
0
;
index
<
hkHolidayDefine
.
gl
.
length
;
index
++
)
{
let
m
=
hkHolidayDefine
.
gl
[
index
][
0
];
let
d
=
hkHolidayDefine
.
gl
[
index
][
1
];
// 如果是周六/周日,顺延到下周一
let
date
=
Date
.
parse
(
`
${
year
}
.
${
m
}
.
${
d
}
`
);
if
(
date
.
getDay
()
==
6
)
{
// 周六
date
.
addDays
(
2
);
}
else
if
(
date
.
getDay
()
==
0
)
{
date
.
addDays
(
1
);
}
m
=
date
.
getMonth
()
+
1
;
d
=
date
.
getDate
();
let
list
=
result
[
m
];
if
(
!
list
)
{
result
[
m
]
=
[];
list
=
result
[
m
];
}
list
.
push
(
d
);
}
for
(
let
index
=
0
;
index
<
hkHolidayDefine
.
nl
.
length
;
index
++
)
{
let
m
=
hkHolidayDefine
.
nl
[
index
][
0
];
let
d
=
hkHolidayDefine
.
nl
[
index
][
1
];
let
gl
=
toSolar
(
year
,
m
,
d
);
m
=
gl
[
1
];
d
=
gl
[
2
];
// 如果是周六/周日,顺延到下周一
let
date
=
Date
.
parse
(
`
${
year
}
.
${
m
}
.
${
d
}
`
);
if
(
date
.
getDay
()
==
6
)
{
// 周六
date
.
addDays
(
2
);
}
else
if
(
date
.
getDay
()
==
0
)
{
date
.
addDays
(
1
);
}
m
=
date
.
getMonth
()
+
1
;
d
=
date
.
getDate
();
let
list
=
result
[
m
];
if
(
!
list
)
{
result
[
m
]
=
[];
list
=
result
[
m
];
}
list
.
push
(
d
);
},
checkWeeken
(
m
,
d
)
{
let
year
=
this
.
year
;
let
date
=
Date
.
parse
(
`
${
year
}
.
${
m
}
.
${
d
}
`
);
// if (date.getDay() == 6) {
// // 周六
// date.addDays(2);
// } else
if
(
date
.
getDay
()
==
0
)
{
date
.
addDays
(
1
);
}
this
.
holiday
=
result
;
console
.
log
(
JSON
.
stringify
(
this
.
holiday
));
m
=
date
.
getMonth
()
+
1
;
d
=
date
.
getDate
();
return
[
m
,
d
];
}
},
mounted
()
{
},
...
...
src/components/home/dropdown/dropdown.js
View file @
69f9df4
...
...
@@ -141,6 +141,7 @@ export default {
}
},
logoutHandler
()
{
this
.
clearCache
();
httpPost
({
url
:
api
.
logout
}).
then
(()
=>
{
...
...
@@ -148,6 +149,13 @@ export default {
this
.
showLogoutTip
();
});
},
clearCache
()
{
for
(
let
index
=
0
;
index
<
sessionStorage
.
length
;
index
++
)
{
let
key
=
sessionStorage
.
key
(
index
);
console
.
log
(
key
);
sessionStorage
.
removeItem
(
key
);
}
},
showLogoutTip
()
{
// 登出后的提示
// alert("登出成功");
...
...
Please
register
or
sign in
to post a comment