Skip to content

Commit

Permalink
完善后台畅言评论设置及统计代码设置
Browse files Browse the repository at this point in the history
  • Loading branch information
livisky committed Jul 2, 2016
1 parent a553ac8 commit 8cd96e0
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 72 deletions.
49 changes: 34 additions & 15 deletions liblog.sql

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/admin/controller/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,16 @@ export default class extends Base {
let rs=await this.model('system').where({id:1}).update(mydata);
if(rs) return this.success();
}
async commenteditAction(){
let mydata =await this.post();
let rs=await this.model('system_comment').where({id:1}).update(mydata);
if(rs) return this.success();
}
async setcommentAction(){
this.assign("title","评论设置");
let sysdata=await this.model('system_comment').where({id:1}).find();
this.assign('sysdata',sysdata);
return this.display();
}
}

34 changes: 16 additions & 18 deletions src/home/controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export default class extends Base {

let actList=await this.model("article").where({item:6,ispublished:1}).limit(5).order("createtime DESC").select();
let now=new Date().getTime();

let setting=await this.model('system_comment').where({id:1}).find();
this.assign("setting",setting);

this.assign('actList',actList);
return this.display();
}
Expand Down Expand Up @@ -42,17 +46,9 @@ export default class extends Base {
}
}
}

//关联文章
let relatearticle=await this.model("article").where({tag:blogInfo.tag,ispublished:1}).limit(6).select();
this.assign("relatearticle",relatearticle);
////判断登陆
//let userinfo=await this.session("userInfo");
//let showComment=false;
//if(!think.isEmpty(userinfo)){
// showComment=true;
//}
//this.assign('showComment',showComment);

//跳转到内容分页
let tagname=tagItem.tagname||'';
Expand All @@ -68,17 +64,19 @@ export default class extends Base {


//获取评论{belongid: {'=': 0},
//let commentList= await this.model('comment').where({belongid: {'=': 0},aid:aid}).select();
//let replyList= await this.model('comment').where({belongid: {'>': 0},aid:aid}).select();
//let count= await this.model('comment').where({aid:aid}).count();
//if(commentList.length===0){
// commentList=replyList;
//}
//this.assign("commentList",commentList);
//this.assign("replyList",replyList);
//this.assign("count",count);

let commentList= await this.model('comment').where({belongid: {'=': 0},aid:aid}).select();
let replyList= await this.model('comment').where({belongid: {'>': 0},aid:aid}).select();
let count= await this.model('comment').where({aid:aid}).count();
if(commentList.length===0){
commentList=replyList;
}
this.assign("commentList",commentList);
this.assign("replyList",replyList);
this.assign("count",count);

//设置畅言appid及appkey
let setting=await this.model('system_comment').where({id:1}).find();
this.assign("setting",setting);

return this.display();
}else{
Expand Down
28 changes: 15 additions & 13 deletions view/admin/content_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="page-container" style="margin-bottom: 140px;">
<% if(!isdraft){ %>
<div class="text-c">
<input type="text" name="searchText" id="searchText" placeholder=" 文章名称" style="width:250px" class="input-text">
<input type="text" name="searchText" id="searchText" placeholder="文章名称或ID" style="width:250px" class="input-text">
<button name="" id="search_article" class="btn btn-success" type="submit"><i class="Hui-iconfont"></i> 搜资讯</button>
</div>
<%}%>
Expand All @@ -26,18 +26,20 @@
<i class="Hui-iconfont"></i> 批量删除
</a>
</span>
<span class="r">
标记筛选&nbsp;
<span class="select-box inline">
<select name="" class="select" id="markselect">
<option value="" <%=(type==="all")?'selected':''%> >全部文章</option>
<option value="totop" <%=(type==="totop")?'selected':''%> >文章置顶</option>
<option value="torecom" <%=(type==="torecom")?'selected':''%> >站长推荐</option>
<option value="topicrecom" <%=(type==="topicrecom")?'selected':''%> >图文推荐</option>
</select>
<input type="hidden" id="markval" value="<%=type%>">
</span>&nbsp;
</span>
<% if(!isdraft){ %>
<span class="r">
标记筛选&nbsp;
<span class="select-box inline">
<select name="" class="select" id="markselect">
<option value="" <%=(type==="all")?'selected':''%> >全部文章</option>
<option value="totop" <%=(type==="totop")?'selected':''%> >文章置顶</option>
<option value="torecom" <%=(type==="torecom")?'selected':''%> >站长推荐</option>
<option value="topicrecom" <%=(type==="topicrecom")?'selected':''%> >图文推荐</option>
</select>
<input type="hidden" id="markval" value="<%=type%>">
</span>&nbsp;
</span>
<%}%>
</div>

<div class="dataTables_wrapper no-footer">
Expand Down
3 changes: 0 additions & 3 deletions view/admin/inc/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
<script src="<%=_web.url%>static/src/js/widget/angular/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=_web.url%>static/admin//js/H-ui.js"></script>
<script type="text/javascript" src="<%=_web.url%>static/admin/js/H-ui.admin.js"></script>
<!--<script src="<%=_web.url%>static/src/js/widget/angular/angular-1.4.6.min.js"></script> -->
<!--<script src="<%=_web.url%>static/src/js/widget/angular/bootstrap.min.js"></script>-->
<!--<script src="<%=_web.url%>static/src/js/widget/angular/ui-bootstrap-tpls-0.10.0.js"></script>-->
<style>
.breadcrumb{padding: 0 15px;}
.wangEditor-menu-shadow { z-index: 9999;}
Expand Down
2 changes: 1 addition & 1 deletion view/admin/inc/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<dd>
<ul>
<li><a _href="/admin/system" data-title="系统设置" href="javascript:void(0)">常规设置</a></li>
<li><a _href="/admin/system" data-title="系统设置" href="javascript:void(0)">账号设置</a></li>
<li><a _href="/admin/system/setcomment" data-title="评论设置" href="javascript:void(0)">评论设置</a></li>
<li><a _href="/admin/system" data-title="系统设置" href="javascript:void(0)">邮件设置</a></li>
</ul>
</dd>
Expand Down
6 changes: 6 additions & 0 deletions view/admin/system_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<div class="formControls col-xs-8 col-sm-9">
<textarea class="form-control textarea links" name="link" rows="4" cols="50" placeholder="友情链接" style="width: 100%; height: 98px;resize:none"><%=_web.links%></textarea></div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>统计代码:</label>
<div class="formControls col-xs-8 col-sm-9">
<textarea class="form-control textarea tongji" name="link" rows="4" cols="50" placeholder="统计代码" style="width: 100%; height: 98px;resize:none"><%=_web.tongji%></textarea></div>
</div>
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-secondary radius" id="savetag" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
Expand All @@ -69,6 +74,7 @@
author:$(".author").val(),
copyright:$(".copyright").val(),
links:$(".links").val(),
tongji:$(".tongji").val(),
__CSRF__:G_csrf
}
$.ajax({
Expand Down
62 changes: 62 additions & 0 deletions view/admin/system_setcomment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html >
<%include inc/header.html%>
<title><%=title%></title>
<body>
<!-- Table -->
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> <a href="/admin/index/welcome">首页</a><span class="c-gray en">&gt;</span> 畅言评论设置 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
<form class="form form-horizontal" id="form-article-add">
<input type="hidden" value="" id="aid"/>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>APP ID:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" class="input-text appid" value="<%-sysdata.appid%>" placeholder="" id="" name="">
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>APP KEY:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" class="input-text appkey" value="<%=sysdata.appkey%>" placeholder="" id="" name="">
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>安装代码:</label>
<div class="formControls col-xs-8 col-sm-9">
<textarea class="form-control textarea appcode" name="link" rows="4" cols="50" placeholder="安装代码" style="width: 100%; height: 98px;resize:none"><%=sysdata.appcode%></textarea></div>
</div>
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-secondary radius" id="savetag" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
<button onClick="window.location.href='/admin/system'" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
</div>
</div>
</form>
</article>

<script type="text/javascript">
$(function(){
$("#savetag").click(function(){
var newData={
appid:$(".appid").val(),
appkey:$(".appkey").val(),
appcode:$(".appcode").val(),
__CSRF__:G_csrf
}
$.ajax({
url:'/admin/system/commentedit',
data:newData,
type:'POST',
success:function(json){
if(json.errno===0){
alert("保存成功!");
window.location.href="/admin/system/setcomment"
}
}
})
})

})
</script>
</body>
</html>
12 changes: 3 additions & 9 deletions view/home/inc/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
</footer>
<script src="<%=_web.url%>static/src/js/widget/angular/jquery-1.9.1.min.js"></script>
<script src="<%=_web.url%>static/src/js/business/pagecommon/footer.js"></script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?8c04fc9ebc7d286e7c03911b6affb970";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!--访客统计代码-->
<%-_web.tongji%>
<!--访客统计代码-->
2 changes: 1 addition & 1 deletion view/home/index_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ <h3><a href="/page/<%=item.id%>.html"><%=item.title%></a></h3>
</div>
</article>
<%include inc/footer.html%>
<script id="cy_cmt_num" src="http://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cysoRJNxO"></script>
<script id="cy_cmt_num" src="http://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=<%=setting.appid%>"></script>
</body>
</html>
17 changes: 5 additions & 12 deletions view/home/index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="description" content="<%=title%>-<%=_web.sitename%>">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<%include inc/header.html%>
<link rel="stylesheet" href="<%=_web.url%>/static/vendors/github-markdown/github-markdown.css">
<link rel="stylesheet" href="<%=_web.url%>static/vendors/github-markdown/github-markdown.css">
<style>
#ds-reset #replyat{float: left;line-height: 40px;padding-left: 10px;}
.com-post-report{display: none;}
Expand Down Expand Up @@ -92,22 +92,15 @@ <h1 class="article-title"><%-blogInfo.title%></h1>
</ul>
</div>
</div>
<!--高速版-->
<script type="text/javascript" src="http://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
<div id="SOHUCS" sid="<%-blogInfo.id%>"></div>
<script charset="utf-8" type="text/javascript" src="http://changyan.sohu.com/upload/changyan.js" ></script>
<script type="text/javascript">
window.changyan.api.config({
appid: 'cysoRJNxO',
conf: 'prod_1fbcbcaf3589e576afe2785fe80d6684'
});
</script>
<!--畅言评论代码-->
<%-setting.appcode%>
<!--畅言评论代码-->
</article>
</div>
</div>
<%include inc/right.html%>
</article>
<%include inc/footer.html%>
<script src="<%=_web.url%>/static/src/js/business/page/page.js"></script>
<script src="<%=_web.url%>static/src/js/business/page/page.js"></script>
</body>
</html>

0 comments on commit 8cd96e0

Please sign in to comment.