Files
PetCommunity/miniprogram/pages/nearby/nearby.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

148 lines
5.2 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="nearby-page">
<!-- 状态栏占位 -->
<view style="height: {{statusBarHeight}}px; flex-shrink: 0;"></view>
<!-- 主导航栏:与胶囊等高,右侧避让胶囊 -->
<view class="navbar" style="height: {{navbarHeight}}px; padding-right: {{navbarPaddingRight}}px;">
<view class="topbar-logo">附<text class="logo-accent">近</text></view>
</view>
<!-- 次级菜单栏:位于胶囊下方,全宽可用 -->
<view class="subbar">
<view class="view-toggle">
<view class="toggle-btn {{viewMode === 'map' ? 'toggle-active' : ''}}" bindtap="setViewMode" data-mode="map">🗺 地图</view>
<view class="toggle-btn {{viewMode === 'list' ? 'toggle-active' : ''}}" bindtap="setViewMode" data-mode="list">📋 列表</view>
</view>
<view class="topbar-btn" bindtap="onFilter">⚙️</view>
</view>
<!-- 地图视图 -->
<view wx:if="{{viewMode === 'map'}}" class="map-wrap">
<map
class="map"
id="petMap"
latitude="{{mapCenter.latitude}}"
longitude="{{mapCenter.longitude}}"
scale="{{mapScale}}"
markers="{{markers}}"
circles="{{circles}}"
show-location="true"
enable-zoom="true"
enable-scroll="true"
enable-rotate="false"
show-compass="false"
bindmarkertap="onMarkerTap"
bindregionchange="onRegionChange"
></map>
<!-- 地图控件 -->
<view class="map-controls">
<view class="map-ctrl-btn" bindtap="onLocateMe">📍</view>
<view class="map-ctrl-btn" bindtap="onZoomIn">+</view>
<view class="map-ctrl-btn" bindtap="onZoomOut"></view>
</view>
<!-- 宠物弹窗 -->
<view wx:if="{{activePet}}" class="pet-popup" bindtap="onPopupTap">
<view class="popup-avatar" style="background: {{activePet.gradient}}">
<text>{{activePet.emoji}}</text>
</view>
<view class="popup-info">
<text class="popup-name">{{activePet.petName}}</text>
<text class="popup-sub">{{activePet.breed}} · {{activePet.distanceText}}</text>
</view>
<view class="popup-hi btn-primary" catchtap="onGreeting" data-uid="{{activePet.userId}}" data-pid="{{activePet.petId}}">
打招呼 👋
</view>
</view>
<!-- 在线数 -->
<view class="online-badge">{{onlineCount}}只在线</view>
</view>
<!-- 列表视图 -->
<scroll-view
wx:if="{{viewMode === 'list'}}"
class="list-scroll"
scroll-y="true"
enhanced="true"
show-scrollbar="false"
bindscrolltolower="onLoadMore"
refresher-enabled="true"
bindrefresherrefresh="onRefresh"
refresher-triggered="{{refreshing}}"
>
<view class="list-header">
<text class="list-title">附近的汪</text>
<view class="online-chip">{{onlineCount}}只在线</view>
</view>
<!-- 骨架 -->
<view wx:if="{{loading && nearbyList.length === 0}}">
<view wx:for="{{[1,2,3,4]}}" wx:key="index" class="nearby-skeleton"></view>
</view>
<!-- 列表项 -->
<view
wx:for="{{nearbyList}}"
wx:key="userId"
class="nearby-item"
bindtap="onItemTap"
data-uid="{{item.userId}}"
>
<view class="nearby-avatar" style="background: {{item.gradient}}">
<text class="avatar-emoji">{{item.emoji}}</text>
</view>
<view class="nearby-info">
<view class="nearby-name-row">
<text class="nearby-pet-name">{{item.petName}}</text>
<view class="breed-chip">{{item.breed}}</view>
</view>
<view class="nearby-sub">
<view wx:if="{{item.isOnline}}" class="online-dot"></view>
<text>{{item.lastSeenText}} · {{item.locationName}}</text>
</view>
</view>
<view class="nearby-right">
<text class="dist-text">{{item.distanceText}}</text>
<view class="say-hi" catchtap="onGreeting" data-uid="{{item.userId}}" data-pid="{{item.petId}}">打招呼</view>
</view>
</view>
<!-- 空态 -->
<view wx:if="{{!loading && nearbyList.length === 0}}" class="empty-nearby">
<text class="empty-emoji">🐾</text>
<text class="empty-title">附近暂时没有汪</text>
<text class="empty-desc">去广场发帖,等小伙伴们上线吧~</text>
</view>
<view style="height: {{tabBarHeight}}px"></view>
</scroll-view>
<!-- 地图模式下的底部列表预览 -->
<view wx:if="{{viewMode === 'map'}}" class="map-preview-list">
<scroll-view scroll-x="true" enhanced="true" show-scrollbar="false" class="preview-scroll">
<view
wx:for="{{nearbyList}}"
wx:key="userId"
class="preview-card"
bindtap="onPreviewTap"
data-uid="{{item.userId}}"
data-lat="{{item.latitude}}"
data-lng="{{item.longitude}}"
>
<view class="preview-avatar" style="background: {{item.gradient}}">
<text>{{item.emoji}}</text>
</view>
<view class="preview-info">
<text class="preview-name">{{item.petName}}</text>
<text class="preview-dist">{{item.distanceText}}</text>
</view>
<view wx:if="{{item.isOnline}}" class="online-dot" style="width:12rpx;height:12rpx;"></view>
</view>
</scroll-view>
</view>
<view style="height: {{tabBarHeight}}px" wx:if="{{viewMode === 'list'}}"></view>
</view>