Showing
3 changed files
with
119 additions
and
15 deletions
| @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO'; | @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO'; | ||
| 10 | 10 | ||
| 11 | @Observed | 11 | @Observed |
| 12 | export class ContentDTO implements BaseDTO { | 12 | export class ContentDTO implements BaseDTO { |
| 13 | + shareFlag?:string='0'; | ||
| 13 | appStyle: string = ''; | 14 | appStyle: string = ''; |
| 14 | cityCode: string = ''; | 15 | cityCode: string = ''; |
| 15 | coverSize: string = ''; | 16 | coverSize: string = ''; |
| @@ -34,6 +34,7 @@ export struct CarderInteraction { | @@ -34,6 +34,7 @@ export struct CarderInteraction { | ||
| 34 | 34 | ||
| 35 | build() { | 35 | build() { |
| 36 | Row() { | 36 | Row() { |
| 37 | + if(this.contentDTO.shareFlag === '1'){ | ||
| 37 | Row() { | 38 | Row() { |
| 38 | Image($r('app.media.CarderInteraction_share')) | 39 | Image($r('app.media.CarderInteraction_share')) |
| 39 | .width(18) | 40 | .width(18) |
| @@ -47,6 +48,8 @@ export struct CarderInteraction { | @@ -47,6 +48,8 @@ export struct CarderInteraction { | ||
| 47 | .onClick(() => { | 48 | .onClick(() => { |
| 48 | WDShare.shareContent(this.contentDetailData) | 49 | WDShare.shareContent(this.contentDetailData) |
| 49 | }) | 50 | }) |
| 51 | + } | ||
| 52 | + | ||
| 50 | 53 | ||
| 51 | Row() { | 54 | Row() { |
| 52 | Image($r('app.media.CarderInteraction_comment')) | 55 | Image($r('app.media.CarderInteraction_comment')) |
| @@ -66,11 +69,11 @@ export struct CarderInteraction { | @@ -66,11 +69,11 @@ export struct CarderInteraction { | ||
| 66 | } | 69 | } |
| 67 | .width('100%') | 70 | .width('100%') |
| 68 | .margin({ top: 11 }) | 71 | .margin({ top: 11 }) |
| 69 | - .padding({ | ||
| 70 | - left: 21, | ||
| 71 | - right: 21 | ||
| 72 | - }) | ||
| 73 | - .justifyContent(FlexAlign.SpaceBetween) | 72 | + // .padding({ |
| 73 | + // left: 21, | ||
| 74 | + // right: 21 | ||
| 75 | + // }) | ||
| 76 | + .justifyContent(FlexAlign.SpaceAround) | ||
| 74 | .alignItems(VerticalAlign.Center) | 77 | .alignItems(VerticalAlign.Center) |
| 75 | } | 78 | } |
| 76 | 79 |
| @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | @@ -14,6 +14,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 14 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 14 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 15 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 15 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 16 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' | 16 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' |
| 17 | +import { CreatorDetailResponseItem } from '../../viewmodel/CreatorDetailResponseItem'; | ||
| 17 | import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' | 18 | import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' |
| 18 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' | 19 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' |
| 19 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' | 20 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' |
| @@ -62,6 +63,7 @@ export struct SearchResultContentComponent { | @@ -62,6 +63,7 @@ export struct SearchResultContentComponent { | ||
| 62 | if (this.hasMore) { | 63 | if (this.hasMore) { |
| 63 | SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords, | 64 | SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords, |
| 64 | getContext(this)).then((value) => { | 65 | getContext(this)).then((value) => { |
| 66 | + | ||
| 65 | if (!this.data || value.list.length == 0) { | 67 | if (!this.data || value.list.length == 0) { |
| 66 | this.hasMore = false | 68 | this.hasMore = false |
| 67 | this.isLoading = false | 69 | this.isLoading = false |
| @@ -69,7 +71,6 @@ export struct SearchResultContentComponent { | @@ -69,7 +71,6 @@ export struct SearchResultContentComponent { | ||
| 69 | } else { | 71 | } else { |
| 70 | if (value.list[0].dataList != null) { | 72 | if (value.list[0].dataList != null) { |
| 71 | let data_temp: SearchRmhDescription[] = [] | 73 | let data_temp: SearchRmhDescription[] = [] |
| 72 | - | ||
| 73 | data_temp = value.list[0].dataList | 74 | data_temp = value.list[0].dataList |
| 74 | 75 | ||
| 75 | //TODO 查询创作者详情接口 | 76 | //TODO 查询创作者详情接口 |
| @@ -118,7 +119,6 @@ export struct SearchResultContentComponent { | @@ -118,7 +119,6 @@ export struct SearchResultContentComponent { | ||
| 118 | data_temp.forEach((data) => { | 119 | data_temp.forEach((data) => { |
| 119 | this.data_rmh.push(data) | 120 | this.data_rmh.push(data) |
| 120 | }) | 121 | }) |
| 121 | - | ||
| 122 | //只有一条创作者,获取 创作者信息 | 122 | //只有一条创作者,获取 创作者信息 |
| 123 | if (this.data_rmh.length === 1) { | 123 | if (this.data_rmh.length === 1) { |
| 124 | if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){ | 124 | if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){ |
| @@ -175,21 +175,34 @@ export struct SearchResultContentComponent { | @@ -175,21 +175,34 @@ export struct SearchResultContentComponent { | ||
| 175 | } | 175 | } |
| 176 | }) | 176 | }) |
| 177 | }) | 177 | }) |
| 178 | + // 批量号主信息 | ||
| 179 | + let creatorIdList: string[] = [] | ||
| 180 | + resultData.list.forEach((value:SearchResultContentItem) => { | ||
| 181 | + creatorIdList.push(value.data.creatorId) | ||
| 182 | + }) | ||
| 183 | + SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => { | ||
| 184 | + | ||
| 178 | 185 | ||
| 179 | resultData.list.forEach((value) => { | 186 | resultData.list.forEach((value) => { |
| 180 | let photos: FullColumnImgUrlDTO[] = [] | 187 | let photos: FullColumnImgUrlDTO[] = [] |
| 181 | - if (value.data.appStyle === 4) { | 188 | + // if (value.data.appStyle === 4) { |
| 182 | value.data.appStyleImages.split("&&").forEach((value) => { | 189 | value.data.appStyleImages.split("&&").forEach((value) => { |
| 183 | - photos.push({ url: value } as FullColumnImgUrlDTO) | 190 | + const resizeParams = this.extractResizeParams(value) |
| 191 | + photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO) | ||
| 184 | }) | 192 | }) |
| 185 | - } | ||
| 186 | - | ||
| 187 | - let contentDTO = this.dataTransform(value, photos); | 193 | + // } |
| 194 | + let contentDTO = this.dataTransform(rem,value, photos); | ||
| 188 | if(value.data.type != "13"){ | 195 | if(value.data.type != "13"){ |
| 189 | this.data.push(contentDTO) | 196 | this.data.push(contentDTO) |
| 190 | } | 197 | } |
| 198 | + }) | ||
| 199 | + | ||
| 191 | 200 | ||
| 201 | + }).catch((err: Error) => { | ||
| 202 | + console.log(TAG, JSON.stringify(err)) | ||
| 192 | }) | 203 | }) |
| 204 | + | ||
| 205 | + | ||
| 193 | this.data.notifyDataReload() | 206 | this.data.notifyDataReload() |
| 194 | this.count = this.data.totalCount() | 207 | this.count = this.data.totalCount() |
| 195 | if (this.data.totalCount() < resultData.totalCount) { | 208 | if (this.data.totalCount() < resultData.totalCount) { |
| @@ -377,7 +390,10 @@ export struct SearchResultContentComponent { | @@ -377,7 +390,10 @@ export struct SearchResultContentComponent { | ||
| 377 | .strokeWidth('12lpx') | 390 | .strokeWidth('12lpx') |
| 378 | } | 391 | } |
| 379 | 392 | ||
| 380 | - private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { | 393 | + private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { |
| 394 | + let rmhInfo = this.getRmhInfo(rem,value) | ||
| 395 | + console.log('获取photos',JSON.stringify(photos)) | ||
| 396 | + console.log('获取value2',JSON.stringify(value)) | ||
| 381 | let contentDTO = new ContentDTO(); | 397 | let contentDTO = new ContentDTO(); |
| 382 | contentDTO.appStyle = value.data.appStyle + "" | 398 | contentDTO.appStyle = value.data.appStyle + "" |
| 383 | contentDTO.cityCode = value.data.cityCode | 399 | contentDTO.cityCode = value.data.cityCode |
| @@ -453,8 +469,92 @@ export struct SearchResultContentComponent { | @@ -453,8 +469,92 @@ export struct SearchResultContentComponent { | ||
| 453 | contentDTO.openType = ''; | 469 | contentDTO.openType = ''; |
| 454 | contentDTO.extra = ''; | 470 | contentDTO.extra = ''; |
| 455 | contentDTO.titleShow = value.data.type == "5" ? 1 : 0; | 471 | contentDTO.titleShow = value.data.type == "5" ? 1 : 0; |
| 456 | - contentDTO.contentText = value.data.contentText; | ||
| 457 | - | 472 | + contentDTO.rmhInfo = rmhInfo |
| 473 | + contentDTO.shareFlag = value.data.shareFlag | ||
| 458 | return contentDTO; | 474 | return contentDTO; |
| 475 | + | ||
| 476 | + | ||
| 477 | + | ||
| 478 | + } | ||
| 479 | + // 搜索数据转化rmhInfo | ||
| 480 | + private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){ | ||
| 481 | + let obj = value.data | ||
| 482 | + let rmhInfo:RmhInfoDTO = { | ||
| 483 | + rmhHeadUrl:obj.headerPhotoUrl, | ||
| 484 | + rmhName:obj.creatorName, | ||
| 485 | + rmhId:obj.creatorId, | ||
| 486 | + authIcon:obj.authIcon, | ||
| 487 | + authTitle: obj.authTitle, | ||
| 488 | + authTitle2: '', | ||
| 489 | + banControl: 0, | ||
| 490 | + cnIsAttention: 0, | ||
| 491 | + cnAttention: 0, | ||
| 492 | + cnlsComment: 0, | ||
| 493 | + cnlsLike: 0, | ||
| 494 | + cnMainControl: 0, | ||
| 495 | + cnShareControl: 0, | ||
| 496 | + cnIsComment: 0, | ||
| 497 | + cnIsLike:0, | ||
| 498 | + posterShareControl: 0, | ||
| 499 | + rmhDesc: obj.introduction, | ||
| 500 | + userId: obj.userId, | ||
| 501 | + userType: obj.userType, | ||
| 502 | + honoraryIcon:'' | ||
| 503 | + } | ||
| 504 | + if(rem.length>0){ | ||
| 505 | + rem.forEach(item=>{ | ||
| 506 | + if(item.creatorId === obj.creatorId){ | ||
| 507 | + rmhInfo = { | ||
| 508 | + rmhHeadUrl:item.headPhotoUrl, | ||
| 509 | + rmhName:item.userName, | ||
| 510 | + rmhId:item.creatorId, | ||
| 511 | + authIcon:item.authIcon, | ||
| 512 | + authTitle: item.authTitle, | ||
| 513 | + authTitle2: '', | ||
| 514 | + banControl: 0, | ||
| 515 | + cnIsAttention:item.isAttention, | ||
| 516 | + cnAttention: 0, | ||
| 517 | + cnlsComment: 0, | ||
| 518 | + cnlsLike: 0, | ||
| 519 | + cnMainControl: 0, | ||
| 520 | + cnShareControl: 0, | ||
| 521 | + cnIsComment: 0, | ||
| 522 | + cnIsLike:0, | ||
| 523 | + posterShareControl: 0, | ||
| 524 | + rmhDesc: item.introduction, | ||
| 525 | + userId: item.userId, | ||
| 526 | + userType: item.userType, | ||
| 527 | + honoraryIcon:'' | ||
| 528 | + } | ||
| 529 | + } | ||
| 530 | + }) | ||
| 459 | } | 531 | } |
| 532 | + return rmhInfo | ||
| 533 | + } | ||
| 534 | + private extractResizeParams(url: string) { | ||
| 535 | + const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450 | ||
| 536 | + const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800 | ||
| 537 | + const heightMatch = url.match(heightRegex); | ||
| 538 | + const widthMatch = url.match(widthRegex); | ||
| 539 | + let height = heightMatch ? `h_${heightMatch[1]}` : undefined | ||
| 540 | + let width = widthMatch ? `w_${widthMatch[1]}` : undefined | ||
| 541 | + let h:number =0 | ||
| 542 | + let w:number =0 | ||
| 543 | + if(height){ | ||
| 544 | + h = Number(height.split('_')[1]) | ||
| 545 | + } | ||
| 546 | + if(width){ | ||
| 547 | + w = Number(width.split('_')[1]) | ||
| 548 | + } | ||
| 549 | + interface Obj{ | ||
| 550 | + width:number; | ||
| 551 | + height:number | ||
| 552 | + } | ||
| 553 | + let obj:Obj = { | ||
| 554 | + width:w, | ||
| 555 | + height:h | ||
| 556 | + } | ||
| 557 | + return obj | ||
| 558 | + } | ||
| 559 | + | ||
| 460 | } | 560 | } |
-
Please register or login to post a comment