maintenance.blade.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. @extends('_layout')
  2. @section('title', trans('auth.maintenance'))
  3. @section('body_class', 'page-login-v3 layout-full')
  4. @section('layout_content')
  5. <div class="page vertical-align text-center" data-animsition-in="fade-in" data-animsition-out="fade-out">
  6. <div class="page-content vertical-align-middle">
  7. <i class="icon wb-settings icon-spin font-size-70" aria-hidden="true"></i>
  8. <h2>{{ trans('auth.maintenance_tip') }}</h2>
  9. {!! $message !!}
  10. <footer class="page-copyright">
  11. <p id="countdown"></p>
  12. <div class="social">
  13. @foreach (config('common.language') as $key => $value)
  14. <a class="btn btn-icon btn-pure" href="{{ route('lang', ['locale' => $key]) }}">
  15. <i class="font-size-30 icon fi fi-{{ $value[1] }}" aria-hidden="true"></i>
  16. </a>
  17. @endforeach
  18. </div>
  19. </footer>
  20. </div>
  21. </div>
  22. @endsection
  23. @section('layout_javascript')
  24. <script>
  25. // 每秒更新计时器
  26. const countDownDate = new Date("{{ $time }}").getTime();
  27. const countdownElement = document.getElementById('countdown');
  28. const daysLabel = '{{ trans_choice('common.days.attribute', 1) }}';
  29. const hoursLabel = '{{ trans_choice('common.hour', 1) }}';
  30. const minutesLabel = '{{ ucfirst(trans('validation.attributes.minute')) }}';
  31. const secondsLabel = '{{ ucfirst(trans('validation.attributes.second')) }}';
  32. const updateCountdown = () => {
  33. const distance = countDownDate - new Date().getTime();
  34. if (distance <= 0) {
  35. clearInterval(interval);
  36. countdownElement.remove();
  37. return;
  38. }
  39. const days = Math.floor(distance / 86400000);
  40. const hours = Math.floor(distance % 86400000 / 3600000);
  41. const minutes = Math.floor(distance % 3600000 / 60000);
  42. const seconds = Math.floor(distance % 60000 / 1000);
  43. countdownElement.innerHTML =
  44. `<h3>${days} <span> ${daysLabel} </span>: ${hours} <span>${hoursLabel}</span>: ${minutes} <span>${minutesLabel}</span>: ${seconds}<span> ${secondsLabel}</span></h3>`;
  45. };
  46. const interval = setInterval(updateCountdown, 1000);
  47. </script>
  48. @endsection