Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
陈剑华
2024-05-06 15:26:17 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
20ca71ba7022d3f350a2a71ac8b6c3f4c4dd90b0
20ca71ba
2 parents
ed3bbc1d
b8a91399
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
234 additions
and
117 deletions
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListHeadComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListTopComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeAttentionComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeListComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeNavComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageAttestationComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageTopComponent.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/people_ship_top_add.png
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomComponent.ets
View file @
20ca71b
...
...
@@ -324,6 +324,27 @@ export struct HomePageBottomComponent{
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item)=>{
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data.forEach((list)=>{
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
View file @
20ca71b
...
...
@@ -139,6 +139,27 @@ export struct OtherHomePageBottomCommentComponent {
data.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, commentContent, item.likeNum, 0, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, parentCommentContent, parentCommentUserName))
})
if(status.commentIdList.length === 0){
data.forEach((item) => {
this.data_comment.push(new CommentListItem(item.fromUserHeader, item.fromUserName, item.targetTitle, item.createTime, item.commentContent, item.likeNum, item.like_status, item.id, item.targetId, item.targetType, item.targetRelId, item.targetRelObjectId, item.targetRelType, item.targetStatus, item.checkStatus, item.parentCommentContent, item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
this.isGetRequest = true
return
}
MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
data.forEach((list) => {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListHeadComponent.ets
View file @
20ca71b
...
...
@@ -3,31 +3,29 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
@Component
export struct PeopleShipAttentionContentListHeadComponent {
@State index: number = 0
@ObjectLink item: FollowListDetailItem
build() {
Column(){
Column()
{
// 头像
PeopleShipHomePageHeadComponent({
diameter: 48,
iconDiameter: 16,
headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') :
((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')),
authIcon: this.index == 0 ? '' : this.item.authIcon
headPhotoUrl: (this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ?
this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'),
authIcon: this.item.authIcon
}).margin({
bottom: '8vp'
})
Text(this.i
ndex == 0 ? '我的关注' : this.i
tem.attentionUserName)
Text(this.item.attentionUserName)
.fontColor($r('app.color.color_666666'))
.fontSize($r('app.float.vp_13'))
.fontWeight(400)
.height('18vp')
.lineHeight('18vp')
.maxLines(1)
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.padding({
left: '2vp',
right: '2vp'
...
...
@@ -36,7 +34,7 @@ export struct PeopleShipAttentionContentListHeadComponent {
.alignItems(HorizontalAlign.Center)
.width('78vp')
.margin({
left:
this.index == 0 ? '8vp' :
'4vp',
left: '4vp',
top: '14vp',
bottom: '14vp'
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipAttentionContentListTopComponent.ets
View file @
20ca71b
...
...
@@ -6,37 +6,72 @@ import { PeopleShipAttentionContentListHeadComponent } from './PeopleShipAttenti
@Component
export struct PeopleShipAttentionContentListTopComponent {
@Prop followList: FollowListDetailItem[]
build() {
Column() {
List(){
List()
{
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: 0,
item: this.followList[0]
})
this.PeopleShipFollowTop()
}.onClick(() => {
// 跳转到关注列表-我的
WDRouterRule.jumpWithPage(WDRouterPage.followListPage)
})
ForEach(this.followList, (item: FollowListDetailItem
, index: number
) => {
ForEach(this.followList, (item: FollowListDetailItem) => {
ListItem() {
PeopleShipAttentionContentListHeadComponent({
index: index + 1,
item: item
})
}.onClick(() => {
let creatorId = item.attentionCreatorId || ''
ProcessUtils.gotoPeopleShipHomePage(creatorId)
})
}, (item: FollowListDetailItem
) => item.attentionCreatorId
)
}, (item: FollowListDetailItem
, index: number) => item.attentionCreatorId + index
)
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height('102vp')
Divider().strokeWidth(1).color($r('app.color.color_F5F5F5'))
}
}
@Builder
PeopleShipFollowTop() {
Column() {
// 头像
Image($r('app.media.attention_mine'))
.alt($r('app.media.attention_mine'))
.width(48)
.height(48)
.borderRadius(24)
.objectFit(ImageFit.ScaleDown)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({
bottom: '8vp'
})
Text('我的关注')
.fontColor($r('app.color.color_666666'))
.fontSize($r('app.float.vp_13'))
.fontWeight(400)
.height('18vp')
.lineHeight('18vp')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '2vp',
right: '2vp'
})
}
.alignItems(HorizontalAlign.Center)
.width('78vp')
.margin({
left: '8vp',
top: '14vp',
bottom: '14vp'
})
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeAttentionComponent.ets
View file @
20ca71b
...
...
@@ -18,7 +18,14 @@ export struct PeopleShipHomeAttentionComponent {
.height(20)
.color($r('app.color.color_fff'))
}else {
Text('+ 关注')
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('16vp')
.height('16pv')
.margin({
right: '4vp'
})
Text('关注')
.fontColor(Color.White)
.fontSize($r('app.float.vp_14'))
.fontWeight(500)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeListComponent.ets
View file @
20ca71b
...
...
@@ -38,14 +38,17 @@ export struct PeopleShipHomeListComponent {
}
.justifyContent(FlexAlign.Start)
}
.backgroundColor(Color.White)
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
}
.backgroundColor(Color.White)
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.justifyContent(FlexAlign.Start)
.height('44vp')
.alignItems(HorizontalAlign.Start)
.width('100%')
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeNavComponent.ets
View file @
20ca71b
...
...
@@ -62,7 +62,25 @@ export struct PeopleShipHomePageNavComponent {
if (this.isAttention == '0') {
// 关注
Button('+ 关注', { type: ButtonType.Normal, stateEffect: true })
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row(){
Image($r('app.media.people_ship_top_add'))
.objectFit(ImageFit.Auto)
.width('12vp')
.height('12pv')
.margin({
right: '2vp'
})
Text('关注')
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
}
.alignSelf(ItemAlign.Center)
.justifyContent(FlexAlign.Center)
.width('100%')
.height('100%')
}
.borderRadius(4)
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
...
...
@@ -77,8 +95,6 @@ export struct PeopleShipHomePageNavComponent {
left: '12vp',
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
} else {
Button('已关注', { type: ButtonType.Normal, stateEffect: true })
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageAttestationComponent.ets
View file @
20ca71b
...
...
@@ -5,7 +5,7 @@ export struct PeopleShipHomePageAttestationComponent {
build() {
Row() {
Text(this.name)
.lineHeight('1
6
vp')
.lineHeight('1
8
vp')
.fontColor($r('app.color.color_ED2800'))
.fontSize($r('app.float.vp_11'))
.backgroundColor($r('app.color.color_1AED2800'))
...
...
@@ -16,21 +16,27 @@ export struct PeopleShipHomePageAttestationComponent {
left: '16vp',
})
.padding({
top: '3vp',
bottom: '3vp',
right: '6vp',
left: '6vp'
top: '1vp',
bottom: '1vp',
right: '4vp',
left: '4vp'
})
Text(this.content)
.lineHeight('
22
vp')
.lineHeight('
18
vp')
.fontSize($r('app.float.vp_12'))
.layoutWeight(1)
.fontColor($r('app.color.color_222222'))
.textAlign(TextAlign.Start)
.align(Alignment.Center)
.padding(0)
.margin({
right: '16vp'
})
.padding({
top: '1vp',
bottom: '1vp',
})
}
.width('100%')
.alignItems(VerticalAlign.Top)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageTopComponent.ets
View file @
20ca71b
...
...
@@ -2,7 +2,7 @@ import measure from '@ohos.measure'
import { DisplayUtils } from 'wdKit'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent'
import
{ Logger } from 'wdKit'
import { Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
...
...
@@ -28,36 +28,37 @@ export struct PeopleShipHomePageTopComponent {
@State collapseTxt: string = '…展开';
private subTxt: string = '';
@State content: string = ''
@State topFixedHeight: number =
320
@State topFixedHeight: number =
286
@State lineInNum: number = 1
@Link topHeight: number
@State provinceName: string = ''
build() {
Column() {
Stack({ alignContent: Alignment.TopStart
}) {
Stack({ alignContent: Alignment.TopStart
}) {
// 顶部图片
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.backgroundColor(Color.
Black
)
.backgroundColor(Color.
White
)
// 头像和名称
Row() {
// 头像
PeopleShipHomePageHeadComponent({
diameter: 80,
iconDiameter: 20,
headPhotoUrl:
(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')
,
headPhotoUrl:
(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')
,
authIcon: this.detailModel.authIcon
}).margin({
left: '10vp',
bottom: '20vp'
}).onClick(()
=>
{
}).onClick(()
=>
{
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,
params)
})
...
...
@@ -68,7 +69,7 @@ export struct PeopleShipHomePageTopComponent {
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.textAlign(TextAlign.Start)
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.maxLines(2)
.layoutWeight(1)
.margin({
...
...
@@ -85,82 +86,89 @@ export struct PeopleShipHomePageTopComponent {
.width('100%')
.height('180vp')
.backgroundColor(Color.Transparent)
// 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证
// 官方认证
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({name: '官方认证', content: this.detailModel.categoryAuth})
if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '官方认证', content: this.detailModel.categoryAuth})
.margin({
top: '
1
0vp',
top: '0vp',
bottom: '10vp'
})
}
if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '领域认证', content: this.detailModel.authTitle})
.margin({
top: '10vp',
bottom: '10vp'
})
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '身份认证', content: this.detailModel.authPersonal})
if (this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '领域认证', content: this.detailModel.authTitle })
.margin({
top: '10vp',
top: '0vp',
bottom: (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) ? '6vp' : '10vp'
})
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) {
PeopleShipHomePageAttestationComponent({ name: '身份认证', content: this.detailModel.authPersonal })
.margin({
top: '0vp',
bottom: '10vp'
})
}
}
// 简介
if(this.lineInNum > 3) {
if
(this.lineInNum > 3) {
Row() {
Text() {
Span(this.content)
.fontColor($r('app.color.color_222222'))
Span(this.collapseTxt)
.onClick(()=>{
if(this.isCollapse){
.onClick(() => {
if (this.isCollapse) {
this.maxLines = Infinity;
this.content = `简介:${this.detailModel.introduction}`
this.isCollapse = false;
this.collapseTxt = '收起';
this.topHeight = this.topFixedHeight + 21 * this.lineInNum
}
else
{
}
else
{
this.isCollapse = true;
this.collapseTxt = '…展开';
this.content = this.subTxt;
this.topHeight =
this.topFixedHeight + 21 * 3
this.topHeight = this.topFixedHeight + 21 * 3
}
})
.fontColor($r('app.color.color_B0B0B0'))
}
.backgroundColor(Color.Transparent)
.lineHeight('21vp')
.width('100%')
.maxLines(this.maxLines)
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.textOverflow({
overflow: TextOverflow.Ellipsis
})
.fontSize($r('app.float.vp_14'))
.key('home_page_introduction')
.margin({
.padding({
left: '16vp',
right: '16vp',
})
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}
else
{
}
else
{
Row() {
Text(`简介:${this.detailModel.introduction}`)
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.lineHeight('21vp')
.maxLines(3)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({
left: '16vp',
right: '16vp',
})
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.lineHeight('21vp')
.width('100%')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '16vp',
right: '16vp',
})
.backgroundColor(Color.Transparent)
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}
...
...
@@ -171,7 +179,6 @@ export struct PeopleShipHomePageTopComponent {
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
...
...
@@ -254,7 +261,8 @@ export struct PeopleShipHomePageTopComponent {
.height('6vp')
}
.width('100%')
.height('100%')
// .height('100%')
}
async aboutToAppear() {
...
...
@@ -272,17 +280,15 @@ export struct PeopleShipHomePageTopComponent {
}
// 不听减去2个字-一直到时3行
private compIntroductionTextHeights() {
let introduction = `简介:${this.detailModel.introduction}`
let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
while (lineInNum1 > 3 ) {
let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
while (lineInNum1 > 3) {
introduction = introduction.substring(0, introduction.length - 2);
lineInNum1 = this.getTextLineNum(introduction
,
DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
lineInNum1 = this.getTextLineNum(introduction
+ this.collapseTxt,
DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
}
introduction = introduction.substring(0, introduction.length - 3);
//
introduction = introduction.substring(0, introduction.length - 3);
Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`)
this.subTxt = introduction;
...
...
@@ -292,7 +298,7 @@ export struct PeopleShipHomePageTopComponent {
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
let height: number = Number(size.height)
return Math.ceil(px2vp(height)
/
lineHeight)
return Math.ceil(px2vp(height)
/
lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
...
...
@@ -306,51 +312,56 @@ export struct PeopleShipHomePageTopComponent {
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.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()
this.content = this.subTxt
}
}
if (this.detailModel) {
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
}
else if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += 10
}
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
}
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topFixedHeight += (21 * this.lineInNum)
this.topHeight = this.topFixedHeight
}else {
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
}
// IP归属地
if (this.provinceName && this.provinceName.length > 0) {
this.topHeight += 28
}
}
if (this.detailModel) {
this.topFixedHeight = 286
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')) * 18
this.topFixedHeight += 12
}
else if (this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0){
this.topFixedHeight += 8
}else{
this.topFixedHeight += 12
}
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18
this.topFixedHeight += 12
}
}
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topHeight = this.topFixedHeight + (21 * this.lineInNum)
} else {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum)
}
// IP归属地
if (this.provinceName && this.provinceName.length > 0) {
this.topFixedHeight += 28
this.topHeight += 28
}
}
}
private computeShowNum(count: number) {
if(count >= 10000) {
return `${(count/10000).toFixed(1)}万`
private computeShowNum(count: number) {
if (count >= 10000) {
return `${(count / 10000).toFixed(1)}万`
}
return `${count}`
}
...
...
@@ -359,7 +370,7 @@ export struct PeopleShipHomePageTopComponent {
private async computeIPRegion(province: string) {
if (province && province.length) {
try {
let provinceName = await HWLocationUtils.getProvinceName(province)
;
let provinceName = await HWLocationUtils.getProvinceName(province);
return provinceName
} catch (e) {
return ''
...
...
@@ -367,5 +378,4 @@ export struct PeopleShipHomePageTopComponent {
}
return ''
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/people_ship_top_add.png
0 → 100644
View file @
20ca71b
221 Bytes
Please
register
or
login
to post a comment