Skip to content

Commit f7c01e9

Browse files
committed
fix: 调整社区模块样式,修复边距和填充问题,优化响应式设计 #6
1 parent d482104 commit f7c01e9

7 files changed

Lines changed: 81 additions & 30 deletions

File tree

src/assets/css/community/community-single.less

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.m-community-single {
2-
.m-community-footer,
32
.m-community-header {
3+
padding: 0;
4+
}
5+
.m-community-footer {
46
padding: 0 28px;
57
}
68
.m-topic-category-box {

src/assets/css/community/reply_item.less

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
background: white;
66
padding: 16px 0;
77
border-radius: 0 0 10px 10px;
8+
9+
&.is-master {
10+
padding-top: 0;
11+
}
812
}
913

1014
// 包含回帖内容 、时间、操作按钮 的主要展示区域
@@ -262,7 +266,7 @@
262266
display: flex;
263267
flex-direction: column;
264268
border-left: 1px solid rgba(232, 232, 232, 1);
265-
padding: 0 24px;
269+
padding: 0 30px;
266270
min-width: 0;
267271
}
268272
// 折叠评论

src/components/bbs/single_side.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default {
5050
5151
<style lang="less">
5252
.m-single-side {
53-
padding: 20px;
53+
// padding: 20px;
5454
}
5555
.m-single-directory {
5656
.mb(20px);

src/components/community/post_header.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
<img svg-inline src="@/assets/img/community/is_star_inline.svg" alt="" />
5858
精选
5959
</span>
60+
<div class="u-meta u-sub-block">
61+
<em class="u-label">适用客户端</em>
62+
<span class="u-value u-client" :class="'i-client-' + client">{{ showClientLabel(client) }}</span>
63+
</div>
6064

6165
<!-- 帖子分类 -->
6266
<!-- <span class="u-status u-sub-block" :style="`background-color: ${styles.color};`">
@@ -87,6 +91,13 @@
8791
<time>{{ post_date }}</time>
8892
</span>
8993

94+
<span class="u-sub-block" :title="'发布日期:' + post_time">
95+
<i class="u-icon-modate">
96+
<img svg-inline src="@jx3box/jx3box-common-ui/assets/img/single/modate.svg" />
97+
</i>
98+
<time>{{ update_date }}</time>
99+
</span>
100+
90101
<!-- 查看次数 -->
91102
<span class="u-views u-sub-block">
92103
<i class="el-icon-view"></i>
@@ -209,6 +220,9 @@ export default {
209220
}
210221
return null;
211222
},
223+
client: function () {
224+
return this.post?.client || "std";
225+
},
212226
},
213227
watch: {
214228
post: {

src/components/community/reply_item.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="m-reply-wrapper" :id="`floor-${post.floor}`">
2+
<div class="m-reply-wrapper" :class="{'is-master': isMaster}" :id="`floor-${post.floor || 0}`">
33
<div class="m-reply-left">
44
<CommentUser :uid="userInfo.id" :isMaster="isMaster" :isAnonymous="isAnonymous" />
55
<div class="u-top-right u-mobile-show">
@@ -8,9 +8,10 @@
88
</div>
99
</div>
1010
<div class="m-reply-right">
11+
<slot name="header"></slot>
1112
<div class="m-reply-content">
1213
<div class="u-reply-floor u-mobile-hidden">
13-
<a :href="`#floor-${post.floor}`" @click="onFloorClick">{{
14+
<a :href="`#floor-${post.floor || 0}`" @click="onFloorClick">{{
1415
isMaster ? "楼主" : post.floor + "楼"
1516
}}</a>
1617
<span class="u-comment-time u-mobile-hidden">{{ post.updated_at }}</span>
@@ -100,7 +101,7 @@
100101
:author-id="post.user_id"
101102
:banner="post.banner_img"
102103
:contentMetaId="post.link_content_meta_id"
103-
:allowGift="!isDisableBoxcoin"
104+
:allowGift="Number(!isDisableBoxcoin)"
104105
/>
105106
<!-- 操作按钮 -->
106107
<!-- <div class="m-reply-time u-mobile-hidden">{{ showTime }}</div> -->

src/components/single/single_side.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default {
4141
4242
<style lang="less">
4343
.m-single-side {
44-
padding: 20px;
44+
// padding: 15px;
4545
}
4646
.m-single-directory {
4747
.mb(20px);

src/views/CommunitySingle.vue

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<CommunitySingleLayout :post="post">
33
<div class="m-community-single" v-loading="loading">
44
<!-- 头部 -->
5-
<div class="m-community-header">
5+
<!-- <div class="m-community-header">
66
<PostHeader :post="post" :stat="stat">
77
<template #append>
88
<el-pagination
@@ -16,16 +16,16 @@
1616
class="m-pageheader-pagination"
1717
></el-pagination>
1818
</template>
19-
</PostHeader>
19+
</PostHeader> -->
2020
<!-- 文集小册 -->
21-
<Collection
21+
<!-- <Collection
2222
class="m-single-collection"
2323
:id="collection_id"
2424
:defaultVisible="collection_collapse"
2525
@collectionUpdate="updateCollection"
2626
/>
27-
<el-divider content-position="left">JX3BOX</el-divider>
28-
</div>
27+
<el-divider content-position="left">JX3BOX</el-divider> -->
28+
<!-- </div> -->
2929

3030
<div class="m-list-box">
3131
<!-- 楼主 -->
@@ -37,7 +37,35 @@
3737
:post="post"
3838
@onReplyTopic="handleReplyTopic"
3939
@enterPwd="enterPwd"
40-
/>
40+
>
41+
<template #header>
42+
<!-- 头部 -->
43+
<div class="m-community-header">
44+
<PostHeader :post="post" :stat="stat">
45+
<template #append>
46+
<el-pagination
47+
layout="prev, pager, next"
48+
:hide-on-single-page="true"
49+
:page-size="per"
50+
:total="total"
51+
:current-page.sync="page"
52+
@current-change="changePage"
53+
size="small"
54+
class="m-pageheader-pagination"
55+
></el-pagination>
56+
</template>
57+
</PostHeader>
58+
<!-- 文集小册 -->
59+
<Collection
60+
class="m-single-collection"
61+
:id="collection_id"
62+
:defaultVisible="collection_collapse"
63+
@collectionUpdate="updateCollection"
64+
/>
65+
<el-divider content-position="left">JX3BOX</el-divider>
66+
</div>
67+
</template>
68+
</ReplyItem>
4169
</div>
4270

4371
<!-- 帖子回复 -->
@@ -82,7 +110,9 @@
82110
<div class="u-editor">
83111
<el-divider content-position="left">回帖</el-divider>
84112
<CommentEditor @submit="onReplyTopic" v-if="!isDisabledComment" />
85-
<el-alert :show-close="false" center v-else class="m-disabled-comment-tip">作者已关闭回帖功能</el-alert>
113+
<el-alert :show-close="false" center v-else class="m-disabled-comment-tip"
114+
>作者已关闭回帖功能</el-alert
115+
>
86116
</div>
87117
</div>
88118
</div>
@@ -206,7 +236,7 @@ export default {
206236
};
207237
},
208238
computed: {
209-
styles: function() {
239+
styles: function () {
210240
let item = this.categoryList.find((item) => item.value === this.post.category);
211241
if (item) {
212242
return item;
@@ -218,7 +248,7 @@ export default {
218248
};
219249
}
220250
},
221-
id: function() {
251+
id: function () {
222252
return this.$route.params.id;
223253
},
224254
isAuthor() {
@@ -228,25 +258,25 @@ export default {
228258
return window.innerWidth < 768;
229259
},
230260
// 是否显示加载更多
231-
hasNextPage: function() {
261+
hasNextPage: function () {
232262
return this.pageTotal >= 1 && this.per * this.page < this.total;
233263
},
234264
collection_id() {
235265
return this.post.collection_id;
236266
},
237-
collection_collapse: function() {
267+
collection_collapse: function () {
238268
return this.post?.collection_collapse;
239269
},
240-
null_tip: function() {
270+
null_tip: function () {
241271
let str = "作者设置了【";
242272
str += __visibleMap[this.post?.visible];
243273
str += "";
244274
return str;
245275
},
246-
visible: function() {
276+
visible: function () {
247277
return !!this.post?.visible_validate;
248278
},
249-
isDisabledComment: function() {
279+
isDisabledComment: function () {
250280
return !!this.post?.disable_comment;
251281
},
252282
},
@@ -281,7 +311,7 @@ export default {
281311
"$route.query": {
282312
deep: true,
283313
immediate: true,
284-
handler: function(query) {
314+
handler: function (query) {
285315
if (Object.keys(query).length) {
286316
for (let key in query) {
287317
// for:element分页组件兼容性问题
@@ -299,7 +329,7 @@ export default {
299329
/**
300330
* 获取url楼诚参数
301331
*/
302-
getJumpFloor: function() {
332+
getJumpFloor: function () {
303333
const hash = window.location.hash;
304334
const floor = hash.substring(1).split("?")[0];
305335
if (floor) {
@@ -322,7 +352,7 @@ export default {
322352
});
323353
},
324354
// 翻页按钮
325-
nextPage: function() {
355+
nextPage: function () {
326356
this.getReplyList(true);
327357
},
328358
onSearch() {
@@ -341,7 +371,7 @@ export default {
341371
this.getReplyList();
342372
},
343373
344-
buildQuery: function() {
374+
buildQuery: function () {
345375
let _query = {
346376
index: this.page,
347377
pageSize: this.per,
@@ -354,10 +384,10 @@ export default {
354384
this.replaceRoute({ page: this.page, onlyAuthor: this.onlyAuthor });
355385
return _query;
356386
},
357-
getTopicData: function() {
387+
getTopicData: function () {
358388
return this.post;
359389
},
360-
getDetails: function() {
390+
getDetails: function () {
361391
let fun = getTopicDetails;
362392
if (this.mode == "admin") {
363393
fun = getTopicDetailsFromAdmin;
@@ -400,7 +430,7 @@ export default {
400430
}
401431
});
402432
},
403-
getReplyList: function(appendMode) {
433+
getReplyList: function (appendMode) {
404434
if (this.mode == "admin") return;
405435
this.loading = true;
406436
if (appendMode) {
@@ -516,7 +546,7 @@ export default {
516546
this.getReplyList();
517547
},
518548
// 路由绑定
519-
replaceRoute: function(extend) {
549+
replaceRoute: function (extend) {
520550
return this.$router
521551
.push({ name: this.$route.name, query: Object.assign({}, this.$route.query, extend) })
522552
.then(() => {
@@ -528,7 +558,7 @@ export default {
528558
// 展示快捷回复弹窗
529559
this.showComment = true;
530560
},
531-
updateCollection: function(val) {
561+
updateCollection: function (val) {
532562
this.collection_data = val;
533563
},
534564

0 commit comments

Comments
 (0)