|
|
@@ -10,6 +10,11 @@ import { trustedAppService } from '@kit.DeviceSecurityKit';
|
|
|
import { promptAction } from '@kit.ArkUI';
|
|
|
import { Cell } from '../models';
|
|
|
import { it } from '@ohos/hypium';
|
|
|
+import { TimeTextCom } from '../component/TimeTextCom';
|
|
|
+import { CountTextCom } from '../component/CountTextCom';
|
|
|
+import { TimeProgressCom } from '../component/TimeProgressCom';
|
|
|
+import { AutoAdComponent } from '@ohos.advertising.AutoAdComponent';
|
|
|
+import { AutoDesiciTime } from '../component/AutoDesiciTime';
|
|
|
|
|
|
|
|
|
@Component
|
|
|
@@ -45,44 +50,60 @@ export struct MainView{
|
|
|
@State isAnimation:boolean=false
|
|
|
|
|
|
|
|
|
- //时间间隔
|
|
|
- @State time:number=1000
|
|
|
+
|
|
|
|
|
|
@State isShowTimeManger:boolean=false
|
|
|
|
|
|
- //当前分钟
|
|
|
+ //时间间隔
|
|
|
+ @State time:number=1000
|
|
|
+
|
|
|
+ //当前倒计时 分钟渲染参数
|
|
|
@State valueTime:number=10
|
|
|
|
|
|
|
|
|
+ //全部用分钟来计算,实际传递给后端用小时制
|
|
|
+ //实际后端要的小时来算的数据
|
|
|
@Watch('caluc')
|
|
|
- @State countdownHour:number=0.1
|
|
|
+ @State countdownHour:number=10
|
|
|
+
|
|
|
+ //倒计时时间间隔
|
|
|
@State countdownTime:number=1
|
|
|
- //
|
|
|
+
|
|
|
+ //倒计时敲击次数渲染文本
|
|
|
@Watch('caluc')
|
|
|
@State countdownCount:string="1"
|
|
|
|
|
|
+ //倒计时自定义的文本分钟
|
|
|
@State countAutoHour:string=""
|
|
|
|
|
|
caluc(){
|
|
|
//计算间隔时长
|
|
|
- this.countdownTime=this.countdownHour*60*60/Number(this.countdownCount)
|
|
|
+ this.countdownTime=this.countdownHour*60/Number(this.countdownCount)
|
|
|
}
|
|
|
|
|
|
+ //固定次数
|
|
|
@State fixedNum:number=1
|
|
|
+ //固定间隔时间
|
|
|
@State fixedTime:number=1
|
|
|
+ //固定次数渲染文本
|
|
|
@State fixedNumText:string="1"
|
|
|
+ //固定间隔时间渲染文本
|
|
|
@State fixedTimeText:string="1"
|
|
|
-
|
|
|
- @State infiniteTime:number=1 //无限模式间隔时长
|
|
|
+ //无限模式间隔时长
|
|
|
+ @State infiniteTime:number=1
|
|
|
+ //无限模式间隔时长渲染文本
|
|
|
@State infiniteTimeText:string="1"
|
|
|
+ //模式 1(结束 手动) 2无限,3固定次数 4倒计时
|
|
|
@State woodenfishModel:number=1
|
|
|
- //进度条
|
|
|
+ //进度条功德数
|
|
|
@State currentMerit:number=0
|
|
|
+ //总功德数
|
|
|
@State totalMerit:number=10
|
|
|
|
|
|
+ //自动点击缩放参数
|
|
|
+ @State scaleValue:number=1
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ @State inversetId:number=-1
|
|
|
|
|
|
dialogController: CustomDialogController=new CustomDialogController({
|
|
|
builder:BlessCustomCustomDialog({
|
|
|
@@ -94,6 +115,40 @@ export struct MainView{
|
|
|
height:'100%',
|
|
|
})
|
|
|
|
|
|
+
|
|
|
+ // 初始化方法,在组件即将显示时被调用
|
|
|
+ aboutToAppear(): void {
|
|
|
+ for (let i = 0; i < this.count; i++) {
|
|
|
+ this.list.push(new Cell()); // 初始化 Cell 数组
|
|
|
+ }
|
|
|
+ YTUserRequest.getFishFra((res)=>{
|
|
|
+
|
|
|
+ promptAction.showToast({
|
|
|
+ message:JSON.stringify(res)
|
|
|
+ })
|
|
|
+ AppStorage.setOrCreate('updateID',res.id as number)
|
|
|
+ this.currentMerit=res.meritsValue as number
|
|
|
+ this.woodenfishModel=res.woodenfishModel as number
|
|
|
+ //无限间隔时长
|
|
|
+ this.infiniteTime=res.infiniteTime as number
|
|
|
+ //固定
|
|
|
+ this.fixedNum=res.fixedNum as number
|
|
|
+ this.fixedTime=res.fixedTime as number
|
|
|
+
|
|
|
+ //倒计时
|
|
|
+ this.countdownTime=res.countdownTime as number
|
|
|
+ this.countdownHour=(res.countdownHour as number)
|
|
|
+ this.isAuto=this.woodenfishModel!=1?true:false
|
|
|
+ //判断是否自动并设置敲击时间
|
|
|
+ clearInterval(this.inversetId)
|
|
|
+ //自动敲击
|
|
|
+
|
|
|
+ this.autoOnclick()
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//开启关闭音乐
|
|
|
async openMusic(){
|
|
|
await avPlayerManager.playByRawSrc('music3.mp3')
|
|
|
@@ -132,17 +187,19 @@ export struct MainView{
|
|
|
this.indexCount++; // 更新索引计数器
|
|
|
animateToImmediately({
|
|
|
// 立即开始动画
|
|
|
- duration: 0, // 动画持续时间为0毫秒
|
|
|
+ duration: 250, // 动画持续时间为0毫秒
|
|
|
+ curve: Curve.Linear,
|
|
|
onFinish: () => { // 动画完成后的回调
|
|
|
+ this.scaleValue=1
|
|
|
animateToImmediately({
|
|
|
// 再次立即开始动画
|
|
|
- duration: 500, // 动画持续时间为1000毫秒
|
|
|
+ duration: 250, // 动画持续时间为1000毫秒
|
|
|
onFinish:()=>{
|
|
|
this.isAnimation=false
|
|
|
this.closeMusic()
|
|
|
}
|
|
|
}, () => {
|
|
|
- this.list[index].y = -200 // 设置 Cell 的垂直偏移量
|
|
|
+ this.list[index].y = -150 // 设置 Cell 的垂直偏移量
|
|
|
this.list[index].opacity = 0 // 设置 Cell 的透明度
|
|
|
})
|
|
|
|
|
|
@@ -150,26 +207,61 @@ export struct MainView{
|
|
|
}, () => {
|
|
|
this.list[index].y = 0 // 设置 Cell 的垂直偏移量
|
|
|
this.list[index].opacity = 1 // 设置 Cell 的透明度
|
|
|
+ this.scaleValue=0.8
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //自动敲击
|
|
|
+ autoOnclick(){
|
|
|
+ clearInterval(this.inversetId)
|
|
|
+ if(this.woodenfishModel==1){
|
|
|
+ this.isAuto=false
|
|
|
+ }else if(this.woodenfishModel==2){
|
|
|
+ this.inversetId= setInterval(()=>{
|
|
|
+ this.onclikMerit()
|
|
|
+ },this.infiniteTime*1000)
|
|
|
+ }else if(this.woodenfishModel==3){
|
|
|
+ this.inversetId=setInterval(()=>{
|
|
|
+ this.onclikMerit()
|
|
|
+ },this.fixedTime*1000)
|
|
|
+ const b=setTimeout(()=>{
|
|
|
+ clearInterval(this.inversetId)
|
|
|
+ clearTimeout(b)
|
|
|
+ },this.fixedTime*1000*this.fixedNum)
|
|
|
+ }else if(this.woodenfishModel==4){
|
|
|
+ this.onclikMerit()
|
|
|
+ this.inversetId=setInterval(()=>{
|
|
|
+ this.onclikMerit()
|
|
|
+ },this.countdownTime*1000)
|
|
|
+ const b=setTimeout(()=>{
|
|
|
+ clearInterval(this.inversetId)
|
|
|
+ clearTimeout(b)
|
|
|
+ },this.countdownHour*1000*this.countdownHour)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Builder
|
|
|
- timeMangerBuilder(){
|
|
|
+ TimeMangerBuilder(){
|
|
|
Column(){
|
|
|
+
|
|
|
+ //图标
|
|
|
Row(){
|
|
|
Image($r('[basic].media.quxiao')).width(20).onClick(()=>{
|
|
|
this.isShowTimeManger = false
|
|
|
|
|
|
- //发送请求
|
|
|
+ // 发送请求
|
|
|
YTUserRequest.updateFishWoodenModel(
|
|
|
{
|
|
|
countdownHour:this.countdownHour,
|
|
|
countdownTime:this.countdownTime,
|
|
|
fixedNum:this.fixedNum,
|
|
|
fixedTime:this.fixedTime,
|
|
|
- incenseTime:this.infiniteTime,
|
|
|
+ infiniteTime:this.infiniteTime,
|
|
|
woodenfishModel:this.woodenfishModel
|
|
|
} as Params)
|
|
|
|
|
|
@@ -177,16 +269,21 @@ export struct MainView{
|
|
|
message:JSON.stringify( {
|
|
|
countdownHour:this.countdownHour,
|
|
|
countdownTime:this.countdownTime,
|
|
|
- fixedNum:this.fixedNum,
|
|
|
+ fixedNum:this.fixedNum,
|
|
|
fixedTime:this.fixedTime,
|
|
|
- incenseTime:this.infiniteTime,
|
|
|
+ infiniteTime:this.infiniteTime,
|
|
|
woodenfishModel:this.woodenfishModel
|
|
|
} as Params)
|
|
|
})
|
|
|
+ this.autoOnclick()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
|
|
|
}.width('100%')
|
|
|
.justifyContent(FlexAlign.End)
|
|
|
+ //标题
|
|
|
Row(){
|
|
|
Text('自动敲击设置').fontColor(Color.White).fontSize(20)
|
|
|
}.width('100%')
|
|
|
@@ -196,249 +293,68 @@ export struct MainView{
|
|
|
Tabs({ barPosition: BarPosition.Start, controller: this.tabsController,index:this.currentIndex }) {
|
|
|
TabContent() {
|
|
|
Column() {
|
|
|
- Column({ space: 16 }) {
|
|
|
- Row() {
|
|
|
- Text() {
|
|
|
- Span('敲击间隔时长').fontSize(16)
|
|
|
- Span('(1-10秒)').fontSize(12)
|
|
|
- }.fontColor(Color.White)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
-
|
|
|
-
|
|
|
- Row() {
|
|
|
- TextInput({text:this.infiniteTimeText})
|
|
|
- .width(70)
|
|
|
- .height(40)
|
|
|
- .padding(0)
|
|
|
- .type(InputType.Number) // 设置输入类型为数字
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .borderRadius(4)
|
|
|
- .backgroundColor(Color.Gray)
|
|
|
- .margin({ right: 5 })
|
|
|
- .onChange((value)=>{
|
|
|
- if(Number(value)>10){
|
|
|
- IBestToast.show({
|
|
|
- message:"间隔时间不能大于10秒"
|
|
|
- })
|
|
|
- this.infiniteTimeText="10"
|
|
|
- this.infiniteTime=10
|
|
|
- return
|
|
|
- }
|
|
|
- if(Number(value)<=0){
|
|
|
- IBestToast.show({
|
|
|
- message:"间隔时间不能小于一秒"
|
|
|
- })
|
|
|
- this.infiniteTimeText="1"
|
|
|
- this.infiniteTime=1
|
|
|
- return
|
|
|
- }
|
|
|
- this.infiniteTime=Number(value)
|
|
|
- this.infiniteTimeText=this.infiniteTime.toString()
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- Text('秒').fontColor('rgba(250, 222, 113, 1)')
|
|
|
- }.width('100%').justifyContent(FlexAlign.Center)
|
|
|
- }
|
|
|
- .width('100%')
|
|
|
+ Column() {
|
|
|
+ TimeTextCom({
|
|
|
+ onclickTime: this.infiniteTimeText,
|
|
|
+ changeText: (value: string) => {
|
|
|
+ this.infiniteTimeText = value
|
|
|
+ //获取到无限模式间隔时间
|
|
|
+ this.infiniteTime=Number(this.infiniteTimeText)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }.width('100%')
|
|
|
.height(136)
|
|
|
.borderRadius(8)
|
|
|
.padding(20)
|
|
|
.backgroundColor('rgba(77, 77, 77, 1)')
|
|
|
-
|
|
|
}.layoutWeight(1).justifyContent(FlexAlign.Start)
|
|
|
}.tabBar('无限').layoutWeight(1)
|
|
|
TabContent() {
|
|
|
Column(){
|
|
|
Column({space:16}) {
|
|
|
- Row(){
|
|
|
- Text() {
|
|
|
- Span('敲击次数').fontSize(16)
|
|
|
- Span('(1-9999次)').fontSize(12)
|
|
|
- }.fontColor(Color.White)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
-
|
|
|
-
|
|
|
- Row() {
|
|
|
- TextInput({text:this.fixedNumText})
|
|
|
- .width(70)
|
|
|
- .height(40)
|
|
|
- .padding(0)
|
|
|
- .type(InputType.Number) // 设置输入类型为数字
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .borderRadius(4)
|
|
|
- .backgroundColor(Color.Gray)
|
|
|
- .margin({right:5})
|
|
|
- .onChange((value)=>{
|
|
|
- if(Number(value)>9999){
|
|
|
- IBestToast.show({
|
|
|
- message:"敲击次数不能大于9999"
|
|
|
- })
|
|
|
- this.fixedNumText="9999"
|
|
|
- this.fixedNum=9999
|
|
|
- return
|
|
|
- }
|
|
|
- if(Number(value)<=0){
|
|
|
- IBestToast.show({
|
|
|
- message:"敲击次数不能小于1"
|
|
|
- })
|
|
|
- this.fixedNumText="1"
|
|
|
- this.fixedNum=1
|
|
|
- return
|
|
|
- }
|
|
|
- this.fixedNum=Number(value)
|
|
|
- this.fixedNumText=this.fixedNum.toString()
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- Text('次').fontColor('rgba(250, 222, 113, 1)')
|
|
|
- }.width('100%').justifyContent(FlexAlign.Center)
|
|
|
-
|
|
|
- Row(){
|
|
|
- Text() {
|
|
|
- Span('敲击间隔时长').fontSize(16)
|
|
|
- Span('(1-10秒)').fontSize(12)
|
|
|
- }.fontColor(Color.White)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
-
|
|
|
-
|
|
|
- Row() {
|
|
|
- TextInput({text:this.fixedTimeText})
|
|
|
- .width(70)
|
|
|
- .height(40)
|
|
|
- .padding(0)
|
|
|
- .type(InputType.Number) // 设置输入类型为数字
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .borderRadius(4)
|
|
|
- .backgroundColor(Color.Gray)
|
|
|
- .margin({right:5})
|
|
|
- .onChange((value)=>{
|
|
|
- if(Number(value)>10){
|
|
|
- IBestToast.show({
|
|
|
- message:"间隔时间不能大于10秒"
|
|
|
- })
|
|
|
- this.fixedTimeText="10"
|
|
|
- this.fixedTime=10
|
|
|
- return
|
|
|
- }
|
|
|
- if(Number(value)<=0){
|
|
|
- IBestToast.show({
|
|
|
- message:"间隔时间不能小于一秒"
|
|
|
- })
|
|
|
- this.fixedTimeText="1"
|
|
|
- this.fixedTime=1
|
|
|
- return
|
|
|
- }
|
|
|
- this.fixedTime=Number(value)
|
|
|
- this.fixedTimeText=this.fixedTime.toString()
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
+ CountTextCom({
|
|
|
+ onclickCount:this.fixedNumText,
|
|
|
+ changeOnclickCount:(value:string)=>{
|
|
|
+ this.fixedNumText=value
|
|
|
+ //固定模式敲击次数
|
|
|
+ this.fixedNum=Number(this.fixedNumText)
|
|
|
+ }
|
|
|
|
|
|
- Text('秒').fontColor('rgba(250, 222, 113, 1)')
|
|
|
- }.width('100%').justifyContent(FlexAlign.Center)
|
|
|
+ })
|
|
|
+ TimeTextCom({
|
|
|
+ onclickTime:this.fixedTimeText,
|
|
|
+ changeText:(value:string)=>{
|
|
|
+ this.fixedTimeText=value
|
|
|
+ //固定模式间隔时间
|
|
|
+ this.fixedTime=Number(this.fixedTimeText)
|
|
|
+ }
|
|
|
|
|
|
+ })
|
|
|
}.width('100%').height(210).borderRadius(8).padding(20).backgroundColor('rgba(77, 77, 77, 1)')
|
|
|
}.layoutWeight(1).justifyContent(FlexAlign.Start)
|
|
|
}.tabBar('固定次数').layoutWeight(1)
|
|
|
TabContent() {
|
|
|
Column(){
|
|
|
Column({space:16}) {
|
|
|
- Column({space:16}) {
|
|
|
- Row(){
|
|
|
- Text() {
|
|
|
- Span('倒计时').fontSize(16)
|
|
|
- }.fontColor(Color.White)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
- Stack({alignContent:Alignment.TopStart}) {
|
|
|
- Progress({ value: this.valueTime, total: 60, type: ProgressType.Linear }).width(290).height(16).backgroundColor('rgba(255, 255, 255, 0.55)').margin({left:14})
|
|
|
- Row({space:17}){
|
|
|
- ForEach([0,10,20,30,40,50,60],(item:number,index:number)=> {
|
|
|
-
|
|
|
- Column() {
|
|
|
- Column() {
|
|
|
- }
|
|
|
- .width(16)
|
|
|
- .height(16)
|
|
|
- .borderRadius('50%')
|
|
|
- .onClick(() => {
|
|
|
- if (index != 6) {
|
|
|
- this.valueTime = item //比实际小10
|
|
|
- this.countdownHour=(this.valueTime+10)/60
|
|
|
- } else {
|
|
|
- this.valueTime=item
|
|
|
- this.currentIndex = 3
|
|
|
- this.tabsController.changeIndex(this.currentIndex)
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- .backgroundColor(this.valueTime == item ? Color.Yellow : Color.White)
|
|
|
- Column() {
|
|
|
- if (item != 60) {
|
|
|
- Text(Number(item+10) + "分钟")
|
|
|
- .fontSize(10)
|
|
|
- .fontColor(this.valueTime == item ? Color.White : 'rgba(255, 255, 255, 0.55)')
|
|
|
- } else {
|
|
|
- Text('自定义')
|
|
|
- .fontSize(10)
|
|
|
- .fontColor(this.valueTime == item ? Color.White : 'rgba(255, 255, 255, 0.55)')
|
|
|
- }
|
|
|
- }
|
|
|
- }.alignItems(HorizontalAlign.Start)
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
- }.width('100%')
|
|
|
-
|
|
|
+ TimeProgressCom({
|
|
|
+ progressValue:this.countdownHour,
|
|
|
+ changeTabCurrNumberAndCountTime:(progressValue:string,tabIndex?:number,)=>{
|
|
|
+ if(progressValue!='自定义') {
|
|
|
+ this.countdownHour = Number(progressValue)
|
|
|
+ }
|
|
|
+ if(tabIndex==3) {
|
|
|
+ this.tabsController.changeIndex(tabIndex)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ })
|
|
|
+ CountTextCom({
|
|
|
+ onclickCount:this.countdownCount,
|
|
|
+ changeOnclickCount:(value:string)=>{
|
|
|
+ this.countdownCount=value
|
|
|
}
|
|
|
|
|
|
- Column({space:16}) {
|
|
|
- Row(){
|
|
|
- Text() {
|
|
|
- Span('敲击次数').fontSize(16)
|
|
|
- Span('(1-9999次)').fontSize(12)
|
|
|
- }.fontColor(Color.White)
|
|
|
- }.width('100%')
|
|
|
- .justifyContent(FlexAlign.Start)
|
|
|
- Row() {
|
|
|
- TextInput({text:this.countdownCount})
|
|
|
- .width(70)
|
|
|
- .height(40)
|
|
|
- .padding(0)
|
|
|
- .type(InputType.Number) // 设置输入类型为数字
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .borderRadius(4)
|
|
|
- .backgroundColor(Color.Gray)
|
|
|
- .onChange((value)=>{
|
|
|
- if(Number(value)>9999){
|
|
|
- IBestToast.show({
|
|
|
- message:"敲击次数不能大于9999"
|
|
|
- })
|
|
|
- this.countdownCount="9999"
|
|
|
- return
|
|
|
- }
|
|
|
- if(Number(value)<=0){
|
|
|
- IBestToast.show({
|
|
|
- message:"敲击次数不能小于1"
|
|
|
- })
|
|
|
- this.countdownCount="1"
|
|
|
- return
|
|
|
- }
|
|
|
- this.countdownCount=value
|
|
|
-
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- Text('次').fontColor('rgba(250, 222, 113, 1)')
|
|
|
- }
|
|
|
- }
|
|
|
+ })
|
|
|
|
|
|
}.width('100%').borderRadius(8).padding(20).backgroundColor('rgba(77, 77, 77, 1)')
|
|
|
|
|
|
@@ -447,32 +363,18 @@ export struct MainView{
|
|
|
}.tabBar('倒计时').layoutWeight(1)
|
|
|
TabContent() {
|
|
|
Column(){
|
|
|
- Column({space:30}) {
|
|
|
- Text('自定义时间').fontColor(Color.White)
|
|
|
- Row() {
|
|
|
- TextInput({text:this.countAutoHour})
|
|
|
- .width(70)
|
|
|
- .height(40)
|
|
|
- .padding(0)
|
|
|
- .type(InputType.Number) // 设置输入类型为数字
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .borderRadius(4)
|
|
|
- .backgroundColor(Color.Gray)
|
|
|
- .onChange((value)=>{
|
|
|
- if(Number(value)>120){
|
|
|
- IBestToast.show({
|
|
|
- message:'最多不得超过120分钟'
|
|
|
- })
|
|
|
- this.countAutoHour="120"
|
|
|
- return
|
|
|
- }
|
|
|
- this.countAutoHour=value
|
|
|
- this.countdownHour=Number(this.countAutoHour)/60
|
|
|
- })
|
|
|
+ AutoDesiciTime({
|
|
|
+ countAutoHour:this.countAutoHour,
|
|
|
+ changeAutoHour:(countAutoHour:string)=>{
|
|
|
+ this.countAutoHour=countAutoHour
|
|
|
+ this.countdownHour=Number(this.countAutoHour)
|
|
|
+ },
|
|
|
+ backTab:(woodenfishModel:number,tabChangeIndex:number)=>{
|
|
|
+ this.woodenfishModel=woodenfishModel
|
|
|
+ this.tabsController.changeIndex(tabChangeIndex)
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
- Text('分钟').fontColor('rgba(250, 222, 113, 1)')
|
|
|
- }
|
|
|
- }
|
|
|
}.layoutWeight(1).justifyContent(FlexAlign.Start)
|
|
|
}.tabBar('自定义').layoutWeight(1)
|
|
|
|
|
|
@@ -532,57 +434,7 @@ export struct MainView{
|
|
|
|
|
|
}
|
|
|
|
|
|
- // 初始化方法,在组件即将显示时被调用
|
|
|
- aboutToAppear(): void {
|
|
|
- for (let i = 0; i < this.count; i++) {
|
|
|
- this.list.push(new Cell()); // 初始化 Cell 数组
|
|
|
- }
|
|
|
- YTUserRequest.getFishFra((res)=>{
|
|
|
- AppStorage.setOrCreate('updateID',res.id as number)
|
|
|
- this.currentMerit=res.meritsValue as number
|
|
|
- this.woodenfishModel=res.woodenfishModel as number
|
|
|
- //无限间隔时长
|
|
|
- this.infiniteTime=res.infiniteTime as number
|
|
|
- //固定
|
|
|
- this.fixedNum=res.fixedNum as number
|
|
|
- this.fixedTime=res.fixedTime as number
|
|
|
|
|
|
- //倒计时
|
|
|
- this.countdownTime=res.countdownTime as number
|
|
|
- this.countdownHour=(res.countdownHour as number)*60
|
|
|
- //判断是否自动并设置敲击时间
|
|
|
- if(res.woodenfishModel==1){
|
|
|
- this.isAuto=false
|
|
|
- }else if(res.woodenfishModel==2){
|
|
|
- setInterval(()=>{
|
|
|
- this.onclikMerit()
|
|
|
- },this.infiniteTime*1000)
|
|
|
- }else if(res.woodenfishModel==3){
|
|
|
- const a=setInterval(()=>{
|
|
|
- this.onclikMerit()
|
|
|
-
|
|
|
- },this.fixedTime)
|
|
|
- const b=setTimeout(()=>{
|
|
|
- clearInterval(a)
|
|
|
- clearTimeout(b)
|
|
|
- },this.fixedTime*this.fixedNum)
|
|
|
- }else if(res.woodenfishModel==4){
|
|
|
-
|
|
|
- this.onclikMerit()
|
|
|
- const a=setInterval(()=>{
|
|
|
- this.onclikMerit()
|
|
|
- },this.countdownTime)
|
|
|
- const b=setTimeout(()=>{
|
|
|
- clearInterval(a)
|
|
|
- clearTimeout(b)
|
|
|
- },this.countdownHour*this.countdownHour)
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
clockFish(){
|
|
|
YTUserRequest.knockingFish()
|
|
|
@@ -596,7 +448,6 @@ export struct MainView{
|
|
|
Stack({ alignContent: Alignment.Bottom }) {
|
|
|
Column() {
|
|
|
if (this.isShowMessage) {
|
|
|
-
|
|
|
Row() {
|
|
|
Column({ space: 20 }) {
|
|
|
//积功德+清零
|
|
|
@@ -683,6 +534,8 @@ export struct MainView{
|
|
|
//如果本来是手动,再点击就是自动,就需要设置东西
|
|
|
// this.isHand = false
|
|
|
this.woodenfishModel=1
|
|
|
+ clearInterval(this.inversetId)
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
if (this.isAuto) {
|
|
|
@@ -700,6 +553,7 @@ export struct MainView{
|
|
|
this.isAuto = !this.isAuto
|
|
|
if(this.isAuto==false){
|
|
|
this.woodenfishModel=1
|
|
|
+ clearInterval(this.inversetId)
|
|
|
}
|
|
|
})
|
|
|
Text('无限')
|
|
|
@@ -711,7 +565,8 @@ export struct MainView{
|
|
|
})
|
|
|
.fontColor(Color.White)
|
|
|
.backgroundColor('#252111')
|
|
|
- .bindSheet($$this.isShowTimeManger, this.timeMangerBuilder(), {
|
|
|
+ .bindSheet($$this.isShowTimeManger, this.TimeMangerBuilder
|
|
|
+ , {
|
|
|
width: '100%',
|
|
|
height: 400,
|
|
|
showClose: false,
|
|
|
@@ -724,6 +579,32 @@ export struct MainView{
|
|
|
.onClick(() => {
|
|
|
this.isShowTimeManger = true
|
|
|
this.woodenfishModel=2
|
|
|
+ // YTUserRequest.getFishFra((res)=>{
|
|
|
+ //
|
|
|
+ // promptAction.showToast({
|
|
|
+ // message:JSON.stringify(res)
|
|
|
+ // })
|
|
|
+ // AppStorage.setOrCreate('updateID',res.id as number)
|
|
|
+ // this.currentMerit=res.meritsValue as number
|
|
|
+ // this.woodenfishModel=res.woodenfishModel as number
|
|
|
+ // //无限间隔时长
|
|
|
+ // this.infiniteTime=res.infiniteTime as number
|
|
|
+ // //固定
|
|
|
+ // this.fixedNum=res.fixedNum as number
|
|
|
+ // this.fixedTime=res.fixedTime as number
|
|
|
+ //
|
|
|
+ // //倒计时
|
|
|
+ // this.countdownTime=res.countdownTime as number
|
|
|
+ // this.countdownHour=(res.countdownHour as number)
|
|
|
+ // this.isAuto=this.woodenfishModel!=1?true:false
|
|
|
+ // //判断是否自动并设置敲击时间
|
|
|
+ // clearInterval(this.inversetId)
|
|
|
+ // //自动敲击
|
|
|
+ //
|
|
|
+ // this.autoOnclick()
|
|
|
+ //
|
|
|
+ // })
|
|
|
+
|
|
|
})
|
|
|
Text('设置')
|
|
|
.padding({
|
|
|
@@ -774,11 +655,15 @@ export struct MainView{
|
|
|
.width(200)
|
|
|
.height(200)
|
|
|
.objectFit(ImageFit.Contain)
|
|
|
- .clickEffect({
|
|
|
- // 点击效果配置
|
|
|
- scale: 0.5, // 缩放比例
|
|
|
- level: ClickEffectLevel.LIGHT // 效果级别
|
|
|
+ .scale({
|
|
|
+ x:this.scaleValue,
|
|
|
+ y:this.scaleValue
|
|
|
})
|
|
|
+ // .clickEffect({
|
|
|
+ // // 点击效果配置
|
|
|
+ // scale: 0.5, // 缩放比例
|
|
|
+ // level: ClickEffectLevel.LIGHT // 效果级别
|
|
|
+ // })
|
|
|
.onClick(() => { // 点击图片时触发的回调
|
|
|
if(!this.isAuto) {
|
|
|
this.onclikMerit()
|