hookehuyr

feat(message): 优化消息列表与详情页展示

### 消息列表页
- 优化消息项卡片布局,提升信息可读性
- 添加未读红点显示
- 改进标题和状态标签的视觉层级

### 消息详情页
- 添加富文本内容格式化功能
- 处理图片宽度自适应
- 处理文本换行显示

详细变更:
- src/pages/message/index.vue: 优化卡片布局和状态显示
- src/pages/message-detail/index.vue: 新增格式化功能
...@@ -173,13 +173,16 @@ const getProposalStatusText = (status) => { ...@@ -173,13 +173,16 @@ const getProposalStatusText = (status) => {
173 } 173 }
174 174
175 /** 175 /**
176 - * 格式化富文本内容,处理图片宽度等问题 176 + * 格式化富文本内容,处理图片宽度、文本换行等问题
177 */ 177 */
178 const formattedContent = computed(() => { 178 const formattedContent = computed(() => {
179 if (!detail.value?.note) return '' 179 if (!detail.value?.note) return ''
180 180
181 - // 简单的正则替换,确保图片宽度不超过容器 181 + // 1. 处理文本换行:将真正的换行符替换为 <br> 标签
182 - const content = detail.value.note.replace( 182 + let content = detail.value.note.replace(/\n/g, '<br>')
183 +
184 + // 2. 处理图片样式:确保图片宽度不超过容器
185 + content = content.replace(
183 /<img/g, 186 /<img/g,
184 '<img style="max-width:100%;height:auto;display:block;border-radius:8px;margin:10px 0;"' 187 '<img style="max-width:100%;height:auto;display:block;border-radius:8px;margin:10px 0;"'
185 ) 188 )
......
...@@ -29,17 +29,19 @@ ...@@ -29,17 +29,19 @@
29 @tap="handleItemClick(item)" 29 @tap="handleItemClick(item)"
30 > 30 >
31 <!-- 顶部:标题与红点 --> 31 <!-- 顶部:标题与红点 -->
32 - <view class="flex justify-between items-start mb-2"> 32 + <view class="mb-2">
33 - <view class="flex-1 mr-2 relative"> 33 + <view class="flex-1 relative">
34 <!-- 未读红点 --> 34 <!-- 未读红点 -->
35 <view v-if="item.status === 'send'" class="absolute -left-2 top-1.5 w-1.5 h-1.5 bg-red-500 rounded-full"></view> 35 <view v-if="item.status === 'send'" class="absolute -left-2 top-1.5 w-1.5 h-1.5 bg-red-500 rounded-full"></view>
36 <!-- 标题:使用 API 返回的 title --> 36 <!-- 标题:使用 API 返回的 title -->
37 - <text class="text-lg font-bold text-gray-900 leading-snug"> 37 + <text class="text-base font-bold text-gray-900 leading-snug text-justify">
38 {{ item.title || '暂无标题' }} 38 {{ item.title || '暂无标题' }}
39 </text> 39 </text>
40 </view> 40 </view>
41 + </view>
41 42
42 - <!-- 状态标签 --> 43 + <!-- 状态标签行:靠右对齐 -->
44 + <view class="flex justify-end mb-2">
43 <view v-if="item.status === 'send'" class="shrink-0 px-2 py-1 bg-red-50 text-red-600 rounded text-xs font-medium border border-red-100"> 45 <view v-if="item.status === 'send'" class="shrink-0 px-2 py-1 bg-red-50 text-red-600 rounded text-xs font-medium border border-red-100">
44 未读 46 未读
45 </view> 47 </view>
...@@ -50,7 +52,7 @@ ...@@ -50,7 +52,7 @@
50 52
51 <!-- 中间:内容预览 --> 53 <!-- 中间:内容预览 -->
52 <view class="mb-4"> 54 <view class="mb-4">
53 - <text class="text-sm text-gray-500 leading-relaxed"> 55 + <text class="text-xs text-gray-500 leading-relaxed">
54 {{ item.note ? '点击查看详情' : '暂无内容' }} 56 {{ item.note ? '点击查看详情' : '暂无内容' }}
55 </text> 57 </text>
56 </view> 58 </view>
......