Procházet zdrojové kódy

首页弹窗修改

yanym před 1 rokem
rodič
revize
251b205deb

+ 16 - 21
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/add.html

@@ -97,7 +97,7 @@
     </style>
 </head>
 <body class="white-bg">
-<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="div1">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
     <form class="form-horizontal m" id="form-configuration-add">
         <div class="form-group">
             <label class="col-sm-3 control-label">弹框类型:</label>
@@ -110,14 +110,12 @@
         <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" type="hidden"/>
-                <!--<div class="thumbnail slideshow_span" id="div-bgUrl" onclick="javascript:bgUpload('bg')">-->
-                    <!--<i class="fa fa-plus"></i>-->
+                <!--<input id="input_bgUrl" name="bgUrl"/>-->
+                <div style="width: 150px;height: 150px;" 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="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>
@@ -237,6 +235,7 @@
         }
         $("#alertContentItem").hide();
         $("#alertImageItem").hide();
+        $("#div-bgUrl").hide();
         getCompanyList(obj);
         $('#avatar').on('change', function () {
             var reader = new FileReader();
@@ -246,13 +245,13 @@
                 if ((options.imgSrc).indexOf("image/") == -1) {
                     $.modal.alertWarning("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
                 } else {
-                    cropper = $('.imageBox').cropbox(options);
+                    setTimeout(function () {
+                        upBg(e.target.result);
+                    },500)
+                    // cropper = $('.imageBox').cropbox(options);
                 }
             }
             reader.readAsDataURL(this.files[0]);
-            setTimeout(function () {
-                upBg();
-            },500)
         })
         console.log('ctx',ctx);
     })
@@ -356,11 +355,11 @@
         cropper = $('.imageBox').cropbox(options);
     }
 
-    function upBg() {
-        cropper = $('.imageBox').cropbox(options);
-        var img = cropper.getBlob();
+    function upBg(imgFile) {
+        // cropper = $('.imageBox').cropbox(options);
+        // var img = cropper.getBlob();
         var formdata = new FormData();
-        formdata.append("file", img);
+        formdata.append("file", imgFile);
         $.ajax({
             url: ctx + "common/upload",
             data: formdata,
@@ -370,13 +369,9 @@
             success: function (result) {
                 if (result.code == 0) {
                     photoUrl = result.data.url;
-                    $("#input_bgUrl").val(result.data.fileName);
                     $("#div-bgUrl").html("<img src='" + result.data.url + "' style='width;100%;height:100%;'>");
-                    $("#div1").show();
-                    $("#div2").hide();
+                    $("#div-bgUrl").show();
                 } else {
-                    $("#div1").show();
-                    $("#div2").hide();
                     $.modal.alertWarning(result.msg);
                 }
             }

+ 1 - 7
suishenbang-admin/src/main/resources/templates/system/alertConfiguration/configuration.html

@@ -116,14 +116,8 @@
                         title : '弹框图片',
                         width : '100px',
                         formatter: function(value, row, index) {
-                            var str="";
-                            if(ctx=="/"){
-                                str = value;
-                            }else{
-                                str = ctx+value;
-                            }
                             if (value != null){
-                                return $.table.imageView(str,218,237,"tableImage_s img-view");
+                                return $.table.imageView(value,218,237,"tableImage_s img-view");
                             }
                         }
                     },