hookehuyr

feat(消息中心): 优化消息中心功能并重命名相关文案

将"消息"统一改为"通知",优化搜索框提示文案
添加系统欢迎消息功能,当无消息时显示欢迎信息
将"发送消息"按钮文案改为"发送留言"
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
43 class="absolute top-0 right-0 bg-red-500 rounded-full w-2 h-2" 43 class="absolute top-0 right-0 bg-red-500 rounded-full w-2 h-2"
44 > 44 >
45 </div> 45 </div>
46 - <span class="text-xs mt-1">消息</span> 46 + <span class="text-xs mt-1">通知</span>
47 </view> 47 </view>
48 48
49 <!-- 我的 --> 49 <!-- 我的 -->
......
1 /* 1 /*
2 * @Date: 2025-07-01 17:55:00 2 * @Date: 2025-07-01 17:55:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-16 11:30:49 4 + * @LastEditTime: 2025-08-18 14:57:56
5 * @FilePath: /jgdl/src/pages/messages/index.config.js 5 * @FilePath: /jgdl/src/pages/messages/index.config.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 export default { 8 export default {
9 - navigationBarTitleText: '消息' 9 + navigationBarTitleText: '通知'
10 } 10 }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
8 </nut-col> --> 8 </nut-col> -->
9 <nut-col span="24"> 9 <nut-col span="24">
10 <!-- Search Bar --> 10 <!-- Search Bar -->
11 - <nut-searchbar v-model="searchValue" placeholder="按联系人名字/系统通知内容搜索" @blur="onBlurSearch" @clear="onBlurSearch" shape="round" 11 + <nut-searchbar v-model="searchValue" placeholder="按通知内容搜索" @blur="onBlurSearch" @clear="onBlurSearch" shape="round"
12 background="transparent" input-background="#ffffff"> 12 background="transparent" input-background="#ffffff">
13 <template #leftin> 13 <template #leftin>
14 <Search2 /> 14 <Search2 />
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
19 </view> 19 </view>
20 </view> 20 </view>
21 21
22 -
23 <nut-sticky> 22 <nut-sticky>
24 <!-- 状态筛选标签 --> 23 <!-- 状态筛选标签 -->
25 <view id="status-tabs" class="status-tabs"> 24 <view id="status-tabs" class="status-tabs">
...@@ -299,12 +298,46 @@ const initData = async () => { ...@@ -299,12 +298,46 @@ const initData = async () => {
299 create_time: item.create_time 298 create_time: item.create_time
300 })) 299 }))
301 300
302 - conversations.value = transformedData 301 + // 如果没有消息数据,添加系统欢迎消息
302 + if (transformedData.length === 0 && activeTab.value === 'all' && !searchValue.value) {
303 + const welcomeMessage = {
304 + id: 'welcome-system-message',
305 + name: '系统通知',
306 + avatar: '',
307 + icon: markRaw(Notice),
308 + lastMessage: '欢迎使用捡个电驴!您可以在这里查看系统通知和消息。',
309 + time: '刚刚',
310 + unread: false,
311 + type: 'system',
312 + create_time: Date.now(),
313 + isWelcome: true // 标记为欢迎消息
314 + }
315 + conversations.value = [welcomeMessage]
316 + } else {
317 + conversations.value = transformedData
318 + }
303 319
304 // 判断是否还有更多数据 320 // 判断是否还有更多数据
305 hasMore.value = transformedData.length === pageSize 321 hasMore.value = transformedData.length === pageSize
306 } else { 322 } else {
307 - conversations.value = [] 323 + // 如果API返回失败,也检查是否需要显示欢迎消息
324 + if (activeTab.value === 'all' && !searchValue.value) {
325 + const welcomeMessage = {
326 + id: 'welcome-system-message',
327 + name: '系统通知',
328 + avatar: '',
329 + icon: markRaw(Notice),
330 + lastMessage: '欢迎使用捡个电驴!您可以在这里查看系统通知和消息。',
331 + time: '刚刚',
332 + unread: false,
333 + type: 'system',
334 + create_time: Date.now(),
335 + isWelcome: true // 标记为欢迎消息
336 + }
337 + conversations.value = [welcomeMessage]
338 + } else {
339 + conversations.value = []
340 + }
308 hasMore.value = false 341 hasMore.value = false
309 } 342 }
310 } catch (error) { 343 } catch (error) {
...@@ -447,6 +480,18 @@ const onConversationClick = async (conversation) => { ...@@ -447,6 +480,18 @@ const onConversationClick = async (conversation) => {
447 try { 480 try {
448 loading.value = true 481 loading.value = true
449 482
483 + // 如果是欢迎消息,直接显示详情不调用API
484 + if (conversation.isWelcome) {
485 + selectedConversation.value = {
486 + ...conversation,
487 + content: '欢迎使用捡个电驴!\n\n这里是您的消息中心,您可以:\n• 查看系统通知和重要消息\n• 与其他用户进行聊天交流\n• 接收订单状态更新\n• 获取平台最新动态\n\n感谢您的使用!',
488 + name: '系统通知'
489 + }
490 + showMessageDetail.value = true
491 + loading.value = false
492 + return
493 + }
494 +
450 // 根据消息类型获取详情数据 495 // 根据消息类型获取详情数据
451 if (conversation.type === 'system') { 496 if (conversation.type === 'system') {
452 // 获取系统消息详情 497 // 获取系统消息详情
...@@ -473,8 +518,10 @@ const onConversationClick = async (conversation) => { ...@@ -473,8 +518,10 @@ const onConversationClick = async (conversation) => {
473 // 显示弹框 518 // 显示弹框
474 showMessageDetail.value = true 519 showMessageDetail.value = true
475 520
476 - // 标记为已读 521 + // 标记为已读(欢迎消息不需要标记已读)
477 - markAsRead(conversation.id) 522 + if (!conversation.isWelcome) {
523 + markAsRead(conversation.id)
524 + }
478 } catch (error) { 525 } catch (error) {
479 console.error('获取消息详情失败:', error) 526 console.error('获取消息详情失败:', error)
480 Taro.showToast({ 527 Taro.showToast({
...@@ -484,7 +531,9 @@ const onConversationClick = async (conversation) => { ...@@ -484,7 +531,9 @@ const onConversationClick = async (conversation) => {
484 // 即使失败也显示基本信息 531 // 即使失败也显示基本信息
485 selectedConversation.value = conversation 532 selectedConversation.value = conversation
486 showMessageDetail.value = true 533 showMessageDetail.value = true
487 - markAsRead(conversation.id) 534 + if (!conversation.isWelcome) {
535 + markAsRead(conversation.id)
536 + }
488 } finally { 537 } finally {
489 loading.value = false 538 loading.value = false
490 } 539 }
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-08-04 14:32:52 4 + * @LastEditTime: 2025-08-18 14:36:14
5 * @FilePath: /jgdl/src/pages/productDetail/index.vue 5 * @FilePath: /jgdl/src/pages/productDetail/index.vue
6 * @Description: 商品详情页 6 * @Description: 商品详情页
7 --> 7 -->
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
237 <nut-button @click="sendMessageToSeller" block type="primary" shape="round" color="orange" 237 <nut-button @click="sendMessageToSeller" block type="primary" shape="round" color="orange"
238 style="background-color: #f97316; border-color: #f97316; margin-top: 2rem;" 238 style="background-color: #f97316; border-color: #f97316; margin-top: 2rem;"
239 :disabled="!messageText.trim()"> 239 :disabled="!messageText.trim()">
240 - 发送消息 240 + 发送留言
241 </nut-button> 241 </nut-button>
242 </view> 242 </view>
243 </nut-popup> 243 </nut-popup>
......