浏览代码

report time

scorpio 2 年之前
父节点
当前提交
10d877b0eb
共有 2 个文件被更改,包括 10 次插入5 次删除
  1. 1 1
      src/api/dash/index.js
  2. 9 4
      src/views/dash/compoents/profile.vue

+ 1 - 1
src/api/dash/index.js

@@ -42,6 +42,6 @@ export default {
    * @returns {Promise | Promise<unknown>}
    */
   updateAvatar(params) {
-    return fetch('/blade-user/submit', params, 'post', 'json')
+    return fetch('/blade-user/update', params, 'post', 'json')
   }
 }

+ 9 - 4
src/views/dash/compoents/profile.vue

@@ -40,7 +40,7 @@
       </div>
     </div>
 
-    <el-dialog title="修改头像" v-model="show" width="780px">
+    <el-dialog title="修改头像" v-model="show" width="780px" @close="close">
       <div>
         <div>
           <span
@@ -114,10 +114,9 @@ import { Cropper } from 'vue-advanced-cropper'
 import 'vue-advanced-cropper/dist/style.css'
 import api from '@/api/index.js'
 import website from '@/config/website.js'
-import { getToken, removeToken } from '@/utils/auth.js'
+import { getToken } from '@/utils/auth.js'
 import { Base64 } from 'js-base64'
 import uploadOffice from '@/components/upload-office/index.vue'
-import router from '@/router/index.js'
 
 export default {
   components: {
@@ -248,9 +247,15 @@ export default {
       const data = { id: this.user.info.userId, avatar }
       this.$api.dash.updateAvatar(data).then(res => {
         if (res.code === 200) {
-          console.log(res)
+          this.$message.success(res.msg)
+        } else {
+          this.$message.error(res.msg)
         }
       })
+    },
+    close() {
+      this.img = ''
+      this.previewImg = ''
     }
   }
 }