|  |  |  | 
|---|
|  |  |  | <div> | 
|---|
|  |  |  | <el-upload | 
|---|
|  |  |  | class="avatar-uploader" | 
|---|
|  |  |  | accept=".png,.jpg" | 
|---|
|  |  |  | accept=".png,.jpg,.jpeg" | 
|---|
|  |  |  | :style="customStyle" | 
|---|
|  |  |  | :action="uploadImgUrl" | 
|---|
|  |  |  | :data="uploadData" | 
|---|
|  |  |  | 
|---|
|  |  |  | tipsLabel: '', | 
|---|
|  |  |  | customStyle: { | 
|---|
|  |  |  | type: String, | 
|---|
|  |  |  | default: 'width: 90px; height: 90px;' | 
|---|
|  |  |  | default: 'width: 90px; max-height: 90px;' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | uploadData: Object | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload' | 
|---|
|  |  |  | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/upload' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$message.success('上传成功') | 
|---|
|  |  |  | this.$emit('uploadSuccess', { imgurl: data.imgaddr, imgurlfull: data.url, name: data.originname }) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$tip.apiFailed('上传失败') | 
|---|
|  |  |  | this.$message.error('上传失败') | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$emit('uploadEnd') | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | uploadError() { | 
|---|
|  |  |  | this.$tip.apiFailed('上传失败') | 
|---|
|  |  |  | this.$emit('endUpload') | 
|---|
|  |  |  | this.$message.error('上传失败') | 
|---|
|  |  |  | this.$emit('uploadEnd') | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // // 拦截 | 
|---|
|  |  |  | beforeAvatarUpload(file) { | 
|---|
|  |  |  | 
|---|
|  |  |  | text-align: center; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .avatar { | 
|---|
|  |  |  | width: 100% !important; | 
|---|
|  |  |  | height: auto !important; | 
|---|
|  |  |  | width: 90px; | 
|---|
|  |  |  | max-height: 90px; | 
|---|
|  |  |  | display: block; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | .tips-style { | 
|---|