site_article.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. @extends('admin/site/side_layout')
  2. @section('header_extend')
  3. <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
  4. <style>
  5. h1 {
  6. color: #0d8ddb
  7. }
  8. </style>
  9. @endsection
  10. @section('right')
  11. <div class="ibox-content" id="passTpl" style="display: none">
  12. <form class="form-horizontal">
  13. <div class="form-group">
  14. <div class="col-sm-12">
  15. <select class="form-control" name="passScore">
  16. <option value="1">1分</option>
  17. <option value="2">2分</option>
  18. <option value="3">3分</option>
  19. <option value="4">4分</option>
  20. <option value="5" selected>5分</option>
  21. </select>
  22. </div>
  23. </div>
  24. </form>
  25. </div>
  26. @php $hasEdit=0; @endphp
  27. <form class="row" id="searchForm">
  28. @hasAuth('sites-articles-edit')
  29. @php $hasEdit=1; @endphp
  30. <div class="col-md-6">
  31. <div class="input-group">
  32. <span class="input-group-btn">
  33. @php
  34. $siteRecord=\App\Http\Models\Site::query()->select(['contract_ids'])->find($siteId);
  35. $hasContractIds=$siteRecord->contract_ids??[];
  36. @endphp
  37. @if(in_array("1",$hasContractIds))
  38. <button type="button" class="btn btn-md btn-info"
  39. onclick="units.syncSite()">
  40. <span class="glyphicon glyphicon-hand-up"></span> 同步到站点
  41. </button>
  42. @endif
  43. {{--<button type="button" class="btn btn-md btn-info"--}}
  44. {{--onclick="units.syncSocial()" style="margin-left: 10px">--}}
  45. {{--<span class="glyphicon glyphicon-hand-up"></span> 同步到社交--}}
  46. {{--</button>--}}
  47. <button type="button" class="btn btn-md btn-warning"
  48. onclick="units.pass()"
  49. style="margin-left: 10px">
  50. <span class="glyphicon glyphicon-hand-down"></span> 审核通过
  51. </button>
  52. <button type="button" class="btn btn-md btn-primary"
  53. onclick="units.save(0)" style="margin-left: 10px">
  54. <span class="glyphicon glyphicon-plus"></span> 添加
  55. </button>
  56. <button type="button" class="btn btn-md btn-danger"
  57. onclick="units.delete()" style="margin-left: 10px">
  58. <span class="glyphicon glyphicon-remove"></span> 删除
  59. </button>
  60. <button type="button" class="btn btn-md btn-success"
  61. onclick="units.isPublished()" style="margin-left: 10px"> 已发布
  62. </button>
  63. <button type="button" class="btn btn-md btn-danger"
  64. onclick="units.update()" style="margin-left: 10px">
  65. <span class="glyphicon glyphicon-remove"></span> 未使用
  66. </button>
  67. <button type="button" class="btn btn-md btn-success"
  68. onclick="units.push()" style="margin-left: 10px"> 软文推送
  69. </button>
  70. <button type="button" class="btn btn-md btn-danger"
  71. onclick="units.show()" id="bzx" style="margin-left: 10px">备注
  72. </button>
  73. <button type="button" class="btn btn-md btn-success"
  74. onclick="units.export()" style="margin-left: 10px">导出软文
  75. </button>
  76. </span>
  77. </div>
  78. <div class="toggle-x-box" style="display: none;margin-top: 40px;">
  79. <div>
  80. <div style="float: left;width: 140px">
  81. <div>
  82. 是否客户审核:
  83. <input type="checkbox" id="article_custom_audit" value="" style="margin-right: 10px"
  84. @if(!empty($siteInFo->article_custom_audit)) checked @endif>
  85. </div>
  86. <div>
  87. 是否上传缩略图:
  88. <input type="checkbox" id="is_upload_thumb" value="" style="margin-right: 10px"
  89. @if(!empty($siteInFo->is_upload_thumb)) checked @endif>
  90. </div>
  91. </div>
  92. <div style="float: left;width: calc(100% - 140px)">
  93. 文章同步目录:
  94. <textarea id="article_remark" class="form-control"
  95. rows="3">{{$siteInFo->article_remark??''}}</textarea>
  96. </div>
  97. <div style="clear:both"></div>
  98. </div>
  99. <div style="padding-top: 10px">
  100. 兼职备注:<textarea class="form-control" rows="3"
  101. id="article_pt_remark">{{$siteInFo->article_pt_remark??''}}</textarea>
  102. {{-- <div style="padding-top: 6px">
  103. 本月需更新数:<input class="form-control" type="number" value="{{$siteInFo->article_need_num??''}}"
  104. id="article_need_num" style="width: 120px;display: inline-block"/>
  105. </div>--}}
  106. </div>
  107. <div>
  108. 站外更新平台:<textarea class="form-control" rows="3"
  109. id="outside_update_platform">{{$siteInFo->outside_update_platform??''}}</textarea>
  110. <button type="button" class="btn btn-success" onclick="units.saveInfo()" style="margin-top: 5px">保存
  111. </button>
  112. </div>
  113. </div>
  114. <br>
  115. <br>
  116. </div>
  117. @endHasAuth
  118. </form>
  119. <p id="mouseout">合同数:{{$site->article_goal??0}} 总数:{{$count}} 待更新:{{$pendingUpgrade}} 本月更新:{{$thisMonthUpgrade}}
  120. 每月更新数:<input
  121. type="text"
  122. style="width: 40px"
  123. id="articles_updates_per_month"
  124. name="articles_updates_per_month"
  125. value="{{$site->articles_updates_per_month??4}}">
  126. 续费篇数:<input
  127. type="text"
  128. style="width: 40px"
  129. id="article_renewal_quantity"
  130. name="article_renewal_quantity"
  131. value="{{$site->article_renewal_quantity??0}}">
  132. 续费次数:{{$site->renewal_times??0}} &nbsp;
  133. <button id="articlesUpdates">保存</button>
  134. <input type="checkbox" id="article_pause" name="article_pause"
  135. class="js-switch"
  136. @if($site->article_pause??0) checked @endif onchange="units.articlePause()"> 暂停
  137. </p>
  138. <hr>
  139. <div class="table-responsive">
  140. <table id="table" class="table table-condensed"
  141. data-mobile-responsive="true"></table>
  142. </div>
  143. @endsection
  144. @section('footer_extend')
  145. <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
  146. <script>
  147. var checkbox = document.querySelector(".js-switch");
  148. new Switchery(checkbox, {color: "#1AB394", size: 'small'});
  149. $("#articlesUpdates").click(function () {
  150. var articlesUpdatesPerMonth = $('#articles_updates_per_month').val();
  151. var article_renewal_quantity = $('#article_renewal_quantity').val();
  152. var ajaxConfig = {
  153. url: '/admin/articles-updates-per-month',
  154. type: 'put',
  155. data: {
  156. siteId: "{{$siteId}}",
  157. articlesUpdatesPerMonth: articlesUpdatesPerMonth,
  158. article_renewal_quantity: article_renewal_quantity
  159. },
  160. success: function (result) {
  161. layer.msg(result.message, {icon: 6, time: 1000}, function () {
  162. });
  163. }
  164. };
  165. tips.ajax(ajaxConfig);
  166. });
  167. $('#bzx').click(function () {
  168. $('.toggle-x-box').toggle();
  169. });
  170. var units = {
  171. articlePause: function () {
  172. var isChecked = checkbox.checked ? 1 : 0;
  173. var ajaxConfig = {
  174. url: '/admin/sites/' + "{{$siteId}}" + '/article-pause-status',
  175. type: 'put',
  176. data: {status: isChecked},
  177. success: function () {
  178. }
  179. };
  180. tips.ajax(ajaxConfig);
  181. },
  182. search: function () {
  183. tips.selectPage();
  184. },
  185. getIdsBySelections: function () {
  186. var selections = $("#table").bootstrapTable('getSelections');
  187. var ids = [];
  188. $.each(selections, function (inx, val) {
  189. ids.push(val.id);
  190. });
  191. return ids;
  192. },
  193. detail: function (id) {
  194. layer.open({
  195. type: 2,
  196. content: ['/admin/articles-detail/' + id + '?referer=sites'],
  197. area: ['100%', '100%'],
  198. title: '',
  199. closeBtn: 0
  200. });
  201. },
  202. pass: function () {
  203. var ids = units.getIdsBySelections();
  204. if (ids.length === 0) {
  205. layer.alert('请先选择您所要操作的对象', {icon: 0});
  206. return;
  207. }
  208. layer.open({
  209. shade: 0,
  210. type: 1,
  211. content: $('#passTpl'),
  212. title: '审核通过',
  213. area: ['400px', '200px'],
  214. btn: ['确认', '取消'],
  215. yes: function (index, layero) {
  216. var passScore = $(layero).find("[name=passScore]").val();
  217. var ajaxConfig = {
  218. url: '/admin/articles/pass',
  219. type: 'put',
  220. data: {ids: ids, passScore: passScore},
  221. success: function (result) {
  222. layer.msg(result.message, {icon: 6, time: 1000}, function () {
  223. tips.tableRefresh();
  224. });
  225. }
  226. };
  227. tips.ajax(ajaxConfig);
  228. }
  229. });
  230. // layer.confirm('您确定要审核通过吗?', {icon: 3, title: '审核操作'}, function () {
  231. // var ajaxConfig = {
  232. // url: '/admin/articles/pass',
  233. // type: 'put',
  234. // data: {ids: ids},
  235. // success: function (result) {
  236. // layer.msg(result.message, {icon: 6, time: 1000}, function () {
  237. // tips.tableRefresh();
  238. // });
  239. // }
  240. // };
  241. // tips.ajax(ajaxConfig);
  242. // });
  243. },
  244. delete: function () {
  245. var ids = units.getIdsBySelections();
  246. if (ids.length === 0) {
  247. layer.alert('请先选择您所要操作的对象', {icon: 0});
  248. return;
  249. }
  250. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  251. layer.close(index);
  252. tips.ajax({
  253. url: '/admin/articles',
  254. type: 'delete',
  255. data: {ids: ids},
  256. tableRefresh: '#table'
  257. });
  258. });
  259. },
  260. update: function () {
  261. var ids = units.getIdsBySelections();
  262. if (ids.length === 0) {
  263. layer.alert('请先选择您所要操作的对象', {icon: 0});
  264. return;
  265. }
  266. layer.confirm('您确定要还原吗?', {icon: 3, title: '初始化翻译中'}, function (index, layero) {
  267. layer.close(index);
  268. tips.ajax({
  269. url: '/admin/articles-batchUpdate',
  270. type: 'put',
  271. data: {ids: ids},
  272. tableRefresh: '#table'
  273. });
  274. });
  275. },
  276. push: function () {
  277. layer.confirm('您确定要推送给用户吗?', {icon: 3, title: '推送至app'}, function (index, layero) {
  278. layer.close(index);
  279. tips.ajax({
  280. url: '/admin/articles-push',
  281. type: 'put',
  282. data: {siteId: "{{$siteId}}"},
  283. tableRefresh: '#table'
  284. });
  285. });
  286. },
  287. isPublished: function () {
  288. var ids = units.getIdsBySelections();
  289. if (ids.length === 0) {
  290. layer.alert('请先选择您所要操作的对象', {icon: 0});
  291. return;
  292. }
  293. layer.confirm('您确定要更新发布时间吗?', {icon: 3, title: '更新发布时间'}, function (index, layero) {
  294. layer.close(index);
  295. tips.ajax({
  296. url: '/admin/articles-published',
  297. type: 'put',
  298. data: {ids: ids},
  299. tableRefresh: '#table'
  300. });
  301. });
  302. },
  303. syncSite: function () {
  304. var ids = units.getIdsBySelections();
  305. if (ids.length === 0) {
  306. layer.alert('请先选择您所要操作的对象', {icon: 0});
  307. return;
  308. }
  309. var param = '?';
  310. $.each(ids, function (inx, val) {
  311. param += 'articleIds[]=' + val + '&'
  312. });
  313. layer.open({
  314. type: 2,
  315. content: ['/admin/sites/{{$siteId}}/articles-sync' + param],
  316. area: ['100%', '100%'],
  317. title: '',
  318. closeBtn: 0
  319. });
  320. },
  321. save: function (id) {
  322. var url = '/admin/articles/' + id + '?siteId={{$siteId}}';
  323. layer.open({
  324. type: 2,
  325. content: [url],
  326. area: ['100%', '100%'],
  327. title: '',
  328. closeBtn: 0
  329. });
  330. },
  331. syncSocial: function () {
  332. var ids = units.getIdsBySelections();
  333. if (ids.length === 0) {
  334. layer.alert('请先选择您所要操作的对象', {icon: 0});
  335. return;
  336. }
  337. layer.confirm('您确定要继续此操作吗?', {icon: 3, title: '社交同步'}, function () {
  338. var ajaxConfig = {
  339. url: '/admin/articles/social-sync',
  340. type: 'post',
  341. data: {ids: ids},
  342. success: function (result) {
  343. layer.msg(result.message, {icon: 6, time: 1000}, function () {
  344. tips.tableRefresh();
  345. });
  346. }
  347. };
  348. tips.ajax(ajaxConfig);
  349. });
  350. },
  351. export: function () {
  352. var ids = units.getIdsBySelections();
  353. window.open('/admin/articles/export/{{$siteId}}?ids=' + ids);
  354. },
  355. saveInfo: function () {
  356. var article_custom_audit = $("#article_custom_audit").prop('checked');
  357. var is_upload_thumb = $("#is_upload_thumb").prop('checked');
  358. var article_remark = $("#article_remark").val();
  359. var article_pt_remark = $("#article_pt_remark").val();
  360. var outside_update_platform = $("#outside_update_platform").val();
  361. var article_need_num = $("#article_need_num").val();
  362. var ajaxConfig = {
  363. url: '/admin/articles/info-save',
  364. type: 'post',
  365. data: {
  366. is_upload_thumb: is_upload_thumb,
  367. article_custom_audit: article_custom_audit,
  368. article_remark: article_remark,
  369. article_pt_remark: article_pt_remark,
  370. outside_update_platform: outside_update_platform,
  371. article_need_num: article_need_num,
  372. siteId: "{{$siteId}}"
  373. },
  374. success: function (result) {
  375. layer.msg(result.message, {icon: 6, time: 1000}, function () {
  376. });
  377. }
  378. };
  379. tips.ajax(ajaxConfig);
  380. }
  381. };
  382. var config = {};
  383. config.url = '/admin/sites/' + "{{$siteId}}" + '/articles';
  384. config.columns = [ //字段
  385. {checkbox: true},
  386. {title: '编号', field: 'id', align: 'center'},
  387. {
  388. title: '标题', field: 'title', align: 'center',
  389. formatter: function (value, row) {
  390. return '<a href="javascript:;" onclick="units.detail(' + row.id + ')">' + value + '</a>'
  391. }
  392. },
  393. {title: '质量分', field: 'pass_score', align: 'center'},
  394. {title: '翻译人员', field: 'translator_name', align: 'center'},
  395. {title: '审核人员', field: 'auditor_name', align: 'center'},
  396. {title: '已翻词数', field: 'translate_words', align: 'center'},
  397. {title: '状态', field: 'status_title', align: 'center'},
  398. {title: '同步时间', field: 'sync_at', align: 'center', sortable: true},
  399. {title: '发布时间', field: 'publish_at', align: 'center', sortable: true},
  400. {title: '创建时间', field: 'created_at', align: 'center', sortable: true},
  401. {
  402. title: '操作', field: 'id', align: 'center',
  403. formatter: function (value) {
  404. var str = '';
  405. @if ($hasEdit)
  406. str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>&nbsp;';
  407. return str;
  408. @endif
  409. }
  410. }
  411. ];
  412. tips.bootstrapTable(config);
  413. </script>
  414. @endsection