Ver Fonte

倒计时问题

XUYangWei há 2 meses atrás
pai
commit
bd5c3ad79d

+ 1 - 1
AppScope/resources/base/element/string.json

@@ -2,7 +2,7 @@
   "string": [
     {
       "name": "app_name",
-      "value": "心木鱼"
+      "value": "心木鱼"
     }
   ]
 }

+ 2 - 2
commons/basic/src/main/ets/apis/YTRequest.ets

@@ -14,8 +14,8 @@ 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'
+// 'http://8.139.252.157:9009'
+export const baseURL: string = 'https://hm.ytpm.net/prod-woodenfish'
 // export const baseURL: string = 'https://hm.ytpm.net/prod-decision/decisionApUser'
 // export const baseURL:string='https://hm.ytpm.net/prod-decision'
 export const instance = axios.create({

+ 1 - 1
commons/basic/src/main/ets/components/generalComp/AgreePrivacy.ets

@@ -25,7 +25,7 @@ export function agreePrivacy(item: BasicType<undefined>) {
       //   })
       //
       // Span('以及')
-      Span('《心木鱼用户协议》')
+      Span('《心木鱼用户协议》')
         .spanEx(() => {
           yTRouter.router2userAgreement()
 

+ 3 - 2
features/feature/src/main/ets/component/TimeProgressCom.ets

@@ -43,8 +43,9 @@ export struct TimeProgressCom{
                   this.changeTabCurrNumberAndCountTime(this.progressValue)
                 } else {
                   //自定义
-                  this.progressValue=Number(item)
-                  this.currtTime=this.progressValue-10
+                  // this.progressValue=Number(item)
+                  // this.progressValue='自定义'
+                  // this.currtTime=this.progressValue-10
                   // this.currentIndex = 3
                   this.changeTabCurrNumberAndCountTime(this.progressValue,3)
                 }

+ 2 - 1
features/feature/src/main/ets/view/FishSettingView.ets

@@ -11,7 +11,8 @@ function FishSettingViewBuilder() {
 
 @Component
 struct FishSettingView {
-  @State selectMusic:number=1
+  @StorageLink('musicID')
+  selectMusic:number=1
   @StorageLink(AppStorageKeyFishCollect.FISHTEXT)
   textValue:string=""
 

+ 1 - 1
features/feature/src/main/ets/view/FragranceSettingView.ets

@@ -302,7 +302,7 @@ parseStringArray(input: string): string[] {
               .onClick(()=>{
                 this.currSelectTimeNumber=2
                 YTUserRequest.updateInceseTime({incenseTime:30})
-                this.countTime=10
+                this.countTime=30
                 this.moveY=0
                 this.imageIndex=1
               })

+ 19 - 0
features/feature/src/main/ets/view/FragranceView.ets

@@ -515,6 +515,7 @@ export struct FragranceView{
                 this.state=AnimationStatus.Running
                 this.imageIndex=1
                 this.countTime=this.time
+                this.isShow=true
                 this.startDownTime(this.countTime)
 
               })
@@ -536,6 +537,24 @@ export struct FragranceView{
     .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
       console.info('IsaKit Test Text isVisible: ' + isVisible + ', currentRatio:' + currentRatio)
       if (isVisible) {
+        this.intervalID=setInterval(()=> {//每0.1秒执行5°的转动,动画更平滑
+          for (let index = 0; index < 5; index++) {
+            let doubleAngle = (this.averageAngle -72 * index + 0) * Math.PI / 180
+            let sin = Math.sin(doubleAngle);
+            let cos = Math.cos(doubleAngle);
+            this.widAr[index] =this.radius1+this.radius1*cos
+            this.heiAr[index] =this.radius2+this.radius2*sin * Math.cos(Math.PI * 5 / 18)
+          }
+          if (this.isRotate) {
+            if (this.averageAngle<360) {//0~360°循环
+              this.averageAngle+=1
+            }else {
+              this.averageAngle = 0;
+            }
+            this.rotateAngle = 360
+          }
+        }, 100)
+
        this.updateNumAndTime()
         // this.caluePosition()
         // this.startDownTime(this.time)

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

@@ -22,6 +22,8 @@ export struct MainView{
   @Watch('changeText')
   @StorageProp(AppStorageKeyFishCollect.FISHTEXT)
   text:string=""
+  @StorageLink('musicID')
+  selectMusic:number=1
   @State private  currentIndex: number = 0
   tabsController: TabsController = new TabsController()
   @StorageProp(YTAvoid.SAFE_TOP_KEY) top: number = 0
@@ -78,7 +80,7 @@ export struct MainView{
 
   caluc(){
     //计算间隔时长
-    this.countdownTime=this.countdownHour*60/Number(this.countdownCount)
+    this.countdownTime=Math.floor(this.countdownHour*60/Number(this.countdownCount))
   }
 
   //固定次数
@@ -148,9 +150,7 @@ 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({
@@ -180,7 +180,7 @@ export struct MainView{
       this.infiniteTimeText=this.infiniteTime.toString()
       this.fixedNumText=this.fixedNum.toString()
       this.fixedTimeText=this.fixedTime.toString()
-      this.countdownCount=(this.countdownHour*60/this.countdownTime).toString()
+      this.countdownCount=Math.floor(this.countdownHour*60/this.countdownTime).toString()
 
       for (let i = 0; i < this.Merit.length; i++) {
         if(this.currentMerit>this.Merit[i]&&this.currentMerit<this.Merit[i+1]){
@@ -206,7 +206,7 @@ export struct MainView{
 
   //开启关闭音乐
   async openMusic(){
-    await avPlayerManager.playByRawSrc('music3.mp3')
+    await avPlayerManager.playByRawSrc(`music${this.selectMusic}.mp3`)
 
   }
   async closeMusic(){
@@ -322,6 +322,7 @@ export struct MainView{
       Row(){
         Image($r('[basic].media.quxiao')).width(20).onClick(()=>{
           this.isShowTimeManger = false
+
           this.caluc()
           // 发送请求
           YTUserRequest.updateFishWoodenModel(
@@ -334,6 +335,8 @@ export struct MainView{
               woodenfishModel:this.woodenfishModel
             } as Params)
 
+
+
           // promptAction.showToast({
           //   message:JSON.stringify(   {
           //     countdownHour:this.countdownHour,
@@ -407,12 +410,12 @@ export struct MainView{
               Column({space:16}) {
                 TimeProgressCom({
                   progressValue:this.countdownHour,
-                  changeTabCurrNumberAndCountTime:(progressValue:string,tabIndex?:number,)=>{
-                    if(progressValue!='自定义') {
-                      this.countdownHour = Number(progressValue)
-                    }
+                  changeTabCurrNumberAndCountTime:(progressValue:number,tabIndex:number=-1)=>{
+
                     if(tabIndex==3) {
                       this.tabsController.changeIndex(tabIndex)
+                    }else {
+                      this.countdownHour = Number(progressValue)
                     }
                   }
 
@@ -706,7 +709,7 @@ export struct MainView{
                               .onClick(() => {
                                 this.isShowTimeManger = true
                                 clearInterval(this.inversetId)
-                                this.woodenfishModel=2
+                                // this.woodenfishModel=2
                                 // YTUserRequest.getFishFra((res)=>{
                                 //
                                 //   promptAction.showToast({
@@ -767,7 +770,7 @@ export struct MainView{
       }.width('100%')
       .height('100%')
       .padding({
-        top: this.top + 22,
+        top: this.top,
         left: 20,
         right: 20
       })
@@ -782,6 +785,8 @@ export struct MainView{
         }else {
           this.autoOnclick()
         }
+        this.list.forEach(item => item.value = this.text)
+
       }
     })
   }

+ 1 - 1
features/user/src/main/ets/components/Terms.ets

@@ -33,7 +33,7 @@ export struct Terms {
           //   })
           //
           // Span('以及')
-          Span('《心木鱼用户协议》')
+          Span('《心木鱼用户协议》')
             .spanEx(() => {
               yTRouter.router2userAgreement()
 

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

@@ -92,7 +92,7 @@ export struct Mine {
       const data = new systemShare.SharedData({
         // utd: uniformTypeDescriptor.UniformDataType.HYPERLINK,
         utd:uniformTypeDescriptor.UniformDataType.TEXT,
-        title: '心木鱼',
+        title: '心木鱼',
         content:'http://appgallery.huawei.com/app/detail?id=6917581171725638374',
         description:"http://appgallery.huawei.com/app/detail?id=6917581171725638374"
         // content: 'store://appgallery.huawei.com/app/detail?id=6917580107917312127',

+ 3 - 0
products/entry/src/main/ets/entryability/EntryAbility.ets

@@ -56,6 +56,9 @@ export default class EntryAbility extends UIAbility {
       PersistentStorage.persistProp<string>('countdownTime','0')  //分钟
       PersistentStorage.persistProp<string>('countdownNum','0')
 
+      //音乐id
+      PersistentStorage.persistProp<number>('musicID',1)
+
 
       //敲木鱼的文字动画
       PersistentStorage.persistProp<string>(AppStorageKeyFishCollect.FISHTEXT, '')

+ 1 - 1
products/entry/src/main/resources/base/element/string.json

@@ -10,7 +10,7 @@
     },
     {
       "name": "EntryAbility_label",
-      "value": "心木鱼"
+      "value": "心木鱼"
     },
     {
       "name": "reason",