Skip to content

Commit e610e04

Browse files
committed
update: optimize home page and topic detail style
1 parent a8fb9d7 commit e610e04

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

src/components/topic-item/topic-item.wxss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
.topic-container {
22
padding: 25rpx;
33
background: #ffffff;
4-
margin-bottom: 15rpx;
4+
margin-bottom: 20rpx;
55
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
6+
border-radius: 8rpx;
67
}
78
/* 头部 */
89
.topic-container .topic-header {

src/components/wemark/wemark.wxss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.wemark_wrapper{
44
margin:10px 0;
5-
font-size:32rpx;
5+
font-size:30rpx;
66
line-height: 1.8em;
77
}
88
.wemark_block_h1{

src/pages/index/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Page({
22
data: {
33
bIsReady: false, // 页面是否准备就绪
44
nActiveTabIndex: 0, // 当前处于活动状态的tab
5+
nContentLen: 60, // 主题卡片显示正文的长度
56
aTabBarList: [
67
{
78
text: '全部',
@@ -71,10 +72,10 @@ Page({
7172
return sNewText;
7273
},
7374
// 格式化主题内容为摘要形式
74-
fnFmtTopicContentToSummary(sContent, nLen = 120) {
75+
fnFmtTopicContentToSummary(sContent, nContentLen = 60) {
7576
sContent = this.fnFilterHtmlTag(sContent);
7677
// 将主题内容,截取指定长度字符作为摘要
77-
return sContent.slice(0, nLen);
78+
return sContent.slice(0, nContentLen);
7879
},
7980
/**
8081
* 获取主题列表
@@ -130,7 +131,7 @@ Page({
130131
visit_count: oItem.visit_count, // 访问数
131132
last_reply_at: wx.moment(oItem.last_reply_at).fromNow(), // 最后一次回复时间
132133
title: oItem.title, // 标题
133-
content: this.fnFmtTopicContentToSummary(oItem.content), // 内容
134+
content: this.fnFmtTopicContentToSummary(oItem.content, this.data.nContentLen), // 内容
134135
avatar_url: oItem.author.avatar_url, // 作者头像
135136
loginname: oItem.author.loginname, // 作者名称
136137
create_at: wx.moment(oItem.create_at).format('YYYY-MM-DD HH:mm:ss') // 创建时间

src/pages/index/index.wxml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
<text>{{item.text}}</text>
1313
</view>
1414
</view>
15-
<topic-list data="{{aTopicList}}"></topic-list>
15+
<view class="topic-list-wrap">
16+
<topic-list data="{{aTopicList}}"></topic-list>
17+
</view>
1618
</view>

src/pages/index/index.wxss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@
2323
.topic-tabbar .topic-tabbar-item.topic-tabbar-item-active {
2424
color: #80bd01;
2525
font-weight: 500;
26+
}
27+
.topic-list-wrap {
28+
padding: 20rpx
2629
}

src/pages/topic/topic.wxss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.topic-container {
2+
padding: 20rpx;
23
}
34
.topic-main {
45
padding: 30rpx;
5-
margin-bottom: 12rpx;
6+
margin-bottom: 20rpx;
67
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
8+
border-radius: 8rpx;
79
}
810
.topic-info {
911
padding-top: 20rpx;
@@ -23,6 +25,7 @@
2325
padding-top: 20rpx;
2426
padding-bottom: 20rpx;
2527
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
28+
border-radius: 8rpx;
2629
}
2730
.topic-comment-list-header {
2831
padding: 20rpx;

0 commit comments

Comments
 (0)