dever 4 years ago
parent
commit
da0ad156e7
2 changed files with 56 additions and 0 deletions
  1. 43 0
      assets/lib/layui/upload.js
  2. 13 0
      assets/lib/manage/main.js

+ 43 - 0
assets/lib/layui/upload.js

@@ -36,6 +36,49 @@ var showUploadFilesValue = [];
      }
  }
 
+ function showUploadCover(i,e,key,url,assets,type)
+ {
+	layui.use(['upload','layer','element'], function() {
+		var html = '';
+		var layer = layui.layer;
+		var layerConfig = {
+		  type: 1,
+		  title: e.attr('value'),
+		  shade: 0.1,
+		  shadeClose : true,
+		  content: html,
+		  area: ['400px', '600px']
+		};
+		e.unbind('click').bind('click', function()
+		{
+			url = url.replace('save', 'view');
+			showUploadE = e;
+			if (!type) {
+				type = 1;
+			}
+			showUploadType = type;
+			showUploadUrl = url;
+			var cur = $('#' + showUploadE.attr('v')).val();
+			var cover = e.attr('data-cover');
+			
+			$.getJSON(url, {json:1,key:key,cur:cur,cover:cover}, function(t)
+			{
+				if (showUploadIndex) {
+					layer.close(showUploadIndex);
+				}
+				//layer.closeAll();
+				layerConfig.content = t.data;
+				layerConfig.end = function() {
+					if (showUploadFilesUploadE) {
+						showUploadFilesUploadE = false;
+					}
+				}
+				showUploadIndex = layer.open(layerConfig);
+			})
+		})
+	});
+ }
+
 function showUpload(i,e,key,url,assets,type)
 {
 	layui.use(['upload','layer','element'], function() {

+ 13 - 0
assets/lib/manage/main.js

@@ -1854,6 +1854,19 @@ function image()
 		})
 	}
 
+	if($(".upload_cover").length)
+	{
+		$(".upload_cover").each(function(i)
+		{
+			var parent = $(this).parent().parent();
+			if(parent.attr('id') && parent.attr('id').indexOf('-child-0') != -1)
+			{
+				return;
+			}
+			showUploadCover(i,$(this),$(this).attr('key'),config.upload + '.videoCover', config.lib + 'upload/', 1);//三个参数说明1:第几个上传框2:文件对象3:图片的基本配置标题
+		})
+	}
+
 	if($(".upload_show_editor").length)
 	{
 		$(".upload_show_editor").each(function(i)