|  |  | 
 |  |  |             <label class="layui-form-label">视频:</label> | 
 |  |  |             <div class="layui-input-block"> | 
 |  |  |                 <button type="button" class="layui-btn upload" id="upload" style="background-color: #009688; margin-bottom: 2px">上传文件</button> | 
 |  |  |                 <button type="button" class="layui-btn layui-btn-danger" id="uploadDel" style="margin-bottom: 2px">删除</button> | 
 |  |  |                 <input type="text" name="videoUrl" autocomplete="off" value="" id="videoUrl" class="layui-input" readonly> | 
 |  |  |             </div> | 
 |  |  |         </div> | 
 |  |  | 
 |  |  |             <div class="layui-input-block"> | 
 |  |  |                 <button type="button" class="layui-btn" id="imageUpload" style="background-color: #009688; margin-bottom: 2px">图片上传</button> | 
 |  |  |                 <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> | 
 |  |  |                     <div class=" layui-upload-list view-images" id="thumbImage"> | 
 |  |  |                     </div> | 
 |  |  |                     <div class="layui-upload-list" id="thumbImage"></div> | 
 |  |  |                 </blockquote> | 
 |  |  |                 <div class="layui-word-aux">双击图片删除</div> | 
 |  |  |                 <div class="febs-hide"> | 
 |  |  |                     <input type="text" id="thumb"  name="thumb" autocomplete="off" class="layui-input" readonly> | 
 |  |  |                 </div> | 
 |  |  | 
 |  |  |             layedit = layui.layedit, | 
 |  |  |             newsInfo = [[${newsInfo}]], | 
 |  |  |             $view = $('#newsInfo-update'), | 
 |  |  |             $uploadDel = $view.find('#uploadDel'), | 
 |  |  |             validate = layui.validate; | 
 |  |  |  | 
 |  |  |         //(下拉框) | 
 |  |  | 
 |  |  |             ,before: function(obj){ | 
 |  |  |                 //预读本地文件示例,不支持ie8 | 
 |  |  |                 obj.preview(function(index, file, result){ | 
 |  |  |                     $('#thumbImage').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img" style="width: 100px">') | 
 |  |  |                     if ($("#thumb").val()) { | 
 |  |  |                         $('#thumbImage').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img new-image" style="width: 130px">') | 
 |  |  |                     } else { | 
 |  |  |                         $('#thumbImage').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img new-image" style="width: 130px">') | 
 |  |  |                     } | 
 |  |  |                     // $('#thumbImage').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img new-image" style="width: 100px">') | 
 |  |  |                 }); | 
 |  |  |             } | 
 |  |  |             ,done: function(res){ | 
 |  |  |                 $("#thumb").val(res.data.src); | 
 |  |  |  | 
 |  |  |                 imgUnBind(".new-image"); | 
 |  |  |                 imgSingleBind(); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |         function imgUnBind(className) { | 
 |  |  |             $(className).each(function() { | 
 |  |  |                 $(this).unbind('dblclick'); | 
 |  |  |             }) | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         function imgSingleBind() { | 
 |  |  |             $(".new-image").each(function(index, element) { | 
 |  |  |                 $(this).on("dblclick", function() { | 
 |  |  |                     var imgThumb = $(".new-image")[index]; | 
 |  |  |                     $(imgThumb).remove(); | 
 |  |  |                     $("#thumb").val(""); | 
 |  |  |  | 
 |  |  |                     imgUnBind(".new-image"); | 
 |  |  |                     imgSingleBind(); | 
 |  |  |                 }); | 
 |  |  |             }) | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         $uploadDel.on('click', function () { | 
 |  |  |             $("#videoUrl").val(''); | 
 |  |  |         }); | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |         function initUserValue() { | 
 |  |  |             var thumb = newsInfo.thumb; | 
 |  |  |             $('#thumbImage').html('<img src="' + thumb + '" alt="" class="layui-upload-img" style="width: 100px">') | 
 |  |  |             $('#thumbImage').html('<img src="' + thumb + '" alt="" class="layui-upload-img new-image" style="width: 100px">') | 
 |  |  |             form.val("newsInfo-update-form", { | 
 |  |  |                 "id": newsInfo.id, | 
 |  |  |                 "categoryId": newsInfo.categoryId, | 
 |  |  | 
 |  |  |                 "thumb": newsInfo.thumb, | 
 |  |  |                 "content": newsInfo.content, | 
 |  |  |             }); | 
 |  |  |             imgSingleBind(); | 
 |  |  |  | 
 |  |  |             layedit.setContent(index, newsInfo.content, false); | 
 |  |  |         } |