XUYangWei 2 hónapja
szülő
commit
faad477f3d

+ 16 - 3
features/feature/src/main/ets/view/MainView.ets

@@ -110,6 +110,7 @@ export struct MainView{
 
   @State inversetId:number=-1
 
+  @State timeCountID:number=-1
   @State timeShow:number=0
 
   private formatTime(totalSeconds: number): string {
@@ -196,6 +197,7 @@ export struct MainView{
 
       //判断是否自动并设置敲击时间
       clearInterval(this.inversetId)
+      clearInterval(this.timeCountID)
       //自动敲击
 
       this.autoOnclick()
@@ -268,9 +270,11 @@ export struct MainView{
 
   }
 
+
   //自动敲击
   autoOnclick(){
     clearInterval(this.inversetId)
+    clearInterval(this.timeCountID)
     if(this.woodenfishModel==1){
       this.isAuto=false
     }else if(this.woodenfishModel==2){
@@ -282,6 +286,7 @@ export struct MainView{
         // this.onclikMerit()
         if(this.fixedNum<=0){
           clearInterval(this.inversetId)
+          clearInterval(this.timeCountID)
           return
         }
         this.onclikMerit()
@@ -290,16 +295,18 @@ export struct MainView{
         YTUserRequest.updateFishFixWoodenModel({fixedNum:this.fixedNum,fixedTime:this.fixedTime})
       },this.fixedTime*1000)
     }else if(this.woodenfishModel==4){
+      this.timeCountID=setInterval(()=>{
+        this.timeShow=(this.countdownHour*60-1)
+        this.countdownHour=this.timeShow/60
+      },1000)
       this.inversetId=setInterval(()=>{
         if(this.countdownCount=='0'){
           clearInterval(this.inversetId)
+          clearInterval(this.timeCountID)
           return
         }
         this.onclikMerit()
-
         this.countdownCount=(Number(this.countdownCount)-1).toString()
-        this.timeShow=(this.countdownHour*60-(this.countdownTime))
-        this.countdownHour=this.timeShow/60
         YTUserRequest.updateFishCountDownWoodenModel({
           countdownHour:this.countdownHour,
           countdownTime:this.countdownTime
@@ -310,6 +317,7 @@ export struct MainView{
         //时间减少
 
       },this.countdownTime*1000)
+
     }
 
   }
@@ -663,6 +671,7 @@ export struct MainView{
                               this.woodenfishModel=1
                               YTUserRequest.updateCloseFishWoodenModel({})
                               clearInterval(this.inversetId)
+                              clearInterval(this.timeCountID)
 
                             }
                           })
@@ -679,10 +688,12 @@ export struct MainView{
                               .backgroundColor('#252111')
                               .onClick(() => {
                                 clearInterval(this.inversetId)
+                                clearInterval(this.timeCountID)
                                 this.isAuto = !this.isAuto
                                 if(this.isAuto==false){
                                   this.woodenfishModel=1
                                   clearInterval(this.inversetId)
+                                  clearInterval(this.timeCountID)
                                   YTUserRequest.updateCloseFishWoodenModel({})
                                 }
                               })
@@ -709,6 +720,7 @@ export struct MainView{
                               .onClick(() => {
                                 this.isShowTimeManger = true
                                 clearInterval(this.inversetId)
+                                clearInterval(this.timeCountID)
                                 // this.woodenfishModel=2
                                 // YTUserRequest.getFishFra((res)=>{
                                 //
@@ -779,6 +791,7 @@ export struct MainView{
       if (!isVisible) {
         //每次隐藏时关闭定时器
         clearInterval(this.inversetId)
+        clearInterval(this.timeCountID)
       }else{
         if(this.woodenfishModel==1){
 

+ 1 - 0
features/feature/src/main/ets/view/xxx.ets

@@ -178,6 +178,7 @@ export struct TextView{
 
       //判断是否自动并设置敲击时间
       clearInterval(this.inversetId)
+      // clearInterval(this.timeCountID)
       //自动敲击
 
       this.autoOnclick()