Showing
3 changed files
with
62 additions
and
56 deletions
| 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' | 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' |
| 2 | import { RmhRecommendDTO } from 'wdBean'; | 2 | import { RmhRecommendDTO } from 'wdBean'; |
| 3 | +import { ProcessUtils } from 'wdRouter'; | ||
| 3 | 4 | ||
| 4 | @Component | 5 | @Component |
| 5 | export struct PeopleShipRecommendComponent { | 6 | export struct PeopleShipRecommendComponent { |
| @@ -63,10 +64,13 @@ export struct PeopleShipRecommendComponent { | @@ -63,10 +64,13 @@ export struct PeopleShipRecommendComponent { | ||
| 63 | ForEach(this.rmhList, (item: RmhRecommendDTO) => { | 64 | ForEach(this.rmhList, (item: RmhRecommendDTO) => { |
| 64 | GridItem() { | 65 | GridItem() { |
| 65 | PeopleShipRecommendHeadComponent({ | 66 | PeopleShipRecommendHeadComponent({ |
| 66 | - rmhInfo: item | 67 | + rmhInfo: item, |
| 68 | + clickCallback:()=>{ | ||
| 69 | + this.clickRecommendHeadSelected(item) | ||
| 70 | + } | ||
| 67 | }) | 71 | }) |
| 68 | .onClick(() => { | 72 | .onClick(() => { |
| 69 | - this.clickRecommendHeadSelected(item) | 73 | + ProcessUtils.gotoPeopleShipHomePage(item.creatorId,1,1,item.userId,item.userType) |
| 70 | }) | 74 | }) |
| 71 | } | 75 | } |
| 72 | }, (item: RmhRecommendDTO) => item.creatorId) | 76 | }, (item: RmhRecommendDTO) => item.creatorId) |
| @@ -6,7 +6,8 @@ export struct PeopleShipRecommendHeadComponent { | @@ -6,7 +6,8 @@ export struct PeopleShipRecommendHeadComponent { | ||
| 6 | @State isSelected: boolean = true | 6 | @State isSelected: boolean = true |
| 7 | @Consume rmhSelectedList: string[] | 7 | @Consume rmhSelectedList: string[] |
| 8 | @State rmhInfo: RmhRecommendDTO = {} as RmhRecommendDTO | 8 | @State rmhInfo: RmhRecommendDTO = {} as RmhRecommendDTO |
| 9 | - | 9 | + clickCallback: () => void = () => { |
| 10 | + } | ||
| 10 | build() { | 11 | build() { |
| 11 | Column(){ | 12 | Column(){ |
| 12 | Stack({ alignContent: Alignment.BottomEnd }) { | 13 | Stack({ alignContent: Alignment.BottomEnd }) { |
| @@ -27,7 +28,9 @@ export struct PeopleShipRecommendHeadComponent { | @@ -27,7 +28,9 @@ export struct PeopleShipRecommendHeadComponent { | ||
| 27 | .objectFit(ImageFit.Cover) | 28 | .objectFit(ImageFit.Cover) |
| 28 | .margin({ | 29 | .margin({ |
| 29 | right: '-3vp' | 30 | right: '-3vp' |
| 30 | - }) | 31 | + }).onClick(()=>{ |
| 32 | + this.clickCallback() | ||
| 33 | + }) | ||
| 31 | }.margin({ top: 4, bottom: 8 }) | 34 | }.margin({ top: 4, bottom: 8 }) |
| 32 | 35 | ||
| 33 | Row() { | 36 | Row() { |
| @@ -28,7 +28,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -28,7 +28,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 28 | @State collapseTxt: string = '…展开'; | 28 | @State collapseTxt: string = '…展开'; |
| 29 | private subTxt: string = ''; | 29 | private subTxt: string = ''; |
| 30 | @State content: string = '' | 30 | @State content: string = '' |
| 31 | - @State topFixedHeight: number = 190 | 31 | + @State topFixedHeight: number = 195 |
| 32 | @State lineInNum: number = 1 | 32 | @State lineInNum: number = 1 |
| 33 | @Link topHeight: number | 33 | @Link topHeight: number |
| 34 | @State provinceName: string = '' | 34 | @State provinceName: string = '' |
| @@ -36,14 +36,6 @@ export struct PeopleShipHomePageTopComponent { | @@ -36,14 +36,6 @@ export struct PeopleShipHomePageTopComponent { | ||
| 36 | build() { | 36 | build() { |
| 37 | Column() { | 37 | Column() { |
| 38 | Stack({ alignContent: Alignment.TopStart }) { | 38 | Stack({ alignContent: Alignment.TopStart }) { |
| 39 | - // 顶部图片 | ||
| 40 | - // Image($r('app.media.home_page_bg')) | ||
| 41 | - // .width('100%') | ||
| 42 | - // .height(120) | ||
| 43 | - // .objectFit(ImageFit.Auto) | ||
| 44 | - // .objectRepeat(ImageRepeat.NoRepeat) | ||
| 45 | - // .objectFit(ImageFit.Auto) | ||
| 46 | - // .backgroundColor(Color.White) | ||
| 47 | // 头像和名称 | 39 | // 头像和名称 |
| 48 | Row() { | 40 | Row() { |
| 49 | // 头像 | 41 | // 头像 |
| @@ -262,6 +254,11 @@ export struct PeopleShipHomePageTopComponent { | @@ -262,6 +254,11 @@ export struct PeopleShipHomePageTopComponent { | ||
| 262 | .backgroundColor($r('app.color.color_F5F5F5')) | 254 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 263 | .width('100%') | 255 | .width('100%') |
| 264 | .height('6vp') | 256 | .height('6vp') |
| 257 | + ///计算顶部视图高度 | ||
| 258 | + .onAreaChange((oldArea: Area, newArea: Area) => { | ||
| 259 | + this.topHeight = Number(newArea.position.y)+6 | ||
| 260 | + this.topFixedHeight = Number(newArea.position.y)+6 | ||
| 261 | + }) | ||
| 265 | } | 262 | } |
| 266 | .width('100%') | 263 | .width('100%') |
| 267 | .backgroundColor($r('app.color.color_transparent')) | 264 | .backgroundColor($r('app.color.color_transparent')) |
| @@ -322,49 +319,51 @@ export struct PeopleShipHomePageTopComponent { | @@ -322,49 +319,51 @@ export struct PeopleShipHomePageTopComponent { | ||
| 322 | this.content = this.subTxt | 319 | this.content = this.subTxt |
| 323 | } | 320 | } |
| 324 | } | 321 | } |
| 325 | - if (this.detailModel) { | ||
| 326 | - this.topFixedHeight = 190 | ||
| 327 | - if (this.detailModel.region && this.detailModel.region.length > 0) { | ||
| 328 | - this.provinceName = this.detailModel.region | ||
| 329 | - } else { | ||
| 330 | - this.provinceName = await this.computeIPRegion(this.detailModel.province) | ||
| 331 | - } | ||
| 332 | - if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { | ||
| 333 | - this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 334 | - this.topFixedHeight += 12 | ||
| 335 | - } | ||
| 336 | - else if (this.detailModel.authId == 2) { | ||
| 337 | - if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) { | ||
| 338 | - this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 339 | - if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0){ | ||
| 340 | - this.topFixedHeight += 8 | ||
| 341 | - }else{ | ||
| 342 | - this.topFixedHeight += 12 | ||
| 343 | - } | ||
| 344 | - } | ||
| 345 | - if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) { | ||
| 346 | - this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 347 | - this.topFixedHeight += 12 | ||
| 348 | - } | ||
| 349 | - } | ||
| 350 | - | ||
| 351 | - // IP归属地 | ||
| 352 | - if (this.provinceName && this.provinceName.length > 0) { | ||
| 353 | - this.topFixedHeight += 28 | ||
| 354 | - this.topHeight = this.topFixedHeight | ||
| 355 | - } | ||
| 356 | - | ||
| 357 | - // 简介 | ||
| 358 | - if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) { | ||
| 359 | - this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 360 | - if (this.lineInNum <= 3) { | ||
| 361 | - this.topHeight = this.topFixedHeight + (21 * this.lineInNum) | ||
| 362 | - } else { | ||
| 363 | - this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 364 | - this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum) | ||
| 365 | - } | ||
| 366 | - } | ||
| 367 | - } | 322 | + // if (this.detailModel) { |
| 323 | + // this.topFixedHeight = 160 | ||
| 324 | + // if (this.detailModel.region && this.detailModel.region.length > 0) { | ||
| 325 | + // this.provinceName = this.detailModel.region | ||
| 326 | + // } else { | ||
| 327 | + // this.provinceName = await this.computeIPRegion(this.detailModel.province) | ||
| 328 | + // } | ||
| 329 | + // if (this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { | ||
| 330 | + // this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 331 | + // this.topFixedHeight += 12 | ||
| 332 | + // } else if (this.detailModel.authId == 2) { | ||
| 333 | + // if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0) { | ||
| 334 | + // this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 335 | + // if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0){ | ||
| 336 | + // this.topFixedHeight += 8 | ||
| 337 | + // }else{ | ||
| 338 | + // this.topFixedHeight += 12 | ||
| 339 | + // } | ||
| 340 | + // } | ||
| 341 | + // if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0) { | ||
| 342 | + // this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12')) * 18 | ||
| 343 | + // this.topFixedHeight += 12 | ||
| 344 | + // } | ||
| 345 | + // }else { | ||
| 346 | + // this.topFixedHeight += 10 | ||
| 347 | + // } | ||
| 348 | + // | ||
| 349 | + // // IP归属地 | ||
| 350 | + // if (this.provinceName && this.provinceName.length > 0) { | ||
| 351 | + // this.topFixedHeight += 30 | ||
| 352 | + // } | ||
| 353 | + // | ||
| 354 | + // // 简介 | ||
| 355 | + // if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) { | ||
| 356 | + // this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 357 | + // if (this.lineInNum <= 3) { | ||
| 358 | + // this.topHeight = this.topFixedHeight + (21 * this.lineInNum) | ||
| 359 | + // } else { | ||
| 360 | + // this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 361 | + // this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum) | ||
| 362 | + // } | ||
| 363 | + // } | ||
| 364 | + // | ||
| 365 | + // this.topHeight = this.topFixedHeight | ||
| 366 | + // } | ||
| 368 | } | 367 | } |
| 369 | 368 | ||
| 370 | private computeShowNum(count: number) { | 369 | private computeShowNum(count: number) { |
-
Please register or login to post a comment