You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
5.6 KiB
168 lines
5.6 KiB
<!DOCTYPE html>
|
|
<html lang="zh-cn">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<!--#include file="/widget/head.html"-->
|
|
</head>
|
|
|
|
<body class="layui-body">
|
|
<div id="wrapper" class="row layui-card layui-panel">
|
|
<!-- Navigation -->
|
|
<!--#include file="/widget/nav.html"-->
|
|
<div id="page-wrapper" class="layui-form" lay-filter="mform">
|
|
<div class="layui-card" id="card-page-wrapper">
|
|
<div class="row">
|
|
<div class="container" style="margin-left: 10px">
|
|
<div class="col-md-1" style="width:40px;">
|
|
<p style="font-size: 18px;line-height: 35px;float: right">Uid:</p>
|
|
</div>
|
|
<div class="col-md-4" style="width:200px;">
|
|
<input type="text" class="layui-input" id="uid" placeholder="feature">
|
|
</div>
|
|
<div class="col-md-1">
|
|
<button type="button" class="layui-btn" id="sele">查询</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row table-responsive" id="form" style="width: 100%">
|
|
<table class="table table-striped table-bordered table-hover inline" id="hero_table">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--#include file="/widget/tail.html"-->
|
|
<script type="text/javascript">
|
|
|
|
|
|
var itemlist;
|
|
|
|
|
|
$("#sele").click(function () {
|
|
Select_data(1, 120, 1);
|
|
});
|
|
|
|
|
|
|
|
function OnChange(feature) {
|
|
|
|
layer.confirm('确定修改嘛?', function(index){
|
|
|
|
$.get(Page.SvrIp + "/api/update_feature_switch",
|
|
{
|
|
token: cookie.get("token"),
|
|
feature:feature
|
|
},
|
|
function (data) {
|
|
if (data.code == 0) {
|
|
layer.msg('修改成功');
|
|
}
|
|
});
|
|
layer.close(index);
|
|
});
|
|
}
|
|
|
|
|
|
function ini_page(data) {
|
|
layui.laypage.render({
|
|
elem: 'test1',
|
|
count: data.count,
|
|
limits: [10, 20, 30, 40, 50, 80, 100],
|
|
limit: 100,
|
|
layout: ["count", "prev", "page", "next", "limit", "skip"],
|
|
jump: function (obj, first) {
|
|
if (!first) {
|
|
Select_data(obj.curr, obj.limit, 0);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
function inihero_table(data, limit) {
|
|
m_limit = limit;
|
|
console.info(data);
|
|
herotable = layui.table.render({
|
|
elem: '#hero_table',
|
|
page: false,
|
|
data: data,
|
|
width: 1300,
|
|
height: 1100,
|
|
autoSort: true,
|
|
limit: limit,
|
|
cols: [[
|
|
{ field: 'feature', title: '功能ID', sort: true, width: 120 },
|
|
{ field: 'name', title: '名称', sort: true, width: 180 },
|
|
{ field: 'status', title: '状态', sort: true, width: 180,templet:function (d) {
|
|
if(d.status==1){
|
|
return '<input type="checkbox" name="'+d.feature+'" lay-skin="switch" lay-text="ON|OFF" checked="" onchange="OnChange('+d.feature+')" lay-filter="switchTest"> ' +
|
|
'<div class="layui-unselect layui-form-switch layui-form-onswitch"' +
|
|
'lay-skin="_switch"><em>ON</em><i></i></div>'
|
|
}
|
|
return '<input type="checkbox" name="'+d.feature+'" lay-data-id="'+d.feature+'" lay-skin="switch" lay-text="ON|OFF" onchange="OnChange('+d.feature+')" lay-filter="switchTest"> ' +
|
|
'<div class="layui-unselect layui-form-switch"' +
|
|
'lay-skin="_switch"><em>OFF</em><i></i></div>'
|
|
} },
|
|
|
|
]]
|
|
});
|
|
|
|
}
|
|
|
|
function Select_data(page, limit, first) {
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: Page.SvrIp + "/api/select_feature_switch",
|
|
data: {
|
|
token: cookie.get("token"),
|
|
},
|
|
dataType: "json",
|
|
beforeSend: function () {
|
|
layer.load(1, { shade: [0.8, '#393D49'] });
|
|
},
|
|
complete: function () {
|
|
layer.closeAll('loading');
|
|
},
|
|
success: function (d) {
|
|
console.dir(d);
|
|
debugger;
|
|
exchange_data =d.data; //JSON.parse(d.data);
|
|
inihero_table(exchange_data, limit);
|
|
layui.form.render();
|
|
if (first === 1) {
|
|
ini_page(d);
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
$(function () {
|
|
initPage('功能开关管理');
|
|
Select_data(1, 120, 1);
|
|
layui.use(['form'], function () {
|
|
var form = layui.form;
|
|
|
|
// 监听开关的改变事件
|
|
form.on('switch(switchTest)', function (data) {
|
|
console.log(data.elem.name);
|
|
OnChange(data.elem.name)
|
|
});
|
|
})
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
<script src="../js/coupon.js"></script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|