2 Commit-ok 751969ee94 ... 0216bea611

Szerző SHA1 Üzenet Dátum
  mazhenhang 0216bea611 Merge branch 'mzh' into test_dev 3 hete
  mazhenhang 1329883d91 聊天页面跳转用户详情 3 hete
1 módosított fájl, 41 hozzáadás és 1 törlés
  1. 41 1
      LiangZhiYUMao/pages/message/chat.vue

+ 41 - 1
LiangZhiYUMao/pages/message/chat.vue

@@ -89,7 +89,8 @@
           <image 
             class="avatar" 
             :src="msg.fromUserId === userId ? userAvatar : targetUserAvatar" 
-            mode="aspectFill" />
+            mode="aspectFill"
+            @click="goToUserDetail(msg.fromUserId)" />
           
           <!-- 消息内容 -->
           <view class="message-content-wrapper">
@@ -1558,6 +1559,45 @@ export default {
       });
     },
     
+    /**
+     * 跳转到用户详情页面
+     */
+    goToUserDetail(userId) {
+      // 检查是否为红娘ID(以m_开头)
+      if (typeof userId === 'string' && userId.startsWith('m_')) {
+        console.log('点击的是红娘头像,不跳转');
+        return;
+      }
+      
+      // 将字符串类型的userId转换为数字
+      let numericUserId = userId;
+      if (typeof userId === 'string') {
+        numericUserId = parseInt(userId);
+      }
+      
+      // 验证userId是否有效
+      if (!numericUserId || isNaN(numericUserId)) {
+        uni.showToast({
+          title: '用户信息无效',
+          icon: 'none'
+        });
+        return;
+      }
+      
+      console.log('跳转到用户详情页面,userId:', numericUserId);
+      
+      uni.navigateTo({
+        url: `/pages/recommend/user-detail?userId=${numericUserId}`,
+        fail: (err) => {
+          console.error('跳转用户详情页失败:', err);
+          uni.showToast({
+            title: '跳转失败',
+            icon: 'none'
+          });
+        }
+      });
+    },
+    
     /**
      * 显示消息操作菜单
      */