WindowCountdown.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <script setup>
  2. import dayjs from "dayjs";
  3. import { computed, onMounted, onUnmounted, ref } from "vue";
  4. import { WindowCountdownStore } from "@/components/WindowQingXiCheAndQv/store/WindowCountdownStore.js";
  5. import { ComVal } from "../ThreeWorldEventQingXiCheAndQv/common/ComVal.js";
  6. let txtCode = "WindowCountdown";
  7. /**
  8. * 退出的逻辑
  9. */
  10. const exitEvent = () => {
  11. ComVal.find().fpsEventDel(txtCode);
  12. if (typeof WindowCountdownStore().obj.callbackEvent == "function") {
  13. WindowCountdownStore().obj.callbackEvent(
  14. WindowCountdownStore().obj.myJson
  15. );
  16. }
  17. WindowCountdownStore().obj.viewOpen = false;
  18. WindowCountdownStore().obj.callbackEvent = null;
  19. WindowCountdownStore().obj.myJson = null;
  20. }
  21. onMounted(() => {
  22. txtEvent();
  23. });
  24. /**
  25. * 倒计时展示的逻辑
  26. */
  27. const txtEvent = () => {
  28. ComVal.find().fpsEventDel(txtCode);
  29. ComVal.find().fpsEventAdd(txtCode, null, (1000 / 1), function(fpsEventAddRet) {
  30. WindowCountdownStore().obj.num = parseInt(WindowCountdownStore().obj.num) - 1;
  31. if (WindowCountdownStore().obj.num <= 0) {
  32. ComVal.find().fpsEventDel(fpsEventAddRet.code);
  33. exitEvent();
  34. }
  35. });
  36. }
  37. </script>
  38. <template>
  39. <div class="WindowCountdown">
  40. <div class="main">
  41. <div class="yuan">
  42. {{ WindowCountdownStore().obj.num }}
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <style lang="less" >
  48. * {
  49. box-sizing:border-box;
  50. -moz-box-sizing:border-box; /* Firefox */
  51. -webkit-box-sizing:border-box; /* Safari */
  52. }
  53. </style>
  54. <style lang="less" scoped>
  55. .WindowCountdown * {
  56. -moz-user-select: none;
  57. -webkit-user-select: none;
  58. -ms-user-select: none;
  59. -khtml-user-select: none;
  60. user-select: none;
  61. }
  62. .WindowCountdown {
  63. position: fixed;
  64. z-index: 0;
  65. width: 0px;
  66. height: 0px;
  67. top: 0px;
  68. left: 0px;
  69. z-index: 1000;
  70. .main {
  71. position: fixed;
  72. width: 100%;
  73. height: 100%;
  74. top: 0px;
  75. left: 0px;
  76. background-color: #00000050;
  77. .yuan {
  78. position: fixed;
  79. width: 15rem;
  80. height: 15rem;
  81. border-radius: 50%;
  82. top: 50%;
  83. left: 50%;
  84. margin: -7.5rem 0px 0px -7.5rem;
  85. // background-image: url("../../assets/res/img/window/yuan.svg");
  86. // background-image: url("../../assets/res/img/window/yuan.webp");
  87. background-image: url("../../assets/res/img/window/yuan2.svg");
  88. background-position: center;
  89. background-size: 100% 100%;
  90. display: flex;
  91. flex-direction: column;
  92. justify-content: center;
  93. align-items: center;
  94. font-size: 10rem;
  95. font-weight: 500;
  96. color: #ffffff;
  97. }
  98. }
  99. }
  100. </style>