lex 2 年之前
父節點
當前提交
d689f98201
共有 2 個文件被更改,包括 23 次插入4 次删除
  1. 21 1
      src/layout/components/components/conversation-list.vue
  2. 2 3
      src/layout/components/modal/chat.js

+ 21 - 1
src/layout/components/components/conversation-list.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="conversation-list">
+  <div class="conversation-list" style="height: 100%;">
     <!-- <div class="item"></div> -->
     <van-list
       v-model="loading"
@@ -30,6 +30,16 @@
               <el-image
                 :src="item.profile ? item.profile.portraitUri : ''"
                 class="user-img"
+                fit="cover"
+                @error="
+                  () => {
+                    // 图片加载失败,显示默认头像
+                    item.profile.portraitUri =
+                      item.profile.conversationType === 1
+                        ? teacherLogo
+                        : groupLogo;
+                  }
+                "
               />
             </el-badge>
           </template>
@@ -57,6 +67,13 @@
       </div>
     </van-list>
 
+    <el-empty
+      v-if="!list.length"
+      :image="emptyImg"
+      style="width: 100%;height: 100%"
+      description=" "
+    ></el-empty>
+
     <Contextmenu
       :dropdown="dropdown"
       :dropdownList="dropdownList"
@@ -102,6 +119,9 @@ export default {
   },
   data() {
     return {
+      emptyImg: require("../imkit/images/no-conversation.svg"),
+      teacherLogo,
+      groupLogo,
       conversationList: [],
       list: [],
       loading: false,

+ 2 - 3
src/layout/components/modal/chat.js

@@ -32,9 +32,8 @@ const getInitData = async list => {
       if (findItem.id) {
         tempItem.name = findItem.name;
         tempItem.portraitUri =
-          findItem.avatar || item.conversationType === 1
-            ? teacherLogo
-            : groupLogo;
+          findItem.avatar ||
+          (item.conversationType === 1 ? teacherLogo : groupLogo);
       } else {
         tempItem.name = "";
         tempItem.portraitUri =