|
|
@@ -99,8 +99,8 @@
|
|
|
</div>
|
|
|
<div class="mt-20 full-width flex flex-justify-end">
|
|
|
<el-button type="primary" plain @click="show = false"
|
|
|
- >取 消</el-button
|
|
|
- >
|
|
|
+ >取 消
|
|
|
+ </el-button>
|
|
|
<el-button type="primary" @click="uploadImage">确 定</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -114,9 +114,10 @@ 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 } from '@/utils/auth.js'
|
|
|
+import { getToken, removeToken } 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: {
|
|
|
@@ -233,11 +234,22 @@ export default {
|
|
|
method: 'POST',
|
|
|
headers: this.headers,
|
|
|
body: form
|
|
|
- }).then(res => {
|
|
|
- console.log(res)
|
|
|
+ }).then(response => {
|
|
|
+ const { status, data = {} } = response
|
|
|
+ if (status >= 200 && status <= 401) {
|
|
|
+ this.updateAvatar(data.data.filePath)
|
|
|
+ }
|
|
|
})
|
|
|
}, 'image/png')
|
|
|
}
|
|
|
+ },
|
|
|
+ updateAvatar(avatar) {
|
|
|
+ const data = { id: this.user.info.userId, avatar }
|
|
|
+ this.$api.dash.updateAvatar(data).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|