index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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" @click="clickLancer(item)">
  8. <section class="cer-info">
  9. <h2 class="cer-title" @click="clickLancer(item)">{{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" v-if='item.end_date && item.is_cert_validate && item.cert_no'>有效期至{{item.end_date}}<a :href="`/cert/id?no=${item.cert_no}`">查看证书</a></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 !== "申请认证" || !item.can_click
  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. min-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. overflow-y: scroll;
  92. }
  93. .cer-box {
  94. display: flex;
  95. margin-top: 26px;
  96. }
  97. .cer-img {
  98. width: 270px;
  99. height: 190px;
  100. margin-right: 6px;
  101. box-sizing: border-box;
  102. padding: 20px;
  103. cursor: pointer;
  104. }
  105. .cer-info {
  106. display: flex;
  107. flex-direction: column;
  108. }
  109. .cer-title {
  110. font-size: 18px;
  111. font-family: PingFangSC-Semibold;
  112. font-weight: 600;
  113. color: rgba(51, 51, 51, 1);
  114. line-height: 25px;
  115. margin-top: 20px;
  116. cursor: pointer;
  117. }
  118. .cer-title:hover {
  119. color: blue;
  120. }
  121. .cer-remind {
  122. width: 680px;
  123. overflow: hidden;
  124. text-overflow: ellipsis;
  125. white-space: nowrap;
  126. font-size: 14px;
  127. font-family: PingFangSC-Regular;
  128. color: rgba(153, 153, 153, 1);
  129. margin: 6px 0 18px;
  130. }
  131. .price {
  132. font-size: 24px;
  133. font-family: PingFangSC-Semibold;
  134. font-weight: 600;
  135. color: rgba(34, 34, 34, 1);
  136. }
  137. .sub {
  138. margin: 0 0 0 -6px;
  139. }
  140. .origin-price {
  141. font-size: 12px;
  142. font-family: PingFangSC-Regular;
  143. color: rgba(153, 153, 153, 1);
  144. line-height: 17px;
  145. text-decoration: line-through;
  146. }
  147. .vip-tag {
  148. display: inline-flex;
  149. justify-content: center;
  150. align-items: center;
  151. width: 72px;
  152. height: 22px;
  153. font-size: 12px;
  154. font-family: PingFangSC-Semibold;
  155. font-weight: 600;
  156. color: #ddaf5a;
  157. background: url(~@/assets/img/cert/vip-tag.png) 0 0 / 100% no-repeat;
  158. }
  159. .cer-ctrl {
  160. margin: 10px 0 0;
  161. width: 154px;
  162. height: 40px;
  163. background: #0093fd;
  164. font-size: 14px;
  165. font-family: PingFangSC-Medium;
  166. font-weight: 500;
  167. color: white;
  168. }
  169. .disabled {
  170. background: grey;
  171. }
  172. .userful-time {
  173. font-size: 13px;
  174. font-family: PingFangSC-Regular;
  175. color: rgba(153, 153, 153, 1);
  176. }
  177. </style>