importAndExportQRCode.blade.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="icon" href="{{asset('icon/faviconc.ico')}}" type="image/x-icon"/>
  7. <!-- CSRF Token -->
  8. <meta name="csrf-token" content="{{ csrf_token() }}">
  9. <title>显示二维码 BsWAS</title>
  10. <!-- Styles -->
  11. <link href="{{ mix('css/app.css') }}" rel="stylesheet">
  12. </head>
  13. <body>
  14. <div class="container-fluid " id="page">
  15. <div class="card ">
  16. <div class="card-body">
  17. <div class="align-content-center m-3" >
  18. <h3 class="text-center text-dark">首次扫描后将与设备绑定,之后扫描需使用原设备与原软件!</h3><br>
  19. <h4 class="text-center text-danger">如更换设备请联系管理人员解除设备绑定!</h4>
  20. </div>
  21. <div class="row">
  22. <div class="col-6 text-center" v-for="importAndExportQRCode in importAndExportQRCodes" >
  23. <img id="img" class="img-thumbnail img-fluid" :src="'data:image/png;base64,'+importAndExportQRCode.src" width="75%"/>
  24. <p class="font-weight-bold m-2 h1 text-center" style="color: red">@{{ importAndExportQRCode.source }}</p>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <script src="{{ asset('js/app.js') }}"></script>
  31. <script>
  32. function computeDiffMicroTime_fromNow(dateComparing) {
  33. let now=new Date();
  34. let dateComparingObj=new Date(dateComparing)
  35. let mil = dateComparingObj.getTime()-now.getTime();
  36. if (mil>0){
  37. return mil;
  38. }else {
  39. return mil=1000;
  40. }
  41. }
  42. new Vue({
  43. el:"#page",
  44. data:{
  45. importAndExportQRCodes:[
  46. @foreach($importAndExportQRCodes as $importAndExportQRCode)
  47. {url:'{{$importAndExportQRCode->url}}', type:'{{$importAndExportQRCode->type}}',source:'{{$importAndExportQRCode->source}}'},
  48. @endforeach
  49. ],
  50. next_refresh_time:'{{$next_refresh_time}}',
  51. },
  52. mounted(){
  53. let _this=this;
  54. let refreshQRCode=function(){
  55. axios.post('{{url('personnel/checking-in/refreshQRCode')}}')
  56. .then(function (response) {
  57. _this.importAndExportQRCodes=response.data.importAndExportQRCodes;
  58. _this.next_refresh_time=response.data.next_refresh_time;
  59. document.querySelector("meta[name='csrf-token']").setAttribute('content',response.data.csrf_Token);
  60. setTimeout(refreshQRCode,computeDiffMicroTime_fromNow(_this.next_refresh_time));
  61. }).catch(function (err) {
  62. setTimeout(refreshQRCode,computeDiffMicroTime_fromNow(_this.next_refresh_time));
  63. tempTip.setDuration(4000);
  64. tempTip.show(err);
  65. });
  66. };
  67. refreshQRCode();
  68. }
  69. });
  70. </script>
  71. </body>
  72. </html>