|
|
@@ -20,6 +20,7 @@
|
|
|
accept="image/png, image/jpeg"
|
|
|
:before-upload="handleFileChange"
|
|
|
>
|
|
|
+ <i v-if="cover_url" class="el-icon-delete avatar-uploader-icon" @click.stop="handleDeleteFile"></i>
|
|
|
<img v-if="cover_url" :src="cover_url" class="avatar" />
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
<div slot="tip" class="el-upload__tip">建议尺寸:480*330,大小在500k以内</div>
|
|
|
@@ -187,6 +188,8 @@ export default {
|
|
|
url: this.cover_url
|
|
|
});
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.goHome();
|
|
|
}
|
|
|
// TODO go details
|
|
|
});
|
|
|
@@ -286,6 +289,9 @@ export default {
|
|
|
this.content += `<img src="${res.filename}" alt="${file.name}"/>`;
|
|
|
});
|
|
|
},
|
|
|
+ handleDeleteFile() {
|
|
|
+ this.cover_url = '';
|
|
|
+ },
|
|
|
handleFileChange(file) {
|
|
|
console.log(file);
|
|
|
if (file.size / 1024 > 500) {
|
|
|
@@ -391,12 +397,19 @@ export default {
|
|
|
border-color: #409eff;
|
|
|
}
|
|
|
.avatar-uploader-icon {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
font-size: 28px;
|
|
|
- color: #8c939d;
|
|
|
+ color: #fff;
|
|
|
width: 160px;
|
|
|
height: 110px;
|
|
|
line-height: 110px;
|
|
|
text-align: center;
|
|
|
+ background: rgba(1, 1, 1, 0.3);
|
|
|
+ :hover {
|
|
|
+ color: #409eff;
|
|
|
+ }
|
|
|
}
|
|
|
.avatar {
|
|
|
width: 178px;
|