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 报错
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { NearbyUser } from '../../types/index'
|
||||
import { NearbyUser, AppGlobalData } from '../../types/index'
|
||||
import { api } from '../../utils/api'
|
||||
import { formatDistance, formatLastSeen, getAvatarGradient, getPetEmoji } from '../../utils/format'
|
||||
import { requireLocation } from '../../utils/auth'
|
||||
@@ -7,11 +7,13 @@ import { NEARBY_RADIUS_KM } from '../../utils/constants'
|
||||
const DEFAULT_LAT = 31.2304
|
||||
const DEFAULT_LNG = 121.4737
|
||||
|
||||
const app = getApp<{ userInfo: any; currentLocation: any }>()
|
||||
const app = getApp<{ globalData: AppGlobalData }>()
|
||||
|
||||
Page({
|
||||
data: {
|
||||
statusBarHeight: 0,
|
||||
navbarHeight: 44,
|
||||
navbarPaddingRight: 0,
|
||||
tabBarHeight: 56,
|
||||
viewMode: 'map' as 'map' | 'list',
|
||||
mapCenter: { latitude: DEFAULT_LAT, longitude: DEFAULT_LNG },
|
||||
@@ -29,7 +31,13 @@ Page({
|
||||
|
||||
onLoad() {
|
||||
const info = wx.getSystemInfoSync()
|
||||
this.setData({ statusBarHeight: info.statusBarHeight })
|
||||
const { statusBarHeight, navbarHeight, navbarPaddingRight } = app.globalData.navBarInfo
|
||||
this.setData({
|
||||
statusBarHeight,
|
||||
navbarHeight,
|
||||
navbarPaddingRight,
|
||||
tabBarHeight: info.windowHeight - (info.safeArea?.bottom ?? info.windowHeight) + 56,
|
||||
})
|
||||
this.initLocation()
|
||||
},
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<view class="nearby-page">
|
||||
<view class="safe-top" style="height: {{statusBarHeight}}px"></view>
|
||||
<!-- 状态栏占位 -->
|
||||
<view style="height: {{statusBarHeight}}px; flex-shrink: 0;"></view>
|
||||
|
||||
<!-- 顶栏 -->
|
||||
<view class="topbar">
|
||||
<!-- 主导航栏:与胶囊等高,右侧避让胶囊 -->
|
||||
<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>
|
||||
|
||||
@@ -6,11 +6,21 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 顶栏 */
|
||||
.topbar {
|
||||
/* 主导航栏:与胶囊等高,右侧避让胶囊 */
|
||||
.navbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 28rpx 12rpx;
|
||||
padding-left: 28rpx;
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
}
|
||||
|
||||
/* 次级菜单栏:胶囊下方,全宽 */
|
||||
.subbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8rpx 28rpx 12rpx;
|
||||
gap: 16rpx;
|
||||
flex-shrink: 0;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
|
||||
Reference in New Issue
Block a user