| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456 | @extends('admin/site/side_layout')@section('header_extend')    <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">    <style>        h1 {            color: #0d8ddb        }    </style>@endsection@section('right')    <div class="ibox-content" id="passTpl" style="display: none">        <form class="form-horizontal">            <div class="form-group">                <div class="col-sm-12">                    <select class="form-control" name="passScore">                        <option value="1">1分</option>                        <option value="2">2分</option>                        <option value="3">3分</option>                        <option value="4">4分</option>                        <option value="5" selected>5分</option>                    </select>                </div>            </div>        </form>    </div>    @php $hasEdit=0; @endphp    <form class="row" id="searchForm">        @hasAuth('sites-articles-edit')        @php $hasEdit=1; @endphp        <div class="col-md-6">            <div class="input-group">               <span class="input-group-btn">                  @php                      $siteRecord=\App\Http\Models\Site::query()->select(['contract_ids'])->find($siteId);                      $hasContractIds=$siteRecord->contract_ids??[];                  @endphp                   @if(in_array("1",$hasContractIds))                       <button type="button" class="btn btn-md btn-info"                               onclick="units.syncSite()">                       <span class="glyphicon glyphicon-hand-up"></span> 同步到站点                   </button>                   @endif                   {{--<button type="button" class="btn btn-md btn-info"--}}                   {{--onclick="units.syncSocial()" style="margin-left: 10px">--}}                   {{--<span class="glyphicon glyphicon-hand-up"></span> 同步到社交--}}                   {{--</button>--}}                   <button type="button" class="btn btn-md btn-warning"                           onclick="units.pass()"                           style="margin-left: 10px">                       <span class="glyphicon glyphicon-hand-down"></span> 审核通过                   </button>                   <button type="button" class="btn btn-md btn-primary"                           onclick="units.save(0)" style="margin-left: 10px">                       <span class="glyphicon glyphicon-plus"></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-success"                          onclick="units.isPublished()" style="margin-left: 10px"> 已发布                   </button>                    <button type="button" class="btn btn-md btn-danger"                            onclick="units.update()" style="margin-left: 10px">                        <span class="glyphicon glyphicon-remove"></span> 未使用                   </button>                   <button type="button" class="btn btn-md btn-success"                           onclick="units.push()" style="margin-left: 10px"> 软文推送                    </button>                   <button type="button" class="btn btn-md btn-danger"                           onclick="units.show()" id="bzx" style="margin-left: 10px">备注                    </button>                    <button type="button" class="btn btn-md btn-success"                            onclick="units.export()" style="margin-left: 10px">导出软文                    </button>               </span>            </div>            <div class="toggle-x-box" style="display: none;margin-top: 40px;">                <div>                    <div style="float: left;width: 140px">                        <div>                            是否客户审核:                            <input type="checkbox" id="article_custom_audit" value="" style="margin-right: 10px"                                   @if(!empty($siteInFo->article_custom_audit)) checked @endif>                        </div>                        <div>                            是否上传缩略图:                            <input type="checkbox" id="is_upload_thumb" value="" style="margin-right: 10px"                                   @if(!empty($siteInFo->is_upload_thumb)) checked @endif>                        </div>                    </div>                    <div style="float: left;width: calc(100% - 140px)">                        文章同步目录:                        <textarea id="article_remark" class="form-control"                                  rows="3">{{$siteInFo->article_remark??''}}</textarea>                    </div>                    <div style="clear:both"></div>                </div>                <div style="padding-top: 10px">                    兼职备注:<textarea class="form-control" rows="3"                                   id="article_pt_remark">{{$siteInFo->article_pt_remark??''}}</textarea>                    {{-- <div style="padding-top: 6px">                         本月需更新数:<input class="form-control" type="number" value="{{$siteInFo->article_need_num??''}}"                                       id="article_need_num" style="width: 120px;display: inline-block"/>                     </div>--}}                </div>                <div>                    站外更新平台:<textarea class="form-control" rows="3"                                     id="outside_update_platform">{{$siteInFo->outside_update_platform??''}}</textarea>                    <button type="button" class="btn btn-success" onclick="units.saveInfo()" style="margin-top: 5px">保存                    </button>                </div>            </div>            <br>            <br>        </div>        @endHasAuth    </form>    <p id="mouseout">合同数:{{$site->article_goal??0}} 总数:{{$count}} 待更新:{{$pendingUpgrade}} 本月更新:{{$thisMonthUpgrade}}        每月更新数:<input            type="text"            style="width: 40px"            id="articles_updates_per_month"            name="articles_updates_per_month"            value="{{$site->articles_updates_per_month??4}}">        续费篇数:<input            type="text"            style="width: 40px"            id="article_renewal_quantity"            name="article_renewal_quantity"            value="{{$site->article_renewal_quantity??0}}">        续费次数:{{$site->renewal_times??0}}          <button id="articlesUpdates">保存</button>        <input type="checkbox" id="article_pause" name="article_pause"               class="js-switch"               @if($site->article_pause??0) checked @endif onchange="units.articlePause()"> 暂停    </p>    <hr>    <div class="table-responsive">        <table id="table" class="table table-condensed"               data-mobile-responsive="true"></table>    </div>@endsection@section('footer_extend')    <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>    <script>        var checkbox = document.querySelector(".js-switch");        new Switchery(checkbox, {color: "#1AB394", size: 'small'});        $("#articlesUpdates").click(function () {            var articlesUpdatesPerMonth = $('#articles_updates_per_month').val();            var article_renewal_quantity = $('#article_renewal_quantity').val();            var ajaxConfig = {                url: '/admin/articles-updates-per-month',                type: 'put',                data: {                    siteId: "{{$siteId}}",                    articlesUpdatesPerMonth: articlesUpdatesPerMonth,                    article_renewal_quantity: article_renewal_quantity                },                success: function (result) {                    layer.msg(result.message, {icon: 6, time: 1000}, function () {                    });                }            };            tips.ajax(ajaxConfig);        });        $('#bzx').click(function () {            $('.toggle-x-box').toggle();        });        var units = {            articlePause: function () {                var isChecked = checkbox.checked ? 1 : 0;                var ajaxConfig = {                    url: '/admin/sites/' + "{{$siteId}}" + '/article-pause-status',                    type: 'put',                    data: {status: isChecked},                    success: function () {                    }                };                tips.ajax(ajaxConfig);            },            search: function () {                tips.selectPage();            },            getIdsBySelections: function () {                var selections = $("#table").bootstrapTable('getSelections');                var ids = [];                $.each(selections, function (inx, val) {                    ids.push(val.id);                });                return ids;            },            detail: function (id) {                layer.open({                    type: 2,                    content: ['/admin/articles-detail/' + id + '?referer=sites'],                    area: ['100%', '100%'],                    title: '',                    closeBtn: 0                });            },            pass: function () {                var ids = units.getIdsBySelections();                if (ids.length === 0) {                    layer.alert('请先选择您所要操作的对象', {icon: 0});                    return;                }                layer.open({                    shade: 0,                    type: 1,                    content: $('#passTpl'),                    title: '审核通过',                    area: ['400px', '200px'],                    btn: ['确认', '取消'],                    yes: function (index, layero) {                        var passScore = $(layero).find("[name=passScore]").val();                        var ajaxConfig = {                            url: '/admin/articles/pass',                            type: 'put',                            data: {ids: ids, passScore: passScore},                            success: function (result) {                                layer.msg(result.message, {icon: 6, time: 1000}, function () {                                    tips.tableRefresh();                                });                            }                        };                        tips.ajax(ajaxConfig);                    }                });                // layer.confirm('您确定要审核通过吗?', {icon: 3, title: '审核操作'}, function () {                //     var ajaxConfig = {                //         url: '/admin/articles/pass',                //         type: 'put',                //         data: {ids: ids},                //         success: function (result) {                //             layer.msg(result.message, {icon: 6, time: 1000}, function () {                //                 tips.tableRefresh();                //             });                //         }                //     };                //     tips.ajax(ajaxConfig);                // });            },            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/articles',                        type: 'delete',                        data: {ids: ids},                        tableRefresh: '#table'                    });                });            },            update: 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/articles-batchUpdate',                        type: 'put',                        data: {ids: ids},                        tableRefresh: '#table'                    });                });            },            push: function () {                layer.confirm('您确定要推送给用户吗?', {icon: 3, title: '推送至app'}, function (index, layero) {                    layer.close(index);                    tips.ajax({                        url: '/admin/articles-push',                        type: 'put',                        data: {siteId: "{{$siteId}}"},                        tableRefresh: '#table'                    });                });            },            isPublished: 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/articles-published',                        type: 'put',                        data: {ids: ids},                        tableRefresh: '#table'                    });                });            },            syncSite: function () {                var ids = units.getIdsBySelections();                if (ids.length === 0) {                    layer.alert('请先选择您所要操作的对象', {icon: 0});                    return;                }                var param = '?';                $.each(ids, function (inx, val) {                    param += 'articleIds[]=' + val + '&'                });                layer.open({                    type: 2,                    content: ['/admin/sites/{{$siteId}}/articles-sync' + param],                    area: ['100%', '100%'],                    title: '',                    closeBtn: 0                });            },            save: function (id) {                var url = '/admin/articles/' + id + '?siteId={{$siteId}}';                layer.open({                    type: 2,                    content: [url],                    area: ['100%', '100%'],                    title: '',                    closeBtn: 0                });            },            syncSocial: function () {                var ids = units.getIdsBySelections();                if (ids.length === 0) {                    layer.alert('请先选择您所要操作的对象', {icon: 0});                    return;                }                layer.confirm('您确定要继续此操作吗?', {icon: 3, title: '社交同步'}, function () {                    var ajaxConfig = {                        url: '/admin/articles/social-sync',                        type: 'post',                        data: {ids: ids},                        success: function (result) {                            layer.msg(result.message, {icon: 6, time: 1000}, function () {                                tips.tableRefresh();                            });                        }                    };                    tips.ajax(ajaxConfig);                });            },            export: function () {                var ids = units.getIdsBySelections();                window.open('/admin/articles/export/{{$siteId}}?ids=' + ids);            },            saveInfo: function () {                var article_custom_audit = $("#article_custom_audit").prop('checked');                var is_upload_thumb = $("#is_upload_thumb").prop('checked');                var article_remark = $("#article_remark").val();                var article_pt_remark = $("#article_pt_remark").val();                var outside_update_platform = $("#outside_update_platform").val();                var article_need_num = $("#article_need_num").val();                var ajaxConfig = {                    url: '/admin/articles/info-save',                    type: 'post',                    data: {                        is_upload_thumb: is_upload_thumb,                        article_custom_audit: article_custom_audit,                        article_remark: article_remark,                        article_pt_remark: article_pt_remark,                        outside_update_platform: outside_update_platform,                        article_need_num: article_need_num,                        siteId: "{{$siteId}}"                    },                    success: function (result) {                        layer.msg(result.message, {icon: 6, time: 1000}, function () {                        });                    }                };                tips.ajax(ajaxConfig);            }        };        var config = {};        config.url = '/admin/sites/' + "{{$siteId}}" + '/articles';        config.columns = [ //字段            {checkbox: true},            {title: '编号', field: 'id', align: 'center'},            {                title: '标题', field: 'title', align: 'center',                formatter: function (value, row) {                    return '<a href="javascript:;" onclick="units.detail(' + row.id + ')">' + value + '</a>'                }            },            {title: '质量分', field: 'pass_score', align: 'center'},            {title: '翻译人员', field: 'translator_name', align: 'center'},            {title: '审核人员', field: 'auditor_name', align: 'center'},            {title: '已翻词数', field: 'translate_words', align: 'center'},            {title: '状态', field: 'status_title', align: 'center'},            {title: '同步时间', field: 'sync_at', align: 'center', sortable: true},            {title: '发布时间', field: 'publish_at', align: 'center', sortable: true},            {title: '创建时间', field: 'created_at', align: 'center', sortable: true},            {                title: '操作', field: 'id', align: 'center',                formatter: function (value) {                    var str = '';                    @if ($hasEdit)                        str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button> ';                    return str;                    @endif                }            }        ];        tips.bootstrapTable(config);    </script>@endsection
 |