procedureArea.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="procedure">
  3. <div class="title">5EX挑战</div>
  4. <div class="content" ref="content">
  5. <div class="procedure_content" v-for="(i, index) in 5" :key="index" :class="{active: phase.atPhase >= index}">
  6. <i class="img" :class="{ isDo : phase.doPhase > index}"></i>
  7. <i class="dot"></i>
  8. <span class="name">
  9. <span>阶段{{ index+1 }}</span>
  10. </span>
  11. <div class="stepBorder" v-if="i != 5" :style="{width: `calc(${contentWidth} / (${5 - 1}))`}" :class="{active: phase.doPhase > index}"></div>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. props:{
  19. phase:{
  20. type:Object,
  21. default:()=>{
  22. return {
  23. doPhase:0,
  24. atPhase:0,
  25. }
  26. }
  27. }
  28. },
  29. data() {
  30. return {
  31. contentWidth:"100px",
  32. }
  33. },
  34. mounted () {
  35. this.$nextTick(() => {
  36. this.contentWidth = this.$refs.content.offsetWidth + "px";
  37. window.addEventListener("resize", () => {
  38. this.contentWidth = this.$refs.content.offsetWidth + "px";
  39. })
  40. })
  41. },
  42. methods: {
  43. },
  44. }
  45. </script>
  46. <style scoped>
  47. .procedure{
  48. width: 100%;
  49. height: 100%;
  50. background-image: url('../../../../assets/icon/pblCourse/top_pbl.png');
  51. background-size: 100% 100%;
  52. border-radius: 15px;
  53. position: relative;
  54. display: flex;
  55. align-items: center;
  56. justify-content: center;
  57. }
  58. .procedure .title{
  59. position: absolute;
  60. top: 0;
  61. color: #fff;
  62. background: linear-gradient(90deg, rgba(54, 115, 232, 0) 0%, #727EF3 50%, rgba(54, 115, 232, 0) 100%);
  63. width: 190px;
  64. height: 24px;
  65. display: flex;
  66. align-items: center;
  67. justify-content: center;
  68. font-size: 14px;
  69. }
  70. .procedure .content{
  71. display: flex;
  72. width: calc(100% - 40px);
  73. margin: 0 auto;
  74. justify-content: space-between;
  75. position: relative;
  76. }
  77. .content .procedure_content{
  78. display: flex;
  79. flex-direction: column;
  80. align-items: center;
  81. position: relative;
  82. }
  83. .content .procedure_content > .img.isDo{
  84. background-image: url('../../../../assets/icon/pblCourse/top_book_active.png');
  85. }
  86. .content .procedure_content > .img{
  87. background-image: url('../../../../assets/icon/pblCourse/top_book.png');
  88. display: block;
  89. width: 40px;
  90. height: 40px;
  91. background-size: 100% 100%;
  92. }
  93. .content .procedure_content > .dot{
  94. border: 2px solid #c8aeff;
  95. width: 16px;
  96. height: 16px;
  97. border-radius: 28px;
  98. margin-bottom: 10px;
  99. z-index: 1;
  100. background: #FFFFFF59;
  101. box-sizing: border-box;
  102. }
  103. .content .procedure_content.active > .dot{
  104. border: none;
  105. background: linear-gradient(90deg, #3673E8 0%, #AD88FD 100%);
  106. }
  107. .content .procedure_content > .name{
  108. background: rgba(255, 255, 255, .55);
  109. border: 2px solid #c8aeff;
  110. display: block;
  111. border-radius: 49px;
  112. font-size: 16px;
  113. padding: 3px 7px;
  114. font-weight: 600;
  115. position: relative;
  116. overflow: hidden;
  117. }
  118. .content .procedure_content.active > .name{
  119. /* border: none; */
  120. background: linear-gradient(90deg, #3673E8 0%, #AD88FD 100%);
  121. }
  122. .content .procedure_content > .name > span{
  123. background-image: linear-gradient(90deg, #3673E8 0%, #AD88FD 100%);
  124. background-clip: text;
  125. color: transparent;
  126. }
  127. .content .procedure_content.active > .name > span{
  128. background-image: unset;
  129. background-clip: unset;
  130. color: #fff;
  131. }
  132. .content .procedure_content > .stepBorder{
  133. position: absolute;
  134. width: 100%;
  135. height: 10px;
  136. border: 1px solid #FFFFFF59;
  137. background: #FFFFFF8C;
  138. left: 22px;
  139. top: 43px;
  140. box-sizing: border-box;
  141. }
  142. .content .procedure_content > .stepBorder.active{
  143. background: linear-gradient(90deg, #3673E8 0%, #AD88FD 100%);
  144. }
  145. </style>