c_ArticleList.vue
3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* 全部一行两个 */
<template>
<div class="article">
<template v-for="(item, index) in list">
<!-- 3图文章内容的容器 1图添加class one-->
<div class="article_list_wrap_three one" @click="toDetail(item)" :key="index">
<!-- 标题容器 -->
<div class="article_list_ctx_wrap">
<div class="article_list_title">
<p>{{ item.title }}</p>
</div>
</div>
<!-- 图片 -->
<div class="article_list_pic_wrap">
<img class="article_list_pic" :src="item.imgUrl" />
</div>
<!-- 阅读量和日期的容器 -->
<div class="article_list_info_wrap">
<!-- 阅读量 -->
<div>
<p class="read_num">浏览量:{{ item.readNumber }}</p>
</div>
<!-- 日期 -->
<div>
<p class="push_date">{{ item.createTime }}</p>
</div>
</div>
</div>
</template>
</div>
</template>
<script>
export default {
props: {
list: {
type: Array,
default: [],
},
},
data() {
return {
active: 0,
}
},
methods: {
toDetail(item) {
if (item.linkUrl) {
this.yxAxios.post(`${this.proxyUrl}/manage/info/content/addReadNum`, { id: item.id }).then((res) => {
if (res.data.code == 200) {
location.href = item.linkUrl
} else {
this.$toast.fail(res.data.message)
}
})
} else {
this.$router.push({ name: 'ArticleDetail', query: { id: item.id } })
}
},
},
}
</script>
<style lang="scss" scoped>
.article {
width: 100%;
height: 100%;
overflow: auto;
padding-left: 30px;
box-sizing: border-box;
.page-head {
font-size: 40px;
text-align: center;
}
.list {
padding-left: 30px;
}
/* 文章内容的容器 三图 */
.article_list_wrap_three {
height:128px;
padding: 34px 0;
}
/* 标题内容 */
.article_list_wrap_three .article_list_title {
font-size: 28px;
font-family: PingFang SC;
font-weight: 500;
color: rgba(58, 58, 58, 1);
line-height: 48px;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.article_list_wrap_three .article_list_pic_wrap {
display: flex;
flex-direction: row;
justify-content: space-between;
}
/* 一个图片样式 */
.article_list_wrap_three.one {
position: relative;
}
.article_list_wrap_three.one .article_list_pic_wrap {
position: absolute;
right: 0;
top: 14px;
width: 260px;
}
.article_list_wrap_three .article_list_ctx_wrap,
.article_list_wrap_three .article_list_info_wrap {
margin-right: 270px;
}
.article_list_wrap_three .article_list_pic {
width: 230px;
height: 168px;
}
/* 阅读量和日期的容器 */
.article_list_wrap_three .article_list_info_wrap {
display: flex;
flex-direction: row;
justify-content: start;
}
/* 阅读量 */
.article_list_wrap_three .read_num {
font-size: 24px;
font-family: PingFang SC;
font-weight: 500;
color: rgba(144, 144, 144, 1);
}
/* 日期 */
.article_list_wrap_three .push_date {
font-size: 24px;
font-family: PingFang SC;
font-weight: 500;
color: rgba(144, 144, 144, 1);
margin-left: 35px;
}
}
</style>