123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- @extends('admin/site/side_layout')
- @section('header_extend')
- @endsection
- @section('right')
- @php $hasEdit=0; @endphp
- @hasAuth('sites-links-edit')
- @php $hasEdit=1; @endphp
- @endHasAuth
- <form class="row" id="searchForm">
- @if($hasEdit)
- <div class="col-md-2">
- <div class="input-group">
- <span class="input-group-btn">
- <button type="button" class="btn btn-md btn-info" onclick="units.importLink()"><span
- class="glyphicon glyphicon-hand-up"></span> 导入外链</button>
- <button type="button" class="btn btn-md btn-success" style="margin-left: 10px"
- onclick="units.save(0)"><span
- class="glyphicon glyphicon-hand-down"></span> 添加单个外链</button>
- <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
- style="margin-left: 10px"> <span
- class="glyphicon glyphicon-remove"></span> 删除</button>
- {{--<button type="button" class="btn btn-md btn-danger"--}}
- {{--style="margin-left: 10px"><span--}}
- {{--class="glyphicon glyphicon-remove"></span> 清空外链</button>--}}
- </span>
- </div>
- </div>
- @endif
- <div class="col-md-6 pull-right">
- <div class="input-group">
- <input type="text" placeholder="请输入平台链接" class="input-md form-control"
- name="keyword"
- id="keyword" style="width: 300px;float: right">
- <span class="input-group-btn">
- <button type="button" class="btn btn-md btn-primary" onclick="units.search()"> 搜索</button>
- <button type="button" class="btn btn-md btn-primary" style="margin-left: 10px" name="btnReset"> 重置</button>
- <button type="button" class="btn btn-md btn-info" style="margin-left: 10px"
- onclick="units.exportExcel()"> 导出</button>
- </span>
- </div>
- </div>
- </form>
- <hr>
- <div class="table-responsive">
- <table id="table" class="table table-condensed"
- data-mobile-responsive="true"></table>
- </div>
- @endsection
- @section('footer_extend')
- <script>
- var units = {
- exportExcel: function () {
- var keyword = $("#keyword").val();
- window.open('/admin/link/export/{{$siteId}}?keyword=' + keyword);
- },
- search: function () {
- tips.selectPage();
- },
- importLink: function () {
- var str = '<div class="ibox-content" id="importLayer">' +
- '<form class="form-horizontal">' +
- '<div class="form-group">' +
- '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
- '<div class="col-sm-6">' +
- '<input type="file" id="excel_file" class="form-control">' +
- '<input type="hidden" id="excel_path">' +
- '</div>' +
- '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUpload()">上传</button></div>' +
- '</div>' +
- ' <div class="form-group">' +
- '<div class="col-sm-6 col-sm-offset-3">' +
- '<a href="{{asset('tpl/link_tpl.xlsx')}}">请下载导入模板</a>' +
- '</div>' +
- '</div>' +
- '</form>' +
- '</div>';
- var openIndex = layer.open({
- type: 1,
- content: str,
- area: ['60%', '40%'],
- btn: ['导入', '取消'],
- title: '导入外链',
- yes: function (index, layero) {
- var data = {excel_path: $("#excel_path").val(), siteId: "{{$siteId}}"};
- var config = {
- url: '/admin/link/import/{{$siteId}}',
- type: 'post',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- layer.close(openIndex);
- tips.tableRefresh();
- });
- }
- };
- tips.ajax(config);
- }
- });
- },
- fileUpload: function () {
- var config = {
- url: '/admin/tool/excel-upload'
- };
- config.success = function (result) {
- $("#excel_path").val(result.data.file_url);
- layer.msg(result.message, {icon: 6, time: 1500});
- };
- tips.fileUpload($("#excel_file"), config);
- },
- getIdsBySelections: function () {
- var selections = $("#table").bootstrapTable('getSelections');
- var ids = [];
- $.each(selections, function (inx, val) {
- ids.push(val.id);
- });
- return ids;
- },
- delete: function () {
- var ids = units.getIdsBySelections();
- if (ids.length === 0) {
- layer.alert('请先选择您所要操作的对象', {icon: 0});
- return;
- }
- layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function () {
- tips.ajax({url: '/admin/link/link-detail', type: 'delete', data: {ids: ids}});
- tips.tableRefresh('#table');
- });
- },
- save: function (id) {
- layer.open({
- type: 2,
- content: ['/admin/link/link-count/' + id + '?siteId={{$siteId}}'],
- area: ['60%', '70%'],
- title: '保存'
- });
- }
- // detail: function (id) {
- // layer.open({
- // type: 2,
- // content: ['/admin/link/task/' + id],
- // area: ['90%', '100%'],
- // title: '',
- // closeBtn: 0
- // });
- // },
- };
- var config = {};
- config.url = '/admin/link/sites/{{$siteId}}/link-count';
- config.columns = [ //字段
- {checkbox: true},
- {
- title: '序号', align: 'center', formatter: function (value, item, index) {
- return index + 1;
- }
- },
- {title: '类型', field: 'link_type_source', align: 'center'},
- {title: '平台链接', field: 'link_url_source', align: 'center'},
- {title: '关联外链标题', field: 'task_title', align: 'center'},
- {title: '用户名', field: 'username', align: 'center'},
- {title: '邮箱', field: 'email', align: 'center'},
- {title: '密码', field: 'password', align: 'center'},
- {title: 'profile演示地址', field: 'url', align: 'center'},
- {title: '页面演示地址数量', field: 'urls_count', align: 'center'},
- {title: '创建时间', field: 'created_at', align: 'center'},
- {
- title: '操作', field: 'id', align: 'center',
- formatter: function (value, row) {
- var str = '';
- @if($hasEdit)
- str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';
- @endif
- return str;
- }
- }
- ];
- tips.bootstrapTable(config);
- </script>
- @endsection
|