Showing
9 changed files
with
221 additions
and
113 deletions
| @@ -173,6 +173,7 @@ export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; | @@ -173,6 +173,7 @@ export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean'; | ||
| 173 | export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; | 173 | export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes'; |
| 174 | 174 | ||
| 175 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | 175 | export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; |
| 176 | +export { PageTrackBean } from './src/main/ets/bean/component/PageTrackBean'; | ||
| 176 | 177 | ||
| 177 | 178 | ||
| 178 | 179 |
| @@ -5,7 +5,7 @@ import PageModel from '../../viewmodel/PageModel'; | @@ -5,7 +5,7 @@ import PageModel from '../../viewmodel/PageModel'; | ||
| 5 | import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh'; | 5 | import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh'; |
| 6 | import LoadMoreLayout from './LoadMoreLayout'; | 6 | import LoadMoreLayout from './LoadMoreLayout'; |
| 7 | import { CompParser } from '../CompParser'; | 7 | import { CompParser } from '../CompParser'; |
| 8 | -import { CompDTO } from 'wdBean'; | 8 | +import { CompDTO, PageTrackBean } from 'wdBean'; |
| 9 | import PageHelper from '../../viewmodel/PageHelper'; | 9 | import PageHelper from '../../viewmodel/PageHelper'; |
| 10 | import { channelSkeleton } from '../skeleton/channelSkeleton' | 10 | import { channelSkeleton } from '../skeleton/channelSkeleton' |
| 11 | import { ProcessUtils } from 'wdRouter/Index'; | 11 | import { ProcessUtils } from 'wdRouter/Index'; |
| @@ -30,6 +30,9 @@ export struct PageComponent { | @@ -30,6 +30,9 @@ export struct PageComponent { | ||
| 30 | private listScroller: Scroller = new Scroller(); | 30 | private listScroller: Scroller = new Scroller(); |
| 31 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) | 31 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) |
| 32 | needload: boolean = true; | 32 | needload: boolean = true; |
| 33 | + // page相关埋点数据,各组件需要,自行取用 | ||
| 34 | + @Provide pageTrackBean: PageTrackBean = new PageTrackBean() | ||
| 35 | + | ||
| 33 | build() { | 36 | build() { |
| 34 | Column() { | 37 | Column() { |
| 35 | if (this.pageModel.viewType == ViewType.LOADING) { | 38 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -265,8 +268,14 @@ export struct PageComponent { | @@ -265,8 +268,14 @@ export struct PageComponent { | ||
| 265 | this.pageModel.channelId = this.channelId; | 268 | this.pageModel.channelId = this.channelId; |
| 266 | this.pageModel.currentPage = 1; | 269 | this.pageModel.currentPage = 1; |
| 267 | this.pageModel.pageTotalCompSize = 0; | 270 | this.pageModel.pageTotalCompSize = 0; |
| 268 | - PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) | ||
| 269 | - PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 271 | + PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel).then(() => { |
| 272 | + this.pageTrackBean.pageId = this.pageId | ||
| 273 | + this.pageTrackBean.pageName = this.pageModel.pageInfo.name | ||
| 274 | + }) | ||
| 275 | + PageHelper.getInitData(this.pageModel, this.pageAdvModel).then(() => { | ||
| 276 | + this.pageTrackBean.pageId = this.pageId | ||
| 277 | + this.pageTrackBean.pageName = this.pageModel.pageInfo.name | ||
| 278 | + }) | ||
| 270 | }, 100) | 279 | }, 100) |
| 271 | } | 280 | } |
| 272 | } | 281 | } |
| 1 | -import { DateTimeUtils, PermissionUtil } from 'wdKit' | 1 | +import { BreakpointSystem, DateTimeUtils, PermissionUtil } from 'wdKit' |
| 2 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' | 2 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' |
| 3 | import { Params } from 'wdBean'; | 3 | import { Params } from 'wdBean'; |
| 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 5 | import { HttpUtils } from 'wdNetwork/Index'; | 5 | import { HttpUtils } from 'wdNetwork/Index'; |
| 6 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; | 6 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 7 | +import { TitleBackComponent } from '../setting/TitleBackComponent'; | ||
| 7 | 8 | ||
| 8 | const TAG = 'PrivacySettingPage'; | 9 | const TAG = 'PrivacySettingPage'; |
| 9 | const DiyString = '开启个性化推荐' | 10 | const DiyString = '开启个性化推荐' |
| @@ -18,6 +19,17 @@ export struct PrivacySettingPage { | @@ -18,6 +19,17 @@ export struct PrivacySettingPage { | ||
| 18 | tipsEnd = '中相应权限使用规则' | 19 | tipsEnd = '中相应权限使用规则' |
| 19 | pageShowTime:number = 0; | 20 | pageShowTime:number = 0; |
| 20 | pageHideTime:number = 0; | 21 | pageHideTime:number = 0; |
| 22 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 23 | + private breakpointSystem = new BreakpointSystem(); | ||
| 24 | + @State percent:number = 1 | ||
| 25 | + | ||
| 26 | + currentChanged(){ | ||
| 27 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 28 | + this.percent = 0.7 | ||
| 29 | + }else { | ||
| 30 | + this.percent = 1 | ||
| 31 | + } | ||
| 32 | + } | ||
| 21 | 33 | ||
| 22 | onPageShow(): void { | 34 | onPageShow(): void { |
| 23 | this.getPermissionStatus(); | 35 | this.getPermissionStatus(); |
| @@ -32,6 +44,8 @@ export struct PrivacySettingPage { | @@ -32,6 +44,8 @@ export struct PrivacySettingPage { | ||
| 32 | } | 44 | } |
| 33 | 45 | ||
| 34 | aboutToAppear() { | 46 | aboutToAppear() { |
| 47 | + this.breakpointSystem.register(); | ||
| 48 | + this.currentChanged() | ||
| 35 | if (!HttpUtils.getUserId()) { | 49 | if (!HttpUtils.getUserId()) { |
| 36 | this.listData.splice(0, 1); | 50 | this.listData.splice(0, 1); |
| 37 | } | 51 | } |
| @@ -43,6 +57,10 @@ export struct PrivacySettingPage { | @@ -43,6 +57,10 @@ export struct PrivacySettingPage { | ||
| 43 | 57 | ||
| 44 | } | 58 | } |
| 45 | 59 | ||
| 60 | + aboutToDisappear(): void { | ||
| 61 | + this.breakpointSystem.unregister(); | ||
| 62 | + } | ||
| 63 | + | ||
| 46 | async getPermissionStatus() { | 64 | async getPermissionStatus() { |
| 47 | const permissionUtil = new PermissionUtil(); | 65 | const permissionUtil = new PermissionUtil(); |
| 48 | for (const element of this.listData) { | 66 | for (const element of this.listData) { |
| @@ -57,25 +75,27 @@ export struct PrivacySettingPage { | @@ -57,25 +75,27 @@ export struct PrivacySettingPage { | ||
| 57 | } | 75 | } |
| 58 | 76 | ||
| 59 | build() { | 77 | build() { |
| 60 | - Navigation() { | 78 | + Column(){ |
| 79 | + TitleBackComponent({title:"隐私设置"}) | ||
| 80 | + | ||
| 61 | //滑动区域 | 81 | //滑动区域 |
| 62 | this.PrivacySettingComponentsUI() | 82 | this.PrivacySettingComponentsUI() |
| 83 | + }.backgroundColor('#F8F8F8') | ||
| 84 | + .width("100%") | ||
| 85 | + .height("100%") | ||
| 63 | 86 | ||
| 64 | - }.titleMode(NavigationTitleMode.Mini) | ||
| 65 | - .title('隐私设置') | ||
| 66 | - .backgroundColor('#F8F8F8') | ||
| 67 | } | 87 | } |
| 68 | 88 | ||
| 69 | @Builder PrivacySettingComponentsUI() { | 89 | @Builder PrivacySettingComponentsUI() { |
| 70 | Column() { | 90 | Column() { |
| 71 | 91 | ||
| 72 | - List({ space: '23lpx' }) { | 92 | + List({ space: `${this.calcHeight(23)}lpx` }) { |
| 73 | ForEach(this.listData, (item: PrivacySettingModel, index:number) => { | 93 | ForEach(this.listData, (item: PrivacySettingModel, index:number) => { |
| 74 | ListItem() { | 94 | ListItem() { |
| 75 | if (item.privacyName == DiyString) { | 95 | if (item.privacyName == DiyString) { |
| 76 | - getTuiJianCell({ item:item, index:index }); | 96 | + getTuiJianCell({ item:item, index:index ,percent:$percent}); |
| 77 | } else { | 97 | } else { |
| 78 | - getArrowCell({ item:item, index:index }); | 98 | + getArrowCell({ item:item, index:index ,percent:$percent}); |
| 79 | } | 99 | } |
| 80 | }.onClick(() => { | 100 | }.onClick(() => { |
| 81 | if (item.privacyName == DiyString) { | 101 | if (item.privacyName == DiyString) { |
| @@ -103,32 +123,33 @@ export struct PrivacySettingPage { | @@ -103,32 +123,33 @@ export struct PrivacySettingPage { | ||
| 103 | } | 123 | } |
| 104 | }) | 124 | }) |
| 105 | }) | 125 | }) |
| 106 | - } | ||
| 107 | - .padding({ left: '29lpx', right: '29lpx' }) | ||
| 108 | - .margin({ top: '38lpx' }) | 126 | + }.width('100%') |
| 127 | + .padding({ left: `${this.calcHeight(29)}lpx`, right: `${this.calcHeight(29)}lpx` }) | ||
| 128 | + .margin({ top: `${this.calcHeight(38)}lpx` }) | ||
| 129 | + | ||
| 109 | 130 | ||
| 110 | Row() { | 131 | Row() { |
| 111 | Text(this.tips) | 132 | Text(this.tips) |
| 112 | - .fontSize('25lpx') | 133 | + .fontSize(`${this.calcHeight(25)}lpx`) |
| 113 | .textAlign(TextAlign.Start) | 134 | .textAlign(TextAlign.Start) |
| 114 | .fontColor($r("app.color.color_666666")) | 135 | .fontColor($r("app.color.color_666666")) |
| 115 | - .margin({ left: '29lpx', top: '46lpx' }) | 136 | + .margin({ left: `${this.calcHeight(29)}lpx`, top: `${this.calcHeight(46)}lpx` }) |
| 116 | // .backgroundColor(Color.Orange) | 137 | // .backgroundColor(Color.Orange) |
| 117 | Text(this.privacyTips) | 138 | Text(this.privacyTips) |
| 118 | - .fontSize('25lpx') | 139 | + .fontSize(`${this.calcHeight(25)}lpx`) |
| 119 | .textAlign(TextAlign.Start) | 140 | .textAlign(TextAlign.Start) |
| 120 | .fontColor('#ED2800') | 141 | .fontColor('#ED2800') |
| 121 | - .margin({ top: '46lpx' }) | 142 | + .margin({ top: `${this.calcHeight(46)}lpx` }) |
| 122 | .onClick(() => { | 143 | .onClick(() => { |
| 123 | //跳转隐私政策 | 144 | //跳转隐私政策 |
| 124 | let bean={contentID:"2",pageID:""} as Params | 145 | let bean={contentID:"2",pageID:""} as Params |
| 125 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) | 146 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean) |
| 126 | }) | 147 | }) |
| 127 | Text(this.tipsEnd) | 148 | Text(this.tipsEnd) |
| 128 | - .fontSize('25lpx') | 149 | + .fontSize(`${this.calcHeight(25)}lpx`) |
| 129 | .textAlign(TextAlign.Start) | 150 | .textAlign(TextAlign.Start) |
| 130 | .fontColor($r("app.color.color_666666")) | 151 | .fontColor($r("app.color.color_666666")) |
| 131 | - .margin({ top: '46lpx' }) | 152 | + .margin({ top: `${this.calcHeight(46)}lpx` }) |
| 132 | } | 153 | } |
| 133 | 154 | ||
| 134 | } | 155 | } |
| @@ -137,6 +158,10 @@ export struct PrivacySettingPage { | @@ -137,6 +158,10 @@ export struct PrivacySettingPage { | ||
| 137 | .backgroundColor('#F8F8F8') | 158 | .backgroundColor('#F8F8F8') |
| 138 | .alignItems(HorizontalAlign.Start) | 159 | .alignItems(HorizontalAlign.Start) |
| 139 | } | 160 | } |
| 161 | + | ||
| 162 | + calcHeight(value:number): number{ | ||
| 163 | + return value * this.percent | ||
| 164 | + } | ||
| 140 | } | 165 | } |
| 141 | 166 | ||
| 142 | 167 | ||
| @@ -144,6 +169,7 @@ export struct PrivacySettingPage { | @@ -144,6 +169,7 @@ export struct PrivacySettingPage { | ||
| 144 | struct getArrowCell { | 169 | struct getArrowCell { |
| 145 | @ObjectLink item: PrivacySettingModel; | 170 | @ObjectLink item: PrivacySettingModel; |
| 146 | index:number = 0; | 171 | index:number = 0; |
| 172 | + @Link percent:number | ||
| 147 | // 右文字+箭头cell | 173 | // 右文字+箭头cell |
| 148 | // @Builder getArrowCell(item:PrivacySettingModel, index) { | 174 | // @Builder getArrowCell(item:PrivacySettingModel, index) { |
| 149 | build() { | 175 | build() { |
| @@ -151,28 +177,32 @@ struct getArrowCell { | @@ -151,28 +177,32 @@ struct getArrowCell { | ||
| 151 | // 左侧标题 | 177 | // 左侧标题 |
| 152 | Text(this.item.privacyName) | 178 | Text(this.item.privacyName) |
| 153 | .fontColor('#666666') | 179 | .fontColor('#666666') |
| 154 | - .fontSize('31lpx') | 180 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 155 | 181 | ||
| 156 | Row() { | 182 | Row() { |
| 157 | Text(this.item.permission ? '已开启' : '去设置') | 183 | Text(this.item.permission ? '已开启' : '去设置') |
| 158 | .fontColor(this.item.permission ? '#666666' : '#CCCCCC') | 184 | .fontColor(this.item.permission ? '#666666' : '#CCCCCC') |
| 159 | - .fontSize('31lpx') | ||
| 160 | - .margin({ right: '8lpx' }) | 185 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 186 | + .margin({ right: `${this.calcHeight(8)}lpx` }) | ||
| 161 | 187 | ||
| 162 | Image($r('app.media.mine_user_arrow')) | 188 | Image($r('app.media.mine_user_arrow')) |
| 163 | - .width('27lpx') | ||
| 164 | - .height('27lpx') | 189 | + .width(`${this.calcHeight(27)}lpx`) |
| 190 | + .height(`${this.calcHeight(27)}lpx`) | ||
| 165 | .objectFit(ImageFit.Auto) | 191 | .objectFit(ImageFit.Auto) |
| 166 | } | 192 | } |
| 167 | 193 | ||
| 168 | } | 194 | } |
| 169 | .alignItems(VerticalAlign.Center) | 195 | .alignItems(VerticalAlign.Center) |
| 170 | .justifyContent(FlexAlign.SpaceBetween) | 196 | .justifyContent(FlexAlign.SpaceBetween) |
| 171 | - .height('97lpx') | 197 | + .height(`${this.calcHeight(97)}lpx`) |
| 172 | .width('100%') | 198 | .width('100%') |
| 173 | - .padding({ left: '29lpx', right: '29lpx' }) | 199 | + .padding({ left: `${this.calcHeight(29)}lpx`, right: `${this.calcHeight(29)}lpx` }) |
| 174 | .backgroundColor('#FFFFFF') | 200 | .backgroundColor('#FFFFFF') |
| 175 | - .borderRadius('8lpx') | 201 | + .borderRadius(`${this.calcHeight(8)}lpx`) |
| 202 | + } | ||
| 203 | + | ||
| 204 | + calcHeight(value:number): number{ | ||
| 205 | + return value * this.percent | ||
| 176 | } | 206 | } |
| 177 | } | 207 | } |
| 178 | 208 | ||
| @@ -180,6 +210,7 @@ struct getArrowCell { | @@ -180,6 +210,7 @@ struct getArrowCell { | ||
| 180 | struct getTuiJianCell { | 210 | struct getTuiJianCell { |
| 181 | @ObjectLink item: PrivacySettingModel; | 211 | @ObjectLink item: PrivacySettingModel; |
| 182 | index:number = 0; | 212 | index:number = 0; |
| 213 | + @Link percent:number | ||
| 183 | build() { | 214 | build() { |
| 184 | Column() { | 215 | Column() { |
| 185 | 216 | ||
| @@ -187,12 +218,12 @@ struct getTuiJianCell { | @@ -187,12 +218,12 @@ struct getTuiJianCell { | ||
| 187 | // 左侧标题 | 218 | // 左侧标题 |
| 188 | Text(this.item.privacyName) | 219 | Text(this.item.privacyName) |
| 189 | .fontColor('#666666') | 220 | .fontColor('#666666') |
| 190 | - .fontSize('31lpx') | 221 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 191 | 222 | ||
| 192 | Row() { | 223 | Row() { |
| 193 | Toggle({ type: ToggleType.Switch, isOn: this.item.permission }) | 224 | Toggle({ type: ToggleType.Switch, isOn: this.item.permission }) |
| 194 | - .height('58lpx') | ||
| 195 | - .width('96lpx') | 225 | + .height(`${this.calcHeight(58)}lpx`) |
| 226 | + .width(`${this.calcHeight(96)}lpx`) | ||
| 196 | .selectedColor('#ED2700') | 227 | .selectedColor('#ED2700') |
| 197 | .onChange((isOn: boolean) => { | 228 | .onChange((isOn: boolean) => { |
| 198 | // this.privacySwitch = isOn; | 229 | // this.privacySwitch = isOn; |
| @@ -203,25 +234,29 @@ struct getTuiJianCell { | @@ -203,25 +234,29 @@ struct getTuiJianCell { | ||
| 203 | } | 234 | } |
| 204 | .alignItems(VerticalAlign.Center) | 235 | .alignItems(VerticalAlign.Center) |
| 205 | .justifyContent(FlexAlign.SpaceBetween) | 236 | .justifyContent(FlexAlign.SpaceBetween) |
| 206 | - .height('97lpx') | 237 | + .height(`${this.calcHeight(97)}lpx`) |
| 207 | .width('100%') | 238 | .width('100%') |
| 208 | 239 | ||
| 209 | 240 | ||
| 210 | Blank() | 241 | Blank() |
| 211 | .backgroundColor('#EDEDED') | 242 | .backgroundColor('#EDEDED') |
| 212 | - .height('1lpx') | 243 | + .height(`${this.calcHeight(1)}lpx`) |
| 213 | 244 | ||
| 214 | Text(DiyCloseTipsString) | 245 | Text(DiyCloseTipsString) |
| 215 | .fontColor('#999999') | 246 | .fontColor('#999999') |
| 216 | - .fontSize('23lpx') | ||
| 217 | - .margin({ right: '8lpx' }) | ||
| 218 | - .height('69lpx') | 247 | + .fontSize(`${this.calcHeight(23)}lpx`) |
| 248 | + .margin({ right: `${this.calcHeight(8)}lpx` }) | ||
| 249 | + .height(`${this.calcHeight(69)}lpx`) | ||
| 219 | 250 | ||
| 220 | - } | 251 | + }.width('100%') |
| 221 | .alignItems(HorizontalAlign.Start) | 252 | .alignItems(HorizontalAlign.Start) |
| 222 | .backgroundColor('#FFFFFF') | 253 | .backgroundColor('#FFFFFF') |
| 223 | - .borderRadius('8lpx') | ||
| 224 | - .padding({ left: '29lpx', right: '29lpx' }) | 254 | + .borderRadius(`${this.calcHeight(8)}lpx`) |
| 255 | + .padding({ left: `${this.calcHeight(29)}lpx`, right: `${this.calcHeight(29)}lpx` }) | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + calcHeight(value:number): number{ | ||
| 259 | + return value * this.percent | ||
| 225 | } | 260 | } |
| 226 | } | 261 | } |
| 227 | 262 |
| @@ -2,7 +2,7 @@ import { MineSettingComponent } from '../setting/MineSettingComponent'; | @@ -2,7 +2,7 @@ import { MineSettingComponent } from '../setting/MineSettingComponent'; | ||
| 2 | import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout'; | 2 | import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout'; |
| 3 | import router from '@ohos.router'; | 3 | import router from '@ohos.router'; |
| 4 | import { Params } from 'wdBean'; | 4 | import { Params } from 'wdBean'; |
| 5 | -import { DateTimeUtils } from 'wdKit/Index'; | 5 | +import { BreakpointSystem, DateTimeUtils } from 'wdKit/Index'; |
| 6 | import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | 6 | import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; |
| 7 | 7 | ||
| 8 | @Entry | 8 | @Entry |
| @@ -51,6 +51,7 @@ struct SettingPage { | @@ -51,6 +51,7 @@ struct SettingPage { | ||
| 51 | AccountAndSecurityLayout({enterActivityTime:this.enterActivityTime}) | 51 | AccountAndSecurityLayout({enterActivityTime:this.enterActivityTime}) |
| 52 | } | 52 | } |
| 53 | }.setFullWidth() | 53 | }.setFullWidth() |
| 54 | + .backgroundColor($r("app.color.white")) | ||
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | // 私有方法 | 57 | // 私有方法 |
| 1 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; | 1 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; |
| 2 | -import { Logger, SPHelper, StringUtils } from 'wdKit'; | 2 | +import { BreakpointSystem, Logger, SPHelper, StringUtils } from 'wdKit'; |
| 3 | import PageViewModel from '../../viewmodel/PageViewModel'; | 3 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 4 | import storageStatistics from "@ohos.file.storageStatistics"; | 4 | import storageStatistics from "@ohos.file.storageStatistics"; |
| 5 | import { BusinessError } from '@ohos.base'; | 5 | import { BusinessError } from '@ohos.base'; |
| @@ -25,6 +25,17 @@ export struct MineSettingComponent { | @@ -25,6 +25,17 @@ export struct MineSettingComponent { | ||
| 25 | @State cacheSize: number = 0 | 25 | @State cacheSize: number = 0 |
| 26 | @State accountState:boolean=false | 26 | @State accountState:boolean=false |
| 27 | preferences: dataPreferences.Preferences | null = null; | 27 | preferences: dataPreferences.Preferences | null = null; |
| 28 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 29 | + private breakpointSystem = new BreakpointSystem(); | ||
| 30 | + @State percent:number = 1 | ||
| 31 | + | ||
| 32 | + currentChanged(){ | ||
| 33 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 34 | + this.percent = 0.7 | ||
| 35 | + }else { | ||
| 36 | + this.percent = 1 | ||
| 37 | + } | ||
| 38 | + } | ||
| 28 | 39 | ||
| 29 | dialogController: CustomDialogController = new CustomDialogController({ | 40 | dialogController: CustomDialogController = new CustomDialogController({ |
| 30 | builder: MyCustomDialog({ | 41 | builder: MyCustomDialog({ |
| @@ -43,6 +54,8 @@ export struct MineSettingComponent { | @@ -43,6 +54,8 @@ export struct MineSettingComponent { | ||
| 43 | customStyle: true | 54 | customStyle: true |
| 44 | }) | 55 | }) |
| 45 | aboutToAppear() { | 56 | aboutToAppear() { |
| 57 | + this.breakpointSystem.register(); | ||
| 58 | + this.currentChanged() | ||
| 46 | // 获取设置页面数据 | 59 | // 获取设置页面数据 |
| 47 | this.getSettingPageData() | 60 | this.getSettingPageData() |
| 48 | 61 | ||
| @@ -54,6 +67,10 @@ export struct MineSettingComponent { | @@ -54,6 +67,10 @@ export struct MineSettingComponent { | ||
| 54 | 67 | ||
| 55 | } | 68 | } |
| 56 | 69 | ||
| 70 | + aboutToDisappear(): void { | ||
| 71 | + this.breakpointSystem.unregister(); | ||
| 72 | + } | ||
| 73 | + | ||
| 57 | async getAccountState(){ | 74 | async getAccountState(){ |
| 58 | let userId=await SPHelper.default.get(SpConstants.USER_ID,'') as string | 75 | let userId=await SPHelper.default.get(SpConstants.USER_ID,'') as string |
| 59 | if(userId==''){ | 76 | if(userId==''){ |
| @@ -91,13 +108,13 @@ export struct MineSettingComponent { | @@ -91,13 +108,13 @@ export struct MineSettingComponent { | ||
| 91 | if (item.type == 0) { | 108 | if (item.type == 0) { |
| 92 | Column() { | 109 | Column() { |
| 93 | this.getArrowCell(item,index) | 110 | this.getArrowCell(item,index) |
| 94 | - }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) | 111 | + }.padding({ left: `${this.calcHeight(27)}lpx` }).height(`${this.calcHeight(117)}lpx`).justifyContent(FlexAlign.Center) |
| 95 | } else if (item.type == 1) { | 112 | } else if (item.type == 1) { |
| 96 | Column() { | 113 | Column() { |
| 97 | this.getSwitchCell(item,index) | 114 | this.getSwitchCell(item,index) |
| 98 | - }.padding({ left: '27lpx' }).height('117lpx').justifyContent(FlexAlign.Center) | 115 | + }.padding({ left: `${this.calcHeight(27)}lpx` }).height(`${this.calcHeight(117)}lpx`).justifyContent(FlexAlign.Center) |
| 99 | } else { | 116 | } else { |
| 100 | - Column().width('100%').height('15lpx').backgroundColor(0xf0f0f0) | 117 | + Column().width('100%').height(`${this.calcHeight(15)}lpx`).backgroundColor(0xf0f0f0) |
| 101 | } | 118 | } |
| 102 | } | 119 | } |
| 103 | }) | 120 | }) |
| @@ -112,7 +129,7 @@ export struct MineSettingComponent { | @@ -112,7 +129,7 @@ export struct MineSettingComponent { | ||
| 112 | @Builder itemHead(text: string) { | 129 | @Builder itemHead(text: string) { |
| 113 | // 列表分组的头部组件,对应联系人分组A、B等位置的组件 | 130 | // 列表分组的头部组件,对应联系人分组A、B等位置的组件 |
| 114 | if (text.length > 0) { | 131 | if (text.length > 0) { |
| 115 | - Row().width('100%').height('20lpx').backgroundColor(0xf0f0f0) | 132 | + Row().width('100%').height(`${this.calcHeight(20)}lpx`).backgroundColor(0xf0f0f0) |
| 116 | } | 133 | } |
| 117 | } | 134 | } |
| 118 | 135 | ||
| @@ -125,28 +142,29 @@ export struct MineSettingComponent { | @@ -125,28 +142,29 @@ export struct MineSettingComponent { | ||
| 125 | // 判断有没有图片 | 142 | // 判断有没有图片 |
| 126 | if (0) { | 143 | if (0) { |
| 127 | Image('https://pic.rmb.bdstatic.com/e182cf67c341d1128d2a6cc05886bf62.jpeg@s_0,h_2000') | 144 | Image('https://pic.rmb.bdstatic.com/e182cf67c341d1128d2a6cc05886bf62.jpeg@s_0,h_2000') |
| 128 | - .height('38lpx') | ||
| 129 | - .margin({ right: '5lpx' }) | 145 | + .height(`${this.calcHeight(38)}lpx`) |
| 146 | + .margin({ right: `${this.calcHeight(5)}lpx` }) | ||
| 130 | 147 | ||
| 131 | Text(`${item.title}`) | 148 | Text(`${item.title}`) |
| 132 | - .margin({ top: '8lpx' }) | ||
| 133 | - .height('38lpx') | 149 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 150 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 134 | .fontColor('#333333') | 151 | .fontColor('#333333') |
| 135 | - .fontSize('29lpx') | 152 | + .fontSize(`${this.calcHeight(29)}lpx`) |
| 136 | } else { | 153 | } else { |
| 137 | Text(`${item.title}`) | 154 | Text(`${item.title}`) |
| 138 | - .margin({ top: '8lpx' }) | ||
| 139 | - .height('38lpx') | 155 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 156 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 140 | .fontColor('#333333') | 157 | .fontColor('#333333') |
| 141 | - .fontSize('29lpx') | 158 | + .fontSize(`${this.calcHeight(29)}lpx`) |
| 142 | } | 159 | } |
| 143 | }.width('60%') | 160 | }.width('60%') |
| 144 | 161 | ||
| 145 | // 右侧文案和右箭头 | 162 | // 右侧文案和右箭头 |
| 146 | Row() { | 163 | Row() { |
| 147 | Toggle({ type: ToggleType.Switch, isOn: item.switchState }) | 164 | Toggle({ type: ToggleType.Switch, isOn: item.switchState }) |
| 148 | - .height('50lpx') | ||
| 149 | - .margin({ left: '81lpx', right: '29lpx' }) | 165 | + .height(`${this.calcHeight(50)}lpx`) |
| 166 | + .width(`${this.calcHeight(96)}lpx`) | ||
| 167 | + .margin({ left: `${this.calcHeight(81)}lpx`, right: `${this.calcHeight(29)}lpx` }) | ||
| 150 | .selectedColor("#ED2800") | 168 | .selectedColor("#ED2800") |
| 151 | .onChange((isOn: boolean) => { | 169 | .onChange((isOn: boolean) => { |
| 152 | if(item.itemType=='push_switch'){ | 170 | if(item.itemType=='push_switch'){ |
| @@ -168,13 +186,13 @@ export struct MineSettingComponent { | @@ -168,13 +186,13 @@ export struct MineSettingComponent { | ||
| 168 | } | 186 | } |
| 169 | }) | 187 | }) |
| 170 | }.width('40%') | 188 | }.width('40%') |
| 171 | - .margin({ right: '29lpx' }) | 189 | + .margin({ right: `${this.calcHeight(29)}lpx` }) |
| 172 | .justifyContent(FlexAlign.End) | 190 | .justifyContent(FlexAlign.End) |
| 173 | 191 | ||
| 174 | } | 192 | } |
| 175 | .alignItems(VerticalAlign.Center) | 193 | .alignItems(VerticalAlign.Center) |
| 176 | .justifyContent(FlexAlign.SpaceBetween) | 194 | .justifyContent(FlexAlign.SpaceBetween) |
| 177 | - }.height('54lpx') | 195 | + }.height(`${this.calcHeight(54)}lpx`) |
| 178 | } | 196 | } |
| 179 | 197 | ||
| 180 | // 右文字+箭头cell | 198 | // 右文字+箭头cell |
| @@ -185,10 +203,10 @@ export struct MineSettingComponent { | @@ -185,10 +203,10 @@ export struct MineSettingComponent { | ||
| 185 | // 左侧logo和标题 | 203 | // 左侧logo和标题 |
| 186 | Row() { | 204 | Row() { |
| 187 | Text(`${item.title}`) | 205 | Text(`${item.title}`) |
| 188 | - .margin({ top: '8lpx' }) | ||
| 189 | - .height('38lpx') | 206 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 207 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 190 | .fontColor('#333333') | 208 | .fontColor('#333333') |
| 191 | - .fontSize('29lpx') | 209 | + .fontSize(`${this.calcHeight(29)}lpx`) |
| 192 | }.width('60%') | 210 | }.width('60%') |
| 193 | 211 | ||
| 194 | // 右侧文案和右箭头 | 212 | // 右侧文案和右箭头 |
| @@ -197,13 +215,13 @@ export struct MineSettingComponent { | @@ -197,13 +215,13 @@ export struct MineSettingComponent { | ||
| 197 | .fontColor('#999999') | 215 | .fontColor('#999999') |
| 198 | .maxLines(1) | 216 | .maxLines(1) |
| 199 | Image($r('app.media.mine_user_arrow_2')) | 217 | Image($r('app.media.mine_user_arrow_2')) |
| 200 | - .width('27lpx') | ||
| 201 | - .height('27lpx') | 218 | + .width(`${this.calcHeight(27)}lpx`) |
| 219 | + .height(`${this.calcHeight(27)}lpx`) | ||
| 202 | .objectFit(ImageFit.Auto) | 220 | .objectFit(ImageFit.Auto) |
| 203 | .interpolation(ImageInterpolation.High) | 221 | .interpolation(ImageInterpolation.High) |
| 204 | - Column().width('29lpx') | 222 | + Column().width(`${this.calcHeight(29)}lpx`) |
| 205 | }.width('40%') | 223 | }.width('40%') |
| 206 | - .margin({ right: '29lpx' }) | 224 | + .margin({ right: `${this.calcHeight(29)}lpx` }) |
| 207 | .justifyContent(FlexAlign.End) | 225 | .justifyContent(FlexAlign.End) |
| 208 | 226 | ||
| 209 | } | 227 | } |
| @@ -211,7 +229,7 @@ export struct MineSettingComponent { | @@ -211,7 +229,7 @@ export struct MineSettingComponent { | ||
| 211 | .justifyContent(FlexAlign.SpaceBetween) | 229 | .justifyContent(FlexAlign.SpaceBetween) |
| 212 | 230 | ||
| 213 | } | 231 | } |
| 214 | - .height('54lpx') | 232 | + .height(`${this.calcHeight(54)}lpx`) |
| 215 | .onClick(() => { | 233 | .onClick(() => { |
| 216 | if (item.itemType == 'account') { | 234 | if (item.itemType == 'account') { |
| 217 | trackButtonClick("settingPageAccountManagement") | 235 | trackButtonClick("settingPageAccountManagement") |
| @@ -266,6 +284,10 @@ export struct MineSettingComponent { | @@ -266,6 +284,10 @@ export struct MineSettingComponent { | ||
| 266 | } | 284 | } |
| 267 | this.preferences.on('change', observer); | 285 | this.preferences.on('change', observer); |
| 268 | } | 286 | } |
| 287 | + | ||
| 288 | + calcHeight(value:number): number{ | ||
| 289 | + return value * this.percent | ||
| 290 | + } | ||
| 269 | } | 291 | } |
| 270 | 292 | ||
| 271 | function trackButtonClick(buttonName: string){ | 293 | function trackButtonClick(buttonName: string){ |
| @@ -13,7 +13,7 @@ import { PlayerBottomView } from '../view/PlayerBottomView'; | @@ -13,7 +13,7 @@ import { PlayerBottomView } from '../view/PlayerBottomView'; | ||
| 13 | import { PlayerRightView } from '../view/PlayerRightView'; | 13 | import { PlayerRightView } from '../view/PlayerRightView'; |
| 14 | import { DisplayDirection } from 'wdConstant/Index'; | 14 | import { DisplayDirection } from 'wdConstant/Index'; |
| 15 | import { CommentDialogView } from '../view/CommentDialogView'; | 15 | import { CommentDialogView } from '../view/CommentDialogView'; |
| 16 | -import { window } from '@kit.ArkUI'; | 16 | +import { componentUtils, window } from '@kit.ArkUI'; |
| 17 | import { PlayerFullScreenView } from '../view/PlayerFullScreenView'; | 17 | import { PlayerFullScreenView } from '../view/PlayerFullScreenView'; |
| 18 | import { OperRowListView, publishCommentModel } from 'wdComponent/Index'; | 18 | import { OperRowListView, publishCommentModel } from 'wdComponent/Index'; |
| 19 | import { ParamType, TrackConstants } from 'wdTracking/Index'; | 19 | import { ParamType, TrackConstants } from 'wdTracking/Index'; |
| @@ -207,14 +207,17 @@ export struct DetailPlayShortVideoPage { | @@ -207,14 +207,17 @@ export struct DetailPlayShortVideoPage { | ||
| 207 | * 屏幕变化动态计算播放器宽高 | 207 | * 屏幕变化动态计算播放器宽高 |
| 208 | */ | 208 | */ |
| 209 | calculatePlayerRect() { | 209 | calculatePlayerRect() { |
| 210 | - let width = this.windowWidth | ||
| 211 | - let height = this.windowHeight | 210 | + const windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口 |
| 211 | + const rect: window.Rect = windowClass.getWindowProperties().windowRect; | ||
| 212 | + | ||
| 213 | + let width = rect.width | ||
| 214 | + let height = rect.height | ||
| 212 | if (this.displayDirection === DisplayDirection.VERTICAL) { | 215 | if (this.displayDirection === DisplayDirection.VERTICAL) { |
| 213 | - width = this.windowWidth | ||
| 214 | - height = this.windowHeight | 216 | + width = rect.width |
| 217 | + height = rect.height | ||
| 215 | } else { | 218 | } else { |
| 216 | - width = this.windowHeight | ||
| 217 | - height = this.windowWidth | 219 | + width = rect.height |
| 220 | + height = rect.width | ||
| 218 | } | 221 | } |
| 219 | // 视频宽高比屏幕大,则宽度撑满 | 222 | // 视频宽高比屏幕大,则宽度撑满 |
| 220 | if (this.ratio > width / height) { | 223 | if (this.ratio > width / height) { |
| @@ -225,7 +228,7 @@ export struct DetailPlayShortVideoPage { | @@ -225,7 +228,7 @@ export struct DetailPlayShortVideoPage { | ||
| 225 | this.playerHeight = '100%' | 228 | this.playerHeight = '100%' |
| 226 | this.playerWidth = px2vp(height * this.ratio) | 229 | this.playerWidth = px2vp(height * this.ratio) |
| 227 | } | 230 | } |
| 228 | - console.log('calculatePlayerRect=====', this.windowWidth, this.windowHeight) | 231 | + console.log('calculatePlayerRect=====', width, height) |
| 229 | 232 | ||
| 230 | } | 233 | } |
| 231 | 234 | ||
| @@ -287,6 +290,7 @@ export struct DetailPlayShortVideoPage { | @@ -287,6 +290,7 @@ export struct DetailPlayShortVideoPage { | ||
| 287 | .width('100%') | 290 | .width('100%') |
| 288 | 291 | ||
| 289 | } | 292 | } |
| 293 | + .id('video-container') | ||
| 290 | .height('100%') | 294 | .height('100%') |
| 291 | .width('100%') | 295 | .width('100%') |
| 292 | .onAreaChange(() => this.calculatePlayerRect()) | 296 | .onAreaChange(() => this.calculatePlayerRect()) |
| @@ -314,7 +318,9 @@ export struct DetailPlayShortVideoPage { | @@ -314,7 +318,9 @@ export struct DetailPlayShortVideoPage { | ||
| 314 | 318 | ||
| 315 | @Builder | 319 | @Builder |
| 316 | playerViewBuilder() { | 320 | playerViewBuilder() { |
| 317 | - Stack({alignContent: this.showCommentList && this.index === this.currentIndex ? Alignment.Top : Alignment.Center}) { | 321 | + Stack({ |
| 322 | + alignContent: this.showCommentList && this.index === this.currentIndex ? Alignment.Top : Alignment.Center | ||
| 323 | + }) { | ||
| 318 | WDPlayerRenderView({ | 324 | WDPlayerRenderView({ |
| 319 | playerController: this.playerController, | 325 | playerController: this.playerController, |
| 320 | onLoad: async () => { | 326 | onLoad: async () => { |
| 1 | -import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil } from 'wdKit' | 1 | +import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil, |
| 2 | + BreakpointSystem } from 'wdKit' | ||
| 2 | import router from '@ohos.router' | 3 | import router from '@ohos.router' |
| 3 | import { LoginViewModel } from './LoginViewModel' | 4 | import { LoginViewModel } from './LoginViewModel' |
| 4 | import { LoginInputComponent } from './LoginInputComponent' | 5 | import { LoginInputComponent } from './LoginInputComponent' |
| @@ -56,6 +57,17 @@ struct LoginPage { | @@ -56,6 +57,17 @@ struct LoginPage { | ||
| 56 | 57 | ||
| 57 | loginViewModel = new LoginViewModel() | 58 | loginViewModel = new LoginViewModel() |
| 58 | @State isProtocol:boolean=false | 59 | @State isProtocol:boolean=false |
| 60 | + @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | ||
| 61 | + private breakpointSystem = new BreakpointSystem(); | ||
| 62 | + @State percent:number = 1 | ||
| 63 | + | ||
| 64 | + currentChanged(){ | ||
| 65 | + if(this.currentBreakpoint == "md" || this.currentBreakpoint == "lg"){ | ||
| 66 | + this.percent = 0.7 | ||
| 67 | + }else { | ||
| 68 | + this.percent = 1 | ||
| 69 | + } | ||
| 70 | + } | ||
| 59 | onCodeSend() { | 71 | onCodeSend() { |
| 60 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") | 72 | Logger.debug(TAG, "isCodeSend:" + this.isCodeSend + "") |
| 61 | if (this.isCodeSend) { | 73 | if (this.isCodeSend) { |
| @@ -66,6 +78,12 @@ struct LoginPage { | @@ -66,6 +78,12 @@ struct LoginPage { | ||
| 66 | 78 | ||
| 67 | aboutToAppear() { | 79 | aboutToAppear() { |
| 68 | Logger.debug(TAG, "aboutToAppear:" + this.isCodeSend + "") | 80 | Logger.debug(TAG, "aboutToAppear:" + this.isCodeSend + "") |
| 81 | + this.breakpointSystem.register(); | ||
| 82 | + this.currentChanged() | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + aboutToDisappear(): void { | ||
| 86 | + this.breakpointSystem.unregister(); | ||
| 69 | } | 87 | } |
| 70 | 88 | ||
| 71 | onPageShow() { | 89 | onPageShow() { |
| @@ -144,10 +162,10 @@ struct LoginPage { | @@ -144,10 +162,10 @@ struct LoginPage { | ||
| 144 | Text("登录") | 162 | Text("登录") |
| 145 | .borderRadius(4) | 163 | .borderRadius(4) |
| 146 | .fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF") | 164 | .fontColor(this.isSubmit ? "#FFFFFFFF" : "#66FFFFFF") |
| 147 | - .fontSize("31lpx") | 165 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 148 | .fontWeight(400) | 166 | .fontWeight(400) |
| 149 | - .margin({ top: 20 }) | ||
| 150 | - .lineHeight("50lpx") | 167 | + .margin({ top: `${this.calcHeight(20)}` }) |
| 168 | + .lineHeight(`${this.calcHeight(50)}lpx`) | ||
| 151 | .height(44) | 169 | .height(44) |
| 152 | .textAlign(TextAlign.Center) | 170 | .textAlign(TextAlign.Center) |
| 153 | .width("100%") | 171 | .width("100%") |
| @@ -170,9 +188,9 @@ struct LoginPage { | @@ -170,9 +188,9 @@ struct LoginPage { | ||
| 170 | if (!this.checkCodePage) { | 188 | if (!this.checkCodePage) { |
| 171 | Text('忘记密码') | 189 | Text('忘记密码') |
| 172 | .fontColor('#666666') | 190 | .fontColor('#666666') |
| 173 | - .fontSize("31lpx") | 191 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 174 | .fontWeight(400) | 192 | .fontWeight(400) |
| 175 | - .lineHeight("38lpx") | 193 | + .lineHeight(`${this.calcHeight(38)}lpx`) |
| 176 | .margin({ top: 16 }) | 194 | .margin({ top: 16 }) |
| 177 | .onClick(() => { | 195 | .onClick(() => { |
| 178 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) | 196 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) |
| @@ -217,7 +235,8 @@ struct LoginPage { | @@ -217,7 +235,8 @@ struct LoginPage { | ||
| 217 | 235 | ||
| 218 | ProtocolComponent({ | 236 | ProtocolComponent({ |
| 219 | cancelMethod: (): void => this.cancelProtocol(), | 237 | cancelMethod: (): void => this.cancelProtocol(), |
| 220 | - agreeMethod: (): void => this.agreeProtocol() | 238 | + agreeMethod: (): void => this.agreeProtocol(), |
| 239 | + percent:$percent | ||
| 221 | }) | 240 | }) |
| 222 | .visibility(this.isProtocol ? Visibility.Visible : Visibility.None) | 241 | .visibility(this.isProtocol ? Visibility.Visible : Visibility.None) |
| 223 | 242 | ||
| @@ -301,15 +320,15 @@ struct LoginPage { | @@ -301,15 +320,15 @@ struct LoginPage { | ||
| 301 | Row() { | 320 | Row() { |
| 302 | Row() { | 321 | Row() { |
| 303 | Image(this.checkCodePage ? $r('app.media.login_qt') : $r('app.media.login_other_password')) | 322 | Image(this.checkCodePage ? $r('app.media.login_qt') : $r('app.media.login_other_password')) |
| 304 | - .size({ width: "35lpx", height: "35lpx" }) | ||
| 305 | - .margin({right:"8lpx"}) | ||
| 306 | - .height("38lpx") | ||
| 307 | - .width("38lpx") | 323 | + .size({ width: `${this.calcHeight(35)}lpx`, height: `${this.calcHeight(35)}lpx` }) |
| 324 | + .margin({right:`${this.calcHeight(8)}lpx`}) | ||
| 325 | + .height(`${this.calcHeight(38)}lpx`) | ||
| 326 | + .width(`${this.calcHeight(38)}lpx`) | ||
| 308 | Text(this.checkCodePage ? "密码登录" : "手机号登录") | 327 | Text(this.checkCodePage ? "密码登录" : "手机号登录") |
| 309 | .fontWeight(400) | 328 | .fontWeight(400) |
| 310 | .fontColor("#3D3D3D") | 329 | .fontColor("#3D3D3D") |
| 311 | - .fontSize("23lpx") | ||
| 312 | - .lineHeight("38lpx") | 330 | + .fontSize(`${this.calcHeight(23)}lpx`) |
| 331 | + .lineHeight(`${this.calcHeight(38)}lpx`) | ||
| 313 | } | 332 | } |
| 314 | .onClick(() => { | 333 | .onClick(() => { |
| 315 | this.onPageHide() | 334 | this.onPageHide() |
| @@ -332,7 +351,7 @@ struct LoginPage { | @@ -332,7 +351,7 @@ struct LoginPage { | ||
| 332 | }.height(36) | 351 | }.height(36) |
| 333 | .width('100%') | 352 | .width('100%') |
| 334 | .padding({ left: 25, right: 25 }) | 353 | .padding({ left: 25, right: 25 }) |
| 335 | - .margin({ top: "46lpx" }) | 354 | + .margin({ top: `${this.calcHeight(46)}lpx` }) |
| 336 | } | 355 | } |
| 337 | .width('100%') | 356 | .width('100%') |
| 338 | .margin({ bottom: 40 }) | 357 | .margin({ bottom: 40 }) |
| @@ -478,7 +497,9 @@ struct LoginPage { | @@ -478,7 +497,9 @@ struct LoginPage { | ||
| 478 | .slide(SlideEffect.Right) | 497 | .slide(SlideEffect.Right) |
| 479 | } | 498 | } |
| 480 | 499 | ||
| 481 | - | 500 | + calcHeight(value:number): number{ |
| 501 | + return value * this.percent | ||
| 502 | + } | ||
| 482 | } | 503 | } |
| 483 | 504 | ||
| 484 | 505 | ||
| @@ -486,41 +507,42 @@ struct LoginPage { | @@ -486,41 +507,42 @@ struct LoginPage { | ||
| 486 | struct ProtocolComponent { | 507 | struct ProtocolComponent { |
| 487 | cancelMethod?: () => void | 508 | cancelMethod?: () => void |
| 488 | agreeMethod?: () => void | 509 | agreeMethod?: () => void |
| 510 | + @Link percent:number | ||
| 489 | 511 | ||
| 490 | build() { | 512 | build() { |
| 491 | Stack() { | 513 | Stack() { |
| 492 | Column() { | 514 | Column() { |
| 493 | Text("温馨提示") | 515 | Text("温馨提示") |
| 494 | .fontColor("#222222") | 516 | .fontColor("#222222") |
| 495 | - .fontSize("35lpx") | ||
| 496 | - .lineHeight("50lpx") | 517 | + .fontSize(`${this.calcHeight(35)}lpx`) |
| 518 | + .lineHeight(`${this.calcHeight(50)}lpx`) | ||
| 497 | .width("100%") | 519 | .width("100%") |
| 498 | .fontWeight(500) | 520 | .fontWeight(500) |
| 499 | .textAlign(TextAlign.Center) | 521 | .textAlign(TextAlign.Center) |
| 500 | - .margin({ top: "38lpx" }) | 522 | + .margin({ top: `${this.calcHeight(38)}lpx` }) |
| 501 | Text() { | 523 | Text() { |
| 502 | Span("为保障您的合法权益,请阅读并同意") | 524 | Span("为保障您的合法权益,请阅读并同意") |
| 503 | - .fontSize("27lpx") | ||
| 504 | - .lineHeight("42lpx") | 525 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 526 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 505 | .fontWeight(400) | 527 | .fontWeight(400) |
| 506 | .fontColor("#666666") | 528 | .fontColor("#666666") |
| 507 | 529 | ||
| 508 | Span("《用户协议》") | 530 | Span("《用户协议》") |
| 509 | - .fontSize("27lpx") | ||
| 510 | - .lineHeight("42lpx") | 531 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 532 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 511 | .fontWeight(400) | 533 | .fontWeight(400) |
| 512 | .fontColor("#ED2800") | 534 | .fontColor("#ED2800") |
| 513 | .onClick(() => { | 535 | .onClick(() => { |
| 514 | let bean = { contentID: "1", pageID: "" } as Params | 536 | let bean = { contentID: "1", pageID: "" } as Params |
| 515 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | 537 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) |
| 516 | }) | 538 | }) |
| 517 | - Span("及").fontSize("27lpx") | ||
| 518 | - .lineHeight("42lpx") | 539 | + Span("及").fontSize(`${this.calcHeight(27)}lpx`) |
| 540 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 519 | .fontWeight(400) | 541 | .fontWeight(400) |
| 520 | .fontColor("#666666") | 542 | .fontColor("#666666") |
| 521 | Span("《隐私政策》") | 543 | Span("《隐私政策》") |
| 522 | - .fontSize("27lpx") | ||
| 523 | - .lineHeight("42lpx") | 544 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 545 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 524 | .fontWeight(400) | 546 | .fontWeight(400) |
| 525 | .fontColor("#ED2800") | 547 | .fontColor("#ED2800") |
| 526 | .onClick(() => { | 548 | .onClick(() => { |
| @@ -528,20 +550,20 @@ struct ProtocolComponent { | @@ -528,20 +550,20 @@ struct ProtocolComponent { | ||
| 528 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) | 550 | WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean) |
| 529 | }) | 551 | }) |
| 530 | Span("后进行登录") | 552 | Span("后进行登录") |
| 531 | - .fontSize("27lpx") | ||
| 532 | - .lineHeight("42lpx") | 553 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 554 | + .lineHeight(`${this.calcHeight(42)}lpx`) | ||
| 533 | .fontWeight(400) | 555 | .fontWeight(400) |
| 534 | .fontColor("#666666") | 556 | .fontColor("#666666") |
| 535 | - }.margin({ top: "23lpx", left: "31lpx", right: "31lpx" }) | 557 | + }.margin({ top: `${this.calcHeight(23)}lpx`, left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) |
| 536 | .wordBreak(WordBreak.BREAK_ALL) | 558 | .wordBreak(WordBreak.BREAK_ALL) |
| 537 | .textAlign(TextAlign.Start) | 559 | .textAlign(TextAlign.Start) |
| 538 | 560 | ||
| 539 | - Divider().color("#f5f5f5").width("100%").margin({ top: "27lpx" }).height('1lpx').strokeWidth('1lpx') | 561 | + Divider().color("#f5f5f5").width("100%").margin({ top: `${this.calcHeight(27)}lpx` }).height(`${this.calcHeight(1)}lpx`).strokeWidth(`${this.calcHeight(1)}lpx`) |
| 540 | Row() { | 562 | Row() { |
| 541 | Text('放弃登录') | 563 | Text('放弃登录') |
| 542 | - .fontSize("31lpx") | 564 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 543 | .fontWeight(500) | 565 | .fontWeight(500) |
| 544 | - .lineHeight("42lpx") | 566 | + .lineHeight(`${this.calcHeight(42)}lpx`) |
| 545 | .fontColor("#999999") | 567 | .fontColor("#999999") |
| 546 | .layoutWeight(1) | 568 | .layoutWeight(1) |
| 547 | .textAlign(TextAlign.Center) | 569 | .textAlign(TextAlign.Center) |
| @@ -553,17 +575,17 @@ struct ProtocolComponent { | @@ -553,17 +575,17 @@ struct ProtocolComponent { | ||
| 553 | .height('100%') | 575 | .height('100%') |
| 554 | 576 | ||
| 555 | Divider() | 577 | Divider() |
| 556 | - .width("1lpx") | ||
| 557 | - .strokeWidth('1lpx') | 578 | + .width(`${this.calcHeight(1)}lpx`) |
| 579 | + .strokeWidth(`${this.calcHeight(1)}lpx`) | ||
| 558 | .vertical(true) | 580 | .vertical(true) |
| 559 | .height('100%') | 581 | .height('100%') |
| 560 | .color("#F5F5F5") | 582 | .color("#F5F5F5") |
| 561 | 583 | ||
| 562 | 584 | ||
| 563 | Text('同意并登录') | 585 | Text('同意并登录') |
| 564 | - .fontSize("31lpx") | 586 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 565 | .fontWeight(500) | 587 | .fontWeight(500) |
| 566 | - .lineHeight("42lpx") | 588 | + .lineHeight(`${this.calcHeight(42)}lpx`) |
| 567 | .fontColor("#ED2800") | 589 | .fontColor("#ED2800") |
| 568 | .layoutWeight(1) | 590 | .layoutWeight(1) |
| 569 | .textAlign(TextAlign.Center) | 591 | .textAlign(TextAlign.Center) |
| @@ -582,15 +604,19 @@ struct ProtocolComponent { | @@ -582,15 +604,19 @@ struct ProtocolComponent { | ||
| 582 | .justifyContent(FlexAlign.Center) | 604 | .justifyContent(FlexAlign.Center) |
| 583 | } | 605 | } |
| 584 | .backgroundColor(Color.White) | 606 | .backgroundColor(Color.White) |
| 585 | - .borderRadius("12lpx") | ||
| 586 | - .width("528lpx") | ||
| 587 | - .height("309lpx") | 607 | + .borderRadius(`${this.calcHeight(12)}lpx`) |
| 608 | + .width(`${this.calcHeight(528)}lpx`) | ||
| 609 | + .height(`${this.calcHeight(309)}lpx`) | ||
| 588 | 610 | ||
| 589 | }.width('100%') | 611 | }.width('100%') |
| 590 | .height('100%') | 612 | .height('100%') |
| 591 | .backgroundColor('#66000000') | 613 | .backgroundColor('#66000000') |
| 592 | 614 | ||
| 593 | } | 615 | } |
| 616 | + | ||
| 617 | + calcHeight(value:number): number{ | ||
| 618 | + return value * this.percent | ||
| 619 | + } | ||
| 594 | } | 620 | } |
| 595 | 621 | ||
| 596 | function trackTypeClick(typeValue: number,pageId: string){ | 622 | function trackTypeClick(typeValue: number,pageId: string){ |
| @@ -27,6 +27,7 @@ struct Index { | @@ -27,6 +27,7 @@ struct Index { | ||
| 27 | @State name: string = 'audio_status_wait'; | 27 | @State name: string = 'audio_status_wait'; |
| 28 | 28 | ||
| 29 | async aboutToAppear() { | 29 | async aboutToAppear() { |
| 30 | + window.findWindow("subWindow").setWindowBackgroundColor("#00000000") | ||
| 30 | this.AudioSuspension.playerController.get().onTimeUpdate = (position, duration) => { | 31 | this.AudioSuspension.playerController.get().onTimeUpdate = (position, duration) => { |
| 31 | this.currentTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(position); | 32 | this.currentTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(position); |
| 32 | this.totalTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(duration); | 33 | this.totalTime = DateFormatUtil.convertMillisecondsToMinutesSeconds(duration); |
-
Please register or login to post a comment