index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <section class="cert-index">
  3. <h1>开发者资质认证</h1>
  4. <div class="hr"></div>
  5. <ul class="cers">
  6. <li class="cer" v-for="item of list" :key="item.id">
  7. <section class="cer-box" :class="{'cer-check': canApply(item)}">
  8. <img :src="item.img" alt="no-img" class="cer-img" @click="clickLancer(item)" />
  9. <section class="cer-info">
  10. <h2 class="cer-title" @click="clickLancer(item)">{{item.name}}认证</h2>
  11. <div class="cer-remind" @click="clickLancer(item)">{{item.introduction}}</div>
  12. <section v-if="item.id!=23" class="cer-price-info">
  13. <span class="price">
  14. ¥{{item.real_price}}
  15. <sub class="sub">/次</sub>
  16. </span>
  17. <span v-if="item.is_discount" class="origin-price">原价¥{{item.origin_price}}</span>
  18. <span class="vip-tag" v-if="item.is_vip_discount">会员¥{{item.vip_price}}</span>
  19. </section>
  20. <section class="cert-status">
  21. <button
  22. class="cer-ctrl"
  23. :class="{disabled: btnDisabled(item)}"
  24. :disabled="btnDisabled(item)"
  25. @click="clickLancer(item,item)"
  26. >{{item.btn_name}}</button>
  27. <span class="userful-time" v-if="canApply(item)">
  28. 有效期至{{item.end_date}}
  29. <nuxt-link class="link-check" :to="`/cert/no/${item.cert_no}`">查看证书</nuxt-link>
  30. </span>
  31. </section>
  32. </section>
  33. </section>
  34. <div class="line"></div>
  35. </li>
  36. </ul>
  37. </section>
  38. </template>
  39. <script>
  40. import WxMixin from "@/mixins/wx";
  41. let page = 1;
  42. export default {
  43. data() {
  44. return {
  45. title: "开发者资质认证- 程序员客栈",
  46. list: []
  47. };
  48. },
  49. head() {
  50. return {
  51. title: this.title,
  52. script: [{ src: "https://res.wx.qq.com/open/js/jweixin-1.2.0.js" }]
  53. };
  54. },
  55. mixins: [WxMixin],
  56. mounted() {
  57. this.getList();
  58. },
  59. methods: {
  60. clickLancer({ id },{ name }) {
  61. this.cnzz("开发者资质认证",name,"")
  62. if(id!=23)
  63. {
  64. this.$router.push(`/cert/type/${id}`);
  65. }
  66. else
  67. {
  68. this.$router.push(`/frontend/skill_cert/profile`);
  69. }
  70. },
  71. btnDisabled(item) {
  72. return item.btn_name !== "申请认证" || !item.can_click;
  73. },
  74. async getList() {
  75. let res = await this.$axios.$post(
  76. "/api/cert/getList",
  77. { page },
  78. { neverLogout: true }
  79. );
  80. if (res.status) {
  81. let list = res.data.list;
  82. this.list = list;
  83. }
  84. },
  85. canApply(item) {
  86. return item.end_date && item.is_cert_validate && item.cert_no;
  87. },
  88. configWx() {
  89. try {
  90. let conf = this.$store.state.wxConfig;
  91. wx.ready(function() {
  92. //需在用户可能点击分享按钮前就先调用
  93. wx.config({
  94. debug: true,
  95. appId: conf.appId,
  96. timestamp: conf.timestamp,
  97. nonceStr: conf.nonceStr,
  98. signature: conf.signature,
  99. jsApiList: [
  100. // 所有要调用的 API 都要加到这个列表中
  101. "onMenuShareTimeline", // 分享到朋友圈接口
  102. "onMenuShareAppMessage", // 分享到朋友接口
  103. "onMenuShareQQ", // 分享到QQ接口
  104. "onMenuShareWeibo" // 分享到微博接口
  105. ],
  106. success: function() {
  107. alert("wx.config ok");
  108. },
  109. error: function(d) {
  110. alert("wx.config err:" + JSON.stringify(d));
  111. }
  112. });
  113. wx.updateAppMessageShareData({
  114. title: "开发者资质认证", // 分享标题
  115. desc: "通过平台审核、认证,将获得更多接单机会", // 分享描述
  116. link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  117. imgUrl: "https://stacdn.proginn.com/favicon.ico", // 分享图标
  118. success: function() {
  119. // 设置成功
  120. alert("微信图标设置成功");
  121. }
  122. });
  123. });
  124. } catch (error) {
  125. alert(error);
  126. }
  127. }
  128. }
  129. };
  130. </script>
  131. <style scoped>
  132. @import "@/assets/css/h1_line.css";
  133. .cert-index {
  134. width: 100%;
  135. max-width: 1000px;
  136. min-height: 591px;
  137. background: white;
  138. border-radius: 4px;
  139. margin: 20px 0 0;
  140. padding: 8px;
  141. overflow-x: hidden;
  142. }
  143. .cers {
  144. padding: 20px 0 0;
  145. }
  146. .cers::-webkit-scrollbar {
  147. display: none;
  148. }
  149. .cer-box {
  150. position: relative;
  151. display: flex;
  152. margin-top: 26px;
  153. }
  154. .cer-img {
  155. width: 270px;
  156. height: 190px;
  157. margin-right: 6px;
  158. box-sizing: border-box;
  159. padding: 20px;
  160. cursor: pointer;
  161. }
  162. .cer-info {
  163. display: flex;
  164. flex-direction: column;
  165. }
  166. .cer-title {
  167. font-size: 18px;
  168. font-family: PingFangSC-Semibold;
  169. font-weight: 600;
  170. color: rgba(51, 51, 51, 1);
  171. line-height: 25px;
  172. margin-top: 20px;
  173. cursor: pointer;
  174. }
  175. .cer-title:hover {
  176. color: #308eff;
  177. }
  178. .cer-remind {
  179. font-size: 14px;
  180. font-family: PingFangSC-Regular;
  181. color: rgba(153, 153, 153, 1);
  182. margin: 6px 0 18px;
  183. }
  184. .price {
  185. font-size: 24px;
  186. font-family: PingFangSC-Semibold;
  187. font-weight: 600;
  188. color: rgba(34, 34, 34, 1);
  189. }
  190. .sub {
  191. margin: 0 0 0 -6px;
  192. }
  193. .origin-price {
  194. font-size: 12px;
  195. font-family: PingFangSC-Regular;
  196. color: rgba(153, 153, 153, 1);
  197. line-height: 17px;
  198. text-decoration: line-through;
  199. }
  200. .vip-tag {
  201. display: inline-flex;
  202. justify-content: center;
  203. align-items: center;
  204. width: 72px;
  205. height: 22px;
  206. font-size: 12px;
  207. font-family: PingFangSC-Semibold;
  208. font-weight: 600;
  209. color: #ddaf5a;
  210. background: url(~@/assets/img/cert/vip-tag.png) 0 0 / 100% no-repeat;
  211. padding: 0;
  212. }
  213. .cer-ctrl {
  214. margin: 10px 0 0;
  215. height: 40px;
  216. background: #0093fd;
  217. font-size: 14px;
  218. font-family: PingFangSC-Medium;
  219. font-weight: 500;
  220. color: white;
  221. }
  222. .disabled {
  223. background: #ececec;
  224. color: #666;
  225. }
  226. .userful-time {
  227. font-size: 13px;
  228. font-family: PingFangSC-Regular;
  229. color: rgba(153, 153, 153, 1);
  230. }
  231. .link-check {
  232. color: var(--mainColor);
  233. }
  234. /* 以下为了兼容移动端,样式比较坑,注意。 */
  235. @media screen and (min-width: 960px) {
  236. .cer-remind {
  237. width: 680px;
  238. overflow: hidden;
  239. text-overflow: ellipsis;
  240. white-space: nowrap;
  241. }
  242. .cer-ctrl {
  243. width: 154px;
  244. }
  245. }
  246. @media screen and (max-width: 960px) {
  247. .cert-index {
  248. padding: 0;
  249. }
  250. .cer-box {
  251. height: 160px;
  252. padding: 0 8px;
  253. }
  254. .cer-check {
  255. height: 200px;
  256. }
  257. .cer-img {
  258. width: 135px;
  259. height: 90px;
  260. padding: 0;
  261. }
  262. .cer-info {
  263. flex: 1;
  264. }
  265. .cer-title {
  266. margin-top: 0;
  267. }
  268. .cer-remind {
  269. display: -webkit-box;
  270. -webkit-box-orient: vertical;
  271. -webkit-line-clamp: 3;
  272. font-size: 12px;
  273. min-height: 48px;
  274. }
  275. .cer-price-info {
  276. position: absolute;
  277. left: 8px;
  278. top: 114px;
  279. }
  280. .cert-status {
  281. text-align: right;
  282. }
  283. .cer-ctrl {
  284. width: 100px;
  285. border-radius: 40px;
  286. }
  287. .userful-time {
  288. position: absolute;
  289. bottom: 0px;
  290. left: 0;
  291. display: flex;
  292. justify-content: space-between;
  293. width: 100%;
  294. border-top: 1px solid #eee;
  295. padding: 14px;
  296. }
  297. .line {
  298. height: 8px;
  299. background: #eee;
  300. }
  301. }
  302. </style>