Files
PetCommunity/miniprogram/pages/post/post.wxml
2026-06-05 17:46:51 +08:00

137 lines
4.5 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 class="safe-top" style="height: {{statusBarHeight}}px"></view>
<!-- 顶部导航 -->
<view class="post-header">
<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>