Skip to content

Commit 9c3917c

Browse files
committed
update: add recent topic list in the user profile
1 parent 4256501 commit 9c3917c

File tree

7 files changed

+74
-55
lines changed

7 files changed

+74
-55
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Component({
2+
properties: {
3+
list: {
4+
type: Array,
5+
value: []
6+
}
7+
},
8+
data: {},
9+
methods: {}
10+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"component": true
3+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<view class="topic-list">
2+
<navigator
3+
class="topic-item"
4+
wx:for="{{list}}"
5+
wx:key="{{index}}"
6+
url="/pages/topic/topic?id={{item.id}}"
7+
>
8+
<navigator class="topic-left inbl vtal-top rounded-p50" url="/pages/user/user?name={{item.author.loginname}}" hover-stop-propagation="{{true}}">
9+
<image class="w-p100 h-p100 rounded-p50" src="{{item.author.avatar_url}}"/>
10+
</navigator>
11+
<view class="topic-right inbl vtal-top">
12+
<view class="topic-title text-ellipsis">{{item.title}}</view>
13+
<view class="clf color-grey">
14+
<view class="fl-left">{{item.author.loginname}}</view>
15+
<view class="fl-right">{{item.last_reply_at}}</view>
16+
</view>
17+
</view>
18+
</navigator>
19+
</view>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@import '/style/base.wxss';
2+
3+
.topic-item {
4+
padding: 30rpx;
5+
margin-bottom: 10rpx;
6+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
7+
border-radius: 8rpx;
8+
}
9+
.topic-left {
10+
width: 100rpx;
11+
height: 100rpx;
12+
}
13+
.topic-right {
14+
width: 520rpx;
15+
margin-left: 30rpx;
16+
font-size: 28rpx;
17+
}
18+
.topic-title {
19+
margin-bottom: 20rpx;
20+
font-size: 32rpx;
21+
}

src/pages/user/user.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{}
1+
{
2+
"usingComponents": {
3+
"topic-list": "./components/topic-list/topic-list"
4+
}
5+
}

src/pages/user/user.wxml

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,21 @@
2323
<view>{{item.text}}</view>
2424
</view>
2525
</view>
26-
<!-- 最近回复列表 -->
27-
<block wx:if="{{nActiveTabIndex === 0}}">
28-
<view class="recent-reply-list" >
29-
<!-- TODO: 点击头像跳转用户资料页,点击文字跳转话题详情 -->
30-
<view class="reply-item" wx:for="{{oUserProfile.recent_replies}}" wx:key="{{index}}">
31-
<image class="reply-left inbl vtal-top rounded-p50" src="{{item.author.avatar_url}}"/>
32-
<view class="reply-right inbl vtal-top">
33-
<view class="reply-topic-title text-ellipsis">{{item.title}}</view>
34-
<view class="clf color-grey">
35-
<view class="fl-left">{{item.author.loginname}}</view>
36-
<view class="fl-right">{{item.last_reply_at}}</view>
37-
</view>
38-
</view>
26+
<view class="topic-list-wrap">
27+
<!-- 最近回复列表 -->
28+
<block wx:if="{{nActiveTabIndex === 0}}">
29+
<topic-list list="{{oUserProfile.recent_replies}}"></topic-list>
30+
</block>
31+
<!-- 最新发布话题列表 -->
32+
<block wx:elif="{{nActiveTabIndex === 1}}">
33+
<topic-list list="{{oUserProfile.recent_topics}}"></topic-list>
34+
</block>
35+
<!-- TODO: 话题收藏列表 -->
36+
<block wx:elif="{{nActiveTabIndex === 2}}">
37+
<view class="topic-collection-list ta-c">
38+
<view>敬请期待</view>
3939
</view>
40-
</view>
41-
</block>
42-
<!-- TODO: 最新发布列表 -->
43-
<block wx:elif="{{nActiveTabIndex === 1}}">
44-
<view class="recent-topic-list ta-c">
45-
<view>敬请期待</view>
46-
</view>
47-
</block>
48-
<!-- TODO: 话题收藏列表 -->
49-
<block wx:elif="{{nActiveTabIndex === 2}}">
50-
<view class="topic-collection-list ta-c">
51-
<view>敬请期待</view>
52-
</view>
53-
</block>
40+
</block>
41+
</view>
5442
</view>
5543
</view>

src/pages/user/user.wxss

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,9 @@
3434
.tabbar-wrap .tab.tab-active {
3535
border-color: #80bd01;
3636
}
37-
/* 最近回复列表 */
38-
.recent-reply-list {
37+
.topic-list-wrap {
3938
padding: 30rpx 20rpx;
4039
}
41-
.reply-item {
42-
padding: 30rpx;
43-
margin-bottom: 10rpx;
44-
/* border-bottom: 0.01rem solid #7c7c7c; */
45-
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
46-
border-radius: 8rpx;
47-
}
48-
.reply-left {
49-
width: 100rpx;
50-
height: 100rpx;
51-
}
52-
.reply-right {
53-
width: 520rpx;
54-
margin-left: 30rpx;
55-
font-size: 28rpx;
56-
}
57-
.reply-topic-title {
58-
margin-bottom: 20rpx;
59-
font-size: 32rpx;
60-
}
61-
/* 最近话题列表 */
62-
.recent-topic-list {
63-
padding: 30rpx 20rpx;
64-
font-size: 28rpx;
65-
}
6640
/* 话题收藏列表 */
6741
.topic-collection-list {
6842
padding: 30rpx 20rpx;

0 commit comments

Comments
 (0)