New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-banner" lay-title="轮播图"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="user-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add"> |
| | | 新增 |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="bannerTable" lay-data="{id: 'bannerTable'}"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script type="text/html" id="isJump"> |
| | | {{# |
| | | var isJump = { |
| | | 2: {title: '否', color: 'red' }, |
| | | 1: {title: '是' , color: 'green'} |
| | | }[d.isJump]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isJump.color}}">{{ isJump.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="isInside"> |
| | | {{# |
| | | var isInside = { |
| | | 2: {title: '外' , color: 'green'}, |
| | | 1: {title: '内', color: 'red'} |
| | | }[d.isInside]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isInside.color}}">{{ isInside.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="showPort"> |
| | | {{# |
| | | var showPort = { |
| | | 2: {title: '手机' , color: 'green'}, |
| | | 1: {title: 'pc', color: 'red'} |
| | | }[d.showPort]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{showPort.color}}">{{ showPort.title }}</span> |
| | | </script> |
| | | <script type="text/html" id="isTop"> |
| | | {{# |
| | | var isTop = { |
| | | 2: {title: '否', color: 'red' }, |
| | | 1: {title: '是' , color: 'green'} |
| | | }[d.isTop]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isTop.color}}">{{ isTop.title }}</span> |
| | | </script> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="user-option"> |
| | | <!-- <span shiro:lacksPermission="user:view,user:update,user:delete">--> |
| | | <!-- <span class="layui-badge-dot febs-bg-orange"></span> 无权限--> |
| | | <!-- </span>--> |
| | | <!-- <a lay-event="edit" shiro:hasPermission="user:update">编辑--> |
| | | <a lay-event="edit">编辑 |
| | | <i class="layui-icon febs-edit-area febs-blue"></i> |
| | | </a> |
| | | <!-- <a lay-event="delete" shiro:hasPermission="user:update">删除--> |
| | | <a lay-event="delete">删除 |
| | | <i class="layui-icon febs-edit-area febs-blue"></i> |
| | | </a> |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | laydate = layui.laydate, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | dropdown = layui.dropdown, |
| | | $view = $('#febs-banner'), |
| | | $reset = $view.find('#reset'), |
| | | $add = $view.find('#add'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'spread', type: null}, |
| | | tableIns |
| | | ; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(bannerTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'edit') { |
| | | febs.modal.open('轮播图设置', 'modules/banner/platformBannerUpdate/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#banner-update').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | if (layEvent === 'delete') { |
| | | febs.modal.confirm('删除', '您是否确认删除?', function () { |
| | | deleteUsers(data.id); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function deleteUsers(id) { |
| | | febs.get(ctx + 'admin/banner/platformBannerDelete/' + id, null, function () { |
| | | febs.alert.success('确认删除'); |
| | | $reset.click(); |
| | | }); |
| | | } |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $add.on('click', function () { |
| | | febs.modal.open('轮播图新增', 'modules/banner/platformBannerAdd/', { |
| | | btn: ['提交', '取消'], |
| | | yes: function (index, layero) { |
| | | $('#banner-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return {}; |
| | | } |
| | | |
| | | function initTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'bannerTable', |
| | | url: ctx + 'admin/banner/platformBanner', |
| | | cols: [[ |
| | | {field: 'id', title: '', minWidth: 10,align:'left'}, |
| | | {field: 'name', title: '标题', minWidth: 120,align:'center'}, |
| | | {field: 'imageUrl', title: '图片链接', |
| | | templet: function (d) { |
| | | return '<img src="'+d.imageUrl+'" >' |
| | | }, minWidth: 200,align:'center'}, |
| | | // {field: 'sort', title: '联系方式', minWidth: 200,align:'center'}, |
| | | |
| | | {title: '是否可跳转', templet: '#isJump', minWidth: 60,align:'center'}, |
| | | {field: 'jumpUrl', title: '跳转链接', minWidth: 200,align:'center'}, |
| | | {title: '跳转外部或内部', templet: '#isInside', minWidth: 60,align:'center'}, |
| | | // {title: '显示端口', templet: '#showPort', minWidth: 60,align:'center'}, |
| | | {title: '是否置顶', templet: '#isTop', minWidth: 60,align:'center'}, |
| | | |
| | | {title: '操作', toolbar: '#user-option', minWidth: 140, fixed : 'right'} |
| | | ]] |
| | | }); |
| | | } |
| | | }) |
| | | </script> |