BBS论坛(二十四)
2025年01月15日 02:41:42

LIKE.TG | 发现全球营销软件&服务汇聚顶尖互联网营销和AI营销产品,提供一站式出海营销解决方案。唯一官网:www.like.tg
24.1.编辑板块
cms/js/banners.js
$(function () {
$('.edit-board-btn').click(function () {
var self = $(this);
var tr = self.parent().parent();
var name = tr.attr('data-name');
var board_id = tr.attr('data-id');
zlalert.alertOneInput({
'title': '编辑板块',
'text': '请输入版块名称',
'placeholder': name,
'confirmCallback': function (inputValue) {
zlajax.post({
'url': '/cms/uboards/',
'data': {
'board_id': board_id,
'name': inputValue
},
'success': function (data) {
if (data['code'] == 200) {
window.location.reload();
} else {
zlalert.alertInfo(data['message'])
}
}
});
}
});
});
});
24.2.删除板块
cms/js/banners.js
$(function () {
$('.delete-board-btn').click(function (event) {
event.preventDefault();
var self = $(this);
var board_id = self.parent().parent().attr('data-id');
zlalert.alertConfirm({
'title': '删除版块',
'msg': '确认删除该版块吗?',
'confirmCallback': function () {
zlajax.post({
'url': '/cms/dboards/',
'data': {
'board_id': board_id
},
'success': function (data) {
if (data['code'] == 200) {
window.location.reload();
} else {
zlalert.alertInfo(data['message']);
}
}
});
}
})
})
});
24.3.首页动态显示板块
(1)front/views.py
@bp.route('/')
def index():
banners = BannerModel.query.order_by(BannerModel.priority.desc()).limit(4)
boards = BoardModel.query.all()
context = {
'banners':banners,
'boards':boards
}
return render_template('front/front_index.html',**context)
(2)front/index.py
<div class="sm-container">
<div style="margin-bottom: 10px;">
<button class="btn btn-warning btn-block">发布帖子</button>
</div>
<div class="list-group">
<a href="#" class="list-group-item active">所有板块</a>
{% for board in boards %}
<a href="#" class="list-group-item">{{ board.name }}</a>
{% endfor %}
</div>
</div>

LIKE.TG:汇集全球营销软件&服务,助力出海企业营销增长。提供最新的“私域营销获客”“跨境电商”“全球客服”“金融支持”“web3”等一手资讯新闻。
点击【联系客服】 🎁 免费领 1G 住宅代理IP/proxy, 即刻体验 WhatsApp、LINE、Telegram、Twitter、ZALO、Instagram、signal等获客系统,社媒账号购买 & 粉丝引流自助服务或关注【LIKE.TG出海指南频道】、【LIKE.TG生态链-全球资源互联社区】连接全球出海营销资源。
本文由LIKE.TG编辑部转载自互联网并编辑,如有侵权影响,请联系官方客服,将为您妥善处理。
This article is republished from public internet and edited by the LIKE.TG editorial department. If there is any infringement, please contact our official customer service for proper handling.
Server deployment全球论坛人工智能论坛全球峰会发展论坛战略论坛开放论坛程序员论坛互联网峰会科技峰会