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