feat(消息页面): 新增对话数据并调整样式
- 添加5条新的对话数据示例 - 为对话项增加间距和边框样式 - 将样式语言改为less并优化响应式布局
Showing
1 changed file
with
52 additions
and
3 deletions
| ... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
| 16 | <nut-tabs v-model="activeTab" @click="onTabClick"> | 16 | <nut-tabs v-model="activeTab" @click="onTabClick"> |
| 17 | <nut-tab-pane title="全部" pane-key="all"> | 17 | <nut-tab-pane title="全部" pane-key="all"> |
| 18 | <scroll-view class="conversation-list" scroll-y @scrolltolower="loadMore" :lower-threshold="50"> | 18 | <scroll-view class="conversation-list" scroll-y @scrolltolower="loadMore" :lower-threshold="50"> |
| 19 | - <view v-for="conversation in filteredConversations" :key="conversation.id" class="conversation-item" | 19 | + <view v-for="conversation in filteredConversations" :key="conversation.id" class="conversation-item mt-2 mb-4 border-b border-gray-100 pb-2" |
| 20 | @click="onConversationClick(conversation)"> | 20 | @click="onConversationClick(conversation)"> |
| 21 | <nut-row> | 21 | <nut-row> |
| 22 | <nut-col :span="4" class="avatar-container"> | 22 | <nut-col :span="4" class="avatar-container"> |
| ... | @@ -235,7 +235,54 @@ const initData = () => { | ... | @@ -235,7 +235,54 @@ const initData = () => { |
| 235 | time: '昨天', | 235 | time: '昨天', |
| 236 | unread: false, | 236 | unread: false, |
| 237 | type: 'message' | 237 | type: 'message' |
| 238 | - } | 238 | + }, |
| 239 | + { | ||
| 240 | + id: 6, | ||
| 241 | + name: '张三', | ||
| 242 | + avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | ||
| 243 | + lastMessage: '你好,这个商品还在吗?', | ||
| 244 | + time: '5分钟前', | ||
| 245 | + unread: true, | ||
| 246 | + type: 'chat' | ||
| 247 | + }, | ||
| 248 | + { | ||
| 249 | + id: 7, | ||
| 250 | + name: '李四', | ||
| 251 | + avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | ||
| 252 | + lastMessage: '价格可以商量吗?', | ||
| 253 | + time: '30分钟前', | ||
| 254 | + unread: false, | ||
| 255 | + type: 'chat' | ||
| 256 | + }, | ||
| 257 | + { | ||
| 258 | + id: 8, | ||
| 259 | + name: '系统通知', | ||
| 260 | + avatar: '', | ||
| 261 | + icon: markRaw(Notice), | ||
| 262 | + lastMessage: '您的商品已通过审核', | ||
| 263 | + time: '1小时前', | ||
| 264 | + unread: true, | ||
| 265 | + type: 'notification' | ||
| 266 | + }, | ||
| 267 | + { | ||
| 268 | + id: 9, | ||
| 269 | + name: '王五', | ||
| 270 | + avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | ||
| 271 | + lastMessage: '[图片]', | ||
| 272 | + time: '2小时前', | ||
| 273 | + unread: true, | ||
| 274 | + type: 'chat' | ||
| 275 | + }, | ||
| 276 | + { | ||
| 277 | + id: 10, | ||
| 278 | + name: '客服留言', | ||
| 279 | + avatar: '', | ||
| 280 | + icon: markRaw(Message), | ||
| 281 | + lastMessage: '感谢您的反馈,我们会尽快处理', | ||
| 282 | + time: '昨天', | ||
| 283 | + unread: false, | ||
| 284 | + type: 'message' | ||
| 285 | + }, | ||
| 239 | ] | 286 | ] |
| 240 | 287 | ||
| 241 | conversations.value = mockData | 288 | conversations.value = mockData |
| ... | @@ -328,7 +375,7 @@ onMounted(() => { | ... | @@ -328,7 +375,7 @@ onMounted(() => { |
| 328 | }) | 375 | }) |
| 329 | </script> | 376 | </script> |
| 330 | 377 | ||
| 331 | -<style scoped> | 378 | +<style lang="less" scoped> |
| 332 | .messages-page { | 379 | .messages-page { |
| 333 | min-height: 100vh; | 380 | min-height: 100vh; |
| 334 | background-color: #f5f5f5; | 381 | background-color: #f5f5f5; |
| ... | @@ -346,6 +393,7 @@ onMounted(() => { | ... | @@ -346,6 +393,7 @@ onMounted(() => { |
| 346 | padding: 24rpx 20rpx; | 393 | padding: 24rpx 20rpx; |
| 347 | border-bottom: 1rpx solid #f0f0f0; | 394 | border-bottom: 1rpx solid #f0f0f0; |
| 348 | transition: background-color 0.2s; | 395 | transition: background-color 0.2s; |
| 396 | + margin: 20rpx 0; | ||
| 349 | } | 397 | } |
| 350 | 398 | ||
| 351 | .avatar-container { | 399 | .avatar-container { |
| ... | @@ -551,6 +599,7 @@ onMounted(() => { | ... | @@ -551,6 +599,7 @@ onMounted(() => { |
| 551 | @media (max-width: 750rpx) { | 599 | @media (max-width: 750rpx) { |
| 552 | .conversation-item { | 600 | .conversation-item { |
| 553 | padding: 20rpx 16rpx; | 601 | padding: 20rpx 16rpx; |
| 602 | + margin: 16rpx 0; | ||
| 554 | } | 603 | } |
| 555 | 604 | ||
| 556 | .w-12 { | 605 | .w-12 { | ... | ... |
-
Please register or login to post a comment