Просмотр исходного кода

Merge branch 'sowon' into develop

sowon4187 5 лет назад
Родитель
Сommit
8d7ad1eb23

+ 12 - 4
src/main/java/com/style24/front/biz/web/TsfPlanningController.java

@@ -25,6 +25,7 @@ import com.style24.front.biz.service.TsfCouponService;
 import com.style24.front.biz.service.TsfPlanningService;
 import com.style24.front.support.controller.TsfBaseController;
 import com.style24.front.support.security.session.TsfSession;
+import com.style24.persistence.TscPageRequest;
 import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.CustDeliveryAddr;
 import com.style24.persistence.domain.Customer;
@@ -238,17 +239,24 @@ public class TsfPlanningController extends TsfBaseController {
 	 * @author sowon	
 	 * @since 2021. 04. 08
 	 */
-	@GetMapping("/reply/list")
+	@PostMapping("/reply/list")
 	@ResponseBody
-	public GagaMap getReplyList(@RequestParam(value="planSq")Integer planSq) {
+	public GagaMap getReplyList(Plan plan) {
 		GagaMap result = new GagaMap();
-		Plan plan = new Plan();
-		plan.setPlanSq(planSq);
+		plan.setPlanSq(plan.getPlanSq());
 		
 		result.set("replyList",planningService.getReplyList(plan));
 		if (TsfSession.isLogin()) {
 			result.set("custNo",TsfSession.getInfo().getCustNo());
 		}
+		TscPageRequest pageable = new TscPageRequest((plan.getPageNo() > 0 ? plan.getPageNo() - 1 : 0), plan.getPageSize(), plan.getPageUnit());
+		//pageable.setTotalCount(reviewService.getCompleteReviewCount(review));
+		pageable.setTotalCount(10);
+		plan.setPageable(pageable);
+		log.info("pageable: {}", pageable);
+		log.info("totalCount {}", pageable.getTotalCount());
+		
+		result.set("paging", plan);
 		return result;
 	}
 

+ 2 - 1
src/main/java/com/style24/front/biz/web/TsfSocialController.java

@@ -1,6 +1,7 @@
 package com.style24.front.biz.web;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mobile.device.Device;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -35,7 +36,7 @@ public class TsfSocialController extends TsfBaseController {
 	 * @since 2021. 3. 11
 	 */
 	@GetMapping("/main/form")
-	public ModelAndView socialMainForm(Social social) throws Exception {
+	public ModelAndView socialMainForm(Social social, Device device) throws Exception {
 		ModelAndView mav = new ModelAndView();
 		
 		// 디바이스 set

+ 2 - 0
src/main/java/com/style24/persistence/domain/Social.java

@@ -65,6 +65,8 @@ public class Social extends TscBaseDomain{
 		private String afLinkCd;
 		private String optCd;
 		private String goodsType;
+		private String brandGroupNm;	//브랜드 그룹명
+		
 		
 		// 고객
 		private Integer custNo;		//고객번호

+ 3 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfSocial.xml

@@ -112,6 +112,9 @@
 		     , FN_GET_GOODS_NM(G.GOODS_NM,G.GOODS_GB,G.FOREIGN_BUY_YN,G.PARALLEL_IMPORT_YN,G.ORDER_MADE_YN) AS GOODS_FULL_NM /*상품FULL명*/
 		     , G.GOODS_TNM
 		     , G.GOODS_TYPE
+		     , G.BRAND_GROUP_NM
+		     , G.GOODS_NM
+		     , G.GOODS_TNM
 		     , G.MAIN_COLOR_CD
 		     , G.LIST_PRICE
 		     , FN_GET_BENEFIT_PRICE(#{frontGb},G.GOODS_CD,G.CURR_PRICE,#{custGb})                     AS CURR_PRICE    /*현재판매가*/

+ 135 - 0
src/main/webapp/WEB-INF/views/mob/social/SocialMainFormMob.html

@@ -0,0 +1,135 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org"
+	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
+	layout:decorator="mob/common/layout/DefaultLayoutMob">
+<!--
+ *******************************************************************************
+ * @source  : SocialMainFormMob.html
+ * @desc    : 핫딜(소셜) Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.04.12   sowon     최초 작성
+ *******************************************************************************
+ -->
+<body>
+<th:block layout:fragment="content">
+<main role="" id="" class="container dp">
+			<section class="content dp_hotdeal">
+				<div class="inner wide">
+                    <div class="hotdeal">
+                        <div id="countdown">
+                            <span>남은시간 </span>
+                            <span id="h-hours"></span>
+                            <span id="h-minutes"></span>
+                            <span id="h-seconds"></span>
+                        </div>
+                    </div>
+                </div>
+                <div class="inner">
+                    <div class="list_content">
+						<div class="itemsGrp rowtype"><!-- itemsGrp rank hot deal --> <!-- rowtype 추가시 가로형태로 출력 -->
+						<th:block th:each="SocialData, SocialStat : ${socialGoods}">
+							<div class="item_prod" th:class="${SocialData.stockQtySum == 0 ? 'item_prod sold_out' : 'item_prod'}">
+								<div class="item_state">
+									<button type="button" th:class="${SocialData.likeIt == 'likeit'}? 'itemLike likeit' : 'itemLike'" onclick="cfnPutWishList(this);" th:attr="goodsCd=${SocialData.goodsCd}, ithrCd='', contentsLoc='', planDtlSq=''">관심상품 추가</button>
+									 <a href="javascript:void(0);" class="itemLink" th:onclick="cfnGoToGoodsDetail([[${SocialData.goodsCd}]])" >
+										<div class="shape ranker"><span>특가</span></div>
+										<div class="itemPic">
+											<img class="vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + SocialData.sysImgNm}">
+										</div>
+										<p class="itemBrand" th:text="${SocialData.brandGroupNm}"></p>
+										<div class="itemName" th:text="${SocialData.goodsNm}"></div>
+										<p class="itemPrice">
+											<span class="itemPrice_original" th:text="${#numbers.formatInteger(SocialData.listPrice,0,'COMMA')}"></span>
+											 [[${#numbers.formatInteger(SocialData.currPrice,0,'COMMA')} + 원]]
+											<span class="itemPercent"  th:text="${#numbers.formatDecimal(SocialData.dcRate,1,0)} + '%'"></span>
+										</p>
+										<div class="itemcolorchip">
+											<span class="chip_color35" value="ABM">BEIGE</span>
+											<span class="chip_color54" value="BDS">BLACK</span>
+											<span class="chip_color40" value="YBR">WHITE</span>
+										</div>
+										<p class="itemBadge">
+											<span class="badge13">베스트 </span>
+										</p>
+										<div class="itemComment" th:if="${SocialData.goodsTnm!=null}" th:text="${SocialData.goodsTnm}"></div>
+										<div class="itemEt">
+											<div class="shopBag">
+												<button class="btn btn_default" onclick="socialAddCart(this)" th:attr="goodsCd=${SocialData.goodsCd}, minOrdQty=${SocialData.minOrdQty}, goodsType=${SocialData.goodsType}, optCd=${SocialData.optCd}"><span>쇼핑백담기</span></button>
+											</div>
+									    </div>
+									</a>
+								</div>
+							</div>
+							</th:block>
+						</div>
+                    </div>
+				</div>
+			</section>
+		</main>
+
+<script th:inline="javascript">
+var socialInfo = [[${socialInfo}]];
+var socialAddCart = function (obj) {
+	let btnType = "C";
+	let params = [];
+
+	let cart = new Object();
+    cart.goodsCd = $(obj).attr("goodsCd");
+	cart.optCd = $(obj).attr("optCd");
+	cart.goodsQty = $(obj).attr("minOrdQty");
+	cart.goodsType = $(obj).attr("goodsType");
+	cart.cartGb = btnType;
+	cart.afLinkCd = $(obj).attr("afLinkCd");
+	cart.ithrCd = "";
+	cart.contentsLoc =  "";
+	cart.planDtlSq = "";
+	params.push(cart); 
+	
+	// 장바구니담기
+	if (params.length > 0){
+		cfnAddCart(params);	
+	} 
+}
+
+
+$(function(){
+    /* 핫딜 countDown */
+    function hotdealTimer() {
+        var endTime = new Date(socialInfo.socialEddt); // 남은시간 지정
+
+            endTime = (Date.parse(endTime) / 1000);
+
+            var now = new Date();
+            now = (Date.parse(now) / 1000);
+
+            var timeLeft = endTime - now;
+
+            var days = Math.floor(timeLeft / 86400); 
+            var hours = Math.floor((timeLeft - (days * 86400)) / 3600);
+            var minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60);
+            var seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60)));
+
+            if (hours < '10') { hours = '0' + hours; }
+            if (minutes < '10') { minutes = '0' + minutes; }
+            if (seconds < '10') { seconds = '0' + seconds; }
+
+            //$('#d-days').html(days);
+            $('#h-hours').html(hours + ' :');
+            $('#h-minutes').html(minutes+ ' :');
+            $('#h-seconds').html(seconds);		
+    }
+    setInterval(function() { hotdealTimer(); }, 1000);
+    /* countDown */
+});
+</script>
+
+</th:block>
+
+</body>
+</html>

+ 116 - 66
src/main/webapp/WEB-INF/views/web/planning/PlanningDetailFormWeb.html

@@ -126,14 +126,16 @@
 								<div class="cmt_thumb">
 									<div class="form_field">
 										<div class="imgUpload">
-											<label for="fileAdd" class="fileAdd" onclick="fnFileAdd()">업로드</label>
-											<input type="file" id="fileAdd" name="files[]" />
-											<input type="hidden" id="orgFileNm" name="orgFileNm">
-											<input type="hidden" id="sysFileNm" name="sysFileNm">
+											<label for="fileAdd" class="fileAdd">업로드</label>
+											<input type="file" id="fileAdd" name="files" />
+											<th:block th:each="num: ${#numbers.sequence(1,10)}">
+											<input type="hidden" th:id="${'orgFileNm' + num}" name="orgFileNm" >
+											<input type="hidden" th:id="${'sysFileNm' + num}" name="sysFileNm">
+											</th:block>
 										</div>
 									</div>
 								</div>
-								<button type="submit" class="btn btn_dark"><span>등록</span></button>
+								<button type="button" class="btn btn_dark" onclick="fnReplySave()"><span>등록</span></button>
 							</form>
 						</div>
 						<div class="cmt_group" id="replyList">
@@ -244,6 +246,11 @@
 <form id="pollListForm" name="pollListForm" th:action="@{'/planning/event/poll/form'}" th:method="post">
 	<input type="hidden" name="planSq" th:value="${planInfo.planSq}"/>
 </form>
+<form id="searchForm" name="searchForm" th:action="@{/planning/reply/list}" th:method="post">
+	<input type="hidden" name="pageNo" value="1" />
+	<input type="hidden" name="planSq" th:value="${planInfo.planSq}" />
+	<input type="hidden" name="pageSize" value="10" />
+</form>
 
 <!-- 댓글 이미지 팝업 -->
 	<div class="modal fade thumb_img_pop" id="thumbImgPop" tabindex="-1" role="dialog" aria-labelledby="thumbImgLabel" aria-hidden="true">
@@ -268,7 +275,7 @@
         </div>        
     </div>
 	<!-- //댓글 이미지 팝업 -->	    
-
+<script src="/ux/plugins/gaga/gaga.paging.js"></script>
 <script th:inline="javascript">
 
 let review = [[${reviewInfo}]];
@@ -743,67 +750,69 @@ var fnTextConfirm = function() {
 	}
 }
 
-// 파일 업로드 확인
-var fnFileAdd = function() {
-	//로그인 확인
-	if (!cfCheckLogin()) {
-		mcxDialog.alert("로그인 후 참여 가능합니다.");
-		$("#replyText").val('');
-		return false;
-	}
+var ajaxReplyList = function () {
+	gagaPaging.init('searchForm', fnSearchCallback, 'paging', 10);
+	gagaPaging.load(1);
+	 /* $.getJSON('/planning/reply/list?planSq='+plan.planSq, function(result, status) { */
+		
+	/*  }); */
 }
 
-var ajaxReplyList = function () {
-	 $.getJSON('/planning/reply/list?planSq='+plan.planSq, function(result, status) {
-		 $("#replyList").html('');
-		 if (status == 'success') {
-			 var html = '';
-			 html += '<div class="cmt_list_tit">';
-			 html += '	<strong>댓글</strong><span class="cnt">('+result.replyList.length.addComma()+')</span>';
-			 html += '</div>';
-			 if (result.replyList.length>0) {
-				 html += '<ul class="cmt_list">';
-				 $.each(result.replyList, function (idx, item) {
-					 html += '	<li>';
-					 html += '		<div class="cmt_top">';
-					 html += '			<span class="writer">'+item.maskingCustId+'</span>';
-					 html += '			<span class="date">'+item.entryDt+'</span>';
-					 html += '		</div>';
-					 html += '		<div class="cmt_cont">';
-					 html += '			<div class="img_wrap clear">';
-					 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img01.jpg" alt="썸네일"></span>';
-					 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img02.jpg" alt="썸네일"></span>';
-					 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img03.jpg" alt="썸네일"></span>';
-					 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img04.jpg" alt="썸네일"></span>';
-					 html += '			</div>';
-					 html += '			<p>'+item.entryVal1+'</p>';
-					 if (item.entryCustNo == result.custNo) {
-						 html += '			<button class="btn btn_default btn_del"><span>삭제</span></button>';
-					}
-					 html += '		</div>';
-					 html += '	</li>';
-				 });
-				 html += '</ul>';
-			}else{
-				html += '<div class="nodata" id="replyNoData"> ';
-				html += '	<div class="txt_box">             ';
-				html += '		<p>                           ';
-				html += '			등록된 댓글이 없습니다.             ';
-				html += '		</p>                          ';
-				html += '	</div>                            ';
-				html += '</div>                                ';
-			}
-			 
-		 }
-		 $("#replyList").append(html);
-	 });
+var fnSearchCallback = function (result) {
+	 $("#replyList").html('');
+	 if (result!=null) {
+		 var html = '';
+		 html += '<div class="cmt_list_tit">';
+		 html += '	<strong>댓글</strong><span class="cnt">('+result.replyList.length.addComma()+')</span>';
+		 html += '</div>';
+		 if (result.replyList.length>0) {
+			 html += '<ul class="cmt_list">';
+			 $.each(result.replyList, function (idx, item) {
+				 html += '	<li>';
+				 html += '		<div class="cmt_top">';
+				 html += '			<span class="writer">'+item.maskingCustId+'</span>';
+				 html += '			<span class="date">'+item.entryDt+'</span>';
+				 html += '		</div>';
+				 html += '		<div class="cmt_cont">';
+				 html += '			<div class="img_wrap clear">';
+				 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img01.jpg" alt="썸네일"></span>';
+				 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img02.jpg" alt="썸네일"></span>';
+				 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img03.jpg" alt="썸네일"></span>';
+				 html += '				<span class="pics"><img class="picsThumbs" src="/images/pc/thumb/ev_list_img04.jpg" alt="썸네일"></span>';
+				 html += '			</div>';
+				 html += '			<p>'+item.entryVal1+'</p>';
+				 if (item.entryCustNo == result.custNo) {
+					 html += '			<button class="btn btn_default btn_del"><span>삭제</span></button>';
+				}
+				 html += '		</div>';
+				 html += '	</li>';
+			 });
+			 html += '</ul>';
+		}else{
+			html += '<div class="nodata" id="replyNoData"> ';
+			html += '	<div class="txt_box">             ';
+			html += '		<p>                           ';
+			html += '			등록된 댓글이 없습니다.             ';
+			html += '		</p>                          ';
+			html += '	</div>                            ';
+			html += '</div>                                ';
+		}
+		 
+	 }
+	 $("#replyList").append(html);
+	 
+	// Create pagination
+	gagaPaging.createPagination(result.paging.pageable);
 }
 
 $('#fileAdd').on('change', function() { fnChooseFile(this); });
 
-var fnChooseFile = function(obj) {
+var fnChooseFile = function(obj,fileNo) {
+	console.log($(".pics").length);
 	// multiple 속성이 있으면 files에는 다수의 객체가 할당됨
 	var file = obj.files[0];
+	
+	
 
 	if (!gagajf.isNull(file.name)) {
 		var extension = "\.(jpg|jpeg|png)$";
@@ -811,14 +820,16 @@ var fnChooseFile = function(obj) {
 			mcxDialog.alertC('이미지는 [jpg, jpeg, png] 파일만 가능합니다.', {
 				sureBtnText: "확인",
 				sureBtnClick: function() {
-					$(obj).parent('.imgUpload').finId('.removes').trigger('click');
+					$(obj).parent('.imgUpload').find('.removes').trigger('click');
+					console.log('file.size1', file.size);
 				}
 			});
 			return false;
 		}
 	}
-	
-	if (!gagajf.isNull(file.size) && Number(file.size) > 10 * 1000000) {
+	console.log('file.size2', file.size);
+	// 이거 왜 안먹히지 
+	if (!gagajf.isNull(file.size) && Number(file.size) > (10 * 1000000)) {
 		mcxDialog.alertC('이미지는 최대 10MB 이하 파일만 가능합니다.', {
 			sureBtnText: "확인",
 			sureBtnClick: function() {
@@ -829,14 +840,44 @@ var fnChooseFile = function(obj) {
 	}
 	
 	// 파일 업로드
-	gagajf.ajaxFileUpload('/common/file/upload?subDir=/reply'
+	 gagajf.ajaxFileUpload('/common/file/upload?subDir=/reply'
 			, file
 			, function(result) {
 				// 업로드한 파일명 설정
-				$('input[name=' + obj.name + 'OrgFileNm]').val(result.oldFileName);
-				$('input[name=' + obj.name + 'SysFileNm]').val(result.newFileName);
+				$('#orgFileNm' + fileNo).val(result.oldFileName);
+				$('#sysFileNm' + fileNo).val(result.newFileName);
 			}
-	);
+	); 
+}
+
+
+// 댓글 등록 버튼 클릭 시 
+var fnReplySave = function() {
+	var content = $('#replyText').val();
+	if (content.length < 2){
+		mcxDialog.alert("최소 2자 이상 입력해주세요.");
+		return;
+	}
+	
+	var yokList = new Array('개새끼','개색기','개색끼','개자식','개년','개걸래','개걸레','씨발','씨팔','씨부랄','씨바랄','시발','씹창','씹탱','씨방세','씨방새','씨펄','시펄','십탱','씨박','썅','쌍놈','쌍넘','싸가지','쓰벌','씁얼','상넘이','상놈의','상놈이','상놈을','좆','좃','존나게','존만한','같은년','넣을년','버릴년','부랄년','바랄년','미친년','니기미','니미씹','니미씨','니미럴','니미랄','호로','후레아들','호로새끼','후레자식','후래자식','후라들년','후라들넘','빠구리','병신');
+	if(yokList.indexOf(content)>=0){
+		mcxDialog.alert("입력 불가한 내용을 포함하고 있습니다.");
+		$('#replyText').val('');
+		return;
+	}
+	
+	data = {content : content};
+	var jsonData = JSON.stringify(data);
+
+	mcxDialog.confirm("댓글을 등록 하시겠습니까?", {
+		cancelBtnText : "취소",
+		sureBtnText : "확인",
+		sureBtnClick : function() {
+
+		gagajf.ajaxJsonSubmit('/planning/reply/save', jsonData,function() {
+						
+		});
+	}
 }
 
 
@@ -954,8 +995,17 @@ $(document).ready( function() {
     
 	 // 첨부파일 갯수제한
 	$('.imgUpload .fileAdd').click(function(){
+		if (!cfCheckLogin()) {
+			mcxDialog.alert("로그인 후 참여 가능합니다.");
+			$("#replyText").val('');
+			return false;
+		}
+		
 		var maxFileLength = 10; /* 최대 파일 갯수를 입력해 주세요 */
 		var imgFiles=$('.imgUpload .pics');
+		if (imgFiles.length == 10) {
+			$('#fileAdd').hide();
+		}
 		if (imgFiles.length >= maxFileLength) {
 			alert('이미지는 최대' + maxFileLength +'장 까지 첨부 가능합니다.');
 			$('#fileAdd').attr("disabled",true);

+ 2 - 2
src/main/webapp/WEB-INF/views/web/social/SocialMainFormWeb.html

@@ -48,14 +48,14 @@
                                             <img alt="BLUE-a" class=" vLHTC pd_img" th:src="${@environment.getProperty('upload.goods.view') + '/' + SocialData.sysImgNm}">
                                         </div>
                                         <div class="itemSpecialPrice"><span>특가</span></div>
-                                        <p class="itemBrand" th:text="${SocialData.brandKnm}"></p>
+                                        <p class="itemBrand" th:text="${SocialData.brandGroupNm}"></p>
                                         <div class="itemName" th:text="${SocialData.goodsNm}"></div>
                                        <div class="itemComment" th:if="${SocialData.goodsTnm!=null}" th:text="${SocialData.goodsTnm}"></div>
                                         <p class="itemPrice">
                                              [[${#numbers.formatInteger(SocialData.currPrice,0,'COMMA')} + 원]]
                                             <span class="itemPrice_original" th:text="${#numbers.formatInteger(SocialData.listPrice,0,'COMMA')} + '원'"></span>
 											<span class=" itemPercent" th:text="${#numbers.formatDecimal(SocialData.dcRate,1,0)} + '%'"></span>
-                                        </p>100 - ROUND((Z.CURR_PRICE / Z.LIST_PRICE) * 100 ,0) AS DC_RATE 
+                                        </p>
                                     </a>
                                     	 <div class="shopBagBtn">
                                             <button type="button" class="btn btn_defalt" onclick="socialAddCart(this)" th:attr="goodsCd=${SocialData.goodsCd}, minOrdQty=${SocialData.minOrdQty}, goodsType=${SocialData.goodsType}, optCd=${SocialData.optCd}">