| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <template>
- <div class="activity-area">
- <div class="activity-container">
- <div class="activity-title">
- <span class="text">100%接单限时活动</span>
- <span v-if="isShowCountDown" class="count-time">(剩余{{ text }})</span>
- </div>
- <div class="activity-list">
- <div class="activity-item">
- <h6>活动1(默认参与):不接单全额退+赠送会员</h6>
- <p>
- * 完成认证后,2个月内未成功接单,退还全部认证费用,并保留认证权益<br />
- * 参与认证,赠送1个月<a
- href="/type/vip/developer"
- class="color-4D81BF"
- >开发者会员</a
- >
- </p>
- </div>
- <div class="activity-item">
- <h6>活动2(提交时勾选即可):先认证,接单后</h6>
- <p>
- * 先进行认证,成功接单后再扣除150%的认证费用
- </p>
- </div>
- </div>
- <div class="activity-tips">
- 备注:活动1和活动2只能参与1个<br />
- 活动时间:2022年4月10日0点—2022年5月10日0点
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- // 模拟结束时间,4月10号0点
- endTime: 0,
- pageNow: Date.now(),
- serverTime: Date.now(),
- text: "",
- timer: null,
- isShowCountDown:false
- };
- },
- mounted() {
- this.fetchActivityTime()
- },
- methods: {
- async fetchActivityTime(){
- let result = await this.$axios.$post("/uapi/cert/info");
- if(result.status == 1){
- let {
- endtime
- } = result.data
- this.pageNow = Date.now();
- // 测试倒计时
- // endtime = 10
- if(endtime >0){
- this.isShowCountDown = true
- }else{
- this.isShowCountDown = false
- return
- }
- this.endTime = endtime * 1000
- this.timer = setInterval(() => {
- let now = Date.now();
- let desc = now - this.pageNow;
- let countDown = this.endTime - desc;
- if(countDown <= 0){
- this.isShowCountDown = false
- this.clearTimer()
- }
- this.parseCountDownText(countDown);
- }, 1000);
-
- }
- },
- clearTimer() {
- clearInterval(this.timer);
- this.timer = null;
- },
- // 以毫秒作为单位
- parseCountDownText(countDown) {
- // 转换秒为单位
- let countDownTime = Math.ceil(countDown / 1000);
- let day = parseInt(countDownTime / (24 * 60 * 60), 10);
- let dayText = day;
- countDownTime = countDownTime - day * 24 * 60 * 60;
- let hour = parseInt(countDownTime / (60 * 60), 10);
- let hourText = hour > 9 ? hour : "0" + hour;
- countDownTime = countDownTime - hour * 60 * 60;
- let minute = parseInt(countDownTime / 60, 10);
- let minuteText = minute > 9 ? minute : "0" + minute;
- countDownTime = countDownTime - minute * 60;
- let second = countDownTime;
- let text = `${dayText}天${hourText}小时${minuteText}分钟${second}秒`;
- this.text = text;
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .activity-area {
- width: 100%;
- }
- .activity-container {
- min-width: 670px;
- // background: #fff6f4 url("~@/assets/img/skill_cert/bg22.png") no-repeat 50% top;
- // background-size: 1048px auto;
- padding-bottom: 20px;
- background: #fff7f4;
- padding-top: 70px;
- position: relative;
- }
- %bg {
- content: "";
- position: absolute;
- top: 0;
- bottom: 0;
- width: 85px;
- z-index: 2;
- }
- .activity-title {
- position: absolute;
- z-index: 3;
- top: -10px;
- left: 50%;
- transform: translateX(-50%);
- height: 50px;
- width: 430px;
- text-align: center;
- font-size: 22px;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- color: #ffffff;
- line-height: 50px;
- text-shadow: 0px 2px 4px #ff5530;
- text-align: center;
- background: url("~@/assets/img/skill_cert/bg_c.png") repeat left top;
- .count-time {
- font-size: 16px;
- font-weight: normal !important;
- font-family: PingFangSC-Regular, PingFang SC;
- }
- &::before {
- @extend %bg;
- left: 3px;
- transform: translateX(-100%);
- background: url("~@/assets/img/skill_cert/pc_l.png") no-repeat left top;
- background-size: cover;
- }
- &::after {
- @extend %bg;
- right: 3px;
- width: 88px;
- transform: translateX(100%);
- background: url("~@/assets/img/skill_cert/pc_r.png") no-repeat right top;
- background-size: cover;
- }
- }
- .activity-list {
- // margin-top: 40px;
- margin-left: 30px;
- margin-right: 30px;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- }
- .activity-item {
- width: 48.7%;
- padding: 20px;
- border: 1px dashed #ff844f;
- background-color: #fff;
- border-radius: 16px;
- h6 {
- font-size: 15px;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- color: #ff4d27;
- line-height: 21px;
- }
- p {
- font-size: 15px;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #0b121a;
- line-height: 24px;
- margin-top: 14px;
- }
- }
- .color-4D81BF {
- color: #4d81bf;
- }
- .activity-tips {
- margin-left: 30px;
- margin-top: 18px;
- font-size: 14px;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #666666;
- line-height: 24px;
- }
- @media screen and (max-width: 670px) {
- .activity-container {
- min-width: inherit;
- }
- .activity-list {
- display: block;
- }
- .activity-item {
- width: auto;
- margin-bottom: 30px;
- }
- .activity-title {
- height: auto;
- width:auto;
- line-height: 1;
- padding:7px 10px;
- background: url("~@/assets/img/skill_cert/m_bg.png") repeat left top;
- &::before {
- background: url("~@/assets/img/skill_cert/m_l.png") no-repeat left top;
- background-size: cover;
- width:44px;
- left:0;
- }
- &::after{
- background: url("~@/assets/img/skill_cert/m_r.png") no-repeat left top;
- background-size: auto 100%;
- width:50px
- }
- span {
- display: block;
- }
- .text {
- font-size: 20px;
- font-family: PingFangSC-Medium, PingFang SC;
- font-weight: 500;
- color: #ffffff;
- line-height: 28px;
- text-shadow: 0px 2px 4px #ff5530;
- }
- .count-time {
- margin-top: 2px;
- font-size: 14px;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: rgba(255, 255, 255, 0.8);
- line-height: 20px;
- width:180px;
- text-align: center;
- }
- }
- }
- </style>
|