social_publish.blade.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. <link rel="stylesheet" href="{{asset('js/plugins/zTree_v3-master/css/zTreeStyle/zTreeStyle.css')}}">
  4. <style type="text/css">
  5. .ztree li span.button.add {
  6. margin-left: 2px;
  7. margin-right: -1px;
  8. background-position: -144px 0;
  9. vertical-align: top;
  10. *vertical-align: middle
  11. }
  12. .ztree li span.button.reset {
  13. margin-right: 2px;
  14. background-position: -110px -48px;
  15. vertical-align: top;
  16. *vertical-align: middle
  17. }
  18. /* 喜欢的颜色 */
  19. .radio-label,
  20. .radio-check {
  21. display: inline-block;
  22. position: relative;
  23. }
  24. .radio-label input[type="checkbox"] {
  25. appearance: none; /*清楚默认样式*/
  26. -webkit-appearance: none;
  27. /* opacity: 0; */
  28. outline: none;
  29. position: absolute;
  30. z-index: 2;
  31. width: 6px;
  32. height: 6px;
  33. top: 10px;
  34. left: 10px;
  35. border-radius: 50%;
  36. background: #b4b4b4;
  37. }
  38. .radio-label label {
  39. display: inline-block;
  40. min-width: 50px;
  41. height: 24px;
  42. line-height: 24px;
  43. text-align: center;
  44. padding-right: 10px;
  45. border-radius: 5px;
  46. padding-left: 25px;
  47. color: #fff;
  48. background-color: #c9c9c9;
  49. }
  50. .radio-label input[type="checkbox"]:checked {
  51. opacity: 0;
  52. }
  53. .radio-label input[type="checkbox"]:checked + label {
  54. color: #fff;
  55. background-color: #3597db;
  56. }
  57. .radio-label input[type="checkbox"]:checked + label::after {
  58. content: "";
  59. position: absolute;
  60. left: 12px;
  61. top: 5px;
  62. width: 5px;
  63. height: 12px;
  64. border-right: 1px solid #fff;
  65. border-bottom: 1px solid #fff;
  66. transform: rotate(45deg);
  67. }
  68. </style>
  69. @endsection
  70. @section('right')
  71. <div class="row">
  72. <div class="col-sm-3">
  73. <div class="ibox float-e-margins">
  74. <div class="ibox-title">
  75. 平台页面
  76. </div>
  77. <div class="ibox-content">
  78. <ul id="treeDemo" class="ztree"></ul>
  79. </div>
  80. </div>
  81. </div>
  82. <div class="col-sm-9">
  83. <div class="ibox float-e-margins">
  84. <div class="ibox-title">概要
  85. {{--<button class="btn btn-info" type="button" style="float: right;margin: 0 5px;padding: 4px 12px"--}}
  86. {{--onclick="units.batchDelete()">删除--}}
  87. {{--</button>--}}
  88. {{--<button class="btn btn-info" type="button" style="float: right;margin: 0 5px;padding: 4px 12px"--}}
  89. {{--onclick="units.saveView(0)">添加--}}
  90. {{--</button>--}}
  91. </div>
  92. <div class="ibox-content">
  93. <form id="form">
  94. <div class="form-group">
  95. <label>主标题</label>
  96. <input type="text" placeholder="" class="form-control" id="title" name="title">
  97. <input type="hidden" name="titleId">
  98. </div>
  99. {{--<div class="form-group">--}}
  100. {{--<label>副标题</label>--}}
  101. {{--<input type="text" placeholder="" class="form-control" id="subtitle" name="subtitle">--}}
  102. {{--</div>--}}
  103. <div class="form-group">
  104. <label>uri地址</label>
  105. <input type="text" placeholder="" class="form-control" id="uri" name="uri">
  106. </div>
  107. <div class="form-group">
  108. <label>缩略图 </label>
  109. <img
  110. src="https://admin.yinqingli.com/storage/202011/jpg/I9LOpRKjyfwVgAgSXHddYrkcDjsBxwDkyR2n2lKZ.jpg"
  111. alt="" style="height: 100px" id="thumb">
  112. </div>
  113. <div class="form-group">
  114. <label>内容摘要</label>
  115. <textarea class="form-control" rows="5" placeholder="" id="summary"
  116. name="summary"></textarea>
  117. </div>
  118. {{-- <div class="radio-label">
  119. <input type="checkbox" id="color1" name="color">
  120. <label for="color1">蓝色</label>
  121. </div>
  122. <div class="radio-label">
  123. <input type="checkbox" id="color2" name="color">
  124. <label for="color2">红色22</label>
  125. </div>
  126. <div class="radio-label">
  127. <input type="checkbox" id="color3" name="color">
  128. <label for="color3">绿色333</label>
  129. </div>--}}
  130. @foreach($labelList as $key=>$value)
  131. <div class="radio-label">
  132. <input class="checkbox-class" type="checkbox" id="color3_{{$key}}" name="color_{{$key}}"
  133. onclick="units.checkboxOnclick({{$key}})" data-key="{{$value}}" value="{{$key}}">
  134. <label for="color3_{{$key}}">{{$value}}</label>
  135. </div>
  136. @endforeach
  137. <button type="button" class="btn btn-md btn-primary"
  138. onclick="units.import()" style="margin-left: 10px">
  139. 导入标签词
  140. </button>
  141. <button type="button" class="btn btn-md btn-success"
  142. onclick="units.publish(0)" style="margin-left: 10px">
  143. 自定义发布
  144. </button>
  145. <div class="hr-line-dashed"></div>
  146. <div class="form-group">
  147. <label>需填内容</label>
  148. </div>
  149. <div class="form-group">
  150. <label for="release_at">发布日期:</label>
  151. <div>
  152. <div class="input-group m-b">
  153. <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
  154. <input type="text" class="form-control" id="release_at" name="release_at">
  155. </div>
  156. </div>
  157. </div>
  158. <div class="form-group">
  159. <label for="release_interval">发布间隔:</label>
  160. <div>
  161. <div class="input-group m-b">
  162. <input type="text" class="form-control" name="release_interval"
  163. id="release_interval">
  164. <span class="input-group-addon">天</span>
  165. </div>
  166. </div>
  167. </div>
  168. <div>
  169. <label>社交账号类型</label>
  170. <div>
  171. <select name="social_ids" class="form-control" multiple>
  172. @foreach($socialProfiles as $item)
  173. <option value="{{$item['id']}}">{{$item['type']}}
  174. -{{$item['socialNetworkUsername']}}</option>
  175. @endforeach
  176. </select>
  177. </div>
  178. </div>
  179. {{--<div class="form-group">--}}
  180. {{--<label for="release_interval">linkedIn组织ID:</label>--}}
  181. {{--<div>--}}
  182. {{--<div class="input-group m-b">--}}
  183. {{--{{$linkedInOrgId}}--}}
  184. {{--</div>--}}
  185. {{--</div>--}}
  186. {{--</div>--}}
  187. {{--<div class="form-group">--}}
  188. {{--<label for="pin_board">pinterest board:</label>--}}
  189. {{--<div>--}}
  190. {{--<div class="input-group m-b">--}}
  191. {{--@if($boardsErr==null)--}}
  192. {{--<select name="pin_board" id="pin_board" class="form-control">--}}
  193. {{--<option value="">请选择board</option>--}}
  194. {{--@foreach($boards as $board)--}}
  195. {{--<option value="{{$board}}">{{$board}}</option>--}}
  196. {{--@endforeach--}}
  197. {{--</select>--}}
  198. {{--@else--}}
  199. {{--<input type="hidden" name="pin_board" id="pin_board" value="">--}}
  200. {{--{{$boardsErr}}--}}
  201. {{--@endif--}}
  202. {{--</div>--}}
  203. {{--</div>--}}
  204. {{--</div>--}}
  205. <button class="btn btn-info btn-sm" type="button" onclick="units.syncSocial()"
  206. style="margin-top: 5px">同步社交
  207. </button>
  208. </form>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. @endsection
  214. @section('footer_extend')
  215. <script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.core.min.js')}}"></script>
  216. {{--<script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.exedit.min.js')}}"></script>--}}
  217. <script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.excheck.min.js')}}"></script>
  218. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  219. <script>
  220. laydate.render({
  221. elem: '#release_at', //指定元素
  222. type: 'datetime'
  223. });
  224. var zTreeObj;
  225. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  226. var setting = {
  227. check: {
  228. enable: true,
  229. chkboxType: {"Y": "s", "N": "s"}
  230. },
  231. data: {
  232. simpleData: {
  233. enable: true
  234. }
  235. },
  236. callback: {
  237. onClick: function (event, treeId, treeNode) {
  238. // config.otherParams = {parentId: treeNode.id};
  239. console.log(treeNode);
  240. $("#title").val(treeNode.name);
  241. // $("#subtitle").val(treeNode.subtitle);
  242. if (treeNode.isParent === true || treeNode.parent_id === 0) {
  243. $("#summary").val(treeNode.summary + ' ' + "{{$site->webmaster_domain}}" + treeNode.uri + '/');
  244. } else {
  245. $("#summary").val(treeNode.summary + ' ' + "{{$site->webmaster_domain}}" + treeNode.uri + ".html");
  246. }
  247. $("#thumb").attr('src', '{{sprintf('http://%s',$site->domain)}}' + treeNode.thumb);
  248. $("#uri").val(treeNode.uri);
  249. // tips.tableRefresh();
  250. }
  251. }
  252. // edit: {
  253. // enable: true,
  254. // showRenameBtn: false,
  255. // showRemoveBtn: false
  256. // }
  257. // view: {
  258. // addHoverDom: units.addHoverDom,
  259. // removeHoverDom: function (treeId, treeNode) {
  260. // $("#addBtn_" + treeNode.tId).unbind().remove();
  261. // $("#resetBtn_" + treeNode.tId).unbind().remove();
  262. // },
  263. // selectedMulti: false
  264. // }
  265. };
  266. // zTree 的数据属性,深入使用请参考 API 文档(zTreeNode 节点数据详解)
  267. var trees = JSON.parse('{!! addslashes(json_encode($trees)) !!}');
  268. console.log(trees);
  269. $(document).ready(function () {
  270. zTreeObj = $.fn.zTree.init($("#treeDemo"), setting, trees);
  271. });
  272. var units = {
  273. checkboxOnclick: function (id) {
  274. var ids = "#color3_" + id;
  275. var label = ' #' + $(ids).data('key');
  276. var summary = $("#summary").val();
  277. if ($(ids).is(':checked')) {
  278. $("#summary").val(summary + label);
  279. } else {
  280. $("#summary").val($("#summary").val().replace(label, ''))
  281. }
  282. },
  283. import: function () {
  284. var str = '<div class="ibox-content" id="importLayer">' +
  285. '<form class="form-horizontal">' +
  286. '<div class="form-group">' +
  287. '<label class="col-sm-3 control-label">请选择excel文件:</label>' +
  288. '<div class="col-sm-6">' +
  289. '<input type="file" id="excel_file" class="form-control">' +
  290. '<input type="hidden" id="excel_path">' +
  291. '</div>' +
  292. '<div class="col-sm-2"><button class="btn btn-info" type="button" onclick="units.fileUpload()">上传</button></div>' +
  293. '</div>' +
  294. ' <div class="form-group">' +
  295. '<div class="col-sm-6 col-sm-offset-3">' +
  296. '<a href="{{asset('tpl/social_tag.xls')}}">请下载导入模板</a>' +
  297. '</div>' +
  298. '</div>' +
  299. '</form>' +
  300. '</div>';
  301. openIndex = layer.open({
  302. type: 1,
  303. content: str,
  304. area: ['60%', '30%'],
  305. title: '导入关键词'
  306. });
  307. },
  308. publish: function (id) {
  309. var url = '/admin/sites/social-queue/' + id + '?siteId={{$siteId}}';
  310. layer.open({
  311. type: 2,
  312. content: url,
  313. area: ['70%', '90%'],
  314. title: '保存'
  315. });
  316. },
  317. fileUpload: function () {
  318. var config = {
  319. url: '/admin/tool/excel-upload'
  320. };
  321. config.success = function (result) {
  322. var data = {excel_path: result.data.file_url, siteId: "{{$siteId}}"};
  323. var config = {
  324. url: '/admin/sites/' + {{$siteId}} +'/social-template-import',
  325. type: 'post',
  326. data: data,
  327. success: function (result) {
  328. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  329. layer.close(openIndex);
  330. window.location.reload();
  331. });
  332. }
  333. };
  334. tips.ajax(config);
  335. };
  336. tips.fileUpload($("#excel_file"), config);
  337. },
  338. syncSocial: function () {
  339. {{--var data = tips.getFormValues('#form');--}}
  340. {{--data.thumb = $("#thumb").attr('src');--}}
  341. {{--var ajaxConfig = {--}}
  342. {{--url: '/admin/sites/' + {{$siteId}} +'/social-publish',--}}
  343. {{--type: 'post',--}}
  344. {{--data: data--}}
  345. {{--};--}}
  346. {{--tips.ajax(ajaxConfig);--}}
  347. var checkedNodes = zTreeObj.getCheckedNodes();
  348. var nodeIds = [];
  349. $.each(checkedNodes, function (inx, val) {
  350. nodeIds.push(val.id);
  351. });
  352. var checkbox = [];
  353. $(".checkbox-class").each(function () {
  354. if ($("#color3_" + $(this).val()).is(':checked')) {
  355. checkbox.push($(this).val())
  356. }
  357. });
  358. var ajaxConfig = {
  359. url: '/admin/sites/' + {{$siteId}} +'/social-publish',
  360. type: 'post',
  361. data: {
  362. checkIds: nodeIds,
  363. release_at: $("#release_at").val(),
  364. release_interval: $("#release_interval").val(),
  365. pin_board: $("#pin_board").val(),
  366. social_ids: $("[name=social_ids]").val(),
  367. label_id: checkbox,
  368. }
  369. };
  370. tips.ajax(ajaxConfig);
  371. },
  372. };
  373. </script>
  374. @endsection