Spring boot实训开发个人博客(七) 博客管理列表页

Spring boot实训开发个人博客(七) 博客管理列表页

1.创建分类页面:

1.新建admin文件:

在这里插入图片描述

2.在里面创建blogs.html文件:

在这里插入图片描述

3.创建顶部任务栏:

在这里插入图片描述

2.写入中间编辑区代码:

在这里插入图片描述

 <div class="m-container-small m-padded-tb-big">
        <div class="ui container">
            <form id="blog-form" action="#" th:action="@{/admin/blogs}" method="POST" class="ui form">
                <!--标题-->
                <input type="hidden" name="published">
                <div class="required field">
                    <div class="ui left labeled input">
                        <!--下拉菜单-->
                        <div class="ui selection compact teal basic dropdown label">
                            <input type="hidden" value="原创" name="flag" th:value="*{flag}">
                            <i class="dropdown icon"></i>
                            <div class="text">原创</div>
                            <div class="menu">
                                <div class="item" data-value="原创">原创</div>
                                <div class="item" data-value="转载">转载</div>
                                <div class="item" data-value="翻译">翻译</div>
                            </div>
                        </div>
                        <!--标题栏-->
                        <input type="text" name="title" placeholder="标题" th:value="*{title}">
                    </div>
                </div>

                <!--博客内容-->
                <div class="required field">
                    <div id="md-content" style="z-index: 1 !important;">
                        <textarea placeholder="博客内容" name="content" th:text="*{content}"></textarea>
                    </div>
                </div>

                <!--博客信息-->
                <div class="two fields">

                    <!--分类-->
                    <div class="required field">
                        <div class="ui  left labeled action input">
                            <label class="ui basic compact label">分类</label>
                            <div class="ui fluid selection dropdown">
                                <input type="hidden" name="type.id" th:value="*{type}!=null ? *{type.id}">
                                <i class="dropdown icon"></i>
                                <div class="default text">分类</div>
                                <div class="menu">
                                    <div th:each="type : ${types}" class="item" data-value="1" th:data-value="${type.id}" th:text="${type.name}">错误日志</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!--标签-->
                    <div class="field">
                        <div class="ui  left labeled action input">
                            <label class="ui basic compact label">标签</label>
                            <div class="ui tag fluid selection multiple search  dropdown">
                                <input type="hidden" name="tagIds" th:value="*{tagIds}">
                                <i class="dropdown icon"></i>
                                <div class="default text">标签</div>
                                <div class="menu">
                                    <div th:each="tag : ${tags}" class="item" data-value="1" th:data-value="${tag.id}" th:text="${tag.name}">java</div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>

                <!--首页图片-->
                <div class="required field">
                    <div class="ui  left labeled action input">
                        <label class="ui basic label">首页图片</label>
                        <input type="text" name="indexPicture" th:value="*{indexPicture}">
                    </div>
                </div>


                <div class="required field">
                    <textarea name="description" th:text="*{description}" placeholder="博客描述……" maxlength="200"></textarea>
                </div>

                <!--博客功能选择-->
                <div class="inline fields">

                    <div class="field">
                        <div class="ui checkbox">
                            <input type="checkbox" id="recommend" name="recommend" checked th:checked="*{recommend}" class="hidden">
                            <label for="recommend">推荐</label>
                        </div>
                    </div>

                    <div class="field">
                        <div class="ui checkbox">
                            <input type="checkbox" id="shareStatement" name="shareStatement" checked th:checked="*{shareStatement}" class="hidden">
                            <label for="shareStatement">转载声明</label>
                        </div>
                    </div>

                    <div class="field">
                        <div class="ui checkbox">
                            <input type="checkbox" id="appreciation" name="appreciation" checked class="hidden">
                            <label for="appreciation">赞赏</label>
                        </div>
                    </div>

                    <div class="field">
                        <div class="ui checkbox">
                            <input type="checkbox" id="commentabled" name="commentabled" checked class="hidden">
                            <label for="commentabled">评论</label>
                        </div>
                    </div>

                </div>

                <!--错误提示栏-->
                <div class="ui error message"></div>

                <!--博客是否提交-->
                <div class="ui right aligned container">
                    <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                    <button type="button" id="save-btn" class="ui secondary button">保存</button>
                    <button type="button" id="publish-btn" class="ui teal button">发布</button>
                </div>
            </form>
        </div>
    </div>

3.底部部分:

  <footer class="ui inverted vertical segment m-padded-tb-massive">
        <div class="ui center aligned container">

            <div class="ui inverted divided stackable grid">

                <div class="three wide column">
                    <div class="ui inverted link list">
                        <div class="item">
                            <img src="../../src/main/resources/static/images/wechat.png" class="ui rounded image" alt="" style="width: 110px">
                        </div>
                    </div>
                </div>
                <div class="three wide column">
                    <h4 class="ui inverted header m-text-thin m-text-spaced ">最新博客</h4>
                    <div class="ui inverted link list">
                        <a href="#" class="item m-text-thin">用户故事{User}</a>
                        <a href="#" class="item m-text-thin">用户故事{User}</a>
                    </div>
                </div>

                <div class="three wide column">
                    <h4 class="ui inverted header m-text-thin m-text-spaced ">联系我</h4>
                    <div class="ui inverted link list">
                        <a href="#" class="item m-text-thin">Email:1316565748@qq.com</a>
                        <a href="#" class="item m-text-thin">QQ:1316565748</a>
                    </div>
                </div>

                <div class="seven wide column">
                    <h4 class="ui inverted header m-text-thin m-text-spaced">Blog</h4>
                    <p class="m-text-thin m-text-spaced m-opacity-mini ">
                        这是我的个人博客、会分享关于编程、写作、思考相关的任何内容,希望可以给来到这儿的人有所帮助...</p>
                </div>
            </div>

            <div class="ui inverted section divider"></div>
            <p class="m-text-thin m-text-spaced m-opacity-tiny">
                Copyright © 2021 Lirenmi Designed by Lirenmi
            </p>
        </div>
    </footer>
    <!--/*/<th:block th:replace="admin/_fragments :: script">/*/-->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
    <!--/*/</th:block>/*/-->

    <!--按钮点击事件-->
    <script>
        $('.menu.toggle').click(function () { $('.m-item').toggleClass('m-mobile-hide'); });
        
        //头像下拉菜单事件
        $('.ui.dropdown').dropdown({
            on:'hover'
        });

        /*保存按钮*/
        $('#save-btn').click(function () {
            $('[name="published"]').val(false);
            $('#blog-form').submit();
        });

        /*发布按钮*/
        $('#publish-btn').click(function () {
            $('[name="published"]').val(true);
            $('#blog-form').submit();
        });

        /*标签自定义*/
        $('.ui.tag.dropdown')
            .dropdown({
                allowAdditions:true
            });

        //检查内容是否为空
        $('.ui.form').form({
            fields:{
                title:{
                    identifier:'title',rules:[{
                        type:'empty',
                        prompt:'标题:请输入博客标题'
                    }]
                }
            }
        });

        //初始化mackdown编译器
        var contentEditor;

        $(function() {
            contentEditor = editormd("md-content", {
                width   : "100%",
                height  : 640,
                syncScrolling : "single",
                path    : "../lib/editormd/lib/"
            });
        });


        /*添加表达验证*/
        $('.ui.form').form({
            fields:{
                title:{
                    identifier:'title',
                    rules:[{
                        type:'empty',
                        prompt:'标题:请输入博客标题'
                    }]
                },
                content:{
                    identifier:'content',
                    rules:[{
                        type:'empty',
                        prompt:'标题:请输入博客内容'
                    }]
                },
                typeId:{
                    identifier:'typeId',
                    rules:[{
                        type:'empty',
                        prompt:'标题:请输入博客分类'
                    }]
                },
                firstPicture:{
                    identifier:'firstPicture',
                    rules:[{
                        type:'empty',
                        prompt:'标题:请输入博客首图'
                    }]
                },
                description:{
                    identifier:'description',
                    rules:[{
                        type:'empty',
                        prompt:'标题:请输入博客描述'
                    }]
                }
            }
        });
    </script>
</body>


显示效果:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值