Skip to content

Commit b85a082

Browse files
committed
表格文字两端对齐,新闻列表展示发布时间
1 parent 9dfce49 commit b85a082

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

assets/scss/variable.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ $--color-primary-light: mix(#fff, $--color-primary, 96%);
7575
letter-spacing: 0.2px;
7676
font-size: 17px;
7777
}
78-
p {
78+
p,td {
7979
text-align: justify;
8080
}
8181
}
@@ -115,7 +115,7 @@ $--color-primary-light: mix(#fff, $--color-primary, 96%);
115115
line-height: 1;
116116
font-size: 0.17rem;
117117
}
118-
p {
118+
p,td {
119119
text-align: justify;
120120
}
121121
}

components/NewsItem.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
</div>
99
<div class="tags">
1010
<el-tag class="tag" type="primary" v-if="itemData.isNew">新</el-tag>
11-
<el-tag class="tag" type="primary" v-if="itemData.is_top" style="float: right"><i class="el-icon-top icon"></i>置顶
11+
<el-tag class="tag" type="primary" v-if="itemData.is_top"><i class="el-icon-top icon"></i>置顶
1212
</el-tag>
1313
<el-tag class="tag" type="warning" v-if="itemData.category.name && showCategory">{{itemData.category.name}}</el-tag>
14+
<el-tag class="tag" style="float:right;font-weight: normal;" type="primary">{{itemData.publish_at|parseTime('{y}-{m}-{d}')}}</el-tag>
1415
</div>
1516
<a class='title' :href="getLink()" :title="itemData.title">{{ itemData.title }}</a>
1617
<p class='desc'>{{ itemData.digest }}</p>

components/NewsItemList.vue

+31-21
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<p class='title'>{{ itemData.title }}</p>
1111
</div>
1212
<p class='desc'>{{ itemData.digest }}</p>
13+
<el-tag class="tag" style="font-weight: normal;margin-top: 12px;" type="primary" size="small">{{itemData.publish_at|parseTime('{y}-{m}-{d}')}}</el-tag>
1314
</div>
1415
</div>
1516
</template>
@@ -22,24 +23,33 @@ export default {
2223
return {
2324
id: '87bc10c00baa42bb917908e89834ba83',
2425
title: '标题',
25-
digest: '第七届中国国际“互联网+”大学生创新创业大赛总决赛在南昌大学举行。重庆大学的创新创业团队表现优异,7件入围总决赛答辩项目获得了5金2银的历史最好成绩。此次比赛,交大不仅金奖数量及获奖总数创历史新高,而且实现了红旅赛道历史首金的突破,并获上海市的“先进集体奖”。',
26-
thumb: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.18-23IyhMHV0DyhI4Rp-hAHaEK?w=333&h=187&c=7&r=0&o=5&dpr=1.25&pid=1.7',
26+
digest:
27+
'第七届中国国际“互联网+”大学生创新创业大赛总决赛在南昌大学举行。重庆大学的创新创业团队表现优异,7件入围总决赛答辩项目获得了5金2银的历史最好成绩。此次比赛,交大不仅金奖数量及获奖总数创历史新高,而且实现了红旅赛道历史首金的突破,并获上海市的“先进集体奖”。',
28+
thumb:
29+
'https://tse2-mm.cn.bing.net/th/id/OIP-C.18-23IyhMHV0DyhI4Rp-hAHaEK?w=333&h=187&c=7&r=0&o=5&dpr=1.25&pid=1.7',
2730
}
2831
},
2932
},
3033
showCategory: {
3134
type: Boolean,
32-
default: false
33-
}
35+
default: false,
36+
},
3437
},
3538
data() {
3639
return {}
3740
},
3841
methods: {
3942
clickNew() {
40-
let menuIds = this.$utils.findMenuIdsByEventLink(this.$store.state.config.menuList, this.itemData.category_id)
41-
this.$router.push(`/content/news-detail?params=${this.itemData.id}&menuIds=${menuIds.join(',')}`)
42-
}
43+
let menuIds = this.$utils.findMenuIdsByEventLink(
44+
this.$store.state.config.menuList,
45+
this.itemData.category_id
46+
)
47+
this.$router.push(
48+
`/content/news-detail?params=${this.itemData.id}&menuIds=${menuIds.join(
49+
','
50+
)}`
51+
)
52+
},
4353
},
4454
}
4555
</script>
@@ -72,19 +82,6 @@ export default {
7282
justify-content: flex-start;
7383
margin-bottom: 10px;
7484
75-
.tag {
76-
height: 20px;
77-
line-height: 18px;
78-
font-weight: bold;
79-
margin-right: 10px;
80-
81-
.icon {
82-
margin-right: 5px;
83-
font-weight: bold;
84-
vertical-align: middle;
85-
}
86-
}
87-
8885
.title {
8986
font-size: 15px;
9087
font-weight: bold;
@@ -96,15 +93,28 @@ export default {
9693
}
9794
}
9895
96+
.tag {
97+
height: 20px;
98+
line-height: 18px;
99+
font-weight: bold;
100+
margin-right: 10px;
101+
102+
.icon {
103+
margin-right: 5px;
104+
font-weight: bold;
105+
vertical-align: middle;
106+
}
107+
}
99108
.desc {
100109
font-size: 14px;
101110
font-weight: 400;
102111
color: #666666;
103112
line-height: 21px;
104113
display: -webkit-box;
105114
overflow: hidden;
106-
-webkit-line-clamp: 3;
115+
-webkit-line-clamp: 2;
107116
-webkit-box-orient: vertical;
117+
min-height: 45px;
108118
}
109119
}
110120
}

0 commit comments

Comments
 (0)