feat(chat): 添加私信功能和WebSocket实时通信
- 集成WebSocket管理器,支持心跳、自动重连、消息队列 - 实现私信相关API接口,包括会话列表、历史消息、已读标记等 - 添加聊天页面和会话列表页面,支持实时消息收发 - 配置地图权限和腾讯地图SDK用于酒局定位功能 - 修改应用名称为"喝酒了么"并更新应用描述 - 在App.vue中初始化WebSocket连接和私信功能 - 添加详细的私信模块接口文档和Mock数据 - 优化单图片动态高度计算和预加载逻辑
This commit is contained in:
+13
-5
@@ -177,11 +177,22 @@ export default {
|
||||
// 动态计算卡片高度
|
||||
const drinks = rec.drinks || []
|
||||
const photoCount = (rec.photos || []).length
|
||||
let photoAreaH = 0
|
||||
const gap = 12
|
||||
const colW = (maxW - gap) / 2
|
||||
|
||||
// 预加载图片(获取宽高用于动态布局)
|
||||
const photos = rec.photos || []
|
||||
const imgs = photos.length > 0 ? await Promise.all(photos.map(p => this.loadImg(p))) : []
|
||||
|
||||
// 单图动态高度:按图片真实比例,限制在 200~560 之间
|
||||
let heroH = 340
|
||||
if (photoCount === 1 && imgs[0] && imgs[0].width && imgs[0].height) {
|
||||
heroH = Math.round(Math.min(560, Math.max(200, maxW * imgs[0].height / imgs[0].width)))
|
||||
}
|
||||
|
||||
let photoAreaH = 0
|
||||
if (photoCount === 0) photoAreaH = 240
|
||||
else if (photoCount === 1) photoAreaH = 340
|
||||
else if (photoCount === 1) photoAreaH = heroH
|
||||
else if (photoCount === 2) photoAreaH = colW
|
||||
else if (photoCount === 3) photoAreaH = 240 + gap + colW
|
||||
else if (photoCount === 4) photoAreaH = 2 * colW + gap
|
||||
@@ -252,11 +263,8 @@ export default {
|
||||
y += 50
|
||||
|
||||
// === 照片/图标区域 ===
|
||||
const photos = rec.photos || []
|
||||
if (photos.length > 0) {
|
||||
const imgs = await Promise.all(photos.map(p => this.loadImg(p)))
|
||||
if (photos.length === 1) {
|
||||
const heroH = 340
|
||||
ctx.save()
|
||||
this.rr(ctx, P, y, maxW, heroH, 24, 'fill')
|
||||
ctx.clip()
|
||||
|
||||
Reference in New Issue
Block a user