145 lines
5.1 KiB
Plaintext
145 lines
5.1 KiB
Plaintext
@page "{handler?}"
|
|
@model YBDevice.NWeb.Pages.Banner.IndexModel
|
|
@{
|
|
ViewData["Title"] = "轮播图";
|
|
}
|
|
<div class="layui-card">
|
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
|
|
<div class="layui-form-item">
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
<input type="text" class="layui-input" name="Name" id="Name" placeholder="请输入名称" />
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
@Html.DropDownList("PositionType", new SelectList(Model.ptypes, "Value", "Text"), "全部广告", new { })
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
@Html.DropDownList("Type", new SelectList(Model.types, "Value", "Text"), "全部类型", new { })
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
@Html.DropDownList("Status", new SelectList(Model.statuss, "Value", "Text"), "全部状态", new { })
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<button class="btn btn-primary btn-lg js-search" type="button">查询</button>
|
|
@Html.Raw(Model.viewdata.Top)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-card-body">
|
|
<table class="layui-table" id="list" lay-filter="list">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<script type="text/html" id="optpl">
|
|
@Html.Raw(Model.viewdata.Table)
|
|
</script>
|
|
<script type="text/html" id="headtpl">
|
|
<img lay-src="{{d.headimg}}" data-src="preview" style="height:100px;width:196px;" />
|
|
</script>
|
|
@section Scripts
|
|
{
|
|
<script type="text/javascript">
|
|
layui.use(['common'], function () {
|
|
var common = layui.common;
|
|
common.initTable({
|
|
url: '/api/info/getlist'
|
|
, method: 'post'
|
|
, cols: [[
|
|
{
|
|
field: 'headimg', title: '封面图', templet: '#headtpl'
|
|
},
|
|
{
|
|
field: 'appid', title: '小程序'
|
|
},
|
|
{
|
|
field: 'name', title: '名称'
|
|
}
|
|
,
|
|
{
|
|
field: 'type', title: '内容类型', templet: function (d) {
|
|
return AdType[d.type];
|
|
}
|
|
}
|
|
,
|
|
{
|
|
field: 'status', title: '状态', templet: function (d) {
|
|
return AdStatus[d.status];
|
|
}
|
|
}
|
|
,
|
|
{
|
|
field: 'createtime', title: '创建时间'
|
|
},
|
|
{
|
|
title: '操作', templet: "#optpl", fixed: 'right'
|
|
}
|
|
]]
|
|
});
|
|
$(".js-search").on("click", function () {
|
|
common.reloadtable("list", {
|
|
where: {
|
|
queryParam: [{
|
|
"Name": 'Name',
|
|
"Type": QueryCond.Like,
|
|
"Value": $("#Name").val()
|
|
}, {
|
|
"Name": 'PositionType',
|
|
"Type": QueryCond.Equal,
|
|
"Value": $("#PositionType").val()
|
|
},{
|
|
"Name": 'Type',
|
|
"Type": QueryCond.Equal,
|
|
"Value": $("#Type").val()
|
|
}, {
|
|
"Name": 'Status',
|
|
"Type": QueryCond.Equal,
|
|
"Value": $("#Status").val()
|
|
}]
|
|
}
|
|
});
|
|
});
|
|
$(".js-add").on("click", function () {
|
|
common.dialog({
|
|
title: '添加广告',
|
|
content: '/Banner/Edit'
|
|
});
|
|
});
|
|
$("body").on("click", ".js-edit", function () {
|
|
var id = $(this).data('id');
|
|
common.dialog({
|
|
title: '编辑广告',
|
|
content: '/Banner/Edit?id=' + id
|
|
});
|
|
});
|
|
$("body").on("click", ".js-Set", function () {
|
|
var id = $(this).data('id');
|
|
var status = $(this).data('status');
|
|
var msg = "确定下架?";
|
|
if (status == 1) {
|
|
msg = "确定发布?";
|
|
}
|
|
common.confirm(msg, function () {
|
|
common.ajax({
|
|
url: "/api/info/SetStatus?id=" + id + "&status=" + status,
|
|
success: function (res) {
|
|
if (res.code == 0) {
|
|
common.info(res.message, function () {
|
|
$(".js-search").trigger("click");
|
|
});
|
|
} else {
|
|
common.alert(res.message);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
} |