python222网站实战(SpringBoot+SpringSecurity+MybatisPlus+thymeleaf+layui)-帖子详情页实现

发布时间:2024年01月20日

锋哥原创的Springboot+Layui python222网站实战:

python222网站实战课程视频教程(SpringBoot+Python爬虫实战) ( 火爆连载更新中... )_哔哩哔哩_bilibilipython222网站实战课程视频教程(SpringBoot+Python爬虫实战) ( 火爆连载更新中... )共计23条视频,包括:python222网站实战课程视频教程(SpringBoot+Python爬虫实战) ( 火爆连载更新中... )、第2讲 架构搭建实现、第3讲 页面系统属性动态化设计实现等,UP主更多精彩视频,请关注UP账号。icon-default.png?t=N7T8https://www.bilibili.com/video/BV1yX4y1a7qM/后端:

/**
 * 根据id查询帖子详细信息
 * @param id
 * @return
 * @throws Exception
 */
@RequestMapping("/{id}")
public ModelAndView view(@PathVariable("id")Integer id)throws Exception{
    Article article = articleService.getById(id);
    if(article!=null && article.getStatus()!=2){
        return null;
    }else{
        ModelAndView mav=new ModelAndView();
        mav.setViewName("article");
        mav.addObject("article",article);
        return mav;
    }
}

前端article.html

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title th:text="${article.title}+'-'+${application.propertyMap['k1']}"></title>
<meta name="keywords" th:content="${article.keyWords}">
<meta name="description" th:content="${article.title}">
<link href="/systemImages/favicon.ico" rel="SHORTCUT ICON">
<link rel="stylesheet" href="/static/layui/css/layui.css"/>
<link rel="stylesheet" href="/static/css/css.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/normalize.css" />
<link rel="stylesheet" href="/static/css/font-awesome.min.css">

</head>
<body>

    <div class="header_top" th:include="common/head::#h" />

    <div class="header" th:include="common/menu::#m" />

    <div class="main_wrapper">
        <div class="w1220 index_content">
            <div class="content_left">
                <div class="article">
                    <div class="title" th:text="${article.title}"></div>
                    <div class="publishDateAndDownload">
                        <div class="publishDate" th:text="${'发布于:'+#dates.format(article.publishDate, 'yyyy-MM-dd HH:mm:ss')}"></div>
                    </div>
                    <div class="content" th:utext="${article.content}"></div>
                    <div class="downloadContent" th:if="${!article.download}" th:text="${'转载自:'+article.downloadContent}"></div>
                </div>
            </div>

            <div class="content_right">
                <div class="card">
                    <h4 class="card_title">热门帖子推荐</h4>
                    <ul class="item_list">
                        <li th:each="hotArticle,status:${application.hotArticleList.subList(0,10)}"><span class="number" th:text="${status.index+1}+'.'"></span><a th:href="'/article/'+${hotArticle.id}" target="_blank"  th:title="${hotArticle.title}" th:text="${hotArticle.title}"></a></li>
                    </ul>
                </div>


                <div class="tag">
                    <h4 class="tag_title">热门标签推荐</h4>
                    <ul class="item_list">
                        <li th:each="tag:${application.tagList}">
                            <a th:href="@{'/search/1?keyWord='+${tag.name}}" target="_blank"><button type="button" class="layui-btn layui-btn-sm" th:text="${tag.name}"></button></a>
                        </li>
                    </ul>
                </div>
            </div>



        </div>
    </div>


    <div class="footer" th:include="common/footer::#f" />


</body>
</html>

文章来源:https://blog.csdn.net/caoli201314/article/details/135711249
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。