Merge branch 'feat/Video' into 'develop'
Feat/video See merge request !7
Showing
5 changed files
with
67 additions
and
35 deletions
| ... | @@ -16,7 +16,7 @@ router.get('/', function (req, res) { | ... | @@ -16,7 +16,7 @@ router.get('/', function (req, res) { |
| 16 | } | 16 | } |
| 17 | if (videos.length != 0) { | 17 | if (videos.length != 0) { |
| 18 | // 빈 배열 체크 | 18 | // 빈 배열 체크 |
| 19 | - console.log(videos); | 19 | + //console.log(videos); |
| 20 | var items = { | 20 | var items = { |
| 21 | category: category[i], | 21 | category: category[i], |
| 22 | videos: videos, | 22 | videos: videos, | ... | ... |
| ... | @@ -54,6 +54,22 @@ router.get('/products/detail/:id', function (req, res) { | ... | @@ -54,6 +54,22 @@ router.get('/products/detail/:id', function (req, res) { |
| 54 | var video = []; | 54 | var video = []; |
| 55 | //제품정보를 받고 그안에서 댓글을 받아온다. | 55 | //제품정보를 받고 그안에서 댓글을 받아온다. |
| 56 | CategoriModel.find({ product_id: req.params.id }, function (err, comments) { | 56 | CategoriModel.find({ product_id: req.params.id }, function (err, comments) { |
| 57 | + VideoModel.find(function (err, myVideo) { | ||
| 58 | + var mitem = []; // 카테고리별 비디오 목록을 담아두는 배열 | ||
| 59 | + var videos = []; // 비디오 목록을 담는 임시 배열 | ||
| 60 | + for (var j in myVideo) { | ||
| 61 | + if (product.title == myVideo[j].categori) { | ||
| 62 | + videos.push(myVideo[j].title); | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + if (videos.length != 0) { | ||
| 66 | + // 빈 배열 체크 | ||
| 67 | + //console.log(videos); | ||
| 68 | + var items = videos; | ||
| 69 | + mitem.push(items); | ||
| 70 | + } | ||
| 71 | + //console.log(item[2].category.title); | ||
| 72 | + //console.log(item[2].videos); | ||
| 57 | if (word != null) { | 73 | if (word != null) { |
| 58 | var count = 0; | 74 | var count = 0; |
| 59 | youtube.addParam('order', 'rating'); // 평점 순으로 정렬 | 75 | youtube.addParam('order', 'rating'); // 평점 순으로 정렬 |
| ... | @@ -61,7 +77,7 @@ router.get('/products/detail/:id', function (req, res) { | ... | @@ -61,7 +77,7 @@ router.get('/products/detail/:id', function (req, res) { |
| 61 | youtube.addParam('videoLicense', 'creativeCommon'); // 크리에이티브 커먼즈 아이템만 불러옴 | 77 | youtube.addParam('videoLicense', 'creativeCommon'); // 크리에이티브 커먼즈 아이템만 불러옴 |
| 62 | youtube.search(word, limit, function (err, result) { | 78 | youtube.search(word, limit, function (err, result) { |
| 63 | // 검색 실행 | 79 | // 검색 실행 |
| 64 | - console.log(word); | 80 | + //console.log(word); |
| 65 | if (err) { | 81 | if (err) { |
| 66 | console.log(err); | 82 | console.log(err); |
| 67 | } // 에러일 경우 에러공지하고 빠져나감 | 83 | } // 에러일 경우 에러공지하고 빠져나감 |
| ... | @@ -92,17 +108,21 @@ router.get('/products/detail/:id', function (req, res) { | ... | @@ -92,17 +108,21 @@ router.get('/products/detail/:id', function (req, res) { |
| 92 | product: product, | 108 | product: product, |
| 93 | comments: comments, | 109 | comments: comments, |
| 94 | videos: video, | 110 | videos: video, |
| 111 | + items: mitem, | ||
| 95 | }); | 112 | }); |
| 96 | }); | 113 | }); |
| 97 | } else { | 114 | } else { |
| 115 | + //console.log(item[0]); | ||
| 98 | res.render('category/productsDetail', { | 116 | res.render('category/productsDetail', { |
| 99 | product: product, | 117 | product: product, |
| 100 | comments: comments, | 118 | comments: comments, |
| 101 | videos: video, | 119 | videos: video, |
| 120 | + items: mitem, | ||
| 102 | }); | 121 | }); |
| 103 | } | 122 | } |
| 104 | }); | 123 | }); |
| 105 | }); | 124 | }); |
| 125 | + }); | ||
| 106 | }); | 126 | }); |
| 107 | 127 | ||
| 108 | router.post('/products/detail/:id', loginRequired, function (req, res) { | 128 | router.post('/products/detail/:id', loginRequired, function (req, res) { | ... | ... |
| ... | @@ -3,6 +3,24 @@ | ... | @@ -3,6 +3,24 @@ |
| 3 | <div class="panel-heading"> | 3 | <div class="panel-heading"> |
| 4 | <%=product.title%> | 4 | <%=product.title%> |
| 5 | </div> | 5 | </div> |
| 6 | + <div style="padding-bottom: 10px"> | ||
| 7 | + 작성일 : | ||
| 8 | + <%=product.getDate.year%> - | ||
| 9 | + <%=product.getDate.month%> - | ||
| 10 | + <%=product.getDate.day%> | ||
| 11 | + </div> | ||
| 12 | + <div> | ||
| 13 | + <% var count=0; %> | ||
| 14 | + 보유중인 영상 | ||
| 15 | + <% for (var i in items[0]) { %> | ||
| 16 | + <div> | ||
| 17 | + <%=items[0][i]%> | ||
| 18 | + </div> | ||
| 19 | + <%count++;};%> | ||
| 20 | + </div> | ||
| 21 | + <div> | ||
| 22 | + 설명 : <%=product.description%> | ||
| 23 | + </div> | ||
| 6 | <form method="get" action=""> | 24 | <form method="get" action=""> |
| 7 | <div class="input-group"> | 25 | <div class="input-group"> |
| 8 | <input type="text" class="form-control" placeholder="검색 키워드를 입력하세요!" name="keyword" autocomplete='off'> | 26 | <input type="text" class="form-control" placeholder="검색 키워드를 입력하세요!" name="keyword" autocomplete='off'> |
| ... | @@ -30,18 +48,6 @@ | ... | @@ -30,18 +48,6 @@ |
| 30 | <button class="btn btn-primary" style="margin-top: 10px; margin-left: 15px;" >영상담기</button> | 48 | <button class="btn btn-primary" style="margin-top: 10px; margin-left: 15px;" >영상담기</button> |
| 31 | </form> | 49 | </form> |
| 32 | <div class="panel-body"> | 50 | <div class="panel-body"> |
| 33 | - <div style="padding-bottom: 10px"> | ||
| 34 | - 작성일 : | ||
| 35 | - <%=product.getDate.year%> - | ||
| 36 | - <%=product.getDate.month%> - | ||
| 37 | - <%=product.getDate.day%> | ||
| 38 | - </div> | ||
| 39 | - <% if(product.thumbnail){%> | ||
| 40 | - <p> | ||
| 41 | - <img src="/uploads/<%=product.thumbnail%>" style="max-width: 100%"/> | ||
| 42 | - </p> | ||
| 43 | - <% } %> | ||
| 44 | - <%=product.description%> | ||
| 45 | <!-- 댓글영역 --> | 51 | <!-- 댓글영역 --> |
| 46 | <div> | 52 | <div> |
| 47 | 댓글작성하기 | 53 | 댓글작성하기 | ... | ... |
| 1 | <% include ./includes/header.ejs %> | 1 | <% include ./includes/header.ejs %> |
| 2 | <div id="masonry_container"> | 2 | <div id="masonry_container"> |
| 3 | - 한식 | 3 | + <% var count = 0; %> |
| 4 | - <% for (var i in videos) { %> | 4 | + <% for (var i in video) { %> |
| 5 | - <div id="<%=videos[i].id%>" vid="<%=videos[i].video_id%>"> | 5 | + <div> |
| 6 | + <%=video[i].category.title%> | ||
| 6 | </div> | 7 | </div> |
| 7 | - <%};%> | 8 | + <% for (var j in video[i].videos) { %> |
| 9 | + <div id="<%=count%>" vid="<%=video[i].videos[j].video_id%>"> | ||
| 10 | + </div> | ||
| 11 | + <%count++;};};%> | ||
| 8 | </div> | 12 | </div> |
| 9 | 13 | ||
| 10 | -<style type="text/css"> | 14 | + <style type="text/css"> |
| 11 | -.masonry-grid img { max-width: 260px; } | 15 | + .masonry-grid img { |
| 12 | -</style> | 16 | + max-width: 260px; |
| 13 | -<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> | 17 | + } |
| 14 | -<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.1/imagesloaded.pkgd.min.js"></script> | 18 | + </style> |
| 15 | -<script type="text/javascript"> | 19 | + <script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> |
| 20 | + <script type="text/javascript" | ||
| 21 | + src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.1/imagesloaded.pkgd.min.js"></script> | ||
| 22 | + <script type="text/javascript"> | ||
| 16 | var $masonry_container = $('#masonry_container'); | 23 | var $masonry_container = $('#masonry_container'); |
| 17 | - $masonry_container.imagesLoaded(function(){ | 24 | + $masonry_container.imagesLoaded(function () { |
| 18 | $masonry_container.masonry({ | 25 | $masonry_container.masonry({ |
| 19 | - itemSelector : '.masonry-grid', | 26 | + itemSelector: '.masonry-grid', |
| 20 | - columnWidth : 270 | 27 | + columnWidth: 270 |
| 21 | }); | 28 | }); |
| 22 | }); | 29 | }); |
| 23 | -</script> | 30 | + </script> |
| 24 | -<script> | 31 | + <script> |
| 25 | var tag = document.createElement('script'); | 32 | var tag = document.createElement('script'); |
| 26 | 33 | ||
| 27 | tag.src = "https://www.youtube.com/iframe_api"; | 34 | tag.src = "https://www.youtube.com/iframe_api"; |
| 28 | var firstScriptTag = document.getElementsByTagName('script')[0]; | 35 | var firstScriptTag = document.getElementsByTagName('script')[0]; |
| 29 | firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | 36 | firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
| 30 | - | ||
| 31 | var player; | 37 | var player; |
| 32 | var players = []; | 38 | var players = []; |
| 33 | var videoIds = []; | 39 | var videoIds = []; |
| 34 | - for (var i = 0;i<10;i++) { | 40 | + for (var i = 0; i < 30; i++) { |
| 35 | players.push(String(i)); | 41 | players.push(String(i)); |
| 36 | - videoIds.push($('#'+i).attr('vid')); | 42 | + videoIds.push($('#' + players[i]).attr('vid')); |
| 37 | } | 43 | } |
| 38 | 44 | ||
| 39 | function onYouTubeIframeAPIReady() { | 45 | function onYouTubeIframeAPIReady() { |
| ... | @@ -56,5 +62,5 @@ | ... | @@ -56,5 +62,5 @@ |
| 56 | // } | 62 | // } |
| 57 | // function stopVideo() { | 63 | // function stopVideo() { |
| 58 | // } | 64 | // } |
| 59 | -</script> | ||
| 60 | -<% include ./includes/footer.ejs %> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 65 | + </script> | ||
| 66 | + <% include ./includes/footer.ejs %> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
| 30 | </div> | 30 | </div> |
| 31 | <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9"> | 31 | <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9"> |
| 32 | <ul class="nav navbar-nav"> | 32 | <ul class="nav navbar-nav"> |
| 33 | - <li class="active"> | 33 | + <li> |
| 34 | <a href="/">Home</a> | 34 | <a href="/">Home</a> |
| 35 | </li> | 35 | </li> |
| 36 | <li><a href="/categori/products">Categori</a></li> | 36 | <li><a href="/categori/products">Categori</a></li> | ... | ... |
-
Please register or login to post a comment