Browse Source

更新头像样式

lex 2 years ago
parent
commit
60cd795294

+ 3 - 1
src/store/modules/user.js

@@ -70,7 +70,9 @@ const actions = {
       })
     })
   },
-
+  setAvatar({commit}, url) {
+    commit('SET_AVATAR', url)
+  },
   // get user info
   getInfo({ commit, state }) {
     return new Promise((resolve, reject) => {

+ 10 - 1
src/views/profile/userAvatar.vue

@@ -14,7 +14,12 @@
       :before-upload="beforeAvatarUpload"
       :data="dataObj"
     >
-      <el-image v-if="options.img" :src="options.img" class="avatar" />
+      <el-image
+        v-if="options.img"
+        :src="options.img"
+        class="avatar"
+        fit="cover"
+      />
       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
     </el-upload>
     <!-- <el-dialog :title="title" :visible.sync="open" width="800px">
@@ -171,6 +176,7 @@ export default {
       uploadAvatar({ avatar: url }).then(response => {
         if (response.code === 200) {
           this.options.img = url;
+          store.dispatch("user/setAvatar", url);
           this.msgSuccess("修改成功");
         } else {
           this.msgError(response.msg);
@@ -222,6 +228,7 @@ export default {
             this.open = false;
             this.options.img =
               process.env.VUE_APP_BASE_API + "/" + response.data;
+
             this.msgSuccess("修改成功");
           } else {
             this.msgError(response.msg);
@@ -242,5 +249,7 @@ export default {
 .avatar {
   border-radius: 50%;
   overflow: hidden;
+  width: 120px !important;
+  height: 120px !important;
 }
 </style>

File diff suppressed because it is too large
+ 0 - 0
web/index.html


+ 1 - 0
web/static/web/css/chunk-3f4d73d6.46f226f8.css

@@ -0,0 +1 @@
+.avatar{border-radius:50%;overflow:hidden;width:120px!important;height:120px!important}

+ 0 - 1
web/static/web/css/chunk-3f4d73d6.99e44bad.css

@@ -1 +0,0 @@
-.avatar{border-radius:50%;overflow:hidden}

File diff suppressed because it is too large
+ 0 - 0
web/static/web/css/chunk-e4d0f168.c951d58c.css


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/app.9953c922.js


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/app.ff0e578f.js


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/chunk-3f4d73d6.16479bdd.js


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/chunk-3f4d73d6.cdc7369f.js


File diff suppressed because it is too large
+ 0 - 0
web/static/web/js/chunk-e4d0f168.0687b927.js


Some files were not shown because too many files changed in this diff