浏览代码

[edit][定时器]

zhangwei 2 年之前
父节点
当前提交
71473a5cc0
共有 1 个文件被更改,包括 49 次插入25 次删除
  1. 49 25
      src/view/iframe/red-packet/luck-draw.vue

+ 49 - 25
src/view/iframe/red-packet/luck-draw.vue

@@ -207,11 +207,11 @@
                 <div class="mark-area">
                 <div class="mark-area">
                     <div class="time">
                     <div class="time">
                         <img :src="require('@/assets/svg/icon-time.svg')" />
                         <img :src="require('@/assets/svg/icon-time.svg')" />
-                        <span>24H</span>
+                        <span>{{ moment(state.detail.endTimestamp).format('HH:mm:ss') }}</span>
                     </div>
                     </div>
                     <div class="win">
                     <div class="win">
                         <img :src="require('@/assets/svg/icon-win.svg')" />
                         <img :src="require('@/assets/svg/icon-win.svg')" />
-                        <span>3 WINNERS</span>
+                        <span>{{ state.detail.totalCount }}WINNERS</span>
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
@@ -891,9 +891,8 @@ const reSetBindTwtterId = (_params) => {
 
 
 const showCloseEndTimePage = () => {
 const showCloseEndTimePage = () => {
     state.status = 'close'
     state.status = 'close'
-    state.close_status = '红包过期了'
+    state.close_status = '已经过期了'
     state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
     state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
-    state.open_timer_status = true
 }
 }
 
 
 const showCloseEndTimePageReport = () => {
 const showCloseEndTimePageReport = () => {
@@ -974,12 +973,13 @@ const handleStatusPage = () => {
     //    如果 任务完成状态 = 未完成
     //    如果 任务完成状态 = 未完成
     //         显示任务未完成页面
     //         显示任务未完成页面
     //    如果 任务完成状态 = 已经完成
     //    如果 任务完成状态 = 已经完成
-    //        如果 开奖时间 > 本地时间 & 红包状态 = 进行中
-    //            显示等待结果页面
-    //        否则如果 领取到红包金额 = 0 & 红包状态 = 已结束
+    //        如果 领取到红包金额 = 0 & 红包状态 = 已结束
     //            显示兔子页面
     //            显示兔子页面
-    //        否则 
+    //        否则如果 红包状态 = 已结束
     //            显示成功页面
     //            显示成功页面
+    //        如果 红包状态 = 进行中
+    //            显示等待结果页面
+
     //    如果 任务完成状态 = 已经过期
     //    如果 任务完成状态 = 已经过期
     //        如果 红包状态 = 进行中
     //        如果 红包状态 = 进行中
     //            显示未打开页面
     //            显示未打开页面
@@ -1015,20 +1015,20 @@ const handleStatusPage = () => {
             }
             }
             //如果 任务完成状态 = 已经完成
             //如果 任务完成状态 = 已经完成
         } else if (state.detail.myReceived.taskFinishStatus == 1) {
         } else if (state.detail.myReceived.taskFinishStatus == 1) {
-            // 如果 开奖时间 >= 本地时间 & 红包状态 = 进行中
-            if (state.detail.endTimestamp >= new Date().getTime() && state.detail.status == 1) {
-                // 显示等待结果页面
-                showLoadResult()
-                open_timer()
-            }
             // 领取到空红包 & 红包状态 = 已结束
             // 领取到空红包 & 红包状态 = 已结束
-            else if (state.receiveAmount == 0 && state.status == 2) {
+            if (state.receiveAmount == 0 && state.status == 2) {
                 showRabbitPage()
                 showRabbitPage()
                 showRabbitPageReport()
                 showRabbitPageReport()
-            } else {
+            } else if (state.detail.status == 2) {
                 // 显示成功页面
                 // 显示成功页面
                 showSuccessPage()
                 showSuccessPage()
             }
             }
+            // 如果  红包状态 = 进行中
+            else if (state.detail.status == 1) {
+                // 显示等待结果页面
+                showLoadResult()
+                open_timer()
+            }
             // 如果 任务完成状态 = 已经过期
             // 如果 任务完成状态 = 已经过期
         } else {
         } else {
             // 如果 红包状态 = 进行中
             // 如果 红包状态 = 进行中
@@ -1237,8 +1237,13 @@ const doTaskReport = (req, sender) => {
     }
     }
 }
 }
 
 
+let open_timer_flag = false
 // 倒计时开奖
 // 倒计时开奖
 const open_timer = () => {
 const open_timer = () => {
+    if (open_timer_flag) {
+        return
+    }
+    open_timer_flag = true
     let new_time
     let new_time
     let open_time
     let open_time
     let timer = setInterval(() => {
     let timer = setInterval(() => {
@@ -1384,15 +1389,9 @@ function handleFinishRedPacket() {
             postId: state.postId
             postId: state.postId
         }
         }
     }).then((res) => {
     }).then((res) => {
-        state.loading_show = false
         if (res.code == 0) {
         if (res.code == 0) {
             if (res.data.finished) {
             if (res.data.finished) {
                 state.receiveAmount = res.data.receiveAmount
                 state.receiveAmount = res.data.receiveAmount
-                if (state.receiveAmount == 0) {
-                    showRabbitPage()
-                } else {
-                    state.status = 'success'
-                }
                 init()
                 init()
                 // 埋点
                 // 埋点
                 Report.reportLog({
                 Report.reportLog({
@@ -1406,6 +1405,7 @@ function handleFinishRedPacket() {
                     get_giveaway_result: Report.extParams.success
                     get_giveaway_result: Report.extParams.success
                 });
                 });
             } else {
             } else {
+                state.loading_show = false
                 let _data = res.data.conditionResult
                 let _data = res.data.conditionResult
                 for (let i in _data) {
                 for (let i in _data) {
                     switch (_data[i].type.toString()) {
                     switch (_data[i].type.toString()) {
@@ -1489,6 +1489,7 @@ function handleFinishRedPacket() {
                 }
                 }
             }
             }
         } else {
         } else {
+            state.loading_show = false
             // 埋点
             // 埋点
             Report.reportLog({
             Report.reportLog({
                 pageSource: Report.pageSource.task_page,
                 pageSource: Report.pageSource.task_page,
@@ -1557,14 +1558,14 @@ function handleErrorCode(res) {
         // 红包金额已经被领取完了
         // 红包金额已经被领取完了
         case '2007':
         case '2007':
             state.status = 'close'
             state.status = 'close'
-            state.close_status = '红包过期了'
+            state.close_status = '已经过期了'
             state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
             state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
             init()
             init()
             break
             break
         // 红包个数已经被领取完了
         // 红包个数已经被领取完了
         case '2008':
         case '2008':
             state.status = 'close'
             state.status = 'close'
-            state.close_status = '红包过期了'
+            state.close_status = '已经过期了'
             state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
             state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
             init()
             init()
             break
             break
@@ -1899,6 +1900,29 @@ body {
     background-color: unset !important;
     background-color: unset !important;
 }
 }
 
 
+:deep() .ant-switch {
+    background-color: #E9ECEE;
+    height: 14px;
+    line-height: 16px;
+    min-width: 36px;
+}
+
+:deep() .ant-switch-checked {
+    background-color: #AED8F5 !important;
+}
+
+:deep() .ant-switch::after {
+    width: 20px;
+    height: 20px;
+    top: -4px;
+    left: -1px;
+}
+
+:deep() .ant-switch-checked::after {
+    background-color: #1D9BF0 !important;
+    margin-left: 3px;
+    left: 100% !important;
+}
 .content {
 .content {
     position: relative;
     position: relative;
     width: 375px;
     width: 375px;
@@ -2399,7 +2423,7 @@ body {
                 }
                 }
             }
             }
 
 
-        
+
 
 
             .notification_switch {
             .notification_switch {
                 border-top: 1px solid #EFEFEF;
                 border-top: 1px solid #EFEFEF;