123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
- @extends('admin/layout')
- @section('header')
- <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
- <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
- <style>
- .selectedTable {
- }
- .selectedTable td {
- border: 1px solid #E3E3E3;
- padding: 6px 18px;
- }
- </style>
- @endsection
- @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="form-horizontal" id="form">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="site_id"><span
- class="red">* </span>站点:</label>
- <div class="col-sm-8 ">
- <select data-placeholder="选择站点..." class="chosen-select" style="width:350px; "
- id="site_id" name="site_id" onchange="units.renderOptimizePage(this)">
- <option value="">请选择站点</option>
- @foreach ($sites as $site)
- <option value="{{$site->id}}"
- @if(($data->site_id??null)==$site->id) selected @endif
- @if($siteId==$site->id) selected @endif>
- {{$site->cn_title}}
- </option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="worker_id">指派:</label>
- <div class="col-sm-8 ">
- <select data-placeholder="选择站点..." class="chosen-select" style="width:350px; "
- id="worker_id" name="worker_id">
- <option value="">请选择兼职人员</option>
- @foreach ($workers as $item)
- <option value="{{$item->id}}"
- @if(($data->worker_id??null)==$item->id) selected @endif>{{$item->username}}</option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="title"><span class="red">* </span>标题:</label>
- <div class="col-sm-8">
- <input type="text" class="form-control" id="title" name="title"
- value="{{$data->title??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="link_ids"><span
- class="red">* </span>外链种类:</label>
- <div class="col-sm-2 ">
- <button type="button" class="btn btn-warning" onclick="units.choseLinkType()">选择平台
- </button>
- <input type="hidden" id="link_ids" value="{{$linkIdsStr}}">
- <input type="hidden" id="link_ids_with_time">
- </div>
- <div class="col-sm-3">
- <table class="selectedTable">
- <thead>
- <tr>
- <td>时间</td>
- <td>外链平台</td>
- </tr>
- </thead>
- <tbody id="linkTableBody">
- @foreach($selectedLinkTypeList as $item)
- <tr>
- <td>无</td>
- <td>【{{$typeList[$item->type]??''}}】{{$item->url}}</td>
- </tr>
- @endforeach
- </tbody>
- </table>
- </div>
- <div class="col-sm-2">
- @php $optimizePageIds=json_decode($data->optimize_page_ids??"[]",true); @endphp
- <select name="optimizePage" id="optimizePage" class="form-control" multiple>
- @foreach($optimizePageList as $page)
- <option value="{{$page['id']}}"
- @if(in_array($page['id'],$optimizePageIds)) selected @endif>
- 【{{$page['keyword']}}】{{$page['url']}}</option>
- @endforeach
- </select>
- ctrl+鼠标选中
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="link_review_at"><span class="red">* </span>
- 链接审核时间:</label>
- <div class="col-sm-6">
- <input type="text" style="width: 200px" class="form-control my-date deadline"
- name="link_review_at" id="link_review_at"
- value="{{$data->link_review_at??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="demand">要求:</label>
- <div class="col-sm-8">
- <!-- 编辑器容器 -->
- <script id="demand" name="demand"
- type="text/plain">{!! $data->demand??'' !!}</script>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="release_at"><span
- class="red"></span>发布时间:</label>
- <div class="col-sm-8">
- <input type="text" class="form-control my-date deadline" id="audit_at"
- name="release_at"
- value="{{$data->release_at??''}}">
- </div>
- </div>
- <div class="hr-line-dashed"></div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- {{--待分配 任务中--}}
- @if(!$data|| in_array($data->status,[1,2]))
- <button class="btn btn-primary" type="button"
- onclick="units.save({{$data->id??0}})">
- 保存
- </button>
- @endif
- <button class="btn btn-white closeLayer" type="button">取消</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- @endsection
- @section('footer')
- @include('vendor.ueditor.assets')
- <script src="{{asset('js/plugins/chosen/chosen.jquery.js')}}"></script>
- <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
- <script>
- //同时绑定多个
- lay('.deadline').each(function () {
- laydate.render({
- elem: this
- , trigger: 'click',
- type: 'datetime'
- });
- });
- var ue = UE.getEditor('demand');
- ue.ready(function () {
- ue.setHeight(300);
- ue.execCommand('serverparam', '_token', '{{ csrf_token() }}'); // 设置 CSRF token.
- {{--ue.setContent("{!! $data->content??'' !!}");--}}
- });
- var config = {".chosen-select": {}};
- for (var selector in config) $(selector).chosen(config[selector]);
- var units = {
- renderOptimizePage: function (_this) {
- var checkVal = $(_this).val();
- if (checkVal != "") {
- var ajaxConfig = {
- url: '/admin/link/task/optimizePage?siteId=' + checkVal,
- type: 'GET',
- success: function (result) {
- var str = '';
- $.each(result.data, function (inx, data) {
- str += '<option value="' + data.id + '">' + data.keyword + '[' + data.url + ']' + '</option>';
- });
- console.log(result.data);
- $("#optimizePage").append(str);
- }
- };
- tips.ajax(ajaxConfig);
- } else {
- $("#optimizePage").html('');
- }
- },
- save: function (id) {
- var url = '/admin/link/task/' + id + '/save';
- var task = tips.getFormValues('#form');
- task.optimize_page_ids = $("#optimizePage").val();
- var link_ids_str = $("#link_ids").val();
- var link_ids_with_time_str = $("#link_ids_with_time").val();
- var linkIds, linkIdsWithTime = null;
- if (!link_ids_str && !link_ids_with_time_str) {
- layer.alert('请先选择外链种类', {icon: 3});
- return;
- }
- if (link_ids_str) {
- linkIds = JSON.parse(link_ids_str);
- }
- if (link_ids_with_time_str) {
- linkIdsWithTime = JSON.parse(link_ids_with_time_str);
- }
- var ajaxConfig = {
- url: url,
- type: 'put',
- data: {task: task, link: {link_ids: linkIds, link_ids_with_time: linkIdsWithTime}},
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1000}, function () {
- tips.closeParentLayer();
- window.parent.tips.tableRefresh('#table');
- });
- }
- };
- tips.ajax(ajaxConfig);
- },
- choseLinkType: function () {
- var siteId = $("#site_id").val();
- var linkIdsValArr;
- var linkIdsVal = $("#link_ids").val();
- if (linkIdsVal) {
- linkIdsValArr = JSON.parse(linkIdsVal);
- } else {
- linkIdsValArr = [];
- }
- var linkIds = '';
- $.each(linkIdsValArr, function (inx, val) {
- linkIds += 'linkIds[]=' + val + '&';
- });
- layer.open({
- type: 2,
- content: ['/admin/link/chose/' + "{{$data->id??0}}?siteId=" + siteId + "&" + linkIds],
- area: ['80%', '100%'],
- btn: ['确认', '取消'],
- title: '选择外链库',
- yes: function (index, layero) {
- var son = $(layero).find('iframe')[0].contentWindow;
- //包括时间的数据
- var withData = $(son.document.body).find("#choseData").val();
- if (withData != "") { //如果是包括时间不为空
- try {
- var withDataObj = JSON.parse(withData);
- $("#link_ids_with_time").val(withData);
- $("#linkTableBody").html('');
- $.each(withDataObj, function (inx, data) {
- $.each(data.selectItems, function (key, items) {
- $("#linkTableBody").append('<tr><td>' + data.release_at + '</td><td>【' + items.type + '】' + items.url + '</td></tr>');
- })
- });
- } catch (e) {
- layer.alert("脚本执行失败");
- return;
- }
- } else {
- var choseCheckBox = [], directChoseItems = [];
- $(son.document.body).find(".ibox-content").find("[name=linkIds]input:checked").each(function () {
- choseCheckBox.push($(this).val());
- directChoseItems.push({type: $(this).data('type'), url: $(this).data('url')})
- });
- $("#linkTableBody").html('');
- $.each(directChoseItems, function (inx, data) {
- $("#linkTableBody").append('<tr><td>无</td><td>【' + data.type + '】' + data.url + '</td></tr>');
- });
- $("#link_ids").val(JSON.stringify(choseCheckBox));
- }
- layer.close(index)
- }
- });
- }
- };
- </script>
- @endsection
|