143 lines
5.0 KiB
Plaintext
143 lines
5.0 KiB
Plaintext
@page "{handler?}"
|
|
@model YBDevice.NWeb.Pages.Info.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="Title" id="Title" placeholder="请输入标题" />
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
@Html.DropDownList("TagId", 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">
|
|
<div class="layui-input-inline">
|
|
@Html.DropDownList("AppId", new SelectList(Model.offs, "Value", "Text"), "全部小程序", new {lay_search=true })
|
|
</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/getinfolist'
|
|
, method: 'post'
|
|
, cols: [[
|
|
{
|
|
field: 'headimg', title: '封面图', templet: '#headtpl'
|
|
},
|
|
{
|
|
field: 'title', title: '标题'
|
|
},
|
|
{
|
|
field: 'tagname', title: '分组'
|
|
}
|
|
,
|
|
{
|
|
field: 'clickcount', title: '点击数'
|
|
}
|
|
,
|
|
{
|
|
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": 'Title',
|
|
"Type": QueryCond.Like,
|
|
"Value": $("#Title").val()
|
|
},{
|
|
"Name": 'TagId',
|
|
"Type": QueryCond.Equal,
|
|
"Value": $("#TagId").val()
|
|
}, {
|
|
"Name": 'Status',
|
|
"Type": QueryCond.Equal,
|
|
"Value": $("#Status").val()
|
|
}, {
|
|
"Name": 'AppId',
|
|
"Type": QueryCond.Equal,
|
|
"Value": $("#AppId").val()
|
|
}]
|
|
}
|
|
});
|
|
});
|
|
$(".js-add").on("click", function () {
|
|
common.dialog({
|
|
title: '添加资讯',
|
|
content: '/Info/Edit'
|
|
});
|
|
});
|
|
$("body").on("click", ".js-edit", function () {
|
|
var id = $(this).data('id');
|
|
common.dialog({
|
|
title: '编辑资讯',
|
|
content: '/Info/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/SetinfoStatus?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>
|
|
} |