加入帖子可设置"私密"
This commit is contained in:
parent
4f89821e4e
commit
7e7f1c2b3c
@ -18,7 +18,11 @@
|
|||||||
<img src="#(x.avatar)" alt="#(x.nickname)">
|
<img src="#(x.avatar)" alt="#(x.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<h2 title="#(x.title)">
|
<h2 title="#(x.title)">
|
||||||
|
#if(x.status == 3)
|
||||||
|
<a class="layui-badge">私密</a>
|
||||||
|
#else
|
||||||
<a class="layui-badge">#(x.typeName)</a>
|
<a class="layui-badge">#(x.typeName)</a>
|
||||||
|
#end
|
||||||
<a href="/jie/detail/#(x.contentId)">
|
<a href="/jie/detail/#(x.contentId)">
|
||||||
#if(x.top == 3)
|
#if(x.top == 3)
|
||||||
<span style="color: #AB5D7C;font-weight: bold;">#(x.title)</span>
|
<span style="color: #AB5D7C;font-weight: bold;">#(x.title)</span>
|
||||||
@ -79,7 +83,11 @@
|
|||||||
<img src="#(x.avatar)" alt="#(x.nickname)">
|
<img src="#(x.avatar)" alt="#(x.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<h2 title="#(x.title)">
|
<h2 title="#(x.title)">
|
||||||
|
#if(x.status == 3)
|
||||||
|
<a class="layui-badge">私密</a>
|
||||||
|
#else
|
||||||
<a class="layui-badge">#(x.typeName)</a>
|
<a class="layui-badge">#(x.typeName)</a>
|
||||||
|
#end
|
||||||
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
|
@ -24,14 +24,14 @@
|
|||||||
<option value="20" #if(bean.type?? == 20) selected #end>分享</option>
|
<option value="20" #if(bean.type?? == 20) selected #end>分享</option>
|
||||||
<option value="30" #if(bean.type?? == 30) selected #end>讨论</option>
|
<option value="30" #if(bean.type?? == 30) selected #end>讨论</option>
|
||||||
<!--高级权限开放类别-->
|
<!--高级权限开放类别-->
|
||||||
#if(mine.userId?? == 100001)
|
#if(mine.roleId?? == 1)
|
||||||
<option value="40" #if(bean.type?? == 40) selected #end>公告</option>
|
<option value="40" #if(bean.type?? == 40) selected #end>公告</option>
|
||||||
<option value="50" #if(bean.type?? == 50) selected #end>动态</option>
|
<option value="50" #if(bean.type?? == 50) selected #end>动态</option>
|
||||||
#end
|
#end
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-md9">
|
<div class="layui-col-md6">
|
||||||
<label for="L_title" class="layui-form-label">标题</label>
|
<label for="L_title" class="layui-form-label">标题</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="hidden" name="contentId" value="#(bean.contentId??)">
|
<input type="hidden" name="contentId" value="#(bean.contentId??)">
|
||||||
@ -39,6 +39,16 @@
|
|||||||
<!-- <input type="hidden" name="id" value="{{d.edit.id}}"> -->
|
<!-- <input type="hidden" name="id" value="{{d.edit.id}}"> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-col-md3">
|
||||||
|
<label class="layui-form-label">帖子权限</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<select lay-verify="required" name="status">
|
||||||
|
<!--[内容栏目]10求助,20分享,30建议,40公告,50动态-->
|
||||||
|
<option value="1" #if(bean.status?? == 1) selected #end>公开</option>
|
||||||
|
<option value="3" #if(bean.status?? == 3) selected #end>私密(自己和管理能查看)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
<div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
|
||||||
<div class="layui-col-md3">
|
<div class="layui-col-md3">
|
||||||
|
@ -13,7 +13,11 @@
|
|||||||
<h1>#(bean.title)</h1>
|
<h1>#(bean.title)</h1>
|
||||||
<div class="fly-detail-info">
|
<div class="fly-detail-info">
|
||||||
<!-- <span class="layui-badge">审核中</span> -->
|
<!-- <span class="layui-badge">审核中</span> -->
|
||||||
<span class="layui-badge layui-bg-green fly-detail-column">#(bean.typeName)</span>
|
#if(bean.status == 3)
|
||||||
|
<span class="layui-badge layui-bg-green fly-detail-column">私密</span>
|
||||||
|
#else
|
||||||
|
<span class="layui-badge layui-bg-green fly-detail-column">#(bean.typeName)</span>
|
||||||
|
#end
|
||||||
|
|
||||||
<span class="layui-badge" style="background-color: #999;">未结</span>
|
<span class="layui-badge" style="background-color: #999;">未结</span>
|
||||||
<!-- <span class="layui-badge" style="background-color: #5FB878;">已结</span> -->
|
<!-- <span class="layui-badge" style="background-color: #5FB878;">已结</span> -->
|
||||||
@ -37,6 +41,12 @@
|
|||||||
#else
|
#else
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="wonderful" v="1">加精</span>
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="wonderful" v="1">加精</span>
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
#if(bean.status != 3)
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" v="3">设为私密</span>
|
||||||
|
#else
|
||||||
|
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="status" v="1">设为公开</span>
|
||||||
|
#end
|
||||||
</div>
|
</div>
|
||||||
#end
|
#end
|
||||||
<span class="fly-list-nums">
|
<span class="fly-list-nums">
|
||||||
|
@ -37,7 +37,11 @@
|
|||||||
<img src="#(x.avatar??)" alt="#(x.nickname)">
|
<img src="#(x.avatar??)" alt="#(x.nickname)">
|
||||||
</a>
|
</a>
|
||||||
<h2>
|
<h2>
|
||||||
|
#if(x.status == 3)
|
||||||
|
<a class="layui-badge">私密</a>
|
||||||
|
#else
|
||||||
<a class="layui-badge">#(x.typeName)</a>
|
<a class="layui-badge">#(x.typeName)</a>
|
||||||
|
#end
|
||||||
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
<a href="/jie/detail/#(x.contentId)">#(x.title)</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="fly-list-info">
|
<div class="fly-list-info">
|
||||||
|
@ -237,7 +237,7 @@ layui.define(['fly','laypage'], function(exports){
|
|||||||
|
|
||||||
form.on('submit(jie-add)', function(data){
|
form.on('submit(jie-add)', function(data){
|
||||||
var bean = {};
|
var bean = {};
|
||||||
["contentId","title", "content", "type"].forEach(function (value) {
|
["contentId","title", "content", "type", "status"].forEach(function (value) {
|
||||||
bean[value] = data.field[value];
|
bean[value] = data.field[value];
|
||||||
});
|
});
|
||||||
bean["content"] = editor.txt.html();
|
bean["content"] = editor.txt.html();
|
||||||
|
@ -190,6 +190,7 @@ public class Content implements java.io.Serializable {
|
|||||||
info.setWonderful(wonderful);
|
info.setWonderful(wonderful);
|
||||||
info.setTop(top);
|
info.setTop(top);
|
||||||
info.setSolved(solved);
|
info.setSolved(solved);
|
||||||
|
info.setStatus(status);
|
||||||
|
|
||||||
info.setTypeName(types.getOrDefault(type, "其他").toString());
|
info.setTypeName(types.getOrDefault(type, "其他").toString());
|
||||||
info.setCreateTime(LxyKit.dateFmt(createTime));
|
info.setCreateTime(LxyKit.dateFmt(createTime));
|
||||||
|
@ -54,10 +54,10 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
private int top;
|
private int top;
|
||||||
|
|
||||||
@Column(comment = "[结帖]大于0结帖")
|
@Column(comment = "[结帖]大于0结帖")
|
||||||
private int solved;*/
|
private int solved;
|
||||||
|
|
||||||
@Column(comment = "[状态]")
|
@Column(comment = "[状态]")
|
||||||
private int status = 1;
|
private int status = 1;*/
|
||||||
|
|
||||||
public void setContentId(int contentId) {
|
public void setContentId(int contentId) {
|
||||||
this.contentId = contentId;
|
this.contentId = contentId;
|
||||||
@ -139,14 +139,6 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
|||||||
this.viewNum = viewNum;
|
this.viewNum = viewNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(int status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return JsonConvert.root().convertTo(this);
|
return JsonConvert.root().convertTo(this);
|
||||||
|
@ -56,7 +56,7 @@ public class ContentService extends BaseService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "query", auth = false, comment = "内容列表")
|
@RestMapping(name = "query", auth = false, comment = "内容列表")
|
||||||
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived){
|
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived, int currentId){
|
||||||
FilterNode filterNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1);
|
FilterNode filterNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1);
|
||||||
switch (actived){
|
switch (actived){
|
||||||
case "top": filterNode.and("top", 1);break;
|
case "top": filterNode.and("top", 1);break;
|
||||||
@ -65,6 +65,12 @@ public class ContentService extends BaseService{
|
|||||||
case "solved": filterNode.and("solved", 1);break;
|
case "solved": filterNode.and("solved", 1);break;
|
||||||
case "wonderful": filterNode.and("wonderful", 1);break;
|
case "wonderful": filterNode.and("wonderful", 1);break;
|
||||||
}
|
}
|
||||||
|
if (currentId > 0){
|
||||||
|
filterNode.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 3).or(FilterNode.create("status", 3).and("userId", currentId)));
|
||||||
|
}else {
|
||||||
|
filterNode.and("status", FilterExpress.NOTEQUAL, 3);
|
||||||
|
}
|
||||||
|
|
||||||
return contentQuery(flipper, filterNode);
|
return contentQuery(flipper, filterNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +108,7 @@ public class ContentService extends BaseService{
|
|||||||
|
|
||||||
source.insert(content);
|
source.insert(content);
|
||||||
}else {
|
}else {
|
||||||
source.updateColumn(content, SelectColumn.createIncludes("title", "digest", "content","type"));
|
source.updateColumn(content, SelectColumn.createIncludes("title", "digest", "content","type", "status"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return RetResult.success();
|
return RetResult.success();
|
||||||
@ -206,7 +212,7 @@ public class ContentService extends BaseService{
|
|||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", 0);
|
||||||
|
|
||||||
//最新加入
|
//最新加入
|
||||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||||
|
@ -47,11 +47,11 @@ public class IndexServlet extends BaseServlet {
|
|||||||
Flipper flipper = new Flipper().limit(30).sort("top DESC,createTime DESC");
|
Flipper flipper = new Flipper().limit(30).sort("top DESC,createTime DESC");
|
||||||
//置顶贴
|
//置顶贴
|
||||||
FilterNode topNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", FilterExpress.GREATERTHAN, 0);
|
FilterNode topNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", FilterExpress.GREATERTHAN, 0);
|
||||||
Sheet<ContentInfo> top = contentService.contentQuery(flipper, topNode);
|
Sheet<ContentInfo> top = contentService.contentQuery(flipper, setPrivate(topNode));
|
||||||
|
|
||||||
//非置顶贴
|
//非置顶贴
|
||||||
FilterNode untopNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", 0);
|
FilterNode untopNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", 0);
|
||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, untopNode);
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(untopNode));
|
||||||
|
|
||||||
//热帖
|
//热帖
|
||||||
/*Flipper flipper2 = new Flipper().limit(8).sort("viewNum DESC");
|
/*Flipper flipper2 = new Flipper().limit(8).sort("viewNum DESC");
|
||||||
@ -59,7 +59,7 @@ public class IndexServlet extends BaseServlet {
|
|||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId());
|
||||||
|
|
||||||
//最新加入
|
//最新加入
|
||||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||||
@ -86,11 +86,11 @@ public class IndexServlet extends BaseServlet {
|
|||||||
if (solved > -1) filterNode.and("solved", solved);
|
if (solved > -1) filterNode.and("solved", solved);
|
||||||
if (wonderful > -1) filterNode.and("wonderful", wonderful);
|
if (wonderful > -1) filterNode.and("wonderful", wonderful);
|
||||||
|
|
||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, filterNode);
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(filterNode));
|
||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId());
|
||||||
|
|
||||||
|
|
||||||
Kv kv = Kv.by("contents", contents).set("hotReply", hotReply)
|
Kv kv = Kv.by("contents", contents).set("hotReply", hotReply)
|
||||||
@ -194,7 +194,7 @@ public class IndexServlet extends BaseServlet {
|
|||||||
|
|
||||||
//分页帖子列表
|
//分页帖子列表
|
||||||
Flipper flipper = new Flipper().offset((curr-1)*15).limit(15).sort("top DESC,createTime DESC");
|
Flipper flipper = new Flipper().offset((curr-1)*15).limit(15).sort("top DESC,createTime DESC");
|
||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived);
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived, currentId());
|
||||||
|
|
||||||
Kv kv = Kv.by("contents", contents).set("url", request.getRequestURI())
|
Kv kv = Kv.by("contents", contents).set("url", request.getRequestURI())
|
||||||
.set("actived", actived).set("curr", curr);
|
.set("actived", actived).set("curr", curr);
|
||||||
@ -227,7 +227,7 @@ public class IndexServlet extends BaseServlet {
|
|||||||
|
|
||||||
//热议
|
//热议
|
||||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId());
|
||||||
|
|
||||||
//更新
|
//更新
|
||||||
CompletableFuture.supplyAsync(new Supplier<String>() {
|
CompletableFuture.supplyAsync(new Supplier<String>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user