| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- {extend name="public/container"}
- {block name="head_top"}
- {/block}
- {block name="content"}
- <div class="layui-fluid" style="background: #fff;margin-top: -10px;">
- <div class="layui-row layui-col-space15">
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-body">
- <div class="layui-btn-container">
- <button class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('addChannel')}',{h:480,w:720})">
- 添加渠道
- </button>
- </div>
- <table class="layui-hide" id="List" lay-filter="List"></table>
- <script type="text/html" id="act">
- <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
- 编辑
- </button>
- <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='del'>
- 删除
- </button>
- </script>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="{__ADMIN_PATH}js/layuiList.js"></script>
- {/block}
- {block name="script"}
- <script>
- layList.tableList('List', "{:Url('channelList')}", function() {
- return [{
- field: 'id',
- title: 'ID',
- sort: true,
- event: 'id',
- width: '20%'
- },
- {
- field: 'name',
- title: '渠道名称',
- width: '30%'
- },
- {
- field: 'code',
- title: '渠道代码',
- width: '30%'
- },
- {
- field: 'right',
- title: '操作',
- align: 'center',
- toolbar: '#act',
- width: '20%'
- },
- ];
- });
- //点击事件绑定
- layList.tool(function(event, data, obj) {
- switch (event) {
- case 'del':
- var url = layList.U({
- c: 'user.user_channel',
- a: 'delete',
- q: {
- id: data.id
- }
- });
- var code = {
- title: "操作提示",
- text: "确定删除该渠道?",
- type: 'info',
- confirm: '是的,删除'
- };
- $eb.$swal('delete', function() {
- $eb.axios.get(url).then(function(res) {
- if (res.status == 200 && res.data.code == 200) {
- $eb.$swal('success', res.data.msg);
- obj.del();
- location.reload();
- } else
- return Promise.reject(res.data.msg || '删除失败')
- }).catch(function(err) {
- $eb.$swal('error', err);
- });
- }, code)
- break;
- case 'open_image':
- $eb.openImage(data.image);
- break;
- case 'edit':
- $eb.createModalFrame(data.name + '-编辑', layList.U({
- a: 'addChannel',
- q: {
- id: data.id
- }
- }), {
- h: 480,
- w: 720
- });
- break;
- }
- })
- </script>
- {/block}
|