dever 6 éve
szülő
commit
ca19a8147a

+ 7 - 2
assets/lib/layui/lay/modules/upload.js

@@ -320,10 +320,15 @@ layui.define('layer' , function(exports){
         that.files[index] = newFile;
       }
       //编辑文件
-      ,editFile: function(path){
+      ,editFile: function(path, cover){
         layui.each(that.chooseFiles, function(index, item){
         	var temp = item.name.split('.');
-          that.chooseFiles[index]['key'] = path + hex_md5(item.name) + '.' + temp[temp.length-1];
+          if (cover == 1) {
+            that.chooseFiles[index]['key'] = path + hex_md5(item.name) + '.' + temp[temp.length-1];
+          } else {
+              var timestamp = Date.parse(new Date());
+              that.chooseFiles[index]['key'] = path + hex_md5(item.name + '_' + timestamp) + '.' + temp[temp.length-1];
+          }
         });
         return that.files;
       }

+ 19 - 5
assets/lib/layui/upload.js

@@ -159,6 +159,10 @@ function loadUploadL(i,e,key,url,assets)
 	var host = e.attr('host');
 	var domain = e.attr('domain');
 	var path = e.attr('path');
+	var cover = e.attr('cover');
+	if (!cover) {
+		cover = 1;
+	}
 	var uploadUrl = url;
 	url = domain;
 
@@ -193,11 +197,17 @@ function loadUploadL(i,e,key,url,assets)
 
 		      filename = path + hex_md5(file.name) + '.' + temp[temp.length-1];
 
+		      //不覆盖
+		      if (cover == 2) {
+		      		var timestamp = Date.parse(new Date());
+		      		filename = path + hex_md5(file.name + '_' + timestamp) + '.' + temp[temp.length-1];
+		      }
+
 		      // 设置next,error,complete对应的操作,分别处理相应的进度信息,错误信息,以及完成后的操作
 		      var error = function(err) {
 		        //请求异常回调
 		        console.log(err);
-				layer.alert('文件上传错误');
+				layer.alert('文件上传错误1');
 				element.progress(id + '_progress', '0%')
 				$('#' + id + '_progress').hide();
 				layer.closeAll('loading');
@@ -211,14 +221,14 @@ function loadUploadL(i,e,key,url,assets)
 					layer.closeAll('loading');
 					var data = {};
 			      if (res.hash) {
-			      	$.getJSON(uploadUrl.replace('save.start', 'qiniu.addFile'), {source:file.name,file:filename, key:key});
+			      	$.getJSON(uploadUrl.replace('save.start', 'qiniu.addFile'), {source:file.name,file:res.key, key:key});
 						data.status = 1;
 						data.name = res.key;
 						data.url = host + res.key;
 
 						loadUploadSet(e,value,data);
 					} else {
-						layer.alert('文件上传错误');
+						layer.alert('文件上传错误2');
 						return false;
 					}
 		        }
@@ -275,6 +285,10 @@ function loadUpload(i,e,key,url,assets)
 	var host = e.attr('host');
 	var domain = e.attr('domain');
 	var path = e.attr('path');
+	var cover = e.attr('cover');
+	if (!cover) {
+		cover = 1;
+	}
 	if (token) {
 		data.token = token;
 	}
@@ -305,7 +319,7 @@ function loadUpload(i,e,key,url,assets)
 			}
 			,choose: function(obj, self){
 				if (domain) {
-					obj.editFile(path);
+					obj.editFile(path, cover);
 				}
 				element.progress(id + '_progress', '0%')
 				//layer.load();
@@ -316,7 +330,7 @@ function loadUpload(i,e,key,url,assets)
 					data.name = data.key;
 					data.url = host + data.key;
 
-					$.getJSON(uploadUrl.replace('save.start', 'qiniu.addFile'), {source:file.name,file:file.key, key:key});
+					$.getJSON(uploadUrl.replace('save.start', 'qiniu.addFile'), {source:file.name,file:data.key, key:key});
 				}
 				element.progress(id + '_progress', '0%')
 				$('#' + id + '_progress').hide();

+ 5 - 5
assets/lib/manage/main.js

@@ -359,12 +359,12 @@ function loadEditorParam(e)
 		htmlTags : {
 			font : ['id', 'class', 'color', 'size', 'face', '.background-color'],
 			span : [
-				'id', 'class', '.color', '.background-color', '.font-size', '.background',
+				'id', 'class', '.color', '.background-color', '.font-size','.letter-spacing', '.background',
 				'.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height'
 			],
 			div : [
 				'id', 'class', 'data-id', 'data-key','.dever-video', 'align', '.border', '.margin', '.padding', '.text-align', '.color',
-				'.background-color', '.font-size', '.font-weight', '.background',
+				'.background-color', '.font-size','.letter-spacing', '.font-weight', '.background',
 				'.font-style', '.text-decoration', '.vertical-align', '.margin-left'
 			],
 			table: [
@@ -375,14 +375,14 @@ function loadEditorParam(e)
 			],
 			'td,th': [
 				'id', 'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
-				'.text-align', '.color', '.background-color', '.font-size', '.font-weight',
+				'.text-align', '.color', '.background-color', '.font-size','.letter-spacing', '.font-weight',
 				'.font-style', '.text-decoration', '.vertical-align', '.background', '.border'
 			],
 			a : ['id', 'class', 'href', 'target', 'name'],
 			embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess', 'wmode'],
 			img : ['id', 'class', 'data-id', 'data-key', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
 			'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
-				'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.background',
+				'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size','.letter-spacing', '.background',
 				'.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left'
 			],
 			pre : ['id', 'class'],
@@ -396,7 +396,7 @@ function loadEditorParam(e)
 		        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
 		        'justifyfull', 'indent', 'outdent', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', 'source', '/',
 		        'formatblock', 'fontsize', 'fontheight', '|', 'forecolor', 'hilitecolor', 'bold',
-		        'italic', 'underline', 'lineheight', 'removeformat', '|', 'image','table', 'hr', 'link', 'unlink'
+		        'italic', 'underline', 'lineheight', 'removeformat', 'insertorderedlist','|', 'image','table', 'hr', 'pagebreak','link', 'unlink'
 		]
 		/*
 		items : [