yangchenggong1_wd

desc:登录相关页面 适配全屏

1 -@Entry  
2 -@Component  
3 -struct Index {  
4 - @State message: string = 'Hello World';  
5 -  
6 - build() {  
7 - Row() {  
8 - Column() {  
9 - Text(this.message)  
10 - .fontSize(50)  
11 - .fontWeight(FontWeight.Bold)  
12 - }  
13 - .width('100%')  
14 - }  
15 - .height('100%')  
16 - }  
17 -}  
@@ -24,6 +24,8 @@ struct ChangeBindPhonePage { @@ -24,6 +24,8 @@ struct ChangeBindPhonePage {
24 lastTime: number = 0 24 lastTime: number = 0
25 pageShowTime:number = 0; 25 pageShowTime:number = 0;
26 pageHideTime:number = 0; 26 pageHideTime:number = 0;
  27 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  28 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
27 29
28 30
29 onPageShow() { 31 onPageShow() {
@@ -58,6 +60,7 @@ struct ChangeBindPhonePage { @@ -58,6 +60,7 @@ struct ChangeBindPhonePage {
58 60
59 61
60 build() { 62 build() {
  63 + Column(){
61 Column() { 64 Column() {
62 Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => { 65 Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
63 router.back() 66 router.back()
@@ -156,6 +159,10 @@ struct ChangeBindPhonePage { @@ -156,6 +159,10 @@ struct ChangeBindPhonePage {
156 .padding({ left: 25, right: 25 }) 159 .padding({ left: 25, right: 25 })
157 160
158 }.width('100%').height('100%').alignItems(HorizontalAlign.Start) 161 }.width('100%').height('100%').alignItems(HorizontalAlign.Start)
  162 + }.width("100%")
  163 + .height("100%")
  164 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
  165 +
159 } 166 }
160 167
161 //发送验证码 168 //发送验证码
@@ -23,6 +23,8 @@ struct ForgetPasswordPage { @@ -23,6 +23,8 @@ struct ForgetPasswordPage {
23 @State pageTitle:string = '找回密码'; 23 @State pageTitle:string = '找回密码';
24 @State isForgetPassword: number = 0 //是否是登录页忘记密码过来的,标题不一样 24 @State isForgetPassword: number = 0 //是否是登录页忘记密码过来的,标题不一样
25 @State codeStateSuccess:boolean=false 25 @State codeStateSuccess:boolean=false
  26 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  27 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
26 onCodeSend() { 28 onCodeSend() {
27 if (this.isCodeSend) { 29 if (this.isCodeSend) {
28 this.sendVerifyCode() 30 this.sendVerifyCode()
@@ -43,6 +45,7 @@ struct ForgetPasswordPage { @@ -43,6 +45,7 @@ struct ForgetPasswordPage {
43 45
44 46
45 build() { 47 build() {
  48 + Column(){
46 Column() { 49 Column() {
47 Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => { 50 Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
48 router.back() 51 router.back()
@@ -79,6 +82,11 @@ struct ForgetPasswordPage { @@ -79,6 +82,11 @@ struct ForgetPasswordPage {
79 .height('100%') 82 .height('100%')
80 .alignItems(HorizontalAlign.Start) 83 .alignItems(HorizontalAlign.Start)
81 .backgroundColor(Color.White) 84 .backgroundColor(Color.White)
  85 +
  86 + }.width("100%")
  87 + .height("100%")
  88 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
  89 +
82 } 90 }
83 91
84 aboutToAppear() { 92 aboutToAppear() {
@@ -27,6 +27,8 @@ const TAG = "LoginPage" @@ -27,6 +27,8 @@ const TAG = "LoginPage"
27 @Entry 27 @Entry
28 @Component 28 @Component
29 struct LoginPage { 29 struct LoginPage {
  30 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  31 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
30 @State codeBtnState: boolean = false 32 @State codeBtnState: boolean = false
31 @State timeCount: number = 60 33 @State timeCount: number = 60
32 phoneController: TextInputController = new TextInputController() 34 phoneController: TextInputController = new TextInputController()
@@ -104,6 +106,7 @@ struct LoginPage { @@ -104,6 +106,7 @@ struct LoginPage {
104 } 106 }
105 107
106 build() { 108 build() {
  109 + Column(){
107 Stack() { 110 Stack() {
108 RelativeContainer() { 111 RelativeContainer() {
109 112
@@ -242,8 +245,12 @@ struct LoginPage { @@ -242,8 +245,12 @@ struct LoginPage {
242 .visibility(this.isProtocol ? Visibility.Visible : Visibility.None) 245 .visibility(this.isProtocol ? Visibility.Visible : Visibility.None)
243 246
244 }.width('100%') 247 }.width('100%')
245 - .height('100%') 248 + .height("100%")
246 .backgroundColor(Color.White) 249 .backgroundColor(Color.White)
  250 + }.width("100%")
  251 + .height("100%")
  252 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
  253 +
247 } 254 }
248 255
249 @Builder 256 @Builder
@@ -10,6 +10,8 @@ const TAG = 'LoginProtocolWebview'; @@ -10,6 +10,8 @@ const TAG = 'LoginProtocolWebview';
10 @Entry 10 @Entry
11 @Component 11 @Component
12 struct LoginProtocolWebview { 12 struct LoginProtocolWebview {
  13 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  14 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
13 webUrl: string = '' 15 webUrl: string = ''
14 webviewController: webview.WebviewController = new webview.WebviewController() 16 webviewController: webview.WebviewController = new webview.WebviewController()
15 userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html" 17 userProtocol = "https://cdnpeoplefrontuat.aikan.pdnews.cn/rmrb/rmrb-protocol-zh-web/0.0.1/app/protocol-1005.html"
@@ -55,7 +57,7 @@ struct LoginProtocolWebview { @@ -55,7 +57,7 @@ struct LoginProtocolWebview {
55 } 57 }
56 58
57 build() { 59 build() {
58 - 60 + Column(){
59 Column() { 61 Column() {
60 Row() { 62 Row() {
61 Image($r("app.media.login_back_icon")) 63 Image($r("app.media.login_back_icon"))
@@ -88,5 +90,9 @@ struct LoginProtocolWebview { @@ -88,5 +90,9 @@ struct LoginProtocolWebview {
88 }) 90 })
89 .padding({bottom:this.contentID === "2" ? "40lpx" : 0 }) 91 .padding({bottom:this.contentID === "2" ? "40lpx" : 0 })
90 } 92 }
  93 + }.width("100%")
  94 + .height("100%")
  95 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
  96 +
91 } 97 }
92 } 98 }
@@ -12,6 +12,8 @@ import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/I @@ -12,6 +12,8 @@ import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/I
12 @Entry 12 @Entry
13 @Component 13 @Component
14 struct ModifyPasswordPage { 14 struct ModifyPasswordPage {
  15 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  16 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
15 password_old: string = ''; 17 password_old: string = '';
16 password_new: string = ''; 18 password_new: string = '';
17 password_new_repeat: string = ''; 19 password_new_repeat: string = '';
@@ -64,9 +66,13 @@ struct ModifyPasswordPage { @@ -64,9 +66,13 @@ struct ModifyPasswordPage {
64 66
65 build() { 67 build() {
66 Column(){ 68 Column(){
  69 + Column(){
67 this.TitleBackComponent('') 70 this.TitleBackComponent('')
68 this.ModifyPasswordLayout() 71 this.ModifyPasswordLayout()
69 } 72 }
  73 + }.width("100%")
  74 + .height("100%")
  75 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
70 76
71 } 77 }
72 78
@@ -77,6 +77,8 @@ export struct SettingPasswordPage { @@ -77,6 +77,8 @@ export struct SettingPasswordPage {
77 @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; 77 @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm';
78 private breakpointSystem = new BreakpointSystem(); 78 private breakpointSystem = new BreakpointSystem();
79 @State percent:number = 1 79 @State percent:number = 1
  80 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  81 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
80 82
81 currentChanged(){ 83 currentChanged(){
82 if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ 84 if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){
@@ -169,9 +171,14 @@ export struct SettingPasswordPage { @@ -169,9 +171,14 @@ export struct SettingPasswordPage {
169 171
170 build() { 172 build() {
171 Column(){ 173 Column(){
  174 + Column(){
172 this.TitleBackComponent('') 175 this.TitleBackComponent('')
173 this.settingList() //滑动区域 176 this.settingList() //滑动区域
174 } 177 }
  178 + }.width("100%")
  179 + .height("100%")
  180 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
  181 +
175 } 182 }
176 183
177 @Builder TitleBackComponent(title:string){ 184 @Builder TitleBackComponent(title:string){
@@ -24,6 +24,8 @@ struct VerifyPhoneNumberPage { @@ -24,6 +24,8 @@ struct VerifyPhoneNumberPage {
24 isFirst:boolean=true//是否第一次获取验证码 24 isFirst:boolean=true//是否第一次获取验证码
25 pageShowTime:number = 0; 25 pageShowTime:number = 0;
26 pageHideTime:number = 0; 26 pageHideTime:number = 0;
  27 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  28 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
27 29
28 onCodeSend() { 30 onCodeSend() {
29 if (this.isCodeSend) { 31 if (this.isCodeSend) {
@@ -60,6 +62,7 @@ struct VerifyPhoneNumberPage { @@ -60,6 +62,7 @@ struct VerifyPhoneNumberPage {
60 62
61 63
62 build() { 64 build() {
  65 + Column(){
63 Column() { 66 Column() {
64 Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => { 67 Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
65 router.back() 68 router.back()
@@ -155,6 +158,9 @@ struct VerifyPhoneNumberPage { @@ -155,6 +158,9 @@ struct VerifyPhoneNumberPage {
155 }.padding({ left: 25, right: 25 }).width('100%') 158 }.padding({ left: 25, right: 25 }).width('100%')
156 159
157 }.width('100%').height('100%').alignItems(HorizontalAlign.Start) 160 }.width('100%').height('100%').alignItems(HorizontalAlign.Start)
  161 + }.width("100%")
  162 + .height("100%")
  163 + .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
158 } 164 }
159 165
160 //发送验证码 166 //发送验证码
1 { 1 {
2 "src": [ 2 "src": [
3 - "pages/Index",  
4 "pages/login/LoginPage", 3 "pages/login/LoginPage",
5 "pages/login/ForgetPasswordPage", 4 "pages/login/ForgetPasswordPage",
6 "pages/login/LoginProtocolWebview", 5 "pages/login/LoginProtocolWebview",