NewYear.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <div class="christmas" v-if="isOpen">
  3. <div class="christmas-modal">
  4. <div class="newYear-info">
  5. <a href="javascript:void(0)" @click="isOpen = false"></a>
  6. <div class="newYear-img">
  7. <img src="/images/newYear/chinese-knot.png" :class="{'active': timer > 3}">
  8. <img src="/images/newYear/happy-new-year.png" :class="{'occur': timer > 3}">
  9. <img src="/images/newYear/snow.png" :class="{'snow': timer > 8}">
  10. </div>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'NewYear',
  18. data () {
  19. return {
  20. isOpen: false,
  21. timer: 0
  22. }
  23. },
  24. created () {
  25. setInterval(() => {
  26. this.timer += 0.5
  27. }, 500)
  28. },
  29. mounted () {
  30. const endTime = window.localStorage.getItem('newYearEndTime2018')
  31. const overTime = new Date('2018/02/24 23:59:59').getTime()
  32. const now = new Date().getTime()
  33. if (now <= overTime) {
  34. if (endTime) {
  35. if (now - endTime >= 1000 * 60 * 60 * 2) {
  36. this.isOpen = true
  37. window.localStorage.setItem('newYearEndTime2018', now)
  38. } else {
  39. this.isOpen = false
  40. }
  41. } else {
  42. this.isOpen = true
  43. window.localStorage.setItem('newYearEndTime2018', now)
  44. }
  45. } else {
  46. this.isOpen = false
  47. }
  48. }
  49. }
  50. </script>
  51. <style scoped>
  52. .christmas{
  53. position:fixed;
  54. top:0px;
  55. left:0;
  56. z-index:10000;
  57. width:100%;
  58. height:100%;
  59. }
  60. .christmas-modal{
  61. background:rgba(0,0,0,.6);
  62. width:100%;
  63. height:100%;
  64. }
  65. .newYear-info{
  66. position:absolute;
  67. top:50%;
  68. left:50%;
  69. transform: translate(-50%, -50%);
  70. }
  71. .newYear-info .newYear-img{
  72. position:relative;
  73. }
  74. .newYear-info .newYear-img img{
  75. position:absolute;
  76. top:50%;
  77. left:50%;
  78. transform: translate(-50%, -50%);
  79. }
  80. .newYear-info .newYear-img img:nth-child(1){
  81. animation: newYear1 3s linear;
  82. -o-animation: newYear1 3s linear;
  83. -webkit-animation: newYear1 3s linear;
  84. -moz-animation: newYear1 3s linear;
  85. }
  86. /*.newYear-info .newYear-img img.active {
  87. animation: newYear1-active 3s linear infinite;
  88. -o-animation: newYear1-active 3s linear infinite;
  89. -webkit-animation: newYear1-active 3s linear infinite;
  90. -moz-animation: newYear1-active 3s linear infinite;
  91. }*/
  92. .newYear-info .newYear-img img:nth-child(2){
  93. top: -159px;
  94. left: 10px;
  95. animation: newYear2 3s linear;
  96. -moz-animation: newYear2 3s linear;
  97. -o-animation: newYear2 3s linear;
  98. -webkit-animation: newYear2 3s linear;
  99. }
  100. /* .newYear-info .newYear-img img.occur{
  101. top: -224px;
  102. left: -130px;
  103. animation: newYear2-occur 3s linear infinite;
  104. -moz-animation: newYear2-occur 3s linear infinite;
  105. -o-animation: newYear2-occur 3s linear infinite;
  106. -webkit-animation: newYear2-occur 3s linear infinite;
  107. }*/
  108. .newYear-info .newYear-img img:nth-child(3){
  109. /*left: -15px;
  110. top: -5px;*/
  111. /* height: 700px;*/
  112. opacity: 0.6;
  113. animation: newYear3 8s linear;
  114. -moz-animation: newYear3 8s linear;
  115. -o-animation: newYear3 8s linear;
  116. -webkit-animation: newYear3 8s linear;
  117. }
  118. .newYear-info .newYear-img img.snow{
  119. animation: newYear3-snow 8s linear infinite;
  120. -moz-animation: newYear3-snow 8s linear infinite;
  121. -o-animation: newYear3-snow 8s linear infinite;
  122. -webkit-animation: newYear3-snow 8s linear infinite;
  123. }
  124. .newYear-info a {
  125. position:relative;
  126. z-index:100000;
  127. display:block;
  128. top:-200px;
  129. left:295px;
  130. width: 45px;
  131. height: 45px;
  132. background: url('/images/christmas/close.png')no-repeat center center;
  133. animation: newYear4 3s linear;
  134. -moz-animation: newYear4 3s linear;
  135. -o-animation: newYear4 3s linear;
  136. -webkit-animation: newYear4 3s linear;
  137. }
  138. @keyframes newYear1 {
  139. 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
  140. 25%{top: -317px;left: -295px;transform:scale(0.9);}
  141. 75%{top: -317px;left: -295px;transform:scale(0.8);}
  142. 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
  143. }
  144. @keyframes newYear1-active {
  145. /*0%{top: -317px;left: -295px;transform:scale(1);}*/
  146. 0%{top: -317px;left: -295px;transform:scale(0.8);}
  147. 100%{top: -317px;left: -295px;transform:scale(0.9);}
  148. }
  149. @-webkit-keyframes newYear1 {
  150. 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
  151. 25%{top: -317px;left: -295px;transform:scale(0.9);}
  152. 75%{top: -317px;left: -295px;transform:scale(0.8);}
  153. 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
  154. }
  155. @-moz-keyframes newYear1 {
  156. 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
  157. 25%{top: -317px;left: -295px;transform:scale(0.9);}
  158. 75%{top: -317px;left: -295px;transform:scale(0.8);}
  159. 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
  160. }
  161. @-o-keyframes newYear1 {
  162. 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
  163. 25%{top: -317px;left: -295px;transform:scale(0.9);}
  164. 75%{top: -317px;left: -295px;transform:scale(0.8);}
  165. 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
  166. }
  167. @keyframes newYear2 {
  168. /*0%{ opacity:0;}*/
  169. /*100%{transform:scale( 1);opacity:0.6;}*/
  170. 0%{ opacity: 0 }
  171. 25%{opacity: 0}
  172. 50%{opacity: 0}
  173. 75%{opacity: 0}
  174. 80%{opacity: 0}
  175. 90%{opacity: 0}
  176. 100%{opacity: 1}
  177. }
  178. @keyframes newYear2-occur {
  179. 0%{transform:scale(0.8);opacity:0.8;}
  180. 100%{transform:scale( 1);opacity:1;}
  181. }
  182. @-webkit-keyframes newYear2 {
  183. 0%{ opacity: 0 }
  184. 25%{opacity: 0}
  185. 50%{opacity: 0}
  186. 75%{opacity: 0}
  187. 80%{opacity: 0}
  188. 90%{opacity: 0}
  189. 100%{opacity: 1}
  190. }
  191. @-moz-keyframes newYear2 {
  192. 0%{ opacity: 0 }
  193. 25%{opacity: 0}
  194. 50%{opacity: 0}
  195. 75%{opacity: 0}
  196. 80%{opacity: 0}
  197. 90%{opacity: 0}
  198. 100%{opacity: 1}
  199. }
  200. @-o-keyframes newYear2 {
  201. 0%{opacity: 0 }
  202. 25%{opacity: 0}
  203. 50%{opacity: 0}
  204. 75%{opacity: 0}
  205. 80%{opacity: 0}
  206. 90%{opacity: 0}
  207. 100%{opacity: 1}
  208. }
  209. @keyframes newYear3 {
  210. 0%{ top: -280px;opacity: 0}
  211. 100%{top: -5px;opacity: 0.6}
  212. }
  213. @keyframes newYear3-snow {
  214. 0%{ top: -280px;opacity: 0.6}
  215. 100%{top: -5px;opacity: 0.6}
  216. }
  217. @-webkit-keyframes newYear3 {
  218. 0%{ top: -280px;opacity: 0}
  219. 100%{top: -5px;opacity: 0.6}
  220. }
  221. @-moz-keyframes newYear3{
  222. 0%{ top: -280px;opacity: 0}
  223. 100%{top: -5px;opacity: 0.6}
  224. }
  225. @-o-keyframes newYear3 {
  226. 0%{ top: -280px;opacity: 0}
  227. 100%{top: -5px;opacity: 0.6}
  228. }
  229. @keyframes newYear4 {
  230. 0%{ opacity: 0}
  231. 100%{ opacity: 1}
  232. }
  233. @-webkit-keyframes newYear4 {
  234. 0%{ opacity: 0}
  235. 100%{ opacity: 1}
  236. }
  237. @-moz-keyframes newYear4 {
  238. 0%{ opacity: 0}
  239. 100%{ opacity: 1}
  240. }
  241. @-o-keyframes newYear4 {
  242. 0%{ opacity: 0}
  243. 100%{ opacity: 1}
  244. }
  245. </style>