Skip to content

Commit f800cb1

Browse files
committed
fix:collection styles
1 parent 5c9e4bd commit f800cb1

File tree

2 files changed

+45
-27
lines changed

2 files changed

+45
-27
lines changed

src/assets/css/community/list.less

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
.ml(0);
7676
}
7777
}
78-
.w-filter-topic{
78+
.w-filter-topic {
7979
.ml(10px);
8080
}
8181
.u-map {
@@ -163,7 +163,7 @@
163163
}
164164

165165
.u-item {
166-
background-color:@bg-light;
166+
background-color: @bg-light;
167167
border-bottom: 1px solid @border-hr;
168168
padding: 16px;
169169
.r(6px);
@@ -252,15 +252,15 @@
252252
.u-push__time {
253253
.fz(12px);
254254
color: #999;
255-
border:1px solid #eee;
256-
background-color:@bg-light;
255+
border: 1px solid #eee;
256+
background-color: @bg-light;
257257
margin-right: 5px;
258258
.r(3px);
259259
padding: 0 5px;
260260

261261
&.is-recent {
262-
color: #48C10F;
263-
border-color: #48C10F;
262+
color: #48c10f;
263+
border-color: #48c10f;
264264
background-color: #f8fff5;
265265
}
266266
}
@@ -300,7 +300,6 @@
300300
.u-metalist {
301301
.nobreak;
302302
.db;
303-
.fz(12px, 25px);
304303
.mb(4px);
305304
strong {
306305
.dbi;
@@ -318,13 +317,19 @@
318317
b {
319318
font-weight: normal;
320319
}
320+
.fz(12px, 22px);
321321
a {
322322
color: #333;
323+
.fz(12px, 22px);
323324
&:hover {
324325
color: @color-link;
325326
box-shadow: 0 1px 0 @color-link;
326327
}
327328
}
329+
.u-tag--collection{
330+
background: linear-gradient(90deg, #2563eb, #7c3aed);
331+
color: #fff;
332+
}
328333
}
329334
.u-topic {
330335
background-color: @bg-gray;

src/components/community/list_item.vue

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@
2626
/>
2727

2828
<!-- 标题文字 -->
29-
<a class="u-title" :style="hightStyle" :href="postLink(item.id)" :target="target" v-html="highlightText(item.title)">
29+
<a
30+
class="u-title"
31+
:style="hightStyle"
32+
:href="postLink(item.id)"
33+
:target="target"
34+
v-html="highlightText(item.title)"
35+
>
3036
</a>
3137

3238
<!-- 角标 -->
@@ -35,8 +41,12 @@
3541
</span> -->
3642

3743
<span class="u-push" v-if="hasPermission">
38-
<time v-if="showPushDate" class="u-push__time" :class="{'is-recent': isRecent()}">{{ pushDate }} 已推送</time>
39-
<el-button class="u-push__btn" size="mini" type="warning" @click="onPush" icon="el-icon-s-promotion">推送</el-button>
44+
<time v-if="showPushDate" class="u-push__time" :class="{ 'is-recent': isRecent() }"
45+
>{{ pushDate }} 已推送</time
46+
>
47+
<el-button class="u-push__btn" size="mini" type="warning" @click="onPush" icon="el-icon-s-promotion"
48+
>推送</el-button
49+
>
4050
</span>
4151
</h2>
4252

@@ -64,25 +74,28 @@
6474
</div>
6575
<div class="u-metalist u-topics">
6676
<strong>标签</strong>
67-
<template v-if="~~item.collection_id">
68-
<a :href="`/collection/${item.collection_id}`" target="_blank"
69-
>《{{ item.collection && item.collection.title }}》</a
70-
>
71-
</template>
7277
<span class="m-topic-tag">
73-
<span class="u-tag">{{ showCategory(item.category) }}</span>
78+
<a class="u-tag" :href="`/community?category=${item.category}&page=1`" target="_blank">{{
79+
showCategory(item.category)
80+
}}</a>
7481
<template v-if="item.color_tag">
7582
<a
7683
class="u-tag"
7784
v-for="(_item, index) in item.color_tag"
7885
:key="index"
7986
:style="{ backgroundColor: _item.color }"
8087
:href="getLink(_item)"
88+
target="_blank"
8189
>
8290
{{ _item.label }}
8391
</a>
8492
</template>
85-
<span class="u-tag u-star-tag" v-if="item.is_star">精选</span>
93+
<!-- <span class="u-tag u-star-tag" v-if="item.is_star">精选</span> -->
94+
<template v-if="~~item.collection_id">
95+
<a class="u-tag u-tag--collection" :href="`/collection/${item.collection_id}`" target="_blank">{{
96+
item.collection && item.collection.title.replace(/(^《|》$)/g, "")
97+
}}</a>
98+
</template>
8699
</span>
87100
</div>
88101
</div>
@@ -120,7 +133,7 @@ import bus from "@/utils/bus";
120133
import { getSkinJson } from "@/service/community";
121134
const appKey = "community";
122135
const skinKey = "community_topic_skin";
123-
import {tabsMap} from "@/assets/data/community_category.js";
136+
import { tabsMap } from "@/assets/data/community_category.js";
124137
125138
export default {
126139
name: "ListItem",
@@ -217,7 +230,7 @@ export default {
217230
post_title: this.item.title,
218231
ID: this.item.id,
219232
author: this.item?.ext_user_info?.display_name || "匿名",
220-
}
233+
};
221234
bus.emit("design-task", data);
222235
},
223236
postLink: function (val) {
@@ -246,7 +259,7 @@ export default {
246259
const url = new URL(window.location.href);
247260
url.searchParams.set("tag", item.label);
248261
return url.toString();
249-
}
262+
},
250263
},
251264
filters: {
252265
authorLink,
@@ -283,8 +296,8 @@ export default {
283296
border: 1px solid #fff !important;
284297
background-color: #fff;
285298
286-
&:hover{
287-
border:1px solid @color-link !important;
299+
&:hover {
300+
border: 1px solid @color-link !important;
288301
}
289302
290303
.u-post {
@@ -303,15 +316,15 @@ export default {
303316
align-items: center;
304317
}
305318
}
306-
@media screen and (max-width:@phone){
307-
.m-topic-list .u-community-item{
308-
.u-post{
319+
@media screen and (max-width: @phone) {
320+
.m-topic-list .u-community-item {
321+
.u-post {
309322
.flex;
310323
align-items: flex-start;
311324
}
312-
.u-title{
325+
.u-title {
313326
.pr;
314-
top:-3px;
327+
top: -3px;
315328
}
316329
}
317330
}

0 commit comments

Comments
 (0)