Explorar el Código

修改倒计时显示问题

lhl hace 4 años
padre
commit
17c26de6a4

+ 7 - 0
components/uni-countdown/uni-countdown.vue

@@ -53,6 +53,10 @@
 			second: {
 				type: Number,
 				default: 0
+			},
+			index: {
+				type:Number,
+				default: 0
 			}
 		},
 		data() {
@@ -136,6 +140,9 @@
 						return
 					}
 					this.countDown()
+					if(this.d === '00' && this.h === '00' && this.i === '00' && this.s === '00'){
+						this.$emit('timeover',this.index)
+					}
 				}, 1000)
 			},
 			changeFlag() {

+ 9 - 1
pages/calculation/myCalculation.vue

@@ -37,6 +37,8 @@
 								:hour="ls.stopTimeH"
 								:minute="ls.stopTimeM"
 								:second="ls.stopTimeS"
+								:index="index"
+								@timeover="isTime"
 							></uni-countdown></view>
 			</view>
 			<!-- <view class="cell-info flex">
@@ -89,8 +91,11 @@ export default {
 					if (ar.status === 0) {
 						// 计算倒计时时间
 						obj.timeComputed(ar.mining_start_time * 1000, ar);
+						console.log(ar.stopTimeD)
 					} else {
+						console.log('++++++++++')
 						// 获取距离开始还需要多少时间
+						if( ar.time){
 						let arTime = ar.time.split(':');
 						let h = arTime[0];
 						let m = arTime[1];
@@ -98,7 +103,7 @@ export default {
 						// 设置时间
 						time.setHours(h, m, 0);
 						// 计算倒计时时间
-						obj.timeComputed(time.getTime(), ar);
+						obj.timeComputed(time.getTime(), ar);}
 					}
 					
 					return e;
@@ -115,6 +120,9 @@ export default {
 			ar.stopTimeH = stopTime.hours;
 			ar.stopTimeM = stopTime.minutes;
 			ar.stopTimeS = stopTime.seconds;
+		},
+		isTime(index) {
+			this.list[index].status = 1
 		}
 	}
 };