Browse Source

메인전시 수정

bin2107 4 years ago
parent
commit
aa62381f40
1 changed files with 141 additions and 9 deletions
  1. 141 9
      src/main/webapp/WEB-INF/views/display/MainMultiContentsPopupForm.html

+ 141 - 9
src/main/webapp/WEB-INF/views/display/MainMultiContentsPopupForm.html

@@ -102,9 +102,10 @@ console.log('brandGroupNo:'+brandGroupNo);
 			html += '</td>';
 			html += '<td class="aL">';
 			if(contentsLoc=='SMM007') {
-				html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow(\'#\',this);">기획전/배너추가</button>';
-				html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
-				html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
+				html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow2(\'#\',this, '+i+');">기획전/배너추가</button>';
+				// html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow(\'#\',this);">기획전/배너추가</button>';
+				// html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
+				// html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
 			}
 			html += '<button type="button" class="btn btn-base btn-lg" id="addGoodsBtn'+i+'" onclick="fnAddGoodsRow(this);">상품추가</button>';
 			html += '<button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteBrandRow(this);">삭제</button></td>';
@@ -163,14 +164,49 @@ console.log('brandGroupNo:'+brandGroupNo);
 					var strVar = eval("result[" + i + "].strVar" + j);
 					var strTitle = eval("result["+i+"].strTitle" + j);
 					var subText = eval("result["+i+"].subText" + j);
+
 					if (!gagajf.isNull(strVar) || !gagajf.isNull(imgPath)) {
-						html += fnAddPlanRow(strVar, imgPath);
+						// html += fnAddPlanRow(strVar, imgPath);
 					}
 					if(strTitle!=null && strTitle!='null' && strTitle!='' ){
-						html += fnAddTitlePopRow(strTitle);
+						// html += fnAddTitlePopRow(strTitle);
 					}
 					if(subText!=null && subText!='null' && subText!='' ){
-						html += fnAddSubTextPopRow(subText);
+						// html += fnAddSubTextPopRow(subText);
+					}
+					if(!gagajf.isNull(strVar) || !gagajf.isNull(imgPath) || (strTitle!=null && strTitle!='null' && strTitle!='') || (subText!=null && subText!='null' && subText!='')){
+						var src = '';
+						var img_Path = '';
+						if(!gagajf.isNull(imgPath)){
+							src = $("#uploadDefaultPlanUrlPop").val().replace('/contents/planning/', '')+imgPath;
+							img_Path = imgPath;
+						}
+						html += '<tr name="planRow" class="planTr'+i+'">';
+
+						html += '<th rowspan="3">링크/이미지 <br> 타이틀 <br> 서브텍스트</th>';
+						html += '<td><input type="text" name="planLink" id="planLink'+i+'" value="'+strVar+'" placeholder="링크"></td>';
+						html += '<td><div class="uFile w300">';
+						html += '<input id="planFile_'+i+'" name="file" type="file" class="uFileInput w300" onchange="fnPlanFileUpload(this, '+i+')"/>';
+						html += '<label for="planFile_'+i+'" class="uFileLabel">파일선택</label>';
+						html += '<input type="hidden" name="planImgPath" value="'+img_Path+'"/>';
+						html += '<input type="hidden" name="planNewImgFile" value="" />';
+						html += '</div>';
+						html += '<div id="planImgViewPop_'+i+'" class=';
+						if(src!=''){
+							html += '"on">';
+						}else{
+							html += '"off">';
+						}
+						html += '<img id="planPreViewUrlPop_'+i+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'planPreimgViewPop\',$(this).attr(\'src\'));"/>';
+						html += '</div></td>';
+						html += '<td class="aL"><button type="button" class="btn icn" onclick="fnBrandPickDeleteTrRow(this,'+i+', '+i+');"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
+						html += '</tr>';
+						html += '<tr class="planTr'+i+'">';
+						html += '<td><input name="title" type="text" maxlength="200" placeholder="타이틀" value="'+strTitle+'"/></td>';
+						html += '</tr>';
+						html += '<tr class="planTr'+i+'">';
+						html += '<td><input type="text" name="subText" maxlength="200" placeholder="서브텍스트" value="'+subText+'"/></td>';
+						html += '</tr>';
 					}
 				}
 			}
@@ -178,6 +214,40 @@ console.log('brandGroupNo:'+brandGroupNo);
 				// console.log(fnAddGoodsRow(result[i].contentsGoodsList));
 				html += fnAddGoodsRow(result[i].contentsGoodsList , i);
 			}
+
+			// var src = '';
+			// var imgPath = '';
+			// if(!gagajf.isNull(result[i].imgPath1)){
+			// 	src = $("#uploadDefaultPlanUrlPop").val().replace('/contents/planning/', '')+result[i].imgPath1;
+			// 	imgPath = result[i].imgPath1;
+			// }
+			// html += '<tr name="planRow" class="planTr'+i+'">';
+			//
+			// html += '<th rowspan="3">링크/이미지 <br> 타이틀 <br> 서브텍스트</th>';
+			// html += '<td><input type="text" name="planLink" id="planLink'+i+'" value="'+result[i].strVar1+'" placeholder="링크"></td>';
+			// html += '<td><div class="uFile w300">';
+			// html += '<input id="planFile_'+i+'" name="file" type="file" class="uFileInput w300" onchange="fnPlanFileUpload(this, '+i+')"/>';
+			// html += '<label for="planFile_'+i+'" class="uFileLabel">파일선택</label>';
+			// html += '<input type="hidden" name="planImgPath" value="'+imgPath+'"/>';
+			// html += '<input type="hidden" name="planNewImgFile" value="" />';
+			// html += '</div>';
+			// html += '<div id="planImgViewPop_'+i+'" class=';
+			// if(src!=''){
+			// 	html += '"on">';
+			// }else{
+			// 	html += '"off">';
+			// }
+			// html += '<img id="planPreViewUrlPop_'+i+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'planPreimgViewPop\',$(this).attr(\'src\'));"/>';
+			// html += '</div></td>';
+			// html += '<td class="aL"><button type="button" class="btn icn" onclick="fnBrandPickDeleteTrRow(this,'+i+', '+i+');"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
+			// html += '</tr>';
+			// html += '<tr class="planTr'+i+'">';
+			// html += '<td><input name="title" type="text" maxlength="200" placeholder="타이틀" value="'+result[i].strTitle1+'"/></td>';
+			// html += '</tr>';
+			// html += '<tr class="planTr'+i+'">';
+			// html += '<td><input type="text" name="subText" maxlength="200" placeholder="서브텍스트" value="'+result[i].subText1+'"/></td>';
+			// html += '</tr>';
+
 			html += '</tbody></table>';
 		}
 		$("#multiPopSortable").append(html);
@@ -198,6 +268,7 @@ console.log('brandGroupNo:'+brandGroupNo);
 			defaultDate: $('.schDate').val()
 		});
 		tableLen = $(".tableTest").length;
+		planImgIndex2 = $(".tableTest").length;
 	}
 
 	/**
@@ -273,9 +344,10 @@ console.log('brandGroupNo:'+brandGroupNo);
 		html += '</td>';
 		html += '<td class="aL">';
 		if(contentsLoc=='SMM007') {
-			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow(\'#\',this);">기획전/배너추가</button>';
-			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
-			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
+			html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow2(\'#\',this, '+brandIdx+');">기획전/배너추가</button>';
+			// html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddPlanRow(\'#\',this);">기획전/배너추가</button>';
+			// html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddTitlePopRow(this);">타이틀추가</button>';
+			// html += '<button type="button" class="btn btn-base btn-lg" onclick="fnAddSubTextPopRow(this);">서브텍스트추가</button>';
 		}
 		html += '<button type="button" class="btn btn-base btn-lg" id="addGoodsBtn'+brandIdx+'" onclick="fnAddGoodsRow(this);">상품추가</button>';
 		html += '<button type="button" class="btn btn-danger btn-lg" onclick="fnDeleteBrandRow(this);">삭제</button></td>';
@@ -412,6 +484,60 @@ console.log('brandGroupNo:'+brandGroupNo);
 		$("#"+tblNm).find("input[name=brandGroupNo]").val(result[0].brandGroupNo);
 	}
 
+	/**
+	 * 기획전/배너 추가
+	 */
+	var planImgIndex2 = 0;
+	var fnAddPlanRow2 = function (strvar, param , tableIdx){
+		var src = '';
+		var imgPath = '';
+		if(typeof param!='object'){
+			src = $("#uploadDefaultPlanUrlPop").val().replace('/contents/planning/', '')+param;
+			imgPath = param;
+		}
+		var html = '<tr name="planRow" class="planTr'+planImgIndex2+'">';
+
+		html += '<th rowspan="3">링크/이미지 <br> 타이틀 <br> 서브텍스트</th>';
+		html += '<td><input type="text" name="planLink" id="planLink'+planImgIndex2+'" value="'+strvar+'" placeholder="링크"></td>';
+		html += '<td><div class="uFile w300">';
+		html += '<input id="planFile_'+planImgIndex2+'" name="file" type="file" class="uFileInput w300" onchange="fnPlanFileUpload(this, '+planImgIndex2+')"/>';
+		html += '<label for="planFile_'+planImgIndex2+'" class="uFileLabel">파일선택</label>';
+		html += '<input type="hidden" name="planImgPath" value="'+imgPath+'"/>';
+		html += '<input type="hidden" name="planNewImgFile" value="" />';
+		html += '</div>';
+		html += '<div id="planImgViewPop_'+planImgIndex2+'" class=';
+		if(src!=''){
+			html += '"on">';
+		}else{
+			html += '"off">';
+		}
+		html += '<img id="planPreViewUrlPop_'+planImgIndex2+'" src="'+src+'" style="height:100px; max-width:500px;"  onclick="cfnOpenImagePreViewPopup(\'planPreimgViewPop\',$(this).attr(\'src\'));"/>';
+		html += '</div></td>';
+		html += '<td class="aL"><button type="button" class="btn icn" onclick="fnBrandPickDeleteTrRow(this,'+planImgIndex2+', '+tableIdx+');"><i class="fa fa-times" aria-hidden="true"></i></button></td>';
+		html += '</tr>';
+
+		html += '<tr class="planTr'+planImgIndex2+'">';
+		html += '<td><input name="title" type="text" maxlength="200" placeholder="타이틀" value=""/></td>';
+		html += '</tr>';
+
+		html += '<tr class="planTr'+planImgIndex2+'">';
+		html += '<td><input type="text" name="subText" maxlength="200" placeholder="서브텍스트" value=""/></td>';
+
+		html += '</tr>';
+
+		if(typeof param == 'object'){
+			if($(param).closest("table").find("tbody").find("tr[name=planRow]").length>4){
+				mcxDialog.alert("기획전/배너는 5개까지 등록 가능합니다");
+				return;
+			}
+			planImgIndex2++;
+			$(param).closest("table").find("tbody").append(html);
+		}else{
+			planImgIndex2++;
+			return html;
+		}
+	}
+
 	/**
 	 * 기획전/배너 추가
 	 */
@@ -533,6 +659,12 @@ console.log('brandGroupNo:'+brandGroupNo);
 		$(obj).closest("tr").remove();
 	}
 
+	var fnBrandPickDeleteTrRow = function (obj, planIdx, tableIdx){
+		$("#tabTable"+tableIdx).find('.planTr'+planIdx).each(function (i){
+			$(this).remove();
+		});
+	}
+
 	// 컨텐츠 추가 날짜 설정
 	var fnCreateTimeOption = function(val, sel) {
 		var html = '';