refactor(消息功能): 移除留言相关功能并简化消息类型
移除留言标签页及相关消息类型处理逻辑 将消息类型简化为仅聊天和通知两种 更新空状态显示图标为Notice组件
Showing
2 changed files
with
8 additions
and
13 deletions
| ... | @@ -148,7 +148,7 @@ const messages = ref([]) | ... | @@ -148,7 +148,7 @@ const messages = ref([]) |
| 148 | * 初始化聊天消息 | 148 | * 初始化聊天消息 |
| 149 | */ | 149 | */ |
| 150 | const initChatMessages = () => { | 150 | const initChatMessages = () => { |
| 151 | - if (props.conversation?.type === 'message' || props.conversation?.type === 'chat') { | 151 | + if (props.conversation?.type === 'chat') { |
| 152 | // 模拟历史消息 | 152 | // 模拟历史消息 |
| 153 | messages.value = [ | 153 | messages.value = [ |
| 154 | { | 154 | { | ... | ... |
| ... | @@ -33,9 +33,6 @@ | ... | @@ -33,9 +33,6 @@ |
| 33 | @click="setActiveTab('notification')"> | 33 | @click="setActiveTab('notification')"> |
| 34 | 通知 | 34 | 通知 |
| 35 | </view> | 35 | </view> |
| 36 | - <view class="tab-item" :class="{ active: activeTab === 'message' }" @click="setActiveTab('message')"> | ||
| 37 | - 留言 | ||
| 38 | - </view> | ||
| 39 | </view> | 36 | </view> |
| 40 | </nut-sticky> | 37 | </nut-sticky> |
| 41 | 38 | ||
| ... | @@ -73,7 +70,7 @@ | ... | @@ -73,7 +70,7 @@ |
| 73 | <!-- 空状态提示 --> | 70 | <!-- 空状态提示 --> |
| 74 | <view v-if="filteredConversations.length === 0 && !loading && !hasMore" | 71 | <view v-if="filteredConversations.length === 0 && !loading && !hasMore" |
| 75 | class="empty-state py-8 text-center"> | 72 | class="empty-state py-8 text-center"> |
| 76 | - <Message size="48" color="#9ca3af" class="mb-4" /> | 73 | + <Notice size="48" color="#9ca3af" class="mb-4" /> |
| 77 | <text class="text-gray-500 text-base block mb-2">暂无消息</text> | 74 | <text class="text-gray-500 text-base block mb-2">暂无消息</text> |
| 78 | <text class="text-gray-400 text-sm">当前筛选条件下没有找到相关消息</text> | 75 | <text class="text-gray-400 text-sm">当前筛选条件下没有找到相关消息</text> |
| 79 | </view> | 76 | </view> |
| ... | @@ -100,7 +97,7 @@ | ... | @@ -100,7 +97,7 @@ |
| 100 | 97 | ||
| 101 | <script setup> | 98 | <script setup> |
| 102 | import { ref, computed, onMounted, markRaw } from 'vue' | 99 | import { ref, computed, onMounted, markRaw } from 'vue' |
| 103 | -import { Search2, Notice, Message } from '@nutui/icons-vue-taro' | 100 | +import { Search2, Notice } from '@nutui/icons-vue-taro' |
| 104 | import TabBar from '@/components/TabBar.vue' | 101 | import TabBar from '@/components/TabBar.vue' |
| 105 | import MessageDetail from '@/components/MessageDetail.vue' | 102 | import MessageDetail from '@/components/MessageDetail.vue' |
| 106 | import { $ } from '@tarojs/extend' | 103 | import { $ } from '@tarojs/extend' |
| ... | @@ -149,15 +146,15 @@ const initData = () => { | ... | @@ -149,15 +146,15 @@ const initData = () => { |
| 149 | 146 | ||
| 150 | // 生成更多初始数据确保可以滚动 | 147 | // 生成更多初始数据确保可以滚动 |
| 151 | for (let i = 1; i <= 15; i++) { | 148 | for (let i = 1; i <= 15; i++) { |
| 152 | - const types = ['chat', 'notification', 'message'] | 149 | + const types = ['chat', 'notification'] |
| 153 | - const type = types[i % 3] | 150 | + const type = types[i % 2] |
| 154 | 151 | ||
| 155 | mockData.push({ | 152 | mockData.push({ |
| 156 | id: i, | 153 | id: i, |
| 157 | - name: type === 'notification' ? '系统通知' : type === 'message' ? '客服留言' : `用户${i}`, | 154 | + name: type === 'notification' ? '系统通知' : `用户${i}`, |
| 158 | avatar: type === 'chat' ? `https://randomuser.me/api/portraits/men/${(i % 50) + 1}.jpg` : '', | 155 | avatar: type === 'chat' ? `https://randomuser.me/api/portraits/men/${(i % 50) + 1}.jpg` : '', |
| 159 | - icon: type === 'notification' ? markRaw(Notice) : type === 'message' ? markRaw(Message) : null, | 156 | + icon: type === 'notification' ? markRaw(Notice) : null, |
| 160 | - lastMessage: type === 'notification' ? '您有新的系统通知' : type === 'message' ? '感谢您的反馈' : `这是第${i}条消息内容`, | 157 | + lastMessage: type === 'notification' ? '您有新的系统通知' : `这是第${i}条消息内容`, |
| 161 | time: i <= 5 ? `${i * 5}分钟前` : i <= 10 ? `${i}小时前` : `${i - 10}天前`, | 158 | time: i <= 5 ? `${i * 5}分钟前` : i <= 10 ? `${i}小时前` : `${i - 10}天前`, |
| 162 | unread: Math.random() > 0.5, | 159 | unread: Math.random() > 0.5, |
| 163 | type: type | 160 | type: type |
| ... | @@ -176,8 +173,6 @@ const filteredConversations = computed(() => { | ... | @@ -176,8 +173,6 @@ const filteredConversations = computed(() => { |
| 176 | filtered = filtered.filter(conv => conv.unread) | 173 | filtered = filtered.filter(conv => conv.unread) |
| 177 | } else if (activeTab.value === 'notification') { | 174 | } else if (activeTab.value === 'notification') { |
| 178 | filtered = filtered.filter(conv => conv.type === 'notification') | 175 | filtered = filtered.filter(conv => conv.type === 'notification') |
| 179 | - } else if (activeTab.value === 'message') { | ||
| 180 | - filtered = filtered.filter(conv => conv.type === 'message') | ||
| 181 | } | 176 | } |
| 182 | 177 | ||
| 183 | // 根据搜索关键词过滤 | 178 | // 根据搜索关键词过滤 | ... | ... |
-
Please register or login to post a comment