|
@@ -110,17 +110,21 @@
|
|
|
<div class="form-group" id="alertImageItem">
|
|
|
<label class="col-sm-3 control-label">弹框图片:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <!--<input id="input_bgUrl" name="bgUrl"/>-->
|
|
|
- <div style="width: 150px;height: 150px;" id="div-bgUrl"></div>
|
|
|
+ <!--<input id="input_bgUrl" name="bgUrl" type="hidden"/>-->
|
|
|
+ <!--<div class="thumbnail slideshow_span" id="div-bgUrl" onclick="javascript:bgUpload('bg')">-->
|
|
|
+ <!--<i class="fa fa-plus"></i>-->
|
|
|
+ <!--</div>-->
|
|
|
+ <div id="div-bgUrl"></div>
|
|
|
<!--<div class="imageBox">-->
|
|
|
<!--<div class="thumbBox" style="width:150px;height:150px;"></div>-->
|
|
|
<!--<div class="spinner" style="display: none">Loading...</div>-->
|
|
|
<!--</div>-->
|
|
|
<div class="action">
|
|
|
<div class="new-contentarea tc">
|
|
|
- <a href="javascript:void(0)" class=""><label for="avatar">选择图片</label> </a>
|
|
|
- <input type="file" class="" name="avatar" id="avatar" accept="image/*"/>
|
|
|
+ <!--<a href="javascript:void(0)" class=""><label for="avatar">选择图片</label> </a>-->
|
|
|
+ <!--<input type="file" class="" name="avatar" id="avatar" accept="image/*" value="上传"/>-->
|
|
|
</div>
|
|
|
+ <input type="file" class="" name="avatar" id="avatar" accept="image/*" value="上传"/>
|
|
|
<!--<input type="button" id="submitbuttonBg" onclick="upBg()" class="" value="上传"/>-->
|
|
|
</div>
|
|
|
</div>
|
|
@@ -235,7 +239,6 @@
|
|
|
}
|
|
|
$("#alertContentItem").hide();
|
|
|
$("#alertImageItem").hide();
|
|
|
- $("#div-bgUrl").hide();
|
|
|
getCompanyList(obj);
|
|
|
$('#avatar').on('change', function () {
|
|
|
var reader = new FileReader();
|
|
@@ -244,14 +247,15 @@
|
|
|
//根据MIME判断上传的文件是不是图片类型
|
|
|
if ((options.imgSrc).indexOf("image/") == -1) {
|
|
|
$.modal.alertWarning("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
|
|
|
- } else {
|
|
|
- setTimeout(function () {
|
|
|
- upBg(e.target.result);
|
|
|
- },500)
|
|
|
- // cropper = $('.imageBox').cropbox(options);
|
|
|
}
|
|
|
+ // else {
|
|
|
+ // cropper = $('.imageBox').cropbox(options);
|
|
|
+ // }
|
|
|
}
|
|
|
+ console.log(333,this.files[0])
|
|
|
reader.readAsDataURL(this.files[0]);
|
|
|
+ console.log(4444,this.files[0])
|
|
|
+ upBg(this.files[0]);
|
|
|
})
|
|
|
console.log('ctx',ctx);
|
|
|
})
|
|
@@ -357,7 +361,9 @@
|
|
|
|
|
|
function upBg(imgFile) {
|
|
|
// cropper = $('.imageBox').cropbox(options);
|
|
|
+ // console.log(111,cropper)
|
|
|
// var img = cropper.getBlob();
|
|
|
+ // console.log(222,img)
|
|
|
var formdata = new FormData();
|
|
|
formdata.append("file", imgFile);
|
|
|
$.ajax({
|
|
@@ -369,8 +375,8 @@
|
|
|
success: function (result) {
|
|
|
if (result.code == 0) {
|
|
|
photoUrl = result.data.url;
|
|
|
- $("#div-bgUrl").html("<img src='" + result.data.url + "' style='width;100%;height:100%;'>");
|
|
|
- $("#div-bgUrl").show();
|
|
|
+ // $("#input_bgUrl").val(result.data.fileName);
|
|
|
+ $("#div-bgUrl").html("<img src='" + result.data.url + "' style='width;150px;height:150px;'>");
|
|
|
} else {
|
|
|
$.modal.alertWarning(result.msg);
|
|
|
}
|