miniprogramme/config/config.js
2025-09-12 16:08:17 +08:00

164 lines
No EOL
4.7 KiB
JavaScript
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.

// 小程序配置文件 - 对应Fl`utter的app_config.dart
module.exports = {
// 应用信息
appName: "FindMe",
appVersion: "1.0.0",
// API配置 - 使用正确的域名
api: {
baseUrl: "https://api.faxianwo.me",
timeout: 15000
},
// WebSocket配置 - 使用正确的WebSocket路径
websocket: {
baseUrl: "wss://api.faxianwo.me",
url: "wss://api.faxianwo.me/api/v1/ws", // 🔥 恢复正确的WebSocket路径
heartbeatInterval: 30000, // 30秒
reconnectBaseDelay: 2000, // 重连基础延迟
maxReconnectAttempts: 10 // 最大重连次数
},
// 高德地图配置
//amapKey: '55e1d9a4c6c0f9fa4c75656fe3060641',
amapKey: '9212b693317725fca66ae697ec444fd5',
// 网络超时设置 (保持向后兼容)
networkTimeout: {
request: 15000,
upload: 60000,
download: 60000
},
// 位置刷新间隔
locationUpdateInterval: 30000, // 30秒
// 文件大小限制 (小程序有自己的限制,这里作为前端验证)
fileSizeLimit: {
image: 10 * 1024 * 1024, // 10MB
video: 50 * 1024 * 1024, // 50MB
audio: 5 * 1024 * 1024, // 5MB
file: 50 * 1024 * 1024 // 50MB
},
// 支持的文件类型
supportedFileTypes: {
image: ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'],
video: ['mp4', 'avi', 'wmv', 'mov', '3gp'],
audio: ['mp3', 'wav', 'ogg', 'aac', 'm4a']
},
// 缓存设置
cache: {
maxAge: 7 * 24 * 60 * 60, // 7天
resourceExpireTime: {
image: 4 * 3600, // 4小时
video: 2 * 3600, // 2小时
audio: 2 * 3600, // 2小时
file: 1 * 3600, // 1小时
avatar: 24 * 3600 // 24小时
}
},
// API端点路径
apiPaths: {
// 身份验证相关统一使用user路径
auth: {
sendVerifyCode: '/api/v1/user/send-verify-code',
login: '/api/v1/user/login',
wechatLogin: '/api/v1/user/wechat-login',
refresh: '/api/v1/auth/refresh',
logout: '/api/v1/user/logout'
},
// 用户相关
user: {
profile: '/api/v1/user/profile',
updateProfile: '/api/v1/user/profile',
setting: '/api/v1/user/setting',
bindPhone: '/api/v1/user/bind-phone',
detectMerge: '/api/v1/user/detect-merge',
mergeAccount: '/api/v1/user/merge-account'
},
// 位置相关
location: {
update: '/api/v1/location/update',
getFriends: '/api/v1/location/friends',
getStrangers: '/api/v1/location/strangers',
privacy: '/api/v1/location/privacy'
},
// 聊天相关 - 根据接口文档修正API路径
chat: {
conversations: '/api/v1/chat/conversations',
history: '/api/v1/chat/history', // 修正:使用正确的历史消息接口
messages: '/api/v1/chat/history', // 保持向后兼容
send: '/api/v1/chat/send',
batchRead: '/api/v1/chat/batch-read', // 新增:批量已读
markAllRead: '/api/v1/chat/mark-all-read', // 新增:全部已读
unreadTotal: '/api/v1/chat/unread/total', // 新增:总未读数
settings: '/api/v1/chat/settings', // 新增:聊天设置
backup: '/api/v1/chat/backup', // 新增:备份
restore: '/api/v1/chat/restore', // 新增:恢复
danmaku: '/api/v1/chat/danmaku', // 新增:弹幕
emoji: '/api/v1/chat/emoji/packages', // 新增:表情包
syncPull: '/api/v1/chat/sync/pull', // 新增:同步拉取
syncAck: '/api/v1/chat/sync/ack', // 新增:同步确认
upload: '/api/v1/file/upload'
},
// 社交相关
social: {
friends: '/api/v1/social/friends',
addFriend: '/api/v1/social/friend/add',
acceptFriend: '/api/v1/social/friend/handle-request',
deleteFriend: '/api/v1/social/friend',
search: '/api/v1/social/search',
friendRequests: '/api/v1/social/friend/requests',
friendRequestsCount: '/api/v1/social/friend/requests/count',
groups: '/api/v1/social/groups',
groupsCount: '/api/v1/social/groups/count'
},
},
// 小程序特有配置
miniprogram: {
// 页面路径
pages: {
splash: '/pages/splash/splash',
login: '/pages/login/login',
main: '/pages/main/main',
map: '/pages/map/map',
friends: '/pages/social/friends/friends',
message: '/pages/message/message',
profile: '/pages/profile/profile'
},
// 主题配置
theme: {
primaryColor: '#3cc51f',
backgroundColor: '#F5F5F5',
textColor: '#333333',
subTextColor: '#999999'
},
// 地图配置
map: {
defaultZoom: 16,
minZoom: 3,
maxZoom: 20,
showLocation: true,
showScale: true,
showCompass: true
}
},
// 调试配置
debug: {
enabled: true,
showLog: true,
mockData: false
}
};