|  |  |  | 
|---|
|  |  |  | <ImageCropper ref="iconShot" v-if="updateImg" :imgSrc="img" > | 
|---|
|  |  |  | </ImageCropper> | 
|---|
|  |  |  | <span slot="footer" class="dialog-footer"> | 
|---|
|  |  |  | <el-button @click="updateImg = false">取 消</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="uploadIcon">确 定</el-button> | 
|---|
|  |  |  | <el-button v-if="loading">取 消</el-button> | 
|---|
|  |  |  | <el-button v-else @click="updateImg = false">取 消</el-button> | 
|---|
|  |  |  | <el-button :loading="loading" type="primary" @click="uploadIcon">确 定</el-button> | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | </el-dialog> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | loading: false, | 
|---|
|  |  |  | fileInfo:{}, | 
|---|
|  |  |  | img: null, | 
|---|
|  |  |  | updateImg: false, | 
|---|
|  |  |  | 
|---|
|  |  |  | const formData = new FormData() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | formData.append('folder', 'member') | 
|---|
|  |  |  | if(this.uploadData.isFace || this.uploadData.isFace == 0){ | 
|---|
|  |  |  | formData.append('isFace', 0) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | formData.append( | 
|---|
|  |  |  | 'file', | 
|---|
|  |  |  | new File( | 
|---|
|  |  |  | 
|---|
|  |  |  | { type: this.fileInfo.type } // 设置File类型的文件类型 | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | this.loading = true | 
|---|
|  |  |  | upload(formData).then(res => { | 
|---|
|  |  |  | this.loading = false | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | this.file.imgurl = res.imgaddr | 
|---|
|  |  |  | this.file.imgurlfull = res.url | 
|---|
|  |  |  | 
|---|
|  |  |  | this.updateImg = false | 
|---|
|  |  |  | this.$emit('uploadSuccess', { imgurl: res.imgaddr, imgurlfull: res.url, name: res.originname }) | 
|---|
|  |  |  | this.$emit('uploadEnd') | 
|---|
|  |  |  | }, () => { | 
|---|
|  |  |  | this.loading = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|