Showing
10 changed files
with
241 additions
and
36 deletions
| @@ -30,7 +30,8 @@ export struct DetailPlayShortVideoPage { | @@ -30,7 +30,8 @@ export struct DetailPlayShortVideoPage { | ||
| 30 | @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 | 30 | @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 |
| 31 | @Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 31 | @Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 32 | @Provide followStatus: string = '0' // 关注状态 | 32 | @Provide followStatus: string = '0' // 关注状态 |
| 33 | - @Provide isOpenDetail: boolean = false | 33 | + @Provide isOpenDetail: boolean = false // 查看详情按钮点击 |
| 34 | + @Provide isDragging: boolean = false // 拖动时间进度条 | ||
| 34 | @Consume @Watch('pageShowChange') pageShow: number | 35 | @Consume @Watch('pageShowChange') pageShow: number |
| 35 | @Consume @Watch('pageHideChange') pageHide: number | 36 | @Consume @Watch('pageHideChange') pageHide: number |
| 36 | 37 | ||
| @@ -138,8 +139,12 @@ export struct DetailPlayShortVideoPage { | @@ -138,8 +139,12 @@ export struct DetailPlayShortVideoPage { | ||
| 138 | build() { | 139 | build() { |
| 139 | Stack({ alignContent: Alignment.Top }) { | 140 | Stack({ alignContent: Alignment.Top }) { |
| 140 | this.playerViewBuilder() | 141 | this.playerViewBuilder() |
| 141 | - PlayerBottomView() | ||
| 142 | - PlayerRightView() | 142 | + PlayerBottomView({ |
| 143 | + playerController: this.playerController | ||
| 144 | + }) | ||
| 145 | + PlayerRightView({ | ||
| 146 | + playerController: this.playerController | ||
| 147 | + }) | ||
| 143 | 148 | ||
| 144 | } | 149 | } |
| 145 | .height('100%') | 150 | .height('100%') |
| 1 | +export class PlayerConstants { | ||
| 2 | + static readonly STATUS_IDLE: number = 0; | ||
| 3 | + static readonly STATUS_START: number = 1; | ||
| 4 | + static readonly STATUS_PAUSE: number = 2; | ||
| 5 | + static readonly STATUS_STOP: number = 3; | ||
| 6 | +} | ||
| 7 | + | ||
| 8 | + | ||
| 1 | @Preview | 9 | @Preview |
| 2 | @Component | 10 | @Component |
| 3 | export struct Test { | 11 | export struct Test { |
| 4 | - build() { | ||
| 5 | - Stack({ alignContent: Alignment.Top }) { | 12 | + @State progressVal: number = 10; |
| 13 | + @State status: number = PlayerConstants.STATUS_PAUSE; | ||
| 14 | + | ||
| 15 | + padding1(num: string) { | ||
| 16 | + let length = 2; | ||
| 17 | + for (let len = (num.toString()).length; len < length; len = num.length) { | ||
| 18 | + num = `${'0'}${num}`; | ||
| 19 | + } | ||
| 20 | + return num; | ||
| 21 | + } | ||
| 6 | 22 | ||
| 7 | - Text('视频').width('100%').height('50%').backgroundColor('#000').fontColor(Color.White) | 23 | + secondToTime(seconds: number) { |
| 24 | + let time = '00:00' | ||
| 25 | + let hourUnit = 60 * 60; | ||
| 26 | + let hour = Math.floor(seconds / hourUnit); | ||
| 27 | + let minute = Math.floor((seconds - hour * hourUnit) / 60); | ||
| 28 | + let second = seconds - hour * hourUnit - minute * 60; | ||
| 29 | + if (hour > 0) { | ||
| 30 | + return `${this.padding1(hour.toString())}${':'}${this.padding1(minute.toString())}${':'}${this.padding1(second.toString())}`; | ||
| 31 | + } | ||
| 32 | + if (minute > 0) { | ||
| 33 | + return `${this.padding1(minute.toString())}${':'}${this.padding1(second.toString())}`; | ||
| 34 | + } else { | ||
| 35 | + return `${'00'}${':'}${this.padding1(second.toString())}`; | ||
| 36 | + } | ||
| 37 | + } | ||
| 8 | 38 | ||
| 9 | - Row() { | ||
| 10 | - Text('title') | ||
| 11 | - Text('contentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontent') | 39 | + build() { |
| 40 | + Column() { | ||
| 41 | + | ||
| 42 | + Text() { | ||
| 43 | + Span(this.secondToTime(6)) | ||
| 44 | + Span(' / ') | ||
| 45 | + Span('00:06') | ||
| 12 | } | 46 | } |
| 13 | - .backgroundColor('#ff0000') | ||
| 14 | - .align(Alignment.BottomStart) | ||
| 15 | - .position({ y: '100%' }) | ||
| 16 | - .markAnchor({ y: '100%' }) | 47 | + .fontSize(24) |
| 48 | + .fontColor(Color.White) | ||
| 49 | + .fontWeight(600) | ||
| 50 | + .margin({ bottom: 30 }) | ||
| 51 | + | ||
| 52 | + // .visibility(Visibility.None) | ||
| 53 | + | ||
| 54 | + Slider({ | ||
| 55 | + value: this.progressVal, | ||
| 56 | + step: 0.01, | ||
| 57 | + // style: SliderStyle.OutSet | ||
| 58 | + }) | ||
| 59 | + .blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color')) | ||
| 60 | + .trackColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_track_color') : $r('app.color.pause_track_color')) | ||
| 61 | + .selectedColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_selected_color') : $r('app.color.pause_selected_color')) | ||
| 62 | + .trackThickness(this.status === PlayerConstants.STATUS_START ? 1 : 4) | ||
| 63 | + .blockStyle({ | ||
| 64 | + type: this.status === PlayerConstants.STATUS_START ? SliderBlockType.DEFAULT : SliderBlockType.IMAGE, | ||
| 65 | + image: $r('app.media.ic_player_block') | ||
| 66 | + }) | ||
| 67 | + .blockSize({ width: 18, height: 12 }) | ||
| 68 | + .width('100%')// .height(19) | ||
| 69 | + .onChange((value: number, mode: SliderChangeMode) => { | ||
| 70 | + // this.playerController?.setSeekTime(Math.floor(value), mode); | ||
| 71 | + }) | ||
| 17 | 72 | ||
| 18 | } | 73 | } |
| 19 | - .width(300) | ||
| 20 | - .height(600) | ||
| 21 | - .backgroundColor('#cccccc') | 74 | + .backgroundColor(Color.Blue) |
| 75 | + .height('100%') | ||
| 22 | } | 76 | } |
| 23 | } | 77 | } |
| @@ -2,20 +2,21 @@ import { WDPlayerController } from 'wdPlayer/Index'; | @@ -2,20 +2,21 @@ import { WDPlayerController } from 'wdPlayer/Index'; | ||
| 2 | import { PlayerTitleView } from './PlayerTitleView' | 2 | import { PlayerTitleView } from './PlayerTitleView' |
| 3 | import { PlayerProgressView } from './PlayerProgressView' | 3 | import { PlayerProgressView } from './PlayerProgressView' |
| 4 | import { PlayerCommentView } from './PlayerCommentView' | 4 | import { PlayerCommentView } from './PlayerCommentView' |
| 5 | +import { PlayerTimeSeekView } from './PlayerTimeSeekView' | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export struct PlayerBottomView { | 8 | export struct PlayerBottomView { |
| 9 | + private playerController?: WDPlayerController; | ||
| 8 | @Consume showComment?: boolean | 10 | @Consume showComment?: boolean |
| 9 | @Consume isOpenDetail?: boolean | 11 | @Consume isOpenDetail?: boolean |
| 10 | - private playerController?: WDPlayerController; | 12 | + @Consume isDragging?: boolean |
| 11 | 13 | ||
| 12 | build() { | 14 | build() { |
| 13 | Column() { | 15 | Column() { |
| 14 | PlayerTitleView() | 16 | PlayerTitleView() |
| 15 | PlayerProgressView({ playerController: this.playerController }) | 17 | PlayerProgressView({ playerController: this.playerController }) |
| 16 | - .visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible) | ||
| 17 | if (this.showComment) { | 18 | if (this.showComment) { |
| 18 | - PlayerCommentView().visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible) | 19 | + PlayerCommentView() |
| 19 | } | 20 | } |
| 20 | } | 21 | } |
| 21 | .alignItems(HorizontalAlign.Start) | 22 | .alignItems(HorizontalAlign.Start) |
| @@ -3,6 +3,7 @@ import router from '@ohos.router'; | @@ -3,6 +3,7 @@ import router from '@ohos.router'; | ||
| 3 | @Component | 3 | @Component |
| 4 | export struct PlayerCommentView { | 4 | export struct PlayerCommentView { |
| 5 | @Consume showComment?: boolean | 5 | @Consume showComment?: boolean |
| 6 | + @Consume isOpenDetail?: boolean | ||
| 6 | @State comment: string = ''; | 7 | @State comment: string = ''; |
| 7 | 8 | ||
| 8 | build() { | 9 | build() { |
| @@ -30,5 +31,6 @@ export struct PlayerCommentView { | @@ -30,5 +31,6 @@ export struct PlayerCommentView { | ||
| 30 | .backgroundColor(Color.Black) | 31 | .backgroundColor(Color.Black) |
| 31 | .alignItems(VerticalAlign.Center) | 32 | .alignItems(VerticalAlign.Center) |
| 32 | .padding({ left: 16, right: 16, top: 11, bottom: 11 }) | 33 | .padding({ left: 16, right: 16, top: 11, bottom: 11 }) |
| 34 | + .visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible) | ||
| 33 | } | 35 | } |
| 34 | } | 36 | } |
| 1 | +import { ContentDetailDTO } from 'wdBean/Index'; | ||
| 2 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 1 | import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'; | 3 | import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'; |
| 2 | 4 | ||
| 3 | @Component | 5 | @Component |
| 4 | export struct PlayerProgressView { | 6 | export struct PlayerProgressView { |
| 5 | private playerController?: WDPlayerController; | 7 | private playerController?: WDPlayerController; |
| 8 | + @Consume contentDetailData: ContentDetailDTO | ||
| 6 | @Consume progressVal: number; | 9 | @Consume progressVal: number; |
| 10 | + @Consume isOpenDetail: boolean | ||
| 11 | + @Consume isDragging: boolean | ||
| 7 | @State status: number = PlayerConstants.STATUS_START; | 12 | @State status: number = PlayerConstants.STATUS_START; |
| 8 | 13 | ||
| 9 | aboutToAppear() { | 14 | aboutToAppear() { |
| 10 | if (this.playerController) { | 15 | if (this.playerController) { |
| 11 | this.playerController.onStatusChange = (status: number) => { | 16 | this.playerController.onStatusChange = (status: number) => { |
| 12 | this.status = status | 17 | this.status = status |
| 18 | + console.log('=============', this.status) | ||
| 13 | } | 19 | } |
| 14 | } | 20 | } |
| 15 | } | 21 | } |
| 16 | 22 | ||
| 17 | build() { | 23 | build() { |
| 24 | + Column() { | ||
| 25 | + Text() { | ||
| 26 | + Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.contentDetailData.videoInfo[0].videoDuration))) | ||
| 27 | + Span(' / ') | ||
| 28 | + Span(DateTimeUtils.secondToTime(this.contentDetailData.videoInfo[0].videoDuration || 0)) | ||
| 29 | + } | ||
| 30 | + .fontSize(24) | ||
| 31 | + .fontColor(Color.White) | ||
| 32 | + .fontWeight(600) | ||
| 33 | + .margin({ bottom: 30 }) | ||
| 34 | + .visibility(this.isDragging ? Visibility.Visible : Visibility.None) | ||
| 35 | + | ||
| 18 | Slider({ | 36 | Slider({ |
| 19 | value: this.progressVal, | 37 | value: this.progressVal, |
| 20 | step: 0.01, | 38 | step: 0.01, |
| 21 | // style: SliderStyle.OutSet | 39 | // style: SliderStyle.OutSet |
| 22 | }) | 40 | }) |
| 23 | - .blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color')) | ||
| 24 | - .trackColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_track_color') : $r('app.color.pause_track_color')) | ||
| 25 | - .selectedColor(this.status === PlayerConstants.STATUS_START ? $r('app.color.play_selected_color') : $r('app.color.pause_selected_color')) | ||
| 26 | - .trackThickness(this.status === PlayerConstants.STATUS_START ? 1 : 4) | 41 | + .blockColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.play_block_color') : Color.Transparent) |
| 42 | + .trackColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.pause_track_color') : $r('app.color.play_track_color')) | ||
| 43 | + .selectedColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.pause_selected_color') : $r('app.color.play_selected_color')) | ||
| 44 | + .trackThickness(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? 4 : 1) | ||
| 27 | .blockStyle({ | 45 | .blockStyle({ |
| 28 | - type: this.status === PlayerConstants.STATUS_START ? SliderBlockType.DEFAULT : SliderBlockType.IMAGE, | 46 | + type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE : SliderBlockType.DEFAULT, |
| 29 | image: $r('app.media.ic_player_block') | 47 | image: $r('app.media.ic_player_block') |
| 30 | }) | 48 | }) |
| 31 | .blockSize({ width: 18, height: 12 }) | 49 | .blockSize({ width: 18, height: 12 }) |
| 32 | .width('100%') | 50 | .width('100%') |
| 33 | .height(19) | 51 | .height(19) |
| 34 | .onChange((value: number, mode: SliderChangeMode) => { | 52 | .onChange((value: number, mode: SliderChangeMode) => { |
| 35 | - this.playerController?.setSeekTime(Math.floor(value), mode); | 53 | + this.progressVal = value |
| 54 | + if (mode === SliderChangeMode.Moving) { | ||
| 55 | + this.isDragging = true | ||
| 56 | + } | ||
| 57 | + if (mode === SliderChangeMode.End) { | ||
| 58 | + this.isDragging = false | ||
| 59 | + } | ||
| 60 | + this.playerController?.setSeekTime(value, mode); | ||
| 61 | + console.log('slider onChange:', value, mode) | ||
| 62 | + | ||
| 36 | }) | 63 | }) |
| 64 | + }.visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible) | ||
| 37 | } | 65 | } |
| 38 | } | 66 | } |
| @@ -33,6 +33,7 @@ export struct PlayerRightView { | @@ -33,6 +33,7 @@ export struct PlayerRightView { | ||
| 33 | @Consume newsStatusOfUser: batchLikeAndCollectResult | 33 | @Consume newsStatusOfUser: batchLikeAndCollectResult |
| 34 | @Consume followStatus: string | 34 | @Consume followStatus: string |
| 35 | @Consume isOpenDetail: boolean | 35 | @Consume isOpenDetail: boolean |
| 36 | + @Consume isDragging: boolean | ||
| 36 | @State operationList: OperationItem[] = [ | 37 | @State operationList: OperationItem[] = [ |
| 37 | { | 38 | { |
| 38 | icon: $r('app.media.ic_like_uncheck'), | 39 | icon: $r('app.media.ic_like_uncheck'), |
| @@ -309,6 +310,6 @@ export struct PlayerRightView { | @@ -309,6 +310,6 @@ export struct PlayerRightView { | ||
| 309 | .position({ x: '100%', y: '100%' }) | 310 | .position({ x: '100%', y: '100%' }) |
| 310 | .markAnchor({ x: '100%', y: '100%' }) | 311 | .markAnchor({ x: '100%', y: '100%' }) |
| 311 | .padding({ bottom: 72 }) | 312 | .padding({ bottom: 72 }) |
| 312 | - .visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible) | 313 | + .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) |
| 313 | } | 314 | } |
| 314 | } | 315 | } |
| @@ -9,6 +9,7 @@ export struct PlayerTitleView { | @@ -9,6 +9,7 @@ export struct PlayerTitleView { | ||
| 9 | @Consume contentDetailData: ContentDetailDTO | 9 | @Consume contentDetailData: ContentDetailDTO |
| 10 | @Consume windowWidth: number | 10 | @Consume windowWidth: number |
| 11 | @Consume isOpenDetail: boolean | 11 | @Consume isOpenDetail: boolean |
| 12 | + @Consume isDragging: boolean | ||
| 12 | @State titleHeight: number = 0 | 13 | @State titleHeight: number = 0 |
| 13 | dialogController: CustomDialogController = new CustomDialogController({ | 14 | dialogController: CustomDialogController = new CustomDialogController({ |
| 14 | builder: DetailDialog({ | 15 | builder: DetailDialog({ |
| @@ -104,6 +105,6 @@ export struct PlayerTitleView { | @@ -104,6 +105,6 @@ export struct PlayerTitleView { | ||
| 104 | .width(this.windowWidth - 100 + 'px') | 105 | .width(this.windowWidth - 100 + 'px') |
| 105 | .padding({ left: 16, right: 22 }) | 106 | .padding({ left: 16, right: 22 }) |
| 106 | .alignItems(HorizontalAlign.Start) | 107 | .alignItems(HorizontalAlign.Start) |
| 107 | - .visibility(this.isOpenDetail ? Visibility.None : Visibility.Visible) | 108 | + .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) |
| 108 | } | 109 | } |
| 109 | } | 110 | } |
| @@ -55,6 +55,7 @@ struct LoginPage { | @@ -55,6 +55,7 @@ struct LoginPage { | ||
| 55 | alignment:DialogAlignment.Center | 55 | alignment:DialogAlignment.Center |
| 56 | }) | 56 | }) |
| 57 | loginViewModel = new LoginViewModel() | 57 | loginViewModel = new LoginViewModel() |
| 58 | + @State isProtocol:boolean=false | ||
| 58 | 59 | ||
| 59 | onCodeSend() { | 60 | onCodeSend() { |
| 60 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") | 61 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") |
| @@ -72,6 +73,7 @@ struct LoginPage { | @@ -72,6 +73,7 @@ struct LoginPage { | ||
| 72 | } | 73 | } |
| 73 | 74 | ||
| 74 | build() { | 75 | build() { |
| 76 | + Stack() { | ||
| 75 | RelativeContainer() { | 77 | RelativeContainer() { |
| 76 | 78 | ||
| 77 | //注册内容 | 79 | //注册内容 |
| @@ -105,13 +107,13 @@ struct LoginPage { | @@ -105,13 +107,13 @@ struct LoginPage { | ||
| 105 | Text() { | 107 | Text() { |
| 106 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) | 108 | Span("我已阅读并同意").fontColor("#999999").fontSize(12) |
| 107 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { | 109 | Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 108 | - let bean={contentID:"1",pageID:""} as Params | ||
| 109 | - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 110 | + let bean = { contentID: "1", pageID: "" } as Params |
| 111 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 110 | }) | 112 | }) |
| 111 | Span("及").fontColor("#999999").fontSize(12) | 113 | Span("及").fontColor("#999999").fontSize(12) |
| 112 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { | 114 | Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => { |
| 113 | - let bean={contentID:"2",pageID:""} as Params | ||
| 114 | - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 115 | + let bean = { contentID: "2", pageID: "" } as Params |
| 116 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 115 | }) | 117 | }) |
| 116 | } | 118 | } |
| 117 | }.margin({ top: 48 }).alignItems(VerticalAlign.Center) | 119 | }.margin({ top: 48 }).alignItems(VerticalAlign.Center) |
| @@ -119,16 +121,16 @@ struct LoginPage { | @@ -119,16 +121,16 @@ struct LoginPage { | ||
| 119 | Row() { | 121 | Row() { |
| 120 | Text("登录") | 122 | Text("登录") |
| 121 | .borderRadius(4) | 123 | .borderRadius(4) |
| 122 | - .fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF") | 124 | + .fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF") |
| 123 | .fontSize(18) | 125 | .fontSize(18) |
| 124 | .fontWeight(FontWeight.Medium) | 126 | .fontWeight(FontWeight.Medium) |
| 125 | .margin({ top: 20 }) | 127 | .margin({ top: 20 }) |
| 126 | .height(44) | 128 | .height(44) |
| 127 | .textAlign(TextAlign.Center) | 129 | .textAlign(TextAlign.Center) |
| 128 | .width("100%") | 130 | .width("100%") |
| 129 | - .backgroundColor(this.isSubmit?"#FFED2800":"#99ED2800") | 131 | + .backgroundColor(this.isSubmit ? "#FFED2800" : "#99ED2800") |
| 130 | .onClick(() => { | 132 | .onClick(() => { |
| 131 | - if(!this.isSubmit){ | 133 | + if (!this.isSubmit) { |
| 132 | return | 134 | return |
| 133 | } | 135 | } |
| 134 | this.loginSubmit() | 136 | this.loginSubmit() |
| @@ -141,7 +143,7 @@ struct LoginPage { | @@ -141,7 +143,7 @@ struct LoginPage { | ||
| 141 | Text('忘记密码').fontColor('#666666').fontSize(14).margin({ top: 16 }) | 143 | Text('忘记密码').fontColor('#666666').fontSize(14).margin({ top: 16 }) |
| 142 | .onClick(() => { | 144 | .onClick(() => { |
| 143 | // router.pushUrl({ url: 'pages/login/ForgetPasswordPage' }) | 145 | // router.pushUrl({ url: 'pages/login/ForgetPasswordPage' }) |
| 144 | - let pageType = {'pageType': 0} as Record<string, number>; | 146 | + let pageType = { 'pageType': 0 } as Record<string, number>; |
| 145 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 147 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) |
| 146 | }) | 148 | }) |
| 147 | } | 149 | } |
| @@ -174,6 +176,16 @@ struct LoginPage { | @@ -174,6 +176,16 @@ struct LoginPage { | ||
| 174 | .id('id_close') | 176 | .id('id_close') |
| 175 | 177 | ||
| 176 | }.width('100%').height('100%') | 178 | }.width('100%').height('100%') |
| 179 | + | ||
| 180 | + ProtocolComponent({ | ||
| 181 | + cancelMethod: (): void => this.cancelProtocol(), | ||
| 182 | + agreeMethod: (): void => this.agreeProtocol() | ||
| 183 | + }) | ||
| 184 | + .visibility(this.isProtocol ? Visibility.Visible : Visibility.None) | ||
| 185 | + | ||
| 186 | + }.width('100%') | ||
| 187 | + .height('100%') | ||
| 188 | + | ||
| 177 | } | 189 | } |
| 178 | 190 | ||
| 179 | @Builder | 191 | @Builder |
| @@ -366,8 +378,92 @@ struct LoginPage { | @@ -366,8 +378,92 @@ struct LoginPage { | ||
| 366 | if (this.protocolState) { | 378 | if (this.protocolState) { |
| 367 | this.requestLogin() | 379 | this.requestLogin() |
| 368 | } else { | 380 | } else { |
| 369 | - this.dialogController.open() | 381 | + // this.dialogController.open() |
| 382 | + this.isProtocol=true | ||
| 383 | + } | ||
| 384 | + | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + agreeProtocol(): void { | ||
| 388 | + this.isProtocol = false | ||
| 389 | + this.protocolState = true | ||
| 390 | + this.requestLogin() | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + cancelProtocol(): void { | ||
| 394 | + this.isProtocol = false | ||
| 370 | } | 395 | } |
| 396 | +} | ||
| 397 | + | ||
| 398 | + | ||
| 399 | +@Component | ||
| 400 | +struct ProtocolComponent { | ||
| 401 | + cancelMethod?: () => void | ||
| 402 | + agreeMethod?: () => void | ||
| 403 | + | ||
| 404 | + build() { | ||
| 405 | + Stack() { | ||
| 406 | + Column() { | ||
| 407 | + Text("温馨提示") | ||
| 408 | + .fontColor("#222222") | ||
| 409 | + .fontSize(18) | ||
| 410 | + .width("100%") | ||
| 411 | + .fontWeight(FontWeight.Bold) | ||
| 412 | + .textAlign(TextAlign.Center) | ||
| 413 | + .margin({ top: 20 }) | ||
| 414 | + Text() { | ||
| 415 | + Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666") | ||
| 416 | + Span("《用户协议》").fontSize(14).fontColor("#ED2800").onClick(() => { | ||
| 417 | + let bean = { contentID: "1", pageID: "" } as Params | ||
| 418 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 419 | + }) | ||
| 420 | + Span("及").fontSize(14).fontColor("#666666") | ||
| 421 | + Span("《隐私政策》").fontSize(14).fontColor("#ED2800").onClick(() => { | ||
| 422 | + let bean = { contentID: "2", pageID: "" } as Params | ||
| 423 | + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | ||
| 424 | + }) | ||
| 425 | + Span("后进行登录").fontSize(14).fontColor("#666666") | ||
| 426 | + }.margin({ top: 12, left: 16, right: 16 }) | ||
| 427 | + | ||
| 428 | + Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') | ||
| 429 | + Row() { | ||
| 430 | + Text('放弃登录') | ||
| 431 | + .fontSize(16) | ||
| 432 | + .fontColor("#999999") | ||
| 433 | + .layoutWeight(1) | ||
| 434 | + .fontWeight(FontWeight.Medium) | ||
| 435 | + .textAlign(TextAlign.Center) | ||
| 436 | + .onClick(() => { | ||
| 437 | + if (this.cancelMethod) { | ||
| 438 | + this.cancelMethod() | ||
| 439 | + } | ||
| 440 | + }) | ||
| 441 | + .height('100%') | ||
| 442 | + // Divider().color("#999999").height('100%').width('0.5vp') | ||
| 443 | + Text('同意并登录') | ||
| 444 | + .fontSize(16) | ||
| 445 | + .fontColor("#ED2800") | ||
| 446 | + .layoutWeight(1) | ||
| 447 | + .fontWeight(FontWeight.Medium) | ||
| 448 | + .textAlign(TextAlign.Center) | ||
| 449 | + .border({ | ||
| 450 | + width: { left: 1 }, | ||
| 451 | + color: "#999999", | ||
| 452 | + style: { left: BorderStyle.Solid } | ||
| 453 | + | ||
| 454 | + }) | ||
| 455 | + .onClick(() => { | ||
| 456 | + if (this.agreeMethod) { | ||
| 457 | + this.agreeMethod() | ||
| 458 | + } | ||
| 459 | + }) | ||
| 460 | + .height('100%') | ||
| 461 | + }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 462 | + }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%') | ||
| 463 | + | ||
| 464 | + }.width('100%') | ||
| 465 | + .height('100%') | ||
| 466 | + .backgroundColor('#66000000') | ||
| 371 | 467 | ||
| 372 | } | 468 | } |
| 373 | } | 469 | } |
-
Please register or login to post a comment