Showing
13 changed files
with
291 additions
and
103 deletions
| @@ -57,7 +57,14 @@ export class HttpUrlUtils { | @@ -57,7 +57,14 @@ export class HttpUrlUtils { | ||
| 57 | * 个人中心 我的预约列表 | 57 | * 个人中心 我的预约列表 |
| 58 | */ | 58 | */ |
| 59 | static readonly APPOINTMENT_LIST_DATA_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; | 59 | static readonly APPOINTMENT_LIST_DATA_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; |
| 60 | - | 60 | + /** |
| 61 | + * 个人中心 关注列表详情 | ||
| 62 | + */ | ||
| 63 | + static readonly FOLLOW_LIST_DETAIL_DATA_PATH: string = "/api/rmrb-creator-user/c/creatorDirectory/getContactMasterDetaiPage"; | ||
| 64 | + /** | ||
| 65 | + * 个人中心 关注列表 | ||
| 66 | + */ | ||
| 67 | + static readonly FOLLOW_LIST_DATA_PATH: string = "/api/rmrb-creator-user/c/creatorDirectory/getCreatorDirectoryTree"; | ||
| 61 | /** | 68 | /** |
| 62 | * 早晚报列表 | 69 | * 早晚报列表 |
| 63 | * 根据页面id获取页面楼层列表 | 70 | * 根据页面id获取页面楼层列表 |
| @@ -257,6 +264,16 @@ export class HttpUrlUtils { | @@ -257,6 +264,16 @@ export class HttpUrlUtils { | ||
| 257 | return url | 264 | return url |
| 258 | } | 265 | } |
| 259 | 266 | ||
| 267 | + static getFollowListDetailDataUrl() { | ||
| 268 | + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.FOLLOW_LIST_DETAIL_DATA_PATH | ||
| 269 | + return url | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + static getFollowListDataUrl() { | ||
| 273 | + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.FOLLOW_LIST_DATA_PATH | ||
| 274 | + return url | ||
| 275 | + } | ||
| 276 | + | ||
| 260 | static getYcgCommonHeaders(): HashMap<string, string> { | 277 | static getYcgCommonHeaders(): HashMap<string, string> { |
| 261 | let headers: HashMap<string, string> = new HashMap<string, string>() | 278 | let headers: HashMap<string, string> = new HashMap<string, string>() |
| 262 | 279 | ||
| @@ -269,10 +286,10 @@ export class HttpUrlUtils { | @@ -269,10 +286,10 @@ export class HttpUrlUtils { | ||
| 269 | headers.set('X-Ca-Stage', "TEST") | 286 | headers.set('X-Ca-Stage', "TEST") |
| 270 | headers.set('plat', "Phone") | 287 | headers.set('plat', "Phone") |
| 271 | headers.set('Content-Type', 'application/json; charset=utf-8') | 288 | headers.set('Content-Type', 'application/json; charset=utf-8') |
| 272 | - headers.set('timestamp', "649773304") | ||
| 273 | - headers.set('RMRB-X-TOKEN', "eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8") | 289 | + headers.set('timestamp', "740977741") |
| 290 | + headers.set('RMRB-X-TOKEN', "eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDc1NjM3NywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ.KBkF0Yki-JWlq0ZIOCzgKwQc1ycBnFHa6CF-rMPRgHU") | ||
| 274 | headers.set('device_id', "5156098c-6c44-3514-af70-04a0139a9327") | 291 | headers.set('device_id', "5156098c-6c44-3514-af70-04a0139a9327") |
| 275 | - headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8') | 292 | + // headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8') |
| 276 | headers.set('build_version', "202403112023") | 293 | headers.set('build_version', "202403112023") |
| 277 | headers.set('adcode', "340000") | 294 | headers.set('adcode', "340000") |
| 278 | headers.set('os_version', "10") | 295 | headers.set('os_version', "10") |
| @@ -281,7 +298,7 @@ export class HttpUrlUtils { | @@ -281,7 +298,7 @@ export class HttpUrlUtils { | ||
| 281 | headers.set('versionCode', "7302") | 298 | headers.set('versionCode', "7302") |
| 282 | headers.set('system', "Android") | 299 | headers.set('system', "Android") |
| 283 | headers.set('version_name', "7.3.0.2") | 300 | headers.set('version_name', "7.3.0.2") |
| 284 | - headers.set('EagleEye-TraceID', '5C3D0800CF2C4440A43E5B131187629B') | 301 | + headers.set('EagleEye-TraceID', '101118E4D006453DA549A82AA8CAFBFE') |
| 285 | headers.set('imei', "5156098c-6c44-3514-af70-04a0139a9327") | 302 | headers.set('imei', "5156098c-6c44-3514-af70-04a0139a9327") |
| 286 | headers.set('userType', "1") | 303 | headers.set('userType', "1") |
| 287 | headers.set('Accept-Language', 'zh') | 304 | headers.set('Accept-Language', 'zh') |
| @@ -3,6 +3,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter' | @@ -3,6 +3,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter' | ||
| 3 | @Component | 3 | @Component |
| 4 | export default struct MinePageUserSimpleInfoUI { | 4 | export default struct MinePageUserSimpleInfoUI { |
| 5 | @Prop isLogin:boolean | 5 | @Prop isLogin:boolean |
| 6 | + @Prop userName:string | ||
| 7 | + | ||
| 6 | 8 | ||
| 7 | build(){ | 9 | build(){ |
| 8 | Row(){ | 10 | Row(){ |
| @@ -21,14 +23,16 @@ export default struct MinePageUserSimpleInfoUI { | @@ -21,14 +23,16 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 21 | .height('110lpx') | 23 | .height('110lpx') |
| 22 | .alignContent(Alignment.Center) | 24 | .alignContent(Alignment.Center) |
| 23 | .onClick(()=>{ | 25 | .onClick(()=>{ |
| 24 | - WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 26 | + if(!this.isLogin){ |
| 27 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 28 | + } | ||
| 25 | }) | 29 | }) |
| 26 | 30 | ||
| 27 | if(this.isLogin){ | 31 | if(this.isLogin){ |
| 28 | //昵称信息 | 32 | //昵称信息 |
| 29 | Column(){ | 33 | Column(){ |
| 30 | Row(){ | 34 | Row(){ |
| 31 | - Text("人民日报6G5E3T") | 35 | + Text(this.userName) |
| 32 | .fontColor($r('app.color.color_222222')) | 36 | .fontColor($r('app.color.color_222222')) |
| 33 | .maxLines(1) | 37 | .maxLines(1) |
| 34 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 38 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 1 | -import { AppointmentListChildComponent } from '../mine/AppointmentListChildComponent'; | ||
| 2 | -import { CustomTitleUI } from '../reusable/CustomTitleUI' | ||
| 3 | -import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'; | ||
| 4 | -import { MineAppointmentItem } from '../../viewmodel/MineAppointmentItem'; | 1 | +import { AppointmentListChildComponent } from './AppointmentListChildComponent'; |
| 2 | +import { CustomTitleUI } from '../../reusable/CustomTitleUI' | ||
| 3 | +import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 4 | +import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem'; | ||
| 5 | import { LazyDataSource, StringUtils } from 'wdKit'; | 5 | import { LazyDataSource, StringUtils } from 'wdKit'; |
| 6 | -import MinePageDatasModel from '../../model/MinePageDatasModel'; | 6 | +import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 7 | const TAG = "AppointmentListUI" | 7 | const TAG = "AppointmentListUI" |
| 8 | 8 | ||
| 9 | @Component | 9 | @Component |
| 10 | export struct AppointmentListUI{ | 10 | export struct AppointmentListUI{ |
| 11 | @State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource(); | 11 | @State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource(); |
| 12 | + @State count:number = 0; | ||
| 12 | @State isLoading:boolean = false | 13 | @State isLoading:boolean = false |
| 13 | @State hasMore:boolean = true | 14 | @State hasMore:boolean = true |
| 14 | curPageNum:number = 1; | 15 | curPageNum:number = 1; |
| @@ -21,35 +22,39 @@ export struct AppointmentListUI{ | @@ -21,35 +22,39 @@ export struct AppointmentListUI{ | ||
| 21 | Column() { | 22 | Column() { |
| 22 | //标题栏目 | 23 | //标题栏目 |
| 23 | CustomTitleUI({titleName:"预约列表"}) | 24 | CustomTitleUI({titleName:"预约列表"}) |
| 24 | - //刷新控件 TODO | ||
| 25 | - //List | ||
| 26 | - List({ space: '6lpx' }) { | ||
| 27 | - LazyForEach(this.data, (item: MineAppointmentItem, index: number) => { | ||
| 28 | - ListItem() { | ||
| 29 | - AppointmentListChildComponent({item:item}) | ||
| 30 | - } | ||
| 31 | - .onClick(()=>{ | ||
| 32 | - //TODO 跳转 | ||
| 33 | - }) | ||
| 34 | - }, (item: MineAppointmentItem, index: number) => index.toString()) | 25 | + if(this.count == 0){ |
| 26 | + ListHasNoMoreDataUI({style:2}) | ||
| 27 | + }else{ | ||
| 28 | + //刷新控件 TODO | ||
| 29 | + //List | ||
| 30 | + List({ space: '6lpx' }) { | ||
| 31 | + LazyForEach(this.data, (item: MineAppointmentItem, index: number) => { | ||
| 32 | + ListItem() { | ||
| 33 | + AppointmentListChildComponent({item:item}) | ||
| 34 | + } | ||
| 35 | + .onClick(()=>{ | ||
| 36 | + //TODO 跳转 | ||
| 37 | + }) | ||
| 38 | + }, (item: MineAppointmentItem, index: number) => index.toString()) | ||
| 35 | 39 | ||
| 36 | - //没有更多数据 显示提示 | ||
| 37 | - if(!this.hasMore){ | ||
| 38 | - ListItem(){ | ||
| 39 | - ListHasNoMoreDataUI() | 40 | + //没有更多数据 显示提示 |
| 41 | + if(!this.hasMore){ | ||
| 42 | + ListItem(){ | ||
| 43 | + ListHasNoMoreDataUI() | ||
| 44 | + } | ||
| 40 | } | 45 | } |
| 41 | - } | ||
| 42 | - }.cachedCount(4) | ||
| 43 | - .scrollBar(BarState.Off) | ||
| 44 | - .margin({top:'23lpx',left:'23lpx',right:'23lpx'}) | ||
| 45 | - .layoutWeight(1) | ||
| 46 | - .onReachEnd(()=>{ | ||
| 47 | - console.log(TAG,"触底了"); | ||
| 48 | - if(!this.isLoading){ | ||
| 49 | - //加载分页数据 | ||
| 50 | - this.getNewPageData() | ||
| 51 | - } | ||
| 52 | - }) | 46 | + }.cachedCount(4) |
| 47 | + .scrollBar(BarState.Off) | ||
| 48 | + .margin({top:'23lpx',left:'23lpx',right:'23lpx'}) | ||
| 49 | + .layoutWeight(1) | ||
| 50 | + .onReachEnd(()=>{ | ||
| 51 | + console.log(TAG,"触底了"); | ||
| 52 | + if(!this.isLoading){ | ||
| 53 | + //加载分页数据 | ||
| 54 | + this.getNewPageData() | ||
| 55 | + } | ||
| 56 | + }) | ||
| 57 | + } | ||
| 53 | } | 58 | } |
| 54 | .backgroundColor($r('app.color.color_F9F9F9')) | 59 | .backgroundColor($r('app.color.color_F9F9F9')) |
| 55 | .height('100%') | 60 | .height('100%') |
| @@ -72,6 +77,7 @@ export struct AppointmentListUI{ | @@ -72,6 +77,7 @@ export struct AppointmentListUI{ | ||
| 72 | } | 77 | } |
| 73 | }) | 78 | }) |
| 74 | this.data.notifyDataReload() | 79 | this.data.notifyDataReload() |
| 80 | + this.count = this.data.totalCount() | ||
| 75 | if (this.data.totalCount() < value.totalCount) { | 81 | if (this.data.totalCount() < value.totalCount) { |
| 76 | this.curPageNum++ | 82 | this.curPageNum++ |
| 77 | }else { | 83 | }else { |
| 1 | import { ResourcesUtils } from 'wdKit' | 1 | import { ResourcesUtils } from 'wdKit' |
| 2 | import { ResponseDTO } from 'wdNetwork' | 2 | import { ResponseDTO } from 'wdNetwork' |
| 3 | +import MinePageDatasModel from '../../../model/MinePageDatasModel' | ||
| 3 | import { FollowListItem } from '../../../viewmodel/FollowListItem' | 4 | import { FollowListItem } from '../../../viewmodel/FollowListItem' |
| 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 5 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| 5 | import { FollowSecondTabsComponent } from './FollowSecondTabsComponent' | 6 | import { FollowSecondTabsComponent } from './FollowSecondTabsComponent' |
| @@ -19,10 +20,10 @@ export struct FollowFirstTabsComponent{ | @@ -19,10 +20,10 @@ export struct FollowFirstTabsComponent{ | ||
| 19 | // this.data.push(element) | 20 | // this.data.push(element) |
| 20 | // }); | 21 | // }); |
| 21 | 22 | ||
| 22 | - ResourcesUtils.getResourcesJson<ResponseDTO<FollowListItem[]>>(getContext(this),'follow_list_data.json').then((success)=>{ | ||
| 23 | - success.data?.forEach(element => { | ||
| 24 | - this.data.push(element) | ||
| 25 | - }); | 23 | + MinePageDatasModel.getFollowListData(getContext(this)).then((value)=>{ |
| 24 | + value.forEach((element)=>{ | ||
| 25 | + this.data.push(element) | ||
| 26 | + }) | ||
| 26 | console.log("ycg",this.data.length.toString()); | 27 | console.log("ycg",this.data.length.toString()); |
| 27 | }) | 28 | }) |
| 28 | } | 29 | } |
| 1 | import { LazyDataSource } from 'wdKit'; | 1 | import { LazyDataSource } from 'wdKit'; |
| 2 | +import MinePageDatasModel from '../../../model/MinePageDatasModel'; | ||
| 2 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | 3 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' |
| 4 | +import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | ||
| 3 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 5 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 4 | 6 | ||
| 5 | const TAG = "FollowListDetailUI" | 7 | const TAG = "FollowListDetailUI" |
| @@ -7,11 +9,10 @@ const TAG = "FollowListDetailUI" | @@ -7,11 +9,10 @@ const TAG = "FollowListDetailUI" | ||
| 7 | export struct FollowListDetailUI{ | 9 | export struct FollowListDetailUI{ |
| 8 | @State creatorDirectoryId:number = -1; | 10 | @State creatorDirectoryId:number = -1; |
| 9 | @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | 11 | @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); |
| 12 | + @State count:number = 0; | ||
| 10 | @State isLoading:boolean = false | 13 | @State isLoading:boolean = false |
| 11 | @State hasMore:boolean = true | 14 | @State hasMore:boolean = true |
| 12 | curPageNum:number = 1; | 15 | curPageNum:number = 1; |
| 13 | - headUrl = "https://sitcontentjdcdn.aikan.pdnews.cn/vod/content/202309/202309Th211436299/GLN.png?x-oss-process=image/resize,l_400/auto-orient,1/quality,q_90/format,jpg" | ||
| 14 | - | ||
| 15 | 16 | ||
| 16 | aboutToAppear(){ | 17 | aboutToAppear(){ |
| 17 | console.log("YCG","aboutToAppear==="+this.creatorDirectoryId); | 18 | console.log("YCG","aboutToAppear==="+this.creatorDirectoryId); |
| @@ -20,58 +21,64 @@ export struct FollowListDetailUI{ | @@ -20,58 +21,64 @@ export struct FollowListDetailUI{ | ||
| 20 | 21 | ||
| 21 | build(){ | 22 | build(){ |
| 22 | Column(){ | 23 | Column(){ |
| 23 | - List({ space: 3 }) { | ||
| 24 | - LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { | ||
| 25 | - ListItem() { | ||
| 26 | - ChildComponent({data: item}) | ||
| 27 | - } | ||
| 28 | - .onClick(() => { | ||
| 29 | - }) | ||
| 30 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | 24 | + if(this.count === 0){ |
| 25 | + ListHasNoMoreDataUI({style:2}) | ||
| 26 | + }else{ | ||
| 27 | + List({ space: 3 }) { | ||
| 28 | + LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { | ||
| 29 | + ListItem() { | ||
| 30 | + ChildComponent({data: item}) | ||
| 31 | + } | ||
| 32 | + .onClick(() => { | ||
| 33 | + }) | ||
| 34 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 31 | 35 | ||
| 32 | - | ||
| 33 | - //没有更多数据 显示提示 | ||
| 34 | - if(!this.hasMore){ | ||
| 35 | - ListItem(){ | ||
| 36 | - ListHasNoMoreDataUI() | 36 | + //没有更多数据 显示提示 |
| 37 | + if(!this.hasMore){ | ||
| 38 | + ListItem(){ | ||
| 39 | + ListHasNoMoreDataUI() | ||
| 40 | + } | ||
| 37 | } | 41 | } |
| 38 | - } | ||
| 39 | - }.cachedCount(7) | ||
| 40 | - .padding({left:'31lpx',right:'31lpx'}) | ||
| 41 | - .layoutWeight(1) | ||
| 42 | - .onReachEnd(()=>{ | ||
| 43 | - console.log(TAG,"触底了"); | ||
| 44 | - if(!this.isLoading){ | ||
| 45 | - this.isLoading = true | ||
| 46 | - //加载分页数据 | ||
| 47 | - this.getNewPageData() | ||
| 48 | - } | ||
| 49 | - }) | ||
| 50 | - }.layoutWeight(1) | 42 | + }.cachedCount(7) |
| 43 | + .padding({left:'31lpx',right:'31lpx'}) | ||
| 44 | + .layoutWeight(1) | ||
| 45 | + .scrollBar(BarState.Off) | ||
| 46 | + .onReachEnd(()=>{ | ||
| 47 | + console.log(TAG,"触底了"); | ||
| 48 | + if(!this.isLoading){ | ||
| 49 | + this.isLoading = true | ||
| 50 | + //加载分页数据 | ||
| 51 | + this.getNewPageData() | ||
| 52 | + } | ||
| 53 | + }) | ||
| 54 | + } | ||
| 55 | + }.height('100%') | ||
| 56 | + .width('100%') | ||
| 51 | } | 57 | } |
| 52 | 58 | ||
| 53 | getNewPageData(){ | 59 | getNewPageData(){ |
| 60 | + this.isLoading = true | ||
| 54 | if(this.hasMore){ | 61 | if(this.hasMore){ |
| 55 | - if(this.curPageNum>=4){ | ||
| 56 | - this.hasMore = false | ||
| 57 | - return | ||
| 58 | - } | ||
| 59 | - if(this.curPageNum == 1){ | ||
| 60 | - this.data.push(new FollowListDetailItem(this.headUrl,"人之初,性本善",10,"人之初,性本善")); | ||
| 61 | - this.data.push(new FollowListDetailItem(this.headUrl,"性相近,习相远",20,"性相近,习相远")); | ||
| 62 | - this.data.push(new FollowListDetailItem(this.headUrl,"苟不教,性乃迁",30,"苟不教,性乃迁")); | ||
| 63 | - this.data.push(new FollowListDetailItem(this.headUrl,"教之道,贵以专",40,"教之道,贵以专")); | ||
| 64 | - this.data.push(new FollowListDetailItem(this.headUrl,"AAAAAAA",50,"教之道,贵以专")); | ||
| 65 | - this.data.push(new FollowListDetailItem(this.headUrl,"BBBBBBB",60,"教之道,贵以专")); | ||
| 66 | - this.data.push(new FollowListDetailItem(this.headUrl,"CCCCCCC",70,"教之道,贵以专")); | ||
| 67 | - }else if(this.curPageNum == 2){ | ||
| 68 | - this.data.push(new FollowListDetailItem(this.headUrl,"昔孟母,择邻处",40,"昔孟母,择邻处")); | ||
| 69 | - }else if(this.curPageNum == 3){ | ||
| 70 | - this.data.push(new FollowListDetailItem(this.headUrl,"子不学,断机杼",40,"子不学,断机杼")); | ||
| 71 | - } | ||
| 72 | - this.isLoading = false | ||
| 73 | - this.curPageNum++ | 62 | + let object = new FollowListDetailRequestItem(this.creatorDirectoryId,20,this.curPageNum) |
| 63 | + | ||
| 64 | + MinePageDatasModel.getFollowListDetailData(object,getContext(this)).then((value)=>{ | ||
| 65 | + if (!this.data || value.list.length == 0){ | ||
| 66 | + this.hasMore = false | ||
| 67 | + }else{ | ||
| 68 | + value.list.forEach((value)=>{ | ||
| 69 | + this.data.push(new FollowListDetailItem(value.headPhotoUrl,value.cnUserName,value.cnFansNum,value.introduction)) | ||
| 70 | + }) | ||
| 71 | + this.data.notifyDataReload() | ||
| 72 | + this.count = this.data.totalCount() | ||
| 73 | + if (this.data.totalCount() < value.totalCount) { | ||
| 74 | + this.curPageNum++ | ||
| 75 | + }else { | ||
| 76 | + this.hasMore = false | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + }) | ||
| 74 | } | 80 | } |
| 81 | + this.isLoading = false | ||
| 75 | } | 82 | } |
| 76 | } | 83 | } |
| 77 | 84 |
| @@ -7,6 +7,8 @@ import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI' | @@ -7,6 +7,8 @@ import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI' | ||
| 7 | import MinePageCardUI from '../mine/MinePageCardUI' | 7 | import MinePageCardUI from '../mine/MinePageCardUI' |
| 8 | import MinePageCreatorFunctionUI from '../mine/MinePageCreatorFunctionUI' | 8 | import MinePageCreatorFunctionUI from '../mine/MinePageCreatorFunctionUI' |
| 9 | import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' | 9 | import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' |
| 10 | +import { SPHelper, StringUtils } from 'wdKit' | ||
| 11 | +import { SpConstants } from 'wdConstant' | ||
| 10 | 12 | ||
| 11 | const TAG = 'MinePageComponent'; | 13 | const TAG = 'MinePageComponent'; |
| 12 | 14 | ||
| @@ -18,14 +20,14 @@ export struct MinePageComponent { | @@ -18,14 +20,14 @@ export struct MinePageComponent { | ||
| 18 | //是否是创作者 | 20 | //是否是创作者 |
| 19 | @State isCreator:boolean = false | 21 | @State isCreator:boolean = false |
| 20 | @State isLogin:boolean = false | 22 | @State isLogin:boolean = false |
| 23 | + @State userName:string = "登陆注册" | ||
| 21 | @State personalData:MinePagePersonalFunctionsItem[] = [] | 24 | @State personalData:MinePagePersonalFunctionsItem[] = [] |
| 22 | @State creatorData:MinePageCreatorFunctionsItem[] = [] | 25 | @State creatorData:MinePageCreatorFunctionsItem[] = [] |
| 23 | @State moreData:MinePageMoreFunctionModel[] = [] | 26 | @State moreData:MinePageMoreFunctionModel[] = [] |
| 24 | scroller: Scroller = new Scroller() | 27 | scroller: Scroller = new Scroller() |
| 25 | 28 | ||
| 26 | aboutToAppear(){ | 29 | aboutToAppear(){ |
| 27 | - //登录信息 TODO | ||
| 28 | - | 30 | + this.getUserLogin() |
| 29 | this.getFunctionData() | 31 | this.getFunctionData() |
| 30 | } | 32 | } |
| 31 | 33 | ||
| @@ -59,7 +61,7 @@ export struct MinePageComponent { | @@ -59,7 +61,7 @@ export struct MinePageComponent { | ||
| 59 | @Builder MinePageUI(){ | 61 | @Builder MinePageUI(){ |
| 60 | Column(){ | 62 | Column(){ |
| 61 | //头像层 | 63 | //头像层 |
| 62 | - MinePageUserSimpleInfoUI({isLogin:this.isLogin}) | 64 | + MinePageUserSimpleInfoUI({isLogin:this.isLogin,userName:this.userName}) |
| 63 | //Grid 区域 | 65 | //Grid 区域 |
| 64 | MinePagePersonFunctionUI({personalData:$personalData}) | 66 | MinePagePersonFunctionUI({personalData:$personalData}) |
| 65 | //Card | 67 | //Card |
| @@ -77,4 +79,16 @@ export struct MinePageComponent { | @@ -77,4 +79,16 @@ export struct MinePageComponent { | ||
| 77 | .height('100%') | 79 | .height('100%') |
| 78 | } | 80 | } |
| 79 | 81 | ||
| 82 | + async getUserLogin() { | ||
| 83 | + let userid = await SPHelper.default.get(SpConstants.USER_ID,"") | ||
| 84 | + if(StringUtils.isNotEmpty(userid)){ | ||
| 85 | + this.isLogin = true | ||
| 86 | + let userName = await SPHelper.default.get(SpConstants.USER_NAME,"") as string | ||
| 87 | + this.userName = userName | ||
| 88 | + }else{ | ||
| 89 | + this.isLogin = false | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + | ||
| 80 | } | 93 | } |
| 94 | + |
| 1 | @Component | 1 | @Component |
| 2 | export struct ListHasNoMoreDataUI{ | 2 | export struct ListHasNoMoreDataUI{ |
| 3 | + @State style:number = 1; | ||
| 4 | + | ||
| 3 | build(){ | 5 | build(){ |
| 4 | - Row(){ | ||
| 5 | - Text("已显示全部内容") | ||
| 6 | - .fontColor($r('app.color.color_999999')) | ||
| 7 | - .fontWeight('500lpx') | ||
| 8 | - .fontSize('23lpx') | ||
| 9 | - }.justifyContent(FlexAlign.Center) | ||
| 10 | - .width('100%') | ||
| 11 | - .margin({top:'20lpx',bottom:'20lpx'}) | 6 | + if (this.style === 1){ |
| 7 | + Row(){ | ||
| 8 | + Text("已显示全部内容") | ||
| 9 | + .fontColor($r('app.color.color_999999')) | ||
| 10 | + .fontWeight('500lpx') | ||
| 11 | + .fontSize('23lpx') | ||
| 12 | + }.justifyContent(FlexAlign.Center) | ||
| 13 | + .width('100%') | ||
| 14 | + .margin({top:'20lpx',bottom:'20lpx'}) | ||
| 15 | + }else if (this.style === 2){ | ||
| 16 | + Column(){ | ||
| 17 | + Image($r('app.media.empty_icon')) | ||
| 18 | + .width('200lpx') | ||
| 19 | + .height('200lpx') | ||
| 20 | + .objectFit(ImageFit.Auto) | ||
| 21 | + Text("暂无内容") | ||
| 22 | + .fontColor($r('app.color.color_999999')) | ||
| 23 | + .fontWeight('500lpx') | ||
| 24 | + .fontSize('23lpx') | ||
| 25 | + } | ||
| 26 | + .justifyContent(FlexAlign.Center) | ||
| 27 | + .width('100%') | ||
| 28 | + .height('100%') | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + | ||
| 12 | } | 32 | } |
| 13 | } | 33 | } |
| @@ -6,6 +6,10 @@ import HashMap from '@ohos.util.HashMap'; | @@ -6,6 +6,10 @@ import HashMap from '@ohos.util.HashMap'; | ||
| 6 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 6 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 7 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; | 7 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; |
| 8 | import { Logger, ResourcesUtils } from 'wdKit'; | 8 | import { Logger, ResourcesUtils } from 'wdKit'; |
| 9 | +import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; | ||
| 10 | +import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; | ||
| 11 | +import { FollowListItem } from '../viewmodel/FollowListItem'; | ||
| 12 | + | ||
| 9 | const TAG = "MinePageDatasModel" | 13 | const TAG = "MinePageDatasModel" |
| 10 | 14 | ||
| 11 | /** | 15 | /** |
| @@ -83,6 +87,12 @@ class MinePageDatasModel{ | @@ -83,6 +87,12 @@ class MinePageDatasModel{ | ||
| 83 | return this.moreData | 87 | return this.moreData |
| 84 | } | 88 | } |
| 85 | 89 | ||
| 90 | + /** | ||
| 91 | + * 预约 | ||
| 92 | + * @param pageSize | ||
| 93 | + * @param pageNum | ||
| 94 | + * @returns | ||
| 95 | + */ | ||
| 86 | fetchAppointmentListData(pageSize:string,pageNum:string) { | 96 | fetchAppointmentListData(pageSize:string,pageNum:string) { |
| 87 | let url = HttpUrlUtils.getAppointmentListDataUrl()+ `?pageSize=${pageSize}&pageNum=${pageNum}` | 97 | let url = HttpUrlUtils.getAppointmentListDataUrl()+ `?pageSize=${pageSize}&pageNum=${pageNum}` |
| 88 | let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | 98 | let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); |
| @@ -120,7 +130,90 @@ class MinePageDatasModel{ | @@ -120,7 +130,90 @@ class MinePageDatasModel{ | ||
| 120 | return compRes.data | 130 | return compRes.data |
| 121 | } | 131 | } |
| 122 | 132 | ||
| 133 | + /** | ||
| 134 | + * 关注频道详情 | ||
| 135 | + * @param pageSize | ||
| 136 | + * @param pageNum | ||
| 137 | + * @param context | ||
| 138 | + * @returns | ||
| 139 | + */ | ||
| 140 | + getFollowListDetailData(params:FollowListDetailRequestItem,context: Context): Promise<MineFollowListDetailItem> { | ||
| 141 | + return new Promise<MineFollowListDetailItem>((success, error) => { | ||
| 142 | + Logger.info(TAG, `getAppointmentList start`); | ||
| 143 | + this.fetchFollowListDetailData(params).then((navResDTO: ResponseDTO<MineFollowListDetailItem>) => { | ||
| 144 | + if (!navResDTO) { | ||
| 145 | + error("page data invalid"); | ||
| 146 | + success(this.getFollowListDetailDataLocal(context)) | ||
| 147 | + return | ||
| 148 | + } | ||
| 149 | + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 150 | + let navigationBean = navResDTO.data as MineFollowListDetailItem | ||
| 151 | + success(navigationBean); | ||
| 152 | + }).catch((err: Error) => { | ||
| 153 | + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 154 | + // error(err); | ||
| 155 | + success(this.getFollowListDetailDataLocal(context)) | ||
| 156 | + }) | ||
| 157 | + }) | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + async getFollowListDetailDataLocal(context: Context): Promise<MineFollowListDetailItem> { | ||
| 161 | + Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 162 | + let compRes: ResponseDTO<MineFollowListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineFollowListDetailItem>>(context,'follow_list_detail_data_id120.json' ); | ||
| 163 | + if (!compRes || !compRes.data) { | ||
| 164 | + Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 165 | + return new MineFollowListDetailItem() | ||
| 166 | + } | ||
| 167 | + Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 168 | + return compRes.data | ||
| 169 | + } | ||
| 123 | 170 | ||
| 171 | + fetchFollowListDetailData(object:FollowListDetailRequestItem) { | ||
| 172 | + let url = HttpUrlUtils.getFollowListDetailDataUrl() | ||
| 173 | + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | ||
| 174 | + return WDHttp.post<ResponseDTO<MineFollowListDetailItem>>(url, object,headers) | ||
| 175 | + }; | ||
| 176 | + | ||
| 177 | + /** | ||
| 178 | + * 关注频道列表 | ||
| 179 | + * @returns | ||
| 180 | + */ | ||
| 181 | + fetchFollowListData() { | ||
| 182 | + let url = HttpUrlUtils.getFollowListDataUrl() | ||
| 183 | + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders(); | ||
| 184 | + return WDHttp.get<ResponseDTO<FollowListItem[]>>(url, headers) | ||
| 185 | + }; | ||
| 186 | + | ||
| 187 | + getFollowListData(context: Context): Promise<FollowListItem[]> { | ||
| 188 | + return new Promise<FollowListItem[]>((success, error) => { | ||
| 189 | + Logger.info(TAG, `getAppointmentList start`); | ||
| 190 | + this.fetchFollowListData().then((navResDTO: ResponseDTO<FollowListItem[]>) => { | ||
| 191 | + if (!navResDTO) { | ||
| 192 | + error("page data invalid"); | ||
| 193 | + success(this.getFollowListDataLocal(context)) | ||
| 194 | + return | ||
| 195 | + } | ||
| 196 | + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 197 | + let navigationBean = navResDTO.data as FollowListItem[] | ||
| 198 | + success(navigationBean); | ||
| 199 | + }).catch((err: Error) => { | ||
| 200 | + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 201 | + // error(err); | ||
| 202 | + success(this.getFollowListDataLocal(context)) | ||
| 203 | + }) | ||
| 204 | + }) | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + async getFollowListDataLocal(context: Context): Promise<FollowListItem[]> { | ||
| 208 | + Logger.info(TAG, `getFollowListDataLocal start`); | ||
| 209 | + let compRes: ResponseDTO<FollowListItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<FollowListItem[]>>(context,'follow_list_data2.json' ); | ||
| 210 | + if (!compRes || !compRes.data) { | ||
| 211 | + Logger.info(TAG, `getFollowListDataLocal compRes is empty`); | ||
| 212 | + return [] | ||
| 213 | + } | ||
| 214 | + Logger.info(TAG, `getFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 215 | + return compRes.data | ||
| 216 | + } | ||
| 124 | } | 217 | } |
| 125 | 218 | ||
| 126 | const minePageDatasModel = MinePageDatasModel.getInstance() | 219 | const minePageDatasModel = MinePageDatasModel.getInstance() |
sight_harmony/features/wdComponent/src/main/ets/viewmodel/FollowListDetailRequestItem.ets
0 → 100644
| 1 | +export class FollowListDetailRequestItem{ | ||
| 2 | + creatorDirectoryId:number = 120 | ||
| 3 | + pageSize:number = 20 | ||
| 4 | + pageNum:number = 1 | ||
| 5 | + | ||
| 6 | + constructor(creatorDirectoryId: number = 120, | ||
| 7 | + pageSize: number = 20, | ||
| 8 | + pageNum: number = 1) { | ||
| 9 | + this.creatorDirectoryId = creatorDirectoryId | ||
| 10 | + this.pageSize = pageSize | ||
| 11 | + this.pageNum = pageNum | ||
| 12 | + } | ||
| 13 | +} |
| 1 | +import { FollowListDetailItem } from './FollowListDetailItem' | ||
| 2 | + | ||
| 3 | +export class MineFollowListDetailItem{ | ||
| 4 | + list:FollowListDetailItem[] = [] | ||
| 5 | + | ||
| 6 | + pageNum: number = 0 | ||
| 7 | + pageSize: number = 20 | ||
| 8 | + totalCount: number = 0 | ||
| 9 | + | ||
| 10 | + constructor(list?:FollowListDetailItem[],pageNum?: number,pageSize?: number,totalCount?: number) { | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | +} |
-
Please register or login to post a comment