代码提交--标签相关

This commit is contained in:
2020-09-27 17:35:31 +08:00
parent ba3c813106
commit fde1079d74
30 changed files with 788 additions and 290 deletions
@@ -1,4 +1,5 @@
package com.yaoyuan.jiscuss.common; package com.yaoyuan.jiscuss.common;
import com.yaoyuan.jiscuss.entity.custom.PostCustom; import com.yaoyuan.jiscuss.entity.custom.PostCustom;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@@ -7,6 +8,7 @@ import javax.persistence.Column;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* @author yaoyuan2.chu * @author yaoyuan2.chu
* @Title: * @Title:
@@ -77,7 +79,7 @@ public class Node {
*/ */
public static boolean addNode(List<Node> list, Node node) { public static boolean addNode(List<Node> list, Node node) {
for (Node node1 : list) { //循环添加 for (Node node1 : list) { //循环添加
if (node1.getId() .equals(node.getParentId()) ) { //判断留言的上一段是都是这条留言 if (node1.getId().equals(node.getParentId())) { //判断留言的上一段是都是这条留言
node1.getNextNodes().add(node); //是,添加,返回true; node1.getNextNodes().add(node); //是,添加,返回true;
System.out.println("添加了一个"); System.out.println("添加了一个");
return true; return true;
@@ -30,22 +30,34 @@ public class PostCommonUtil {
} }
String content = ""; String content = "";
if (mapObj.get("content") != null) { if (mapObj.get("content") != null) {
if (mapObj.get("content") instanceof Clob) {
Clob clob = (Clob) mapObj.get("content"); Clob clob = (Clob) mapObj.get("content");
content = PostCommonUtil.clobToString(clob); content = PostCommonUtil.clobToString(clob);
} else if (mapObj.get("content") instanceof String) {
content = String.valueOf(mapObj.get("content"));
}
} }
postCustom.setContent(content); postCustom.setContent(content);
String avatar = ""; String avatar = "";
if (mapObj.get("create_avatar") != null) { if (mapObj.get("create_avatar") != null) {
if (mapObj.get("create_avatar") instanceof Clob) {
Clob clob = (Clob) mapObj.get("create_avatar"); Clob clob = (Clob) mapObj.get("create_avatar");
avatar = PostCommonUtil.clobToString(clob); avatar = PostCommonUtil.clobToString(clob);
} else if (mapObj.get("create_avatar") instanceof String) {
avatar = String.valueOf(mapObj.get("create_avatar"));
}
} }
postCustom.setAvatar(avatar); postCustom.setAvatar(avatar);
postCustom.setUsername(mapObj.get("create_username") != null ? String.valueOf(mapObj.get("create_username")) : null); postCustom.setUsername(mapObj.get("create_username") != null ? String.valueOf(mapObj.get("create_username")) : null);
postCustom.setRealname(mapObj.get("create_realname") != null ? String.valueOf(mapObj.get("create_realname")) : null); postCustom.setRealname(mapObj.get("create_realname") != null ? String.valueOf(mapObj.get("create_realname")) : null);
String avatarReply = ""; String avatarReply = "";
if (mapObj.get("user_avatar") != null) { if (mapObj.get("user_avatar") != null) {
if (mapObj.get("user_avatar") instanceof Clob) {
Clob clob = (Clob) mapObj.get("user_avatar"); Clob clob = (Clob) mapObj.get("user_avatar");
avatarReply = PostCommonUtil.clobToString(clob); avatarReply = PostCommonUtil.clobToString(clob);
} else if (mapObj.get("user_avatar") instanceof String) {
avatarReply = String.valueOf(mapObj.get("user_avatar"));
}
} }
postCustom.setAvatarReply(avatarReply); postCustom.setAvatarReply(avatarReply);
postCustom.setUsernameReply(mapObj.get("user_username") != null ? String.valueOf(mapObj.get("user_username")) : null); postCustom.setUsernameReply(mapObj.get("user_username") != null ? String.valueOf(mapObj.get("user_username")) : null);
@@ -59,29 +71,29 @@ public class PostCommonUtil {
public static List<PostCustom> getNewPostsObjCustom(List<PostCustom> postCustomList) { public static List<PostCustom> getNewPostsObjCustom(List<PostCustom> postCustomList) {
List<PostCustom> mainList = new ArrayList<>(); List<PostCustom> mainList = new ArrayList<>();
Map<String, Object> postMap = new LinkedHashMap<>(); Map<String, Object> postMap = new LinkedHashMap<>();
for(PostCustom mapObj : postCustomList){ for (PostCustom mapObj : postCustomList) {
if(null == mapObj.getParentId() ){ if (null == mapObj.getParentId()) {
mainList.add(mapObj); mainList.add(mapObj);
}else{ } else {
List<PostCustom> tempList = new ArrayList<>(); List<PostCustom> tempList = new ArrayList<>();
if(postMap.containsKey(String.valueOf(mapObj.getParentId()))){ if (postMap.containsKey(String.valueOf(mapObj.getParentId()))) {
tempList = (List<PostCustom>) postMap.get(String.valueOf(mapObj.getParentId())); tempList = (List<PostCustom>) postMap.get(String.valueOf(mapObj.getParentId()));
tempList.add(mapObj); tempList.add(mapObj);
postMap.put(String.valueOf(mapObj.getParentId()),tempList); postMap.put(String.valueOf(mapObj.getParentId()), tempList);
}else{ } else {
tempList.add(mapObj); tempList.add(mapObj);
postMap.put(String.valueOf(mapObj.getParentId()),tempList); postMap.put(String.valueOf(mapObj.getParentId()), tempList);
} }
} }
} }
List<PostCustom> mainListResult = new ArrayList<>(); List<PostCustom> mainListResult = new ArrayList<>();
for(PostCustom mapObj : mainList){ for (PostCustom mapObj : mainList) {
if(postMap.containsKey(String.valueOf(mapObj.getId()))){ if (postMap.containsKey(String.valueOf(mapObj.getId()))) {
PostCustom newObj = new PostCustom(); PostCustom newObj = new PostCustom();
BeanUtils.copyProperties(mapObj , newObj); BeanUtils.copyProperties(mapObj, newObj);
newObj.setChild((List<PostCustom>) postMap.get(String.valueOf(mapObj.getId()))); newObj.setChild((List<PostCustom>) postMap.get(String.valueOf(mapObj.getId())));
mainListResult.add(newObj); mainListResult.add(newObj);
}else{ } else {
mainListResult.add(mapObj); mainListResult.add(mapObj);
} }
} }
@@ -1,4 +1,5 @@
package com.yaoyuan.jiscuss.config; package com.yaoyuan.jiscuss.config;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -15,15 +15,15 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
/** /**
prePostEnabled :决定Spring Security的前注解是否可用 [@PreAuthorize,@PostAuthorize,..] * prePostEnabled :决定Spring Security的前注解是否可用 [@PreAuthorize,@PostAuthorize,..]
secureEnabled : 决定是否Spring Security的保障注解 [@Secured] 是否可用 * secureEnabled : 决定是否Spring Security的保障注解 [@Secured] 是否可用
jsr250Enabled :决定 JSR-250 annotations 注解[@RolesAllowed..] 是否可用. * jsr250Enabled :决定 JSR-250 annotations 注解[@RolesAllowed..] 是否可用.
*/ */
@Configurable @Configurable
@EnableWebSecurity @EnableWebSecurity
//开启 Spring Security 方法级安全注解 @EnableGlobalMethodSecurity //开启 Spring Security 方法级安全注解 @EnableGlobalMethodSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true,securedEnabled = true,jsr250Enabled = true) @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true, jsr250Enabled = true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired @Autowired
private CustomAccessDeniedHandler customAccessDeniedHandler; private CustomAccessDeniedHandler customAccessDeniedHandler;
@@ -44,9 +44,11 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
"/images/**", "/images/**",
"/static/**", "/static/**",
"/h2-console/**", "/h2-console/**",
"/test/**",
"/druid/**" "/druid/**"
); );
} }
/** /**
* http请求设置 * http请求设置
*/ */
@@ -56,7 +58,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
http.headers().frameOptions().disable();//解决 in a frame because it set 'X-Frame-Options' to 'DENY' 问题 http.headers().frameOptions().disable();//解决 in a frame because it set 'X-Frame-Options' to 'DENY' 问题
//http.anonymous().disable(); //http.anonymous().disable();
http.authorizeRequests() http.authorizeRequests()
.antMatchers("/login/**","/initUserData")//不拦截登录相关方法 .antMatchers("/login/**", "/initUserData")//不拦截登录相关方法
.permitAll() .permitAll()
//.antMatchers("/user").hasRole("ADMIN") // user接口只有ADMIN角色的可以访问 //.antMatchers("/user").hasRole("ADMIN") // user接口只有ADMIN角色的可以访问
// .anyRequest() // .anyRequest()
@@ -79,6 +81,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
.logoutSuccessUrl("/login?logout"); //退出登录成功URL .logoutSuccessUrl("/login?logout"); //退出登录成功URL
} }
/** /**
* 自定义获取用户信息接口 * 自定义获取用户信息接口
*/ */
@@ -89,6 +92,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
/** /**
* 密码加密算法 * 密码加密算法
*
* @return * @return
*/ */
@Bean @Bean
@@ -20,9 +20,10 @@ public class BaseController {
/** /**
* 获取当前用户 * 获取当前用户
*
* @return * @return
*/ */
protected UserInfo getUserInfo(HttpServletRequest request){ protected UserInfo getUserInfo(HttpServletRequest request) {
UserInfo user = null; UserInfo user = null;
//获得session对象 //获得session对象
HttpSession session = request.getSession(); HttpSession session = request.getSession();
@@ -35,7 +36,7 @@ public class BaseController {
Object spring_security_context = session.getAttribute("SPRING_SECURITY_CONTEXT"); Object spring_security_context = session.getAttribute("SPRING_SECURITY_CONTEXT");
System.out.println(spring_security_context); System.out.println(spring_security_context);
SecurityContext securityContext = (SecurityContext) spring_security_context; SecurityContext securityContext = (SecurityContext) spring_security_context;
if(securityContext!=null){ if (securityContext != null) {
//获得认证信息 //获得认证信息
Authentication authentication = securityContext.getAuthentication(); Authentication authentication = securityContext.getAuthentication();
//获得用户详情 //获得用户详情
@@ -10,9 +10,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
public class TestController { public class TestController {
/** /**
* 登录页面跳转 * 登录页面跳转
*
* @return * @return
*/ */
@GetMapping("loginpage") @GetMapping("loginpage")
@@ -23,7 +23,7 @@ public class TestController {
@RequestMapping("/world") @RequestMapping("/world")
public String world(Map<String, Object> model) { public String world(Map<String, Object> model) {
model.put("data","2019"); model.put("data", "2019");
// request.setAttribute("name", "xxxxxxxxx"); // request.setAttribute("name", "xxxxxxxxx");
model.put("msg", "xxxxxxx2222xx"); model.put("msg", "xxxxxxx2222xx");
return "world"; return "world";
@@ -7,8 +7,7 @@ import javax.servlet.http.HttpServletRequest;
import com.yaoyuan.jiscuss.entity.*; import com.yaoyuan.jiscuss.entity.*;
import com.yaoyuan.jiscuss.entity.custom.DiscussionCustom; import com.yaoyuan.jiscuss.entity.custom.DiscussionCustom;
import com.yaoyuan.jiscuss.entity.custom.PostCustom; import com.yaoyuan.jiscuss.entity.custom.PostCustom;
import com.yaoyuan.jiscuss.service.IPostsService; import com.yaoyuan.jiscuss.service.*;
import com.yaoyuan.jiscuss.service.IUsersService;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -24,9 +23,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import com.yaoyuan.jiscuss.service.IDiscussionsService;
import com.yaoyuan.jiscuss.service.ITagsService;
/** /**
* 主题帖子评论控制器 * 主题帖子评论控制器
*/ */
@@ -42,6 +38,9 @@ public class UserPostController extends BaseController {
@Autowired @Autowired
private ITagsService tagsService; private ITagsService tagsService;
@Autowired
private IDiscussionsTagsService iDiscussionsTagsService;
@Autowired @Autowired
private IPostsService postsService; private IPostsService postsService;
@@ -52,25 +51,24 @@ public class UserPostController extends BaseController {
//首页查看主题列表(各种条件筛选,最热最新标签等) //首页查看主题列表(各种条件筛选,最热最新标签等)
//查看主题详情 //查看主题详情
@RequestMapping("/getdiscussionsbyid") @RequestMapping("/getdiscussionsbyid")
public String getDiscussionsById(HttpServletRequest request, ModelMap map, @RequestParam("id") Integer id) { public String getDiscussionsById(HttpServletRequest request, ModelMap map, @RequestParam("id") Integer id) {
logger.info(">>> getDiscussionsById{}",id); logger.info(">>> getDiscussionsById{}", id);
Discussion discussion = discussionsService.findOne(id); Discussion discussion = discussionsService.findOne(id);
// 获取此主题下的评论 // 获取此主题下的评论
List<Post> posts = postsService.findOneBy(id); List<Post> posts = postsService.findOneBy(id);
DiscussionCustom newdd = new DiscussionCustom(); DiscussionCustom newdd = new DiscussionCustom();
BeanUtils.copyProperties(discussion , newdd); BeanUtils.copyProperties(discussion, newdd);
if (null != newdd.getStartUserId()){ if (null != newdd.getStartUserId()) {
User startUser = usersService.findOne(newdd.getStartUserId()); User startUser = usersService.findOne(newdd.getStartUserId());
newdd.setAvatar(startUser.getAvatar()); newdd.setAvatar(startUser.getAvatar());
newdd.setRealname(startUser.getRealname()); newdd.setRealname(startUser.getRealname());
newdd.setUsername(startUser.getUsername()); newdd.setUsername(startUser.getUsername());
} }
if (null != newdd.getLastUserId()){ if (null != newdd.getLastUserId()) {
User lastUser = usersService.findOne(newdd.getLastUserId()); User lastUser = usersService.findOne(newdd.getLastUserId());
newdd.setAvatarLast(lastUser.getAvatar()); newdd.setAvatarLast(lastUser.getAvatar());
newdd.setRealnameLast(lastUser.getRealname()); newdd.setRealnameLast(lastUser.getRealname());
@@ -87,30 +85,46 @@ public class UserPostController extends BaseController {
map.put("discussions", newdd); map.put("discussions", newdd);
map.put("posts", postsObj); map.put("posts", postsObj);
UserInfo user = getUserInfo(request); UserInfo user = getUserInfo(request);
if(user != null){ if (user != null) {
map.put("username", user.getUsername()); map.put("username", user.getUsername());
} }
return "discussions"; return "discussions";
} }
//新建主题 //新建主题
@PostMapping(value = "/newdiscussions") @PostMapping(value = "/newdiscussions")
@ResponseBody @ResponseBody
public String newDiscussions(@RequestBody Discussion discussion) { public String newDiscussions(@RequestBody DiscussionCustom discussion) {
logger.info(">>> newPost"+ discussion); logger.info(">>> newPost" + discussion);
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = servletRequestAttributes.getRequest(); HttpServletRequest request = servletRequestAttributes.getRequest();
UserInfo user = getUserInfo(request); UserInfo user = getUserInfo(request);
if(user != null){ if (user != null) {
discussion.setLastUserId( user.getId()); discussion.setStartUserId(user.getId());
discussion.setCreateId( user.getId()); discussion.setLastUserId(user.getId());
discussion.setCreateId(user.getId());
} }
discussion.setCreateTime(new Date()); discussion.setCreateTime(new Date());
discussion.setStartTime(new Date());
discussion.setLastTime(new Date());
Discussion saveDiscussion = discussionsService.insert(discussion); Discussion saveDiscussion = discussionsService.insert(discussion);
if (null != discussion.getTag()) {
//执行组装标签
String[] strArray = discussion.getTag().split(",");
for(String str : strArray){
DiscussionTag dtag= new DiscussionTag();
dtag.setDiscussionId(saveDiscussion.getId());
dtag.setTagId(Integer.parseInt(str));
iDiscussionsTagsService.insert(dtag);
}
}
JSONObject resultobj = new JSONObject(); JSONObject resultobj = new JSONObject();
logger.info(">>>{}", saveDiscussion); logger.info(">>>{}", saveDiscussion);
@@ -129,18 +143,18 @@ public class UserPostController extends BaseController {
@PostMapping(value = "/newpost") @PostMapping(value = "/newpost")
@ResponseBody @ResponseBody
public String newPosts(@RequestBody Post post) { public String newPosts(@RequestBody Post post) {
logger.info(">>> newpost"+ post); logger.info(">>> newpost" + post);
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = servletRequestAttributes.getRequest(); HttpServletRequest request = servletRequestAttributes.getRequest();
UserInfo user = getUserInfo(request); UserInfo user = getUserInfo(request);
if(user != null){ if (user != null) {
post.setCreateId( user.getId()); post.setCreateId(user.getId());
} }
post.setCreateTime(new Date()); post.setCreateTime(new Date());
if(null != post.getParentId()){ if (null != post.getParentId()) {
Post temp =postsService.findOneByid(post.getParentId()); Post temp = postsService.findOneByid(post.getParentId());
post.setUserId(temp.getCreateId()); post.setUserId(temp.getCreateId());
} }
@@ -148,7 +162,7 @@ public class UserPostController extends BaseController {
Post savePost = postsService.insert(post); Post savePost = postsService.insert(post);
JSONObject resultobj = new JSONObject(); JSONObject resultobj = new JSONObject();
logger.info(">>>{}",savePost ); logger.info(">>>{}", savePost);
resultobj.put("msg", "添加成功"); resultobj.put("msg", "添加成功");
resultobj.put("flag", true); resultobj.put("flag", true);
return resultobj.toString(); // return resultobj.toString(); //
@@ -160,14 +174,14 @@ public class UserPostController extends BaseController {
@PostMapping(value = "/newtags") @PostMapping(value = "/newtags")
@ResponseBody @ResponseBody
public String newTags(@RequestBody Tag tag) { public String newTags(@RequestBody Tag tag) {
logger.info(">>> newTags"+ tag); logger.info(">>> newTags" + tag);
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = servletRequestAttributes.getRequest(); HttpServletRequest request = servletRequestAttributes.getRequest();
UserInfo user = getUserInfo(request); UserInfo user = getUserInfo(request);
if(user != null){ if (user != null) {
tag.setCreateId( user.getId()); tag.setCreateId(user.getId());
} }
tag.setCreateTime(new Date()); tag.setCreateTime(new Date());
@@ -42,45 +42,45 @@ public class UserSystemController extends BaseController {
private ITagsService tagsService; private ITagsService tagsService;
//首页 //首页
@RequestMapping({"/","/main","/index"}) @RequestMapping({"/", "/main", "/index"})
public String home(@RequestParam(defaultValue = "all") String tag, @RequestParam(defaultValue = "all") String type,@RequestParam(defaultValue = "1") Integer public String home(@RequestParam(defaultValue = "all") String tag, @RequestParam(defaultValue = "all") String type, @RequestParam(defaultValue = "1") Integer
pageNum, HttpServletRequest request, ModelMap map) { pageNum, HttpServletRequest request, ModelMap map) {
logger.info(">>> index"); logger.info(">>> index");
logger.info(">>> tag:" + tag); logger.info(">>> tag:" + tag);
logger.info(">>> pageNum:" + pageNum); logger.info(">>> pageNum:" + pageNum);
List<User> userall = usersService.getAllList(); List<User> userall = usersService.getAllList();
logger.info(">>> 第一遍的全部用户:"+userall); logger.info(">>> 第一遍的全部用户:" + userall);
List<User> useral2 = usersService.getAllList(); List<User> useral2 = usersService.getAllList();
logger.info(">>> 第二遍的全部用户:"+useral2); logger.info(">>> 第二遍的全部用户:" + useral2);
int pageSiz = 10; int pageSiz = 10;
int pageNumNew = pageNum - 1; int pageNumNew = pageNum - 1;
Discussion discussion = new Discussion(); Discussion discussion = new Discussion();
//分页获取主题帖子 //分页获取主题帖子
Page<Discussion> allDiscussionsPage = discussionsService.queryAllDiscussionsList(discussion,pageNumNew,pageSiz); Page<Discussion> allDiscussionsPage = discussionsService.queryAllDiscussionsList(discussion, pageNumNew, pageSiz);
List<Discussion> allDiscussions = allDiscussionsPage.getContent(); List<Discussion> allDiscussions = allDiscussionsPage.getContent();
List<DiscussionCustom> newAllD = new ArrayList<>(); List<DiscussionCustom> newAllD = new ArrayList<>();
for (Discussion dd : allDiscussions){ for (Discussion dd : allDiscussions) {
DiscussionCustom newdd = new DiscussionCustom(); DiscussionCustom newdd = new DiscussionCustom();
BeanUtils.copyProperties(dd , newdd); BeanUtils.copyProperties(dd, newdd);
String newCon = ""; String newCon = "";
String content = DelTagsUtil.getTextFromHtml(newdd.getContent()); String content = DelTagsUtil.getTextFromHtml(newdd.getContent());
if(null != content && content.length()>30){ if (null != content && content.length() > 30) {
newCon = content.substring(0,29); newCon = content.substring(0, 29);
}else{ } else {
newCon = content; newCon = content;
} }
newdd.setContent(newCon); newdd.setContent(newCon);
if (null != newdd.getStartUserId()){ if (null != newdd.getStartUserId()) {
User startUser = usersService.findOne(newdd.getStartUserId()); User startUser = usersService.findOne(newdd.getStartUserId());
newdd.setAvatar(startUser.getAvatar()); newdd.setAvatar(startUser.getAvatar());
newdd.setRealname(startUser.getRealname()); newdd.setRealname(startUser.getRealname());
newdd.setUsername(startUser.getUsername()); newdd.setUsername(startUser.getUsername());
} }
if (null != newdd.getLastUserId()){ if (null != newdd.getLastUserId()) {
User lastUser = usersService.findOne(newdd.getLastUserId()); User lastUser = usersService.findOne(newdd.getLastUserId());
newdd.setAvatarLast(lastUser.getAvatar()); newdd.setAvatarLast(lastUser.getAvatar());
newdd.setRealnameLast(lastUser.getRealname()); newdd.setRealnameLast(lastUser.getRealname());
@@ -90,7 +90,7 @@ public class UserSystemController extends BaseController {
newAllD.add(newdd); newAllD.add(newdd);
} }
logger.info("全部主题==>{}",allDiscussions); logger.info("全部主题==>{}", allDiscussions);
Long total = allDiscussionsPage.getTotalElements(); Long total = allDiscussionsPage.getTotalElements();
@@ -99,7 +99,7 @@ public class UserSystemController extends BaseController {
//获取所有标签(以后尝试去缓存中取) //获取所有标签(以后尝试去缓存中取)
List<Tag> allTags = tagsService.getAllList(); List<Tag> allTags = tagsService.getAllList();
logger.info("全部标签==>{}",allTags); logger.info("全部标签==>{}", allTags);
System.out.println(userall.toString()); System.out.println(userall.toString());
map.put("data", "Jiscuss 用户"); map.put("data", "Jiscuss 用户");
@@ -109,12 +109,12 @@ public class UserSystemController extends BaseController {
map.put("tag", tag); map.put("tag", tag);
map.put("type", type); map.put("type", type);
map.put("pageSize",pageSiz); map.put("pageSize", pageSiz);
map.put("pageTotal", total); map.put("pageTotal", total);
map.put("pageNum", pageNum); map.put("pageNum", pageNum);
map.put("pageTotalPages", allDiscussionsPage.getTotalPages()); map.put("pageTotalPages", allDiscussionsPage.getTotalPages());
UserInfo user = getUserInfo(request); UserInfo user = getUserInfo(request);
if(user != null){ if (user != null) {
map.put("username", user.getUsername()); map.put("username", user.getUsername());
map.put("data", "Jiscuss 用户:" + user.getUsername()); map.put("data", "Jiscuss 用户:" + user.getUsername());
} }
@@ -124,17 +124,23 @@ public class UserSystemController extends BaseController {
private List<String> getPageNumList(int size) { private List<String> getPageNumList(int size) {
List<String> pageNumList = new ArrayList<String>(); List<String> pageNumList = new ArrayList<String>();
for(int i = 0;i<size;i++) { for (int i = 0; i < size; i++) {
pageNumList.add(""+(i+1)); pageNumList.add("" + (i + 1));
} }
return pageNumList; return pageNumList;
} }
//登录页
@GetMapping("/test")
public String test() {
return "test";
}
//登录页 //登录页
@GetMapping("/login") @GetMapping("/login")
public String login(@RequestParam(value = "error", required = false) String error, public String login(@RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout,ModelMap map) { @RequestParam(value = "logout", required = false) String logout, ModelMap map) {
if (error != null) { if (error != null) {
map.put("msg", "您输入的用户名密码错误!"); map.put("msg", "您输入的用户名密码错误!");
return "login"; return "login";
@@ -2,10 +2,7 @@ package com.yaoyuan.jiscuss.entity;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data; import lombok.Data;
@@ -19,9 +16,12 @@ public class Setting implements Serializable{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
@Column(name="key") @GeneratedValue(strategy = GenerationType.IDENTITY)
private String key; private Integer id;
@Column(name="value") @Column(name="setting_key")
private String value; private String settingKey;
@Column(name="setting_value")
private String settingValue;
} }
@@ -1,8 +1,11 @@
package com.yaoyuan.jiscuss.entity.custom; package com.yaoyuan.jiscuss.entity.custom;
import com.yaoyuan.jiscuss.entity.Discussion; import com.yaoyuan.jiscuss.entity.Discussion;
import com.yaoyuan.jiscuss.entity.Tag;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author yaoyuan2.chu * @author yaoyuan2.chu
* @Title: * @Title:
@@ -26,4 +29,9 @@ public class DiscussionCustom extends Discussion {
private String realnameLast; private String realnameLast;
private String tag;
private List<Tag> tagList;
} }
@@ -38,12 +38,12 @@ public class DiscussionsServiceImpl implements IDiscussionsService {
@Override @Override
public Page<Discussion> queryAllDiscussionsList(Discussion discussion, int pageNum, int pageSize) { public Page<Discussion> queryAllDiscussionsList(Discussion discussion, int pageNum, int pageSize) {
Sort sort=new Sort(Sort.Direction.DESC,"id"); Sort sort = new Sort(Sort.Direction.DESC, "id");
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
Pageable pageable=new PageRequest(pageNum,pageSize,sort); Pageable pageable = new PageRequest(pageNum, pageSize, sort);
//将匹配对象封装成Example对象 //将匹配对象封装成Example对象
Example<Discussion> example = Example.of(discussion); Example<Discussion> example = Example.of(discussion);
return discussionsRepository.findAll(example,pageable); return discussionsRepository.findAll(example, pageable);
} }
} }
@@ -42,7 +42,7 @@ public class PostsServiceImpl implements IPostsService {
@Override @Override
public Post findOneByid(Integer id) { public Post findOneByid(Integer id) {
Post post =new Post(); Post post = new Post();
post.setId(id); post.setId(id);
Example<Post> example = Example.of(post); Example<Post> example = Example.of(post);
Optional<Post> postRes = postsRepository.findOne(example); Optional<Post> postRes = postsRepository.findOne(example);
@@ -66,7 +66,6 @@ public class PostsServiceImpl implements IPostsService {
// List<PostCustom> thenpostCustomListNew = PostCommonUtil.getNewPostsObjCustom(thenpostCustomList); // List<PostCustom> thenpostCustomListNew = PostCommonUtil.getNewPostsObjCustom(thenpostCustomList);
//新建一个Node集合。 //新建一个Node集合。
ArrayList<Node> nodes = new ArrayList<>(); ArrayList<Node> nodes = new ArrayList<>();
//将第一层评论都添加都Node集合中 //将第一层评论都添加都Node集合中
@@ -82,8 +81,6 @@ public class PostsServiceImpl implements IPostsService {
Node.show(list); Node.show(list);
// List<Map<String, Object>> posts = postsRepository.findPostCustomById(id); // List<Map<String, Object>> posts = postsRepository.findPostCustomById(id);
// //
// List<PostCustom> postCustomList = PostCommonUtil.getNewPostsObjMap(posts); // List<PostCustom> postCustomList = PostCommonUtil.getNewPostsObjMap(posts);
+76
View File
@@ -0,0 +1,76 @@
#h2 配置
spring:
cache:
type: ehcache
ehcache:
config: classpath:ehcache.xml
jpa:
generate-ddl: false
show-sql: true
hibernate:
ddl-auto: none
h2:
console:
path: /h2-console
enabled: true
settings:
web-allow-others: true
datasource:
platform: h2
url: jdbc:h2:~/testjiscuss
username: sa
password:
schema: classpath:schema.sql
data: classpath:data.sql
driver-class-name: org.h2.Driver
type: com.alibaba.druid.pool.DruidDataSource
druid:
min-idle: 2
initial-size: 5
max-active: 10
max-wait: 5000
validation-query: select 1SS
# 状态监控
filter:
stat:
enabled: true
db-type: h2
log-slow-sql: true
slow-sql-millis: 2000
# 监控过滤器
web-stat-filter:
enabled: true
exclusions:
- "*.js"
- "*.gif"
- "*.jpg"
- "*.png"
- "*.css"
- "*.ico"
- "/druid/*"
# druid 监控页面
stat-view-servlet:
enabled: true
url-pattern: /druid/*
# reset-enable: false
# login-username: root
# login-password: root
freemarker:
# 设置模板后缀名
suffix: .ftl
# 设置文档类型
content-type: text/html
# 设置页面编码格式
charset: UTF-8
# 设置页面缓存
cache: false
# 设置ftl文件路径
template-loader-path:
- classpath:/templates
settings:
classic_compatible: true
# 设置静态文件路径,js,css等
mvc:
static-path-pattern: /static/**
server:
port: 80
+69
View File
@@ -0,0 +1,69 @@
#mysql 配置
spring:
cache:
type: ehcache
ehcache:
config: classpath:ehcache.xml
jpa:
database: MYSQL
show-sql: true
hibernate:
ddl-auto: update
datasource:
url: jdbc:mysql://127.0.0.1:3306/jiscuss?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
tomcat:
init-s-q-l: SET NAMES utf8mb4
druid:
min-idle: 2
initial-size: 5
max-active: 10
max-wait: 5000
validation-query: select 1SS
# 状态监控
filter:
stat:
enabled: true
db-type: mysql
log-slow-sql: true
slow-sql-millis: 2000
# 监控过滤器
web-stat-filter:
enabled: true
exclusions:
- "*.js"
- "*.gif"
- "*.jpg"
- "*.png"
- "*.css"
- "*.ico"
- "/druid/*"
# druid 监控页面
stat-view-servlet:
enabled: true
url-pattern: /druid/*
# reset-enable: false
# login-username: root
# login-password: root
freemarker:
# 设置模板后缀名
suffix: .ftl
# 设置文档类型
content-type: text/html
# 设置页面编码格式
charset: UTF-8
# 设置页面缓存
cache: false
# 设置ftl文件路径
template-loader-path:
- classpath:/templates
settings:
classic_compatible: true
# 设置静态文件路径,js,css等
mvc:
static-path-pattern: /static/**
server:
port: 80
+13 -19
View File
@@ -1,28 +1,22 @@
#mysql 配置
spring: spring:
cache: cache:
type: ehcache type: ehcache
ehcache: ehcache:
config: classpath:ehcache.xml config: classpath:ehcache.xml
jpa: jpa:
generate-ddl: false database: MYSQL
show-sql: true show-sql: true
hibernate: hibernate:
ddl-auto: none ddl-auto: update
h2:
console:
path: /h2-console
enabled: true
settings:
web-allow-others: true
datasource: datasource:
platform: h2 url: jdbc:mysql://127.0.0.1:3306/jiscuss?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&autoReconnect=true&useSSL=false
url: jdbc:h2:~/testjiscuss username: root
username: sa password: 123456
password: driver-class-name: com.mysql.cj.jdbc.Driver
schema: classpath:schema.sql
data: classpath:data.sql
driver-class-name: org.h2.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
tomcat:
init-s-q-l: SET NAMES utf8mb4
druid: druid:
min-idle: 2 min-idle: 2
initial-size: 5 initial-size: 5
@@ -33,7 +27,7 @@ spring:
filter: filter:
stat: stat:
enabled: true enabled: true
db-type: h2 db-type: mysql
log-slow-sql: true log-slow-sql: true
slow-sql-millis: 2000 slow-sql-millis: 2000
# 监控过滤器 # 监控过滤器
@@ -51,9 +45,9 @@ spring:
stat-view-servlet: stat-view-servlet:
enabled: true enabled: true
url-pattern: /druid/* url-pattern: /druid/*
# reset-enable: false # reset-enable: false
# login-username: root # login-username: root
# login-password: root # login-password: root
freemarker: freemarker:
# 设置模板后缀名 # 设置模板后缀名
suffix: .ftl suffix: .ftl
+3 -2
View File
@@ -67,8 +67,9 @@ create_time datetime
-- 设置表5 -- 设置表5
drop table if exists setting; drop table if exists setting;
CREATE TABLE setting( CREATE TABLE setting(
key varchar(20) primary key, id INTEGER not null primary key auto_increment ,
value text setting_key varchar(20) ,
setting_value text
); );
-- 标签表6 -- 标签表6
drop table if exists tag; drop table if exists tag;
+11 -2
View File
@@ -63,6 +63,7 @@ $("#newdiscussions").click(function(){
console.warn(header) console.warn(header)
console.warn(token) console.warn(token)
var title = $("#discussionstitle").val(); var title = $("#discussionstitle").val();
var tag = $("#selectTag").val();
// $("#discussionscontent").val(); // $("#discussionscontent").val();
console.log(tinyMCE.editors[0].getContent()); console.log(tinyMCE.editors[0].getContent());
var content =tinyMCE.editors[0].getContent(); var content =tinyMCE.editors[0].getContent();
@@ -107,7 +108,16 @@ $("#commitnewtags").click(function(){
var header = $("meta[name='_csrf_header']").attr("content"); var header = $("meta[name='_csrf_header']").attr("content");
var token =$("meta[name='_csrf']").attr("content"); var token =$("meta[name='_csrf']").attr("content");
var name = $("#tagsname").val(); var name = $("#tagsname").val();
var tagColor = $("#tagColor").val();
var tagIcon = $("#tagIcon").val();
var parentTag = $("#parentTag").val();
console.log(tagColor);
console.log(tagIcon);
console.log(parentTag);
console.log(name); console.log(name);
$.ajax({ $.ajax({
type: "POST", type: "POST",
@@ -124,10 +134,9 @@ $("#commitnewtags").click(function(){
console.log(data); console.log(data);
if(data.flag){ if(data.flag){
massage(name+',添加成功!',''); massage(name+',添加成功!','');
return false; $("#selectTag").html("");
}else{ }else{
massage(name+',添加失败!',''); massage(name+',添加失败!','');
return false;
} }
} }
}); });
@@ -0,0 +1,36 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
</profile>
</component>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/templates.iml" filepath="$PROJECT_DIR$/.idea/templates.iml" />
</modules>
</component>
</project>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../.." vcs="Git" />
</component>
</project>
+54
View File
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="755544fc-90a1-4d60-9093-335fc4c5e923" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../../java/com/yaoyuan/jiscuss/config/WebSecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/../../java/com/yaoyuan/jiscuss/config/WebSecurityConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../../java/com/yaoyuan/jiscuss/controller/UserSystemController.java" beforeDir="false" afterPath="$PROJECT_DIR$/../../java/com/yaoyuan/jiscuss/controller/UserSystemController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/comm/footer.ftl" beforeDir="false" afterPath="$PROJECT_DIR$/comm/footer.ftl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/index.ftl" beforeDir="false" afterPath="$PROJECT_DIR$/index.ftl" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../../.." />
</component>
<component name="ProjectId" id="1hzVfIl0oebNSYJlVoYCSm1cyrz" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../../../../../other_project/h2&amp;mysql/spb-jpa-mysql-master" />
</component>
<component name="SvnConfiguration">
<configuration>C:\Users\A11200321050045\AppData\Roaming\Subversion</configuration>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="755544fc-90a1-4d60-9093-335fc4c5e923" name="Default Changelist" comment="" />
<created>1601014009683</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1601014009683</updated>
<workItem from="1601014011056" duration="15000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="2" />
</component>
<component name="WindowStateProjectService">
<state x="740" y="274" key="FileChooserDialogImpl" timestamp="1601014023451">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="740" y="274" key="FileChooserDialogImpl/1920.137.1366.728/0.0.1920.1040@0.0.1920.1040" timestamp="1601014023451" />
</component>
</project>
+2 -1
View File
@@ -1,7 +1,8 @@
<div class="ui section divider"></div> <#--<div class="ui section divider"></div>-->
<div class="ui vertical footer segment"> <div class="ui vertical footer segment">
<div class="ui center aligned container"> <div class="ui center aligned container">
<div class="ui section divider"></div>
<div class="ui stackable divided grid"> <div class="ui stackable divided grid">
<div class="three wide column"> <div class="three wide column">
<h4 class="ui header">关于遥远</h4> <h4 class="ui header">关于遥远</h4>
+10 -1
View File
@@ -50,6 +50,15 @@
${discussions.content} ${discussions.content}
</div> </div>
<div class="ui labeled button" tabindex="0">
<div class="ui red button">
<i class="heart icon"></i> 赞这个主题
</div>
<a class="ui basic red left pointing label">
1,048
</a>
</div>
<div class="ui feed"> <div class="ui feed">
<div class="event"> <div class="event">
@@ -71,7 +80,7 @@
</div> </div>
<div class="meta"> <div class="meta">
<a class="like"> <a class="like">
<i class="like icon"></i> 0 喜欢 <i class="like icon"></i> 0 喜欢作者
</a> </a>
</div> </div>
</div> </div>
+140 -76
View File
@@ -56,12 +56,10 @@
</div> </div>
<div class="field"> <div class="field">
<label>选择标签</label> <label>选择标签</label>
<select multiple="" class="ui dropdown"> <select multiple="" class="ui dropdown" id="selectTag">
<option value="">选择标签</option> <option value="">选择标签</option>
<#list allTags as tags> <#list allTags as tags>
<option value=${tags.id}>${tags.name}</option> <option value=${tags.id}>${tags.name}</option>
</#list> </#list>
</select> </select>
</div> </div>
@@ -74,15 +72,65 @@
<label>标签名</label> <label>标签名</label>
<input type="text" placeholder="标签名" id="tagsname"> <input type="text" placeholder="标签名" id="tagsname">
</div> </div>
<div class="field" id="createNewtagsDiv" style="display:none">
<label>父标签</label>
<select class="ui fluid dropdown" id="parentTag">
<#list allTags as tag>
<option value="{tag.id}">{tag.name}</option>
</#list>
</select>
</div>
<div class="two fields">
<div class="field">
<label>选择颜色</label>
<div class="ui fluid search selection dropdown">
<input type="hidden" id="tagColor">
<i class="dropdown icon"></i>
<div class="default text">选择颜色</div>
<div class="menu">
<div class="item" data-value="red"><div class="ui red empty circular label"></div>红色</div>
<div class="item" data-value="orange"><div class="ui orange empty circular label"></div>橙色</div>
<div class="item" data-value="yellow"><div class="ui yellow empty circular label"></div>黄色</div>
<div class="item" data-value="olive"><div class="ui olive empty circular label"></div>橄榄绿</div>
<div class="item" data-value="green"><div class="ui green empty circular label"></div>纯绿</div>
<div class="item" data-value="teal"><div class="ui teal empty circular label"></div>水鸭蓝</div>
<div class="item" data-value="blue"><div class="ui blue empty circular label"></div>纯蓝</div>
<div class="item" data-value="violet"><div class="ui violet empty circular label"></div>紫罗兰</div>
<div class="item" data-value="purple"><div class="ui purple empty circular label"></div>纯紫</div>
<div class="item" data-value="pink"><div class="ui pink empty circular label"></div>粉红</div>
<div class="item" data-value="brown"><div class="ui brown empty circular label"></div>棕色</div>
<div class="item" data-value="grey"><div class="ui grey empty circular label"></div>灰色</div>
<div class="item" data-value="black"><div class="ui black empty circular label"></div>黑色</div>
</div>
</div>
</div>
<div class="field">
<label>选择图标</label>
<div class="ui fluid search selection dropdown">
<input type="hidden" id="tagIcon">
<i class="dropdown icon"></i>
<div class="default text">选择图标</div>
<div class="menu">
<div class="item" data-value="bullhorn"><i class="bullhorn"></i>bullhorn</div>
<div class="item" data-value="coffee"><i class="coffee"></i>coffee</div>
<div class="item" data-value="edit"><i class="edit"></i>edit</div>
<div class="item" data-value="fax"><i class="fax"></i>fax</div>
<div class="item" data-value="bug"><i class="bug"></i>bug</div>
<div class="item" data-value="keyboard"><i class="keyboard"></i>keyboard</div>
<div class="item" data-value="folder open outline"><i class="folder open outline"></i>folder open outline</div>
<div class="item" data-value="comment outline"><i class="comment outline"></i>comment outline</div>
</div>
</div>
</div>
</div>
<div class="field" id="createNewtagsBtn" style="display:none"> <div class="field" id="createNewtagsBtn" style="display:none">
<button class="ui teal button" id="commitnewtags">保存</button> <button class="ui teal button" id="commitnewtags">保存</button>
<button class="ui grey button" id="cancelnewtags">取消</button>
</div> </div>
<div class="field"> <div class="field">
<label>内容</label> <label>内容</label>
<textarea id="discussionscontent"></textarea> <textarea id="discussionscontent"></textarea>
</div> </div>
<div class="ui fluid large blue button" id="newdiscussions">提交内容</div> <div class="ui fluid large blue button" id="newdiscussions">提交内容</div>
@@ -90,72 +138,90 @@
</div> </div>
</div> </div>
<div class="ui list">
<div class="item">下面这个按钮可以过滤帖子呦</div>
</div>
<div class="fluid ui floating dropdown labeled icon orange button">
<i class="filter icon"></i> <span class="text">过滤帖子标签</span>
<div class="menu">
<div class="ui icon search input">
<i class="search icon"></i> <input type="text"
placeholder="搜索标签...">
</div>
<div class="divider"></div>
<div class="header">
<i class="tags icon"></i> 标签
</div>
<div class="scrolling menu">
<div class="item">
<div class="ui red empty circular label"></div>
重要
</div>
<div class="item">
<div class="ui blue empty circular label"></div>
通知
</div>
<div class="item">
<div class="ui black empty circular label"></div>
无法修复
</div>
<div class="item">
<div class="ui purple empty circular label"></div>
新闻
</div>
<div class="item">
<div class="ui orange empty circular label"></div>
交换
</div>
<div class="item">
<div class="ui empty circular label"></div>
改变下降
</div>
<div class="item">
<div class="ui yellow empty circular label"></div>
题外话
</div>
<div class="item">
<div class="ui pink empty circular label"></div>
有趣
</div>
<div class="item">
<div class="ui green empty circular label"></div>
讨论
</div>
</div>
</div>
</div>
<div class="ui section divider"></div> <div class="ui section divider"></div>
<div class="ui fluid action input"> <div class="ui card red ">
<input type="text" placeholder="搜索..."> <div class="content">
<div class="ui button">搜索</div> <div class="header">全部标签</div>
</div>
<div class="content">
<div class="ui ordered list">
<div class="item">
<i class="folder icon"></i>
<div class="content">
<div class="header">src</div>
<div class="description">Source files for project</div>
<div class="list">
<div class="item">
<i class="folder icon"></i>
<div class="content">
<div class="header">site</div>
<div class="description">Your site's theme</div>
</div>
</div>
<div class="item">
<i class="blue folder icon"></i>
<div class="content">
<div class="header">themes</div>
<div class="description">Packaged theme files</div>
<div class="list">
<div class="item">
<i class="folder icon"></i>
<div class="content">
<div class="header">default</div>
<div class="description">Default packaged theme</div>
</div>
</div>
<div class="item">
<i class="folder icon"></i>
<div class="content">
<div class="header">my_theme</div>
<div class="description">Packaged themes are also available in
this folder
</div>
</div>
</div>
</div>
</div>
</div>
<div class="item">
<i class="file icon"></i>
<div class="content">
<a class="header">theme.config</a>
<div class="description">Config file for setting packaged themes</div>
</div>
</div>
</div>
</div>
</div>
<div class="item">
<i class="red folder icon"></i>
<div class="content">
<a class="header">dist</a>
<div class="description">Compiled CSS and JS files</div>
<div class="list">
<div class="item">
<i class="folder icon"></i>
<div class="content">
<a class="header">components</a>
<div class="description">Individual component CSS and JS</div>
</div>
</div>
</div>
</div>
</div>
<div class="item">
<i class="file icon red"></i>
<div class="content">
<div class="header">semantic.json</div>
<div class="description">Contains build settings for gulp</div>
</div>
</div>
</div>
</div>
</div> </div>
<div class="ui card black ">
<div class="ui card">
<div class="content"> <div class="content">
<div class="header">预留功能</div> <div class="header">预留功能</div>
</div> </div>
@@ -185,7 +251,7 @@
</div> </div>
<div class="ui card"> <div class="ui card violet ">
<div class="content"> <div class="content">
<img class="right floated mini ui image" <img class="right floated mini ui image"
src="static/assets/images/logo.png"> src="static/assets/images/logo.png">
@@ -430,14 +496,12 @@
</div> </div>
<div class="ui button" data-tooltip="预留" data-position="top center">
</div>
<div class="ui button" data-tooltip="预留" data-position="top center">
预留 预留
</div>
</div> </div>
<#include "comm/footer.ftl"/> <#include "comm/footer.ftl"/>
<script type="text/javascript"> <script type="text/javascript">
@@ -449,12 +513,12 @@
console.log('pageNum' + '${pageNum}'); console.log('pageNum' + '${pageNum}');
console.log('pageNumAll' + '${pageNumAll}'); console.log('pageNumAll' + '${pageNumAll}');
setpageNum('${pageNum}','${pageNumAll}'); setpageNum('${pageNum}', '${pageNumAll}');
var token = $("meta[name='_csrf']").attr("content"); var token = $("meta[name='_csrf']").attr("content");
if(token == '' && username && username != null){ if (token == '' && username && username != null) {
console.log('因为默认页没有_csrf_token,跳页'); console.log('因为默认页没有_csrf_token,跳页');
location.href="/main"; location.href = "/main";
} }
}); });
+108
View File
@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html>
<title>Jiscuss Demo</title>
<head>
<!-- <link rel="stylesheet" type="text/css" href="static/semanticui/semantic.css"> -->
<!-- <script src="static/jquery/jquery-3.4.1.min.js"></script> -->
<!-- <script src="static/semanticui/semantic.min.js"></script> -->
<!-- default header name is X-CSRF-TOKEN -->
<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>
<#include "comm/commjs.ftl"/>
</head>
<body>
<div class="ui fixed inverted menu">
<div class="ui container">
<a href="fixed.php#" class="header item">
<img class="logo" src="assets/images/logo.png">
项目名
</a>
<a href="fixed.php#" class="item">主页</a>
<div class="ui simple dropdown item">
Dropdown <i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="fixed.php#">链接选项</a>
<a class="item" href="fixed.php#">链接选项</a>
<div class="divider"></div>
<div class="header">标题项</div>
<div class="item">
<i class="dropdown icon"></i>
子菜单
<div class="menu">
<a class="item" href="fixed.php#">链接选项</a>
<a class="item" href="fixed.php#">链接选项</a>
</div>
</div>
<a class="item" href="fixed.php#">链接选项</a>
</div>
</div>
</div>
</div>
<div class="ui main text container">
<h1 class="ui header">Semantic UI Fixed Template</h1>
<p>This is a basic fixed menu template using fixed size containers.</p>
<p>A text container is used for the main container, which is useful for single column layouts</p>
<img class="wireframe" src="assets/images/wireframe/media-paragraph.png">
<img class="wireframe" src="assets/images/wireframe/paragraph.png">
<img class="wireframe" src="assets/images/wireframe/paragraph.png">
<img class="wireframe" src="assets/images/wireframe/paragraph.png">
<img class="wireframe" src="assets/images/wireframe/paragraph.png">
<img class="wireframe" src="assets/images/wireframe/paragraph.png">
<img class="wireframe" src="assets/images/wireframe/paragraph.png">
</div>
<div class="ui inverted vertical footer segment">
<div class="ui center aligned container">
<div class="ui stackable inverted divided grid">
<div class="three wide column">
<h4 class="ui inverted header">Group 1</h4>
<div class="ui inverted link list">
<a href="fixed.php#" class="item">Link One</a>
<a href="fixed.php#" class="item">Link Two</a>
<a href="fixed.php#" class="item">Link Three</a>
<a href="fixed.php#" class="item">Link Four</a>
</div>
</div>
<div class="three wide column">
<h4 class="ui inverted header">Group 2</h4>
<div class="ui inverted link list">
<a href="fixed.php#" class="item">Link One</a>
<a href="fixed.php#" class="item">Link Two</a>
<a href="fixed.php#" class="item">Link Three</a>
<a href="fixed.php#" class="item">Link Four</a>
</div>
</div>
<div class="three wide column">
<h4 class="ui inverted header">Group 3</h4>
<div class="ui inverted link list">
<a href="fixed.php#" class="item">Link One</a>
<a href="fixed.php#" class="item">Link Two</a>
<a href="fixed.php#" class="item">Link Three</a>
<a href="fixed.php#" class="item">Link Four</a>
</div>
</div>
<div class="seven wide column">
<h4 class="ui inverted header">Footer Header</h4>
<p>Extra space for a call to action inside the footer that could help re-engage users.</p>
</div>
</div>
<div class="ui inverted section divider"></div>
<img src="assets/images/logo.png" class="ui centered mini image">
<div class="ui horizontal inverted small divided link list">
<a class="item" href="fixed.php#">Site Map</a>
<a class="item" href="fixed.php#">Contact Us</a>
<a class="item" href="fixed.php#">Terms and Conditions</a>
<a class="item" href="fixed.php#">Privacy Policy</a>
</div>
</div>
</div>
</body>
</html>