skill-cert-activity.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="activity-area">
  3. <div class="activity-container">
  4. <div class="activity-title">
  5. <span class="text">100%接单限时活动</span>
  6. <span class="count-time">(剩余{{ text }})</span>
  7. </div>
  8. <div class="activity-list">
  9. <div class="activity-item">
  10. <h6>活动1(默认参与):不接单全额退+赠送会</h6>
  11. <p>
  12. * 完成认证后,2个月内未成功接单,退还全部认证费用,并保留认证权益<br />
  13. * 参与认证,赠送1个月<a
  14. href="/type/vip/developer"
  15. class="color-4D81BF"
  16. >开发者会员</a
  17. >
  18. </p>
  19. </div>
  20. <div class="activity-item">
  21. <h6>活动2(提交时勾选即可):先认证,接单后</h6>
  22. <p>
  23. * 先进行认证,成功接单后再扣除150%的认证费用
  24. </p>
  25. </div>
  26. </div>
  27. <div class="activity-tips">
  28. 备注:活动1和活动2只能参与1个<br />
  29. 活动时间:2022年4月10日0点—2022年5月10日0点
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. // 模拟结束时间,4月10号0点
  39. endTime: 1649520000000,
  40. pageNow: Date.now(),
  41. serverTime: Date.now(),
  42. text: "",
  43. timer: null
  44. };
  45. },
  46. mounted() {
  47. this.startTimer();
  48. },
  49. methods: {
  50. startTimer() {
  51. this.timer = setInterval(() => {
  52. let now = Date.now();
  53. let pageNow = this.pageNow;
  54. let desc = now - pageNow;
  55. let countDown = this.endTime - (this.serverTime + desc);
  56. this.parseCountDownText(countDown);
  57. }, 800);
  58. },
  59. clearTimer() {
  60. clearInterval(this.timer);
  61. this.timer = null;
  62. },
  63. // 以毫秒作为单位
  64. parseCountDownText(countDown) {
  65. // 转换秒为单位
  66. let countDownTime = Math.ceil(countDown / 1000);
  67. let day = parseInt(countDownTime / (24 * 60 * 60), 10);
  68. let dayText = day;
  69. countDownTime = countDownTime - day * 24 * 60 * 60;
  70. let hour = parseInt(countDownTime / (60 * 60), 10);
  71. let hourText = hour > 9 ? hour : "0" + hour;
  72. countDownTime = countDownTime - hour * 60 * 60;
  73. let minute = parseInt(countDownTime / 60, 10);
  74. let minuteText = minute > 9 ? minute : "0" + minute;
  75. countDownTime = countDownTime - minute * 60;
  76. let second = countDownTime;
  77. let text = `${dayText}天${hourText}小时${minuteText}分钟${second}秒`;
  78. this.text = text;
  79. }
  80. }
  81. };
  82. </script>
  83. <style lang="scss" scoped>
  84. .activity-area {
  85. width: 100%;
  86. }
  87. .activity-container {
  88. min-width: 670px;
  89. // background: #fff6f4 url("~@/assets/img/skill_cert/bg22.png") no-repeat 50% top;
  90. // background-size: 1048px auto;
  91. padding-bottom: 20px;
  92. background: #fff7f4;
  93. padding-top: 70px;
  94. position: relative;
  95. }
  96. %bg {
  97. content: "";
  98. position: absolute;
  99. top: 0;
  100. bottom: 0;
  101. width: 85px;
  102. z-index: 2;
  103. }
  104. .activity-title {
  105. position: absolute;
  106. z-index: 3;
  107. top: -10px;
  108. left: 50%;
  109. transform: translateX(-50%);
  110. height: 50px;
  111. width: 430px;
  112. text-align: center;
  113. font-size: 22px;
  114. font-family: PingFangSC-Medium, PingFang SC;
  115. font-weight: 500;
  116. color: #ffffff;
  117. line-height: 50px;
  118. text-shadow: 0px 2px 4px #ff5530;
  119. text-align: center;
  120. background: url("~@/assets/img/skill_cert/bg_c.png") repeat left top;
  121. .count-time {
  122. font-size: 16px;
  123. font-weight: normal !important;
  124. font-family: PingFangSC-Regular, PingFang SC;
  125. }
  126. &::before {
  127. @extend %bg;
  128. left: 3px;
  129. transform: translateX(-100%);
  130. background: url("~@/assets/img/skill_cert/pc_l.png") no-repeat left top;
  131. background-size: cover;
  132. }
  133. &::after {
  134. @extend %bg;
  135. right: 3px;
  136. width: 88px;
  137. transform: translateX(100%);
  138. background: url("~@/assets/img/skill_cert/pc_r.png") no-repeat right top;
  139. background-size: cover;
  140. }
  141. }
  142. .activity-list {
  143. // margin-top: 40px;
  144. margin-left: 30px;
  145. margin-right: 30px;
  146. display: flex;
  147. justify-content: space-between;
  148. flex-wrap: wrap;
  149. }
  150. .activity-item {
  151. width: 48.7%;
  152. padding: 20px;
  153. border: 1px dashed #ff844f;
  154. background-color: #fff;
  155. border-radius: 16px;
  156. h6 {
  157. font-size: 15px;
  158. font-family: PingFangSC-Medium, PingFang SC;
  159. font-weight: 500;
  160. color: #ff4d27;
  161. line-height: 21px;
  162. }
  163. p {
  164. font-size: 15px;
  165. font-family: PingFangSC-Regular, PingFang SC;
  166. font-weight: 400;
  167. color: #0b121a;
  168. line-height: 24px;
  169. margin-top: 14px;
  170. }
  171. }
  172. .color-4D81BF {
  173. color: #4d81bf;
  174. }
  175. .activity-tips {
  176. margin-left: 30px;
  177. margin-top: 18px;
  178. font-size: 14px;
  179. font-family: PingFangSC-Regular, PingFang SC;
  180. font-weight: 400;
  181. color: #666666;
  182. line-height: 24px;
  183. }
  184. @media screen and (max-width: 670px) {
  185. .activity-container {
  186. min-width: inherit;
  187. }
  188. .activity-list {
  189. display: block;
  190. }
  191. .activity-item {
  192. width: auto;
  193. margin-bottom: 30px;
  194. }
  195. .activity-title {
  196. height: auto;
  197. width:auto;
  198. line-height: 1;
  199. padding:7px 10px;
  200. background: url("~@/assets/img/skill_cert/m_bg.png") repeat left top;
  201. &::before {
  202. background: url("~@/assets/img/skill_cert/m_l.png") no-repeat left top;
  203. background-size: cover;
  204. width:44px;
  205. left:0;
  206. }
  207. &::after{
  208. background: url("~@/assets/img/skill_cert/m_r.png") no-repeat left top;
  209. background-size: auto 100%;
  210. width:50px
  211. }
  212. span {
  213. display: block;
  214. }
  215. .text {
  216. font-size: 20px;
  217. font-family: PingFangSC-Medium, PingFang SC;
  218. font-weight: 500;
  219. color: #ffffff;
  220. line-height: 28px;
  221. text-shadow: 0px 2px 4px #ff5530;
  222. }
  223. .count-time {
  224. margin-top: 2px;
  225. font-size: 14px;
  226. font-family: PingFangSC-Regular, PingFang SC;
  227. font-weight: 400;
  228. color: rgba(255, 255, 255, 0.8);
  229. line-height: 20px;
  230. width:180px;
  231. text-align: center;
  232. }
  233. }
  234. }
  235. </style>