| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-banner" lay-title="轮播图"> |
| | | <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"> |
| | |
| | | <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> |
| | |
| | | }} |
| | | <span class="layui-badge febs-bg-{{isTop.color}}">{{ isTop.title }}</span> |
| | | </script> |
| | | |
| | | <script type="text/html" id="bannerToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="platformBannerAdd:add" lay-event="platformBannerAdd">新增</button> |
| | | </div> |
| | | </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> |
| | | |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="platformBannerUpdate:update" lay-event="editBanner">编辑</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" shiro:hasPermission="platformBannerUpdate:update" lay-event="deleteBanner">删除</button> |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | |
| | | table.on('tool(bannerTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'seeIconPng') { |
| | | var t = $view.find('#seeIconPng'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "图片", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'edit') { |
| | | febs.modal.open('轮播图设置', 'modules/banner/platformBannerUpdate/' + data.id, { |
| | | if (layEvent === 'editBanner') { |
| | | febs.modal.open('设置', 'modules/banner/platformBannerUpdate/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#banner-update').find('#submit').trigger('click'); |
| | | $('#febs-banner-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | if (layEvent === 'delete') { |
| | | if (layEvent === 'deleteBanner') { |
| | | febs.modal.confirm('删除', '您是否确认删除?', function () { |
| | | deleteUsers(data.id); |
| | | }); |
| | |
| | | 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(); |
| | | } |
| | | }); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(bannerTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | if(layEvent === 'platformBannerAdd'){ |
| | | febs.modal.open('新增', 'modules/banner/platformBannerAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-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', |
| | | toolbar:"#bannerToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {field: 'id', title: '', minWidth: 10,align:'left'}, |
| | | {title: '操作', toolbar: '#user-option', minWidth: 140, fixed : 'right'}, |
| | | {field: 'name', title: '标题', minWidth: 120,align:'center'}, |
| | | {field: 'imageUrl', title: '图片链接', |
| | | {field: 'imageUrl',title: '图片', |
| | | templet: function (d) { |
| | | return '<img src="'+d.imageUrl+'" >' |
| | | }, minWidth: 200,align:'center'}, |
| | | // {field: 'sort', title: '联系方式', minWidth: 200,align:'center'}, |
| | | |
| | | return '<a lay-event="seeIconPng">' + |
| | | '<img id="seeIconPng' + d.id + '" src="' + d.imageUrl + |
| | | '" alt="图片" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,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'} |
| | | ]] |
| | | }); |
| | | } |