2e3345cdfc
修复雪花 ID 精度丢失(真 bug) - bottom-sheet 的 postId 声明为 Number,而 ID 是 18 位雪花字符串, 超出 JS 安全整数范围:339346584095428608 会被转成 ...600, 评论弹层实际查的是不存在的帖子。改为 String 记录 - 后端 DELETE /records/:id 早已就绪但前端从未调用,记错了删不掉。 时间轴支持长按删除 - 时间轴加类型筛选(体重/便便/饮食/异常/用药/疫苗/消费/照片), 后端 ?type= 本就支持 用户侧内容删除(UGC 合规:用户应能删除自己发布的内容) - 新增 DELETE /posts/:id 与 DELETE /comments/:id,仅限本人, 越权返回 40300;帖子软删除,评论删除同步递减 comment_count - 评论列表返回 is_self;社区长按自己的帖子、长按自己的评论可删 AI 聊天历史 - ai_messages 一直在写但没有查询接口,每次打开弹层都是空白。 新增 GET /api/ai/messages,弹层打开时接在开场白后加载 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
2.6 KiB
Plaintext
51 lines
2.6 KiB
Plaintext
<wxs module="im">
|
||
module.exports.isUrl = function (s) { return s && s.indexOf('http') === 0; }
|
||
</wxs>
|
||
<nav-bar title="宠友圈"></nav-bar>
|
||
|
||
<scroll-view class="page-scroll" scroll-y="{{true}}" enhanced="{{true}}" show-scrollbar="{{false}}">
|
||
<view class="page-body">
|
||
<view class="page-title">
|
||
<view class="pt-h2">宠友圈</view>
|
||
<view class="pt-p">和宠友交流、晒宠、求助与经验分享。</view>
|
||
</view>
|
||
|
||
<scroll-view class="feed-tabs" scroll-x="true" enhanced="{{true}}" show-scrollbar="{{false}}">
|
||
<view wx:for="{{feedTabs}}" wx:key="*this"
|
||
class="feed-tab {{feedIdx === index ? 'active' : ''}}" data-index="{{index}}" bindtap="switchFeedTab">{{item}}</view>
|
||
</scroll-view>
|
||
|
||
<view class="compose-card">
|
||
<button class="btn btn-primary btn-block" bindtap="openSheet" data-type="createPost">+ 发布图文</button>
|
||
</view>
|
||
|
||
<view wx:for="{{posts}}" wx:key="id" class="post-card" bindlongpress="onLongPressPost" data-index="{{index}}">
|
||
<view class="post-head">
|
||
<view class="post-avatar">{{item.author_emoji}}</view>
|
||
<view class="post-user"><text class="pu-b">{{item.author_name}}<text wx:if="{{item.is_ai}}" class="ai-tag">AI</text></text><text class="pu-s">宠友</text></view>
|
||
<view wx:if="{{!item.is_self && item.user_id}}" class="follow-btn {{item.followed ? 'on' : ''}}"
|
||
catchtap="toggleFollow" data-index="{{index}}">{{item.followed ? '已关注' : '+ 关注'}}</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"></image>
|
||
<view wx:else class="photo-tile">{{img}}</view>
|
||
</block>
|
||
</view>
|
||
<view class="post-actions">
|
||
<view class="pa-btn {{item.liked ? 'liked' : ''}}" data-index="{{index}}" bindtap="likePost">{{item.liked ? '♥' : '♡'}} {{item.like_count}}</view>
|
||
<view class="pa-btn" data-id="{{item.id}}" bindtap="openComments">💬 {{item.comment_count}}</view>
|
||
<button class="pa-btn pa-share" open-type="share" data-content="{{item.content}}">↗ 分享</button>
|
||
</view>
|
||
</view>
|
||
|
||
<view wx:if="{{posts.length === 0}}" class="empty-hint">还没有帖子,来发第一条吧 🐾</view>
|
||
</view>
|
||
</scroll-view>
|
||
|
||
<fab bind:tap="onFab"></fab>
|
||
<bottom-sheet show="{{sheetShow}}" type="{{sheetType}}" post-id="{{sheetPostId}}"
|
||
bind:close="closeSheet" bind:posted="onPosted" bind:commented="onCommented"></bottom-sheet>
|