Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
10 changed files
with
116 additions
and
72 deletions
| @@ -3,10 +3,13 @@ export struct CustomToast { | @@ -3,10 +3,13 @@ export struct CustomToast { | ||
| 3 | public static LENGTH_LONG = 4000; | 3 | public static LENGTH_LONG = 4000; |
| 4 | public static LENGTH_SHORT = 2000; | 4 | public static LENGTH_SHORT = 2000; |
| 5 | 5 | ||
| 6 | - @State msg: string = "" | 6 | + @State msg: ResourceStr = "" |
| 7 | @State duration: number = CustomToast.LENGTH_SHORT | 7 | @State duration: number = CustomToast.LENGTH_SHORT |
| 8 | @State bgBorderRadius: number = 10 | 8 | @State bgBorderRadius: number = 10 |
| 9 | - | 9 | + opacityValue: number = 0.7 |
| 10 | + bgColor: ResourceColor = $r("app.color.black") | ||
| 11 | + fontSizeValue :number | string | Resource = "27lpx" | ||
| 12 | + lineHeightValue :number | string | Resource = "38lpx" | ||
| 10 | controller: CustomDialogController | 13 | controller: CustomDialogController |
| 11 | 14 | ||
| 12 | dismiss: () => void = () => { | 15 | dismiss: () => void = () => { |
| @@ -27,13 +30,13 @@ export struct CustomToast { | @@ -27,13 +30,13 @@ export struct CustomToast { | ||
| 27 | Text(this.msg) | 30 | Text(this.msg) |
| 28 | .fontWeight(FontWeight.Regular) | 31 | .fontWeight(FontWeight.Regular) |
| 29 | .fontColor($r('app.color.white')) | 32 | .fontColor($r('app.color.white')) |
| 30 | - .fontSize("27lpx") | ||
| 31 | - .lineHeight("38lpx") | 33 | + .fontSize(this.fontSizeValue) |
| 34 | + .lineHeight(this.lineHeightValue) | ||
| 32 | .textAlign(TextAlign.Center) | 35 | .textAlign(TextAlign.Center) |
| 33 | }.borderRadius(`${this.bgBorderRadius}lpx`) | 36 | }.borderRadius(`${this.bgBorderRadius}lpx`) |
| 34 | .constraintSize({maxWidth:"86%"}) | 37 | .constraintSize({maxWidth:"86%"}) |
| 35 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) | 38 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) |
| 36 | - .backgroundColor($r("app.color.black")) | ||
| 37 | - .opacity(0.7) | 39 | + .backgroundColor(this.bgColor) |
| 40 | + .opacity(this.opacityValue) | ||
| 38 | } | 41 | } |
| 39 | } | 42 | } |
| @@ -21,7 +21,7 @@ export enum HostEnum { | @@ -21,7 +21,7 @@ export enum HostEnum { | ||
| 21 | * 环境host管理工具类 | 21 | * 环境host管理工具类 |
| 22 | */ | 22 | */ |
| 23 | export class HostManager { | 23 | export class HostManager { |
| 24 | - private static _hostUrl: HostEnum = HostEnum.HOST_UAT; | 24 | + private static _hostUrl: HostEnum = HostEnum.HOST_PRODUCT; |
| 25 | 25 | ||
| 26 | static changeHost(host: HostEnum) { | 26 | static changeHost(host: HostEnum) { |
| 27 | HostManager._hostUrl = host; | 27 | HostManager._hostUrl = host; |
| @@ -89,7 +89,7 @@ export struct CompParser { | @@ -89,7 +89,7 @@ export struct CompParser { | ||
| 89 | } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 89 | } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 90 | if (this.compDTO.operDataList.length > this.audioItems.length) { | 90 | if (this.compDTO.operDataList.length > this.audioItems.length) { |
| 91 | ZhCarouselLayout01({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 91 | ZhCarouselLayout01({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| 92 | - Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 92 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 93 | } | 93 | } |
| 94 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && | 94 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && |
| 95 | this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | 95 | this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" |
| 1 | import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; | 1 | import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; |
| 2 | import { AppUtils, | 2 | import { AppUtils, |
| 3 | + CustomToast, | ||
| 3 | DateTimeUtils, | 4 | DateTimeUtils, |
| 4 | DeviceUtil, | 5 | DeviceUtil, |
| 5 | - FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 6 | + FastClickUtil, Logger, NetworkUtil, StringUtils, UserDataLocal } from 'wdKit/Index'; |
| 6 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 7 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 7 | import { CustomTitleUI } from './reusable/CustomTitleUI' | 8 | import { CustomTitleUI } from './reusable/CustomTitleUI' |
| 8 | import { picker } from '@kit.CoreFileKit'; | 9 | import { picker } from '@kit.CoreFileKit'; |
| @@ -38,6 +39,21 @@ export struct FeedBackActivity { | @@ -38,6 +39,21 @@ export struct FeedBackActivity { | ||
| 38 | addPic: PhotoListBean = {itemType:1} as PhotoListBean | 39 | addPic: PhotoListBean = {itemType:1} as PhotoListBean |
| 39 | @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] | 40 | @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] |
| 40 | 41 | ||
| 42 | + @State toastText:ResourceStr = "" | ||
| 43 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 44 | + builder: CustomToast({ | ||
| 45 | + bgColor:$r("app.color.color_B3000000"), | ||
| 46 | + opacityValue:1, | ||
| 47 | + fontSizeValue:"25lpx", | ||
| 48 | + lineHeightValue:"36lpx", | ||
| 49 | + msg: this.toastText, | ||
| 50 | + }), | ||
| 51 | + autoCancel: false, | ||
| 52 | + alignment: DialogAlignment.Center, | ||
| 53 | + customStyle: true, | ||
| 54 | + maskColor:"#00000000" | ||
| 55 | + }) | ||
| 56 | + | ||
| 41 | async aboutToAppear() { | 57 | async aboutToAppear() { |
| 42 | await this.getContentDetailData() | 58 | await this.getContentDetailData() |
| 43 | } | 59 | } |
| @@ -124,7 +140,7 @@ export struct FeedBackActivity { | @@ -124,7 +140,7 @@ export struct FeedBackActivity { | ||
| 124 | if(value.length> 500){ | 140 | if(value.length> 500){ |
| 125 | //隐藏键盘 | 141 | //隐藏键盘 |
| 126 | inputMethod.getController().stopInputSession(); | 142 | inputMethod.getController().stopInputSession(); |
| 127 | - ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) | 143 | + this.showToastTip($r('app.string.res_feedback_commentsFail')) |
| 128 | // Logger.debug(TAG, "onChange > 500 " + value) | 144 | // Logger.debug(TAG, "onChange > 500 " + value) |
| 129 | this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean | 145 | this.editValue = {classifyName:value.substring(0,500)} as FeedbackTypeBean |
| 130 | }else{ | 146 | }else{ |
| @@ -409,13 +425,13 @@ export struct FeedBackActivity { | @@ -409,13 +425,13 @@ export struct FeedBackActivity { | ||
| 409 | }) | 425 | }) |
| 410 | }else{ | 426 | }else{ |
| 411 | // | 427 | // |
| 412 | - ToastUtils.shortToast($r('app.string.feedback_opinion_type')) | 428 | + this.showToastTip($r('app.string.feedback_opinion_type')) |
| 413 | TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage) | 429 | TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage) |
| 414 | return | 430 | return |
| 415 | } | 431 | } |
| 416 | //内容必填 | 432 | //内容必填 |
| 417 | if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){ | 433 | if(StringUtils.isEmpty(this.editValue.classifyName) || this.editValue.classifyName.length < 10 || this.editValue.classifyName.length>500){ |
| 418 | - ToastUtils.shortToast($r('app.string.res_feedback_commentsFail')) | 434 | + this.showToastTip($r('app.string.res_feedback_commentsFail')) |
| 419 | return | 435 | return |
| 420 | } | 436 | } |
| 421 | 437 | ||
| @@ -458,4 +474,9 @@ export struct FeedBackActivity { | @@ -458,4 +474,9 @@ export struct FeedBackActivity { | ||
| 458 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) | 474 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) |
| 459 | 475 | ||
| 460 | } | 476 | } |
| 477 | + | ||
| 478 | + showToastTip(msg:ResourceStr){ | ||
| 479 | + this.toastText = msg | ||
| 480 | + this.dialogToast.open() | ||
| 481 | + } | ||
| 461 | } | 482 | } |
| @@ -46,7 +46,7 @@ export struct ZhGridLayout03 { | @@ -46,7 +46,7 @@ export struct ZhGridLayout03 { | ||
| 46 | left: $r('app.float.card_comp_pagePadding_lf'), | 46 | left: $r('app.float.card_comp_pagePadding_lf'), |
| 47 | right: $r('app.float.card_comp_pagePadding_lf'), | 47 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 48 | top: $r('app.float.card_comp_pagePadding_tb'), | 48 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 49 | - bottom: $r('app.float.card_comp_pagePadding_tb') | 49 | + bottom: '0vp' |
| 50 | }) | 50 | }) |
| 51 | } | 51 | } |
| 52 | 52 |
| @@ -146,7 +146,7 @@ export struct SearchComponent { | @@ -146,7 +146,7 @@ export struct SearchComponent { | ||
| 146 | Scroll(this.scroller) { | 146 | Scroll(this.scroller) { |
| 147 | Column() { | 147 | Column() { |
| 148 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ | 148 | if(this.searchHistoryData!=null && this.searchHistoryData.length>0){ |
| 149 | - SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput() }) | 149 | + SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput(),percent:this.percent }) |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | if(this.searchHistoryData.length>0){ | 152 | if(this.searchHistoryData.length>0){ |
| @@ -175,10 +175,10 @@ export struct SearchComponent { | @@ -175,10 +175,10 @@ export struct SearchComponent { | ||
| 175 | this.getSearchHistoryData() | 175 | this.getSearchHistoryData() |
| 176 | this.getSearchInputResData(this.searchText) | 176 | this.getSearchInputResData(this.searchText) |
| 177 | } | 177 | } |
| 178 | - }}) | 178 | + },percent:this.percent}) |
| 179 | } else { | 179 | } else { |
| 180 | //联想搜索 | 180 | //联想搜索 |
| 181 | - SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 181 | + SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText,percent:this.percent}) |
| 182 | } | 182 | } |
| 183 | } | 183 | } |
| 184 | }.height('100%') | 184 | }.height('100%') |
| @@ -337,20 +337,22 @@ export struct SearchComponent { | @@ -337,20 +337,22 @@ export struct SearchComponent { | ||
| 337 | } | 337 | } |
| 338 | } | 338 | } |
| 339 | }) | 339 | }) |
| 340 | - }.padding({right:`${this.calcHeight(70)}lpx`}) | ||
| 341 | - .layoutWeight(1) | ||
| 342 | 340 | ||
| 343 | Image($r('app.media.search_input_del_icon')) | 341 | Image($r('app.media.search_input_del_icon')) |
| 344 | .width(`${this.calcHeight(31)}lpx`) | 342 | .width(`${this.calcHeight(31)}lpx`) |
| 345 | .height(`${this.calcHeight(31)}lpx`) | 343 | .height(`${this.calcHeight(31)}lpx`) |
| 346 | .objectFit(ImageFit.Auto) | 344 | .objectFit(ImageFit.Auto) |
| 347 | .interpolation(ImageInterpolation.Medium) | 345 | .interpolation(ImageInterpolation.Medium) |
| 348 | - .margin({left:`${this.calcHeight(495)}lpx`}) | ||
| 349 | .onClick(()=>{ | 346 | .onClick(()=>{ |
| 350 | this.searchText = "" | 347 | this.searchText = "" |
| 351 | }) | 348 | }) |
| 349 | + .offset({x:10}) | ||
| 350 | + .enabled(true) | ||
| 352 | .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible) | 351 | .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible) |
| 353 | 352 | ||
| 353 | + }.padding({right:`${this.calcHeight(70)}lpx`}) | ||
| 354 | + .layoutWeight(1) | ||
| 355 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 354 | } | 356 | } |
| 355 | .backgroundImage($r('app.media.search_page_input_bg')) | 357 | .backgroundImage($r('app.media.search_page_input_bg')) |
| 356 | .backgroundImageSize(ImageSize.Cover) | 358 | .backgroundImageSize(ImageSize.Cover) |
| @@ -27,6 +27,7 @@ export struct SearchHistoryComponent{ | @@ -27,6 +27,7 @@ export struct SearchHistoryComponent{ | ||
| 27 | alignment: DialogAlignment.Center, | 27 | alignment: DialogAlignment.Center, |
| 28 | customStyle: true | 28 | customStyle: true |
| 29 | }) | 29 | }) |
| 30 | + @Prop percent:number = 1 | ||
| 30 | 31 | ||
| 31 | onAccept(){ | 32 | onAccept(){ |
| 32 | console.info('Callback when the second button is clicked') | 33 | console.info('Callback when the second button is clicked') |
| @@ -48,14 +49,14 @@ export struct SearchHistoryComponent{ | @@ -48,14 +49,14 @@ export struct SearchHistoryComponent{ | ||
| 48 | Text("搜索历史") | 49 | Text("搜索历史") |
| 49 | .textAlign(TextAlign.Center) | 50 | .textAlign(TextAlign.Center) |
| 50 | .fontWeight(FontWeight.Regular) | 51 | .fontWeight(FontWeight.Regular) |
| 51 | - .fontSize('27lpx') | ||
| 52 | - .lineHeight('38lpx') | 52 | + .fontSize(`${this.calcHeight(27)}lpx`) |
| 53 | + .lineHeight(`${this.calcHeight(38)}lpx`) | ||
| 53 | .fontColor($r('app.color.color_999999')) | 54 | .fontColor($r('app.color.color_999999')) |
| 54 | - .height('38lpx') | 55 | + .height(`${this.calcHeight(38)}lpx`) |
| 55 | 56 | ||
| 56 | Image($r('app.media.search_delete_icon')) | 57 | Image($r('app.media.search_delete_icon')) |
| 57 | - .height('31lpx') | ||
| 58 | - .width('31lpx') | 58 | + .height(`${this.calcHeight(31)}lpx`) |
| 59 | + .width(`${this.calcHeight(31)}lpx`) | ||
| 59 | .interpolation(ImageInterpolation.High) | 60 | .interpolation(ImageInterpolation.High) |
| 60 | .objectFit(ImageFit.Auto) | 61 | .objectFit(ImageFit.Auto) |
| 61 | .onClick(()=>{ | 62 | .onClick(()=>{ |
| @@ -63,7 +64,7 @@ export struct SearchHistoryComponent{ | @@ -63,7 +64,7 @@ export struct SearchHistoryComponent{ | ||
| 63 | this.dialogController.open() | 64 | this.dialogController.open() |
| 64 | }) | 65 | }) |
| 65 | }.justifyContent(FlexAlign.SpaceBetween) | 66 | }.justifyContent(FlexAlign.SpaceBetween) |
| 66 | - .margin({bottom:'17lpx'}) | 67 | + .margin({bottom:`${this.calcHeight(17)}lpx`}) |
| 67 | .width('100%') | 68 | .width('100%') |
| 68 | 69 | ||
| 69 | Grid(){ | 70 | Grid(){ |
| @@ -72,14 +73,14 @@ export struct SearchHistoryComponent{ | @@ -72,14 +73,14 @@ export struct SearchHistoryComponent{ | ||
| 72 | Row(){ | 73 | Row(){ |
| 73 | Text(`${item.searchContent}`) | 74 | Text(`${item.searchContent}`) |
| 74 | .fontColor($r('app.color.color_222222')) | 75 | .fontColor($r('app.color.color_222222')) |
| 75 | - .fontSize('31lpx') | 76 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 76 | .fontWeight(FontWeight.Regular) | 77 | .fontWeight(FontWeight.Regular) |
| 77 | - .lineHeight('46lpx') | 78 | + .lineHeight(`${this.calcHeight(46)}lpx`) |
| 78 | .maxLines(1) | 79 | .maxLines(1) |
| 79 | - .constraintSize({maxWidth:index%2 === 0?'270lpx':'230lpx'}) | 80 | + .constraintSize({maxWidth:index%2 === 0?`${this.calcHeight(270)}lpx`:`${this.calcHeight(230)}lpx`}) |
| 80 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 81 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 81 | .textAlign(TextAlign.Start) | 82 | .textAlign(TextAlign.Start) |
| 82 | - .margin({left:index%2 === 0?'0lpx':'23lpx'}) | 83 | + .margin({left:index%2 === 0?'0lpx':`${this.calcHeight(23)}lpx`}) |
| 83 | .onClick(()=>{ | 84 | .onClick(()=>{ |
| 84 | if (this.onGetSearchRes !== undefined) { | 85 | if (this.onGetSearchRes !== undefined) { |
| 85 | this.onGetSearchRes(item.searchContent,index) | 86 | this.onGetSearchRes(item.searchContent,index) |
| @@ -87,9 +88,9 @@ export struct SearchHistoryComponent{ | @@ -87,9 +88,9 @@ export struct SearchHistoryComponent{ | ||
| 87 | }) | 88 | }) |
| 88 | 89 | ||
| 89 | Image($r('app.media.search_item_delete_icon')) | 90 | Image($r('app.media.search_item_delete_icon')) |
| 90 | - .width('23lpx') | ||
| 91 | - .height('23lpx') | ||
| 92 | - .margin({left:'4lpx'}) | 91 | + .width(`${this.calcHeight(23)}lpx`) |
| 92 | + .height(`${this.calcHeight(23)}lpx`) | ||
| 93 | + .margin({left:`${this.calcHeight(4)}lpx`}) | ||
| 93 | .interpolation(ImageInterpolation.Medium) | 94 | .interpolation(ImageInterpolation.Medium) |
| 94 | .objectFit(ImageFit.Auto) | 95 | .objectFit(ImageFit.Auto) |
| 95 | .onClick(()=>{ | 96 | .onClick(()=>{ |
| @@ -103,19 +104,19 @@ export struct SearchHistoryComponent{ | @@ -103,19 +104,19 @@ export struct SearchHistoryComponent{ | ||
| 103 | 104 | ||
| 104 | if(index%2 === 0 && index != this.searchHistoryData.length-1 ){ | 105 | if(index%2 === 0 && index != this.searchHistoryData.length-1 ){ |
| 105 | Divider() | 106 | Divider() |
| 106 | - .width('2lpx') | ||
| 107 | - .height('23lpx') | 107 | + .width(`${this.calcHeight(2)}lpx`) |
| 108 | + .height(`${this.calcHeight(23)}lpx`) | ||
| 108 | .color($r('app.color.color_CCCCCC')) | 109 | .color($r('app.color.color_CCCCCC')) |
| 109 | - .strokeWidth('2lpx') | 110 | + .strokeWidth(`${this.calcHeight(2)}lpx`) |
| 110 | .vertical(true) | 111 | .vertical(true) |
| 111 | } | 112 | } |
| 112 | }.height('100%') | 113 | }.height('100%') |
| 113 | .alignItems(VerticalAlign.Center) | 114 | .alignItems(VerticalAlign.Center) |
| 114 | .width('100%') | 115 | .width('100%') |
| 115 | - .margin({left:index%2 === 1?'23lpx':'0lpx'}) | 116 | + .margin({left:index%2 === 1?`${this.calcHeight(23)}lpx`:'0lpx'}) |
| 116 | 117 | ||
| 117 | } | 118 | } |
| 118 | - .height('46lpx') | 119 | + .height(`${this.calcHeight(46)}lpx`) |
| 119 | .alignSelf(ItemAlign.Center) | 120 | .alignSelf(ItemAlign.Center) |
| 120 | 121 | ||
| 121 | }) | 122 | }) |
| @@ -123,9 +124,9 @@ export struct SearchHistoryComponent{ | @@ -123,9 +124,9 @@ export struct SearchHistoryComponent{ | ||
| 123 | .height(this.getCategoryViewHeight()) | 124 | .height(this.getCategoryViewHeight()) |
| 124 | .rowsTemplate(this.getCategoryRowTmpl()) | 125 | .rowsTemplate(this.getCategoryRowTmpl()) |
| 125 | .columnsTemplate('1fr 1fr') | 126 | .columnsTemplate('1fr 1fr') |
| 126 | - .rowsGap('23lpx') | 127 | + .rowsGap(`${this.calcHeight(23)}lpx`) |
| 127 | } | 128 | } |
| 128 | - .margin({top:"36lpx",bottom:'46lpx'}) | 129 | + .margin({top:`${this.calcHeight(36)}lpx`,bottom:`${this.calcHeight(46)}lpx`}) |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | getCategoryRowCount() { | 132 | getCategoryRowCount() { |
| @@ -140,6 +141,10 @@ export struct SearchHistoryComponent{ | @@ -140,6 +141,10 @@ export struct SearchHistoryComponent{ | ||
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | getCategoryViewHeight() { | 143 | getCategoryViewHeight() { |
| 143 | - return `${50 * this.getCategoryRowCount()}lpx`; | 144 | + return `${50 * this.percent * this.getCategoryRowCount()}lpx`; |
| 145 | + } | ||
| 146 | + | ||
| 147 | + calcHeight(value:number): number{ | ||
| 148 | + return value * this.percent | ||
| 144 | } | 149 | } |
| 145 | } | 150 | } |
| @@ -10,6 +10,7 @@ export struct SearchRelatedComponent { | @@ -10,6 +10,7 @@ export struct SearchRelatedComponent { | ||
| 10 | @Link relatedSearchContentData: SearchRelatedItem[] | 10 | @Link relatedSearchContentData: SearchRelatedItem[] |
| 11 | onGetSearchRes?: (item:string) => void; | 11 | onGetSearchRes?: (item:string) => void; |
| 12 | @Prop searchText: string | 12 | @Prop searchText: string |
| 13 | + @Prop percent:number = 1 | ||
| 13 | 14 | ||
| 14 | build() { | 15 | build() { |
| 15 | Column() { | 16 | Column() { |
| @@ -19,19 +20,19 @@ export struct SearchRelatedComponent { | @@ -19,19 +20,19 @@ export struct SearchRelatedComponent { | ||
| 19 | Column(){ | 20 | Column(){ |
| 20 | Row() { | 21 | Row() { |
| 21 | Image($r('app.media.search_related_item_icon')) | 22 | Image($r('app.media.search_related_item_icon')) |
| 22 | - .width('31lpx') | ||
| 23 | - .height('31lpx') | 23 | + .width(`${this.calcHeight(31)}lpx`) |
| 24 | + .height(`${this.calcHeight(31)}lpx`) | ||
| 24 | .objectFit(ImageFit.Auto) | 25 | .objectFit(ImageFit.Auto) |
| 25 | - .margin({ right: '10lpx' }) | 26 | + .margin({ right:`${this.calcHeight(10)}lpx` }) |
| 26 | .interpolation(ImageInterpolation.High) | 27 | .interpolation(ImageInterpolation.High) |
| 27 | 28 | ||
| 28 | Text(){ | 29 | Text(){ |
| 29 | ForEach(item.data_arr,(item:string)=>{ | 30 | ForEach(item.data_arr,(item:string)=>{ |
| 30 | Span(item) | 31 | Span(item) |
| 31 | .fontColor(item===this.searchText?$r('app.color.color_ED2800'):$r('app.color.color_000000')) | 32 | .fontColor(item===this.searchText?$r('app.color.color_ED2800'):$r('app.color.color_000000')) |
| 32 | - .fontSize('31lpx') | ||
| 33 | - .fontWeight('400lpx') | ||
| 34 | - .lineHeight('50lpx') | 33 | + .fontSize(`${this.calcHeight(31)}lpx`) |
| 34 | + .fontWeight(400) | ||
| 35 | + .lineHeight(`${this.calcHeight(50)}lpx`) | ||
| 35 | }) | 36 | }) |
| 36 | } | 37 | } |
| 37 | .maxLines(1) | 38 | .maxLines(1) |
| @@ -40,14 +41,14 @@ export struct SearchRelatedComponent { | @@ -40,14 +41,14 @@ export struct SearchRelatedComponent { | ||
| 40 | 41 | ||
| 41 | }.alignItems(VerticalAlign.Center) | 42 | }.alignItems(VerticalAlign.Center) |
| 42 | .justifyContent(FlexAlign.Start) | 43 | .justifyContent(FlexAlign.Start) |
| 43 | - .height('95lpx') | 44 | + .height(`${this.calcHeight(95)}lpx`) |
| 44 | 45 | ||
| 45 | if (index != this.relatedSearchContentData.length - 1) { | 46 | if (index != this.relatedSearchContentData.length - 1) { |
| 46 | Divider() | 47 | Divider() |
| 47 | .width('100%') | 48 | .width('100%') |
| 48 | - .height('1lpx') | 49 | + .height(`${this.calcHeight(1)}lpx`) |
| 49 | .color($r('app.color.color_F5F5F5')) | 50 | .color($r('app.color.color_F5F5F5')) |
| 50 | - .strokeWidth('1lpx') | 51 | + .strokeWidth(`${this.calcHeight(1)}lpx`) |
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| 53 | }.width('100%') | 54 | }.width('100%') |
| @@ -59,8 +60,11 @@ export struct SearchRelatedComponent { | @@ -59,8 +60,11 @@ export struct SearchRelatedComponent { | ||
| 59 | }) | 60 | }) |
| 60 | }.width('100%') | 61 | }.width('100%') |
| 61 | }.width('100%') | 62 | }.width('100%') |
| 62 | - .margin({ top: '8lpx' }) | ||
| 63 | - .padding({ left: '31lpx', right: '31lpx' }) | 63 | + .margin({ top: `${this.calcHeight(8)}lpx` }) |
| 64 | + .padding({ left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) | ||
| 64 | } | 65 | } |
| 65 | 66 | ||
| 67 | + calcHeight(value:number): number{ | ||
| 68 | + return value * this.percent | ||
| 69 | + } | ||
| 66 | } | 70 | } |
| @@ -28,6 +28,7 @@ export struct SearchResultComponent { | @@ -28,6 +28,7 @@ export struct SearchResultComponent { | ||
| 28 | scroller: Scroller = new Scroller() | 28 | scroller: Scroller = new Scroller() |
| 29 | onClickTryAgain?: () => void; | 29 | onClickTryAgain?: () => void; |
| 30 | @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | 30 | @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() |
| 31 | + @Prop percent:number = 1 | ||
| 31 | 32 | ||
| 32 | aboutToAppear(): void { | 33 | aboutToAppear(): void { |
| 33 | if (this.count.length === 0 && this.isGetRequest == true) { | 34 | if (this.count.length === 0 && this.isGetRequest == true) { |
| @@ -71,7 +72,7 @@ export struct SearchResultComponent { | @@ -71,7 +72,7 @@ export struct SearchResultComponent { | ||
| 71 | //缺省图 | 72 | //缺省图 |
| 72 | if(this.isConnectNetwork){ | 73 | if(this.isConnectNetwork){ |
| 73 | EmptyComponent({emptyType:4}) | 74 | EmptyComponent({emptyType:4}) |
| 74 | - .height('612lpx') | 75 | + .height(`${this.calcHeight(612)}lpx`) |
| 75 | .width('100%') | 76 | .width('100%') |
| 76 | }else{ | 77 | }else{ |
| 77 | EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | 78 | EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { |
| @@ -90,19 +91,19 @@ export struct SearchResultComponent { | @@ -90,19 +91,19 @@ export struct SearchResultComponent { | ||
| 90 | ListItem() { | 91 | ListItem() { |
| 91 | Row() { | 92 | Row() { |
| 92 | Image($r('app.media.search_suggest_icon')) | 93 | Image($r('app.media.search_suggest_icon')) |
| 93 | - .width('6lpx') | ||
| 94 | - .height('31lpx') | 94 | + .width(`${this.calcHeight(6)}lpx`) |
| 95 | + .height(`${this.calcHeight(31)}lpx`) | ||
| 95 | .objectFit(ImageFit.Cover) | 96 | .objectFit(ImageFit.Cover) |
| 96 | .interpolation(ImageInterpolation.High) | 97 | .interpolation(ImageInterpolation.High) |
| 97 | - .margin({ right: '10lpx' }) | 98 | + .margin({ right: `${this.calcHeight(10)}lpx` }) |
| 98 | Text("为你推荐") | 99 | Text("为你推荐") |
| 99 | .textAlign(TextAlign.Start) | 100 | .textAlign(TextAlign.Start) |
| 100 | .fontWeight(600) | 101 | .fontWeight(600) |
| 101 | - .fontSize('33lpx') | ||
| 102 | - .lineHeight('46lpx') | 102 | + .fontSize(`${this.calcHeight(33)}lpx`) |
| 103 | + .lineHeight(`${this.calcHeight(46)}lpx`) | ||
| 103 | .fontColor($r('app.color.color_222222')) | 104 | .fontColor($r('app.color.color_222222')) |
| 104 | - }.height('84lpx') | ||
| 105 | - .padding({ left: '31lpx', right: '31lpx' }) | 105 | + }.height(`${this.calcHeight(84)}lpx`) |
| 106 | + .padding({ left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) | ||
| 106 | .width('100%') | 107 | .width('100%') |
| 107 | .alignItems(VerticalAlign.Center) | 108 | .alignItems(VerticalAlign.Center) |
| 108 | } | 109 | } |
| @@ -115,9 +116,9 @@ export struct SearchResultComponent { | @@ -115,9 +116,9 @@ export struct SearchResultComponent { | ||
| 115 | if (index != this.data.totalCount() - 1) { | 116 | if (index != this.data.totalCount() - 1) { |
| 116 | Divider() | 117 | Divider() |
| 117 | .width('100%') | 118 | .width('100%') |
| 118 | - .height('1lpx') | 119 | + .height(`${this.calcHeight(1)}lpx`) |
| 119 | .color($r('app.color.color_F5F5F5')) | 120 | .color($r('app.color.color_F5F5F5')) |
| 120 | - .strokeWidth('1lpx') | 121 | + .strokeWidth(`${this.calcHeight(1)}lpx`) |
| 121 | } | 122 | } |
| 122 | } | 123 | } |
| 123 | } | 124 | } |
| @@ -144,7 +145,7 @@ export struct SearchResultComponent { | @@ -144,7 +145,7 @@ export struct SearchResultComponent { | ||
| 144 | .vertical(false) | 145 | .vertical(false) |
| 145 | .barMode(BarMode.Fixed) | 146 | .barMode(BarMode.Fixed) |
| 146 | .barWidth('100%') | 147 | .barWidth('100%') |
| 147 | - .barHeight('84lpx') | 148 | + .barHeight(`${this.calcHeight(84)}lpx`) |
| 148 | .animationDuration(0) | 149 | .animationDuration(0) |
| 149 | .width('100%') | 150 | .width('100%') |
| 150 | .scrollable(false) | 151 | .scrollable(false) |
| @@ -152,26 +153,26 @@ export struct SearchResultComponent { | @@ -152,26 +153,26 @@ export struct SearchResultComponent { | ||
| 152 | } | 153 | } |
| 153 | }.width('100%') | 154 | }.width('100%') |
| 154 | .layoutWeight(1) | 155 | .layoutWeight(1) |
| 155 | - .margin({ top: '12lpx' }) | 156 | + .margin({ top: `${this.calcHeight(12)}lpx` }) |
| 156 | } | 157 | } |
| 157 | 158 | ||
| 158 | @Builder | 159 | @Builder |
| 159 | TabBuilder(index: number, item: string) { | 160 | TabBuilder(index: number, item: string) { |
| 160 | Stack() { | 161 | Stack() { |
| 161 | Text(item) | 162 | Text(item) |
| 162 | - .height('38lpx') | ||
| 163 | - .fontSize('33lpx') | 163 | + .height(`${this.calcHeight(38)}lpx`) |
| 164 | + .fontSize(`${this.calcHeight(33)}lpx`) | ||
| 164 | .fontWeight(this.currentIndex === index ? 600 : 400) | 165 | .fontWeight(this.currentIndex === index ? 600 : 400) |
| 165 | .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) | 166 | .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) |
| 166 | - .lineHeight('38lpx') | 167 | + .lineHeight(`${this.calcHeight(38)}lpx`) |
| 167 | 168 | ||
| 168 | if (this.currentIndex === index) { | 169 | if (this.currentIndex === index) { |
| 169 | Divider() | 170 | Divider() |
| 170 | - .width('31lpx') | ||
| 171 | - .height('4lpx') | 171 | + .width(`${this.calcHeight(31)}lpx`) |
| 172 | + .height(`${this.calcHeight(4)}lpx`) | ||
| 172 | .color('#ED2800') | 173 | .color('#ED2800') |
| 173 | - .strokeWidth('4lpx') | ||
| 174 | - .margin({ top: '50lpx' }) | 174 | + .strokeWidth(`${this.calcHeight(4)}lpx`) |
| 175 | + .margin({ top: `${this.calcHeight(50)}lpx` }) | ||
| 175 | .id("divTag") | 176 | .id("divTag") |
| 176 | } | 177 | } |
| 177 | }.onClick(() => { | 178 | }.onClick(() => { |
| @@ -179,7 +180,11 @@ export struct SearchResultComponent { | @@ -179,7 +180,11 @@ export struct SearchResultComponent { | ||
| 179 | this.controller.changeIndex(this.currentIndex) | 180 | this.controller.changeIndex(this.currentIndex) |
| 180 | }) | 181 | }) |
| 181 | .height('100%') | 182 | .height('100%') |
| 182 | - .margin({ right: '9lpx' }) | ||
| 183 | - .padding({ left: '31lpx', right: index === this.count.length - 1 ? "31lpx" : "0lpx" }) | 183 | + .margin({ right: `${this.calcHeight(9)}lpx` }) |
| 184 | + .padding({ left: `${this.calcHeight(31)}lpx`, right: index === this.count.length - 1 ? `${this.calcHeight(31)}lpx` : "0lpx" }) | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + calcHeight(value:number): number{ | ||
| 188 | + return value * this.percent | ||
| 184 | } | 189 | } |
| 185 | } | 190 | } |
| @@ -157,6 +157,10 @@ | @@ -157,6 +157,10 @@ | ||
| 157 | "value": "#0D000000" | 157 | "value": "#0D000000" |
| 158 | }, | 158 | }, |
| 159 | { | 159 | { |
| 160 | + "name": "color_B3000000", | ||
| 161 | + "value": "#B3000000" | ||
| 162 | + }, | ||
| 163 | + { | ||
| 160 | "name": "res_color_general_000000_30", | 164 | "name": "res_color_general_000000_30", |
| 161 | "value": "#4D000000" | 165 | "value": "#4D000000" |
| 162 | } | 166 | } |
-
Please register or login to post a comment