Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
任超
/
js.portalStaticPage
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
69db53a9
authored
2021-01-19 11:28:19 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:日期
1 parent
918a5e1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
staticJs/pageHome.js
staticJs/pageHome.js
View file @
69db53a
...
...
@@ -30,7 +30,6 @@ layui.use('util', function () {
});
var
recentlyDay
;
function
getDate
()
{
var
date
=
new
Date
();
var
base
=
new
Date
(
date
).
getTime
();
...
...
@@ -38,13 +37,17 @@ function getDate() {
var
date
=
[];
var
data
=
[
Math
.
random
()
*
300
];
var
time
=
new
Date
(
base
);
date
.
push
([
time
.
getFullYear
(),
time
.
getMonth
()
+
1
,
time
.
getDate
()].
join
(
'/'
));
var
mon
=
(
time
.
getMonth
()
+
1
)
>=
10
?
time
.
getMonth
()
+
1
:
'0'
+
(
time
.
getMonth
()
+
1
);
var
day
=
time
.
getDate
()
>=
10
?
time
.
getDate
()
:
'0'
+
time
.
getDate
();
date
.
push
([
time
.
getFullYear
(),
mon
,
day
].
join
(
'/'
));
for
(
var
i
=
1
;
i
<
7
;
i
++
)
{
//控制需要的天数
var
now
=
new
Date
(
base
-=
oneDay
);
//这里控制往前一周还是往后一周
date
.
push
([
now
.
getFullYear
(),
now
.
getMonth
()
+
1
,
now
.
getDate
()].
join
(
'/'
));
var
nowMon
=
(
now
.
getMonth
()
+
1
)
>=
10
?
now
.
getMonth
()
+
1
:
'0'
+
(
now
.
getMonth
()
+
1
);
var
nowDay
=
now
.
getDate
()
>=
10
?
now
.
getDate
()
:
'0'
+
now
.
getDate
();
date
.
push
([
now
.
getFullYear
(),
nowMon
,
nowDay
].
join
(
'/'
));
data
.
push
(
Math
.
round
((
Math
.
random
()
-
0.5
)
*
20
+
data
[
i
-
1
]));
}
return
date
.
reverse
();
return
date
.
reverse
();
}
//初始化方法
...
...
@@ -59,14 +62,14 @@ $(function () {
policiesData
();
});
function
initData
()
{
$
(
'#appointment_inquiry'
).
click
(
function
()
{
$
(
'#appointment_inquiry'
).
click
(
function
()
{
if
(
isLogin
())
{
window
.
open
(
'./staticViews/wdyy.html'
,
'_self'
)
window
.
open
(
'./staticViews/wdyy.html'
,
'_self'
)
}
})
$
(
'#onlineBooking'
).
click
(
function
()
{
$
(
'#onlineBooking'
).
click
(
function
()
{
if
(
isLogin
())
{
window
.
open
(
'./staticViews/wdyy.html'
,
'_self'
)
window
.
open
(
'./staticViews/wdyy.html'
,
'_self'
)
}
})
}
...
...
@@ -82,18 +85,18 @@ function NewsData() {
//数据,这里使用的是Json格式进行传输
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
if
(
result
.
code
==
200
&&
result
.
data
!=
null
)
{
if
(
result
.
data
[
0
].
preViewUrl
)
{
$
(
'.news-img img'
).
attr
(
'src'
,
result
.
data
[
0
].
preViewUrl
);
}
else
{
$
(
'.news-img img'
).
attr
(
'src'
,
'./staticImages/news_demo.jpg'
);
if
(
result
.
data
[
0
].
preViewUrl
)
{
$
(
'.news-img img'
).
attr
(
'src'
,
result
.
data
[
0
].
preViewUrl
);
}
else
{
$
(
'.news-img img'
).
attr
(
'src'
,
'./staticImages/news_demo.jpg'
);
}
for
(
var
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
if
(
i
==
6
)
return
;
publishTime
=
CutDate
(
result
.
data
[
i
].
publishTime
);
if
(
result
.
data
[
i
].
preViewUrl
)
{
li
=
'<li url="'
+
result
.
data
[
i
].
preViewUrl
+
'"><a href="./staticViews/news/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
;
}
else
{
li
=
'<li><a href="./staticViews/news/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
;
li
=
'<li url="'
+
result
.
data
[
i
].
preViewUrl
+
'"><a href="./staticViews/news/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
;
}
else
{
li
=
'<li><a href="./staticViews/news/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
;
}
li
+=
'<div class="news_item">'
;
if
(
recentlyDay
.
indexOf
(
publishTime
)
>
-
1
)
{
...
...
@@ -108,10 +111,10 @@ function NewsData() {
});
$
(
document
).
on
(
"mouseover"
,
"#ulNews li"
,
function
(
e
)
{
if
(
$
(
this
).
attr
(
'url'
))
{
$
(
'.news-img img'
).
attr
(
'src'
,
$
(
this
).
attr
(
'url'
));
}
else
{
$
(
'.news-img img'
).
attr
(
'src'
,
'./staticImages/news_demo.jpg'
);
if
(
$
(
this
).
attr
(
'url'
))
{
$
(
'.news-img img'
).
attr
(
'src'
,
$
(
this
).
attr
(
'url'
));
}
else
{
$
(
'.news-img img'
).
attr
(
'src'
,
'./staticImages/news_demo.jpg'
);
}
})
}
...
...
@@ -130,7 +133,7 @@ function NoticeData() {
if
(
result
.
code
==
200
&&
result
.
data
!=
null
)
{
for
(
var
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
if
(
i
==
6
)
return
;
li
=
'<li class="item_notice"><a href="./staticViews/notice/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
title
+
'" target="_blank">'
;
li
=
'<li class="item_notice"><a href="./staticViews/notice/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
title
+
'" target="_blank">'
;
li
+=
'<p>'
+
result
.
data
[
i
].
title
+
'</P>'
;
if
(
result
.
data
[
i
].
noticeType
==
1
)
{
li
+=
'<svg class="icon svg-icon" aria-hidden="true"> <use xlink:href="#icongongshi"></use> </svg>'
;
...
...
@@ -161,7 +164,7 @@ function LawsData() {
if
(
result
.
code
==
200
&&
result
.
data
!=
null
)
{
for
(
var
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
if
(
i
==
6
)
return
;
li
=
'<li><a href="./staticViews/law/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
+
result
.
data
[
i
].
headline
;
li
=
'<li><a href="./staticViews/law/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
+
result
.
data
[
i
].
headline
;
li
+=
'</a></li>'
;
ulTag
.
append
(
li
);
}
...
...
@@ -183,7 +186,7 @@ function policiesData() {
if
(
result
.
code
==
200
&&
result
.
data
!=
null
)
{
for
(
var
i
=
0
;
i
<
result
.
data
.
length
;
i
++
)
{
if
(
i
==
6
)
return
;
li
=
'<li><a href="./staticViews/policy/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
+
result
.
data
[
i
].
headline
;
li
=
'<li><a href="./staticViews/policy/'
+
result
.
data
[
i
].
id
+
'.html" title="'
+
result
.
data
[
i
].
headline
+
'" target="_blank">'
+
result
.
data
[
i
].
headline
;
li
+=
'</a></li>'
;
policies
.
append
(
li
);
}
...
...
Please
register
or
sign in
to post a comment