Browse Source

메인전시 수정

bin2107 5 years ago
parent
commit
eaafb95fd4

+ 16 - 9
src/main/webapp/WEB-INF/views/display/MainContentsPopupForm.html

@@ -154,16 +154,20 @@
 				html += '<tr class="cateTypeTr" name="tvY'+i+'">';
 				html += '	<th>미디어<br>컨텐츠키</th>';
 				html += '	<td colspan="3">';
-				html += '		<input name="tvMediaKey'+i+'" type="text" class="w150" maxlength="200" data-valid-name="미디어 컨텐츠키" value="'+result[i].strVar2+'"/>';
+				html += '		<input name="tvMediaKey'+i+'" type="text" class="w150" maxlength="200" data-valid-name="미디어 컨텐츠키" value="'+result[i].strVar2+'" ';
+				if(result[i].strVar1=='M'){
+					html += ' disabled="disabled" ';
+				}
+				html += '/>';
 				html += '	</td>';
 				html += '</tr>';
-				if(result[i].strVar1=='M'){
+				if(result[i].strVar1=='M' && (result[i].strVar2==null || result[i].strVar2=='')){
 					html += '<tr class="cateTypeTr" name="tvM'+i+'">';
 					html +='	<th>파일첨부<em class="required" title="필수"></em></th>';
 					html +='	<td class="infoTxt" colSpan="5">';
 					html +='		<div class="uFile w300">';
 					html +='			<input id="file'+i+'" name="file" type="file" class="uFileInput w300" onchange="fnVideoFileUpload(this, '+i+')"/>';
-					html +='			<label htmlFor="file'+i+'" class="uFileLabel">파일선택</label>';
+					html +='			<label for="file'+i+'" class="uFileLabel">파일선택</label>';
 					html +='			<input type="hidden" name="kufKey" value="'+result[i].strVar3+'"/>';
 					html +='			<input type="hidden" name="kmcKey"/>';
 					html +='		</div>';
@@ -476,9 +480,11 @@
 		if(tvPlayer == 'Y'){
 			$(obj).closest("table").find("[name=tvY"+idx+"]").show();
 			$(obj).closest("table").find("[name=tvM"+idx+"]").hide();
+			$(obj).closest("table").find("[name=tvMediaKey"+idx+"]").prop('disabled',false);
 		}else{
 			$(obj).closest("table").find("[name=tvY"+idx+"]").show();
 			$(obj).closest("table").find("[name=tvM"+idx+"]").show();
+			$(obj).closest("table").find("[name=tvMediaKey"+idx+"]").prop('disabled',true);
 		}
 	}
 
@@ -662,11 +668,11 @@
 			html += '	</td>';
 			html += '</tr>';
 			html += '<tr class="cateTypeTr" name="tvM'+dataIdx+'" style="display: none;">';
-			html +='	<th>파일첨부<em className="required" title="필수"></em></th>';
-			html +='	<td className="infoTxt" colSpan="5">';
-			html +='		<div className="uFile w300">';
-			html +='			<input id="file'+dataIdx+'" name="file" type="file" className="uFileInput w300" onchange="fnVideoFileUpload(this, '+dataIdx+')"/>';
-			html +='			<label htmlFor="file'+dataIdx+'" className="uFileLabel">파일선택</label>';
+			html +='	<th>파일첨부<em class="required" title="필수"></em></th>';
+			html +='	<td class="infoTxt" colSpan="5">';
+			html +='		<div class="uFile w300">';
+			html +='			<input id="file'+dataIdx+'" name="file" type="file" class="uFileInput w300" onchange="fnVideoFileUpload(this, '+dataIdx+')"/>';
+			html +='			<label for="file'+dataIdx+'" class="uFileLabel">파일선택</label>';
 			html +='			<input type="hidden" name="kufKey"/>';
 			html +='			<input type="hidden" name="kmcKey"/>';
 			html +='		</div>';
@@ -959,7 +965,7 @@
 		var dataBool = true;
 		$(".mcTable").each(function(i){
 			var thisIdx = $(this).find("input[name=tableIdx]").val();
-			if($(this).find("input:radio[name=tvPlayer"+thisIdx+"]:checked").val()=='M'){
+			if($(this).find("input:radio[name=tvPlayer"+thisIdx+"]:checked").val()=='M' && ($(this).find("input[name=tvMediaKey"+thisIdx+"]").val()==null || $(this).find("input[name=tvMediaKey"+thisIdx+"]").val()=='')){
 				var fileName = $(this).find("input:file[name=file]").val();
 				var ext =  fileName.split('.').pop().toLowerCase();
 				if(ext!='mp4'&&ext!='MP4'){
@@ -1530,6 +1536,7 @@
 
 	// 동영상파일 선택 시
 	$('#popSortable input[name=file]').on('change', function() {
+		console.log('888');
 		var file = this.files[0];
 		gagaKollus.upload('Display', file, $('input[name=kufKey]'));
 	});

+ 46 - 6
src/main/webapp/WEB-INF/views/display/MainMultiContentsPopupForm.html

@@ -789,6 +789,46 @@ console.log('brandGroupNo:'+brandGroupNo);
 		});
 	});
 
+	var fnUpBtn = function (obj, idx){
+		var ind = $(obj).closest('.item').index();
+		if(ind>0){
+			$('#goodsListTd'+idx).find(".item").eq(ind-1).before($('#goodsListTd'+idx).find(".item").eq(ind));
+			$('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=setDispOrd]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=setDispOrd]").val())+1);
+			$('#goodsListTd'+idx).find(".item").eq(ind-1).find("input[name=setDispOrd]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind-1).find("input[name=setDispOrd]").val())-1);
+			$('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=dispOrdEdit]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=dispOrdEdit]").val())+1);
+			$('#goodsListTd'+idx).find(".item").eq(ind-1).find("input[name=dispOrdEdit]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind-1).find("input[name=dispOrdEdit]").val())-1);
+		}
+	}
+
+	var fnDownBtn = function (obj, idx){
+		var ind = $(obj).closest('.item').index();
+		if(ind<$("#goodsListTd"+idx).find('.goodsClass').length){
+			$('#goodsListTd'+idx).find(".item").eq(ind+1).after($('#goodsListTd'+idx).find(".item").eq(ind));
+			$('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=setDispOrd]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=setDispOrd]").val())-1);
+			$('#goodsListTd'+idx).find(".item").eq(ind+1).find("input[name=setDispOrd]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind+1).find("input[name=setDispOrd]").val())+1);
+			$('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=dispOrdEdit]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind).find("input[name=dispOrdEdit]").val())-1);
+			$('#goodsListTd'+idx).find(".item").eq(ind+1).find("input[name=dispOrdEdit]").val(Number($('#goodsListTd'+idx).find(".item").eq(ind+1).find("input[name=dispOrdEdit]").val())+1);
+		}
+	}
+
+	var fnUpdownBtn = function (obj, gubun, idx){
+		if(gubun=='up'){
+			var ind = $(obj).closest('.item').index();
+			$('#goodsListTd'+idx).find(".item").eq(0).before($('#goodsListTd'+idx).find(".item").eq(ind));
+			$('#goodsListTd'+idx).find('.goodsClass').each(function (j){
+				$(this).find('input[name=dispOrdEdit]').val(j+1);
+			});
+		}else{
+			var ind = $(obj).closest('.item').index();
+			let lastNum = $("#goodsListTd"+idx).find('.goodsClass').length;
+			$('#goodsListTd'+idx).find(".item").eq(lastNum-1).after($('#goodsListTd'+idx).find(".item").eq(ind));
+			$('#goodsListTd'+idx).find('.goodsClass').each(function (j){
+				$(this).find('input[name=dispOrdEdit]').val(j+1);
+			});
+		}
+
+	}
+
 	/**
 	 * 상품추가
 	 */
@@ -809,12 +849,12 @@ console.log('brandGroupNo:'+brandGroupNo);
 				html += '<ul id="goodsUl'+i+'" class="item ui-state-default goodsClass" style="min-height:200px;"> ';
 				html += '<li class="img">';
 				html += '<img src="'+imgPath+ "/" +param[i].sysImgNm+'" onerror="this.src=\'/image/no.png\';"/>';
-				// html += '<div class="btnArea">';
-				// html += '<button type="button" class="icnSm" title="맨위로" onclick="fnUpdownBtn(\''+param[i].goodsCd+'\', \''+param[i].dispOrd+'\', \'up\');"><i class="fa fa-play-circle fa-rotate-270" aria-hidden="true"></i></button>';
-				// html += '<button type="button" class="icnSm" title="위로"><i class="fa fa-arrow-up" aria-hidden="true"></i></button>';
-				// html += '<button type="button" class="icnSm" title="맨아래로" onclick="fnUpdownBtn(\''+param[i].goodsCd+'\', \''+param[i].dispOrd+'\', \'down\');"><i class="fa fa-play-circle fa-rotate-90" aria-hidden="true"></i></button>';
-				// html += '<button type="button" class="icnSm" title="아래로"><i class="fa fa-arrow-down" aria-hidden="true"></i></button>';
-				// html += '</div>';
+				html += '<div class="btnArea">';
+				html += '<button type="button" class="icnSm" title="맨위로" onclick="fnUpdownBtn(this, \'up\', \''+goodsIdx+'\');"><i class="fa fa-play-circle fa-rotate-270" aria-hidden="true"></i></button>';
+				html += '<button type="button" class="icnSm" title="위로" onclick="fnUpBtn(this, \''+goodsIdx+'\');"><i class="fa fa-arrow-up" aria-hidden="true"></i></button>';
+				html += '<button type="button" class="icnSm" title="맨아래로" onclick="fnUpdownBtn(this, \'down\', \''+goodsIdx+'\');"><i class="fa fa-play-circle fa-rotate-90" aria-hidden="true"></i></button>';
+				html += '<button type="button" class="icnSm" title="아래로" onclick="fnDownBtn(this, \''+goodsIdx+'\');"><i class="fa fa-arrow-down" aria-hidden="true"></i></button>';
+				html += '</div>';
 				html += '</li>';
 				html += '<li class="cont">';
 				html += '<ul>';