index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <section class="cert-index">
  3. <h1>开发者资质认证</h1>
  4. <ul class="cers">
  5. <li class="cer" v-for="item of list" :key="item.id">
  6. <section class="cer-box">
  7. <img :src="item.img" alt="no-img" class="cer-img">
  8. <section class="cer-info">
  9. <h2 class="cer-title">{{item.name}}</h2>
  10. <div class="cer-remind">{{item.introduction}}</div>
  11. <section class="cer-price-info">
  12. <span class="price">
  13. ¥{{item.real_price}}
  14. <sub class="sub">/次</sub>
  15. </span>
  16. <span class="origin-price">原价¥{{item.origin_price}}</span>
  17. <span class="vip-tag" v-if="item.is_vip_discount">会员¥{{item.vip_price}}</span>
  18. </section>
  19. <section class="cert-status">
  20. <button class="cer-ctrl" :class="{disabled: btnDisabled(item)}" :disabled="btnDisabled(item)" @click="clickLancer(item)">{{item.btn_name}}</button>
  21. <span class="userful-time">{{item.end_date ? `有效期至${item.end_date}` : ''}}</span>
  22. </section>
  23. </section>
  24. </section>
  25. </li>
  26. </ul>
  27. </section>
  28. </template>
  29. <script>
  30. let page = 1
  31. export default {
  32. data() {
  33. return {
  34. title: '开发者资质认证- 程序员客栈',
  35. list: [],
  36. }
  37. },
  38. head () {
  39. return {
  40. title: this.title,
  41. meta: [
  42. { hid: 'description', name: 'description', content: 'My custom description' }
  43. ]
  44. }
  45. },
  46. mounted() {
  47. this.getList()
  48. },
  49. methods: {
  50. clickLancer({id}) {
  51. this.$router.push({
  52. path: '/cert/freelancer',
  53. query: {
  54. id,
  55. }
  56. })
  57. },
  58. btnDisabled(item) {
  59. return item.btn_name !== "申请认证"
  60. },
  61. async getList() {
  62. let res = await this.$post('/api/cert/getList', {page})
  63. if(res.status) {
  64. let list = res.data.list
  65. this.list = list
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style scoped>
  72. .cert-index {
  73. width: 1000px;
  74. height: 591px;
  75. background: white;
  76. border-radius: 4px;
  77. margin: 20px 0 0;
  78. padding: 8px;
  79. }
  80. h1 {
  81. font-size: 28px;
  82. font-weight: 500;
  83. color: rgba(29, 42, 58, 1);
  84. text-align: center;
  85. margin: 16px 12px 0;
  86. padding: 0 0 25px;
  87. border-bottom: 2px solid rgb(243, 243, 243);
  88. }
  89. .cers {
  90. padding: 20px 0 0;
  91. height: calc(100% - 75px);
  92. overflow-y: scroll;
  93. }
  94. .cer-box {
  95. display: flex;
  96. margin-top: 26px;
  97. }
  98. .cer-img {
  99. width: 270px;
  100. height: 190px;
  101. margin-right: 6px;
  102. }
  103. .cer-info {
  104. display: flex;
  105. flex-direction: column;
  106. }
  107. .cer-title {
  108. font-size: 18px;
  109. font-family: PingFangSC-Semibold;
  110. font-weight: 600;
  111. color: rgba(51, 51, 51, 1);
  112. line-height: 25px;
  113. }
  114. .cer-remind {
  115. width: 680px;
  116. overflow: hidden;
  117. text-overflow: ellipsis;
  118. white-space: nowrap;
  119. font-size: 14px;
  120. font-family: PingFangSC-Regular;
  121. color: rgba(153, 153, 153, 1);
  122. margin: 6px 0 18px;
  123. }
  124. .price {
  125. font-size: 24px;
  126. font-family: PingFangSC-Semibold;
  127. font-weight: 600;
  128. color: rgba(34, 34, 34, 1);
  129. }
  130. .sub {
  131. margin: 0 0 0 -6px;
  132. }
  133. .origin-price {
  134. font-size: 12px;
  135. font-family: PingFangSC-Regular;
  136. color: rgba(153, 153, 153, 1);
  137. line-height: 17px;
  138. text-decoration: line-through;
  139. }
  140. .vip-tag {
  141. display: inline-flex;
  142. justify-content: center;
  143. align-items: center;
  144. width: 72px;
  145. height: 22px;
  146. font-size: 12px;
  147. font-family: PingFangSC-Semibold;
  148. font-weight: 600;
  149. color: #ddaf5a;
  150. background: url(~@/assets/img/cert/vip-tag.png) 0 0 / 100% no-repeat;
  151. }
  152. .cer-ctrl {
  153. margin: 10px 0 0;
  154. width: 154px;
  155. height: 40px;
  156. background: #0093fd;
  157. font-size: 14px;
  158. font-family: PingFangSC-Medium;
  159. font-weight: 500;
  160. color: white;
  161. }
  162. .disabled {
  163. background: grey;
  164. }
  165. .userful-time {
  166. font-size: 13px;
  167. font-family: PingFangSC-Regular;
  168. color: rgba(153, 153, 153, 1);
  169. }
  170. </style>