Browse Source

修改头像

baichun 5 years ago
parent
commit
7b6524383c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      _src/components/panel/panel.vue

+ 5 - 1
_src/components/panel/panel.vue

@@ -2,7 +2,7 @@
   <div class="c-panel">
     <div class="c-panel-header">
       <div class="avatar-wrap" @click="$showUserInfo" v-if="userInfo">
-        <img v-if="userInfo.cover_photo" :src="`${userInfo.cover_photo}?imageview/0/w/180`" alt="">
+        <img v-if="userInfo.cover_photo" :src="avatarUrl" alt="">
         <div v-else class="user-avatar"
           :class="'avatar_bg' + userInfo.user_id % 9"
           :data-name="userInfo.nick_name && userInfo.nick_name.slice(0,2).toUpperCase()"></div>
@@ -94,6 +94,10 @@ export default {
     }
   },
   computed: {
+    avatarUrl () {
+      if (/^http/.test(this.userInfo.cover_photo)) return `${this.userInfo.cover_photo}?imageview/0/w/400`
+      else return this.userInfo.cover_photo
+    },
     ...mapState({
       curSession: state => state.curSession,
       userId: state => state.userId,