update feature/pagedesktop/src/main/ets/default/viewmodel/PageDesktopViewModel.ts.

Signed-off-by: 王志港 <wangzhigang46@huawei.com>
This commit is contained in:
王志港 2023-04-10 03:29:48 +00:00 committed by Gitee
parent 3cfb982463
commit 68925ae6ba
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -779,7 +779,7 @@ export default class PageDesktopViewModel extends BaseViewModel {
'row': row, 'row': row,
'column': column 'column': column
}; };
if (AppStorage.Get('isPortrait')) { if (AppStorage.Has('isPortrait') && AppStorage.Get('isPortrait')) {
let cardInfoHorizontal: any[] = []; let cardInfoHorizontal: any[] = [];
for (let i = 0; i < info.layoutInfo.length; i++) { for (let i = 0; i < info.layoutInfo.length; i++) {
if (info.layoutInfo[i].typeId == CommonConstants.TYPE_FOLDER) { if (info.layoutInfo[i].typeId == CommonConstants.TYPE_FOLDER) {
@ -807,7 +807,7 @@ export default class PageDesktopViewModel extends BaseViewModel {
AppStorage.SetOrCreate('isPortraitCard', cardInfoHorizontal); AppStorage.SetOrCreate('isPortraitCard', cardInfoHorizontal);
} }
if (!AppStorage.Get('isPortrait')) { if (AppStorage.Has('isPortrait') && !AppStorage.Get('isPortrait')) {
for (let i = 0; i < info.layoutInfo.length; i++) { for (let i = 0; i < info.layoutInfo.length; i++) {
if (info.layoutInfo[i].typeId == CommonConstants.TYPE_FOLDER) { if (info.layoutInfo[i].typeId == CommonConstants.TYPE_FOLDER) {
let tt = info.layoutInfo[i].column let tt = info.layoutInfo[i].column
@ -841,6 +841,15 @@ export default class PageDesktopViewModel extends BaseViewModel {
} }
} }
if (!AppStorage.Has('isPortrait')) {
newLayoutInfo.layoutDescription = {
'pageCount': pageNum,
'row': row,
'column': column
};
newLayoutInfo.layoutInfo = [];
}
return newLayoutInfo; return newLayoutInfo;
} }
@ -887,7 +896,7 @@ export default class PageDesktopViewModel extends BaseViewModel {
isBlankPage(): boolean { isBlankPage(): boolean {
const curPageIndex = this.mPageDesktopModel.getPageIndex(); const curPageIndex = this.mPageDesktopModel.getPageIndex();
// 当且仅当只有一个页面时,菜单项只允许添加 // 当且仅当只有一个页面时,菜单项只允许添加
if (curPageIndex === 0 || this.getGridPageCount() <= 1) { if (this.getGridPageCount() <= 1) {
return false; return false;
} }
if (CheckEmptyUtils.isEmpty(this.mGridAppsInfos) || CheckEmptyUtils.isEmpty(this.mGridAppsInfos[curPageIndex]) if (CheckEmptyUtils.isEmpty(this.mGridAppsInfos) || CheckEmptyUtils.isEmpty(this.mGridAppsInfos[curPageIndex])