alarm.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <!--
  2. * @LastEditors: gcz
  3. -->
  4. <template>
  5. <div class="alarm-wrap">
  6. <div class='alarm'>
  7. <div class="alarm-con u-flex">
  8. <img src="../assets/img/gaojing.png" alt="">
  9. <div class="g-container">
  10. <ul :style="{'--s': alarmNum}">
  11. <li v-for="(item) in data" :key="item.id">{{item.content}}</li>
  12. <!--末尾补一个首条数据-->
  13. <li>{{data[0].content}}</li>
  14. </ul>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. name: '',
  23. props:{
  24. data:{
  25. type: Array,
  26. default: null,
  27. },
  28. },
  29. components: {},
  30. data () {
  31. return {
  32. alarmNum:this.data.length,
  33. };
  34. },
  35. created(){},
  36. methods: {},
  37. }
  38. </script>
  39. <style lang='scss' scoped>
  40. .alarm-wrap{
  41. position: fixed;
  42. left: 0;
  43. right: 0;
  44. top: calc( var(--header-height) + 34px + 40px );
  45. }
  46. .alarm {
  47. position: relative;
  48. width: 30vw;
  49. margin: 0 auto;
  50. border: 1px solid rgba(186, 25, 25, 0.17);
  51. height: 2.998501rem;
  52. background: rgba(186, 25, 25, 0.17);
  53. backdrop-filter: blur(6px);
  54. &::before {
  55. position: absolute;
  56. top: 0;
  57. left: 0;
  58. content: "";
  59. width: 10px;
  60. height: 10px;
  61. border-top: 2px solid #f33c52;
  62. border-left: 2px solid #f33c52;
  63. }
  64. &::after {
  65. position: absolute;
  66. top: 0;
  67. right: 0;
  68. content: "";
  69. width: 10px;
  70. height: 10px;
  71. border-top: 2px solid #f33c52;
  72. border-right: 2px solid #f33c52;
  73. }
  74. .alarm-con{
  75. position: absolute;
  76. left: 0;
  77. bottom: 0;
  78. width: 100%;
  79. height: 100%;
  80. img{
  81. width: 150px;
  82. border-radius: unset;
  83. cursor: default;
  84. pointer-events: auto;
  85. animation-name: imageAnimation;
  86. animation-iteration-count: infinite;
  87. animation-timing-function: linear;
  88. animation-duration: 2s;
  89. animation-delay: 0s;
  90. -webkit-user-drag: none;
  91. filter: brightness(120%);
  92. }
  93. &::before {
  94. position: absolute;
  95. bottom: 0;
  96. left: 0;
  97. content: "";
  98. width: 10px;
  99. height: 10px;
  100. border-bottom: 2px solid #f33c52;
  101. border-left: 2px solid #f33c52;
  102. }
  103. &::after {
  104. position: absolute;
  105. bottom: 0;
  106. right: 0;
  107. content: "";
  108. width: 10px;
  109. height: 10px;
  110. border-bottom: 2px solid #f33c52;
  111. border-right: 2px solid #f33c52;
  112. }
  113. }
  114. }
  115. @keyframes imageAnimation {
  116. 0% {
  117. opacity: 1;
  118. transform: none;
  119. }
  120. 50% {
  121. opacity: 0.3;
  122. transform: none;
  123. }
  124. 100% {
  125. opacity: 1;
  126. transform: none;
  127. }
  128. }
  129. .g-container {
  130. width: 100%;
  131. // margin: auto;
  132. height: calc(var(--h) * 1px);
  133. line-height: calc(var(--h) * 1px);
  134. // font-size: 20px;
  135. background: transparent;
  136. color: #fff;
  137. overflow: hidden;
  138. }
  139. ul {
  140. display: flex;
  141. flex-wrap: nowrap;
  142. flex-direction: column;
  143. margin: 0;
  144. padding: 0;
  145. }
  146. ul li {
  147. flex-shrink: 0;
  148. width: 100%;
  149. padding-left: 10px;
  150. box-sizing: border-box;
  151. list-style:none;
  152. margin: 0;
  153. padding: 0;
  154. }
  155. ul {
  156. display: flex;
  157. flex-wrap: nowrap;
  158. flex-direction: column;
  159. }
  160. ul li {
  161. flex-shrink: 0;
  162. width: 100%;
  163. padding-left: 10px;
  164. box-sizing: border-box;
  165. text-align: left;
  166. }
  167. ul {
  168. animation: move calc(var(--speed) * var(--s)) steps(var(--s)) infinite;
  169. }
  170. ul li {
  171. white-space: nowrap;
  172. cursor: pointer;
  173. animation: liMove calc(var(--speed)) infinite;
  174. }
  175. @keyframes move {
  176. 0% {
  177. transform: translate(0, 0);
  178. }
  179. 100% {
  180. transform: translate(0, calc(var(--s) * var(--h) * -1px));
  181. }
  182. }
  183. @keyframes liMove {
  184. 0% {
  185. transform: translate(0, 0);
  186. }
  187. 60%,
  188. 100% {
  189. transform: translate(0, calc(var(--h) * -1px));
  190. }
  191. }
  192. </style>