فهرست منبع

抽屉打开时的遮罩层,用于拦截点击事件 这个只能正常尺寸的手机竖屏的才能生效

onecold 1 سال پیش
والد
کامیت
41a60335c0
2فایلهای تغییر یافته به همراه20 افزوده شده و 15 حذف شده
  1. 19 14
      entry/src/main/ets/pages/NewIndex.ets
  2. 1 1
      entry/src/main/ets/pages/UserCenter.ets

+ 19 - 14
entry/src/main/ets/pages/NewIndex.ets

@@ -1,4 +1,4 @@
-import { AppUtil, DeviceUtil, DisplayUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils';
+import { AppUtil, DeviceUtil, DisplayUtil, LogUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils';
 import TitleBar from '../view/TitleBar';
 import { router } from '@kit.ArkUI';
 import mainViewModel, { MainViewModel } from '../viewmodel/MainViewModel';
@@ -246,8 +246,8 @@ struct NewIndex {
           AboutPage()
             .visibility(this.mType === 4 ? Visibility.Visible : Visibility.None)
           
-          // 抽屉打开时的遮罩层,用于拦截点击事件
-          if (this.isShowDrawer) {
+          // 抽屉打开时的遮罩层,用于拦截点击事件  这个只能正常尺寸的手机竖屏的才能生效
+          if (this.isShowDrawer&&this.isPhonePortrait()) {
             Column()
               .width('100%')
               .height('100%')
@@ -273,6 +273,21 @@ struct NewIndex {
 
   }
 
+  //是不是正常的手机竖屏
+  isPhonePortrait() {
+    LogUtil.info('twocold this.currentHeightBreakpoint = '+this.currentHeightBreakpoint)
+    LogUtil.info('twocold this.currentWidthBreakpoint = '+this.currentWidthBreakpoint)
+    if(DeviceUtil.getDeviceType() === resourceManager.DeviceType.DEVICE_TYPE_PHONE
+      &&this.currentHeightBreakpoint == HeightBreakpoint.HEIGHT_LG
+      &&this.currentWidthBreakpoint==WidthBreakpoint.WIDTH_SM){//如果是手机横屏,返回false
+
+      return true
+    }
+
+
+    return false
+  }
+
   /**
    * 判断是否横屏
    * @returns
@@ -295,17 +310,7 @@ struct NewIndex {
   getLeftView() {
     Column() {
       Column() {
-        // 抽屉顶部背景图
-        // Image($r('app.media.bg_music'))
-        //   .width('100%')
-        //   .visibility(this.isCoverOpacity()?Visibility.None:Visibility.Visible)
-        //   .height(180)
-        //   .borderRadius({
-        //     topLeft: 0,
-        //     topRight	: 20,
-        //     bottomLeft: 0,
-        //     bottomRight: 0
-        //   })
+
         this.buildUserInfoCard()
 
         this.getDrawerView()

+ 1 - 1
entry/src/main/ets/pages/UserCenter.ets

@@ -502,7 +502,7 @@ export struct UserCenter {
                 .textAlign(TextAlign.Start)
               Text('到期:' + this.subscriptionEndDate)
                 .fontSize(11)
-                .padding(8)
+                .padding(5)
                 .fontColor(this.isDarkMode ? Color.White : Color.Gray)
                 .textAlign(TextAlign.Start)
             } else {