Showing
23 changed files
with
945 additions
and
15 deletions
| @@ -284,6 +284,22 @@ export class HttpUrlUtils { | @@ -284,6 +284,22 @@ export class HttpUrlUtils { | ||
| 284 | */ | 284 | */ |
| 285 | static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; | 285 | static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; |
| 286 | 286 | ||
| 287 | + /** | ||
| 288 | + * 人民号号主推荐 | ||
| 289 | + */ | ||
| 290 | + static readonly RMH_RECOMMEND_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/rmh"; | ||
| 291 | + | ||
| 292 | + /** | ||
| 293 | + * 关注号主发布内容接口 | ||
| 294 | + */ | ||
| 295 | + static readonly ATTENTION_CONTENT_LIST_DATA_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/attention/contentList"; | ||
| 296 | + | ||
| 297 | + /** | ||
| 298 | + * 一键关注接口 | ||
| 299 | + */ | ||
| 300 | + static readonly ATTENTION_BATCH_DATA_PATH: string = "/api/rmrb-interact/interact/zh/c/attention/batch"; | ||
| 301 | + | ||
| 302 | + | ||
| 287 | static getHost(): string { | 303 | static getHost(): string { |
| 288 | return HostManager.getHost(); | 304 | return HostManager.getHost(); |
| 289 | } | 305 | } |
| @@ -650,4 +666,23 @@ export class HttpUrlUtils { | @@ -650,4 +666,23 @@ export class HttpUrlUtils { | ||
| 650 | let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; | 666 | let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; |
| 651 | return url; | 667 | return url; |
| 652 | } | 668 | } |
| 669 | + | ||
| 670 | + // 人民号号主推荐 | ||
| 671 | + static getRmhRecommendUrl() { | ||
| 672 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.RMH_RECOMMEND_DATA_PATH; | ||
| 673 | + return url; | ||
| 674 | + } | ||
| 675 | + | ||
| 676 | + // 关注号主发布内容接口 | ||
| 677 | + static getAttentionContentListUrl() { | ||
| 678 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_CONTENT_LIST_DATA_PATH; | ||
| 679 | + return url; | ||
| 680 | + } | ||
| 681 | + | ||
| 682 | + // 一键关注接口 | ||
| 683 | + static getAttentionBatchUrl() { | ||
| 684 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.ATTENTION_BATCH_DATA_PATH; | ||
| 685 | + return url; | ||
| 686 | + } | ||
| 687 | + | ||
| 653 | } | 688 | } |
| @@ -153,3 +153,15 @@ export { | @@ -153,3 +153,15 @@ export { | ||
| 153 | UserExtend | 153 | UserExtend |
| 154 | } from './src/main/ets/bean/user/UserDetail'; | 154 | } from './src/main/ets/bean/user/UserDetail'; |
| 155 | 155 | ||
| 156 | +export { | ||
| 157 | + RmhRecommendDTO | ||
| 158 | +} from './src/main/ets/bean/peoples/RmhRecommendDTO'; | ||
| 159 | + | ||
| 160 | +export { | ||
| 161 | + PeopleShipContentListDTO | ||
| 162 | +} from './src/main/ets/bean/peoples/PeopleShipContentListDTO'; | ||
| 163 | + | ||
| 164 | +export { | ||
| 165 | + AttentionBatchDTO, | ||
| 166 | + CreatorDTO | ||
| 167 | +} from './src/main/ets/bean/peoples/AttentionBatchDTO'; |
| 1 | +export class AttentionBatchDTO{ | ||
| 2 | + creators: CreatorDTO[]; | ||
| 3 | + | ||
| 4 | + constructor(creators: CreatorDTO[] = []) { | ||
| 5 | + this.creators = creators | ||
| 6 | + } | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +export class CreatorDTO { | ||
| 10 | + attentionUserType: string; | ||
| 11 | + attentionUserId: string; | ||
| 12 | + attentionCreatorId: string; | ||
| 13 | + | ||
| 14 | + constructor(attentionUserType: string, attentionUserId: string, attentionCreatorId: string) { | ||
| 15 | + this.attentionUserType = attentionUserType | ||
| 16 | + this.attentionUserId = attentionUserId | ||
| 17 | + this.attentionCreatorId = attentionCreatorId | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | +} |
| 1 | +export interface RmhRecommendDTO { | ||
| 2 | + authIcon: string; | ||
| 3 | + authTitle: string; | ||
| 4 | + authTitle2: string; | ||
| 5 | + cnAttention: number; | ||
| 6 | + cnMainControl: number; | ||
| 7 | + creatorId: string; | ||
| 8 | + fansNum: number; | ||
| 9 | + headPhotoUrl: string; | ||
| 10 | + introduction: string; | ||
| 11 | + itemId: string; | ||
| 12 | + itemType: string; | ||
| 13 | + itemTypeCode: string; | ||
| 14 | + posterShareControl: number; | ||
| 15 | + region: string; | ||
| 16 | + sceneId: string; | ||
| 17 | + subSceneId: string; | ||
| 18 | + traceId: string; | ||
| 19 | + traceInfo: string; | ||
| 20 | + userId: string; | ||
| 21 | + userName: string; | ||
| 22 | + userType: string; | ||
| 23 | +} | ||
| 24 | + |
| @@ -6,6 +6,8 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | @@ -6,6 +6,8 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | ||
| 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; | 6 | import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; |
| 7 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 7 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 9 | +import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | ||
| 10 | + | ||
| 9 | 11 | ||
| 10 | const TAG = 'TopNavigationComponent'; | 12 | const TAG = 'TopNavigationComponent'; |
| 11 | 13 | ||
| @@ -218,7 +220,16 @@ export struct TopNavigationComponent { | @@ -218,7 +220,16 @@ export struct TopNavigationComponent { | ||
| 218 | pageId: navItem.pageId + '', | 220 | pageId: navItem.pageId + '', |
| 219 | channelId: navItem.channelId + '', | 221 | channelId: navItem.channelId + '', |
| 220 | }) | 222 | }) |
| 221 | - } else | 223 | + } |
| 224 | + else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { | ||
| 225 | + PeopleShipMainComponent({ | ||
| 226 | + currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 227 | + navIndex: index, | ||
| 228 | + pageId: navItem.pageId + '', | ||
| 229 | + channelId: navItem.channelId + '', | ||
| 230 | + }) | ||
| 231 | + } | ||
| 232 | + else | ||
| 222 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 233 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| 223 | PageComponent({ | 234 | PageComponent({ |
| 224 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 235 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| 1 | +import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' | ||
| 2 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 3 | +import { ContentDTO } from 'wdBean' | ||
| 4 | +import { CardParser } from '../CardParser' | ||
| 5 | + | ||
| 6 | +@Preview | ||
| 7 | +@Component | ||
| 8 | +export struct PeopleShipAttentionContentListComponent { | ||
| 9 | + | ||
| 10 | + @Prop followList: FollowListDetailItem[] | ||
| 11 | + | ||
| 12 | + @Prop attentionList: ContentDTO[] | ||
| 13 | + | ||
| 14 | + build() { | ||
| 15 | + List(){ | ||
| 16 | + // 头部关注列表 | ||
| 17 | + ListItem(){ | ||
| 18 | + PeopleShipAttentionContentListTopComponent({ | ||
| 19 | + followList: this.followList | ||
| 20 | + }) | ||
| 21 | + } | ||
| 22 | + ForEach(this.attentionList, (item: ContentDTO) => { | ||
| 23 | + ListItem() { | ||
| 24 | + CardParser({ contentDTO: item }) | ||
| 25 | + }.width("100%") | ||
| 26 | + .backgroundColor(Color.Transparent) | ||
| 27 | + | ||
| 28 | + }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | ||
| 29 | + } | ||
| 30 | + .scrollBar(BarState.Off) | ||
| 31 | + .width('100%') | ||
| 32 | + .height('100%') | ||
| 33 | + } | ||
| 34 | +} | ||
| 35 | + |
| 1 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 3 | +import { ProcessUtils } from 'wdRouter'; | ||
| 4 | +import { PeopleShipHomePageHeadComponent } from '../peopleShipHomePage/PeopleShipHomePageHeadComponent' | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +@Component | ||
| 8 | +export struct PeopleShipAttentionContentListTopComponent { | ||
| 9 | + @Prop followList: FollowListDetailItem[] | ||
| 10 | + build() { | ||
| 11 | + Column() { | ||
| 12 | + List(){ | ||
| 13 | + ListItem() { | ||
| 14 | + PeopleShipAttentionContentListHeadComponent({ | ||
| 15 | + index: 0, | ||
| 16 | + item: this.followList[0] | ||
| 17 | + }) | ||
| 18 | + }.onClick(() => { | ||
| 19 | + // 跳转到关注列表-我的 | ||
| 20 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage) | ||
| 21 | + }) | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + ForEach(this.followList, (item: FollowListDetailItem, index: number) => { | ||
| 25 | + ListItem() { | ||
| 26 | + PeopleShipAttentionContentListHeadComponent({ | ||
| 27 | + index: index + 1, | ||
| 28 | + item: item | ||
| 29 | + }) | ||
| 30 | + }.onClick(() => { | ||
| 31 | + let creatorId = item.attentionCreatorId || '' | ||
| 32 | + ProcessUtils.gotoPeopleShipHomePage(creatorId) | ||
| 33 | + }) | ||
| 34 | + }, (item: FollowListDetailItem) => item.attentionCreatorId) | ||
| 35 | + } | ||
| 36 | + .listDirection(Axis.Horizontal) | ||
| 37 | + .scrollBar(BarState.Off) | ||
| 38 | + .width('100%') | ||
| 39 | + .height('102vp') | ||
| 40 | + Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +@Component | ||
| 46 | +struct PeopleShipAttentionContentListHeadComponent { | ||
| 47 | + | ||
| 48 | + @State index: number = 0 | ||
| 49 | + @ObjectLink item: FollowListDetailItem | ||
| 50 | + build() { | ||
| 51 | + Column(){ | ||
| 52 | + // 头像 | ||
| 53 | + PeopleShipHomePageHeadComponent({ | ||
| 54 | + diameter: 48, | ||
| 55 | + iconDiameter: 16, | ||
| 56 | + headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') : | ||
| 57 | + ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? | ||
| 58 | + this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')), | ||
| 59 | + authIcon: this.index == 0 ? '' : this.item.authIcon | ||
| 60 | + }).margin({ | ||
| 61 | + bottom: '8vp' | ||
| 62 | + }) | ||
| 63 | + | ||
| 64 | + Text(this.index == 0 ? '我的关注' : this.item.attentionUserName) | ||
| 65 | + .fontColor($r('app.color.color_666666')) | ||
| 66 | + .fontSize($r('app.float.vp_13')) | ||
| 67 | + .fontWeight(400) | ||
| 68 | + .height('18vp') | ||
| 69 | + .lineHeight('18vp') | ||
| 70 | + .maxLines(1) | ||
| 71 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 72 | + .padding({ | ||
| 73 | + left: '2vp', | ||
| 74 | + right: '2vp' | ||
| 75 | + }) | ||
| 76 | + } | ||
| 77 | + .alignItems(HorizontalAlign.Center) | ||
| 78 | + .width('78vp') | ||
| 79 | + .margin({ | ||
| 80 | + left: this.index == 0 ? '8vp' : '4vp', | ||
| 81 | + top: '14vp', | ||
| 82 | + bottom: '14vp' | ||
| 83 | + }) | ||
| 84 | + } | ||
| 85 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
0 → 100644
| 1 | +import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent'; | ||
| 2 | +import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | ||
| 3 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 4 | +import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit'; | ||
| 5 | +import { RmhRecommendDTO, ContentDTO, AttentionBatchDTO, CreatorDTO } from 'wdBean'; | ||
| 6 | +import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | ||
| 7 | +import { channelSkeleton } from '../skeleton/channelSkeleton' | ||
| 8 | +import { EmptyComponent } from '../view/EmptyComponent'; | ||
| 9 | +import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 10 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 11 | +import MinePageDatasModel from '../../model/MinePageDatasModel'; | ||
| 12 | +import { FollowListDetailRequestItem } from '../../viewmodel/FollowListDetailRequestItem'; | ||
| 13 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 14 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 15 | +import PageModel from '../../viewmodel/PageModel'; | ||
| 16 | +import PageAdModel from '../../viewmodel/PageAdvModel'; | ||
| 17 | +import PageHelper from '../../viewmodel/PageHelper'; | ||
| 18 | +import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' | ||
| 19 | +import { CardParser } from '../CardParser' | ||
| 20 | +import NoMoreLayout from '../page/NoMoreLayout'; | ||
| 21 | + | ||
| 22 | +@Preview | ||
| 23 | +@Component | ||
| 24 | +export struct PeopleShipMainComponent { | ||
| 25 | + @State private pageModel: PageModel = new PageModel(); | ||
| 26 | + @State private pageAdvModel: PageAdModel = new PageAdModel(); | ||
| 27 | + | ||
| 28 | + navIndex: number = 0; | ||
| 29 | + pageId: string = ""; | ||
| 30 | + channelId: string = ""; | ||
| 31 | + @Link @Watch('onChange') currentTopNavSelectedIndex: number | ||
| 32 | + private scroller: Scroller = new Scroller() | ||
| 33 | + private listScroller: Scroller = new Scroller() | ||
| 34 | + | ||
| 35 | + @State rmhList: RmhRecommendDTO[] = [] | ||
| 36 | + @Provide rmhSelectedList: string[] = [] | ||
| 37 | + @State viewType: ViewType = ViewType.LOADING | ||
| 38 | + // 一键关注处理 | ||
| 39 | + @State @Watch('onOneFollowChange') oneKeyFollow: boolean = false | ||
| 40 | + // 已经关注的列表 | ||
| 41 | + @State followList: FollowListDetailItem[] = [] | ||
| 42 | + // 换一换 | ||
| 43 | + @State @Watch('onChangeButtonClick') changeButton: boolean = false | ||
| 44 | + @State attentionList: ContentDTO[] = [] | ||
| 45 | + @State private hasMore: boolean = true | ||
| 46 | + @State private currentPage: number = 1 | ||
| 47 | + @State private isLoading: boolean = false | ||
| 48 | + @State private loadTime: string = '' | ||
| 49 | + | ||
| 50 | + // 页面展示监听 | ||
| 51 | + @Consume @Watch('onPageShowChange') pageShow: number | ||
| 52 | + @State private pageAttentionChange: boolean = false | ||
| 53 | + | ||
| 54 | + build() { | ||
| 55 | + if (this.viewType == ViewType.LOADING) { | ||
| 56 | + this.LoadingLayout() | ||
| 57 | + } else if (this.viewType == ViewType.ERROR) { | ||
| 58 | + ErrorComponent() | ||
| 59 | + } else if (this.viewType == ViewType.EMPTY) { | ||
| 60 | + EmptyComponent() | ||
| 61 | + } else { | ||
| 62 | + if (this.followList.length == 0) { | ||
| 63 | + CustomPullToRefresh({ | ||
| 64 | + alldata: this.rmhList, | ||
| 65 | + scroller: this.scroller, | ||
| 66 | + hasMore: false, | ||
| 67 | + customList: () => { | ||
| 68 | + this.ListLayout() | ||
| 69 | + }, | ||
| 70 | + onRefresh: (resolve) => { | ||
| 71 | + this.currentPage = 1 | ||
| 72 | + this.getData(resolve) | ||
| 73 | + }, | ||
| 74 | + }) | ||
| 75 | + }else { | ||
| 76 | + CustomPullToRefresh({ | ||
| 77 | + alldata: this.attentionList, | ||
| 78 | + scroller: this.listScroller, | ||
| 79 | + hasMore: this.hasMore, | ||
| 80 | + customList: () => { | ||
| 81 | + this.ListAttentionLayout() | ||
| 82 | + }, | ||
| 83 | + onRefresh: (resolve) => { | ||
| 84 | + this.currentPage = 1 | ||
| 85 | + this.getData(resolve) | ||
| 86 | + }, | ||
| 87 | + onLoadMore:(resolve)=> { | ||
| 88 | + if (this.hasMore === false) { | ||
| 89 | + if(resolve) { | ||
| 90 | + resolve('') | ||
| 91 | + } | ||
| 92 | + return | ||
| 93 | + } | ||
| 94 | + if(!this.isLoading && this.hasMore){ | ||
| 95 | + //加载分页数据 | ||
| 96 | + this.currentPage++; | ||
| 97 | + this.getAttentionContentListData(resolve) | ||
| 98 | + }else { | ||
| 99 | + if(resolve) { | ||
| 100 | + resolve('') | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + }, | ||
| 104 | + }) | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + @Builder | ||
| 110 | + LoadingLayout() { | ||
| 111 | + channelSkeleton() | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + @Builder | ||
| 115 | + ListLayout() { | ||
| 116 | + Scroll(this.scroller) { | ||
| 117 | + // 推荐人民号 | ||
| 118 | + PeopleShipRecommendComponent({ | ||
| 119 | + rmhList: this.rmhList, | ||
| 120 | + oneKeyFollow: this.oneKeyFollow, | ||
| 121 | + changeButton: this.changeButton | ||
| 122 | + }) | ||
| 123 | + } | ||
| 124 | + .edgeEffect(EdgeEffect.None) | ||
| 125 | + .scrollBar(BarState.Off) | ||
| 126 | + .width('100%') | ||
| 127 | + .height('100%') | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + @Builder | ||
| 131 | + ListAttentionLayout() { | ||
| 132 | + List({scroller: this.listScroller}){ | ||
| 133 | + // 头部关注列表 | ||
| 134 | + ListItem(){ | ||
| 135 | + PeopleShipAttentionContentListTopComponent({ | ||
| 136 | + followList: this.followList | ||
| 137 | + }) | ||
| 138 | + } | ||
| 139 | + ForEach(this.attentionList, (item: ContentDTO) => { | ||
| 140 | + ListItem() { | ||
| 141 | + CardParser({ contentDTO: item }) | ||
| 142 | + }.width("100%") | ||
| 143 | + .backgroundColor(Color.Transparent) | ||
| 144 | + | ||
| 145 | + }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | ||
| 146 | + | ||
| 147 | + // 加载更多 | ||
| 148 | + ListItem() { | ||
| 149 | + if (!this.hasMore && !this.isLoading) { | ||
| 150 | + NoMoreLayout() | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + .edgeEffect(EdgeEffect.None) | ||
| 155 | + .scrollBar(BarState.Off) | ||
| 156 | + .width('100%') | ||
| 157 | + .height('100%') | ||
| 158 | + | ||
| 159 | + // PeopleShipAttentionContentListComponent({ | ||
| 160 | + // followList: this.followList, | ||
| 161 | + // attentionList: this.attentionList | ||
| 162 | + // }) | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + aboutToAppear() { | ||
| 166 | + if (this.navIndex == this.currentTopNavSelectedIndex && this.viewType == ViewType.LOADING) { | ||
| 167 | + this.getData() | ||
| 168 | + } | ||
| 169 | + // 有登录-退出登录-关注接口等问题 | ||
| 170 | + EmitterUtils.receiveEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION, () => { | ||
| 171 | + Logger.debug('PeopleShipMainComponent', 'PEOPLE_SHIP_ATTENTION') | ||
| 172 | + this.pageAttentionChange = true | ||
| 173 | + }) | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + onChange() { | ||
| 177 | + if (this.navIndex === this.currentTopNavSelectedIndex && (this.viewType == ViewType.LOADING || this.pageAttentionChange)) { | ||
| 178 | + this.getData(); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + private async getData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 183 | + if (this.isLoading) { | ||
| 184 | + if (resolve) { | ||
| 185 | + resolve('已更新至最新') | ||
| 186 | + } | ||
| 187 | + return | ||
| 188 | + } | ||
| 189 | + this.pageAttentionChange = false | ||
| 190 | + this.isLoading = true | ||
| 191 | + this.getInitData() | ||
| 192 | + try { | ||
| 193 | + // 登录后获取 | ||
| 194 | + if (HttpUtils.getUserId()) { | ||
| 195 | + // 获取用户关注人数 | ||
| 196 | + let object = new FollowListDetailRequestItem(-1, 20, 1) | ||
| 197 | + let followInfo = await MinePageDatasModel.getMineFollowListData(object, getContext(this)) | ||
| 198 | + Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(followInfo)}`) | ||
| 199 | + | ||
| 200 | + if (followInfo.list.length == 0) { | ||
| 201 | + this.followList = [] | ||
| 202 | + this.getRmhRecommendInfo(resolve) | ||
| 203 | + } else { | ||
| 204 | + this.followList = [] | ||
| 205 | + // this.followList = followInfo.list | ||
| 206 | + this.followList.push(...followInfo.list) | ||
| 207 | + this.attentionList = [] | ||
| 208 | + this.currentPage = 1 | ||
| 209 | + this.loadTime = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN) | ||
| 210 | + this.getAttentionContentListData(resolve) | ||
| 211 | + } | ||
| 212 | + } else { | ||
| 213 | + this.followList = [] | ||
| 214 | + this.getRmhRecommendInfo(resolve) | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + } catch (exception) { | ||
| 218 | + this.viewType = ViewType.ERROR | ||
| 219 | + this.isLoading = false | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + // 获取人民号号主推荐 | ||
| 224 | + private async getRmhRecommendInfo(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 225 | + try { | ||
| 226 | + // 获取页面信息 | ||
| 227 | + this.rmhList = await PeopleShipMainViewModel.getPeopleRemRecommendInfo() | ||
| 228 | + this.rmhSelectedList = [] | ||
| 229 | + this.rmhList.forEach((item: RmhRecommendDTO) => { | ||
| 230 | + this.rmhSelectedList.push(item.creatorId) | ||
| 231 | + }) | ||
| 232 | + this.viewType = ViewType.LOADED | ||
| 233 | + this.changeButton = false | ||
| 234 | + this.isLoading = false | ||
| 235 | + Logger.debug('PeopleShipMainComponent', 'getRmhRecommendInfo' + `${JSON.stringify(this.rmhList)}`) | ||
| 236 | + if (resolve) { | ||
| 237 | + resolve('已更新至最新') | ||
| 238 | + } | ||
| 239 | + } catch (exception) { | ||
| 240 | + if (resolve) { | ||
| 241 | + resolve('') | ||
| 242 | + } | ||
| 243 | + this.viewType = ViewType.ERROR | ||
| 244 | + this.changeButton = false | ||
| 245 | + this.isLoading = false | ||
| 246 | + } | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + // 获取关注 | ||
| 250 | + private async getAttentionContentListData(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 251 | + if (this.isLoading && this.currentPage != 1) { | ||
| 252 | + if (resolve) { | ||
| 253 | + resolve('') | ||
| 254 | + } | ||
| 255 | + return | ||
| 256 | + } | ||
| 257 | + this.isLoading = true | ||
| 258 | + try { | ||
| 259 | + // 获取列表数据 | ||
| 260 | + let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime) | ||
| 261 | + Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`) | ||
| 262 | + | ||
| 263 | + if (resolve ) { | ||
| 264 | + if (this.currentPage == 1) { | ||
| 265 | + resolve('已更新至最新') | ||
| 266 | + }else { | ||
| 267 | + resolve('') | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + if (listData && listData.list && listData.list.length > 0) { | ||
| 271 | + if (listData.list.length === 20) { | ||
| 272 | + this.hasMore = true; | ||
| 273 | + } else { | ||
| 274 | + this.hasMore = false; | ||
| 275 | + } | ||
| 276 | + if (this.currentPage == 1) { | ||
| 277 | + this.attentionList = [] | ||
| 278 | + } | ||
| 279 | + this.attentionList.push(...listData.list) | ||
| 280 | + } | ||
| 281 | + this.viewType = ViewType.LOADED | ||
| 282 | + this.isLoading = false | ||
| 283 | + } catch (exception) { | ||
| 284 | + this.viewType = ViewType.ERROR | ||
| 285 | + this.isLoading = false | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + // 说是首页必须要调用 | ||
| 290 | + async getInitData() { | ||
| 291 | + Logger.debug('PeopleShipMainComponent', `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); | ||
| 292 | + this.pageModel.pageId = this.pageId; | ||
| 293 | + this.pageModel.groupId = this.pageId; | ||
| 294 | + this.pageModel.channelId = this.channelId; | ||
| 295 | + this.pageModel.currentPage = 1; | ||
| 296 | + PageHelper.getInitData(this.pageModel, this.pageAdvModel) | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + // 点击一键关注 | ||
| 300 | + onOneFollowChange() { | ||
| 301 | + if (this.oneKeyFollow) { | ||
| 302 | + if (this.rmhSelectedList.length > 0) { | ||
| 303 | + if (!HttpUtils.getUserId()) { | ||
| 304 | + this.oneKeyFollow = false | ||
| 305 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 306 | + return | ||
| 307 | + } | ||
| 308 | + //调用接口 | ||
| 309 | + this.attentionBatchPort() | ||
| 310 | + } else { | ||
| 311 | + this.oneKeyFollow = false | ||
| 312 | + } | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + // 一键关注接口 | ||
| 317 | + private async attentionBatchPort() { | ||
| 318 | + try { | ||
| 319 | + // 获取列表数据 | ||
| 320 | + let objects = new AttentionBatchDTO() | ||
| 321 | + this.rmhList.forEach((element: RmhRecommendDTO) => { | ||
| 322 | + if ( this.rmhSelectedList.indexOf(element.creatorId) != -1) { | ||
| 323 | + const creator = new CreatorDTO(element.userType, element.userId, element.creatorId) | ||
| 324 | + objects.creators.push(creator) | ||
| 325 | + } | ||
| 326 | + }) | ||
| 327 | + Logger.debug('PeopleShipMainComponent', `一键关注接口参数: ${JSON.stringify(objects)}`); | ||
| 328 | + let batchInfo = await PeopleShipMainViewModel.getAttentionBatchInfo(objects) | ||
| 329 | + if (batchInfo.code === 0 || batchInfo.code.toString() === "0") { | ||
| 330 | + this.getData() | ||
| 331 | + } | ||
| 332 | + } catch (exception) { | ||
| 333 | + | ||
| 334 | + } | ||
| 335 | + } | ||
| 336 | + | ||
| 337 | + // 点击换一换 | ||
| 338 | + onChangeButtonClick() { | ||
| 339 | + if (this.changeButton) { | ||
| 340 | + this.getRmhRecommendInfo() | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + // 页面展示监听 | ||
| 345 | + onPageShowChange() { | ||
| 346 | + if (this.navIndex === this.currentTopNavSelectedIndex && this.pageAttentionChange ) { | ||
| 347 | + this.getData() | ||
| 348 | + } | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | +} |
| 1 | +import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' | ||
| 2 | +import { RmhRecommendDTO } from 'wdBean'; | ||
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 4 | +import NoMoreLayout from '../page/NoMoreLayout'; | ||
| 5 | + | ||
| 6 | +@Component | ||
| 7 | +export struct PeopleShipRecommendComponent { | ||
| 8 | + @Prop rmhList: RmhRecommendDTO[] = [] | ||
| 9 | + @Consume rmhSelectedList: string[] | ||
| 10 | + // 一键关注处理 | ||
| 11 | + @Link oneKeyFollow: boolean | ||
| 12 | + // 换一换 | ||
| 13 | + @Link changeButton: boolean | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + build() { | ||
| 17 | + Column({ space: 0 }) { | ||
| 18 | + Row() { | ||
| 19 | + Image($r('app.media.redLine')) | ||
| 20 | + .width('3vp') | ||
| 21 | + .height('16vp') | ||
| 22 | + .objectFit(ImageFit.Cover) | ||
| 23 | + .margin({ | ||
| 24 | + left: '16vp', | ||
| 25 | + right: '4vp' | ||
| 26 | + }) | ||
| 27 | + Text('为你推荐优质号主') | ||
| 28 | + .height('30vp') | ||
| 29 | + .fontColor($r('app.color.color_222222')) | ||
| 30 | + .fontWeight(600) | ||
| 31 | + .fontSize($r('app.float.vp_18')) | ||
| 32 | + | ||
| 33 | + Blank() | ||
| 34 | + Button({ type: ButtonType.Normal, stateEffect: true }) { | ||
| 35 | + Row() { | ||
| 36 | + Text('换一换') | ||
| 37 | + .height('30vp') | ||
| 38 | + .fontColor($r('app.color.color_999999')) | ||
| 39 | + .fontWeight(400) | ||
| 40 | + .fontSize($r('app.float.vp_14')) | ||
| 41 | + Image($r('app.media.ic_refresh')) | ||
| 42 | + .width('14vp') | ||
| 43 | + .height('14vp') | ||
| 44 | + .objectFit(ImageFit.Cover) | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + .margin({ | ||
| 48 | + right: '16vp' | ||
| 49 | + }) | ||
| 50 | + .backgroundColor(Color.Transparent) | ||
| 51 | + .onClick(() => { | ||
| 52 | + // 点击换一换 | ||
| 53 | + if (!this.changeButton) { | ||
| 54 | + this.changeButton = true | ||
| 55 | + } | ||
| 56 | + }) | ||
| 57 | + } | ||
| 58 | + .width('100%') | ||
| 59 | + .alignSelf(ItemAlign.Start) | ||
| 60 | + .margin({ | ||
| 61 | + top: '10vp', | ||
| 62 | + bottom: '10vp' | ||
| 63 | + }) | ||
| 64 | + | ||
| 65 | + Grid() { | ||
| 66 | + ForEach(this.rmhList, (item: RmhRecommendDTO) => { | ||
| 67 | + GridItem() { | ||
| 68 | + PeopleShipRecommendHeadComponent({ | ||
| 69 | + rmhInfo: item | ||
| 70 | + }) | ||
| 71 | + .onClick(() => { | ||
| 72 | + this.clickRecommendHeadSelected(item) | ||
| 73 | + }) | ||
| 74 | + } | ||
| 75 | + }, (item: RmhRecommendDTO) => item.creatorId) | ||
| 76 | + } | ||
| 77 | + .columnsTemplate('1fr 1fr 1fr') | ||
| 78 | + .columnsGap(20) | ||
| 79 | + .rowsGap(20) | ||
| 80 | + .height(Math.ceil(this.rmhList.length / 3.0) * 136) | ||
| 81 | + .backgroundColor(Color.Transparent) | ||
| 82 | + .margin({ | ||
| 83 | + right: '20vp', | ||
| 84 | + left: '20pv' | ||
| 85 | + }) | ||
| 86 | + | ||
| 87 | + // 为你推荐 | ||
| 88 | + Button(this.rmhSelectedList.length == 0 ? '一键关注' : `一键关注 (${this.rmhSelectedList.length})`, { type: ButtonType.Normal, stateEffect: this.rmhSelectedList.length != 0 }) | ||
| 89 | + .margin({ | ||
| 90 | + top: '24vp' | ||
| 91 | + }) | ||
| 92 | + .width('120vp') | ||
| 93 | + .height('36vp') | ||
| 94 | + .backgroundColor(this.rmhSelectedList.length != 0 ? $r('app.color.color_ED2800') : $r('app.color.color_B0B0B0')) | ||
| 95 | + .borderRadius('3vp') | ||
| 96 | + .fontColor($r('app.color.color_999999')) | ||
| 97 | + .fontWeight(500) | ||
| 98 | + .fontSize($r('app.float.vp_14')) | ||
| 99 | + .fontColor(Color.White) | ||
| 100 | + .onClick(() => { | ||
| 101 | + // 点击一键关注 | ||
| 102 | + if (!this.oneKeyFollow && this.rmhSelectedList.length > 0 ){ | ||
| 103 | + this.oneKeyFollow = true | ||
| 104 | + } | ||
| 105 | + }) | ||
| 106 | + // 没有更多 | ||
| 107 | + NoMoreLayout() | ||
| 108 | + } | ||
| 109 | + .width('100%') | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + // 选中 | ||
| 113 | + private clickRecommendHeadSelected(rmhInfo: RmhRecommendDTO) { | ||
| 114 | + if (this.rmhSelectedList.length > 0 && rmhInfo ) { | ||
| 115 | + const num = this.rmhSelectedList.indexOf(rmhInfo.creatorId) | ||
| 116 | + if ( num != -1) { | ||
| 117 | + this.rmhSelectedList.splice(num, 1) | ||
| 118 | + }else { | ||
| 119 | + this.rmhSelectedList.push(rmhInfo.creatorId) | ||
| 120 | + } | ||
| 121 | + }else { | ||
| 122 | + this.rmhSelectedList.push(rmhInfo.creatorId) | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | +} |
| 1 | +import { RmhRecommendDTO } from 'wdBean'; | ||
| 2 | +import { ToastUtils } from 'wdKit/Index'; | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct PeopleShipRecommendHeadComponent { | ||
| 6 | + @State isSelected: boolean = true | ||
| 7 | + @Consume rmhSelectedList: string[] | ||
| 8 | + @State rmhInfo: RmhRecommendDTO = {} as RmhRecommendDTO | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Column(){ | ||
| 12 | + Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 13 | + Image(this.rmhInfo.headPhotoUrl.length > 0 ? this.rmhInfo.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')) | ||
| 14 | + .width('44vp') | ||
| 15 | + .height('44vp') | ||
| 16 | + .borderRadius('22vp') | ||
| 17 | + .objectFit(ImageFit.Cover) | ||
| 18 | + | ||
| 19 | + Image( this.isSelectedRmhInfo() ? $r('app.media.rmh_selected') : $r('app.media.rmh_unselected') ) | ||
| 20 | + .width('18vp') | ||
| 21 | + .height('18vp') | ||
| 22 | + .objectFit(ImageFit.Cover) | ||
| 23 | + .margin({ | ||
| 24 | + right: '-3vp' | ||
| 25 | + }) | ||
| 26 | + }.margin({ top: 12, bottom: 8 }) | ||
| 27 | + | ||
| 28 | + Text(this.rmhInfo.userName) | ||
| 29 | + .fontColor($r('app.color.color_222222')) | ||
| 30 | + .fontSize($r('app.float.vp_14')) | ||
| 31 | + .fontWeight(600) | ||
| 32 | + .maxLines(1) | ||
| 33 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 34 | + | ||
| 35 | + Text(this.rmhInfo.introduction) | ||
| 36 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 37 | + .fontSize($r('app.float.vp_12')) | ||
| 38 | + .margin({ top: 8, bottom: 14 }) | ||
| 39 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 40 | + .maxLines(2) | ||
| 41 | + .height(34) | ||
| 42 | + } | ||
| 43 | + .width('100%') | ||
| 44 | + .height('116vp') | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + private isSelectedRmhInfo() { | ||
| 49 | + if (this.rmhSelectedList.length > 0 && this.rmhInfo ) { | ||
| 50 | + if (this.rmhSelectedList.indexOf(this.rmhInfo.creatorId) != -1) { | ||
| 51 | + return true | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + return false | ||
| 55 | + } | ||
| 56 | +} |
| @@ -20,7 +20,6 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | @@ -20,7 +20,6 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | ||
| 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' | 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' |
| 21 | import { ErrorComponent } from '../view/ErrorComponent'; | 21 | import { ErrorComponent } from '../view/ErrorComponent'; |
| 22 | import NoMoreLayout from '../page/NoMoreLayout'; | 22 | import NoMoreLayout from '../page/NoMoreLayout'; |
| 23 | -// import { LazyDataSource } from 'wdKit'; | ||
| 24 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' | 23 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' |
| 25 | 24 | ||
| 26 | const TAG = 'PeopleShipHomeArticleListComponent'; | 25 | const TAG = 'PeopleShipHomeArticleListComponent'; |
| @@ -36,7 +36,7 @@ export struct PeopleShipHomePageNavComponent { | @@ -36,7 +36,7 @@ export struct PeopleShipHomePageNavComponent { | ||
| 36 | PeopleShipHomePageHeadComponent({ | 36 | PeopleShipHomePageHeadComponent({ |
| 37 | diameter: 30, | 37 | diameter: 30, |
| 38 | iconDiameter: 10, | 38 | iconDiameter: 10, |
| 39 | - headPhotoUrl: this.detailModel.headPhotoUrl, | 39 | + headPhotoUrl: (this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0 ) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'), |
| 40 | authIcon: this.detailModel.authIcon | 40 | authIcon: this.detailModel.authIcon |
| 41 | }) | 41 | }) |
| 42 | .margin({ | 42 | .margin({ |
| @@ -2,13 +2,13 @@ | @@ -2,13 +2,13 @@ | ||
| 2 | export struct PeopleShipHomePageHeadComponent { | 2 | export struct PeopleShipHomePageHeadComponent { |
| 3 | @State diameter: number = 30 | 3 | @State diameter: number = 30 |
| 4 | @State iconDiameter: number = 10 | 4 | @State iconDiameter: number = 10 |
| 5 | - @Prop headPhotoUrl: string = '' | 5 | + @Prop headPhotoUrl: string | ResourceStr = '' |
| 6 | @Prop authIcon: string = '' | 6 | @Prop authIcon: string = '' |
| 7 | 7 | ||
| 8 | build() { | 8 | build() { |
| 9 | Stack({ alignContent: Alignment.BottomEnd }) { | 9 | Stack({ alignContent: Alignment.BottomEnd }) { |
| 10 | // 头像 | 10 | // 头像 |
| 11 | - Image( this.headPhotoUrl.length > 0 ? this.headPhotoUrl : $r('app.media.home_page_header_authority') ) | 11 | + Image( this.headPhotoUrl ) |
| 12 | .width(this.diameter) | 12 | .width(this.diameter) |
| 13 | .height(this.diameter) | 13 | .height(this.diameter) |
| 14 | .borderRadius(this.diameter/2) | 14 | .borderRadius(this.diameter/2) |
| @@ -16,6 +16,7 @@ export struct PeopleShipHomePageHeadComponent { | @@ -16,6 +16,7 @@ export struct PeopleShipHomePageHeadComponent { | ||
| 16 | .borderStyle(BorderStyle.Solid) | 16 | .borderStyle(BorderStyle.Solid) |
| 17 | .borderColor(Color.White) | 17 | .borderColor(Color.White) |
| 18 | .objectFit(ImageFit.Cover) | 18 | .objectFit(ImageFit.Cover) |
| 19 | + .backgroundColor(Color.White) | ||
| 19 | if(this.authIcon.length > 0 ) { | 20 | if(this.authIcon.length > 0 ) { |
| 20 | Image( this.authIcon ) | 21 | Image( this.authIcon ) |
| 21 | .width(this.iconDiameter) | 22 | .width(this.iconDiameter) |
| @@ -46,7 +46,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -46,7 +46,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 46 | PeopleShipHomePageHeadComponent({ | 46 | PeopleShipHomePageHeadComponent({ |
| 47 | diameter: 80, | 47 | diameter: 80, |
| 48 | iconDiameter: 20, | 48 | iconDiameter: 20, |
| 49 | - headPhotoUrl: this.detailModel.headPhotoUrl, | 49 | + headPhotoUrl:(this.detailModel.headPhotoUrl && this.detailModel.headPhotoUrl.length > 0) ? this.detailModel.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon') , |
| 50 | authIcon: this.detailModel.authIcon | 50 | authIcon: this.detailModel.authIcon |
| 51 | }).margin({ | 51 | }).margin({ |
| 52 | left: '10vp', | 52 | left: '10vp', |
| 1 | 1 | ||
| 2 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; | 2 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; |
| 3 | -import { Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit'; | 3 | +import { Logger, SPHelper, ToastUtils, UserDataLocal, EmitterEventId, EmitterUtils } from 'wdKit'; |
| 4 | import { TopNavigationComponent } from '../page/TopNavigationComponent'; | 4 | import { TopNavigationComponent } from '../page/TopNavigationComponent'; |
| 5 | import PageViewModel from '../../viewmodel/PageViewModel'; | 5 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 6 | import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem'; | 6 | import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem'; |
| @@ -430,7 +430,7 @@ export struct AccountAndSecurityLayout { | @@ -430,7 +430,7 @@ export struct AccountAndSecurityLayout { | ||
| 430 | let login = new LoginViewModel; | 430 | let login = new LoginViewModel; |
| 431 | login.logOut().then(()=>{ | 431 | login.logOut().then(()=>{ |
| 432 | promptAction.showToast({ message: '退出登录' }) | 432 | promptAction.showToast({ message: '退出登录' }) |
| 433 | - router.back(); | 433 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) |
| 434 | router.back(); | 434 | router.back(); |
| 435 | }).catch((error:string)=>{ | 435 | }).catch((error:string)=>{ |
| 436 | promptAction.showToast({ message: error }) | 436 | promptAction.showToast({ message: error }) |
| @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI | @@ -4,7 +4,7 @@ import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsI | ||
| 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; | 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; |
| 5 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 5 | import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; | 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; |
| 7 | -import { Logger, StringUtils } from 'wdKit'; | 7 | +import { Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; | 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; |
| 9 | import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; | 9 | import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; |
| 10 | import { FollowListItem } from '../viewmodel/FollowListItem'; | 10 | import { FollowListItem } from '../viewmodel/FollowListItem'; |
| @@ -545,6 +545,7 @@ class MinePageDatasModel{ | @@ -545,6 +545,7 @@ class MinePageDatasModel{ | ||
| 545 | return | 545 | return |
| 546 | } | 546 | } |
| 547 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | 547 | Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); |
| 548 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 548 | success(navResDTO); | 549 | success(navResDTO); |
| 549 | }).catch((err: Error) => { | 550 | }).catch((err: Error) => { |
| 550 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 551 | Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); |
| 1 | import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 1 | import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 2 | -import { DateTimeUtils, Logger, StringUtils } from 'wdKit'; | 2 | +import { DateTimeUtils, Logger, StringUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 3 | + | ||
| 3 | import { | 4 | import { |
| 4 | batchLikeAndCollectResult, | 5 | batchLikeAndCollectResult, |
| 5 | CompInfoBean, | 6 | CompInfoBean, |
| @@ -313,10 +314,32 @@ export class PageRepository { | @@ -313,10 +314,32 @@ export class PageRepository { | ||
| 313 | /** | 314 | /** |
| 314 | * 关注号主 | 315 | * 关注号主 |
| 315 | */ | 316 | */ |
| 316 | - static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | 317 | + private static postInteractAccentionOperateInfo(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { |
| 317 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION | 318 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION |
| 318 | return WDHttp.post(url, params) | 319 | return WDHttp.post(url, params) |
| 319 | } | 320 | } |
| 321 | + /** | ||
| 322 | + * 关注号主 | ||
| 323 | + */ | ||
| 324 | + static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | ||
| 325 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 326 | + Logger.debug(TAG, `postInteractAccentionOperate pageInfo start`); | ||
| 327 | + PageRepository.postInteractAccentionOperateInfo(params) | ||
| 328 | + .then((resDTO: ResponseDTO) => { | ||
| 329 | + if (!resDTO || resDTO.code != 0) { | ||
| 330 | + error(null) | ||
| 331 | + return | ||
| 332 | + } | ||
| 333 | + Logger.debug(TAG, "postInteractAccentionOperate then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 334 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 335 | + success(resDTO); | ||
| 336 | + }) | ||
| 337 | + .catch((err: Error) => { | ||
| 338 | + Logger.error(TAG, `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 339 | + error(err); | ||
| 340 | + }) | ||
| 341 | + }) | ||
| 342 | + } | ||
| 320 | 343 | ||
| 321 | static fetchNewspaperInfo(date: string) { | 344 | static fetchNewspaperInfo(date: string) { |
| 322 | let url = PageRepository.getNewspaperInfoUrl(date) | 345 | let url = PageRepository.getNewspaperInfoUrl(date) |
| 1 | +import { Logger } from 'wdKit'; | ||
| 2 | +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 3 | +import HashMap from '@ohos.util.HashMap'; | ||
| 4 | +import { | ||
| 5 | + RmhRecommendDTO, | ||
| 6 | + PeopleShipContentListDTO, | ||
| 7 | + AttentionBatchDTO | ||
| 8 | +} from 'wdBean'; | ||
| 9 | + | ||
| 10 | +const TAG = 'PeopleShipMainViewModel' | ||
| 11 | + | ||
| 12 | +export class PeopleShipMainViewModel { | ||
| 13 | + | ||
| 14 | + /*人民号号主推荐*/ | ||
| 15 | + static fetchPeopleRemRecommendData() { | ||
| 16 | + let url = HttpUrlUtils.getRmhRecommendUrl() | ||
| 17 | + let bean: Record<string, string> = {}; | ||
| 18 | + return WDHttp.post<ResponseDTO<RmhRecommendDTO[]>>(url, bean) | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + static async getPeopleRemRecommendInfo(): Promise<RmhRecommendDTO[]> { | ||
| 22 | + return new Promise<RmhRecommendDTO[]>((success, error) => { | ||
| 23 | + Logger.debug(TAG, `getMorningEveningCompInfo pageInfo start`); | ||
| 24 | + PeopleShipMainViewModel.fetchPeopleRemRecommendData() | ||
| 25 | + .then((resDTO: ResponseDTO<RmhRecommendDTO[]>) => { | ||
| 26 | + if (!resDTO || !resDTO.data) { | ||
| 27 | + Logger.error(TAG, 'getPeopleRemRecommendInfo then navResDTO is empty'); | ||
| 28 | + error('resDTO is empty'); | ||
| 29 | + return | ||
| 30 | + } | ||
| 31 | + if (resDTO.code != 0) { | ||
| 32 | + Logger.error(TAG, `getPeopleRemRecommendInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 33 | + error('resDTO Response Code is failure'); | ||
| 34 | + return | ||
| 35 | + } | ||
| 36 | + Logger.debug(TAG, "getPeopleRemRecommendInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 37 | + success(resDTO.data); | ||
| 38 | + }) | ||
| 39 | + .catch((err: Error) => { | ||
| 40 | + Logger.error(TAG, `getPeopleRemRecommendInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 41 | + error(err); | ||
| 42 | + }) | ||
| 43 | + }) | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /*关注号主发布内容接口*/ | ||
| 47 | + static fetchAttentionContentListData(pageNum: number, pageSize: number, time: string) { | ||
| 48 | + let url = HttpUrlUtils.getAttentionContentListUrl() | ||
| 49 | + let params: Record<string, Object> = {}; | ||
| 50 | + params['pageNum'] = pageNum | ||
| 51 | + params['pageSize'] = pageSize | ||
| 52 | + params['time'] = time | ||
| 53 | + return WDHttp.post<ResponseDTO<PeopleShipContentListDTO>>(url, params) | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + static async getAttentionContentListInfo(pageNum:number, pageSize: number, time: string): Promise<PeopleShipContentListDTO> { | ||
| 57 | + return new Promise<PeopleShipContentListDTO>((success, error) => { | ||
| 58 | + Logger.debug(TAG, `getAttentionContentListInfo pageInfo start`); | ||
| 59 | + PeopleShipMainViewModel.fetchAttentionContentListData(pageNum, pageSize, time) | ||
| 60 | + .then((resDTO: ResponseDTO<PeopleShipContentListDTO>) => { | ||
| 61 | + if (!resDTO || !resDTO.data) { | ||
| 62 | + Logger.error(TAG, 'getAttentionContentListInfo then navResDTO is empty'); | ||
| 63 | + error('resDTO is empty'); | ||
| 64 | + return | ||
| 65 | + } | ||
| 66 | + if (resDTO.code != 0) { | ||
| 67 | + Logger.error(TAG, `getAttentionContentListInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 68 | + error('resDTO Response Code is failure'); | ||
| 69 | + return | ||
| 70 | + } | ||
| 71 | + Logger.debug(TAG, "getAttentionContentListInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 72 | + success(resDTO.data); | ||
| 73 | + }) | ||
| 74 | + .catch((err: Error) => { | ||
| 75 | + Logger.error(TAG, `getAttentionContentListInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 76 | + error(err); | ||
| 77 | + }) | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + /*一键关注接口*/ | ||
| 82 | + static fetchAttentionBatchData(params: AttentionBatchDTO) { | ||
| 83 | + let url = HttpUrlUtils.getAttentionBatchUrl() | ||
| 84 | + return WDHttp.post<ResponseDTO>(url, params) | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + static async getAttentionBatchInfo(params: AttentionBatchDTO): Promise<ResponseDTO> { | ||
| 88 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 89 | + Logger.debug(TAG, `getAttentionBatchInfo pageInfo start`); | ||
| 90 | + PeopleShipMainViewModel.fetchAttentionBatchData(params) | ||
| 91 | + .then((resDTO: ResponseDTO) => { | ||
| 92 | + if (!resDTO || resDTO.code != 0) { | ||
| 93 | + error(resDTO.message) | ||
| 94 | + return | ||
| 95 | + } | ||
| 96 | + Logger.debug(TAG, "getAttentionBatchInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 97 | + success(resDTO); | ||
| 98 | + }) | ||
| 99 | + .catch((err: Error) => { | ||
| 100 | + Logger.error(TAG, `getAttentionBatchInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 101 | + error(err); | ||
| 102 | + }) | ||
| 103 | + }) | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + | ||
| 107 | +} |
5.05 KB
| 1 | -import { Logger, ResourcesUtils } from 'wdKit'; | 1 | +import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit'; |
| 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; | 3 | import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| @@ -321,8 +321,32 @@ export class ContentDetailRequest { | @@ -321,8 +321,32 @@ export class ContentDetailRequest { | ||
| 321 | /** | 321 | /** |
| 322 | * 关注号主 | 322 | * 关注号主 |
| 323 | */ | 323 | */ |
| 324 | - static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | 324 | + private static postInteractAccentionOperateInfo(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { |
| 325 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION | 325 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION |
| 326 | return WDHttp.post(url, params) | 326 | return WDHttp.post(url, params) |
| 327 | } | 327 | } |
| 328 | + | ||
| 329 | + /** | ||
| 330 | + * 关注号主 | ||
| 331 | + */ | ||
| 332 | + static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> { | ||
| 333 | + return new Promise<ResponseDTO>((success, error) => { | ||
| 334 | + Logger.debug(TAG, `postInteractAccentionOperate pageInfo start`); | ||
| 335 | + ContentDetailRequest.postInteractAccentionOperateInfo(params) | ||
| 336 | + .then((resDTO: ResponseDTO) => { | ||
| 337 | + if (!resDTO || resDTO.code != 0) { | ||
| 338 | + error(null) | ||
| 339 | + return | ||
| 340 | + } | ||
| 341 | + Logger.debug(TAG, "postInteractAccentionOperate then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 342 | + // 关注号后发送-更新关注页面 | ||
| 343 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 344 | + success(resDTO); | ||
| 345 | + }) | ||
| 346 | + .catch((err: Error) => { | ||
| 347 | + Logger.error(TAG, `postInteractAccentionOperate catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 348 | + error(err); | ||
| 349 | + }) | ||
| 350 | + }) | ||
| 351 | + } | ||
| 328 | } | 352 | } |
| 1 | -import { Logger } from 'wdKit/src/main/ets/utils/Logger' | 1 | +import { Logger, EmitterEventId, EmitterUtils } from 'wdKit' |
| 2 | import { CustomProtocolDialog } from './CustomProtocolDialog' | 2 | import { CustomProtocolDialog } from './CustomProtocolDialog' |
| 3 | import router from '@ohos.router' | 3 | import router from '@ohos.router' |
| 4 | import { LoginViewModel } from './LoginViewModel' | 4 | import { LoginViewModel } from './LoginViewModel' |
| @@ -325,6 +325,7 @@ struct LoginPage { | @@ -325,6 +325,7 @@ struct LoginPage { | ||
| 325 | let interestsModel = new InterestsHobbiesModel() | 325 | let interestsModel = new InterestsHobbiesModel() |
| 326 | interestsModel.updateInterests() | 326 | interestsModel.updateInterests() |
| 327 | this.queryUserDetail() | 327 | this.queryUserDetail() |
| 328 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 328 | }).catch((error:string)=>{ | 329 | }).catch((error:string)=>{ |
| 329 | promptAction.showToast({ message: error }) | 330 | promptAction.showToast({ message: error }) |
| 330 | }) | 331 | }) |
| @@ -332,11 +333,12 @@ struct LoginPage { | @@ -332,11 +333,12 @@ struct LoginPage { | ||
| 332 | this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { | 333 | this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { |
| 333 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) | 334 | Logger.debug(TAG, "requestLogin: " + data.jwtToken) |
| 334 | promptAction.showToast({ message: '登录成功' }) | 335 | promptAction.showToast({ message: '登录成功' }) |
| 335 | - | ||
| 336 | ///同步兴趣tag | 336 | ///同步兴趣tag |
| 337 | let interestsModel = new InterestsHobbiesModel() | 337 | let interestsModel = new InterestsHobbiesModel() |
| 338 | interestsModel.updateInterests() | 338 | interestsModel.updateInterests() |
| 339 | this.queryUserDetail() | 339 | this.queryUserDetail() |
| 340 | + EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 341 | + | ||
| 340 | // router.back({ | 342 | // router.back({ |
| 341 | // params: { userName: data.userName, | 343 | // params: { userName: data.userName, |
| 342 | // userId:data.id}, | 344 | // userId:data.id}, |
-
Please register or login to post a comment