|
|
@@ -63,14 +63,14 @@ export struct MainView{
|
|
|
|
|
|
//全部用分钟来计算,实际传递给后端用小时制
|
|
|
//实际后端要的小时来算的数据
|
|
|
- @Watch('caluc')
|
|
|
+ // @Watch('caluc')
|
|
|
@State countdownHour:number=10
|
|
|
|
|
|
//倒计时时间间隔
|
|
|
@State countdownTime:number=1
|
|
|
|
|
|
//倒计时敲击次数渲染文本
|
|
|
- @Watch('caluc')
|
|
|
+ // @Watch('caluc')
|
|
|
@State countdownCount:string="1"
|
|
|
|
|
|
//倒计时自定义的文本分钟
|
|
|
@@ -96,9 +96,12 @@ export struct MainView{
|
|
|
//模式 1(结束 手动) 2无限,3固定次数 4倒计时
|
|
|
@State woodenfishModel:number=1
|
|
|
//进度条功德数
|
|
|
+ @Watch('total')
|
|
|
@State currentMerit:number=0
|
|
|
//总功德数
|
|
|
@State totalMerit:number=10
|
|
|
+ private Merit:number[]=[10,200,500,1000,2000,5000,6000,8000]
|
|
|
+ private MeritIndex:number=0
|
|
|
|
|
|
//自动点击缩放参数
|
|
|
@State scaleValue:number=1
|
|
|
@@ -115,6 +118,13 @@ export struct MainView{
|
|
|
height:'100%',
|
|
|
})
|
|
|
|
|
|
+ total(){
|
|
|
+ if(this.currentMerit>this.totalMerit){
|
|
|
+ this.MeritIndex++
|
|
|
+ this.totalMerit=this.Merit[this.MeritIndex]
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
// 初始化方法,在组件即将显示时被调用
|
|
|
aboutToAppear(): void {
|
|
|
@@ -123,14 +133,15 @@ export struct MainView{
|
|
|
}
|
|
|
YTUserRequest.getFishFra((res)=>{
|
|
|
|
|
|
- promptAction.showToast({
|
|
|
- message:JSON.stringify(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
|
|
|
@@ -138,7 +149,31 @@ export struct MainView{
|
|
|
//倒计时
|
|
|
this.countdownTime=res.countdownTime as number
|
|
|
this.countdownHour=(res.countdownHour as number)
|
|
|
+ if(this.countdownHour>60){
|
|
|
+ this.countAutoHour=this.countdownHour.toString()
|
|
|
+ }
|
|
|
+
|
|
|
this.isAuto=this.woodenfishModel!=1?true:false
|
|
|
+
|
|
|
+ this.text=res.suspensionCharacters as string
|
|
|
+ //需要渲染
|
|
|
+ this.infiniteTimeText=this.infiniteTime.toString()
|
|
|
+ this.fixedNumText=this.fixedNum.toString()
|
|
|
+ this.fixedTimeText=this.fixedTime.toString()
|
|
|
+ this.countdownCount=(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]){
|
|
|
+ this.totalMerit=this.Merit[i+1]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // promptAction.showToast({
|
|
|
+ // message:this.countdownCount
|
|
|
+ // })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//判断是否自动并设置敲击时间
|
|
|
clearInterval(this.inversetId)
|
|
|
//自动敲击
|
|
|
@@ -238,7 +273,7 @@ export struct MainView{
|
|
|
const b=setTimeout(()=>{
|
|
|
clearInterval(this.inversetId)
|
|
|
clearTimeout(b)
|
|
|
- },this.countdownHour*1000*this.countdownHour)
|
|
|
+ },this.countdownHour*60000)
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -253,7 +288,7 @@ export struct MainView{
|
|
|
Row(){
|
|
|
Image($r('[basic].media.quxiao')).width(20).onClick(()=>{
|
|
|
this.isShowTimeManger = false
|
|
|
-
|
|
|
+ this.caluc()
|
|
|
// 发送请求
|
|
|
YTUserRequest.updateFishWoodenModel(
|
|
|
{
|
|
|
@@ -265,16 +300,16 @@ export struct MainView{
|
|
|
woodenfishModel:this.woodenfishModel
|
|
|
} as Params)
|
|
|
|
|
|
- promptAction.showToast({
|
|
|
- message:JSON.stringify( {
|
|
|
- countdownHour:this.countdownHour,
|
|
|
- countdownTime:this.countdownTime,
|
|
|
- fixedNum:this.fixedNum,
|
|
|
- fixedTime:this.fixedTime,
|
|
|
- infiniteTime:this.infiniteTime,
|
|
|
- woodenfishModel:this.woodenfishModel
|
|
|
- } as Params)
|
|
|
- })
|
|
|
+ // promptAction.showToast({
|
|
|
+ // message:JSON.stringify( {
|
|
|
+ // countdownHour:this.countdownHour,
|
|
|
+ // countdownTime:this.countdownTime,
|
|
|
+ // fixedNum:this.fixedNum,
|
|
|
+ // fixedTime:this.fixedTime,
|
|
|
+ // infiniteTime:this.infiniteTime,
|
|
|
+ // woodenfishModel:this.woodenfishModel
|
|
|
+ // } as Params)
|
|
|
+ // })
|
|
|
this.autoOnclick()
|
|
|
|
|
|
|
|
|
@@ -311,52 +346,52 @@ export struct MainView{
|
|
|
}.tabBar('无限').layoutWeight(1)
|
|
|
TabContent() {
|
|
|
Column(){
|
|
|
- Column({space:16}) {
|
|
|
- CountTextCom({
|
|
|
- onclickCount:this.fixedNumText,
|
|
|
- changeOnclickCount:(value:string)=>{
|
|
|
- this.fixedNumText=value
|
|
|
- //固定模式敲击次数
|
|
|
- this.fixedNum=Number(this.fixedNumText)
|
|
|
- }
|
|
|
+ Column({space:16}) {
|
|
|
+ CountTextCom({
|
|
|
+ onclickCount:this.fixedNumText,
|
|
|
+ changeOnclickCount:(value:string)=>{
|
|
|
+ this.fixedNumText=value
|
|
|
+ //固定模式敲击次数
|
|
|
+ this.fixedNum=Number(this.fixedNumText)
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
- TimeTextCom({
|
|
|
- onclickTime:this.fixedTimeText,
|
|
|
- changeText:(value:string)=>{
|
|
|
- this.fixedTimeText=value
|
|
|
- //固定模式间隔时间
|
|
|
- this.fixedTime=Number(this.fixedTimeText)
|
|
|
- }
|
|
|
+ })
|
|
|
+ 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)')
|
|
|
+ })
|
|
|
+ }.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}) {
|
|
|
- TimeProgressCom({
|
|
|
- progressValue:this.countdownHour,
|
|
|
- changeTabCurrNumberAndCountTime:(progressValue:string,tabIndex?:number,)=>{
|
|
|
- if(progressValue!='自定义') {
|
|
|
- this.countdownHour = Number(progressValue)
|
|
|
- }
|
|
|
- if(tabIndex==3) {
|
|
|
- this.tabsController.changeIndex(tabIndex)
|
|
|
+ Column({space:16}) {
|
|
|
+ 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
|
|
|
- }
|
|
|
+ })
|
|
|
+ CountTextCom({
|
|
|
+ onclickCount:this.countdownCount,
|
|
|
+ changeOnclickCount:(value:string)=>{
|
|
|
+ this.countdownCount=value
|
|
|
+ }
|
|
|
|
|
|
- })
|
|
|
+ })
|
|
|
|
|
|
- }.width('100%').borderRadius(8).padding(20).backgroundColor('rgba(77, 77, 77, 1)')
|
|
|
+ }.width('100%').borderRadius(8).padding(20).backgroundColor('rgba(77, 77, 77, 1)')
|
|
|
|
|
|
}.layoutWeight(1).justifyContent(FlexAlign.Start)
|
|
|
|
|
|
@@ -388,12 +423,12 @@ export struct MainView{
|
|
|
.fontColor(this.currentIndex==0?Color.Black:'rgba(255, 255, 255, 0.35)')
|
|
|
.backgroundColor(this.currentIndex==0?'rgba(250, 222, 113, 1)':Color.Transparent)
|
|
|
.onClick(()=>{
|
|
|
- this.currentIndex=0
|
|
|
- this.tabsController.changeIndex(this.currentIndex)
|
|
|
+ this.currentIndex=0
|
|
|
+ this.tabsController.changeIndex(this.currentIndex)
|
|
|
this.woodenfishModel=2
|
|
|
|
|
|
|
|
|
- })
|
|
|
+ })
|
|
|
Text('固定次数')
|
|
|
.layoutWeight(1)
|
|
|
.textAlign(TextAlign.Center)
|
|
|
@@ -414,11 +449,11 @@ export struct MainView{
|
|
|
.fontColor((this.currentIndex==2||this.currentIndex==3)?Color.Black:'rgba(255, 255, 255, 0.35)')
|
|
|
.backgroundColor((this.currentIndex==2||this.currentIndex==3)?'rgba(250, 222, 113, 1)':Color.Transparent)
|
|
|
.onClick(()=>{
|
|
|
- this.currentIndex=2
|
|
|
- this.tabsController.changeIndex(this.currentIndex)
|
|
|
+ this.currentIndex=2
|
|
|
+ this.tabsController.changeIndex(this.currentIndex)
|
|
|
this.woodenfishModel=4
|
|
|
|
|
|
- })
|
|
|
+ })
|
|
|
|
|
|
}.width('100%')
|
|
|
.borderRadius(10)
|
|
|
@@ -471,6 +506,7 @@ export struct MainView{
|
|
|
.fontColor('rgba(0, 0, 0, 0.95)')
|
|
|
.onClick(() => {
|
|
|
this.currentMerit = 0
|
|
|
+ this.totalMerit=this.Merit[0]
|
|
|
YTUserRequest.resetFish()
|
|
|
})
|
|
|
|
|
|
@@ -486,6 +522,7 @@ export struct MainView{
|
|
|
.width(80).color('rgba(61, 186, 208, 1)')
|
|
|
.style({ strokeWidth: 7, shadow: true })
|
|
|
.backgroundColor(Color.White)
|
|
|
+ .value(this.currentMerit)
|
|
|
Text('集福').fontSize(20).fontColor('rgba(252, 253, 237, 1)')
|
|
|
}.margin({ left: 10 })
|
|
|
|
|
|
@@ -566,16 +603,16 @@ export struct MainView{
|
|
|
.fontColor(Color.White)
|
|
|
.backgroundColor('#252111')
|
|
|
.bindSheet($$this.isShowTimeManger, this.TimeMangerBuilder
|
|
|
- , {
|
|
|
- width: '100%',
|
|
|
- height: 400,
|
|
|
- showClose: false,
|
|
|
- onWillDismiss: ((dismissSheetAction: DismissSheetAction) => {
|
|
|
- if (dismissSheetAction.reason == DismissReason.SLIDE_DOWN) {
|
|
|
- dismissSheetAction.dismiss(); //注册dismiss行为
|
|
|
- }
|
|
|
- }),
|
|
|
- })
|
|
|
+ , {
|
|
|
+ width: '100%',
|
|
|
+ height: 400,
|
|
|
+ showClose: false,
|
|
|
+ onWillDismiss: ((dismissSheetAction: DismissSheetAction) => {
|
|
|
+ if (dismissSheetAction.reason == DismissReason.SLIDE_DOWN) {
|
|
|
+ dismissSheetAction.dismiss(); //注册dismiss行为
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ })
|
|
|
.onClick(() => {
|
|
|
this.isShowTimeManger = true
|
|
|
this.woodenfishModel=2
|