mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-26 08:16:47 +08:00
优化代码
This commit is contained in:
parent
ea0a9f155c
commit
d10a26ccae
@ -1,14 +1,10 @@
|
||||
<div class="uploadImage row margin-left-0">
|
||||
<div v-for="image in this.uploadImageInfo.photos">
|
||||
<img v-bind:src="image" width="100px" height="100px"/>
|
||||
<span v-on:click="this._removeImage(image)" class="fa fa-remove"
|
||||
style="position: relative; top: -35px;right: 20px; color: #d9534f"></span>
|
||||
<img v-bind:src="image.url" width="100px" height="100px" />
|
||||
<span v-on:click="this._removeImage(image)" class="fa fa-remove" style="position: relative; top: -35px;right: 20px; color: #d9534f"></span>
|
||||
</div>
|
||||
<div class="uploadButton" v-on:click="this._uploadPhoto()"
|
||||
v-if="this.uploadImageInfo.photos.length < this.uploadImageInfo.imageCount">
|
||||
<div class="uploadButton" v-on:click="this._uploadPhoto()" v-if="this.uploadImageInfo.photos.length < this.uploadImageInfo.imageCount">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||
</div>
|
||||
<input type="file" class="file" accept="image/*" id="uploadImage"
|
||||
v-if="this.uploadImageInfo.photos.length < this.uploadImageInfo.imageCount" hidden
|
||||
v-on:change="this._choosePhoto($event)">
|
||||
</div>
|
||||
<input type="file" class="file" accept="image/*" id="uploadImage" v-if="this.uploadImageInfo.photos.length < this.uploadImageInfo.imageCount" hidden v-on:change="this._choosePhoto($event)">
|
||||
</div>
|
||||
@ -19,7 +19,7 @@
|
||||
uploadImageInfo: {
|
||||
deep: true,
|
||||
handler: function() {
|
||||
//vc.emit($props.callBackListener, $props.callBackFunction, this.uploadImageInfo.photos);
|
||||
vc.emit($props.callBackListener, $props.callBackFunction, this.uploadImageInfo.photos);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -89,7 +89,7 @@
|
||||
var reader = new FileReader(); //新建FileReader对象
|
||||
reader.readAsDataURL(file); //读取为base64
|
||||
reader.onloadend = function(e) {
|
||||
this.uploadImageInfo.photos.push(reader.result);
|
||||
//this.uploadImageInfo.photos.push(reader.result);
|
||||
}
|
||||
this.uploadImageInfo.fileName = file.name;
|
||||
this._doUploadImage(file);
|
||||
@ -124,13 +124,14 @@
|
||||
vc.toast("上传文件失败");
|
||||
return;
|
||||
}
|
||||
var data = JSON.parse(json);
|
||||
let data = JSON.parse(json);
|
||||
//关闭model
|
||||
//$summernote.summernote('insertImage', "/callComponent/download/getFile/file?fileId=" + data.fileId + "&communityId=" + vc.getCurrentCommunity().communityId);
|
||||
//$summernote.summernote('insertImage', data.url);
|
||||
this.uploadImageInfo.fileName = data.fileName;
|
||||
this.uploadImageInfo.realFileName = data.realFileName;
|
||||
vc.emit($props.callBackListener, $props.callBackFunction, data);
|
||||
this.uploadImageInfo.photos.push(data);
|
||||
vc.emit($props.callBackListener, $props.callBackFunction, this.uploadImageInfo.photos);
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
|
||||
@ -276,4 +276,4 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
})(window.vc, window.vc.component);
|
||||
})(window.vc, window.vc.component);
|
||||
Loading…
Reference in New Issue
Block a user