게시판 기능만 동작

This commit is contained in:
2019-01-25 02:11:54 +09:00
parent 8d701e46df
commit f2d2d287f5
4 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ $text = Util::getReq('text');
increaseRefresh("회의실", 1); increaseRefresh("회의실", 1);
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID); $me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
$con = checkLimit($me['con']); $con = checkLimit($me['con']);
if ($con >= 2) { if ($con >= 2) {
+1 -1
View File
@@ -62,7 +62,7 @@ foreach(
) as $comment ) as $comment
){ ){
//TODO:아이콘 받아오기? //TODO:아이콘 받아오기?
$articles[$article['no']]['comment'] = $comment; $articles[$comment['document_no']]['comment'][] = $comment;
} }
Json::die([ Json::die([
+7 -5
View File
@@ -48,7 +48,8 @@ function submitArticle(){
function submitComment(){ function submitComment(){
var $this = $(this); var $this = $(this);
var $article = $this.parents('.article').eq(0);
var $article = $this.closest('.articleObj').eq(0);
var articleNo = $article.data('no'); var articleNo = $article.data('no');
var $text = $article.find('input.commentText'); var $text = $article.find('input.commentText');
var text = $.trim($text.val()); var text = $.trim($text.val());
@@ -96,8 +97,8 @@ function drawArticle(idx, articleObj){
.data('no', articleObj.no) .data('no', articleObj.no)
.data('author', articleObj.general_no); .data('author', articleObj.general_no);
console.log(articleObj);
$article.find('.articleNo').text(articleObj.no);
$article.find('.authorName').text(articleObj.author); $article.find('.authorName').text(articleObj.author);
$article.find('.articleTitle').text(articleObj.title); $article.find('.articleTitle').text(articleObj.title);
$article.find('.date').text(articleObj.date); $article.find('.date').text(articleObj.date);
@@ -107,7 +108,7 @@ function drawArticle(idx, articleObj){
var $articleComment = $article.find('ul.commentList'); var $articleComment = $article.find('ul.commentList');
$.each(articleObj.comment, function(commentObj){ $.each(articleObj.comment, function(_, commentObj){
var $comment = $commentFrame.clone(); var $comment = $commentFrame.clone();
$comment.find('.author').text(commentObj.author); $comment.find('.author').text(commentObj.author);
//$comment.find('.text').text(commentObj.text); //$comment.find('.text').text(commentObj.text);
@@ -116,6 +117,8 @@ function drawArticle(idx, articleObj){
$articleComment.append($comment); $articleComment.append($comment);
}); });
$article.find('.submitComment').click(submitComment);
var $board = $('#board'); var $board = $('#board');
$board.append($article); $board.append($article);
@@ -150,7 +153,6 @@ function loadArticles(){
$(function(){ $(function(){
$('#submitArticle').click(submitArticle); $('#submitArticle').click(submitArticle);
$('.submitComment').click(submitComment);
loadArticles() loadArticles()
.then(drawArticles, errUnknown) .then(drawArticles, errUnknown)
+2 -3
View File
@@ -77,18 +77,17 @@ var isSecretBoard = <?=($isSecretBoard?'true':'false')?>; //
<!-- 설계미스. template와 shadowdom으로 변경 --> <!-- 설계미스. template와 shadowdom으로 변경 -->
<div id='articleTemplate' style='display:none;'> <div id='articleTemplate' style='display:none;'>
<div class='articleFrame'> <div class='articleFrame'>
<div><span class='articleTitle'></span></div> <div>#<span class='articleNo'></span> <span class='articleTitle'></span></div>
<div class='authorPlate'><span class='authorIcon'></span><span class='authorName'></span><span class='date'></span></div> <div class='authorPlate'><span class='authorIcon'></span><span class='authorName'></span><span class='date'></span></div>
<div class='text'> <div class='text'>
</div>
</div> </div>
<div class='commentFrame'> <div class='commentFrame'>
<ul class='commentList'> <ul class='commentList'>
</ul> </ul>
<div> <div>
<input class='commentText' type='text' maxlength='250'></input> <input class='commentText' type='text' maxlength='250'>
<button type='button' class='submitComment'>등록</button> <button type='button' class='submitComment'>등록</button>
</div> </div>
</div> </div>