yangchenggong1_wd

fix |> 搜索-热门搜索 布局单位 lpx 改成 vp

@@ -171,7 +171,6 @@ export struct SearchComponent { @@ -171,7 +171,6 @@ export struct SearchComponent {
171 171
172 SearchHotsComponent({ 172 SearchHotsComponent({
173 onGetSearchRes: (item): void => this.getSearchHotResData(item), 173 onGetSearchRes: (item): void => this.getSearchHotResData(item),
174 - percent: this.percent  
175 }) 174 })
176 } 175 }
177 } 176 }
@@ -179,7 +178,7 @@ export struct SearchComponent { @@ -179,7 +178,7 @@ export struct SearchComponent {
179 .scrollBar(BarState.Off) 178 .scrollBar(BarState.Off)
180 .width('100%') 179 .width('100%')
181 .height('100%') 180 .height('100%')
182 - .padding({ left: `${this.calcHeight(31)}lpx`, right: `${this.calcHeight(31)}lpx` }) 181 + .padding({ left: 16, right: 16 })
183 } else { 182 } else {
184 if (this.hasChooseSearch) { 183 if (this.hasChooseSearch) {
185 //搜索结果 184 //搜索结果
@@ -10,7 +10,6 @@ const TAG = "SearchHotsComponent" @@ -10,7 +10,6 @@ const TAG = "SearchHotsComponent"
10 export struct SearchHotsComponent{ 10 export struct SearchHotsComponent{
11 @State searchHotsData:SearchHotContentItem[] = [] 11 @State searchHotsData:SearchHotContentItem[] = []
12 onGetSearchRes?: (item:string) => void; 12 onGetSearchRes?: (item:string) => void;
13 - @Prop percent:number = 1  
14 13
15 aboutToAppear(){ 14 aboutToAppear(){
16 //获取搜索热词 15 //获取搜索热词
@@ -35,22 +34,21 @@ export struct SearchHotsComponent{ @@ -35,22 +34,21 @@ export struct SearchHotsComponent{
35 if(this.searchHotsData.length>0){ 34 if(this.searchHotsData.length>0){
36 Row() { 35 Row() {
37 Image($r('app.media.search_hot_icon')) 36 Image($r('app.media.search_hot_icon'))
38 - .width(`${this.calcHeight(46)}lpx`)  
39 - .height(`${this.calcHeight(46)}lpx`) 37 + .width(24)
  38 + .height(24)
40 .objectFit(ImageFit.Auto) 39 .objectFit(ImageFit.Auto)
41 - .margin({right:`${this.calcHeight(8)}lpx`}) 40 + .margin({right:4})
42 .interpolation(ImageInterpolation.Medium) 41 .interpolation(ImageInterpolation.Medium)
43 42
44 Text("热门搜索") 43 Text("热门搜索")
45 .textAlign(TextAlign.Center) 44 .textAlign(TextAlign.Center)
46 .fontWeight(FontWeight.Bold) 45 .fontWeight(FontWeight.Bold)
47 - .fontSize(`${this.calcHeight(33)}lpx`)  
48 - .lineHeight(`${this.calcHeight(46)}lpx`) 46 + .fontSize(17)
49 .fontColor($r('app.color.color_222222')) 47 .fontColor($r('app.color.color_222222'))
50 - .height(`${this.calcHeight(46)}lpx`) 48 + .height(24)
51 } 49 }
52 .width('100%') 50 .width('100%')
53 - .margin({bottom:`${this.calcHeight(15)}lpx`}) 51 + .margin({bottom:8})
54 } 52 }
55 53
56 List(){ 54 List(){
@@ -61,49 +59,47 @@ export struct SearchHotsComponent{ @@ -61,49 +59,47 @@ export struct SearchHotsComponent{
61 Row(){ 59 Row(){
62 if(item.sequence <=3){ 60 if(item.sequence <=3){
63 Image(item.sequence===1?$r('app.media.search_hot_num1'):item.sequence===2?$r('app.media.search_hot_num2'):$r('app.media.search_hot_num3')) 61 Image(item.sequence===1?$r('app.media.search_hot_num1'):item.sequence===2?$r('app.media.search_hot_num2'):$r('app.media.search_hot_num3'))
64 - .width(`${this.calcHeight(27)}lpx`)  
65 - .height(`${this.calcHeight(35)}lpx`) 62 + .width(14)
  63 + .height(18)
66 .objectFit(ImageFit.Auto) 64 .objectFit(ImageFit.Auto)
67 - .margin({right:`${this.calcHeight(12)}lpx`}) 65 + .margin({right:6})
68 .interpolation(ImageInterpolation.High) 66 .interpolation(ImageInterpolation.High)
69 }else { 67 }else {
70 Text(`${item.sequence}`) 68 Text(`${item.sequence}`)
71 - .height(`${this.calcHeight(31)}lpx`) 69 + .height(16)
72 .fontColor($r('app.color.color_666666')) 70 .fontColor($r('app.color.color_666666'))
73 - .fontSize(`${this.calcHeight(27)}lpx`) 71 + .fontSize(14)
74 .fontWeight(FontWeight.Regular) 72 .fontWeight(FontWeight.Regular)
75 - .lineHeight(`${this.calcHeight(31)}lpx`)  
76 - .margin({right:`${this.calcHeight(12)}lpx`}) 73 + .margin({right:6})
77 } 74 }
78 Text(`${item.hotEntry}`) 75 Text(`${item.hotEntry}`)
79 .textOverflow({ overflow: TextOverflow.Ellipsis }) 76 .textOverflow({ overflow: TextOverflow.Ellipsis })
80 .fontColor($r('app.color.color_222222')) 77 .fontColor($r('app.color.color_222222'))
81 - .fontSize(`${this.calcHeight(31)}lpx`) 78 + .fontSize(16)
82 .maxLines(1) 79 .maxLines(1)
83 .fontWeight(FontWeight.Regular) 80 .fontWeight(FontWeight.Regular)
84 - .lineHeight(`${this.calcHeight(42)}lpx`)  
85 }.layoutWeight(1) 81 }.layoutWeight(1)
86 82
87 if(item.mark===1 || item.mark===2){ 83 if(item.mark===1 || item.mark===2){
88 Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2')) 84 Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2'))
89 - .width(`${this.calcHeight(42)}lpx`)  
90 - .height(`${this.calcHeight(31)}lpx`) 85 + .width(22)
  86 + .height(16)
91 .objectFit(ImageFit.Auto) 87 .objectFit(ImageFit.Auto)
92 .interpolation(ImageInterpolation.High) 88 .interpolation(ImageInterpolation.High)
93 } 89 }
94 }.alignItems(VerticalAlign.Center) 90 }.alignItems(VerticalAlign.Center)
95 - .height(`${this.calcHeight(84)}lpx`) 91 + .height(44)
96 .width('100%') 92 .width('100%')
97 .justifyContent(FlexAlign.SpaceBetween) 93 .justifyContent(FlexAlign.SpaceBetween)
98 94
99 if(index != this.searchHotsData.length-1 ){ 95 if(index != this.searchHotsData.length-1 ){
100 Divider() 96 Divider()
101 .width('100%') 97 .width('100%')
102 - .height(`${this.calcHeight(1)}lpx`) 98 + .height(1)
103 .color($r('app.color.color_F5F5F5')) 99 .color($r('app.color.color_F5F5F5'))
104 - .strokeWidth(`${this.calcHeight(1)}lpx`) 100 + .strokeWidth(1)
105 } 101 }
106 - }.height(`${this.calcHeight(85)}lpx`) 102 + }.height(45)
107 .width('100%') 103 .width('100%')
108 .alignItems(HorizontalAlign.Start) 104 .alignItems(HorizontalAlign.Start)
109 } 105 }
@@ -118,10 +114,7 @@ export struct SearchHotsComponent{ @@ -118,10 +114,7 @@ export struct SearchHotsComponent{
118 }).layoutWeight(1) 114 }).layoutWeight(1)
119 }.width('100%') 115 }.width('100%')
120 .height('100%') 116 .height('100%')
121 - .margin({top:`${this.calcHeight(46)}lpx`}) 117 + .margin({top:24})
122 } 118 }
123 119
124 - calcHeight(value:number): number{  
125 - return value * this.percent  
126 - }  
127 } 120 }