yanlu

fix: bug_279-bug_280人民号没有IP归属地的时候未能隐藏显示

@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
18 "wdRouter": "file:../../commons/wdRouter", 18 "wdRouter": "file:../../commons/wdRouter",
19 "wdNetwork": "file:../../commons/wdNetwork", 19 "wdNetwork": "file:../../commons/wdNetwork",
20 "wdJsBridge": "file:../../commons/wdJsBridge", 20 "wdJsBridge": "file:../../commons/wdJsBridge",
21 - "wdDetailPlayApi":"file:../../features/wdDetailPlayApi" 21 + "wdDetailPlayApi":"file:../../features/wdDetailPlayApi",
  22 + "wdHwAbility": "file:../../features/wdHwAbility"
22 } 23 }
23 } 24 }
@@ -24,7 +24,7 @@ export struct PeopleShipHomeListComponent { @@ -24,7 +24,7 @@ export struct PeopleShipHomeListComponent {
24 // 列表 24 // 列表
25 else if (this.publishCount == 0) { 25 else if (this.publishCount == 0) {
26 // 无数据展示 26 // 无数据展示
27 - EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight) 27 + EmptyComponent({emptyType: 13}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
28 } else { 28 } else {
29 Column() { 29 Column() {
30 Column() { 30 Column() {
@@ -46,6 +46,7 @@ export struct PeopleShipHomeListComponent { @@ -46,6 +46,7 @@ export struct PeopleShipHomeListComponent {
46 .alignItems(VerticalAlign.Bottom) 46 .alignItems(VerticalAlign.Bottom)
47 .width('100%') 47 .width('100%')
48 } 48 }
  49 + .height('44vp')
49 .alignItems(HorizontalAlign.Start) 50 .alignItems(HorizontalAlign.Start)
50 .width('100%') 51 .width('100%')
51 52
@@ -109,8 +110,8 @@ export struct PeopleShipHomeListComponent { @@ -109,8 +110,8 @@ export struct PeopleShipHomeListComponent {
109 .justifyContent(FlexAlign.Center) 110 .justifyContent(FlexAlign.Center)
110 .constraintSize({ minWidth: 35 }) 111 .constraintSize({ minWidth: 35 })
111 .margin({ 112 .margin({
112 - left: '16vp',  
113 - right: '16vp' 113 + left: index == 0 ? '16vp' : '10vp',
  114 + right: index == this.tabArr.length - 1 ? '16vp' : '10vp'
114 }) 115 })
115 .height('44vp') 116 .height('44vp')
116 .onClick(() => { 117 .onClick(() => {
@@ -6,6 +6,7 @@ import { Logger } from 'wdKit' @@ -6,6 +6,7 @@ import { Logger } from 'wdKit'
6 import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' 6 import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
7 import { InfluenceData, PeopleShipUserDetailData } from 'wdBean' 7 import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
8 import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent' 8 import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
  9 +import { HWLocationUtils } from 'wdHwAbility'
9 10
10 11
11 @Component 12 @Component
@@ -29,6 +30,7 @@ export struct PeopleShipHomePageTopComponent { @@ -29,6 +30,7 @@ export struct PeopleShipHomePageTopComponent {
29 @State topFixedHeight: number = 320 30 @State topFixedHeight: number = 320
30 @State lineInNum: number = 1 31 @State lineInNum: number = 1
31 @Link topHeight: number 32 @Link topHeight: number
  33 + @State provinceName: string = ''
32 build() { 34 build() {
33 Column() { 35 Column() {
34 Stack({ alignContent: Alignment.TopStart}) { 36 Stack({ alignContent: Alignment.TopStart}) {
@@ -136,7 +138,6 @@ export struct PeopleShipHomePageTopComponent { @@ -136,7 +138,6 @@ export struct PeopleShipHomePageTopComponent {
136 .margin({ 138 .margin({
137 left: '16vp', 139 left: '16vp',
138 right: '16vp', 140 right: '16vp',
139 - bottom: '10vp'  
140 }) 141 })
141 }.width('100%') 142 }.width('100%')
142 .alignItems(VerticalAlign.Top) 143 .alignItems(VerticalAlign.Top)
@@ -151,24 +152,26 @@ export struct PeopleShipHomePageTopComponent { @@ -151,24 +152,26 @@ export struct PeopleShipHomePageTopComponent {
151 .margin({ 152 .margin({
152 left: '16vp', 153 left: '16vp',
153 right: '16vp', 154 right: '16vp',
154 - bottom: '10vp'  
155 }) 155 })
156 }.width('100%') 156 }.width('100%')
157 .alignItems(VerticalAlign.Top) 157 .alignItems(VerticalAlign.Top)
158 } 158 }
159 159
160 // IP归属地 160 // IP归属地
161 - Text(`IP归属地:${this.detailModel.region}`)  
162 - .lineHeight('18vp')  
163 - .fontSize($r('app.float.vp_12'))  
164 - .fontColor($r('app.color.color_999999'))  
165 - .textAlign(TextAlign.Start)  
166 - .width('100%')  
167 - .alignSelf(ItemAlign.Start)  
168 - .margin({  
169 - right: '16vp',  
170 - left: '16vp',  
171 - }) 161 + if (this.provinceName && this.provinceName.length > 0) {
  162 + Text(`IP归属地:${this.provinceName}`)
  163 + .lineHeight('18vp')
  164 + .fontSize($r('app.float.vp_12'))
  165 + .fontColor($r('app.color.color_999999'))
  166 + .textAlign(TextAlign.Start)
  167 + .width('100%')
  168 + .alignSelf(ItemAlign.Start)
  169 + .margin({
  170 + right: '16vp',
  171 + left: '16vp',
  172 + top: '10vp'
  173 + })
  174 + }
172 175
173 // 发布, 粉丝, 影响力 176 // 发布, 粉丝, 影响力
174 Row() { 177 Row() {
@@ -294,8 +297,9 @@ export struct PeopleShipHomePageTopComponent { @@ -294,8 +297,9 @@ export struct PeopleShipHomePageTopComponent {
294 }) 297 })
295 } 298 }
296 299
297 - onIntroductionUpdated() {  
298 - if (this.content.length == 0 && this.detailModel.introduction ) { 300 + async onIntroductionUpdated() {
  301 +
  302 + if (this.content.length == 0 && this.detailModel.introduction ) {
299 this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) 303 this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
300 if (this.lineInNum > 3) { 304 if (this.lineInNum > 3) {
301 this.compIntroductionTextHeights() 305 this.compIntroductionTextHeights()
@@ -303,7 +307,12 @@ export struct PeopleShipHomePageTopComponent { @@ -303,7 +307,12 @@ export struct PeopleShipHomePageTopComponent {
303 } 307 }
304 } 308 }
305 if (this.detailModel) { 309 if (this.detailModel) {
306 - this.topFixedHeight = 336 310 + this.topFixedHeight = 308
  311 + if (this.detailModel.region && this.detailModel.region.length > 0) {
  312 + this.provinceName = this.detailModel.region
  313 + }else {
  314 + this.provinceName = await this.computeIPRegion(this.detailModel.province)
  315 + }
307 if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { 316 if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
308 this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 317 this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
309 } 318 }
@@ -325,6 +334,10 @@ export struct PeopleShipHomePageTopComponent { @@ -325,6 +334,10 @@ export struct PeopleShipHomePageTopComponent {
325 }else { 334 }else {
326 this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum ) 335 this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
327 } 336 }
  337 + // IP归属地
  338 + if (this.provinceName && this.provinceName.length > 0) {
  339 + this.topHeight += 28
  340 + }
328 } 341 }
329 } 342 }
330 343
@@ -335,4 +348,17 @@ export struct PeopleShipHomePageTopComponent { @@ -335,4 +348,17 @@ export struct PeopleShipHomePageTopComponent {
335 return `${count}` 348 return `${count}`
336 } 349 }
337 350
  351 + // 通过省份code获取IP问题
  352 + private async computeIPRegion(province: string) {
  353 + if (province && province.length) {
  354 + try {
  355 + let provinceName = await HWLocationUtils.getProvinceName(province) ;
  356 + return provinceName
  357 + } catch (e) {
  358 + return ''
  359 + }
  360 + }
  361 + return ''
  362 + }
  363 +
338 } 364 }
@@ -52,6 +52,10 @@ @@ -52,6 +52,10 @@
52 { 52 {
53 "name": "comp_advertisement", 53 "name": "comp_advertisement",
54 "value": "广告" 54 "value": "广告"
  55 + },
  56 + {
  57 + "name": "location_reason",
  58 + "value": " "
55 } 59 }
56 ] 60 ]
57 } 61 }
@@ -35,6 +35,10 @@ @@ -35,6 +35,10 @@
35 { 35 {
36 "name": "reason_read_write_media", 36 "name": "reason_read_write_media",
37 "value": "user_grant" 37 "value": "user_grant"
  38 + },
  39 + {
  40 + "name": "location_reason",
  41 + "value": " "
38 } 42 }
39 ] 43 ]
40 } 44 }
@@ -152,6 +152,22 @@ export class HWLocationUtils { @@ -152,6 +152,22 @@ export class HWLocationUtils {
152 } 152 }
153 return '' 153 return ''
154 } 154 }
  155 +
  156 + // 通过省份code获取省份名称
  157 + static async getProvinceName(provinceCode: string) {
  158 + let bean = await ResourcesUtils.getResourcesJson<ResponseDTO<Array<LocalData>>>(getContext(), 'areaList_data.json');
  159 + if (bean) {
  160 + if (bean.code == 0 && bean.data) {
  161 + for (let i = 0; i < bean.data.length; i++) {
  162 + if (bean.data[i].code == provinceCode) {
  163 + return bean.data[i].label
  164 + }
  165 + }
  166 + }
  167 + }
  168 + return ''
  169 + }
  170 +
155 } 171 }
156 172
157 interface LocalData { 173 interface LocalData {