<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ### 版塊管理頁面 ``` {% extends 'cms/base.html' %} {% block title %} 版塊管理 {% endblock %} {% block head %} <script src="{{ url_for('static',filename='cms/js/boards.js') }}"></script> {% endblock %} {% block page_title %} {{ self.title() }} {% endblock %} {% block main_content %} <div class="top-box"> <button class="btn btn-waring" style="float:right" id="add-board-btn">添加新版塊</button> </div> <table class="table table-bordered"> <thead> <tr> <th>版塊名稱</th> <th>帖子數量</th> <th>創建時間</th> <th>操作</th> </tr> </thead> <tbody> {% for board in boards %} <tr> <td>{{ board.name }}</td> <td>0</td> <td>{{ board.create_time }}</td> <td> <button class="btn btn-default btn-xs edit-board-tn">編輯</button> <button class="btn btn-danger btn-xs delete-board-tn">刪除</button> </td> </tr> {% endfor %} </tbody> </table> {% endblock %} ``` ### 添加js ``` $(function () { $("#add-board-btn").click(function (event) { event.preventDefault(); zlalert.alertOneInput({ 'text':"請輸入版塊名稱", 'placeholder':"模塊名稱", 'confirmCallback':function (inputValue) { zlajax.post({ 'url':'/cms/aboard/', 'data':{ 'name':inputValue, }, 'success':function (data) { if(data['code'] == 200){ window.location.reload(); }else{ zlalert.alertInfo(data["message"]); } }, 'fail':function () { zlalert.alertNetworkError(); }, }); }, }); }); }); ``` ### 版塊管理視圖 ``` @bp.route('/boards/') @login_required @permission_requeired(CMSPersmission.BOARDER) def boards(): board_models = BoardModel.query.all() context = { "boards":board_models, } return render_template('cms/boards.html',**context) # 添加版塊 @bp.route('/aboard/',methods=['POST']) @login_required @permission_requeired(CMSPersmission.BOARDER) def aboard(): form = AddBoardForm(request.form) if form.validate(): name = form.name.data board = BoardModel(name=name) db.session.add(board) db.session.commit() return restful.success() else: return restful.params_error(message=form.get_error()) # 編輯版塊 @bp.route('/uboard/',methods=["POST"]) @login_required @permission_requeired(CMSPersmission.BOARDER) def uboard(): form = UpdateBoardForm(request.form) if form.validate(): board_id = form.board_id.data name = form.name.data board = BoardModel.query.get(board_id) if board: board.name = name db.session.commit() return restful.success() else: return restful.params_error(message="沒有這個版塊") else: return restful.params_error(message=form.get_error()) # 刪除版塊 @bp.route('/dboard/',methods=["POST"]) @login_required @permission_requeired(CMSPersmission.BOARDER) def dboard(): board_id = request.form.get("board_id") if not board_id: return restful.params_error(message="請傳入版塊id!") board = BoardModel.query.get(board_id) if not board: return restful.params_error(message="沒有這個版塊!") db.session.delete(board) return restful.success() ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看