!340 修复大字体+双屏+横屏状态下,加密分享页确认按钮位置问题

Merge pull request !340 from 何钱贝/master
This commit is contained in:
openharmony_ci 2024-11-13 10:51:56 +00:00 committed by Gitee
commit cdf37e1220
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 24 additions and 4 deletions

View File

@ -228,10 +228,10 @@ export default class Constants {
public static SHARE_TEXT_INPUT_MARGIN_LEFT = 16; public static SHARE_TEXT_INPUT_MARGIN_LEFT = 16;
public static SHARE_TEXT_INPUT_COLUMN_HEIGHT = 120; public static SHARE_TEXT_INPUT_COLUMN_HEIGHT = 120;
public static SHARE_BUTTON_WIDTH = '100%'; public static SHARE_BUTTON_WIDTH = '100%';
public static SHARE_BUTTON_MARGIN_TOP = 16;
public static SHARE_BUTTON_MARGIN_LEFT = 16; public static SHARE_BUTTON_MARGIN_LEFT = 16;
public static SHARE_BUTTON_MARGIN_RIGHT = 16; public static SHARE_BUTTON_MARGIN_RIGHT = 16;
public static SHARE_BUTTON_PADDING_BOTTOM = 24; public static SHARE_BUTTON_PADDING_BOTTOM = 16;
public static SHARE_BUTTON_COLUMN_BOTTOM = 56;
public static SHARE_PAGES_COLUMN_WIDTH = '100%'; public static SHARE_PAGES_COLUMN_WIDTH = '100%';
public static SHARE_PAGES_COLUMN_HEIGHT = '100%'; public static SHARE_PAGES_COLUMN_HEIGHT = '100%';
public static SHARE_SET_TIMEOUT = 1500; public static SHARE_SET_TIMEOUT = 1500;

View File

@ -97,6 +97,7 @@ struct encryptedSharing {
@State osVersion: ResourceStr = ''; @State osVersion: ResourceStr = '';
@State isTextInputFocus: boolean = false; @State isTextInputFocus: boolean = false;
@State generalType: string = 'general.file'; @State generalType: string = 'general.file';
@State scrollHeight: number = 188;
@Builder @Builder
contactsPicker() { contactsPicker() {
@ -500,6 +501,15 @@ struct encryptedSharing {
}, Constants.ENCRYPTION_SET_TIMEOUT_TIME); }, Constants.ENCRYPTION_SET_TIMEOUT_TIME);
} }
getScrollHeight(newValue: SizeOptions) {
const height = newValue.height as number;
this.scrollHeight = height - Constants.SHARE_BUTTON_COLUMN_BOTTOM - Constants.SHARE_TITLE_HEAD_HEIGHT
- Constants.SHARE_TITLE_HEAD_MARGIN_TOP - Constants.SHARE_TITLE_HEAD_MARGIN_BOTTOM;
if (this.scrollHeight > Constants.SHARE_TEXTAREA_MAX_HEIGHT) {
this.scrollHeight = Constants.SHARE_TEXTAREA_MAX_HEIGHT;
}
}
aboutToAppear() { aboutToAppear() {
HiLog.info(TAG, `aboutToAppear enter: ${this.showUIExtensionForAccountLogin}`); HiLog.info(TAG, `aboutToAppear enter: ${this.showUIExtensionForAccountLogin}`);
this.getLoginStatus(); this.getLoginStatus();
@ -627,7 +637,7 @@ struct encryptedSharing {
} }
.align(Alignment.TopStart) .align(Alignment.TopStart)
.constraintSize({ .constraintSize({
minHeight: `${Constants.SHARE_TEXTAREA_MAX_HEIGHT}vp` minHeight: `${this.scrollHeight}vp`
}) })
.padding({ .padding({
top: Constants.SHARE_TITLE_HEAD_MARGIN_BOTTOM top: Constants.SHARE_TITLE_HEAD_MARGIN_BOTTOM
@ -645,11 +655,13 @@ struct encryptedSharing {
} }
.justifyContent(FlexAlign.Center) .justifyContent(FlexAlign.Center)
.margin({ .margin({
top: Constants.SHARE_BUTTON_MARGIN_TOP,
left: Constants.SHARE_BUTTON_MARGIN_LEFT, left: Constants.SHARE_BUTTON_MARGIN_LEFT,
right: Constants.SHARE_BUTTON_MARGIN_RIGHT, right: Constants.SHARE_BUTTON_MARGIN_RIGHT,
bottom: Constants.SHARE_BUTTON_PADDING_BOTTOM bottom: Constants.SHARE_BUTTON_PADDING_BOTTOM
}) })
.constraintSize({
minHeight: `${Constants.SHARE_BUTTON_COLUMN_BOTTOM}vp`
})
} }
.width(Constants.SHARE_PAGES_COLUMN_WIDTH) .width(Constants.SHARE_PAGES_COLUMN_WIDTH)
.height(Constants.SHARE_PAGES_COLUMN_HEIGHT) .height(Constants.SHARE_PAGES_COLUMN_HEIGHT)
@ -701,5 +713,13 @@ struct encryptedSharing {
}) })
} }
} }
.onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => {
const newHeight = newValue.height as number;
const oldHeight = oldValue.height as number;
if (newHeight === oldHeight) {
return;
}
this.getScrollHeight(newValue);
})
} }
} }