chose.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. @extends('admin/layout')
  2. @section('header')
  3. <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
  4. <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
  5. @endsection
  6. @section('content')
  7. <style>
  8. .links-lists-boxs {
  9. display: block;
  10. text-align: center;
  11. padding: 20px 0;
  12. position: fixed;
  13. left: 0;
  14. top: 0px;
  15. width: 100%;
  16. z-index: 999999;
  17. background: #f3f3f4;
  18. }
  19. .links-lists-boxs .lists {
  20. display: inline-block;
  21. vertical-align: top;
  22. text-align: center;
  23. padding: 0 2px;
  24. }
  25. .links-lists-boxs .lists span {
  26. display: inline-block;
  27. font-size: 14px;
  28. padding: 5px 10px;
  29. border: 6px;
  30. border-radius: 6px;
  31. color: #676a6c;
  32. }
  33. .links-lists-boxs .lists.active span {
  34. background: #fff;
  35. color: #2a94e0;
  36. }
  37. .links-lists-boxs .lists:hover span {
  38. background: #fff;
  39. color: #2a94e0;
  40. }
  41. .links-times-boxs {
  42. display: block;
  43. width: 100%;
  44. min-height: 30px;
  45. padding: 0 5px;
  46. text-align: center;
  47. }
  48. .links-times-boxs .times-lefts {
  49. display: inline-block;
  50. vertical-align: top;
  51. padding-right: 12px;
  52. }
  53. .links-times-boxs .times-lefts .spans {
  54. display: inline-block;
  55. vertical-align: top;
  56. font-size: 14px;
  57. color: #2a94e0;
  58. line-height: 24px;
  59. padding: 0 4px;
  60. }
  61. .links-times-boxs .times-lefts .spans + .spans:before {
  62. content: '|';
  63. margin-right: 4px;
  64. }
  65. .links-times-boxs .times-rights {
  66. display: inline-block;
  67. vertical-align: top;
  68. }
  69. .links-times-boxs .times-rights input {
  70. background: none;
  71. border: 1px solid #2a94e0;
  72. color: #2a94e0;
  73. font-size: 12px;
  74. line-height: 22px;
  75. outline: none;
  76. padding: 0 0 0 10px;
  77. }
  78. .links-times-boxs .times-rights .links-btn {
  79. background: #2a94e0;
  80. border: 1px solid #2a94e0;
  81. color: #fff;
  82. font-size: 12px;
  83. line-height: 22px;
  84. outline: none;
  85. }
  86. .fold {
  87. height: 45px;
  88. }
  89. </style>
  90. <body class="gray-bg">
  91. <div class="links-lists-boxs">
  92. @if(!$task)
  93. <div class="links-times-boxs">
  94. <div class="times-lefts">
  95. </div>
  96. <div class="times-rights">
  97. <input type="text" id="release_at">
  98. <button class="links-btn" onclick="utils.saveBtn()">保存</button>
  99. </div>
  100. </div>
  101. @endif
  102. <div class="lists-boxs">
  103. @php $count=0; @endphp
  104. @foreach($typeLinks as $type=>$links)
  105. @php $count++; @endphp
  106. <a href="javascript:;" class="lists @if($count==1) active @endif">
  107. <span>
  108. {{$typeList[$type]??''}}
  109. </span>
  110. </a>
  111. @endforeach
  112. </div>
  113. </div>
  114. <div class="wrapper wrapper-content animated fadeInRight" style="padding-top: 110px;">
  115. @php $count=0; @endphp
  116. @foreach($typeLinks as $type=>$links)
  117. @php $count++; @endphp
  118. <div class="row links-lists @if($count!=1) hide @endif">
  119. <div class="ibox float-e-margins">
  120. <div class="ibox-title">
  121. <h5>{{$typeList[$type]??''}}</h5>
  122. <div style="float: right">
  123. <label>
  124. <input type="checkbox" class="i-checks" name="toggle">
  125. 全选反选
  126. </label>
  127. </div>
  128. </div>
  129. @php $tagList=$links->groupBy('tag')->toArray(); @endphp
  130. <div class="ibox-content">
  131. @php $abandonList=[]; @endphp
  132. @php $tagInx=1; @endphp
  133. @foreach($tagList as $tag=>$items)
  134. @if ($tag=='放弃')
  135. @php $abandonList[$tag]=$items; @endphp
  136. @continue
  137. @endif
  138. <div class="alert @if($tagInx%2==0) alert-success @else alert-info @endif">
  139. <input type="checkbox" class="i-checks" name="localToggle">全选反选 <span
  140. style="margin-left: 20px">当前标签:{{empty($tag)?'无':$tag}} </span>&nbsp;
  141. <br>
  142. @foreach($items as $link)
  143. <div style="display: inline-block;width: 220px">
  144. <label title="{{$link['remark']}}"
  145. @if(in_array($link['id'],$linkHad)) style="color: red;opacity: .6" @endif>
  146. <input type="checkbox" class="i-checks" name="linkIds"
  147. data-url="{{$link['url']}}" data-type="{{$typeList[$type]??''}}"
  148. value="{{$link['id']}}"
  149. @if(in_array($link['id'],$hasLinkIds)) checked @endif>
  150. {{$link['url']}}
  151. </label>
  152. </div>
  153. @endforeach
  154. </div>
  155. @php $tagInx++@endphp
  156. @endforeach
  157. {{--放弃--}}
  158. @foreach($abandonList as $tag=>$items)
  159. <div class="alert alert-warning fold" style="position: relative;overflow: hidden">
  160. <button type="button"
  161. onclick="utils.toggleVisible(this)" style="display: block;margin-bottom: 4px">显示
  162. </button>
  163. <input type="checkbox" class="i-checks" name="localToggle">全选反选 <span
  164. style="margin-left: 20px">当前标签:{{empty($tag)?'无':$tag}} </span>&nbsp;
  165. <br>
  166. @foreach($items as $link)
  167. <div style="display: inline-block;width: 220px">
  168. <label title="{{$link['remark']}}"
  169. @if(in_array($link['id'],$linkHad)) style="color: red;opacity: .6" @endif>
  170. <input type="checkbox" class="i-checks" name="linkIds"
  171. data-url="{{$link['url']}}" data-type="{{$typeList[$type]??''}}"
  172. value="{{$link['id']}}"
  173. @if(in_array($link['id'],$hasLinkIds)) checked @endif>
  174. {{$link['url']}}
  175. </label>
  176. </div>
  177. @endforeach
  178. </div>
  179. @endforeach
  180. </div>
  181. </div>
  182. </div>
  183. @endforeach
  184. </div>
  185. <input type="hidden" id="choseData">
  186. </body>
  187. @endsection
  188. @section('footer')
  189. <script src="{{asset('js/plugins/iCheck/icheck.min.js')}}"></script>
  190. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  191. <script>
  192. $(function () {
  193. $(".links-lists-boxs .lists-boxs .lists").click(function () {
  194. var i = $(this).index();
  195. $(this).addClass("active").siblings().removeClass("active");
  196. $(".links-lists").eq(i).removeClass("hide").siblings(".links-lists").addClass("hide");
  197. });
  198. });
  199. $(function () {
  200. $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green"});
  201. });
  202. var choseDataList = [];
  203. var utils = {
  204. toggleVisible: function (_this) {
  205. if ($(_this).parent().hasClass('fold')) {
  206. $(_this).parent().removeClass('fold');
  207. $(_this).text('隐藏')
  208. } else {
  209. $(_this).parent().addClass('fold');
  210. $(_this).text('显示')
  211. }
  212. },
  213. saveBtn: function () {
  214. if ($("#release_at").val() != '') {
  215. var selectIds = [], selectItems = [];
  216. $("[name=linkIds]input:checked").each(function () {
  217. selectIds.push($(this).val());
  218. selectItems.push({type: $(this).data('type'), url: $(this).data('url')})
  219. });
  220. if (selectIds.length < 1) {
  221. layer.alert("请选择外链库", {icon: 5});
  222. return;
  223. }
  224. var _val = $("#release_at").val();
  225. $(".links-times-boxs .times-lefts").append('<span class="spans">' + _val + '</span>');
  226. $("#release_at").val('');
  227. choseDataList.push({
  228. release_at: _val,
  229. link_ids: selectIds,
  230. selectItems: selectItems
  231. });
  232. var str = JSON.stringify(choseDataList);
  233. $("#choseData").val(str);
  234. $(".i-checks").iCheck('uncheck');
  235. }
  236. }
  237. };
  238. laydate.render({
  239. elem: '#release_at', //指定元素
  240. type: 'datetime'
  241. });
  242. $("[name=toggle]").on('ifChecked', function () {
  243. $(this).parent().parent().parent().parent().next().iCheck('check')
  244. }).on('ifUnchecked', function () {
  245. $(this).parent().parent().parent().parent().next().iCheck('uncheck');
  246. });
  247. $("[name=localToggle]").on('ifChecked', function () {
  248. $(this).parent().parent().iCheck('check')
  249. }).on('ifUnchecked', function () {
  250. $(this).parent().parent().iCheck('uncheck')
  251. });
  252. </script>
  253. @endsection