douaojie

Merge remote-tracking branch 'origin/main'

@@ -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,9 +139,13 @@ export struct DetailPlayShortVideoPage { @@ -138,9 +139,13 @@ 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()  
143 - 142 + PlayerBottomView({
  143 + playerController: this.playerController
  144 + })
  145 + PlayerRightView({
  146 + playerController: this.playerController
  147 + })
  148 +
144 } 149 }
145 .height('100%') 150 .height('100%')
146 .width('100%') 151 .width('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;
6 14
7 - Text('视频').width('100%').height('50%').backgroundColor('#000').fontColor(Color.White) 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 + }
8 22
9 - Row() {  
10 - Text('title')  
11 - Text('contentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontentcontent') 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 + }
  38 +
  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 }
@@ -26,7 +26,7 @@ const TAG = 'VideoChannelDetail' @@ -26,7 +26,7 @@ const TAG = 'VideoChannelDetail'
26 let timer: number = -1 26 let timer: number = -1
27 27
28 const storage = LocalStorage.getShared(); 28 const storage = LocalStorage.getShared();
29 - 29 +
30 @Entry(storage) 30 @Entry(storage)
31 @Component 31 @Component
32 export struct VideoChannelDetail { 32 export struct VideoChannelDetail {
@@ -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() {
18 - Slider({  
19 - value: this.progressVal,  
20 - step: 0.01,  
21 - // style: SliderStyle.OutSet  
22 - })  
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)  
27 - .blockStyle({  
28 - type: this.status === PlayerConstants.STATUS_START ? SliderBlockType.DEFAULT : SliderBlockType.IMAGE,  
29 - image: $r('app.media.ic_player_block')  
30 - })  
31 - .blockSize({ width: 18, height: 12 })  
32 - .width('100%')  
33 - .height(19)  
34 - .onChange((value: number, mode: SliderChangeMode) => {  
35 - this.playerController?.setSeekTime(Math.floor(value), mode); 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 +
  36 + Slider({
  37 + value: this.progressVal,
  38 + step: 0.01,
  39 + // style: SliderStyle.OutSet
36 }) 40 })
  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)
  45 + .blockStyle({
  46 + type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE : SliderBlockType.DEFAULT,
  47 + image: $r('app.media.ic_player_block')
  48 + })
  49 + .blockSize({ width: 18, height: 12 })
  50 + .width('100%')
  51 + .height(19)
  52 + .onChange((value: number, mode: SliderChangeMode) => {
  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 +
  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 }
  1 +@Preview
  2 +@Component
  3 +export struct PlayerTimeSeekView {
  4 + build() {
  5 + Row() {
  6 + Text() {
  7 + Span('00:06')
  8 + Span('/')
  9 + Span('00:06')
  10 + }
  11 + .fontSize(24)
  12 + .fontColor(Color.White)
  13 + .fontWeight(600)
  14 +
  15 + }
  16 + }
  17 +}
@@ -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,108 +73,119 @@ struct LoginPage { @@ -72,108 +73,119 @@ struct LoginPage {
72 } 73 }
73 74
74 build() { 75 build() {
75 - RelativeContainer() {  
76 -  
77 - //注册内容  
78 - Column() {  
79 - Image($r("app.media.login_logo"))  
80 - .width(120)  
81 - .height(66)  
82 - .margin({ top: 78 })  
83 - .align(Alignment.Center)  
84 -  
85 - if (this.checkCodePage) {  
86 - LoginInputComponent({  
87 - phoneContent: $phoneContent,  
88 - codeContent: $codeContent,  
89 - isSubmit: $isSubmit,  
90 - isCodeSend: $isCodeSend  
91 - })  
92 - } else {  
93 - this.addPassword()  
94 - }  
95 - 76 + Stack() {
  77 + RelativeContainer() {
96 78
97 - Row() {  
98 - Image(this.protocolState ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected'))  
99 - .width(15)  
100 - .height(15)  
101 - .onClick(() => {  
102 - this.protocolState = !this.protocolState 79 + //注册内容
  80 + Column() {
  81 + Image($r("app.media.login_logo"))
  82 + .width(120)
  83 + .height(66)
  84 + .margin({ top: 78 })
  85 + .align(Alignment.Center)
  86 +
  87 + if (this.checkCodePage) {
  88 + LoginInputComponent({
  89 + phoneContent: $phoneContent,
  90 + codeContent: $codeContent,
  91 + isSubmit: $isSubmit,
  92 + isCodeSend: $isCodeSend
103 }) 93 })
  94 + } else {
  95 + this.addPassword()
  96 + }
104 97
105 - Text() {  
106 - Span("我已阅读并同意").fontColor("#999999").fontSize(12)  
107 - Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => {  
108 - let bean={contentID:"1",pageID:""} as Params  
109 - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)  
110 - })  
111 - Span("及").fontColor("#999999").fontSize(12)  
112 - Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => {  
113 - let bean={contentID:"2",pageID:""} as Params  
114 - WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)  
115 - }) 98 +
  99 + Row() {
  100 + Image(this.protocolState ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected'))
  101 + .width(15)
  102 + .height(15)
  103 + .onClick(() => {
  104 + this.protocolState = !this.protocolState
  105 + })
  106 +
  107 + Text() {
  108 + Span("我已阅读并同意").fontColor("#999999").fontSize(12)
  109 + Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => {
  110 + let bean = { contentID: "1", pageID: "" } as Params
  111 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
  112 + })
  113 + Span("及").fontColor("#999999").fontSize(12)
  114 + Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => {
  115 + let bean = { contentID: "2", pageID: "" } as Params
  116 + WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
  117 + })
  118 + }
  119 + }.margin({ top: 48 }).alignItems(VerticalAlign.Center)
  120 +
  121 + Row() {
  122 + Text("登录")
  123 + .borderRadius(4)
  124 + .fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF")
  125 + .fontSize(18)
  126 + .fontWeight(FontWeight.Medium)
  127 + .margin({ top: 20 })
  128 + .height(44)
  129 + .textAlign(TextAlign.Center)
  130 + .width("100%")
  131 + .backgroundColor(this.isSubmit ? "#FFED2800" : "#99ED2800")
  132 + .onClick(() => {
  133 + if (!this.isSubmit) {
  134 + return
  135 + }
  136 + this.loginSubmit()
  137 +
  138 + })
  139 + }.padding({ left: 25, right: 25 }).width('100%')
  140 +
  141 +
  142 + if (!this.checkCodePage) {
  143 + Text('忘记密码').fontColor('#666666').fontSize(14).margin({ top: 16 })
  144 + .onClick(() => {
  145 + // router.pushUrl({ url: 'pages/login/ForgetPasswordPage' })
  146 + let pageType = { 'pageType': 0 } as Record<string, number>;
  147 + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)
  148 + })
116 } 149 }
117 - }.margin({ top: 48 }).alignItems(VerticalAlign.Center)  
118 150
119 - Row() {  
120 - Text("登录")  
121 - .borderRadius(4)  
122 - .fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF")  
123 - .fontSize(18)  
124 - .fontWeight(FontWeight.Medium)  
125 - .margin({ top: 20 })  
126 - .height(44)  
127 - .textAlign(TextAlign.Center)  
128 - .width("100%")  
129 - .backgroundColor(this.isSubmit?"#FFED2800":"#99ED2800")  
130 - .onClick(() => {  
131 - if(!this.isSubmit){  
132 - return  
133 - }  
134 - this.loginSubmit() 151 + }.width("100%")
  152 + .alignRules({
  153 + top: { anchor: "__container__", align: VerticalAlign.Top },
  154 + }).id("register")
135 155
136 - })  
137 - }.padding({ left: 25, right: 25 }).width('100%') 156 + //其他登录方式
  157 + Column() {
  158 + this.addOtherLogin()
  159 + }.width('100%')
  160 + .alignRules({
  161 + bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
  162 + }).id("other")
138 163
  164 + //关闭按钮
  165 + Image($r('app.media.login_closed'))
  166 + .width(24)
  167 + .height(24)
  168 + .margin({ top: 10, right: 15 })
  169 + .alignRules({
  170 + top: { anchor: "__container__", align: VerticalAlign.Top },
  171 + right: { anchor: "__container__", align: HorizontalAlign.End }
  172 + })
  173 + .onClick(() => {
  174 + router.back()
  175 + })
  176 + .id('id_close')
139 177
140 - if (!this.checkCodePage) {  
141 - Text('忘记密码').fontColor('#666666').fontSize(14).margin({ top: 16 })  
142 - .onClick(() => {  
143 - // router.pushUrl({ url: 'pages/login/ForgetPasswordPage' })  
144 - let pageType = {'pageType': 0} as Record<string, number>;  
145 - WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType)  
146 - })  
147 - } 178 + }.width('100%').height('100%')
148 179
149 - }.width("100%")  
150 - .alignRules({  
151 - top: { anchor: "__container__", align: VerticalAlign.Top },  
152 - }).id("register") 180 + ProtocolComponent({
  181 + cancelMethod: (): void => this.cancelProtocol(),
  182 + agreeMethod: (): void => this.agreeProtocol()
  183 + })
  184 + .visibility(this.isProtocol ? Visibility.Visible : Visibility.None)
153 185
154 - //其他登录方式  
155 - Column() {  
156 - this.addOtherLogin()  
157 - }.width('100%')  
158 - .alignRules({  
159 - bottom: { anchor: "__container__", align: VerticalAlign.Bottom },  
160 - }).id("other")  
161 -  
162 - //关闭按钮  
163 - Image($r('app.media.login_closed'))  
164 - .width(24)  
165 - .height(24)  
166 - .margin({ top: 10, right: 15 })  
167 - .alignRules({  
168 - top: { anchor: "__container__", align: VerticalAlign.Top },  
169 - right: { anchor: "__container__", align: HorizontalAlign.End }  
170 - })  
171 - .onClick(() => {  
172 - router.back()  
173 - })  
174 - .id('id_close') 186 + }.width('100%')
  187 + .height('100%')
175 188
176 - }.width('100%').height('100%')  
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
370 } 383 }
371 384
372 } 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
  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')
  467 +
  468 + }
373 } 469 }