Browse Source

样式优化

wkw 1 week ago
parent
commit
79346787c2
1 changed files with 17 additions and 4 deletions
  1. 17 4
      src/views/im/chat/index.vue

+ 17 - 4
src/views/im/chat/index.vue

@@ -17,7 +17,7 @@
             <!-- 头像 -->
             <van-image
               class="list-img"
-              :class="item.from === walletStore.account ? 'ml12' : 'mr12'"
+              :class="walletStore.account == item.toUsername ? 'mr12' : 'ml12'"
               round
               src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
               @click="router.push('personal')"
@@ -277,6 +277,10 @@ const goDetail = () => router.push("detail");
           font-weight: 400;
           font-size: 12px;
           color: #8d8d8d;
+          max-width: 70%;
+          display: flex;
+          flex-direction: column;
+          align-items: flex-start;
           .business-card {
             width: 199px;
             height: 93px;
@@ -310,17 +314,19 @@ const goDetail = () => router.push("detail");
             }
           }
           .content {
-            max-width: 230px;
-            background: #4d71ff;
+            background: #ffffff; // 对方消息背景白色
+            color: #000;
             border-radius: 10px;
             margin-top: 8px;
             padding: 8px 17px;
+            word-break: break-word;
+            white-space: pre-wrap;
+            max-width: 100%;
             font-family:
               PingFang SC,
               PingFang SC;
             font-weight: 400;
             font-size: 15px;
-            color: #ffffff;
           }
         }
       }
@@ -347,6 +353,13 @@ const goDetail = () => router.push("detail");
       .flex-reverse {
         flex-direction: row-reverse;
       }
+      .flex-reverse .list-cont {
+        align-items: flex-end;
+        .content {
+          background: #4d71ff; // 自己的消息是蓝色
+          color: #ffffff; // 白字
+        }
+      }
     }
   }
   .chat-list::-webkit-scrollbar {