Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chifengweb2.0
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
lichunliang
chifengweb2.0
Commits
937afddc
Commit
937afddc
authored
Jul 04, 2025
by
sxl
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:[bug]:新闻列表动态展示
parent
d428df9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
61 deletions
+84
-61
index.vue
pages/News/index.vue
+84
-61
No files found.
pages/News/index.vue
View file @
937afddc
<
template
>
<
template
>
<div
class=
"news cfkqbg"
>
<div
class=
"news cfkqbg"
>
<BackToTopButton
/>
<BackToTopButton
/>
<Header
:activeIndex=
"6"
/>
<Header
:activeIndex=
"6"
/>
<div
class=
"m2zrCon m2pubCon background-attachment"
>
<div
class=
"m2zrCon m2pubCon background-attachment"
>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"inner"
>
<div
class=
"inner"
>
<div
class=
"news-list"
>
<div
class=
"news-list"
>
<ul>
<ul>
<li
v-for=
"(type,index) in newsType"
:key=
"type.id"
@
click=
"newsTabsChange(type.id)"
>
<li
v-for=
"(type, index) in newsType"
:key=
"type.id"
@
click=
"newsTabsChange(type.id)"
>
<span
<span
:class=
"nowType == type.id
:class=
"
? 'por news-type-active'
nowType === type.id
: 'por news-type-normal'
? 'por news-type-active'
"
>
{{
type
.
label
}}
</span>
: 'por news-type-normal'
"
>
{{
type
.
label
}}
</span>
</li>
</li>
</ul>
</ul>
</div>
</div>
<div
class=
"inner por marquee-out"
v-if=
"marqueeData"
>
<div
class=
"inner por marquee-out"
v-if=
"marqueeData"
>
<img
src=
"@/static/images/tout.png"
alt=
""
>
<img
src=
"@/static/images/tout.png"
alt=
""
>
<el-carousel
height=
"40px"
direction=
"vertical"
arrow=
"never"
indicator-position=
"none"
:interval=
"5000"
>
<el-carousel
height=
"40px"
direction=
"vertical"
arrow=
"never"
indicator-position=
"none"
:interval=
"5000"
>
<el-carousel-item
v-for=
"item in marqueeData"
:key=
"item.id"
>
<el-carousel-item
v-for=
"item in marqueeData"
:key=
"item.id"
>
<p
class=
"pmd-con"
:title=
"item.pmdTitle"
>
{{
item
.
pmdTitle
}}
</p>
<p
class=
"pmd-con"
:title=
"item.pmdTitle"
>
{{
item
.
pmdTitle
}}
</p>
</el-carousel-item>
</el-carousel-item>
...
@@ -30,18 +27,14 @@
...
@@ -30,18 +27,14 @@
<div
class=
"mt30"
v-if=
"!marqueeData"
></div>
<div
class=
"mt30"
v-if=
"!marqueeData"
></div>
<div
class=
"news-content"
>
<div
class=
"news-content"
>
<ul>
<ul>
<li
<li
v-for=
"item in newsContentList"
:key=
"item.newsId"
class=
"por"
>
v-for=
"item in newsContentList"
:key=
"item.newsId"
class=
"por"
>
<div
@
click=
"gotoNew(item.newsId)"
>
<div
@
click=
"gotoNew(item.newsId)"
>
<div
class=
"mt10"
></div>
<div
class=
"mt10"
></div>
<div
class=
"left-time poa"
>
<div
class=
"left-time poa"
>
<p>
{{
formatDate
(
item
.
releaseTime
,
"
y.m
"
)
}}
</p>
<p>
{{
formatDate
(
item
.
releaseTime
,
"
y.m
"
)
}}
</p>
<p>
{{
formatDate
(
item
.
releaseTime
,
"
d
"
)
}}
日
</p>
<p>
{{
formatDate
(
item
.
releaseTime
,
"
d
"
)
}}
日
</p>
</div>
</div>
<div
class=
"news-list-con"
>
<div
class=
"news-list-con"
>
<h2
:title=
"item.newsTitle"
>
{{
item
.
newsTitle
}}
</h2>
<h2
:title=
"item.newsTitle"
>
{{
item
.
newsTitle
}}
</h2>
...
@@ -57,14 +50,8 @@
...
@@ -57,14 +50,8 @@
</ul>
</ul>
<div
class=
"mt20"
></div>
<div
class=
"mt20"
></div>
<div
class=
"block"
>
<div
class=
"block"
>
<el-pagination
<el-pagination
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:page-size=
"10"
@
size-change=
"handleSizeChange"
layout=
"prev, pager, next, jumper"
:total=
"total"
v-if=
"total > 10"
>
@
current-change=
"handleCurrentChange"
:page-size=
"10"
layout=
"prev, pager, next, jumper"
:total=
"total"
v-if=
"total > 10"
>
</el-pagination>
</el-pagination>
</div>
</div>
</div>
</div>
...
@@ -90,12 +77,7 @@ export default {
...
@@ -90,12 +77,7 @@ export default {
pageTitle
:
"
赤峰矿权-新闻资讯
"
,
// 静态页面标题
pageTitle
:
"
赤峰矿权-新闻资讯
"
,
// 静态页面标题
pageDescription
:
"
赤峰矿权-新闻资讯
"
,
// 静态页面描述
pageDescription
:
"
赤峰矿权-新闻资讯
"
,
// 静态页面描述
pageKeywords
:
"
赤峰矿权、赤峰矿业、新闻动态
"
,
pageKeywords
:
"
赤峰矿权、赤峰矿业、新闻动态
"
,
newsType
:
[
newsType
:
[],
{
id
:
1
,
label
:
"
国家政策
"
},
{
id
:
2
,
label
:
"
法律法规
"
},
{
id
:
3
,
label
:
"
市场行情
"
},
{
id
:
4
,
label
:
"
行业动态
"
},
],
nowType
:
1
,
nowType
:
1
,
query
:
{
query
:
{
pageNum
:
1
,
pageNum
:
1
,
...
@@ -106,7 +88,7 @@ export default {
...
@@ -106,7 +88,7 @@ export default {
newsContentList
:
[],
newsContentList
:
[],
total
:
0
,
total
:
0
,
isChangingTab
:
false
,
isChangingTab
:
false
,
marqueeData
:
undefined
,
marqueeData
:
undefined
,
};
};
},
},
head
()
{
head
()
{
...
@@ -126,25 +108,25 @@ export default {
...
@@ -126,25 +108,25 @@ export default {
HorizontalMenu
,
HorizontalMenu
,
Header
,
Header
,
},
},
created
()
{},
created
()
{
},
mounted
()
{
mounted
()
{
this
.
getType
();
this
.
getType
();
this
.
fetchData
();
this
.
marqueeFun
();
this
.
marqueeFun
();
},
},
methods
:
{
methods
:
{
removeTagsAndSpaces
(
input
)
{
removeTagsAndSpaces
(
input
)
{
// 使用正则表达式替换
// 使用正则表达式替换
var
output
=
input
.
replace
(
/<
\/?[^
>
]
+
(
>|$
)
/g
,
''
);
// 去除所有的
<>
标签
var
output
=
input
.
replace
(
/<
\/?[^
>
]
+
(
>|$
)
/g
,
''
);
// 去除所有的
<>
标签
output
=
output
.
replace
(
/
[\t\n\r]
/g
,
''
);
// 去除制表符、换行符、回车符
output
=
output
.
replace
(
/
[\t\n\r]
/g
,
''
);
// 去除制表符、换行符、回车符
output
=
output
.
replace
(
/ /g
,
''
);
// 去除
output
=
output
.
replace
(
/ /g
,
''
);
// 去除
output
=
output
.
replace
(
/
\s
+/g
,
''
);
// 去除空白字符
output
=
output
.
replace
(
/
\s
+/g
,
''
);
// 去除空白字符
return
output
;
return
output
;
},
},
extractContent
,
extractContent
,
formatDate
,
formatDate
,
gotoNew
(
id
){
gotoNew
(
id
)
{
this
.
$router
.
push
({
path
:
`/News/det?id=
${
id
}
`
});
this
.
$router
.
push
({
path
:
`/News/det?id=
${
id
}
`
});
},
},
scrollToTop
()
{
scrollToTop
()
{
...
@@ -173,14 +155,24 @@ export default {
...
@@ -173,14 +155,24 @@ export default {
async
getType
()
{
async
getType
()
{
try
{
try
{
const
type
=
await
sendRequest
(
const
type
=
await
sendRequest
(
"
business/companyInformation/list
"
,
// "business/companyInformation/list",
"
system/dict/data/list
"
,
"
get
"
,
"
get
"
,
{
{
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
10
,
pageSize
:
10
,
dictType
:
'
cfkq_news_type
'
,
}
}
);
);
console
.
log
(
type
,
"
type
"
);
this
.
newsType
=
type
.
rows
&&
type
.
rows
.
length
>
0
&&
type
.
rows
.
filter
((
item
)
=>
{
return
item
.
status
!=
'
1
'
}).
map
((
item
)
=>
{
return
{
id
:
item
.
dictValue
,
label
:
item
.
dictLabel
,
};
});
this
.
newsTabsChange
(
this
.
newsType
[
0
].
id
)
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
"
Error fetching data:
"
,
error
);
console
.
error
(
"
Error fetching data:
"
,
error
);
}
}
...
@@ -206,13 +198,13 @@ export default {
...
@@ -206,13 +198,13 @@ export default {
console
.
error
(
"
Error fetching data:
"
,
error
);
console
.
error
(
"
Error fetching data:
"
,
error
);
}
}
},
},
async
marqueeFun
(){
async
marqueeFun
()
{
const
marquee
=
await
sendRequest
(
const
marquee
=
await
sendRequest
(
"
/system/paomadeng/listAll
"
,
"
/system/paomadeng/listAll
"
,
"
get
"
,
"
get
"
,
{
{
pmdType
:
'
2
'
,
pmdType
:
'
2
'
,
isDisplay
:
'
Y
'
isDisplay
:
'
Y
'
}
}
);
);
this
.
marqueeData
=
marquee
.
rows
;
this
.
marqueeData
=
marquee
.
rows
;
...
@@ -224,17 +216,21 @@ export default {
...
@@ -224,17 +216,21 @@ export default {
.news-bg
{
.news-bg
{
width
:
100%
;
width
:
100%
;
}
}
.news-bg
img
{
.news-bg
img
{
width
:
100%
;
width
:
100%
;
height
:
auto
;
height
:
auto
;
object-fit
:
contain
;
object-fit
:
contain
;
}
}
.news-type-normal
{
.news-type-normal
{
color
:
#666
;
color
:
#666
;
}
}
.news-type-active
{
.news-type-active
{
color
:
#0457c7
;
color
:
#0457c7
;
}
}
.news-list
ul
{
.news-list
ul
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-evenly
;
justify-content
:
space-evenly
;
...
@@ -244,14 +240,17 @@ export default {
...
@@ -244,14 +240,17 @@ export default {
font-size
:
0
.3rem
;
font-size
:
0
.3rem
;
line-height
:
0
.6rem
;
line-height
:
0
.6rem
;
}
}
.news-list
ul
li
span
{
.news-list
ul
li
span
{
cursor
:
pointer
;
cursor
:
pointer
;
display
:
block
;
display
:
block
;
transition
:
all
0
.5s
ease
;
transition
:
all
0
.5s
ease
;
}
}
.news-list
ul
li
:hover
span
{
.news-list
ul
li
:hover
span
{
color
:
rgba
(
4
,
87
,
199
,
0
.5
);
color
:
rgba
(
4
,
87
,
199
,
0
.5
);
}
}
.
news-list
ul
li
span
:
:
after
{
.
news-list
ul
li
span
:
:
after
{
content
:
""
;
content
:
""
;
display
:
none
;
display
:
none
;
...
@@ -262,12 +261,15 @@ export default {
...
@@ -262,12 +261,15 @@ export default {
height
:
34px
;
height
:
34px
;
background
:
#0457c7
;
background
:
#0457c7
;
}
}
.news-list
ul
li
:last-child
span
::after
{
.news-list
ul
li
:last-child
span
::after
{
display
:
none
;
display
:
none
;
}
}
.news-content
ul
{
.news-content
ul
{
width
:
100%
;
width
:
100%
;
}
}
.news-content
ul
li
{
.news-content
ul
li
{
width
:
100%
;
width
:
100%
;
background
:
#ffffff
;
background
:
#ffffff
;
...
@@ -278,12 +280,15 @@ export default {
...
@@ -278,12 +280,15 @@ export default {
color
:
#666
;
color
:
#666
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.news-content
ul
li
:hover
{
.news-content
ul
li
:hover
{
box-shadow
:
0px
5px
10px
0px
rgba
(
0
,
0
,
0
,
0
.4
);
box-shadow
:
0px
5px
10px
0px
rgba
(
0
,
0
,
0
,
0
.4
);
}
}
.left-time
{
.left-time
{
display
:
none
;
display
:
none
;
}
}
.news-list-con
h2
{
.news-list-con
h2
{
color
:
#333333
;
color
:
#333333
;
overflow
:
hidden
;
overflow
:
hidden
;
...
@@ -295,6 +300,7 @@ export default {
...
@@ -295,6 +300,7 @@ export default {
font-size
:
0
.22rem
;
font-size
:
0
.22rem
;
margin
:
0
0
.2rem
;
margin
:
0
0
.2rem
;
}
}
.
news-list-con
h2
:
:
before
{
.
news-list-con
h2
:
:
before
{
content
:
""
;
content
:
""
;
position
:
absolute
;
position
:
absolute
;
...
@@ -306,11 +312,13 @@ export default {
...
@@ -306,11 +312,13 @@ export default {
border-radius
:
50%
;
border-radius
:
50%
;
display
:
none
;
display
:
none
;
}
}
.news-list-con
.news-time
{
.news-list-con
.news-time
{
font-size
:
0
.18rem
;
font-size
:
0
.18rem
;
color
:
#666666
;
color
:
#666666
;
margin
:
0
0
.2rem
;
margin
:
0
0
.2rem
;
}
}
.news-list-con
.news-disc
{
.news-list-con
.news-disc
{
color
:
#666666
;
color
:
#666666
;
line-height
:
1
.5em
;
line-height
:
1
.5em
;
...
@@ -330,32 +338,37 @@ export default {
...
@@ -330,32 +338,37 @@ export default {
font-size
:
20px
;
font-size
:
20px
;
line-height
:
57px
;
line-height
:
57px
;
}
}
.
news-list
ul
li
span
:
:
after
{
.
news-list
ul
li
span
:
:
after
{
display
:
block
;
display
:
block
;
height
:
22px
;
height
:
22px
;
top
:
34%
;
top
:
34%
;
right
:
-90px
;
right
:
-90px
;
}
}
.news-content
ul
li
{
.news-content
ul
li
{
min-height
:
100px
;
min-height
:
100px
;
overflow
:
hidden
;
overflow
:
hidden
;
margin-top
:
30px
;
margin-top
:
30px
;
}
}
.news-content
ul
li
:first-child
{
.news-content
ul
li
:first-child
{
margin-top
:
0
;
margin-top
:
0
;
}
}
.left-time
{
.left-time
{
display
:
block
;
display
:
block
;
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
width
:
130px
;
width
:
130px
;
height
:
91px
;
height
:
91px
;
box-shadow
:
0px
3px
6px
0px
rgba
(
0
,
0
,
0
,
0
.2
);
box-shadow
:
0px
3px
6px
0px
rgba
(
0
,
0
,
0
,
0
.2
);
text-align
:
center
;
text-align
:
center
;
border
:
1px
solid
#1961c5
;
border
:
1px
solid
#1961c5
;
}
}
.left-time
p
:first-child
{
.left-time
p
:first-child
{
font-size
:
20px
;
font-size
:
20px
;
background
:
#1961c5
;
background
:
#1961c5
;
...
@@ -363,12 +376,15 @@ export default {
...
@@ -363,12 +376,15 @@ export default {
height
:
45px
;
height
:
45px
;
line-height
:
45px
;
line-height
:
45px
;
}
}
.left-time
p
:last-child
{
.left-time
p
:last-child
{
font-size
:
30px
;
font-size
:
30px
;
}
}
.news-list-con
{
.news-list-con
{
margin-left
:
120px
;
margin-left
:
120px
;
}
}
.news-list-con
h2
{
.news-list-con
h2
{
width
:
45%
;
width
:
45%
;
font-size
:
18px
;
font-size
:
18px
;
...
@@ -376,6 +392,7 @@ export default {
...
@@ -376,6 +392,7 @@ export default {
text-indent
:
1em
;
text-indent
:
1em
;
float
:
left
;
float
:
left
;
}
}
.
news-list-con
h2
:
:
before
{
.
news-list-con
h2
:
:
before
{
left
:
0
;
left
:
0
;
top
:
12px
;
top
:
12px
;
...
@@ -383,6 +400,7 @@ export default {
...
@@ -383,6 +400,7 @@ export default {
height
:
11px
;
height
:
11px
;
display
:
block
;
display
:
block
;
}
}
.news-list-con
.news-time
{
.news-list-con
.news-time
{
width
:
30%
;
width
:
30%
;
font-size
:
18px
;
font-size
:
18px
;
...
@@ -390,11 +408,13 @@ export default {
...
@@ -390,11 +408,13 @@ export default {
text-align
:
right
;
text-align
:
right
;
float
:
right
;
float
:
right
;
}
}
.news-list-con
.news-disc
{
.news-list-con
.news-disc
{
font-size
:
20px
;
font-size
:
20px
;
-webkit-line-clamp
:
2
;
-webkit-line-clamp
:
2
;
text-indent
:
2em
;
text-indent
:
2em
;
}
}
// .block ::v-deep .el-pager li {
// .block ::v-deep .el-pager li {
// padding: 0 15px;
// padding: 0 15px;
// background: #fff;
// background: #fff;
...
@@ -411,19 +431,23 @@ export default {
...
@@ -411,19 +431,23 @@ export default {
.inner
{
.inner
{
width
:
1250px
;
width
:
1250px
;
}
}
.
news-list
ul
li
span
:
:
after
{
.
news-list
ul
li
span
:
:
after
{
height
:
22px
;
height
:
22px
;
top
:
34%
;
top
:
34%
;
right
:
-100%
;
right
:
-100%
;
}
}
.news-content
ul
li
{
.news-content
ul
li
{
margin-top
:
30px
;
margin-top
:
30px
;
}
}
}
}
@keyframes
marquee
{
@keyframes
marquee
{
0
%
{
0
%
{
left
:
100%
;
left
:
100%
;
}
}
100
%
{
100
%
{
left
:
-100%
;
left
:
-100%
;
}
}
...
@@ -431,17 +455,16 @@ export default {
...
@@ -431,17 +455,16 @@ export default {
@keyframes
blink
{
@keyframes
blink
{
0
%
{
0
%
{
opacity
:
1
;
opacity
:
1
;
}
}
50
%
{
opacity
:
0
;
}
100
%
{
opacity
:
1
;
}
}
50
%
{
opacity
:
0
;
}
100
%
{
opacity
:
1
;
}
}
</
style
>
</
style
>
\ No newline at end of file
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