feat(chat): 添加私信功能和WebSocket实时通信

- 集成WebSocket管理器,支持心跳、自动重连、消息队列
- 实现私信相关API接口,包括会话列表、历史消息、已读标记等
- 添加聊天页面和会话列表页面,支持实时消息收发
- 配置地图权限和腾讯地图SDK用于酒局定位功能
- 修改应用名称为"喝酒了么"并更新应用描述
- 在App.vue中初始化WebSocket连接和私信功能
- 添加详细的私信模块接口文档和Mock数据
- 优化单图片动态高度计算和预加载逻辑
This commit is contained in:
cg
2026-07-21 21:27:01 +08:00
parent 0332aabba0
commit eaa0d7101f
14 changed files with 2112 additions and 38 deletions
+10
View File
@@ -1,6 +1,7 @@
<script>
import { getCurrentTheme, applyTheme } from './common/utils'
import client, { refreshAuthToken } from './common/api'
import wsManager from './common/websocket'
export default {
onLaunch() {
@@ -9,6 +10,8 @@ export default {
this.initTheme()
// 尝试刷新 token
this.restoreAuth()
// 初始化 WebSocket 连接(私信功能)
this.initWebSocket()
// 数据迁移:清除旧版 logo.png 头像引用
this.migrateUserData()
// 启动路由守卫
@@ -46,6 +49,13 @@ export default {
refreshAuthToken().catch(() => {})
}
},
// 初始化 WebSocket 连接(私信实时通信)
initWebSocket() {
const token = uni.getStorageSync('auth_token')
if (token) {
wsManager.connect(token)
}
},
// 数据迁移:清除旧版 logo.png 头像引用
migrateUserData() {
try {