Files
PetCommunity/miniprogram/pages/post/post.wxml
chenwu 3d21a9d297 fix: 修复评论/资料/导航胶囊/宠物档案/定位等多处问题,补全相关云函数
- 新增 addComment/getComments/getFollowList/followUser/getUser/updateProfile/updatePet/deletePet 云函数并完成部署
- 统一通过 app.globalData.navBarInfo 避让系统胶囊按钮(编辑资料/编辑宠物等页面保存按钮被遮挡问题)
- 编辑资料页所在城市改为省份 picker 选择
- 修复"我的"页动态为空(getUserPosts 应传 openid 而非数据库 _id)
- 重构编辑宠物页:品种改用 picker 滚轮(替代有数量上限的 actionSheet),标签改用 selectedTagSet 映射 + 自定义标签输入(5字以内、仅中英文/数字、最多8个)
- 接通宠物保存/删除真实云函数调用并同步本地缓存
- 移除 feed 页对不存在的 getStories 云函数调用,修复模拟器卡死
- 移除 post 页对不存在的 wx.reverseGeocoder API 的调用
- 统一扩展 AppGlobalData 类型并修正所有 getApp 调用的泛型,解决 TS 报错
2026-06-07 15:59:21 +08:00

138 lines
4.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<view class="post-page">
<!-- 状态栏占位 -->
<view style="height: {{statusBarHeight}}px; flex-shrink: 0;"></view>
<!-- 顶部导航:高度与胶囊等高,右侧 padding 避让胶囊 -->
<view class="post-header" style="height: {{navbarHeight}}px; padding-right: {{navbarPaddingRight}}px;">
<view class="cancel-btn" bindtap="onCancel">取消</view>
<view class="header-title">发布动态</view>
<view class="submit-btn {{canSubmit ? '' : 'submit-disabled'}}" bindtap="onSubmit">
{{submitting ? '发布中...' : '发布'}}
</view>
</view>
<scroll-view scroll-y="true" class="post-scroll" enhanced="true" show-scrollbar="false">
<view class="post-body">
<!-- 图片上传区 -->
<view class="upload-section">
<view wx:if="{{images.length === 0}}" class="upload-placeholder" bindtap="onChooseImage">
<view class="upload-icon">📷</view>
<text class="upload-hint">点击添加图片或视频</text>
<text class="upload-sub">最多9张</text>
</view>
<view wx:else class="image-grid">
<view
wx:for="{{images}}"
wx:key="index"
class="image-item"
bindtap="onPreviewImage"
data-idx="{{index}}"
>
<image class="img-preview" src="{{item.tempPath || item}}" mode="aspectFill" />
<view class="img-remove" catchtap="onRemoveImage" data-idx="{{index}}">×</view>
<view wx:if="{{item.uploading}}" class="img-uploading">
<view class="upload-spinner"></view>
</view>
</view>
<view wx:if="{{images.length < 9}}" class="image-add" bindtap="onChooseImage">
<text class="add-plus">+</text>
</view>
</view>
</view>
<!-- 文字输入 -->
<textarea
class="content-input"
placeholder="分享你和毛孩子的今天 🐾"
placeholder-class="input-placeholder"
value="{{content}}"
bindinput="onContentInput"
maxlength="500"
auto-height="true"
show-confirm-bar="false"
adjust-position="true"
cursor-spacing="120"
/>
<view class="word-count">{{content.length}}/500</view>
<!-- 位置标签 -->
<view class="section-title">📍 位置</view>
<view class="tag-row">
<view
class="tag-pill {{location ? 'tag-selected' : ''}}"
bindtap="onChooseLocation"
>
<text>{{location ? location.name : '添加位置'}}</text>
</view>
<view wx:if="{{location}}" class="tag-remove" bindtap="onRemoveLocation">×</view>
</view>
<!-- 关联宠物 -->
<view class="section-title">🐾 关联宠物</view>
<view class="tag-row">
<view
wx:for="{{myPets}}"
wx:key="_id"
class="tag-pill {{selectedPetId === item._id ? 'tag-selected' : ''}}"
bindtap="onSelectPet"
data-id="{{item._id}}"
>
<text>{{item.emoji}} {{item.name}}</text>
</view>
</view>
<!-- 话题标签 -->
<view class="section-title">🏷 话题</view>
<view class="hashtag-wrap">
<view class="hashtag-input-row">
<input
class="hashtag-input"
placeholder="输入话题..."
value="{{hashtagInput}}"
bindinput="onHashtagInput"
bindconfirm="onAddHashtag"
maxlength="20"
/>
<view class="hashtag-add-btn" bindtap="onAddHashtag">添加</view>
</view>
<view class="tag-row" style="margin-top: 16rpx;">
<view
wx:for="{{selectedHashtags}}"
wx:key="index"
class="hashtag-chip"
>
<text>#{{item}}</text>
<text class="chip-remove" catchtap="onRemoveHashtag" data-idx="{{index}}">×</text>
</view>
</view>
<view class="hot-tags">
<text class="hot-tags-label">热门:</text>
<view
wx:for="{{hotHashtags}}"
wx:key="index"
class="hot-tag"
bindtap="onHotTag"
data-tag="{{item}}"
>{{item}}</view>
</view>
</view>
<!-- 心情 -->
<view class="section-title">😊 心情</view>
<view class="mood-row">
<view
wx:for="{{moods}}"
wx:key="value"
class="mood-pill {{selectedMood === item.value ? 'mood-on' : ''}}"
bindtap="onSelectMood"
data-val="{{item.value}}"
>{{item.label}}</view>
</view>
<view style="height: 60rpx;"></view>
</view>
</scroll-view>
</view>