|
|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<dialog-form :loading="loading" title="上传头像" :value="value" width="50%" @close="cancel"> |
|
|
|
<dialog-form :loading="loading" title="上传头像" :value="value" width="50%" @close="cancel"> |
|
|
|
<el-row class="avatar-cropper" type="flex"> |
|
|
|
<el-row class="avatar-cropper"> |
|
|
|
<div class="img-wrapper"> |
|
|
|
<div class="img-wrapper"> |
|
|
|
<vue-cropper |
|
|
|
<vue-cropper |
|
|
|
ref="cropper" |
|
|
|
ref="cropper" |
|
|
|
@ -9,33 +9,22 @@ |
|
|
|
autoCrop |
|
|
|
autoCrop |
|
|
|
autoCropHeight="200px" |
|
|
|
autoCropHeight="200px" |
|
|
|
autoCropWidth="200px" |
|
|
|
autoCropWidth="200px" |
|
|
|
centerBox |
|
|
|
|
|
|
|
fixedBox |
|
|
|
fixedBox |
|
|
|
full |
|
|
|
full |
|
|
|
outputType="png" |
|
|
|
outputType="png" |
|
|
|
@realTime="previews=$event" |
|
|
|
|
|
|
|
@wheel.native.prevent="scale" |
|
|
|
@wheel.native.prevent="scale" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="operate-wrapper"> |
|
|
|
<input |
|
|
|
<div class="preview-container"> |
|
|
|
ref="input" |
|
|
|
<div :style="previews.div"> |
|
|
|
accept="image/png, image/jpeg, image/gif, image/jpg" |
|
|
|
<img :src="previews.url" :style="previews.img"> |
|
|
|
style="display: none" |
|
|
|
</div> |
|
|
|
type="file" |
|
|
|
</div> |
|
|
|
@change="chooseImage" |
|
|
|
<el-button size="small" type="primary" @click="$refs.input.click()"> |
|
|
|
> |
|
|
|
选择图片 |
|
|
|
|
|
|
|
<input |
|
|
|
|
|
|
|
ref="input" |
|
|
|
|
|
|
|
accept="image/png, image/jpeg, image/gif, image/jpg" |
|
|
|
|
|
|
|
style="display: none" |
|
|
|
|
|
|
|
type="file" |
|
|
|
|
|
|
|
@change="chooseImage" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
<template v-slot:footer> |
|
|
|
<template v-slot:footer> |
|
|
|
|
|
|
|
<el-button plain size="small" @click="$refs.input.click()">选择图片</el-button> |
|
|
|
<el-button plain size="small" @click="closeDialog">取 消</el-button> |
|
|
|
<el-button plain size="small" @click="closeDialog">取 消</el-button> |
|
|
|
<el-button size="small" type="primary" @click="confirm">确 定</el-button> |
|
|
|
<el-button size="small" type="primary" @click="confirm">确 定</el-button> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
@ -60,7 +49,6 @@ |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
loading: false, |
|
|
|
loading: false, |
|
|
|
previews: {}, |
|
|
|
|
|
|
|
img: '', |
|
|
|
img: '', |
|
|
|
name: '' |
|
|
|
name: '' |
|
|
|
} |
|
|
|
} |
|
|
|
@ -123,33 +111,17 @@ |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss"> |
|
|
|
<style lang="scss"> |
|
|
|
.avatar-cropper { |
|
|
|
.avatar-cropper { |
|
|
|
|
|
|
|
.cropper-crop-box { |
|
|
|
|
|
|
|
border: 1px solid #39f; |
|
|
|
|
|
|
|
border-radius: 50%; |
|
|
|
|
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.img-wrapper { |
|
|
|
.img-wrapper { |
|
|
|
height: 360px; |
|
|
|
height: 360px; |
|
|
|
width: 640px; |
|
|
|
width: 640px; |
|
|
|
display: inline-block; |
|
|
|
display: inline-block; |
|
|
|
border: 1px solid #ebebeb; |
|
|
|
border: 1px solid #ebebeb; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.operate-wrapper { |
|
|
|
|
|
|
|
padding: 0 40px; |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
flex-direction: column; |
|
|
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.preview-container { |
|
|
|
|
|
|
|
border: 1px solid #ebebeb; |
|
|
|
|
|
|
|
height: 200px; |
|
|
|
|
|
|
|
width: 200px; |
|
|
|
|
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
border-radius: 50%; |
|
|
|
|
|
|
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.el-button { |
|
|
|
|
|
|
|
margin-left: 0; |
|
|
|
|
|
|
|
margin-top: 20px; |
|
|
|
|
|
|
|
width: 100%; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|
|