| | |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">分类</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="groupId" class="group-type"> |
| | | <select name="categoryId" class="group-type"> |
| | | <option value="">请选择</option> |
| | | </select> |
| | | </div> |
| | |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">状态</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="status"> |
| | | <select name="state"> |
| | | <option value="">请选择</option> |
| | | <option value="0">未开启</option> |
| | | <option value="1">已开启</option> |
| | | <option value="2">已结束</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </form> |
| | | <table lay-filter="activityTable" lay-data="{id: 'activityTable'}"></table> |
| | | <!-- <style type="text/css">--> |
| | | <!-- ::-webkit-scrollbar {--> |
| | | <!-- height: 20px !important;--> |
| | | <!-- background-color: #f4f4f4;--> |
| | | <!-- }--> |
| | | <!-- </style>--> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | </script> |
| | | <script type="text/html" id="activityStateSwitch"> |
| | | {{# if(d.status === 1) { }} |
| | | {{# if(d.state === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="activityStateSwitch"> |
| | | {{# } else if(d.status === 2) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="进行中|关闭" checked lay-skin="switch" lay-filter="activityStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="activityStateSwitch"> |
| | | {{# } }} |
| | |
| | | </script> |
| | | |
| | | <script type="text/html" id="activityOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="activityUpdateEvent">编辑</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" lay-event="activityDeleteEvent">删除</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="votesActivityUpdate:update" lay-event="activityUpdateEvent">编辑</button> |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" shiro:hasPermission="votesActivityUpdate:update" lay-event="activityDeleteEvent">删除</button> |
| | | </script> |
| | | |
| | | <style> |
| | |
| | | |
| | | form.render(); |
| | | //(下拉框) |
| | | $.get(ctx + 'admin/votesActivity/allGroup', function (res) { |
| | | $.get(ctx + 'admin/happyActivity/allGroup', function (res) { |
| | | var data = res.data; |
| | | for (let k in data) |
| | | { |
| | |
| | | } |
| | | }); |
| | | |
| | | form.on('switch(activityStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | changeState(data.value,1); |
| | | } else { |
| | | changeState(data.value,0); |
| | | } |
| | | }) |
| | | function changeState(id,state) { |
| | | febs.get(ctx + 'admin/votesActivity/changeState/' + id+'/' + state, null, function (data) { |
| | | febs.get(ctx + 'admin/happyActivity/changeState/' + id+'/' + state, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function delAct(id) { |
| | | febs.get(ctx + 'admin/votesActivity/delActivity/' + id, null, function (data) { |
| | | febs.get(ctx + 'admin/happyActivity/delActivity/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'activityTable', |
| | | url: ctx + 'admin/votesActivity/list', |
| | | url: ctx + 'admin/happyActivity/list', |
| | | toolbar:"#activityToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | |
| | | {type: 'numbers', title: '序号', width: 80}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#activityOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'left'}, |
| | | {field: 'groupby', title: '分类', minWidth: 150,align:'left'}, |
| | | {field: 'categoryName', title: '分类', minWidth: 150,align:'left'}, |
| | | { |
| | | field: 'coverImage', |
| | | title: '图片', |
| | | field: 'indexImg', |
| | | title: '封面', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeImgThumb">' + |
| | | '<img id="seeImgThumb' + d.id + '" src="' + d.coverImage + |
| | | '<img id="seeImgThumb' + d.id + '" src="' + d.indexImg + |
| | | '" alt="图片" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150, |
| | | align: 'center' |
| | | }, |
| | | {field: 'activityType', title: '类型', minWidth: 90,align:'left',templet: function(d){ |
| | | if (d.activityType === '1') { |
| | | return '文字'; |
| | | } else if (d.activityType === '2') { |
| | | return `图片`; |
| | | } else if (d.activityType === '3') { |
| | | return `视频`; |
| | | } else { |
| | | return '二维码'; |
| | | } |
| | | } |
| | | }, |
| | | {field: 'isMultiple', title: '是否多选', minWidth: 90,align:'left',templet: function(d){ |
| | | if (d.activityType === '1') { |
| | | return '是'; |
| | | }else { |
| | | return '否'; |
| | | } |
| | | } |
| | | }, |
| | | {field: 'totalVotes', title: '总投票数', minWidth: 90,align:'left'}, |
| | | {field: 'startTime', title: '开始时间', minWidth: 200,align:'left'}, |
| | | {field: 'endTime', title: '结束时间', minWidth: 200,align:'left'}, |
| | | {field: 'status', title: '状态', templet: '#activityStateSwitch', minWidth: 130,align:'center'} |
| | | {field: 'state', title: '状态', templet: '#activityStateSwitch', minWidth: 130,align:'center'} |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | form.on('switch(activityStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | changeState(data.value,1); |
| | | } else { |
| | | changeState(data.value,0); |
| | | } |
| | | }) |
| | | |
| | | |
| | | // 查询按钮 |
| | |
| | | function getQueryParams() { |
| | | return { |
| | | name: $searchForm.find('input[name="name"]').val().trim(), |
| | | status: $searchForm.find("select[name='status']").val(), |
| | | groupId: $searchForm.find("select[name='groupId']").val(), |
| | | state: $searchForm.find("select[name='state']").val(), |
| | | categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |