Files
PetCommunity/miniprogram/types/index.ts
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

117 lines
1.9 KiB
TypeScript

export interface Pet {
_id: string
ownerId: string
name: string
species: 'dog' | 'cat' | 'other'
breed: string
gender: 'male' | 'female'
birthday?: string
age: string
emoji: string
photos: string[]
tags: string[]
bio?: string
}
export interface UserProfile {
_id: string
openid: string
nickName: string
avatarUrl: string
handle: string
location: string
bio: string
stats: {
posts: number
friends: number
likes: number
}
lastLocation?: GeoPoint
isOnline: boolean
lastSeen: string
pets: Pet[]
}
export interface GeoPoint {
latitude: number
longitude: number
}
export interface LocationTag {
name: string
latitude: number
longitude: number
address?: string
}
export interface Post {
_id: string
authorId: string
author?: UserProfile
petId?: string
pet?: Pet
content: string
images: string[]
video?: string
location?: LocationTag
hashtags: string[]
mood?: string
likeCount: number
commentCount: number
isLiked?: boolean
createdAt: string
}
export interface Comment {
_id: string
postId: string
authorId: string
author?: UserProfile
content: string
createdAt: string
}
export interface Message {
_id: string
fromId: string
from?: UserProfile
toId: string
content: string
type: 'greeting' | 'text' | 'image'
isRead: boolean
createdAt: string
}
export interface NearbyUser {
userId: string
user: UserProfile
pet: Pet
distance: number
distanceText: string
isOnline: boolean
lastSeenText: string
location: GeoPoint
}
export interface TabBarItem {
pagePath: string
text: string
icon: string
activeIcon: string
selected: boolean
}
export interface NavBarInfo {
statusBarHeight: number
navbarHeight: number
navbarPaddingRight: number
}
export interface AppGlobalData {
userInfo: UserProfile | null
isLoggedIn: boolean
currentLocation: GeoPoint | null
navBarInfo: NavBarInfo
_locationTimer: number | null
}