yangchenggong1_wd

desc:搜索结果人民号展现

@@ -38,6 +38,15 @@ export default struct MinePagePersonFunctionUI { @@ -38,6 +38,15 @@ export default struct MinePagePersonFunctionUI {
38 }.onClick(()=>{ 38 }.onClick(()=>{
39 console.log(index+"") 39 console.log(index+"")
40 switch (item.msg){ 40 switch (item.msg){
  41 + case "评论":{
  42 + if(!this.isLogin){
  43 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  44 + return
  45 + }else {
  46 + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
  47 + }
  48 + break;
  49 + }
41 case "预约":{ 50 case "预约":{
42 if(!this.isLogin){ 51 if(!this.isLogin){
43 WDRouterRule.jumpWithPage(WDRouterPage.loginPage) 52 WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  1 +import { StringUtils } from 'wdKit/Index'
  2 +import { HttpUrlUtils } from 'wdNetwork/Index'
  3 +import MinePageDatasModel from '../../../model/MinePageDatasModel'
  4 +import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
  5 +import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'
  6 +
  7 +@Component
  8 +export struct FollowChildComponent{
  9 + @ObjectLink data: FollowListDetailItem
  10 + @State type:number = 0
  11 +
  12 + build() {
  13 + if(this.type == 0 ){
  14 + Column(){
  15 + Blank().height('27lpx')
  16 +
  17 + Row() {
  18 + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
  19 + .objectFit(ImageFit.Auto)
  20 + .width('92lpx')
  21 + .height('92lpx')
  22 + .margin({right:'15lpx'})
  23 +
  24 + Column(){
  25 + Text(this.data.cnUserName)
  26 + .fontWeight('400lpx')
  27 + .fontSize('31lpx')
  28 + .lineHeight('38lpx')
  29 + .fontColor($r('app.color.color_222222'))
  30 + .maxLines(1)
  31 + Text(`粉丝${this.data.cnFansNum}`)
  32 + .fontColor($r('app.color.color_B0B0B0'))
  33 + .fontSize('23lpx')
  34 + .maxLines(1)
  35 + Text(`${this.data.introduction}`)
  36 + .fontColor($r('app.color.color_B0B0B0'))
  37 + .fontSize('23lpx')
  38 + .maxLines(2)
  39 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  40 + }.layoutWeight(1)
  41 + .alignItems(HorizontalAlign.Start)
  42 +
  43 + if(this.data.status == "1"){
  44 + Row(){
  45 + Text(`已关注`)
  46 + .fontColor($r('app.color.color_CCCCCC'))
  47 + .fontSize('23lpx')
  48 + .fontWeight('500lpx')
  49 + .lineHeight('35lpx')
  50 + }.backgroundColor($r('app.color.color_F5F5F5'))
  51 + .borderRadius('6lpx')
  52 + .borderColor($r('app.color.color_F5F5F5'))
  53 + .borderWidth('2lpx')
  54 + .justifyContent(FlexAlign.Center)
  55 + .width('100lpx')
  56 + .height('46lpx')
  57 + .margin({left:'4lpx',top:'23lpx'})
  58 + .onClick(()=>{
  59 + this.followOperation()
  60 + // this.data.status = "0"
  61 + })
  62 + }else{
  63 + Row(){
  64 + Image($r('app.media.follow_icon'))
  65 + .margin({right:'4lpx'})
  66 + .width('23lpx')
  67 + .height('23lpx')
  68 + Text(`关注`)
  69 + .fontColor($r('app.color.color_ED2800'))
  70 + .fontSize('23lpx')
  71 + .fontWeight('500lpx')
  72 + .lineHeight('35lpx')
  73 + }.borderColor($r('app.color.color_1AED2800'))
  74 + .borderRadius('6lpx')
  75 + .borderWidth('2lpx')
  76 + .justifyContent(FlexAlign.Center)
  77 + .width('100lpx')
  78 + .height('46lpx')
  79 + .margin({left:'4lpx',top:'23lpx'})
  80 + .onClick(()=>{
  81 + this.followOperation()
  82 + // this.data.status = "1"
  83 + })
  84 + }
  85 + }.alignItems(VerticalAlign.Top)
  86 + .width('100%')
  87 + .layoutWeight(1)
  88 +
  89 + Divider().width('100%')
  90 + .height('2lpx')
  91 + .strokeWidth('1lpx')
  92 + .backgroundColor($r('app.color.color_EDEDED'))
  93 +
  94 + }.height('146lpx')
  95 + .justifyContent(FlexAlign.Center)
  96 + .onClick(()=>{
  97 + //跳转 人民号的 主页
  98 + })
  99 + }else if(this.type == 1 ){
  100 + Column(){
  101 + Column(){
  102 +
  103 + Row() {
  104 + Row(){
  105 + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
  106 + .objectFit(ImageFit.Auto)
  107 + .width('92lpx')
  108 + .height('92lpx')
  109 + .margin({right:'15lpx'})
  110 + .borderRadius(50)
  111 + .borderWidth('1lpx')
  112 + .borderColor($r('app.color.color_0D000000'))
  113 +
  114 + Column(){
  115 + Text(this.data.cnUserName)
  116 + .fontWeight('400lpx')
  117 + .fontSize('31lpx')
  118 + .lineHeight('38lpx')
  119 + .fontColor($r('app.color.color_222222'))
  120 + .maxLines(1)
  121 + .margin({bottom:'12lpx'})
  122 + Row(){
  123 + Text(`粉丝${this.data.cnFansNum}`)
  124 + .fontColor($r('app.color.color_B0B0B0'))
  125 + .fontSize('23lpx')
  126 +
  127 + Image($r("app.media.point"))
  128 + .width('31lpx')
  129 + .height('31lpx')
  130 + .objectFit(ImageFit.Auto)
  131 +
  132 + Text(`${this.data.introduction}`)
  133 + .fontColor($r('app.color.color_B0B0B0'))
  134 + .fontSize('23lpx')
  135 + .layoutWeight(1)
  136 + .maxLines(1)
  137 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  138 + }.width('100%')
  139 + }
  140 + .layoutWeight(1)
  141 + .alignItems(HorizontalAlign.Start)
  142 + }.layoutWeight(1)
  143 +
  144 + if(this.data.status == "1"){
  145 + Row(){
  146 + Text(`已关注`)
  147 + .fontColor($r('app.color.color_CCCCCC'))
  148 + .fontSize('23lpx')
  149 + .fontWeight('500lpx')
  150 + .lineHeight('35lpx')
  151 + }
  152 + .justifyContent(FlexAlign.Center)
  153 + .width('100lpx')
  154 + .height('46lpx')
  155 + .onClick(()=>{
  156 + this.followOperation()
  157 + })
  158 + }else{
  159 + Row(){
  160 + Image($r('app.media.follow_icon'))
  161 + .margin({right:'4lpx'})
  162 + .width('23lpx')
  163 + .height('23lpx')
  164 + Text(`关注`)
  165 + .fontColor($r('app.color.color_ED2800'))
  166 + .fontSize('23lpx')
  167 + .fontWeight('500lpx')
  168 + .lineHeight('35lpx')
  169 + }.borderColor($r('app.color.color_1AED2800'))
  170 + .borderRadius('6lpx')
  171 + .borderWidth('2lpx')
  172 + .justifyContent(FlexAlign.Center)
  173 + .width('100lpx')
  174 + .height('46lpx')
  175 + .onClick(()=>{
  176 + this.followOperation()
  177 + })
  178 + }
  179 + }
  180 + .width('100%')
  181 + .height('92lpx')
  182 + .justifyContent(FlexAlign.SpaceBetween)
  183 +
  184 + }.height('146lpx')
  185 + .justifyContent(FlexAlign.Center)
  186 + .onClick(()=>{
  187 + })
  188 +
  189 + Divider().width('100%')
  190 + .height('1lpx')
  191 + .strokeWidth('1lpx')
  192 + .backgroundColor($r('app.color.color_EDEDED'))
  193 + }.width('100%')
  194 +
  195 + }
  196 +
  197 + }
  198 +
  199 + followOperation(){
  200 + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)
  201 + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
  202 + if(value!=null){
  203 + if (value.code === 0 || value.code.toString() === "0") {
  204 + this.data.status = this.data.status ==="0"?"1":"0"
  205 + }
  206 + }
  207 + })
  208 + }
  209 +}
1 -import { Params } from 'wdBean';  
2 -import { LazyDataSource, StringUtils } from 'wdKit';  
3 -import { HttpUrlUtils } from 'wdNetwork';  
4 -import { WDRouterPage, WDRouterRule } from 'wdRouter'; 1 +import { LazyDataSource } from 'wdKit';
5 import MinePageDatasModel from '../../../model/MinePageDatasModel'; 2 import MinePageDatasModel from '../../../model/MinePageDatasModel';
6 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' 3 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
7 import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; 4 import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
8 import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem'; 5 import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem';
9 -import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem';  
10 import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem'; 6 import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem';
11 import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; 7 import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem';
12 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 8 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
  9 +import { FollowChildComponent } from './FollowChildComponent';
13 10
14 const TAG = "FollowListDetailUI" 11 const TAG = "FollowListDetailUI"
15 @Component 12 @Component
16 export struct FollowListDetailUI{ 13 export struct FollowListDetailUI{
17 @State creatorDirectoryId:number = -1; 14 @State creatorDirectoryId:number = -1;
  15 + @State type:number = 0
18 @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); 16 @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
19 @State count:number = 0; 17 @State count:number = 0;
20 @State isLoading:boolean = false 18 @State isLoading:boolean = false
@@ -22,7 +20,6 @@ export struct FollowListDetailUI{ @@ -22,7 +20,6 @@ export struct FollowListDetailUI{
22 curPageNum:number = 1; 20 curPageNum:number = 1;
23 21
24 aboutToAppear(){ 22 aboutToAppear(){
25 - console.log("YCG","aboutToAppear==="+this.creatorDirectoryId);  
26 this.getNewPageData() 23 this.getNewPageData()
27 } 24 }
28 25
@@ -35,7 +32,7 @@ export struct FollowListDetailUI{ @@ -35,7 +32,7 @@ export struct FollowListDetailUI{
35 List({ space: 3 }) { 32 List({ space: 3 }) {
36 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { 33 LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
37 ListItem() { 34 ListItem() {
38 - ChildComponent({data: item}) 35 + FollowChildComponent({data: item,type:this.type})
39 } 36 }
40 .onClick(() => { 37 .onClick(() => {
41 }) 38 })
@@ -76,7 +73,8 @@ export struct FollowListDetailUI{ @@ -76,7 +73,8 @@ export struct FollowListDetailUI{
76 this.hasMore = false 73 this.hasMore = false
77 }else{ 74 }else{
78 value.list.forEach((value)=>{ 75 value.list.forEach((value)=>{
79 - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) 76 +
  77 + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
80 }) 78 })
81 this.data.notifyDataReload() 79 this.data.notifyDataReload()
82 this.count = this.data.totalCount() 80 this.count = this.data.totalCount()
@@ -148,112 +146,4 @@ export struct FollowListDetailUI{ @@ -148,112 +146,4 @@ export struct FollowListDetailUI{
148 }) 146 })
149 } 147 }
150 148
151 -}  
152 -  
153 -@Component  
154 -struct ChildComponent {  
155 - @ObjectLink data: FollowListDetailItem  
156 -  
157 - build() {  
158 - Column(){  
159 - Blank().height('27lpx')  
160 -  
161 - Row() {  
162 - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)  
163 - .objectFit(ImageFit.Auto)  
164 - .width('92lpx')  
165 - .height('92lpx')  
166 - .margin({right:'15lpx'})  
167 -  
168 - Column(){  
169 - Text(this.data.cnUserName)  
170 - .fontWeight('400lpx')  
171 - .fontSize('31lpx')  
172 - .lineHeight('38lpx')  
173 - .fontColor($r('app.color.color_222222'))  
174 - .maxLines(1)  
175 - Text(`粉丝${this.data.cnFansNum}`)  
176 - .fontColor($r('app.color.color_B0B0B0'))  
177 - .fontSize('23lpx')  
178 - .maxLines(1)  
179 - Text(`${this.data.introduction}`)  
180 - .fontColor($r('app.color.color_B0B0B0'))  
181 - .fontSize('23lpx')  
182 - .maxLines(2)  
183 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
184 - }.layoutWeight(1)  
185 - .alignItems(HorizontalAlign.Start)  
186 -  
187 - if(this.data.status == "1"){  
188 - Row(){  
189 - Text(`已关注`)  
190 - .fontColor($r('app.color.color_CCCCCC'))  
191 - .fontSize('23lpx')  
192 - .fontWeight('500lpx')  
193 - .lineHeight('35lpx')  
194 - }.backgroundColor($r('app.color.color_F5F5F5'))  
195 - .borderRadius('6lpx')  
196 - .borderColor($r('app.color.color_F5F5F5'))  
197 - .borderWidth('2lpx')  
198 - .justifyContent(FlexAlign.Center)  
199 - .width('100lpx')  
200 - .height('46lpx')  
201 - .margin({left:'4lpx',top:'23lpx'})  
202 - .onClick(()=>{  
203 - this.followOperation()  
204 - // this.data.status = "0"  
205 - })  
206 - }else{  
207 - Row(){  
208 - Image($r('app.media.follow_icon'))  
209 - .margin({right:'4lpx'})  
210 - .width('23lpx')  
211 - .height('23lpx')  
212 - Text(`关注`)  
213 - .fontColor($r('app.color.color_ED2800'))  
214 - .fontSize('23lpx')  
215 - .fontWeight('500lpx')  
216 - .lineHeight('35lpx')  
217 - }.borderColor($r('app.color.color_1AED2800'))  
218 - .borderRadius('6lpx')  
219 - .borderWidth('2lpx')  
220 - .justifyContent(FlexAlign.Center)  
221 - .width('100lpx')  
222 - .height('46lpx')  
223 - .margin({left:'4lpx',top:'23lpx'})  
224 - .onClick(()=>{  
225 - this.followOperation()  
226 - // this.data.status = "1"  
227 - })  
228 - }  
229 - }.alignItems(VerticalAlign.Top)  
230 - .width('100%')  
231 - .layoutWeight(1)  
232 -  
233 - Divider().width('100%')  
234 - .height('2lpx')  
235 - .strokeWidth('1lpx')  
236 - .backgroundColor($r('app.color.color_EDEDED'))  
237 -  
238 - }.height('146lpx')  
239 - .justifyContent(FlexAlign.Center)  
240 - .onClick(()=>{  
241 - //跳转 人民号的 主页  
242 - // let params: Params = {  
243 - // pageID: this.data.attentionUserId  
244 - // }  
245 - // WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)  
246 - })  
247 - }  
248 -  
249 - followOperation(){  
250 - let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)  
251 - MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{  
252 - if(value!=null){  
253 - if (value.code === 0 || value.code.toString() === "0") {  
254 - this.data.status = this.data.status ==="0"?"1":"0"  
255 - }  
256 - }  
257 - })  
258 - }  
259 } 149 }
@@ -23,7 +23,8 @@ export struct FollowSecondTabsComponent{ @@ -23,7 +23,8 @@ export struct FollowSecondTabsComponent{
23 23
24 if(this.data != null){ 24 if(this.data != null){
25 if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){ 25 if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){
26 - FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id}).layoutWeight(1) 26 + FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id,type:1})
  27 + .layoutWeight(1)
27 }else{ 28 }else{
28 this.FollowSecondUI() 29 this.FollowSecondUI()
29 } 30 }
@@ -184,7 +184,7 @@ export struct HomePageBottomComponent{ @@ -184,7 +184,7 @@ export struct HomePageBottomComponent{
184 this.hasMore = false 184 this.hasMore = false
185 }else{ 185 }else{
186 value.list.forEach((value)=>{ 186 value.list.forEach((value)=>{
187 - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) 187 + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
188 }) 188 })
189 this.data_follow.notifyDataReload() 189 this.data_follow.notifyDataReload()
190 this.count = this.data_follow.totalCount() 190 this.count = this.data_follow.totalCount()
@@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{ @@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{
116 this.hasMore = false 116 this.hasMore = false
117 }else{ 117 }else{
118 value.list.forEach((value)=>{ 118 value.list.forEach((value)=>{
119 - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId)) 119 + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId))
120 }) 120 })
121 this.data_follow.notifyDataReload() 121 this.data_follow.notifyDataReload()
122 this.count = this.data_follow.totalCount() 122 this.count = this.data_follow.totalCount()
  1 +import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
  2 +
  3 +@Component
  4 +export struct SearchCreatorComponent{
  5 + @ObjectLink item: SearchRmhDescription
  6 +
  7 + build() {
  8 + Column(){
  9 + Image(this.item.headerPhotoUrl)
  10 + .width('92lpx')
  11 + .alt($r('app.media.default_head'))
  12 + .height('92lpx')
  13 + .margin({bottom:'15lpx'})
  14 + .borderRadius(50)
  15 + Text(this.item.creatorName)
  16 + .fontSize('25lpx')
  17 + .fontWeight('400lpx')
  18 + .lineHeight('35lpx')
  19 + .constraintSize({maxWidth:'150lpx'})
  20 + .maxLines(1)
  21 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  22 + }.alignItems(HorizontalAlign.Center)
  23 + .justifyContent(FlexAlign.Center)
  24 + }
  25 +}
1 import { ContentDTO, 1 import { ContentDTO,
2 contentListParams, 2 contentListParams,
3 - FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index' 3 + FullColumnImgUrlDTO, InteractDataDTO,
  4 + Params,
  5 + RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
4 import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' 6 import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
5 import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' 7 import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
6 -import { LazyDataSource, StringUtils, ToastUtils } from 'wdKit/Index' 8 +import { LazyDataSource, Logger, StringUtils, ToastUtils } from 'wdKit/Index'
7 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' 9 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
8 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' 10 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
9 import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' 11 import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
@@ -12,6 +14,7 @@ import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' @@ -12,6 +14,7 @@ import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
12 import { CardParser } from '../CardParser' 14 import { CardParser } from '../CardParser'
13 import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' 15 import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
14 import { ActivityItemComponent } from './ActivityItemComponent' 16 import { ActivityItemComponent } from './ActivityItemComponent'
  17 +import { SearchCreatorComponent } from './SearchCreatorComponent'
15 18
16 const TAG = "SearchResultContentComponent" 19 const TAG = "SearchResultContentComponent"
17 20
@@ -53,24 +56,30 @@ export struct SearchResultContentComponent{ @@ -53,24 +56,30 @@ export struct SearchResultContentComponent{
53 this.isLoading = false 56 this.isLoading = false
54 }else{ 57 }else{
55 if(value.list[0].dataList!=null){ 58 if(value.list[0].dataList!=null){
56 - this.data_rmh = value.list[0].dataList 59 + let data_temp: SearchRmhDescription[] = []
  60 + data_temp = value.list[0].dataList
  61 +
57 //TODO 查询创作者详情接口 62 //TODO 查询创作者详情接口
58 let request = new CreatorDetailRequestItem() 63 let request = new CreatorDetailRequestItem()
59 64
60 - this.data_rmh .forEach((data)=>{ 65 + data_temp.forEach((data)=>{
61 request.creatorIdList.push(data.creatorId) 66 request.creatorIdList.push(data.creatorId)
62 }) 67 })
63 68
64 SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{ 69 SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
65 if(value!=null && value.length>0){ 70 if(value!=null && value.length>0){
66 - this.data_rmh.forEach((data)=>{ 71 + data_temp.forEach((data)=>{
67 value.forEach((item)=>{ 72 value.forEach((item)=>{
68 if(data.creatorId == item.creatorId){ 73 if(data.creatorId == item.creatorId){
69 - data.headerPhotoUrl = item.headPhotoUrl 74 + data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
70 } 75 }
71 }) 76 })
72 }) 77 })
73 } 78 }
  79 + data_temp.forEach((data)=>{
  80 + this.data_rmh.push(data)
  81 + })
  82 +
74 }).catch((err:Error)=>{ 83 }).catch((err:Error)=>{
75 console.log(TAG,JSON.stringify(err)) 84 console.log(TAG,JSON.stringify(err))
76 }) 85 })
@@ -212,23 +221,7 @@ export struct SearchResultContentComponent{ @@ -212,23 +221,7 @@ export struct SearchResultContentComponent{
212 List({space:'8lpx'}) { 221 List({space:'8lpx'}) {
213 ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { 222 ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
214 ListItem() { 223 ListItem() {
215 - Column(){  
216 - Image(item.headerPhotoUrl)  
217 - .width('92lpx')  
218 - .alt($r('app.media.default_head'))  
219 - .height('92lpx')  
220 - .margin({bottom:'15lpx'})  
221 - .borderRadius(50)  
222 - Text(item.creatorName)  
223 - .fontSize('25lpx')  
224 - .fontWeight('400lpx')  
225 - .lineHeight('35lpx')  
226 - .constraintSize({maxWidth:'150lpx'})  
227 - .maxLines(1)  
228 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
229 - }.alignItems(HorizontalAlign.Center)  
230 - .justifyContent(FlexAlign.Center)  
231 - 224 + SearchCreatorComponent({item:item})
232 }.onClick(()=>{ 225 }.onClick(()=>{
233 //TODO 跳转 226 //TODO 跳转
234 }) 227 })
@@ -253,7 +246,10 @@ export struct SearchResultContentComponent{ @@ -253,7 +246,10 @@ export struct SearchResultContentComponent{
253 }.height('100%') 246 }.height('100%')
254 .margin({left:'23lpx'}) 247 .margin({left:'23lpx'})
255 .onClick(()=>{ 248 .onClick(()=>{
256 - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage) 249 + let params: Params = {
  250 + pageID: this.keywords
  251 + }
  252 + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
257 }) 253 })
258 } 254 }
259 .cachedCount(6) 255 .cachedCount(6)
  1 +import { Params } from 'wdBean/Index';
1 import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; 2 import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
  3 +import { router } from '@kit.ArkUI';
  4 +import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem';
  5 +import { LazyDataSource } from 'wdKit/Index';
  6 +import SearcherAboutDataModel from '../model/SearcherAboutDataModel';
  7 +import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
  8 +import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
  9 +import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem';
  10 +import MinePageDatasModel from '../model/MinePageDatasModel';
  11 +import { ListHasNoMoreDataUI } from '../components/reusable/ListHasNoMoreDataUI';
  12 +import { FollowChildComponent } from '../components/mine/follow/FollowChildComponent';
  13 +
  14 +const TAG = "SearchCreatorPage"
2 15
3 @Entry 16 @Entry
4 @Component 17 @Component
5 struct SearchCreatorPage { 18 struct SearchCreatorPage {
  19 + @State params: Params = router.getParams() as Params;
  20 + @State keyword: string = '';
  21 + @State searchType:string = ""
  22 + @State data_temp: FollowListDetailItem[] = []
  23 + @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
  24 + @State count: number = -1;
  25 + @State isLoading: boolean = false
  26 + @State hasMore: boolean = true
  27 + curPageNum: number = 1;
6 28
7 - build() {  
8 - Row() {  
9 - Column() {  
10 - CustomTitleUI({titleName:"全部结果"}) 29 + onPageShow() {
  30 + this.keyword = this.params?.pageID;
  31 + this.searchType = "onlyRmh"
  32 + this.getNewPageData()
  33 + }
  34 +
  35 + getNewPageData() {
  36 + this.isLoading = true
  37 + if (this.hasMore) {
  38 + SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keyword,getContext(this)).then((result)=>{
  39 + if (!this.data || result.list.length == 0){
  40 + this.hasMore = false
  41 + this.isLoading = false
  42 + }else{
  43 + result.list.forEach((data)=>{
  44 + this.data_temp.push(new FollowListDetailItem("",data.data.creatorName,"0","",data.data.id,"0",data.data.userId,data.data.userType,data.data.userId))
  45 + })
  46 +
  47 + let request = new CreatorDetailRequestItem()
  48 +
  49 + this.data_temp.forEach((data)=>{
  50 + request.creatorIdList.push(data.creatorId)
  51 + })
  52 +
  53 + SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
  54 + if(value!=null && value.length>0){
  55 + this.data_temp.forEach((data)=>{
  56 + value.forEach((item)=>{
  57 + if(data.creatorId == item.creatorId){
  58 + data.headPhotoUrl = item.headPhotoUrl
  59 + if(item.fansNum>10000){
  60 + let temp = (item.fansNum/10000)+""
  61 + let index = temp.indexOf('.')
  62 + if(index != -1){
  63 + temp = temp.substring(0,index+2)
  64 + }else{
  65 + temp = temp
  66 + }
  67 + data.cnFansNum = temp + "万"
  68 + }else{
  69 + data.cnFansNum = item.fansNum + ""
  70 + }
  71 + data.introduction = item.introduction
  72 + }
  73 + })
  74 + })
  75 + this.getFollowListStatus(result.totalCount)
  76 + }
  77 + }).catch((err:Error)=>{
  78 + console.log(TAG,JSON.stringify(err))
  79 + this.isLoading = false
  80 + this.count = this.count===-1?0:this.count
  81 + })
  82 + }
  83 + }).catch((err:Error)=>{
  84 + console.log(TAG,JSON.stringify(err))
  85 + this.isLoading = false
  86 + this.count = this.count===-1?0:this.count
  87 + })
  88 + }
  89 + }
  90 +
  91 + getFollowListStatus(totalCount:number){
  92 + let status = new FollowListStatusRequestItem()
  93 + this.data_temp.forEach((item)=>{
  94 + status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
  95 + })
11 96
  97 + MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{
  98 + newValue.forEach((item)=>{
  99 + this.data_temp.forEach((list)=>{
  100 + if (item.creatorId == list.creatorId) {
  101 + list.status = item.status
  102 + }
  103 + })
  104 + })
  105 +
  106 + this.data_temp.forEach((item)=>{
  107 + this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId))
  108 + })
  109 +
  110 + this.data.notifyDataReload()
  111 +
  112 + this.count = this.data.totalCount()
  113 + if (this.data.totalCount() < totalCount) {
  114 + this.curPageNum++
  115 + }else {
  116 + this.hasMore = false
12 } 117 }
  118 +
  119 + this.isLoading = false
  120 + }).catch((err:Error)=>{
  121 + console.log(TAG,"请求失败")
  122 + this.isLoading = false
  123 + this.count = this.count===-1?0:this.count
  124 + })
  125 + }
  126 +
  127 + build() {
  128 + Column() {
  129 + CustomTitleUI({ titleName: "全部结果" })
  130 + Divider()
  131 + .width('100%')
  132 + .height('1lpx')
  133 + .color($r('app.color.color_F5F5F5'))
  134 + .strokeWidth('1lpx')
  135 +
  136 + Column(){
  137 + if(this.count === 0){
  138 + ListHasNoMoreDataUI({style:2})
  139 + .height('100%')
  140 + }else{
  141 + List({ space: 3 }) {
  142 + LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
  143 + ListItem() {
  144 + FollowChildComponent({data: item,type:1})
  145 + }
  146 + .onClick(() => {
  147 + })
  148 + }, (item: FollowListDetailItem, index: number) => index.toString())
  149 +
  150 + //没有更多数据 显示提示
  151 + if(!this.hasMore){
  152 + ListItem(){
  153 + ListHasNoMoreDataUI()
  154 + }
  155 + }
  156 + }.cachedCount(10)
  157 + .padding({left:'31lpx',right:'31lpx'})
  158 + .layoutWeight(1)
  159 + .scrollBar(BarState.Off)
  160 + .onReachEnd(()=>{
  161 + console.log(TAG,"触底了");
  162 + if(!this.isLoading){
  163 + this.isLoading = true
  164 + //加载分页数据
  165 + this.getNewPageData()
  166 + }
  167 + })
  168 + }
  169 + }.layoutWeight(1)
13 .width('100%') 170 .width('100%')
14 } 171 }
  172 + .width('100%')
15 .height('100%') 173 .height('100%')
16 } 174 }
17 } 175 }
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 export class FollowListDetailItem{ 63 export class FollowListDetailItem{
64 headPhotoUrl:string //头像 64 headPhotoUrl:string //头像
65 cnUserName:string //昵称 65 cnUserName:string //昵称
66 - cnFansNum:number //粉丝数 66 + cnFansNum:string //粉丝数
67 introduction:string //介绍 67 introduction:string //介绍
68 status:string = "0" //是否已经关注 68 status:string = "0" //是否已经关注
69 creatorId:string = "" 69 creatorId:string = ""
@@ -80,7 +80,7 @@ export class FollowListDetailItem{ @@ -80,7 +80,7 @@ export class FollowListDetailItem{
80 fansNum :number = 0 80 fansNum :number = 0
81 81
82 82
83 - constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) { 83 + constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) {
84 this.headPhotoUrl = headPhotoUrl 84 this.headPhotoUrl = headPhotoUrl
85 this.cnUserName = cnUserName 85 this.cnUserName = cnUserName
86 this.cnFansNum = cnFansNum 86 this.cnFansNum = cnFansNum
@@ -181,6 +181,7 @@ class SearchDescription{ @@ -181,6 +181,7 @@ class SearchDescription{
181 181
182 } 182 }
183 183
  184 +@Observed
184 export class SearchRmhDescription{ 185 export class SearchRmhDescription{
185 likeEnable: string= "" 186 likeEnable: string= ""
186 previewUri: string= "" 187 previewUri: string= ""
@@ -147,6 +147,10 @@ @@ -147,6 +147,10 @@
147 { 147 {
148 "name": "color_9E9E9E", 148 "name": "color_9E9E9E",
149 "value": "#9E9E9E" 149 "value": "#9E9E9E"
  150 + },
  151 + {
  152 + "name": "color_0D000000",
  153 + "value": "#0D000000"
150 } 154 }
151 ] 155 ]
152 } 156 }