3838 label-position =" left"
3939 ref =" form"
4040 label-width =" 90px"
41- @submit.native. prevent
41+ @submit.prevent
4242 >
4343 <el-form-item label =" 原始密码" prop =" old_password" >
4444 <el-input type =" password" v-model =" form.old_password" autocomplete =" off" ></el-input >
6161 <!-- 修改头像 -->
6262 <el-dialog
6363 title =" 裁剪"
64- :visible.sync =" cropVisible"
64+ v-model :visible =" cropVisible"
6565 width =" 300px"
6666 :append-to-body =" true"
6767 :close-on-click-modal =" false"
8888 </div >
8989 <div style =" margin-top : 1em ;" >通过鼠标滚轮调节头像大小</div >
9090 </div >
91- <div slot =" footer" class =" dialog-footer" >
92- <el-button @click =" cropVisible = false" size =" small" >取 消</el-button >
93- <el-button type =" primary" @click =" handleCrop" size =" small" >确 定</el-button >
94- </div >
91+ <template v-solt :footer >
92+ <div class =" dialog-footer" >
93+ <el-button @click =" cropVisible = false" size =" small" >取 消</el-button >
94+ <el-button type =" primary" @click =" handleCrop" size =" small" >确 定</el-button >
95+ </div >
96+ </template >
9597 </el-dialog >
9698 </div >
9799</template >
@@ -101,6 +103,7 @@ import { mapActions, mapGetters } from 'vuex'
101103import Vue from ' vue'
102104import Croppa from ' vue-croppa'
103105import User from ' @/lin/model/user'
106+ import axios , { post , put } from ' @/lin/plugin/axios'
104107import ' vue-croppa/dist/vue-croppa.css'
105108import defaultAvatar from ' @/assets/image/user/user.png'
106109
@@ -240,12 +243,8 @@ export default {
240243 type: ' image/jpeg' ,
241244 })
242245
243- return this .$axios ({
244- method: ' post' ,
245- url: ' /cms/file' ,
246- data: {
247- file,
248- },
246+ return post (' cms/file' , {
247+ file,
249248 }).then (res => {
250249 // 清空输入框
251250 this .clearFileInput (this .$refs .avatarInput )
@@ -257,12 +256,8 @@ export default {
257256 // if (res.code === 10110) {
258257 // throw new Error('文件体积过大')
259258 // }
260- return this .$axios ({
261- method: ' put' ,
262- url: ' /cms/user' ,
263- data: {
264- avatar: res[0 ].path ,
265- },
259+ return put (' /cms/user' , {
260+ avatar: res[0 ].path ,
266261 })
267262 .then (putRes => {
268263 // eslint-disable-line
@@ -289,7 +284,7 @@ export default {
289284 if (this .nickname ) {
290285 const { user } = this .$store .state
291286 if (this .nickname !== user .nickname && this .nickname !== ' 佚名' ) {
292- this . $ axios ({
287+ axios ({
293288 method: ' put' ,
294289 url: ' /cms/user' ,
295290 data: {
0 commit comments