123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- @extends('admin/layout')
- @section('content')
- <body class="gray-bg">
- <div class="wrapper wrapper-content animated fadeInRight">
- <div class="row">
- <div class="col-sm-12">
- <div class="ibox float-e-margins">
- <div class="ibox-content">
- <form class="row" id="searchForm" onsubmit="units.search();return false;">
- <div class="col-md-2">
- <div class="input-group">
- <span class="input-group-btn">
- <button type="button" class="btn btn-md btn-primary" onclick="units.save(0)"
- style="margin-left: 10px;border-radius:2px;"> <span class="glyphicon glyphicon-plus"></span> 添加</button>
- <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
- style="margin-left: 10px;border-radius:2px;"><span
- class="glyphicon glyphicon-remove"></span> 删除</button>
- <button type="button" class="btn btn-md btn-primary"
- onclick="units.import()" style="margin-left: 10px;border-radius:2px;">
- 导入外链
- </button>
- </span>
- </div>
- </div>
- <div class="col-md-7 pull-right">
- <div class="input-group">
- <select name="type" id="" class="form-control" title=""
- style="width: 150px;float: right">
- <option value="">请选择类型</option>
- @foreach(\App\Http\Models\Link::TYPES as $key=>$val)
- <option value="{{$key}}">{{$val}}</option>
- @endforeach
- </select>
- <select name="business_ids" id="" class="form-control" title=""
- style="width: 150px;float: right">
- <option value="">请选择行业</option>
- @foreach ($businesses as $business)
- <option value="{{$business->id}}">{{$business->title}}</option>
- @endforeach
- </select>
- <input type="text" placeholder="请输入平台链接" class="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" style="border-radius:2px;"
- onclick="units.search()"> 搜索
- </button>
- <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px;border-radius:2px;"
- name="resetBtn"> 重置
- </button>
- <button type="button" class="btn btn-md btn-primary" style="margin-left: 10px;border-radius:2px;"
- onclick="units.exportExcel()"> 导出</button>
- </span>
- </div>
- </div>
- </form>
- <div style="padding: 20px 10px">
- @foreach($list as $value)
- {{$value->type}} : {{$value->count}}
- @endforeach
- </div>
- <hr>
- <div class="table-responsive">
- <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- @endsection
- @section('footer')
- <script>
- var units = {
- getIdsBySelections: function () {
- var selections = $("#table").bootstrapTable('getSelections');
- var ids = [];
- $.each(selections, function (inx, val) {
- ids.push(val.id);
- });
- return ids;
- },
- save: function (id) {
- layer.open({
- type: 2,
- content: ['/admin/link/' + id + '/save'],
- area: ['60%', '60%'],
- title: '保存'
- });
- },
- search: function () {
- tips.selectPage();
- },
- delete: function () {
- var ids = units.getIdsBySelections();
- if (ids.length === 0) {
- layer.alert('请先选择您所要操作的对象', {icon: 0});
- return;
- }
- layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
- layer.close(index);
- tips.ajax({url: '/admin/links', type: 'delete', data: {ids: ids}, tableRefresh: '#table'});
- });
- },
- exportExcel: function () {
- var formValues = tips.getFormValues("#searchForm");
- var str = $.param(formValues);
- window.open('/admin/link/externalChainLibraryExport?' + str)
- },
- import: 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.fileUploadExl()">上传</button></div>' +
- '</div>' +
- ' <div class="form-group">' +
- '<div class="col-sm-6 col-sm-offset-3">' +
- '<a href="{{asset('tpl/outer_chain.xls')}}">请下载导入模板</a>' +
- '</div>' +
- '</div>' +
- '</form>' +
- '</div>';
- openIndex = layer.open({
- type: 1,
- content: str,
- area: ['60%', '30%'],
- title: '导入关键词'
- });
- },
- fileUploadExl: function () {
- var config = {
- url: '/admin/tool/excel-upload'
- };
- config.success = function (result) {
- var data = {excel_path: result.data.file_url};
- var config = {
- url: '/admin/link/externalChainLibraryImport',
- type: 'post',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- layer.close(openIndex);
- window.location.reload();
- });
- }
- };
- tips.ajax(config);
- };
- tips.fileUpload($("#excel_file"), config);
- },
- };
- var config = {};
- config.url = '/admin/links';
- config.columns = [ //字段
- {checkbox: true},
- {
- title: '序号', align: 'center', formatter: function (value, item, index) {
- return index + 1;
- }
- },
- {title: '外链类型', field: 'typeTitle', align: 'center'},
- {title: '标签', field: 'tag', align: 'center'},
- {title: '平台链接', field: 'url', align: 'center'},
- {title: '行业', field: 'business', align: 'center'},
- {title: 'Authority Score', field: 'authority_score', align: 'center'},
- {title: 'Spam Score', field: 'spam_score', align: 'center'},
- {title: '锚文本', field: 'bigBall', align: 'center'},
- {title: '备注', field: 'remark', align: 'center'},
- {title: '创建时间', field: 'created_at', align: 'center'},
- {
- title: '操作', field: 'id', align: 'center',
- formatter: function (value, row) {
- var str = '';
- // if (row.status === 1) {
- str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';
- // }
- return str;
- }
- }
- ];
- tips.bootstrapTable(config);
- </script>
- @endsection
|