123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- @extends('admin/layout')
- @section('header')
- <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
- @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-title">
- <h5>站点软文同步
- {{--<small>包括自定义样式的复选和单选按钮</small>--}}
- </h5>
- <div class="ibox-tools">
- <a class="collapse-link">
- <i class="fa fa-chevron-up"></i>
- </a>
- <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
- <i class="fa fa-wrench"></i>
- </a>
- <ul class="dropdown-menu dropdown-user">
- <li><a href="form_basic.html#">选项1</a>
- </li>
- <li><a href="form_basic.html#">选项2</a>
- </li>
- </ul>
- <a class="close-link">
- <i class="fa fa-times"></i>
- </a>
- </div>
- </div>
- <div class="ibox-content">
- <form class="form-horizontal" id="form">
- <div class="form-group">
- <label class="col-sm-2 control-label">同步文章:</label>
- <div class="col-sm-6">
- @foreach($articles as $item)
- <label class="form-control">{{$item->title}}</label>
- <input type="hidden" name="articleIds" value="{{$item->id}}">
- @endforeach
- {{--<div class="input-group m-b">--}}
- {{--<input type="text" class="form-control"> <span--}}
- {{--class="input-group-addon">.00</span>--}}
- {{--</div>--}}
- {{--<div class="input-group m-b"><span class="input-group-addon">¥</span>--}}
- {{--<input type="text" class="form-control"> <span--}}
- {{--class="input-group-addon">.00</span>--}}
- {{--</div>--}}
- {{--<div class="input-group m-b"><span class="input-group-addon"> <input--}}
- {{--type="checkbox"> </span>--}}
- {{--<input type="text" class="form-control">--}}
- {{--</div>--}}
- {{--<div class="input-group"><span class="input-group-addon"> <input--}}
- {{--type="radio"> </span>--}}
- {{--<input type="text" class="form-control">--}}
- {{--</div>--}}
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="remoteContent">同步至:</label>
- <div class="col-sm-6">
- <select class="form-control m-b" name="remote_content_id" id="remoteContent"
- onchange="units.select(this)">
- <option value="">请选择</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="template_id">页面模板:</label>
- <div class="col-sm-6">
- <select class="form-control m-b" name="template_id" id="template_id">
- <option value="">请选择模板</option>
- @foreach($removeTemplate as $item)
- <option
- value="{{$item['id']}}">{{$item['name'].'('.$item['alias'].')'}}</option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="hr-line-dashed"></div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="release_at">发布日期:</label>
- <div class="col-sm-6">
- <div class="input-group m-b">
- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
- <input type="text" class="form-control" id="release_at" name="release_at">
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="release_interval">发布间隔:</label>
- <div class="col-sm-2">
- <div class="input-group m-b">
- <input type="text" class="form-control" name="release_interval"
- id="release_interval">
- <span class="input-group-addon">天</span>
- </div>
- </div>
- </div>
- <div class="hr-line-dashed"></div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- <button class="btn btn-primary" type="button" onclick="units.sync()">开始同步</button>
- <button class="btn btn-white closeLayer" type="submit">关闭页面</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- @endsection
- @section('footer')
- <script src="{{asset('js/plugins/chosen/chosen.jquery.js')}}"></script>
- <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
- <script src="https://cdn.bootcss.com/lodash.js/4.17.10/lodash.core.min.js"></script>
- <script>
- var remoteContent =@json($remoteContent);
- $(function () {
- // remoteContent = JSON.parse(remoteContent);
- var initRemoveContent = _.filter(remoteContent, {parent_id: "0"});
- var rc = $("#remoteContent");
- $.each(initRemoveContent, function (inx, val) {
- rc.append("<option value='" + val.id + "'>" + val.name + "</option>");
- });
- // rc.chosen({});
- });
- var units = {
- save: function (id) {
- var url = '/admin/articles/' + id;
- var data = tips.getFormValues('#form');
- var ajaxConfig = {
- url: url,
- type: 'put',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1000}, function () {
- tips.closeParentLayer();
- window.parent.tips.tableRefresh('#table');
- });
- }
- };
- tips.ajax(ajaxConfig);
- },
- select: function (_this) {
- $(_this).nextAll().remove();
- var subContent = _.filter(remoteContent, {parent_id: $(_this).val()});
- if (subContent.length !== 0) {
- var head = '<select class="form-control m-b chosen-select" name="remote_content_id" onchange="units.select(this)"><option value="">请选择</option>';
- $.each(subContent, function (inx, val) {
- head += '<option value="' + val.id + '">' + val.name + '</option>';
- });
- var foot = '</select>';
- $(_this).after(head + foot);
- // $(_this).next().chosen({});
- }
- },
- sync: function () {
- var article_ids = [];
- $("[name=articleIds]").each(function () {
- article_ids.push($(this).val());
- });
- var remote_content_id = '';
- $("[name=remote_content_id]").each(function () {
- if ($(this).val()) {
- remote_content_id = $(this).val()
- }
- });
- var data = tips.getFormValues('#form');
- data.article_ids = article_ids;
- data.remote_content_id = remote_content_id;
- var ajaxConfig = {
- url: '/admin/sites/{{$siteId}}/articles-sync',
- type: 'put',
- data: data
- };
- tips.ajax(ajaxConfig);
- }
- };
- laydate.render({
- elem: '#release_at', //指定元素
- type: 'datetime'
- });
- </script>
- @endsection
|