Преглед изворни кода

Merge branch 'sowon' into develop

sowon4187 пре 5 година
родитељ
комит
baf5121ce5

+ 6 - 0
src/main/java/com/style24/persistence/domain/Review.java

@@ -100,6 +100,12 @@ public class Review extends TscBaseDomain {
 	private String itemNm;
 	private String colorNm;	
 	
+	
+
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] orgFileNmArr;
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] sysFileNmArr;
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] itemNmArr;		// 옵션코드
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)

+ 1 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsfReview.xml

@@ -1007,7 +1007,7 @@
 		SET R.DEL_YN = 'Y'
 		WHERE 1=1
  		AND R.REVIEW_SQ = #{reviewSq}
- 		AND R.ADM_RPL IS NULL
+ 		-- AND R.ADM_RPL IS NULL
  		AND R.CUST_NO = #{custNo}
 	</update>
 	

+ 24 - 8
src/main/webapp/WEB-INF/views/web/mypage/MypageReviewCreateFormWeb.html

@@ -341,8 +341,8 @@
 														<!-- 이미지첨부 -->
 														<div class="form_field">
 															<div class="imgUpload">
-																<label for="fileAdd" class="fileAdd">첫번째업로드</label>
-																<input type="file" id="fileAdd" name="files[]">
+																<label for="fileAdd" class="fileAdd" id="fileAdd_reply">첫번째업로드</label>
+																<input type="file" id="fileAdd" name="files">
 															</div>
 														</div>
 														<!-- //이미지첨부 -->
@@ -551,10 +551,25 @@ $('#reviewContent').keyup(function (e){
 $('#fileAdd').on('change', function() { fnChooseFile(this); });
 
 var fnChooseFile = function(obj) {
+	var picLength = $(".pics").length;
+	
 	// multiple 속성이 있으면 files에는 다수의 객체가 할당됨
 	var file = obj.files[0];
-	
-	if (!gagajf.isNull(file.size) && Number(file.size) > 10 * 1000000) {
+
+	if (!gagajf.isNull(file.name)) {
+		var extension = "\.(jpg|jpeg|png)$";
+		if (!(new RegExp(extension, "i")).test(file.name)) {
+			mcxDialog.alertC('이미지는 [jpg, jpeg, png] 파일만 가능합니다.', {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$(obj).parent('.imgUpload').find('.removes').trigger('click');
+				}
+			});
+			return false;
+		}
+	}
+	// 이거 왜 안먹히지 
+	if (!gagajf.isNull(file.size) && Number(file.size) > (10 * 1000000)) {
 		mcxDialog.alertC('이미지는 최대 10MB 이하 파일만 가능합니다.', {
 			sureBtnText: "확인",
 			sureBtnClick: function() {
@@ -565,16 +580,17 @@ var fnChooseFile = function(obj) {
 	}
 	
 	// 파일 업로드
-	gagajf.ajaxFileUpload('/common/file/upload?subDir=/review'
+	 gagajf.ajaxFileUpload('/common/file/upload?subDir=/review'
 			, file
 			, function(result) {
 				// 업로드한 파일명 설정
-				$('input[name=' + obj.name + 'OrgFileNm]').val(result.oldFileName);
-				$('input[name=' + obj.name + 'SysFileNm]').val(result.newFileName);
+				$(".pics").children().eq(0).append("<input type='hidden' name='orgFileNmArr' id='orgFileNm"+(picLength+1)+"' value='"+result.oldFileName+"'>");
+				$(".pics").children().eq(0).append("<input type='hidden' name='sysFileNmArr' id='sysFileNm"+(picLength+1)+"' value='"+result.newFileName+"'>");
 			}
-	);
+	); 
 }
 
+
 $(document).ready(function() {
 	if (reviewList.goodsType == 'G056_S') {
 		$.each(reviewList.colorNmArr, function(index, option) {

+ 37 - 38
src/main/webapp/WEB-INF/views/web/planning/PlanningDetailFormWeb.html

@@ -551,7 +551,6 @@ if(goods4.length>0){
 			html += '<div class="cont_head">';
 			html += '<div>';
 			html += '        <h4>';
-			console.log(template[i].linkOpenGb );
 			if (template[i].linkUrl != null && template[i].linkUrl != '') { /* 링크 변경 예정 */
 				if (template[i].linkOpenGb == "M") { //본창
 					html += '        <a href="http://'+template[i].linkUrl+'" target="_self">'+template[i].title+' <i class="ico_arrow"></i></a>';
@@ -798,7 +797,7 @@ var fnSearchCallback = function (result) {
 				 html += '			<span class="date">'+item.entryDt+'</span>';
 				 html += '		</div>';
 				 html += '		<div class="cmt_cont">';
-				 html += '			<div class="img_wrap clear">';
+				 html += '			<div class="img_wrap clear" onclick="fnImgAttach(this)">';
 				 if (result.replyAttachList.length>0) {
 					for (var i = 0; i < result.replyAttachList.length; i++) {
 						if(result.replyAttachList[i].planEntrySq == item.planEntrySq){
@@ -930,12 +929,47 @@ var fnReplySave = function() {
 		gagajf.ajaxJsonSubmit('/planning/reply/save', jsonData,function() {
 			ajaxReplyList();	
 			$('#replyText').val('');
+			$('.pics').remove();
 			});
 		}
 	})
 }
 
 
+var fnImgAttach = function (obj) {
+	 $("#thumbImgPop .swiper-wrapper").empty();
+	//var popSlideIndex = $(obj).find('span').length -1;
+	var popSlideIndex = 0;
+	contactPopSwiper.slideTo(popSlideIndex);
+	contactPopSwiper.update();
+	
+	var contactImglength = $(obj).find('span').length;
+	var popImgHtml = "";
+	for (i = 0; i < contactImglength; i++) {
+		
+		var contactImgSrc =$(obj).find('img').eq(i).attr('src');
+		popImgHtml += "<div class='swiper-slide'><div class='pop_img' style='background-image:url("+ contactImgSrc +")'></div></div>";
+	}
+
+	$("#thumbImgPop .swiper-wrapper").append(popImgHtml);
+	$('#thumbImgPop').modal("show");
+	
+	return false;
+}
+
+/* SLIDE - 댓글 이미지 팝업 */
+var contactPopSwiper = new Swiper('.thumb_img_pop .swiper-container', {
+	navigation: {
+		nextEl: '.thumb_img_pop .swiper-button-next',
+		prevEl: '.thumb_img_pop .swiper-button-prev',
+	},
+	pagination: {
+		el: '.thumb_img_pop .swiper-pagination',
+		clickable: true,
+	},
+	observer:true,
+	observeParents: true,
+});				
 
 
 $(document).ready( function() {
@@ -1066,6 +1100,7 @@ $(document).ready( function() {
 			$('#fileAdd').removeAttr("disabled");
 		}
 	});			
+	
 
 	//댓글 작성시 글자 카운트
 	$('.cmt_ans').keyup(function (e){
@@ -1078,42 +1113,6 @@ $(document).ready( function() {
 		}
 	});
 	
-	//팝업 - 댓글 이미지 슬라이드
-	 $(document).on('click','.cmt_cont .img_wrap .pics',function(e){
-		$("#thumbImgPop .swiper-wrapper").empty();
-		var popSlideIndex = $(this).index();
-		contactPopSwiper.slideTo(popSlideIndex);
-		contactPopSwiper.update();
-
-		var contactImglength = $('.cmt_cont .img_wrap .pics').length;
-		var popImgHtml = "";
-		for (i = 1; i <= contactImglength; i++) {
-			var contactImg = $(this).find('img');
-			var contactImgSrc = $('.cmt_cont .img_wrap .pics:nth-child('+i+') img').attr('src');
-			popImgHtml += "<div class='swiper-slide'><div class='pop_img' style='background-image:url("+ contactImgSrc +")'></div></div>";
-		}
-
-		$("#thumbImgPop .swiper-wrapper").append(popImgHtml);
-		$('#thumbImgPop').modal("show");
-		
-		return false;
-	});         
-	
-	 /* SLIDE - 댓글 이미지 팝업 */
-	var contactPopSwiper = new Swiper('.thumb_img_pop .swiper-container', {
-		navigation: {
-			nextEl: '.thumb_img_pop .swiper-button-next',
-			prevEl: '.thumb_img_pop .swiper-button-prev',
-		},
-		pagination: {
-			el: '.thumb_img_pop .swiper-pagination',
-			clickable: true,
-		},
-		observer:true,
-		observeParents: true,
-	});				
-
-
 
 });
 </script>