(window.webpackJsonp=window.webpackJsonp||[]).push([[32],{1221:function(e,t,n){"use strict";n.r(t);var o=n(4),a=(n(11),n(64),n(42),n(39),n(814)),r=n(815),s=n(995),i=n(144),c=n(434),m=n.n(c),l={components:{DeleteEventCommentModal:n(996).a,EventFormModal:s.a,Button:a.a,Typo:r.a,notification:i.a},data:function(){return{eventInfo:{id:0,event_name:"",banner_content:"",banner_text_color:"",banner_img:"",m_banner_img:"",start_date:"",end_date:"",top_yn:"N",main_img:"",detail_img:"",btn_name:"",btn_color:"",btn_text_color:"",btn_expose_yn:"N",btn_exec_yn:"N",in_popup_yn:"N",out_link:"",my_apply_yn:"N",my_comment_written_yn:"N",my_comment_blocked_yn:"N"},eventComments:{comment_id:0,reg_name:"",content:"",created_at:"",reg_id:""},eventCommentsCount:0,isLoading:!0,showEventFormtModal:!1,showDelCommentModal:!1,id:0,content:"",showNoti:!1,notiMsg:"",isModifyComment:!1,isDisavailable:!1,userId:"",delCommentId:0,isWriteComment:!1,isPreview:""}},mounted:function(){this.getEventDetail();var e=JSON.parse(localStorage.getItem("user"));e&&(this.userId=e.id),window.addEventListener("popstate",(function(e){window.document.body.style.overflow="auto"}))},methods:{goToOutLink:function(e,t){var n=this;return Object(o.a)(regeneratorRuntime.mark((function o(){var a;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(!(a=JSON.parse(localStorage.getItem("user")))){o.next=17;break}return o.prev=2,n.isLoading=!0,o.next=6,n.$axios({method:"post",headers:{Authorization:a.token},url:"/event_boards/".concat(e,"/apply")});case 6:return n.isLoading=!1,o.next=9,n.getEventDetail();case 9:o.next=14;break;case 11:o.prev=11,o.t0=o.catch(2);case 14:window.open(t,"_blank"),o.next=19;break;case 17:localStorage.setItem("fromUrl","/event/".concat(e)),n.$router.push("/auth/login");case 19:case"end":return o.stop()}}),o,null,[[2,11]])})))()},ShowModal:function(e){JSON.parse(localStorage.getItem("user"))?"Y"===this.eventInfo.btn_exec_yn&&(this.showEventFormtModal=!0,window.document.body.style.overflow="hidden"):(localStorage.setItem("fromUrl","/event/".concat(e)),this.$router.push("/auth/login"))},checkEvent:function(e){var t=this;return Object(o.a)(regeneratorRuntime.mark((function n(){var o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!(o=JSON.parse(localStorage.getItem("user")))){n.next=18;break}return n.prev=2,t.isLoading=!0,n.next=6,t.$axios({method:"post",headers:{Authorization:o.token},url:"/event_boards/".concat(e,"/apply")});case 6:return t.isLoading=!1,n.next=9,t.getEventDetail();case 9:n.next=16;break;case 11:return n.prev=11,n.t0=n.catch(2),n.next=16,t.activeNoti(n.t0.response.data.error);case 16:n.next=20;break;case 18:localStorage.setItem("fromUrl","/event/".concat(e)),t.$router.push("/auth/login");case 20:case"end":return n.stop()}}),n,null,[[2,11]])})))()},showDeleteCommentModal:function(e){this.showDelCommentModal=!0,this.delCommentId=e},closeModal:function(){this.showEventFormtModal=!1,this.showDelCommentModal=!1,window.document.body.style.overflow="auto"},checkModifyComment:function(){this.isModifyComment=!0},getEventDetail:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){var n,o,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,e.isLoading=!0,!(n=JSON.parse(localStorage.getItem("user")))){t.next=12;break}return t.next=6,e.$axios({method:"get",headers:{Authorization:n.token},url:"/event_boards/".concat(e.$route.params.eventId)});case 6:o=t.sent,e.eventInfo=o.data.event_info,e.eventComments=o.data.event_comments,e.eventCommentsCount=o.data.event_comments_count,t.next=18;break;case 12:return t.next=14,e.$axios({method:"get",url:"/event_boards/".concat(e.$route.params.eventId)});case 14:a=t.sent,e.eventInfo=a.data.event_info,e.eventComments=a.data.event_comments,e.eventCommentsCount=a.data.event_comments_count;case 18:e.isWriteComment=e.eventComments.some((function(t){return t.reg_id===e.userId})),e.isLoading=!1,m()().isSame(e.eventInfo.start_date,"day")||m()().isSame(e.eventInfo.end_date,"day")||m()().isBetween(e.eventInfo.start_date,e.eventInfo.end_date)||(e.isDisavailable=!0),t.next=32;break;case 23:if(t.prev=23,t.t0=t.catch(0),e.isLoading=!1,401!==t.t0.response.status){t.next=32;break}return t.next=30,e.$store.dispatch("refreshToken");case 30:return t.next=32,e.getReserveList();case 32:e.content="";case 33:case"end":return t.stop()}}),t,null,[[0,23]])})))()},addComment:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n=JSON.parse(localStorage.getItem("user")))){t.next=18;break}return t.prev=2,t.next=5,e.$axios({method:"post",url:"/event_boards/".concat(e.$route.params.eventId,"/event_board_comments"),headers:{Authorization:n.token},data:{id:e.eventInfo.id,content:e.content}});case 5:return t.next=7,e.activeNoti("댓글이 등록되었습니다.");case 7:return e.$emit("refresh"),t.next=10,e.getEventDetail();case 10:t.next=16;break;case 12:t.prev=12,t.t0=t.catch(2),e.activeNoti(t.t0.response.data.error);case 16:t.next=19;break;case 18:e.checkCommentLogin();case 19:case"end":return t.stop()}}),t,null,[[2,12]])})))()},checkCommentLogin:function(e){var t=this;localStorage.setItem("fromUrl","/event/".concat(e)),JSON.parse(localStorage.getItem("user"))||(this.activeNoti("로그인 후 댓글을 작성하실 수 있습니다."),setTimeout((function(){t.$router.push("/auth/login")}),1e3))},modifyComment:function(e,t){var n=this;return Object(o.a)(regeneratorRuntime.mark((function o(){var a;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return n.content||(n.content=t),o.prev=1,a=JSON.parse(localStorage.getItem("user")),o.next=5,n.$axios({method:"put",headers:{Authorization:a.token},url:"/event_boards/".concat(n.eventInfo.id,"/event_board_comments/").concat(e),data:{id:n.eventInfo.id,comment_id:e,content:n.content}});case 5:return o.sent,o.next=8,n.activeNoti("댓글이 수정되었습니다.");case 8:n.$emit("refresh"),o.next=15;break;case 11:o.prev=11,o.t0=o.catch(1),n.activeNoti(o.t0.response.data.error);case 15:return n.isModifyComment=!1,o.next=18,n.getEventDetail();case 18:case"end":return o.stop()}}),o,null,[[1,11]])})))()},activeNoti:function(e){var t=this;this.notiMsg=e,this.showNoti=!0,setTimeout((function(){t.showNoti=!1}),1500)},getPlaceholderText:function(){return this.userId?"댓글을 작성해보세요.":"로그인 후 글을 작성하실 수 있습니다."}}},d=n(7),v=Object(d.a)(l,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"content_wraper",role:"main"}},[n("section",{staticClass:"contents member_wrap user_level_mo user_event_mo"},[n("div",{staticClass:"profile_inner user_event_mo"},[n("div",{staticClass:"event_detailed_img"},[n("img",{attrs:{src:""+e.eventInfo.main_img,alt:""+e.eventInfo.event_name}})]),e._v(" "),e.eventInfo.detail_img?n("div",{staticClass:"event_detailed_img"},[n("img",{attrs:{src:""+e.eventInfo.detail_img,alt:""+e.eventInfo.event_name}})]):e._e(),e._v(" "),"Y"===e.eventInfo.btn_expose_yn?n("div",{staticClass:"event_btn"},["N"!==e.eventInfo.btn_exec_yn||void 0!==e.eventInfo.my_apply_yn&&"N"!==e.eventInfo.my_apply_yn?"Y"!==e.eventInfo.btn_exec_yn||"Y"!==e.eventInfo.in_popup_yn||void 0!==e.eventInfo.my_apply_yn&&"N"!==e.eventInfo.my_apply_yn?"Y"===e.eventInfo.btn_exec_yn&&"N"===e.eventInfo.in_popup_yn?n("Button",{style:{backgroundColor:"#"+e.eventInfo.btn_color},attrs:{width:"100%",height:"80px"},on:{click:function(t){return e.goToOutLink(e.eventInfo.id,e.eventInfo.out_link)}}},[n("Typo",{attrs:{"font-color":"#"+e.eventInfo.btn_text_color,size:"20px",bold:""}},[e._v(e._s(e.eventInfo.btn_name))])],1):"Y"!==e.eventInfo.my_apply_yn||"Y"===e.eventInfo.btn_exec_yn&&"N"===e.eventInfo.in_popup_yn?e._e():n("Button",{attrs:{variant:"flat",color:"grey10",width:"100%",height:"80px"}},[n("Typo",{attrs:{color:"grey40",size:"20px",bold:""}},[e._v("이벤트 참여 신청 완료")])],1):n("Button",{style:{backgroundColor:"#"+e.eventInfo.btn_color},attrs:{width:"100%",height:"80px"},on:{click:function(t){return e.ShowModal(e.eventInfo.id)}}},[n("Typo",{attrs:{"font-color":"#"+e.eventInfo.btn_text_color,size:"20px",bold:""}},[e._v(e._s(e.eventInfo.btn_name))])],1):n("Button",{style:{backgroundColor:"#"+e.eventInfo.btn_color},attrs:{width:"100%",height:"80px"},on:{click:function(t){return e.checkEvent(e.eventInfo.id)}}},[n("Typo",{attrs:{"font-color":"#"+e.eventInfo.btn_text_color,size:"20px",bold:""}},[e._v(e._s(e.eventInfo.btn_name))])],1)],1):e._e(),e._v(" "),e.isModifyComment||e.isDisavailable||e.isWriteComment?e._e():n("div",{staticClass:"registering_comment"},[n("textarea",{directives:[{name:"model",rawName:"v-model",value:e.content,expression:"content"}],attrs:{placeholder:e.getPlaceholderText()},domProps:{value:e.content},on:{input:[function(t){t.target.composing||(e.content=t.target.value)},function(t){return e.checkCommentLogin(e.eventInfo.id)}]}}),e._v(" "),n("Button",{attrs:{variant:"flat",color:"primary",width:"69px",height:"90px","border-radius":"4px"},on:{click:e.addComment}},[n("Typo",{attrs:{color:"white",bold:""}},[e._v("등록")])],1)],1),e._v(" "),e.eventCommentsCount>0?n("div",{staticClass:"comments"},[n("p",[e._v("댓글 "),n("span",[e._v(e._s(e.eventCommentsCount))]),e._v("개")]),e._v(" "),n("ul",{staticClass:"comments_list"},e._l(e.eventComments.slice().reverse(),(function(t){return n("li",{key:t.comment_id,attrs:{eventComment:t}},[n("div",{staticClass:"comment_list__head"},[n("div",{staticClass:"comment_list__head__info"},[t.reg_name?n("span",{staticClass:"user"},[e._v(e._s(t.reg_name))]):n("span",{staticClass:"user no_data"},[e._v("게스트")]),e._v(" "),n("span",{staticClass:"date"},[e._v(e._s(t.created_at))])]),e._v(" "),t.reg_id!==e.userId||e.isDisavailable?e._e():n("div",{staticClass:"comment_list__head__button"},[n("Button",{on:{click:e.checkModifyComment}},[n("Typo",{attrs:{size:"13px"}},[e._v("수정")])],1),e._v(" "),n("Button",{on:{click:function(n){return e.showDeleteCommentModal(t.comment_id)}}},[n("Typo",{attrs:{size:"13px"}},[e._v("삭제")])],1)],1)]),e._v(" "),!e.isDisavailable&&e.isModifyComment&&e.userId===t.reg_id?n("div",{staticClass:"comment_list__text"},[n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.content,expression:"eventComment.content"}],domProps:{value:t.content},on:{input:function(n){n.target.composing||e.$set(t,"content",n.target.value)}}}),e._v(" "),n("Button",{attrs:{variant:"flat",color:"primary",width:"69px",height:"90px","border-radius":"4px"},on:{click:function(n){return e.modifyComment(t.comment_id,t.content)}}},[n("Typo",{attrs:{color:"white",bold:""}},[e._v("수정")])],1)],1):n("div",{staticClass:"comment_list__text"},[e._v(e._s(t.content))])])})),0)]):e._e()]),e._v(" "),n("notification",{attrs:{message:e.notiMsg,notiStatus:e.showNoti},on:{"update:notiStatus":function(t){e.showNoti=t},"update:noti-status":function(t){e.showNoti=t}}}),e._v(" "),e.showEventFormtModal?n("EventFormModal",{attrs:{modalStatus:e.showEventFormtModal,eventId:e.eventInfo.id},on:{"update:modalStatus":function(t){e.showEventFormtModal=t},"update:modal-status":function(t){e.showEventFormtModal=t},activeNoti:e.activeNoti,getEventDetail:e.getEventDetail}}):e._e(),e._v(" "),e.showDelCommentModal?n("DeleteEventCommentModal",{attrs:{modalStatus:e.showDelCommentModal,eventId:e.eventInfo.id,eventCommentId:e.delCommentId,userId:e.userId},on:{"update:modalStatus":function(t){e.showDelCommentModal=t},"update:modal-status":function(t){e.showDelCommentModal=t},activeNoti:e.activeNoti,getEventDetail:e.getEventDetail}}):e._e(),e._v(" "),n("div",{staticClass:"dimmed",staticStyle:{"z-index":"30"},style:[e.showEventFormtModal&&{display:"block"},e.showDelCommentModal&&{display:"block"}],on:{click:e.closeModal}})],1)])}),[],!1,null,null,null);t.default=v.exports}}]);