diff --git a/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp b/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp index e1a46eb..5fcd674 100644 --- a/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp +++ b/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp @@ -63,7 +63,24 @@
- +
+ 대분류 + +
+
+ 중분류 + +
+
+ 소분류 + +
@@ -189,11 +206,92 @@ $("#enrollBtn").on("click",function(e){ }); -/* -$(document).ready(function(){ - console.log('${cateList}'); -}); -*/ + +/* 카테고리 */ + let cateList = JSON.parse('${cateList}'); + + let cate1Array = new Array(); + let cate2Array = new Array(); + let cate3Array = new Array(); + let cate1Obj = new Object(); + let cate2Obj = new Object(); + let cate3Obj = new Object(); + + let cateSelect1 = $(".cate1"); + let cateSelect2 = $(".cate2"); + let cateSelect3 = $(".cate3"); + + /* 카테고리 배열 초기화 메서드 */ + function makeCateArray(obj,array,cateList, tier){ + for(let i = 0; i < cateList.length; i++){ + if(cateList[i].tier === tier){ + obj = new Object(); + + obj.cateName = cateList[i].cateName; + obj.cateCode = cateList[i].cateCode; + obj.cateParent = cateList[i].cateParent; + + array.push(obj); + + } + } + } + + /* 배열 초기화 */ + makeCateArray(cate1Obj,cate1Array,cateList,1); + makeCateArray(cate2Obj,cate2Array,cateList,2); + makeCateArray(cate3Obj,cate3Array,cateList,3); + + /* + $(document).ready(function(){ + console.log(cate1Array); + console.log(cate2Array); + console.log(cate3Array); + }); + */ + + /* 대분류 "); + } + + + /* 중분류 "); + cateSelect3.append(""); + + for(let i = 0; i < cate2Array.length; i++){ + if(selectVal1 === cate2Array[i].cateParent){ + cateSelect2.append(""); + } + }// for + + }); + + /* 소분류 "); + + for(let i = 0; i < cate3Array.length; i++){ + if(selectVal2 === cate3Array[i].cateParent){ + cateSelect3.append(""); + } + }// for + + }); + diff --git a/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css b/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css index dc71bbc..ad9498a 100644 --- a/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css +++ b/VamPa/src/main/webapp/resources/css/admin/goodsEnroll.css @@ -172,6 +172,20 @@ input[name='publeYear'] { text-align: center; } +.form_section_content select { /* 카테고리 css 설정 */ + width: 92%; + height: 35px; + font-size: 20px; + text-align-last: center; + margin-left: 5px; +} +.cate_wrap span { + font-weight: 600; +} +.cate_wrap:not(:first-child) { + margin-top: 20px; +} + /* 버튼 영역 */ .btn_section{ diff --git a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 3a16d28..291a3f1 100644 --- a/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Thu Mar 25 12:47:17 KST 2021 +#Mon Mar 29 18:10:20 KST 2021 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa m2e.projectName=VamPa groupId=com.vam diff --git a/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp b/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp index e1a46eb..5fcd674 100644 --- a/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp +++ b/VamPa_MySQL/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp @@ -63,7 +63,24 @@
- +
+ 대분류 + +
+
+ 중분류 + +
+
+ 소분류 + +
@@ -189,11 +206,92 @@ $("#enrollBtn").on("click",function(e){ }); -/* -$(document).ready(function(){ - console.log('${cateList}'); -}); -*/ + +/* 카테고리 */ + let cateList = JSON.parse('${cateList}'); + + let cate1Array = new Array(); + let cate2Array = new Array(); + let cate3Array = new Array(); + let cate1Obj = new Object(); + let cate2Obj = new Object(); + let cate3Obj = new Object(); + + let cateSelect1 = $(".cate1"); + let cateSelect2 = $(".cate2"); + let cateSelect3 = $(".cate3"); + + /* 카테고리 배열 초기화 메서드 */ + function makeCateArray(obj,array,cateList, tier){ + for(let i = 0; i < cateList.length; i++){ + if(cateList[i].tier === tier){ + obj = new Object(); + + obj.cateName = cateList[i].cateName; + obj.cateCode = cateList[i].cateCode; + obj.cateParent = cateList[i].cateParent; + + array.push(obj); + + } + } + } + + /* 배열 초기화 */ + makeCateArray(cate1Obj,cate1Array,cateList,1); + makeCateArray(cate2Obj,cate2Array,cateList,2); + makeCateArray(cate3Obj,cate3Array,cateList,3); + + /* + $(document).ready(function(){ + console.log(cate1Array); + console.log(cate2Array); + console.log(cate3Array); + }); + */ + + /* 대분류 "); + } + + + /* 중분류 "); + cateSelect3.append(""); + + for(let i = 0; i < cate2Array.length; i++){ + if(selectVal1 === cate2Array[i].cateParent){ + cateSelect2.append(""); + } + }// for + + }); + + /* 소분류 "); + + for(let i = 0; i < cate3Array.length; i++){ + if(selectVal2 === cate3Array[i].cateParent){ + cateSelect3.append(""); + } + }// for + + }); + diff --git a/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css b/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css index dc71bbc..ad9498a 100644 --- a/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css +++ b/VamPa_MySQL/src/main/webapp/resources/css/admin/goodsEnroll.css @@ -172,6 +172,20 @@ input[name='publeYear'] { text-align: center; } +.form_section_content select { /* 카테고리 css 설정 */ + width: 92%; + height: 35px; + font-size: 20px; + text-align-last: center; + margin-left: 5px; +} +.cate_wrap span { + font-weight: 600; +} +.cate_wrap:not(:first-child) { + margin-top: 20px; +} + /* 버튼 영역 */ .btn_section{ diff --git a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties index 7143c38..871b8a0 100644 --- a/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties +++ b/VamPa_MySQL/target/m2e-wtp/web-resources/META-INF/maven/com.vam/controller/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven Integration for Eclipse -#Thu Mar 25 15:08:52 KST 2021 +#Mon Mar 29 18:10:21 KST 2021 m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project\\VamPa_MySQL m2e.projectName=VamPa_MySQL groupId=com.vam