index.vue 7.3 KB

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