yanlu

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

... ... @@ -18,6 +18,7 @@
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork",
"wdJsBridge": "file:../../commons/wdJsBridge",
"wdDetailPlayApi":"file:../../features/wdDetailPlayApi"
"wdDetailPlayApi":"file:../../features/wdDetailPlayApi",
"wdHwAbility": "file:../../features/wdHwAbility"
}
}
... ...
... ... @@ -24,7 +24,7 @@ export struct PeopleShipHomeListComponent {
// 列表
else if (this.publishCount == 0) {
// 无数据展示
EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight)
EmptyComponent({emptyType: 13}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
} else {
Column() {
Column() {
... ... @@ -46,6 +46,7 @@ export struct PeopleShipHomeListComponent {
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.height('44vp')
.alignItems(HorizontalAlign.Start)
.width('100%')
... ... @@ -109,8 +110,8 @@ export struct PeopleShipHomeListComponent {
.justifyContent(FlexAlign.Center)
.constraintSize({ minWidth: 35 })
.margin({
left: '16vp',
right: '16vp'
left: index == 0 ? '16vp' : '10vp',
right: index == this.tabArr.length - 1 ? '16vp' : '10vp'
})
.height('44vp')
.onClick(() => {
... ...
... ... @@ -6,6 +6,7 @@ import { Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
import { HWLocationUtils } from 'wdHwAbility'
@Component
... ... @@ -29,6 +30,7 @@ export struct PeopleShipHomePageTopComponent {
@State topFixedHeight: number = 320
@State lineInNum: number = 1
@Link topHeight: number
@State provinceName: string = ''
build() {
Column() {
Stack({ alignContent: Alignment.TopStart}) {
... ... @@ -136,7 +138,6 @@ export struct PeopleShipHomePageTopComponent {
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
... ... @@ -151,24 +152,26 @@ export struct PeopleShipHomePageTopComponent {
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
}
// IP归属地
Text(`IP归属地:${this.detailModel.region}`)
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
left: '16vp',
})
if (this.provinceName && this.provinceName.length > 0) {
Text(`IP归属地:${this.provinceName}`)
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
left: '16vp',
top: '10vp'
})
}
// 发布, 粉丝, 影响力
Row() {
... ... @@ -294,8 +297,9 @@ export struct PeopleShipHomePageTopComponent {
})
}
onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
async onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum > 3) {
this.compIntroductionTextHeights()
... ... @@ -303,7 +307,12 @@ export struct PeopleShipHomePageTopComponent {
}
}
if (this.detailModel) {
this.topFixedHeight = 336
this.topFixedHeight = 308
if (this.detailModel.region && this.detailModel.region.length > 0) {
this.provinceName = this.detailModel.region
}else {
this.provinceName = await this.computeIPRegion(this.detailModel.province)
}
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
... ... @@ -325,6 +334,10 @@ export struct PeopleShipHomePageTopComponent {
}else {
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
}
// IP归属地
if (this.provinceName && this.provinceName.length > 0) {
this.topHeight += 28
}
}
}
... ... @@ -335,4 +348,17 @@ export struct PeopleShipHomePageTopComponent {
return `${count}`
}
// 通过省份code获取IP问题
private async computeIPRegion(province: string) {
if (province && province.length) {
try {
let provinceName = await HWLocationUtils.getProvinceName(province) ;
return provinceName
} catch (e) {
return ''
}
}
return ''
}
}
\ No newline at end of file
... ...
... ... @@ -52,6 +52,10 @@
{
"name": "comp_advertisement",
"value": "广告"
},
{
"name": "location_reason",
"value": " "
}
]
}
\ No newline at end of file
... ...
... ... @@ -35,6 +35,10 @@
{
"name": "reason_read_write_media",
"value": "user_grant"
},
{
"name": "location_reason",
"value": " "
}
]
}
\ No newline at end of file
... ...
... ... @@ -152,6 +152,22 @@ export class HWLocationUtils {
}
return ''
}
// 通过省份code获取省份名称
static async getProvinceName(provinceCode: string) {
let bean = await ResourcesUtils.getResourcesJson<ResponseDTO<Array<LocalData>>>(getContext(), 'areaList_data.json');
if (bean) {
if (bean.code == 0 && bean.data) {
for (let i = 0; i < bean.data.length; i++) {
if (bean.data[i].code == provinceCode) {
return bean.data[i].label
}
}
}
}
return ''
}
}
interface LocalData {
... ...