nodeList.blade.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. @extends('user.layouts')
  2. @section('css')
  3. <script src="//at.alicdn.com/t/font_682457_e6aq10jsbq0yhkt9.js" type="text/javascript"></script>
  4. <link href="/assets/global/fonts/font-awesome/font-awesome.min.css" type="text/css" rel="stylesheet">
  5. <link href="/assets/global/vendor/webui-popover/webui-popover.min.css" type="text/css" rel="stylesheet">
  6. @endsection
  7. @section('content')
  8. <!-- BEGIN CONTENT BODY -->
  9. <div class="page-content container-fluid">
  10. <div class="row">
  11. @foreach($nodeList as $node)
  12. <div class="col-xxl-3 col-xl-4 col-sm-6">
  13. <div class="card card-inverse card-shadow bg-white">
  14. <div class="card-block p-30 row">
  15. <div class="col-4">
  16. <svg class="w-p100 text-center" aria-hidden="true">
  17. <use xlink:href="@if($node->country_code)#icon-{{$node->country_code}}@else #icon-un @endif"></use>
  18. </svg>
  19. </div>
  20. <div class="col-8 text-break text-right">
  21. <p class="font-size-20 blue-600">
  22. @if($node->offline)
  23. <i class="red-600 icon wb-warning" data-content="线路不稳定/维护中" data-trigger="hover" data-toggle="popover" data-placement="top"></i>
  24. @endif
  25. @if($node->traffic_rate != 1)
  26. <i class="green-600 icon wb-info-circle" data-content="{{$node->traffic_rate}} 倍流量消耗" data-trigger="hover" data-toggle="popover" data-placement="top"></i>
  27. @endif
  28. {{$node->name}}
  29. </p>
  30. <blockquote>
  31. @foreach($node->labels as $label)
  32. <span class="badge badge-pill font-size-10 up m-0 badge-info">{{$label->labelInfo->name}}</span>
  33. @endforeach
  34. <br>
  35. {{$node->description}}
  36. </blockquote>
  37. <p class="font-size-14">
  38. <button class="btn btn-sm btn-outline-info" onclick="getInfo('{{$node->id}}','code')">
  39. <i id="code{{$node->id}}" class="icon fa-code"></i>
  40. </button>
  41. <button class="btn btn-sm btn-outline-info" onclick="getInfo('{{$node->id}}','qrcode')">
  42. <i id="qrcode{{$node->id}}" class="icon fa-qrcode"></i>
  43. </button>
  44. <button class="btn btn-sm btn-outline-info" onclick="getInfo('{{$node->id}}','text')">
  45. <i id="text{{$node->id}}" class="icon fa-list"></i>
  46. </button>
  47. </p>
  48. <p class="text-muted">
  49. <span>电信: {{$node->ct>0 ?$node->ct.' ms' :'无数据'}} </span>
  50. <span>联通: {{$node->cu>0 ?$node->cu.' ms' :'无数据'}} </span>
  51. <br>
  52. <span>移动: {{$node->cm>0 ?$node->cm.' ms' :'无数据'}} </span>
  53. <span>香港: {{$node->hk>0 ?$node->hk.' ms' :'无数据'}} </span>
  54. </p>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. @endforeach
  60. </div>
  61. </div>
  62. @endsection @section('script')
  63. <script src="/assets/global/vendor/matchheight/jquery.matchHeight-min.js" type="text/javascript"></script>
  64. <script src="/assets/global/js/Plugin/matchheight.js" type="text/javascript"></script>
  65. <script src="/assets/custom/Plugin/jquery-qrcode/jquery.qrcode.min.js" type="text/javascript"></script>
  66. <script src="/assets/global/js/Plugin/webui-popover.js" type="text/javascript"></script>
  67. <script type="text/javascript">
  68. $(function () {
  69. $('.card').matchHeight();
  70. });
  71. function getInfo(id, type) {
  72. const oldClass = $("#" + type + id).attr("class");
  73. $.ajax({
  74. type: "POST",
  75. url: '/nodeList',
  76. data: {_token: '{{csrf_token()}}', id: id, type: type},
  77. beforeSend: function () {
  78. $("#" + type + id).removeAttr("class").addClass("icon wb-loop icon-spin");
  79. },
  80. success: function (ret) {
  81. if (ret.status === 'success') {
  82. switch (type) {
  83. case 'code':
  84. swal.fire({
  85. html: '<textarea class="form-control" rows="8" readonly="readonly">' + ret.data + '</textarea>' +
  86. '<a href="' + ret.data + '" class="btn btn-danger btn-block mt-10">打开' + ret.title + '</a>',
  87. showConfirmButton: false
  88. });
  89. break;
  90. case 'qrcode':
  91. swal.fire({
  92. title: '{{trans('home.scan_qrcode')}}',
  93. html: '<div id="qrcode"></div>',
  94. onBeforeOpen: () => {
  95. $("#qrcode").qrcode({text: ret.data});
  96. },
  97. showConfirmButton: false
  98. });
  99. break;
  100. case 'text':
  101. swal.fire({
  102. title: '{{trans('home.setting_info')}}',
  103. html: '<textarea class="form-control" rows="12" readonly="readonly">' + ret.data + '</textarea>',
  104. showConfirmButton: false
  105. });
  106. break;
  107. default:
  108. swal.fire({title: ret.title, text: ret.data});
  109. }
  110. }
  111. },
  112. complete: function () {
  113. $("#" + type + id).removeAttr("class").addClass(oldClass);
  114. }
  115. });
  116. }
  117. </script>
  118. @endsection