1.数据库:
id |
int(11) |
|
|
否 |
无 |
top |
int(1) |
|
|
否 |
1 |
是否置顶 1为不置顶,2为置顶
|
2.视图:
<div class="layui-form news_list">
<table class="layui-table" lay-filter="test" >
<colgroup>
<col width="">
<col width="">
<col width="">
<col width="350">
</colgroup>
<thead>
<tr>
<th>名称</th>
<th>图片</th>
<th>启用状态</th>
<th>操作</th>
</tr>
</thead>
<tbody id="listbox"></tbody>
</table>
</div>
</div>
</div>
@stop
@section("javascript")
<script src="{
{
asseturl("js/beginbanner/index.js")}}"></script>
3.js代码:
top:function () {
var id = $(this).data("id");
var state = $(this).data("state");
var auditMsg = "";
if(state==1){
auditMsg = "您确认取消置顶吗?";
}else{
auditMsg = "您确认置顶吗?";
}
layer.confirm(auditMsg, {
btn: ['确认', '取消'] //按钮
, title: '<i class="layui-icon"></i> 确认提示'
, icon: 0
}, function () {
$.ajax({
url: adminurl + "/beginbanner/topstatus",
data: {
id: id,
status:state,
_token: _token,
},
type: "PUT",
dataType: "json",