Files
sundynix-pets/pets-fe/pages/user/user.wxml
T
Blizzard 3ad1516aa4 fix(fe): 按钮长文案撑爆 + 用户主页帖子没样式 + 首字头像空白
三个都是我上一轮引入或没顾上的。

## 「Pro 会员(即将开放)」把按钮撑爆

.btn 同时用了 flex 垂直居中和 line-height:96rpx。flex 已经负责居中了,
line-height 纯属多余,而且文案一换行就被这个固定行高顶到按钮外面——
「我的」页底部那颗按钮正好触发。改成 min-height + line-height:1.3,
按钮能随文案长高,短文案的高度不变。

## 用户主页的帖子没有任何样式

.post-card 那一整套只写在 pages/community/community.wxss 里,而页面级
wxss 不跨页生效,所以用户主页上的帖子退化成裸文本。整块提到 app.wxss。
顺带给主页的帖子补上作者行和标签,和社区保持一致。

## 头像圈里空白

WXML 表达式不支持字符串下标,{{nickname[0]}} 求值为空。改成在 js 里
slice 好再传给模板。

另外确认一下:粉丝列表本来就能点进主页——关注和粉丝共用 pages/relations
一个页面,每行都绑了 goUser,和关注列表走同一个 pages/user 主页。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 17:19:18 +08:00

61 lines
2.9 KiB
Plaintext

<wxs module="im">
module.exports.isUrl = function (s) { return s && s.indexOf('http') === 0; }
</wxs>
<nav-bar title="{{card ? card.nickname : '宠友主页'}}" show-back="{{true}}"></nav-bar>
<scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}"
bindscrolltolower="loadMore">
<view class="page-body no-fab">
<view wx:if="{{loading}}" class="empty lg">加载中…</view>
<block wx:elif="{{card}}">
<view class="card u-head">
<view class="u-av">
<image wx:if="{{card.avatar_url}}" class="u-av-img" src="{{card.avatar_url}}" mode="aspectFill"></image>
<block wx:else>{{card.initial}}</block>
</view>
<view class="u-name">{{card.nickname}}<text wx:if="{{card.is_bot}}" class="ai-tag">AI</text></view>
<view class="u-stats">
<view class="u-stat"><text class="u-n">{{card.post_count}}</text><text class="u-l">帖子</text></view>
<view class="u-stat" data-kind="following" bindtap="goRelations">
<text class="u-n">{{card.following_count}}</text><text class="u-l">关注</text>
</view>
<view class="u-stat" data-kind="followers" bindtap="goRelations">
<text class="u-n">{{card.follower_count}}</text><text class="u-l">粉丝</text>
</view>
</view>
<view wx:if="{{!card.is_self}}" class="btn {{card.followed ? 'btn-ghost' : 'btn-dark'}} btn-block" bindtap="toggleFollow">
<pt-icon wx:if="{{!card.followed}}" name="plus" size="{{28}}"></pt-icon>{{card.followed ? '已关注' : '关注 TA'}}
</view>
</view>
<view wx:for="{{posts}}" wx:key="id" class="post-card">
<view class="post-head">
<view class="post-avatar">{{item.author_emoji}}</view>
<view class="post-user">
<view class="pu-b">{{item.author_name}}</view>
<view class="pu-s">{{item.timeText}}</view>
</view>
<view wx:if="{{item.tag}}" class="tag {{item.tagClass}}">{{item.tag}}</view>
</view>
<view class="post-content">{{item.content}}</view>
<view wx:if="{{item.images.length}}" class="photo-grid">
<block wx:for="{{item.images}}" wx:for-item="img" wx:key="*this">
<image wx:if="{{im.isUrl(img)}}" class="photo-tile" src="{{img}}" mode="aspectFill"
bindtap="previewImage" data-urls="{{item.images}}" data-cur="{{img}}"></image>
<view wx:else class="photo-tile">{{img}}</view>
</block>
</view>
<view class="post-actions">
<view class="pa-btn"><pt-icon name="like" size="{{32}}"></pt-icon><text class="pa-n">{{item.like_count || 0}}</text></view>
<view class="pa-btn"><pt-icon name="comment" size="{{32}}"></pt-icon><text class="pa-n">{{item.comment_count || 0}}</text></view>
</view>
</view>
<view wx:if="{{!posts.length}}" class="empty lg">TA 还没有发过帖子</view>
</block>
</view>
</scroll-view>