249 行
7.8 KiB
HTML
可执行文件
249 行
7.8 KiB
HTML
可执行文件
<!--[1.5.51]-->
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/goodsList.css"/>
|
|
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Retail/css/myscroll.css"/>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
table {
|
|
border: 1px solid #f1f1f1;
|
|
margin-top: 40px;
|
|
}
|
|
|
|
.layui-table-cell {
|
|
height: auto;
|
|
}
|
|
|
|
#exchange {
|
|
margin: 0 0 0 20px;
|
|
}
|
|
|
|
.magic_img {
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.magic_img_big_img {
|
|
width: 100%;
|
|
max-width: 100% !important;
|
|
border-radius: 8px;
|
|
border: 1px dashed #ccc;
|
|
height: 120px;
|
|
}
|
|
|
|
.magic_img_small {
|
|
width: 100%;
|
|
height: 70px;
|
|
margin-top: 5px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.magic_img_small_img {
|
|
width: 67px;
|
|
height: 67px;
|
|
border-radius: 8px;
|
|
border: 1px dashed #ccc;
|
|
}
|
|
|
|
.center {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.layui-unselect {
|
|
width: 42px;
|
|
height: 24px;
|
|
line-height: 24px;
|
|
}
|
|
</style>
|
|
<div class="goodsBox">
|
|
<div class="goods_title">
|
|
<div class="goods_title_inner">
|
|
小程序导航栏
|
|
</div>
|
|
</div>
|
|
<div class="goods_edit">
|
|
<form class="layui-form">
|
|
<div class="layui-form-item" style="display: flex;align-items: center;">
|
|
<if condition="$authArr['set_navigation'] eq true">
|
|
<button style="margin-left: 0px" type="button" class="layui-btn" id="add">新增导航</button>
|
|
</if>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<script type="text/html" id="switch_status">
|
|
|
|
<input type="checkbox" name="status"
|
|
<if condition="$authArr['update_status'] neq true">disabled
|
|
</if> lay-skin="switch" lay-text="启用|禁用" lay-filter="status_" value="{{d.id}}" {{d.status==1 ? 'checked' : ''}} {{d.use==1 ? '' : 'disabled'}}>
|
|
|
|
</script>
|
|
<div class="goods_edit">
|
|
<table class="layui-hide" id="navigation" lay-filter="demo"></table>
|
|
<script type="text/html" id="barDemo">
|
|
<if condition="$authArr['set_navigation'] eq true">
|
|
{{# if(d.use ==1){ }}
|
|
<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit">编辑</button>
|
|
{{# } }}
|
|
</if>
|
|
<if condition="$authArr['del_navigation'] eq true">
|
|
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</button>
|
|
</if>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
layui.use(['form', 'layedit', 'laydate', 'table'], function () {
|
|
// 日期
|
|
var laydate = layui.laydate, form = layui.form;
|
|
var table = layui.table;
|
|
|
|
//展示已知数据
|
|
table.render({
|
|
elem: '#navigation',
|
|
url: "{:U('getNavigation')}",
|
|
method: 'post',
|
|
limit: 10,
|
|
cols: [
|
|
[{
|
|
field: 'index',
|
|
title: '序号',
|
|
width: 60
|
|
}, {
|
|
field: 'title',
|
|
title: '标题',
|
|
align: 'center'
|
|
}, {
|
|
field: 'icon',
|
|
title: '图标',
|
|
align: 'center',
|
|
templet: '<div><img src="{{ d.icon}}" style="height: 30px;width: 30px;border-radius: 50%"></div>',
|
|
}, {
|
|
field: 'navigation_name',
|
|
title: '类型',
|
|
align: 'center',
|
|
}, {
|
|
field: 'skip',
|
|
title: '跳转',
|
|
align: 'center',
|
|
}, {
|
|
field: 'link',
|
|
title: '关联',
|
|
align: 'center',
|
|
}, {
|
|
field: 'addtime',
|
|
title: '添加时间',
|
|
align: 'center'
|
|
}, {
|
|
field: 'status',
|
|
title: '状态',
|
|
templet: '#switch_status',
|
|
align: 'center'
|
|
}, {
|
|
field: 'use',
|
|
templet: function(d){
|
|
return d.use == 1? '可用':'不可用';
|
|
},
|
|
title: '是否可用',
|
|
align: 'center'
|
|
}, {
|
|
field: 'right',
|
|
title: '操作',
|
|
align: 'center',
|
|
toolbar: '#barDemo'
|
|
}]
|
|
],
|
|
page: {
|
|
layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
|
|
}, //是否开启分页
|
|
id: 'table_'
|
|
});
|
|
$('#Preservation').click(function () {
|
|
table.reload('test', {
|
|
page: {
|
|
curr: 1 //重新从第 1 页开始
|
|
}
|
|
, where: {
|
|
keyword: $('#keyword').val()
|
|
}
|
|
});
|
|
})
|
|
form.on('switch(status_)', function (obj) { // 监听switch
|
|
if (this.checked == true) { // 启用
|
|
var status = 1;
|
|
} else { // 禁用
|
|
var status = 2;
|
|
}
|
|
$.ajax({
|
|
url: "{:U('update_status')}",
|
|
data: {status: status, id: obj.value},
|
|
type: 'post',
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
layer.msg(res.msg, {icon: 1, time: 1500})
|
|
} else {
|
|
layer.msg(res.msg, {icon: 2, time: 1500}, function () {
|
|
table.reload('table_')
|
|
})
|
|
}
|
|
}
|
|
})
|
|
});
|
|
table.on('tool(demo)', function (obj) {
|
|
var data = obj.data;
|
|
if (obj.event === 'del') {
|
|
layer.confirm('确定删除吗?', function (index) {
|
|
$.ajax({
|
|
url: "{:U('del_navigation')}",
|
|
data: {id: data.id},
|
|
type: 'post',
|
|
success: function (res) {
|
|
if (res.status == 1) {
|
|
layer.msg(res.msg, {icon: 1, time: 1500}, function () {
|
|
obj.del();
|
|
})
|
|
} else {
|
|
layer.msg(res.msg, {icon: 2, time: 1500})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
} else if (obj.event === 'edit') {
|
|
layer.open({
|
|
type: 2,
|
|
content: "{:U(set_navigation)}?id=" + data.id,
|
|
title: "编辑导航栏",
|
|
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
|
offset: 'rb',
|
|
shade: 0,
|
|
btnAlign: 'c',
|
|
end: function () {
|
|
table.reload('table_')
|
|
}
|
|
})
|
|
}
|
|
});
|
|
$('#add').click(function () {
|
|
layer.open({
|
|
type: 2,
|
|
content: "{:U(set_navigation)}?id=0",
|
|
title: "添加导航栏",
|
|
area: ['calc(100% - 160px)', 'calc(100% - 65px)'],
|
|
offset: 'rb',
|
|
shade: 0,
|
|
btnAlign: 'c',
|
|
end: function () {
|
|
table.reload('table_')
|
|
}
|
|
})
|
|
})
|
|
})
|
|
</script>
|