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 a3294bd..1e1d098 100644
--- a/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp
+++ b/VamPa/src/main/webapp/WEB-INF/views/admin/goodsEnroll.jsp
@@ -135,6 +135,16 @@
책 목차를 입력해주세요.
+
+
+
@@ -452,7 +462,60 @@ $("#enrollBtn").on("click",function(e){
});
+
+ /* 이미지 업로드 */
+ $("input[name='bookPrice']").on("change", function(){
+ let userInput = $("#discount_interface");
+ let discountInput = $("input[name='bookDiscount']");
+
+ let discountRate = userInput.val(); // 사용자가 입력한 할인값
+ let sendDiscountRate = discountRate / 100; // 서버에 전송할 할인값
+ let goodsPrice = $("input[name='bookPrice']").val(); // 원가
+ let discountPrice = goodsPrice * (1 - sendDiscountRate); // 할인가격
+
+ if(!isNaN(discountRate)){
+ $(".span_discount").html(discountPrice);
+ }
+
+
+ });
+
+ /* 이미지 업로드 */
+ $("input[type='file']").on("change", function(e){
+
+ let fileInput = $('input[name="uploadFile"]');
+ let fileList = fileInput[0].files;
+ let fileObj = fileList[0];
+
+ if(!fileCheck(fileObj.name, fileObj.size)){
+ return false;
+ }
+
+ alert("통과");
+
+ });
+
+ /* var, method related with attachFile */
+ let regex = new RegExp("(.*?)\.(jpg|png)$");
+ let maxSize = 1048576; //1MB
+
+ function fileCheck(fileName, fileSize){
+
+ if(fileSize >= maxSize){
+ alert("파일 사이즈 초과");
+ return false;
+ }
+
+ if(!regex.test(fileName)){
+ alert("해당 종류의 파일은 업로드할 수 없습니다.");
+ return false;
+ }
+
+ return true;
+
+ }
+
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 a3294bd..f8d64e7 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
@@ -135,6 +135,14 @@
책 목차를 입력해주세요.
+
@@ -436,6 +444,7 @@ $("#enrollBtn").on("click",function(e){
});
+ /* 이미지 업로드 */
$("input[name='bookPrice']").on("change", function(){
let userInput = $("#discount_interface");
@@ -452,7 +461,41 @@ $("#enrollBtn").on("click",function(e){
});
+
+ /* 이미지 업로드 */
+ $("input[type='file']").on("change", function(e){
+ let fileInput = $('input[name="uploadFile"]');
+ let fileList = fileInput[0].files;
+ let fileObj = fileList[0];
+
+ if(!fileCheck(fileObj.name, fileObj.size)){
+ return false;
+ }
+
+ alert("통과");
+
+ });
+
+ /* var, method related with attachFile */
+ let regex = new RegExp("(.*?)\.(jpg|png)$");
+ let maxSize = 1048576; //1MB
+
+ function fileCheck(fileName, fileSize){
+
+ if(fileSize >= maxSize){
+ alert("파일 사이즈 초과");
+ return false;
+ }
+
+ if(!regex.test(fileName)){
+ alert("해당 종류의 파일은 업로드할 수 없습니다.");
+ return false;
+ }
+
+ return true;
+
+ }