| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- <template>
- <section class="cert-index">
- <h1>开发者资质认证</h1>
- <div class="hr"></div>
- <ul class="cers">
- <li class="cer" v-for="item of list" :key="item.id">
- <section class="cer-box" :class="{'cer-check': canApply(item)}">
- <img :src="item.img" alt="no-img" class="cer-img" @click="clickLancer(item)" />
- <section class="cer-info">
- <h2 class="cer-title" @click="clickLancer(item)">{{item.name}}认证</h2>
- <div class="cer-remind" @click="clickLancer(item)">{{item.introduction}}</div>
- <section class="cer-price-info">
- <span class="price">
- ¥{{item.real_price}}
- <sub class="sub">/次</sub>
- </span>
- <span v-if="item.is_discount" class="origin-price">原价¥{{item.origin_price}}</span>
- <span class="vip-tag" v-if="item.is_vip_discount">会员¥{{item.vip_price}}</span>
- </section>
- <section class="cert-status">
- <button
- class="cer-ctrl"
- :class="{disabled: btnDisabled(item)}"
- :disabled="btnDisabled(item)"
- @click="clickLancer(item)"
- >{{item.btn_name}}</button>
- <span class="userful-time" v-if="canApply(item)">
- 有效期至{{item.end_date}}
- <nuxt-link class="link-check" :to="`/cert/no/${item.cert_no}`">查看证书</nuxt-link>
- </span>
- </section>
- </section>
- </section>
- <div class="line"></div>
- </li>
- </ul>
- </section>
- </template>
- <script>
- import WxMixin from "@/mixins/wx";
- let page = 1;
- export default {
- data() {
- return {
- title: "开发者资质认证- 程序员客栈",
- list: []
- };
- },
- head() {
- return {
- title: this.title,
- script: [{ src: "https://res.wx.qq.com/open/js/jweixin-1.2.0.js" }]
- };
- },
- mixins: [WxMixin],
- mounted() {
- this.getList();
- },
- methods: {
- clickLancer({ id }) {
- this.$router.push(`/cert/type/${id}`);
- },
- btnDisabled(item) {
- return item.btn_name !== "申请认证" || !item.can_click;
- },
- async getList() {
- let res = await this.$axios.$post(
- "/api/cert/getList",
- { page },
- { neverLogout: true }
- );
- if (res.status) {
- let list = res.data.list;
- this.list = list;
- }
- },
- canApply(item) {
- return item.end_date && item.is_cert_validate && item.cert_no;
- },
- configWx() {
- try {
- let conf = this.$store.state.wxConfig;
- wx.ready(function() {
- //需在用户可能点击分享按钮前就先调用
- wx.config({
- debug: true,
- appId: conf.appId,
- timestamp: conf.timestamp,
- nonceStr: conf.nonceStr,
- signature: conf.signature,
- jsApiList: [
- // 所有要调用的 API 都要加到这个列表中
- "onMenuShareTimeline", // 分享到朋友圈接口
- "onMenuShareAppMessage", // 分享到朋友接口
- "onMenuShareQQ", // 分享到QQ接口
- "onMenuShareWeibo" // 分享到微博接口
- ],
- success: function() {
- alert("wx.config ok");
- },
- error: function(d) {
- alert("wx.config err:" + JSON.stringify(d));
- }
- });
- wx.updateAppMessageShareData({
- title: "开发者资质认证", // 分享标题
- desc: "通过平台审核、认证,将获得更多接单机会", // 分享描述
- link: location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
- imgUrl: "https://stacdn.proginn.com/favicon.ico", // 分享图标
- success: function() {
- // 设置成功
- alert("微信图标设置成功");
- }
- });
- });
- } catch (error) {
- alert(error);
- }
- }
- }
- };
- </script>
- <style scoped>
- @import "@/assets/css/h1_line.css";
- .cert-index {
- width: 100%;
- max-width: 1000px;
- min-height: 591px;
- background: white;
- border-radius: 4px;
- margin: 20px 0 0;
- padding: 8px;
- overflow-x: hidden;
- }
- .cers {
- padding: 20px 0 0;
- }
- .cers::-webkit-scrollbar {
- display: none;
- }
- .cer-box {
- position: relative;
- display: flex;
- margin-top: 26px;
- }
- .cer-img {
- width: 270px;
- height: 190px;
- margin-right: 6px;
- box-sizing: border-box;
- padding: 20px;
- cursor: pointer;
- }
- .cer-info {
- display: flex;
- flex-direction: column;
- }
- .cer-title {
- font-size: 18px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- color: rgba(51, 51, 51, 1);
- line-height: 25px;
- margin-top: 20px;
- cursor: pointer;
- }
- .cer-title:hover {
- color: #308eff;
- }
- .cer-remind {
- font-size: 14px;
- font-family: PingFangSC-Regular;
- color: rgba(153, 153, 153, 1);
- margin: 6px 0 18px;
- }
- .price {
- font-size: 24px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- color: rgba(34, 34, 34, 1);
- }
- .sub {
- margin: 0 0 0 -6px;
- }
- .origin-price {
- font-size: 12px;
- font-family: PingFangSC-Regular;
- color: rgba(153, 153, 153, 1);
- line-height: 17px;
- text-decoration: line-through;
- }
- .vip-tag {
- display: inline-flex;
- justify-content: center;
- align-items: center;
- width: 72px;
- height: 22px;
- font-size: 12px;
- font-family: PingFangSC-Semibold;
- font-weight: 600;
- color: #ddaf5a;
- background: url(~@/assets/img/cert/vip-tag.png) 0 0 / 100% no-repeat;
- padding: 0;
- }
- .cer-ctrl {
- margin: 10px 0 0;
- height: 40px;
- background: #0093fd;
- font-size: 14px;
- font-family: PingFangSC-Medium;
- font-weight: 500;
- color: white;
- }
- .disabled {
- background: #ececec;
- color: #666;
- }
- .userful-time {
- font-size: 13px;
- font-family: PingFangSC-Regular;
- color: rgba(153, 153, 153, 1);
- }
- .link-check {
- color: var(--mainColor);
- }
- /* 以下为了兼容移动端,样式比较坑,注意。 */
- @media screen and (min-width: 960px) {
- .cer-remind {
- width: 680px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .cer-ctrl {
- width: 154px;
- }
- }
- @media screen and (max-width: 960px) {
- .cert-index {
- padding: 0;
- }
- .cer-box {
- height: 160px;
- padding: 0 8px;
- }
- .cer-check {
- height: 200px;
- }
- .cer-img {
- width: 135px;
- height: 90px;
- padding: 0;
- }
- .cer-info {
- flex: 1;
- }
- .cer-title {
- margin-top: 0;
- }
- .cer-remind {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
- font-size: 12px;
- min-height: 48px;
- }
- .cer-price-info {
- position: absolute;
- left: 8px;
- top: 114px;
- }
- .cert-status {
- text-align: right;
- }
- .cer-ctrl {
- width: 100px;
- border-radius: 40px;
- }
- .userful-time {
- position: absolute;
- bottom: 0px;
- left: 0;
- display: flex;
- justify-content: space-between;
- width: 100%;
- border-top: 1px solid #eee;
- padding: 14px;
- }
- .line {
- height: 8px;
- background: #eee;
- }
- }
- </style>
|