Browse Source

fish打包

XUYangWei 2 months ago
parent
commit
d3cbdd2f8f

+ 1 - 0
commons/basic/src/main/ets/apis/YTRequest.ets

@@ -13,6 +13,7 @@ import { promptAction } from '@kit.ArkUI';
 
 
 // export const baseURL: string = 'https://hm-test.ytpm.net/prod-api'
+// https://hm.ytpm.net/prod-woodenfish/doc.html#/home
 
 export const baseURL: string = 'http://8.139.252.157:9009'
 // export const baseURL: string = 'https://hm.ytpm.net/prod-decision/decisionApUser'

+ 4 - 0
commons/basic/src/main/ets/models/UserInfo.ets

@@ -151,6 +151,10 @@ export class UserInfo {
   getMerit(){
     return userInfo.meritsTotal
   }
+  setMerit(merits:string){
+    userInfo.meritsTotal=merits
+    AppStorage.setOrCreate(UserInfo.KEY, userInfo)
+  }
 
   setPhoneNumber(phoneNumber: string) {
     userInfo.memberPhone = phoneNumber

+ 9 - 1
commons/basic/src/main/ets/utils/VibrationUtils.ets

@@ -3,7 +3,15 @@ import { vibrator } from '@kit.SensorServiceKit'
 
 
 export class Vibration{
-  // 开启震动
+  // 开启震动,可以设置时间震动时长,usage就是震动是用来做什么的
+  /**
+   * {
+   type: 'preset',
+   effectId: 'haptic.notice.success',
+   count: 1,  //马达震动的个数
+   },
+   */
+  //type Usage = 'unknown' | 'alarm' | 'ring' | 'notification' | 'communication' | 'touch' | 'media' | 'physicalFeedback' | 'simulateReality';
   static startVibration() {
     vibrator.startVibration({ type: 'time', duration: 200 }, { usage: 'touch' })
   }

+ 33 - 2
features/feature/src/main/ets/view/FragranceView.ets

@@ -108,6 +108,8 @@ export struct FragranceView{
 
   //获取香烟数量和燃烧时间
   updateNumAndTime(){
+    //-----
+    //时间结束之后,再打开还有烟得位置
     YTUserRequest.getFishFra((res)=>{
       const time=res.incenseTime as number
       if(time==10){
@@ -129,6 +131,7 @@ export struct FragranceView{
       // const jsonString = inputString.replace(/'/g, '"') as string
       this.textArr = this.parseStringArray(inputString)
 
+
       this.startDownTime(this.countTime)
       this.caluePosition()
 
@@ -157,7 +160,13 @@ export struct FragranceView{
           clearInterval(this.interId)
           this.imageIndex=20
           this.isShow=false
+          return
           // this.moveY=160
+        }else if(this.countTime<=0){
+          clearInterval(this.interId)
+          this.imageIndex=20
+          this.isShow=false
+          return
         }
 
         this.moveY = this.moveY + 8
@@ -173,12 +182,14 @@ export struct FragranceView{
       this.timeTextCountDown='不限时'
       return
     }
-    let t=time*60
+    let t=(Math.floor(time))*60
     // this.timeTextCountDown=(time*60).toString()
     // this.formatTime(t)
     this.interIdTimeCountDown=setInterval(()=>{
-      if(t==0){
+      if(t<=0){
         this.timeTextCountDown="00:00"
+        this.isShow=false
+        this.imageIndex=20
         return
       }
 
@@ -528,6 +539,26 @@ export struct FragranceView{
        this.updateNumAndTime()
         // this.caluePosition()
         // this.startDownTime(this.time)
+      }else{
+        //消失计算
+        if(this.moveY>=160){
+          this.isShow=false
+          this.moveY=160
+        }
+        if(this.imageIndex>=20){
+          this.imageIndex=20
+          this.isShow=false
+          this.moveY=160
+        }
+        if(this.imageIndex<20){
+          //更新到下一个状态
+          this.imageIndex=this.imageIndex+1
+          this.moveY=this.moveY+8
+          // this.countTime=this.countTime-0.5
+        }
+        clearInterval(this.intervalID);
+        clearInterval(this.interIdTimeCountDown)
+        clearInterval(this.interId)
       }
     })
   }

+ 29 - 6
features/feature/src/main/ets/view/MainView.ets

@@ -100,7 +100,7 @@ export struct MainView{
   @State currentMerit:number=0
   //总功德数
   @State totalMerit:number=10
-  private Merit:number[]=[10,200,500,1000,2000,5000,6000,8000]
+  private Merit:number[]=[10,200,500,1000,2000,5000,6000,8000,9000,9999]
   private MeritIndex:number=0
 
   //自动点击缩放参数
@@ -129,6 +129,13 @@ export struct MainView{
   })
 
   total(){
+    if(this.currentMerit==9999){
+      this.currentMerit = 0
+      this.totalMerit=this.Merit[0]
+      YTUserRequest.resetMainFish()
+      return
+    }
+
     if(this.currentMerit>this.totalMerit){
       this.MeritIndex++
       this.totalMerit=this.Merit[this.MeritIndex]
@@ -141,6 +148,9 @@ export struct MainView{
     for (let i = 0; i < this.count; i++) {
       this.list.push(new Cell()); // 初始化 Cell 数组
     }
+    if(this.text!="") {
+      this.list.forEach(item => item.value = this.text)
+    }
     YTUserRequest.getFishFra((res)=>{
 
       // promptAction.showToast({
@@ -415,7 +425,7 @@ export struct MainView{
 
                 })
 
-              }.width('100%').borderRadius(8).padding(20).backgroundColor('rgba(77, 77, 77, 1)')
+              }.width('100%').borderRadius(8).padding(10).backgroundColor('rgba(77, 77, 77, 1)')
 
             }.layoutWeight(1).justifyContent(FlexAlign.Start)
 
@@ -495,10 +505,10 @@ export struct MainView{
 
 
 
+
   clockFish(){
     YTUserRequest.knockingFish()
   }
-
   build() {
     Stack() {
       Image($r('[basic].media.dengguang')).width('100%').height('100%')
@@ -613,11 +623,12 @@ export struct MainView{
                   if (this.isShowSilder) {
                     //是否开启声音
                     Image($r('[basic].media.zhendong')).width(32).onClick(() => {
-                      this.isOpenMusic = !this.isOpenMusic
+                      this.isOpenVibration = !this.isOpenVibration
+
                     })
                     //是否开启震动
                     Image($r('[basic].media.shengying')).width(32).onClick(() => {
-                      this.isOpenVibration = !this.isOpenVibration
+                      this.isOpenMusic = !this.isOpenMusic
                     })
 
                     Column() {
@@ -760,6 +771,18 @@ export struct MainView{
         left: 20,
         right: 20
       })
-    }.backgroundColor(Color.Black)
+    }.backgroundColor(Color.Black).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
+      console.info('IsaKit Test Text isVisible: ' + isVisible + ', currentRatio:' + currentRatio)
+      if (!isVisible) {
+        //每次隐藏时关闭定时器
+        clearInterval(this.inversetId)
+      }else{
+        if(this.woodenfishModel==1){
+
+        }else {
+          this.autoOnclick()
+        }
+      }
+    })
   }
 }

+ 1 - 1
features/user/src/main/ets/views/Mine.ets

@@ -230,7 +230,7 @@ export struct Mine {
                         .fontColor('rgba(0, 0, 0, 0.95)')
                         .onClick(() => {
                           YTUserRequest.resetFish()
-
+                          userInfo.setMerit('0')
                         })
                     }
                   }