fix: 重构登陆页面
This commit is contained in:
		
							parent
							
								
									0c0fc179c9
								
							
						
					
					
						commit
						019b582940
					
				| @ -74,7 +74,7 @@ export default class EntryAbility extends UIAbility { | ||||
|     AppStorage.setOrCreate('windowClass', windowClass) | ||||
|     await windowClass.setWindowLayoutFullScreen(true) | ||||
|     // await windowClass.setWindowSystemBarEnable([]) //全屏 | ||||
|     windowStage.loadContent('pages/ExaminerLogin', (err, data) => { | ||||
|     windowStage.loadContent('pages/Index', (err, data) => { | ||||
|       if (err.code) { | ||||
|         hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||||
|         return; | ||||
|  | ||||
| @ -53,6 +53,7 @@ struct ExaminerLoginPage { | ||||
|           inputComponent({ | ||||
|             active: this.selectIndex === "1", | ||||
|             value: this.password, | ||||
|             isPassword: true, | ||||
|             placeholder: "请输入密码", | ||||
|             onSelect: () => { | ||||
|               this.selectIndex = "1" | ||||
| @ -77,8 +78,11 @@ struct ExaminerLoginPage { | ||||
|                         this.password = this.password.slice(0, -1); | ||||
|                       } | ||||
|                     } else if (item === "清空") { | ||||
|                       if (this.selectIndex === "0") { | ||||
|                         this.userName = ""; | ||||
|                       } else { | ||||
|                         this.password = ""; | ||||
|                       } | ||||
|                     } else if (item === "X") { | ||||
|                       this.selectIndex = "0"; | ||||
|                     } else { | ||||
| @ -155,6 +159,10 @@ struct ExaminerLoginPage { | ||||
|         .margin({ | ||||
|           top: 20 | ||||
|         }) | ||||
|         .shadow({ | ||||
|           radius: 30, | ||||
|           color: "#E7B544" | ||||
|         }) | ||||
|       }.width("100%").height("100%").padding(20) | ||||
|     }.backgroundColor("#232424").height("100%").width("100%").padding({ | ||||
|       bottom: 10 | ||||
| @ -190,32 +198,42 @@ struct inputComponent { | ||||
|   @State placeholder: string = "请输入用户名"; | ||||
|   @Prop value: string = ""; | ||||
|   @Prop active: boolean = false; | ||||
|   @State isPassword: boolean = false; | ||||
|   onSelect: () => void = () => { | ||||
|   }; | ||||
| 
 | ||||
|   build() { | ||||
|     Row() { | ||||
|       TextInput({ | ||||
|         text: this.value, | ||||
|         placeholder: this.placeholder | ||||
|       }) | ||||
|         .placeholderColor("#fff") | ||||
|         .onFocus(() => { | ||||
|           this.onSelect() | ||||
|         }) | ||||
|         .fontColor("#fff") | ||||
|       if (this.isPassword) { | ||||
|         Text(this.value !== "" ? "*".repeat(this.value.length) : this.placeholder) | ||||
|           .fontSize(40) | ||||
|         .placeholderFont({ | ||||
|           size: 40 | ||||
|         }) | ||||
|           .fontColor("#fff") | ||||
|           .margin({ | ||||
|             left: 20 | ||||
|           }) | ||||
|     }.backgroundImage( | ||||
|       } else { | ||||
|         Text(this.value !== "" ? this.value : this.placeholder) | ||||
|           .fontSize(40) | ||||
|           .fontColor("#fff") | ||||
|           .margin({ | ||||
|             left: 20 | ||||
|           }) | ||||
|       } | ||||
|     } | ||||
|     .backgroundImage( | ||||
|       this.active ? $r("app.media.kuang_pre") : $r("app.media.kuang_nor") | ||||
|     ).backgroundImageSize({ | ||||
|     ) | ||||
|     .backgroundImageSize({ | ||||
|       width: "100%", | ||||
|       height: "100%" | ||||
|     }).width(750).height(100) | ||||
|     }) | ||||
|     .width(750) | ||||
|     .height(120) | ||||
|     .padding({ | ||||
|       left: 20 | ||||
|     }) | ||||
|     .onClick(() => { | ||||
|       this.onSelect() | ||||
|     }) | ||||
|   } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user