123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- @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">
- @endsection
- @section('content')
- <style type="text/css">
- .radio-label,
- .radio-check {
- display: inline-block;
- position: relative;
- }
- .radio-label input[type="checkbox"] {
- appearance: none; /*清楚默认样式*/
- -webkit-appearance: none;
- /* opacity: 0; */
- outline: none;
- position: absolute;
- z-index: 2;
- width: 6px;
- height: 6px;
- top: 10px;
- left: 10px;
- border-radius: 50%;
- background: #b4b4b4;
- }
- .radio-label label {
- display: inline-block;
- min-width: 50px;
- height: 24px;
- line-height: 24px;
- text-align: center;
- padding-right: 10px;
- border-radius: 5px;
- padding-left: 25px;
- color: #fff;
- background-color: #c9c9c9;
- }
- .radio-label input[type="checkbox"]:checked {
- opacity: 0;
- }
- .radio-label input[type="checkbox"]:checked + label {
- color: #fff;
- background-color: #3597db;
- }
- .radio-label input[type="checkbox"]:checked + label::after {
- content: "";
- position: absolute;
- left: 12px;
- top: 5px;
- width: 5px;
- height: 12px;
- border-right: 1px solid #fff;
- border-bottom: 1px solid #fff;
- transform: rotate(45deg);
- }
- </style>
- <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 method="get" class="form-horizontal" id="form">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="url"><span class="red">* </span>地址:</label>
- <div class="col-sm-8 ">
- <input type="text" class="form-control" id="url" name="url"
- value="{{$data->url??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="thumb">缩略图:</label>
- <div class="col-sm-8">
- <button type="button" class="btn btn-primary" onclick="units.triggerFile(this)">
- 缩略图上传
- </button>
- <input type="file" value="" style="display: none" name="uploadFile"
- onchange="units.fileUpload(this)">
- <input type="hidden" id="media" name="media" value="{{$data->media??''}}">
- </div>
- </div>
- <div class="form-group" @if (empty($data->media))style="display: none"
- @endif id="thumb_div">
- <div class="col-sm-8 col-sm-offset-2">
- <img style="height: 100px" src="{{$data->media??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="content"><span
- class="red">* </span>内容:</label>
- <div class="col-sm-8 ">
- <textarea name="content" id="content" rows="10"
- class="form-control">{{$data->content??''}}</textarea>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="publish_at"><span class="red">* </span>发布时间:</label>
- <div class="col-sm-4">
- <input type="text" class="form-control" id="publish_at" name="publish_at"
- value="{{$data->publish_at??''}}">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="publish_at"><span class="red">* </span>发布间隔:</label>
- <div class="col-sm-4">
- <input type="text" class="form-control" name="release_interval"
- id="release_interval" style="display: inline-block;width: 90%;"> 天
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="publish_at"><span
- class="red">* </span>关键词:</label>
- <div class="col-sm-8">
- @foreach($labelList as $key=>$value)
- <div class="radio-label">
- <input class="checkbox-class" type="checkbox" id="color3_{{$key}}"
- name="color_{{$key}}"
- onclick="units.checkboxOnclick({{$key}})" data-key="{{$value}}"
- value="{{$key}}">
- <label for="color3_{{$key}}">{{$value}}</label>
- </div>
- @endforeach
- <button type="button" class="btn btn-md btn-primary"
- onclick="units.import()" style="margin-left: 10px">
- 导入标签词
- </button>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="publish_at"><span
- class="red">* </span>社交账号类型:</label>
- <div class="col-sm-8">
- <select name="social_ids" class="form-control" multiple>
- @foreach($socialProfiles as $item)
- <option value="{{$item['id']}}">{{$item['type']}}
- -{{$item['socialNetworkUsername']}}</option>
- @endforeach
- </select>
- </div>
- </div>
- {{-- @php
- $result=$data->result??[];
- $resultStatus=$data->result_status??[];
- $errMap=$data->err??[];
- @endphp--}}
- {{-- <div class="form-group">
- <label class="col-sm-2 control-label" for="publish_at">发布结果:</label>
- <div class="col-sm-8 ">
- <span>{{implode(',',$errMap)}}</span>
- --}}{{-- <div><label>facebook:</label>
- <span>{{\App\Http\Models\SocialPublish::STATUS_TITLE[($resultStatus['facebook']??null)]??''}}</span>
- </div>
- <div><label>twitter:</label>
- <span>{{\App\Http\Models\SocialPublish::STATUS_TITLE[($resultStatus['twitter']??null)]??''}}</span>
- </div>
- <div><label>pinterest:</label>
- <span>{{\App\Http\Models\SocialPublish::STATUS_TITLE[($resultStatus['pin']??null)]??''}}</span>
- </div>
- <div><label>linkedIn:</label>
- <span>{{\App\Http\Models\SocialPublish::STATUS_TITLE[($resultStatus['linkedIn']??null)]??''}}</span>
- </div>--}}{{--
- </div>
- </div>--}}
- {{-- <div class="form-group">
- <label class="col-sm-2 control-label" for="publish_at">错误信息:</label>
- <div class="col-sm-8 ">
- <span>{{implode(',',$errMap)}}</span>
- </div>
- </div>--}}
- <div class="hr-line-dashed"></div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- @if(!$data)
- <button class="btn btn-primary" type="button"
- onclick="units.save()">
- 保存
- </button>
- @endif
- <button class="btn btn-white closeLayer" type="button">取消</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- @endsection
- @section('footer')
- <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
- <script>
- laydate.render({
- elem: '#publish_at', //指定元素
- type: 'datetime'
- });
- var units = {
- checkboxOnclick: function (id) {
- var ids = "#color3_" + id;
- var label = ' #' + $(ids).data('key');
- var summary = $("#content").val();
- if ($(ids).is(':checked')) {
- $("#content").val(summary + label);
- } else {
- $("#content").val($("#content").val().replace(label, ''))
- }
- },
- 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/social_tag.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, siteId: "{{$siteId}}"};
- var config = {
- url: '/admin/sites/' + {{$siteId}} +'/social-template-import',
- 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);
- },
- save: function () {
- var checkbox = [];
- $(".checkbox-class").each(function () {
- if ($("#color3_" + $(this).val()).is(':checked')) {
- checkbox.push($(this).val())
- }
- });
- var data = tips.getFormValues("#form");
- data.label_ids = checkbox;
- data.social_ids = $("[name=social_ids]").val();
- var ajaxConfig = {
- url: '/admin/sites/social-queue/{{$data->id??0}}?siteId={{$siteId}}',
- type: 'post',
- data: data,
- success: function (result) {
- layer.msg(result.message, {icon: 6, time: 1500}, function () {
- window.parent.tips.tableRefresh('#table');
- tips.closeParentLayer();
- });
- }
- };
- tips.ajax(ajaxConfig);
- },
- triggerFile: function (_this) { //文件上传
- $(_this).next().trigger('click');
- },
- fileUpload: function (_this) {
- var config = {
- url: '/admin/tool/upload'
- };
- config.success = function (result) {
- console.log(result);
- var data = result.data;
- var thumbDiv = $("#thumb_div");
- thumbDiv.css('display', '');
- thumbDiv.find("img").attr('src', data.file_url);
- $("#media").val(data.file_url);
- };
- tips.fileUpload(_this, config);
- }
- };
- </script>
- @endsection
|