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
2b565883
authored
2021-01-27 08:44:04 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:新闻
1 parent
ce759704
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
54 deletions
index.html
staticJs/pageHome.js
index.html
View file @
2b56588
...
...
@@ -110,7 +110,7 @@
</ul>
<!-- 热点聚焦内容 -->
<ul
class=
"hotspot-list item-list"
>
<li>
<li
url=
"/staticImages/default-news.png"
>
<svg
class=
"icon svg-icon"
aria-hidden=
"true"
>
<use
xlink:href=
"#iconzuixin"
></use>
</svg>
...
...
@@ -124,7 +124,7 @@
</ul>
<!-- 新闻动态内容 -->
<ul
class=
"news-information-list item-list"
>
<li>
<li
url=
"/staticImages/default-news.png"
>
<svg
class=
"icon svg-icon"
aria-hidden=
"true"
>
<use
xlink:href=
"#iconzuixin"
></use>
</svg>
...
...
staticJs/pageHome.js
View file @
2b56588
...
...
@@ -29,12 +29,24 @@ $(function () {
addTabs
(
'#index'
);
initData
();
recentlyDay
=
getDate
();
NewsData
();
NoticeData
();
LawsData
();
policiesData
();
});
function
initData
()
{
// 新闻模块
if
(
$
(
'.news-module-box .hotspot-list li'
).
eq
(
0
).
attr
(
'url'
))
{
$
(
'.news-img'
).
attr
(
'src'
,
$
(
'#ulNews li'
).
eq
(
0
).
attr
(
'url'
));
}
else
{
$
(
'.news-img'
).
attr
(
'src'
,
'/staticImages/default-news.png'
);
}
$
(
document
).
on
(
"mouseover"
,
".news-module-box .item-list li"
,
function
(
e
)
{
if
(
$
(
this
).
attr
(
'url'
))
{
$
(
'.news-img'
).
attr
(
'src'
,
$
(
this
).
attr
(
'url'
));
}
else
{
$
(
'.news-img'
).
attr
(
'src'
,
'/staticImages/default-news.png'
);
}
})
// 在这里处理置顶的头部
let
topTitle
=
$
(
'.top-title'
).
html
();
if
(
strLength
(
topTitle
)
>
7
)
{
...
...
@@ -126,57 +138,6 @@ function strLength(str) {
}
return
realLength
;
};
//加载新闻数据
function
NewsData
()
{
var
ulNews
=
$
(
"#ulNews"
);
ulNews
.
empty
();
var
li
,
publishTime
;
$
.
ajax
({
type
:
"get"
,
//提交方式
url
:
portal
.
api_url
+
"/portal/MhNews/getNewsList"
,
//路径
dataType
:
"json"
,
//数据,这里使用的是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'
);
}
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
+=
'<div class="news_item">'
;
if
(
recentlyDay
.
indexOf
(
publishTime
)
>
-
1
)
{
li
+=
'<svg class="icon svg-icon" aria-hidden="true"> <use xlink:href="#iconzuixin"></use> </svg>'
;
}
li
+=
result
.
data
[
i
].
headline
+
'</div>'
;
li
+=
'<span>'
+
publishTime
+
'</span></a></li>'
;
ulNews
.
append
(
li
);
}
}
}
});
if
(
$
(
'#ulNews li'
).
eq
(
0
).
attr
(
'url'
))
{
$
(
'.news-img img'
).
attr
(
'src'
,
$
(
'#ulNews li'
).
eq
(
0
).
attr
(
'url'
));
}
else
{
$
(
'.news-img img'
).
attr
(
'src'
,
'./staticImages/news_demo.jpg'
);
}
$
(
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'
);
}
})
}
//加载公告数据
function
NoticeData
()
{
var
ulTag
=
$
(
"#ulNotice"
);
...
...
Please
register
or
sign in
to post a comment