linwenxin 1 سال پیش
والد
کامیت
f78e2867cd
2فایلهای تغییر یافته به همراه20 افزوده شده و 6 حذف شده
  1. 3 1
      src/pages/message/index.vue
  2. 17 5
      src/pages/message/msgView.vue

+ 3 - 1
src/pages/message/index.vue

@@ -15,7 +15,9 @@
             <view class="message_user_info">
               <!-- 头像 -->
               <view class="user_head">
-                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.userPic"></image>
+                <image v-if="item.userPic" style="width: 100%; height: 100%;" mode="aspectFill"
+                  :src="imageUrl + item.userPic"></image>
+                <image v-else style="width: 100%; height: 100%;" mode="aspectFill" src="@/static/common/logo.png">
               </view>
               <view class="user_info">
                 <!-- 姓名 -->

+ 17 - 5
src/pages/message/msgView.vue

@@ -44,14 +44,20 @@
               </view>
               <!-- 头像 -->
               <view class="msg_user_img">
-                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.userPic"></image>
+                <image v-if="item.userPic" style="width: 100%; height: 100%;" mode="aspectFill"
+                  :src="imageUrl + item.userPic"></image>
+                <image v-else style="width: 100%; height: 100%;" mode="aspectFill" src="@/static/common/logo.png">
+                </image>
               </view>
             </view>
             <!-- 左消息 -->
             <view class="msg_view" v-else>
               <!-- 头像 -->
               <view class="msg_user_img">
-                <image style="width: 100%; height: 100%;" mode="aspectFill" :src="imageUrl + item.userPic"></image>
+                <image v-if="item.userPic" style="width: 100%; height: 100%;" mode="aspectFill"
+                  :src="imageUrl + item.userPic"></image>
+                <image v-else style="width: 100%; height: 100%;" mode="aspectFill" src="@/static/common/logo.png">
+                </image>
               </view>
               <view class="msg_view_info msg_view_info_left">
                 <view class="msg_view_conent">{{item.message}}</view>
@@ -120,7 +126,8 @@
         list: [],
         message: "",
         userId: this.$store.state.user.userId,
-        goodsDetail: {}
+        goodsDetail: {},
+        ids: {}
       }
     },
     onLoad(pam) {
@@ -223,10 +230,15 @@
             return {}
           })(),
         }, false).then(res => {
+          var newlist = res.data.filter(item => {
+            var bool = !this.ids[item.id]
+            this.ids[item.id] = true
+            return bool
+          })
           if (flag) {
-            this.list.unshift(...res.data)
+            this.list.unshift(...newlist)
           } else {
-            this.list.push(...res.data)
+            this.list.push(...newlist)
           }
           cb && cb()
         })