Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
10 changed files
with
237 additions
and
146 deletions
| @@ -33,9 +33,9 @@ export struct ZhSingleColumn09 { | @@ -33,9 +33,9 @@ export struct ZhSingleColumn09 { | ||
| 33 | try { | 33 | try { |
| 34 | const contentDTO = this.compDTO.operDataList[0]; | 34 | const contentDTO = this.compDTO.operDataList[0]; |
| 35 | const extParams: ParamType = { | 35 | const extParams: ParamType = { |
| 36 | - 'value': type === 'close_interest_card_click' ? 'closeInterestCard' : 'selectInterestCard', | 36 | + 'action': type === 'close_interest_card_click' ? 'closeInterestCard' : 'selectInterestCard', |
| 37 | 'duration': 0, | 37 | 'duration': 0, |
| 38 | - 'action': 'detailPageShow', | 38 | + // 'action': 'detailPageShow', |
| 39 | 'shareChannel': '', | 39 | 'shareChannel': '', |
| 40 | 'contentName': '兴趣选项卡', | 40 | 'contentName': '兴趣选项卡', |
| 41 | 'contentType': this.compDTO.objectType || '', | 41 | 'contentType': this.compDTO.objectType || '', |
| @@ -109,6 +109,7 @@ export struct HomePageBottomFollowComponent { | @@ -109,6 +109,7 @@ export struct HomePageBottomFollowComponent { | ||
| 109 | CustomPullToRefresh({ | 109 | CustomPullToRefresh({ |
| 110 | alldata:this.data_follow, | 110 | alldata:this.data_follow, |
| 111 | scroller:this.scroller, | 111 | scroller:this.scroller, |
| 112 | + hasMore:this.hasMore, | ||
| 112 | customList:()=>{ | 113 | customList:()=>{ |
| 113 | this.ListLayout() | 114 | this.ListLayout() |
| 114 | }, | 115 | }, |
| @@ -128,6 +129,7 @@ export struct HomePageBottomFollowComponent { | @@ -128,6 +129,7 @@ export struct HomePageBottomFollowComponent { | ||
| 128 | this.isLoading = true | 129 | this.isLoading = true |
| 129 | //加载分页数据 | 130 | //加载分页数据 |
| 130 | this.getNewPageData() | 131 | this.getNewPageData() |
| 132 | + if(resolve) resolve('刷新成功') | ||
| 131 | } | 133 | } |
| 132 | } | 134 | } |
| 133 | }) | 135 | }) |
| @@ -197,7 +199,7 @@ export struct HomePageBottomFollowComponent { | @@ -197,7 +199,7 @@ export struct HomePageBottomFollowComponent { | ||
| 197 | 199 | ||
| 198 | getMyFollowListDetail() { | 200 | getMyFollowListDetail() { |
| 199 | if (this.hasMore) { | 201 | if (this.hasMore) { |
| 200 | - let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum) | 202 | + let object = new FollowListDetailRequestItem(-1, 10, this.curPageNum) |
| 201 | 203 | ||
| 202 | MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => { | 204 | MinePageDatasModel.getMineFollowListData(object, getContext(this)).then((value) => { |
| 203 | if (this.curPageNum === 1) this.data_follow.clear() | 205 | if (this.curPageNum === 1) this.data_follow.clear() |
| @@ -222,7 +224,7 @@ export struct HomePageBottomFollowComponent { | @@ -222,7 +224,7 @@ export struct HomePageBottomFollowComponent { | ||
| 222 | }) | 224 | }) |
| 223 | this.data_follow.notifyDataReload() | 225 | this.data_follow.notifyDataReload() |
| 224 | this.count = this.data_follow.totalCount() | 226 | this.count = this.data_follow.totalCount() |
| 225 | - if (this.data_follow.totalCount() < value.totalCount) { | 227 | + if (value.hasNext === 1) { |
| 226 | this.curPageNum++ | 228 | this.curPageNum++ |
| 227 | } else { | 229 | } else { |
| 228 | this.hasMore = false | 230 | this.hasMore = false |
| @@ -70,6 +70,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -70,6 +70,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 70 | CustomPullToRefresh({ | 70 | CustomPullToRefresh({ |
| 71 | alldata:this.data_follow, | 71 | alldata:this.data_follow, |
| 72 | scroller:this.scroller, | 72 | scroller:this.scroller, |
| 73 | + hasMore:this.hasMore, | ||
| 73 | customList:()=>{ | 74 | customList:()=>{ |
| 74 | this.ListLayout() | 75 | this.ListLayout() |
| 75 | }, | 76 | }, |
| @@ -89,6 +90,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -89,6 +90,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 89 | this.isLoading = true | 90 | this.isLoading = true |
| 90 | //加载分页数据 | 91 | //加载分页数据 |
| 91 | this.getNewPageData() | 92 | this.getNewPageData() |
| 93 | + if(resolve) resolve('刷新成功') | ||
| 92 | } | 94 | } |
| 93 | } | 95 | } |
| 94 | }) | 96 | }) |
| @@ -160,7 +162,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -160,7 +162,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 160 | this.isLoading = true | 162 | this.isLoading = true |
| 161 | //关注列表 | 163 | //关注列表 |
| 162 | if(this.hasMore){ | 164 | if(this.hasMore){ |
| 163 | - let object = new UserFollowListRequestItem(Number(this.curUserId),20,this.curPageNum,"1") | 165 | + let object = new UserFollowListRequestItem(Number(this.curUserId),10,this.curPageNum,"1") |
| 164 | 166 | ||
| 165 | MinePageDatasModel.getOtherUserFollowListData(object,getContext(this)).then((value)=>{ | 167 | MinePageDatasModel.getOtherUserFollowListData(object,getContext(this)).then((value)=>{ |
| 166 | 168 | ||
| @@ -186,7 +188,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -186,7 +188,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 186 | this.data_follow.notifyDataReload() | 188 | this.data_follow.notifyDataReload() |
| 187 | this.count = this.data_follow.totalCount() | 189 | this.count = this.data_follow.totalCount() |
| 188 | 190 | ||
| 189 | - if (this.data_follow.totalCount() < value.totalCount) { | 191 | + if (value.hasNext === 1) { |
| 190 | this.curPageNum++ | 192 | this.curPageNum++ |
| 191 | }else { | 193 | }else { |
| 192 | this.hasMore = false | 194 | this.hasMore = false |
| @@ -665,7 +665,7 @@ export struct PaperSingleColumn999CardView { | @@ -665,7 +665,7 @@ export struct PaperSingleColumn999CardView { | ||
| 665 | buildSourceString(): string { | 665 | buildSourceString(): string { |
| 666 | let contentString: string = '' | 666 | let contentString: string = '' |
| 667 | if (this.item?.rmhInfo?.rmhName.length > 0) { | 667 | if (this.item?.rmhInfo?.rmhName.length > 0) { |
| 668 | - contentString = this.item?.rmhInfo?.rmhName | 668 | + // contentString = this.item?.rmhInfo?.rmhName |
| 669 | }else if(this.item?.source.length > 0){ | 669 | }else if(this.item?.source.length > 0){ |
| 670 | contentString = this.item?.source | 670 | contentString = this.item?.source |
| 671 | } | 671 | } |
| @@ -12,7 +12,9 @@ const MORE_CHANNEL: string = '更多频道' | @@ -12,7 +12,9 @@ const MORE_CHANNEL: string = '更多频道' | ||
| 12 | const LOCAL_CHANNEL: string = '地方频道' | 12 | const LOCAL_CHANNEL: string = '地方频道' |
| 13 | 13 | ||
| 14 | const TAG: string = 'ChannelSubscriptionLayout' | 14 | const TAG: string = 'ChannelSubscriptionLayout' |
| 15 | + | ||
| 15 | export { ChannelSubscriptionLayout } | 16 | export { ChannelSubscriptionLayout } |
| 17 | + | ||
| 16 | @Component | 18 | @Component |
| 17 | struct ChannelSubscriptionLayout { | 19 | struct ChannelSubscriptionLayout { |
| 18 | @State indexSettingArray: string [] = ['推荐', '热点'] | 20 | @State indexSettingArray: string [] = ['推荐', '热点'] |
| @@ -20,14 +22,13 @@ struct ChannelSubscriptionLayout { | @@ -20,14 +22,13 @@ struct ChannelSubscriptionLayout { | ||
| 20 | @Link currentTopNavSelectedIndex: number; | 22 | @Link currentTopNavSelectedIndex: number; |
| 21 | @Prop homeChannelList: TopNavDTO [] | 23 | @Prop homeChannelList: TopNavDTO [] |
| 22 | // 我的频道栏目的频道信息数组 | 24 | // 我的频道栏目的频道信息数组 |
| 23 | - @Link myChannelList: TopNavDTO [] | 25 | + @Link @Watch('changeMyChannelData') myChannelList: TopNavDTO [] |
| 24 | // 更多频道栏目频道信息数组 | 26 | // 更多频道栏目频道信息数组 |
| 25 | @Link moreChannelList: TopNavDTO [] | 27 | @Link moreChannelList: TopNavDTO [] |
| 26 | // 地方频道栏目频道信息数组 | 28 | // 地方频道栏目频道信息数组 |
| 27 | @Link localChannelList: TopNavDTO [] | 29 | @Link localChannelList: TopNavDTO [] |
| 28 | // 收集到的我的频道栏目中的频道id | 30 | // 收集到的我的频道栏目中的频道id |
| 29 | @State channelIds: number [] = [] | 31 | @State channelIds: number [] = [] |
| 30 | - | ||
| 31 | @State isShow: boolean = false | 32 | @State isShow: boolean = false |
| 32 | @State dragItem: number = -1 | 33 | @State dragItem: number = -1 |
| 33 | private dragRefOffsetX: number = 0 | 34 | private dragRefOffsetX: number = 0 |
| @@ -38,17 +39,14 @@ struct ChannelSubscriptionLayout { | @@ -38,17 +39,14 @@ struct ChannelSubscriptionLayout { | ||
| 38 | private FIX_VP_Y: number = 48 | 39 | private FIX_VP_Y: number = 48 |
| 39 | @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 | 40 | @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 |
| 40 | @State isEditIng: boolean = false | 41 | @State isEditIng: boolean = false |
| 41 | - // @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO | ||
| 42 | changeTab: (index: number) => void = () => { | 42 | changeTab: (index: number) => void = () => { |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | aboutToAppear() { | 45 | aboutToAppear() { |
| 46 | - // this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex] | ||
| 47 | - this.myChannelList.forEach(item => { | ||
| 48 | - if(item != undefined && item.channelId != undefined){ | ||
| 49 | - this.channelIds.push(item.channelId) | ||
| 50 | - } | ||
| 51 | - }) | 46 | + this.changeMyChannelData() |
| 47 | + } | ||
| 48 | + | ||
| 49 | + aboutToDisappear(): void { | ||
| 52 | } | 50 | } |
| 53 | 51 | ||
| 54 | //交换我的频道数组中的位置 | 52 | //交换我的频道数组中的位置 |
| @@ -79,24 +77,22 @@ struct ChannelSubscriptionLayout { | @@ -79,24 +77,22 @@ struct ChannelSubscriptionLayout { | ||
| 79 | 77 | ||
| 80 | 78 | ||
| 81 | // 删除频道的索引值大于 我的栏目中频道最大索引值 | 79 | // 删除频道的索引值大于 我的栏目中频道最大索引值 |
| 82 | - if(this.currentTopNavSelectedIndex > this.channelIds.length-1){ | 80 | + if (this.currentTopNavSelectedIndex > this.channelIds.length - 1) { |
| 83 | //使用默认频道 | 81 | //使用默认频道 |
| 84 | //缓存首页频道 | 82 | //缓存首页频道 |
| 85 | let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) | 83 | let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) |
| 86 | - console.debug('TopNavigationComponent','index='+index) | ||
| 87 | if (index > -1) { | 84 | if (index > -1) { |
| 88 | this.currentTopNavSelectedIndex = index | 85 | this.currentTopNavSelectedIndex = index |
| 89 | } | 86 | } |
| 90 | - }else { | ||
| 91 | - //检测删除频道后的当前频道是否是特殊频道 | ||
| 92 | - let item = this.myChannelList[this.currentTopNavSelectedIndex] | ||
| 93 | - if(this.isBroadcast(item) || this.isLayout(item)){ | 87 | + } else { |
| 88 | + //检测删除频道后的当前频道是否是特殊频道 | ||
| 89 | + let item = this.myChannelList[this.currentTopNavSelectedIndex] | ||
| 90 | + if (this.isBroadcast(item) || this.isLayout(item)) { | ||
| 94 | 91 | ||
| 95 | this.changeTab(this.currentTopNavSelectedIndex) | 92 | this.changeTab(this.currentTopNavSelectedIndex) |
| 96 | this.isShow = false | 93 | this.isShow = false |
| 97 | 94 | ||
| 98 | let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) | 95 | let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) |
| 99 | - console.debug('TopNavigationComponent','index='+index) | ||
| 100 | if (index > -1) { | 96 | if (index > -1) { |
| 101 | this.currentTopNavSelectedIndex = index | 97 | this.currentTopNavSelectedIndex = index |
| 102 | this.changeTab(this.currentTopNavSelectedIndex) | 98 | this.changeTab(this.currentTopNavSelectedIndex) |
| @@ -129,6 +125,9 @@ struct ChannelSubscriptionLayout { | @@ -129,6 +125,9 @@ struct ChannelSubscriptionLayout { | ||
| 129 | this.channelIds.push(item.channelId) | 125 | this.channelIds.push(item.channelId) |
| 130 | this.myChannelList.push(item) | 126 | this.myChannelList.push(item) |
| 131 | AppStorage.setOrCreate('channelIds', this.channelIds.join(',')) | 127 | AppStorage.setOrCreate('channelIds', this.channelIds.join(',')) |
| 128 | + | ||
| 129 | + // let storageChannelIds: string = AppStorage.get<string>('channelIds') || '' | ||
| 130 | + // console.debug('TopNavigationComponent', 'addChannelItem==>' + storageChannelIds) | ||
| 132 | } | 131 | } |
| 133 | 132 | ||
| 134 | itemMove(index: number, newIndex: number): void { | 133 | itemMove(index: number, newIndex: number): void { |
| @@ -273,6 +272,7 @@ struct ChannelSubscriptionLayout { | @@ -273,6 +272,7 @@ struct ChannelSubscriptionLayout { | ||
| 273 | .width(24) | 272 | .width(24) |
| 274 | .onClick(() => { | 273 | .onClick(() => { |
| 275 | this.isShow = false | 274 | this.isShow = false |
| 275 | + this.isEditIng = false | ||
| 276 | }) | 276 | }) |
| 277 | } | 277 | } |
| 278 | .width('100%') | 278 | .width('100%') |
| @@ -567,7 +567,30 @@ struct ChannelSubscriptionLayout { | @@ -567,7 +567,30 @@ struct ChannelSubscriptionLayout { | ||
| 567 | .onClick(() => { | 567 | .onClick(() => { |
| 568 | this.isShow = true | 568 | this.isShow = true |
| 569 | }) | 569 | }) |
| 570 | - .bindContentCover(this.isShow, this.sheetBuilder()) | 570 | + .bindContentCover(this.isShow, this.sheetBuilder(), { |
| 571 | + modalTransition: ModalTransition.DEFAULT, | ||
| 572 | + onWillAppear: () => {console.log("BindContentCover onWillAppear.")}, | ||
| 573 | + onAppear: () => {console.log("BindContentCover onAppear.")}, | ||
| 574 | + onWillDisappear: () => {console.log("BindContentCover onWillDisappear.")}, | ||
| 575 | + onDisappear: () => {console.log("BindContentCover onDisappear.") | ||
| 576 | + this.isShow = false | ||
| 577 | + this.isEditIng = false} | ||
| 578 | + }) | ||
| 579 | + } | ||
| 580 | + | ||
| 581 | + | ||
| 582 | + | ||
| 583 | + /** | ||
| 584 | + * 改变我的频道栏目中频道id数据 | ||
| 585 | + */ | ||
| 586 | + changeMyChannelData() { | ||
| 587 | + | ||
| 588 | + this.channelIds = [] | ||
| 589 | + this.myChannelList.forEach(item => { | ||
| 590 | + if (item != undefined && item.channelId != undefined) { | ||
| 591 | + this.channelIds.push(item.channelId) | ||
| 592 | + } | ||
| 593 | + }) | ||
| 571 | } | 594 | } |
| 572 | } | 595 | } |
| 573 | 596 |
| @@ -346,12 +346,11 @@ export struct TopNavigationComponentNew { | @@ -346,12 +346,11 @@ export struct TopNavigationComponentNew { | ||
| 346 | }) | 346 | }) |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | - | ||
| 350 | /** | 349 | /** |
| 351 | * 频道信息跳转页面方法 | 350 | * 频道信息跳转页面方法 |
| 352 | * @param index | 351 | * @param index |
| 353 | */ | 352 | */ |
| 354 | - private channelJumpToPage(index :number){ | 353 | + private channelJumpToPage(index: number) { |
| 355 | if (this.isBroadcastByIndex(index)) { | 354 | if (this.isBroadcastByIndex(index)) { |
| 356 | // 跳转到播报页面 | 355 | // 跳转到播报页面 |
| 357 | ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) | 356 | ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) |
| @@ -375,104 +374,6 @@ export struct TopNavigationComponentNew { | @@ -375,104 +374,6 @@ export struct TopNavigationComponentNew { | ||
| 375 | this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER) | 374 | this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER) |
| 376 | } | 375 | } |
| 377 | 376 | ||
| 378 | - //处理新闻tab顶导频道数据 | ||
| 379 | - topNavListHandle() { | ||
| 380 | - let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | ||
| 381 | - let _myChannelList: TopNavDTO [] = [] | ||
| 382 | - let _storageChannelIds: string [] = [] //list1 | ||
| 383 | - let defaultMyChannelList: TopNavDTO[] = [] | ||
| 384 | - let defaultList = [...this.topNavList] | ||
| 385 | - defaultList.sort((a, b) => { | ||
| 386 | - return a.num - b.num; | ||
| 387 | - }); | ||
| 388 | - | ||
| 389 | - //defaultMyChannelList | ||
| 390 | - defaultList.forEach(item => { | ||
| 391 | - if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || | ||
| 392 | - item.headlinesOn === 1) { | ||
| 393 | - defaultMyChannelList.push(item); | ||
| 394 | - } | ||
| 395 | - if (item.defaultPermitted === 1) { | ||
| 396 | - this.homeChannelList.push(item) | ||
| 397 | - } | ||
| 398 | - }) | ||
| 399 | - | ||
| 400 | - //有缓存频道id | ||
| 401 | - if (this.storageChannelIds) { | ||
| 402 | - _storageChannelIds = this.storageChannelIds.split(',') | ||
| 403 | - } | ||
| 404 | - | ||
| 405 | - defaultMyChannelList.forEach(item => { | ||
| 406 | - item.myChannel = '1' | ||
| 407 | - if (item.defaultPermitted === 1) { | ||
| 408 | - item.homeChannel = '1' | ||
| 409 | - } | ||
| 410 | - let index = defaultList.findIndex(_item => _item.channelId === item.channelId) | ||
| 411 | - if (index !== -1) { | ||
| 412 | - defaultList.splice(index, 1) | ||
| 413 | - } | ||
| 414 | - }) | ||
| 415 | - defaultList.unshift(...defaultMyChannelList) | ||
| 416 | - defaultList.forEach((item, index) => { | ||
| 417 | - if (item.channelType === 2) { | ||
| 418 | - if (cityName.includes(item.name)) { | ||
| 419 | - item.myChannel = '1' | ||
| 420 | - } | ||
| 421 | - item.localChannel = '1' | ||
| 422 | - } | ||
| 423 | - if (index >= 11) { | ||
| 424 | - if (item.channelType === 1) { | ||
| 425 | - item.moreChannel = '1' | ||
| 426 | - } | ||
| 427 | - } else { | ||
| 428 | - if (item.channelType === 1 && item.myChannel !== '1') { | ||
| 429 | - item.moreChannel = '1' | ||
| 430 | - } | ||
| 431 | - } | ||
| 432 | - if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) { | ||
| 433 | - item.myChannel = '1' | ||
| 434 | - } | ||
| 435 | - //频道分类 | ||
| 436 | - //TODO 暂时隐藏播报 | ||
| 437 | - if (item.name !== '播报') { | ||
| 438 | - if (item.myChannel === '1') { | ||
| 439 | - _myChannelList.push(item) | ||
| 440 | - } | ||
| 441 | - if (item.moreChannel === '1' && item.myChannel !== '1') { | ||
| 442 | - this.moreChannelList.push(item) | ||
| 443 | - } | ||
| 444 | - if (item.localChannel === '1' && item.myChannel !== '1') { | ||
| 445 | - this.localChannelList.push(item) | ||
| 446 | - } | ||
| 447 | - } | ||
| 448 | - }) | ||
| 449 | - | ||
| 450 | - //根据缓存数组排序 | ||
| 451 | - if (this.storageChannelIds) { | ||
| 452 | - let sortedyChannelList = _myChannelList.sort((item1, item2) => { | ||
| 453 | - let index1 = this.storageChannelIds.indexOf(String(item1.channelId)); | ||
| 454 | - let index2 = this.storageChannelIds.indexOf(String(item2.channelId)); | ||
| 455 | - return index1 - index2; | ||
| 456 | - }); | ||
| 457 | - _myChannelList = sortedyChannelList | ||
| 458 | - } | ||
| 459 | - | ||
| 460 | - | ||
| 461 | - if (cityName) { | ||
| 462 | - let index = _myChannelList.findIndex(ele => cityName.includes(ele.name)) | ||
| 463 | - const localChannelitem = _myChannelList.splice(index, 1)[0]; | ||
| 464 | - // 将当前地区频道插入到第四个 | ||
| 465 | - _myChannelList.splice(3, 0, localChannelitem); | ||
| 466 | - } | ||
| 467 | - | ||
| 468 | - this.myChannelList = _myChannelList | ||
| 469 | - | ||
| 470 | - //缓存首页频道 | ||
| 471 | - let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) | ||
| 472 | - if (index > -1) { | ||
| 473 | - this.currentTopNavSelectedIndex = index | ||
| 474 | - } | ||
| 475 | - } | ||
| 476 | 377 | ||
| 477 | /** | 378 | /** |
| 478 | * 频道是播报 | 379 | * 频道是播报 |
| @@ -517,12 +418,24 @@ export struct TopNavigationComponentNew { | @@ -517,12 +418,24 @@ export struct TopNavigationComponentNew { | ||
| 517 | return item?.channelType === 3 | 418 | return item?.channelType === 3 |
| 518 | } | 419 | } |
| 519 | 420 | ||
| 520 | - aboutToAppear() { | ||
| 521 | - //处理新闻tab顶导频道数据 | ||
| 522 | - this.topNavListHandle() | ||
| 523 | - this.changePage(this.currentTopNavSelectedIndex) | 421 | + async aboutToAppear() { |
| 422 | + | ||
| 423 | + | ||
| 424 | + if (CompUtils.isNews(this.navItem)) { | ||
| 425 | + | ||
| 426 | + // 请求顶导网络数据 | ||
| 427 | + this.getTopNavList(this.navItem.id) | ||
| 428 | + | ||
| 429 | + } else { | ||
| 430 | + // if(CompUtils.isNews(this.navItem)){ | ||
| 431 | + // //处理新闻tab顶导频道数据 | ||
| 432 | + // this.topNavListHandle() | ||
| 433 | + // } | ||
| 434 | + | ||
| 435 | + this.changePage(this.currentTopNavSelectedIndex) | ||
| 436 | + } | ||
| 437 | + | ||
| 524 | 438 | ||
| 525 | - this.getTopNavList(this.navItem.id) | ||
| 526 | } | 439 | } |
| 527 | 440 | ||
| 528 | onTopNavigationDataUpdated() { | 441 | onTopNavigationDataUpdated() { |
| @@ -534,7 +447,6 @@ export struct TopNavigationComponentNew { | @@ -534,7 +447,6 @@ export struct TopNavigationComponentNew { | ||
| 534 | * | 447 | * |
| 535 | */ | 448 | */ |
| 536 | updateCurrentTopNavSelectedIndex() { | 449 | updateCurrentTopNavSelectedIndex() { |
| 537 | - console.debug(TAG, 'updateCurrentTopNavSelectedIndex=>' + this.currentTopNavSelectedIndex) | ||
| 538 | if (CompUtils.isNews(this.navItem)) { | 450 | if (CompUtils.isNews(this.navItem)) { |
| 539 | const tab = this.myChannelList[this.currentTopNavSelectedIndex] | 451 | const tab = this.myChannelList[this.currentTopNavSelectedIndex] |
| 540 | // 埋点 | 452 | // 埋点 |
| @@ -583,10 +495,14 @@ export struct TopNavigationComponentNew { | @@ -583,10 +495,14 @@ export struct TopNavigationComponentNew { | ||
| 583 | * 频道id变化,即指定频道跳转场景 | 495 | * 频道id变化,即指定频道跳转场景 |
| 584 | */ | 496 | */ |
| 585 | onAssignChannelChange() { | 497 | onAssignChannelChange() { |
| 498 | + | ||
| 586 | if (!this.isCurrentPage()) { | 499 | if (!this.isCurrentPage()) { |
| 587 | return | 500 | return |
| 588 | } | 501 | } |
| 589 | let channelId = this.assignChannel.channelId | 502 | let channelId = this.assignChannel.channelId |
| 503 | + | ||
| 504 | + Logger.debug(TAG,'------onAssignChannelChange--------->'+channelId+' ==>'+this._currentNavIndex) | ||
| 505 | + | ||
| 590 | let index = -1 | 506 | let index = -1 |
| 591 | if (this._currentNavIndex === 0) { | 507 | if (this._currentNavIndex === 0) { |
| 592 | // 第一个,新闻,先拿我的,再拿其他 | 508 | // 第一个,新闻,先拿我的,再拿其他 |
| @@ -647,19 +563,20 @@ export struct TopNavigationComponentNew { | @@ -647,19 +563,20 @@ export struct TopNavigationComponentNew { | ||
| 647 | for (let i = 0; i < this.moreChannelList.length; i++) { | 563 | for (let i = 0; i < this.moreChannelList.length; i++) { |
| 648 | let topNavDTO: TopNavDTO = this.moreChannelList[i] | 564 | let topNavDTO: TopNavDTO = this.moreChannelList[i] |
| 649 | if (topNavDTO.channelId?.toString() === channelId) { | 565 | if (topNavDTO.channelId?.toString() === channelId) { |
| 566 | + this.moreChannelList.splice(i,1) | ||
| 650 | return topNavDTO | 567 | return topNavDTO |
| 651 | } | 568 | } |
| 652 | } | 569 | } |
| 653 | for (let j = 0; j < this.localChannelList.length; j++) { | 570 | for (let j = 0; j < this.localChannelList.length; j++) { |
| 654 | let topNavDTO: TopNavDTO = this.localChannelList[j] | 571 | let topNavDTO: TopNavDTO = this.localChannelList[j] |
| 655 | if (topNavDTO.channelId?.toString() === channelId) { | 572 | if (topNavDTO.channelId?.toString() === channelId) { |
| 573 | + this.localChannelList.splice(j,1) | ||
| 656 | return topNavDTO | 574 | return topNavDTO |
| 657 | } | 575 | } |
| 658 | } | 576 | } |
| 659 | return null | 577 | return null |
| 660 | } | 578 | } |
| 661 | 579 | ||
| 662 | - | ||
| 663 | /** | 580 | /** |
| 664 | * 进入早晚报专题 | 581 | * 进入早晚报专题 |
| 665 | */ | 582 | */ |
| @@ -704,11 +621,128 @@ export struct TopNavigationComponentNew { | @@ -704,11 +621,128 @@ export struct TopNavigationComponentNew { | ||
| 704 | 621 | ||
| 705 | //请求顶导数据 | 622 | //请求顶导数据 |
| 706 | async getTopNavList(id: number) { | 623 | async getTopNavList(id: number) { |
| 707 | - let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id) | 624 | + |
| 625 | + Logger.debug(TAG, 'getTopNavList==>' + this.storageChannelIds) | ||
| 626 | + | ||
| 627 | + let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id, this.storageChannelIds) | ||
| 708 | let topNavList = bottomNavDetail?.topNavChannelList || [] | 628 | let topNavList = bottomNavDetail?.topNavChannelList || [] |
| 709 | - // for (let topNav of topNavList) { | ||
| 710 | - // console.debug(TAG, 'getTopNavList=>' + JSON.stringify(topNav)) | ||
| 711 | - // | 629 | + |
| 630 | + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | ||
| 631 | + let _myChannelList: TopNavDTO [] = [] | ||
| 632 | + let _storageChannelIds: string [] = [] //list1 | ||
| 633 | + let defaultMyChannelList: TopNavDTO[] = [] | ||
| 634 | + let defaultList = [...topNavList] | ||
| 635 | + | ||
| 636 | + Logger.debug(TAG, 'cityName=>' + cityName) | ||
| 637 | + // 排序 | ||
| 638 | + defaultList.sort((a, b) => { | ||
| 639 | + return a.num - b.num; | ||
| 640 | + }); | ||
| 641 | + | ||
| 642 | + //defaultMyChannelList | ||
| 643 | + defaultList.forEach(item => { | ||
| 644 | + if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || | ||
| 645 | + item.headlinesOn === 1) { | ||
| 646 | + defaultMyChannelList.push(item); | ||
| 647 | + } | ||
| 648 | + if (item.defaultPermitted === 1) { | ||
| 649 | + this.homeChannelList.push(item) | ||
| 650 | + } | ||
| 651 | + }) | ||
| 652 | + | ||
| 653 | + //有缓存频道id | ||
| 654 | + if (this.storageChannelIds) { | ||
| 655 | + _storageChannelIds = this.storageChannelIds.split(',') | ||
| 656 | + | ||
| 657 | + } | ||
| 658 | + | ||
| 659 | + defaultMyChannelList.forEach(item => { | ||
| 660 | + item.myChannel = '1' | ||
| 661 | + if (item.defaultPermitted === 1) { | ||
| 662 | + item.homeChannel = '1' | ||
| 663 | + } | ||
| 664 | + let index = defaultList.findIndex(_item => _item.channelId === item.channelId) | ||
| 665 | + if (index !== -1) { | ||
| 666 | + defaultList.splice(index, 1) | ||
| 667 | + } | ||
| 668 | + }) | ||
| 669 | + defaultList.unshift(...defaultMyChannelList) | ||
| 670 | + | ||
| 671 | + defaultList.forEach((item, index) => { | ||
| 672 | + if (item.channelType === 2) { | ||
| 673 | + if (cityName.includes(item.name)) { | ||
| 674 | + item.myChannel = '1' | ||
| 675 | + } | ||
| 676 | + item.localChannel = '1' | ||
| 677 | + } | ||
| 678 | + if (index >= 11) { | ||
| 679 | + if (item.channelType === 1) { | ||
| 680 | + item.moreChannel = '1' | ||
| 681 | + } | ||
| 682 | + } else { | ||
| 683 | + if (item.channelType === 1 && item.myChannel !== '1') { | ||
| 684 | + item.moreChannel = '1' | ||
| 685 | + } | ||
| 686 | + } | ||
| 687 | + if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) { | ||
| 688 | + item.myChannel = '1' | ||
| 689 | + } | ||
| 690 | + //频道分类 | ||
| 691 | + //TODO 暂时隐藏播报 | ||
| 692 | + if (item.name !== '播报') { | ||
| 693 | + if (item.myChannel === '1') { | ||
| 694 | + _myChannelList.push(item) | ||
| 695 | + } | ||
| 696 | + if (item.moreChannel === '1' && item.myChannel !== '1') { | ||
| 697 | + this.moreChannelList.push(item) | ||
| 698 | + } | ||
| 699 | + if (item.localChannel === '1' && item.myChannel !== '1') { | ||
| 700 | + this.localChannelList.push(item) | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | + }) | ||
| 704 | + | ||
| 705 | + //根据缓存数组排序 | ||
| 706 | + if (this.storageChannelIds) { | ||
| 707 | + | ||
| 708 | + // let sortedyChannelList: TopNavDTO [] = [] | ||
| 709 | + // | ||
| 710 | + // _storageChannelIds.forEach((channelId) => { | ||
| 711 | + // console.debug(TAG, 'getTopNavList=0=>' + channelId) | ||
| 712 | + // for (let a of _myChannelList) { | ||
| 713 | + // | ||
| 714 | + // console.debug(TAG, | ||
| 715 | + // 'getTopNavList=1=>' + channelId + ' ' + a.channelId + ' ' + (channelId == String(a.channelId))) | ||
| 716 | + // if (channelId == String(a.channelId)) { | ||
| 717 | + // sortedyChannelList.push(a) | ||
| 718 | + // break; | ||
| 719 | + // } | ||
| 720 | + // } | ||
| 721 | + // | ||
| 722 | + // }) | ||
| 723 | + | ||
| 724 | + let sortedyChannelList = _myChannelList.sort((item1, item2) => { | ||
| 725 | + let index1 = this.storageChannelIds.indexOf(String(item1.channelId)); | ||
| 726 | + let index2 = this.storageChannelIds.indexOf(String(item2.channelId)); | ||
| 727 | + return index1 - index2; | ||
| 728 | + }); | ||
| 729 | + _myChannelList = sortedyChannelList | ||
| 730 | + } | ||
| 731 | + | ||
| 732 | + // if (cityName) { | ||
| 733 | + // let index = _myChannelList.findIndex(ele => cityName.includes(ele.name)) | ||
| 734 | + // const localChannelitem = _myChannelList.splice(index, 1)[0]; | ||
| 735 | + // // 将当前地区频道插入到第四个 | ||
| 736 | + // _myChannelList.splice(3, 0, localChannelitem); | ||
| 712 | // } | 737 | // } |
| 738 | + | ||
| 739 | + this.myChannelList = _myChannelList | ||
| 740 | + | ||
| 741 | + | ||
| 742 | + //缓存首页频道 | ||
| 743 | + let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) | ||
| 744 | + if (index > -1) { | ||
| 745 | + this.currentTopNavSelectedIndex = index | ||
| 746 | + } | ||
| 713 | } | 747 | } |
| 714 | } | 748 | } |
| @@ -226,8 +226,25 @@ export class PageRepository { | @@ -226,8 +226,25 @@ export class PageRepository { | ||
| 226 | return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url) | 226 | return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url) |
| 227 | }; | 227 | }; |
| 228 | 228 | ||
| 229 | - static fetchNavigationDetailDataApi(id:number = 210) { | 229 | + /** |
| 230 | + * 获取顶导详情 | ||
| 231 | + * @param id | ||
| 232 | + * @returns | ||
| 233 | + */ | ||
| 234 | + static fetchNavigationDetailDataApi(id: number = 210, myChannelIds?: string) { | ||
| 230 | let url = PageRepository.getBottomNavGroupDetailUrl() + `?id=${id}`; | 235 | let url = PageRepository.getBottomNavGroupDetailUrl() + `?id=${id}`; |
| 236 | + | ||
| 237 | + let provinceCode = HttpUtils.getProvinceCode() | ||
| 238 | + if (provinceCode) { | ||
| 239 | + url = url + "&districtCode=" + HttpUtils.getDistrictCode() | ||
| 240 | + + "&provinceCode=" + HttpUtils.getProvinceCode() | ||
| 241 | + + "&cityCode=" + HttpUtils.getCityCode() | ||
| 242 | + } | ||
| 243 | + if (myChannelIds) { | ||
| 244 | + url = url + `&channelIds=${myChannelIds}` | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + | ||
| 231 | return WDHttp.get<ResponseDTO<NavigationDetailDTO>>(url) | 248 | return WDHttp.get<ResponseDTO<NavigationDetailDTO>>(url) |
| 232 | }; | 249 | }; |
| 233 | 250 | ||
| @@ -486,5 +503,4 @@ export class PageRepository { | @@ -486,5 +503,4 @@ export class PageRepository { | ||
| 486 | url = url + "?mliveId=" + mLiveId | 503 | url = url + "?mliveId=" + mLiveId |
| 487 | return WDHttp.get<ResponseDTO<boolean>>(url) | 504 | return WDHttp.get<ResponseDTO<boolean>>(url) |
| 488 | } | 505 | } |
| 489 | - | ||
| 490 | } | 506 | } |
| @@ -44,10 +44,10 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | @@ -44,10 +44,10 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | ||
| 44 | }, | 44 | }, |
| 45 | intentEntityInfo: { | 45 | intentEntityInfo: { |
| 46 | entityName: 'Blog', | 46 | entityName: 'Blog', |
| 47 | - entityId: item?.objectId || '',//必传 | 47 | + entityId: `objectId=${item?.objectId}&objectType=${item?.objectType}` || '',//必传 |
| 48 | displayName: item?.newsTitle || '', //必传 | 48 | displayName: item?.newsTitle || '', //必传 |
| 49 | entityGroupId, //channelId | 49 | entityGroupId, //channelId |
| 50 | - logoURL: item?.coverUrl, | 50 | + logoURL: item?.coverUrl || 'https://cdnjdphoto.aikan.pdnews.cn/WapApi/800/launcher_icon.png', |
| 51 | metadataModificationTime: Number(item?.publishTime) || 0,//int | 51 | metadataModificationTime: Number(item?.publishTime) || 0,//int |
| 52 | blogTitle: item?.newsTitle, | 52 | blogTitle: item?.newsTitle, |
| 53 | blogType: 'Normal', | 53 | blogType: 'Normal', |
| @@ -99,7 +99,7 @@ export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, | @@ -99,7 +99,7 @@ export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, | ||
| 99 | entityId: String(item?.newsId) || '', | 99 | entityId: String(item?.newsId) || '', |
| 100 | displayName: item?.newsTitle || '', | 100 | displayName: item?.newsTitle || '', |
| 101 | entityGroupId: String(item?.reLInfo?.channelId), //channelId | 101 | entityGroupId: String(item?.reLInfo?.channelId), //channelId |
| 102 | - logoURL: item.fullColumnImgUrls.length > 0 ? item.fullColumnImgUrls[0]?.url : item.firstFrameImageUri, | 102 | + logoURL: item.fullColumnImgUrls.length > 0 ? item.fullColumnImgUrls[0]?.url : item.firstFrameImageUri || 'https://cdnjdphoto.aikan.pdnews.cn/WapApi/800/launcher_icon.png', |
| 103 | metadataModificationTime: new Date(item.publishTime).getTime() || 0, | 103 | metadataModificationTime: new Date(item.publishTime).getTime() || 0, |
| 104 | blogTitle: item?.newsTitle, | 104 | blogTitle: item?.newsTitle, |
| 105 | blogType: 'Normal', | 105 | blogType: 'Normal', |
| @@ -75,9 +75,9 @@ export class ChannelViewModel { | @@ -75,9 +75,9 @@ export class ChannelViewModel { | ||
| 75 | /** | 75 | /** |
| 76 | * 获取底导详情(顶导)接口数据 | 76 | * 获取底导详情(顶导)接口数据 |
| 77 | */ | 77 | */ |
| 78 | - async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> { | 78 | + async getBottomNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO> { |
| 79 | Logger.info(TAG, `getBottomNavDetailData start`); | 79 | Logger.info(TAG, `getBottomNavDetailData start`); |
| 80 | - return this.getNavDetailData(id); | 80 | + return this.getNavDetailData(id,myChannelIds); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | private getNavData(): Promise<NavigationBodyDTO> { | 83 | private getNavData(): Promise<NavigationBodyDTO> { |
| @@ -105,10 +105,16 @@ export class ChannelViewModel { | @@ -105,10 +105,16 @@ export class ChannelViewModel { | ||
| 105 | }) | 105 | }) |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | - private getNavDetailData(id: number): Promise<NavigationDetailDTO> { | 108 | + /** |
| 109 | + * 请求获取顶部导航栏数据 | ||
| 110 | + * @param id | ||
| 111 | + * @param myChannelIds | ||
| 112 | + * @returns | ||
| 113 | + */ | ||
| 114 | + private getNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO> { | ||
| 109 | return new Promise<NavigationDetailDTO>((success, error) => { | 115 | return new Promise<NavigationDetailDTO>((success, error) => { |
| 110 | Logger.info(TAG, `getNavData start`); | 116 | Logger.info(TAG, `getNavData start`); |
| 111 | - PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => { | 117 | + PageRepository.fetchNavigationDetailDataApi(id,myChannelIds).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => { |
| 112 | if (!navResDTO || !navResDTO.data) { | 118 | if (!navResDTO || !navResDTO.data) { |
| 113 | Logger.error(TAG, 'getNavData then navResDTO is empty'); | 119 | Logger.error(TAG, 'getNavData then navResDTO is empty'); |
| 114 | error('navResDTO is empty'); | 120 | error('navResDTO is empty'); |
| 1 | +import Url from '@ohos.url' | ||
| 1 | import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; | 2 | import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; |
| 2 | import { window } from '@kit.ArkUI'; | 3 | import { window } from '@kit.ArkUI'; |
| 3 | import { BusinessError } from '@kit.BasicServicesKit'; | 4 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 4 | import { NetworkUtil, SPHelper, ToastUtils, FastClickUtil } from 'wdKit'; | 5 | import { NetworkUtil, SPHelper, ToastUtils, FastClickUtil } from 'wdKit'; |
| 6 | +import { ContentDTO } from 'wdBean'; | ||
| 5 | import { ProcessUtils } from 'wdRouter'; | 7 | import { ProcessUtils } from 'wdRouter'; |
| 6 | import DailyPaperTopicModel from 'wdComponent/src/main/ets/model/DailyPaperTopicModel' | 8 | import DailyPaperTopicModel from 'wdComponent/src/main/ets/model/DailyPaperTopicModel' |
| 7 | 9 | ||
| @@ -52,6 +54,12 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -52,6 +54,12 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 52 | // TODO 热启动是否切到主页 | 54 | // TODO 热启动是否切到主页 |
| 53 | pageLoader.loadContent('pages/MainPage') | 55 | pageLoader.loadContent('pages/MainPage') |
| 54 | .then(() => { | 56 | .then(() => { |
| 57 | + let url: string = param?.entityId as string || '' | ||
| 58 | + let urlParams = new Url.URLParams(url); | ||
| 59 | + let content = new ContentDTO() | ||
| 60 | + content.objectId = urlParams.get('objectId') || '' | ||
| 61 | + content.objectType = urlParams.get('objectType') || '' | ||
| 62 | + ProcessUtils.processPage(content) | ||
| 55 | resolve({ | 63 | resolve({ |
| 56 | code: 0, | 64 | code: 0, |
| 57 | result: { | 65 | result: { |
| @@ -79,7 +87,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -79,7 +87,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 79 | pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { | 87 | pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { |
| 80 | return new Promise((resolve, reject) => { | 88 | return new Promise((resolve, reject) => { |
| 81 | pageLoader.loadContent('pages/MainPage') | 89 | pageLoader.loadContent('pages/MainPage') |
| 82 | - .then( async () => { | 90 | + .then(async () => { |
| 83 | if (NetworkUtil.isNetConnected()) { | 91 | if (NetworkUtil.isNetConnected()) { |
| 84 | if (await FastClickUtil.isMinDelayTime()) { | 92 | if (await FastClickUtil.isMinDelayTime()) { |
| 85 | return | 93 | return |
| @@ -92,7 +100,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -92,7 +100,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 92 | ToastUtils.showToast('暂无早晚报信息', 1000) | 100 | ToastUtils.showToast('暂无早晚报信息', 1000) |
| 93 | } | 101 | } |
| 94 | }).catch((err: string) => { | 102 | }).catch((err: string) => { |
| 95 | - console.log('yzlerr',JSON.stringify(err)) | 103 | + console.log('yzlerr', JSON.stringify(err)) |
| 96 | ToastUtils.showToast('暂无早晚报信息', 1000) | 104 | ToastUtils.showToast('暂无早晚报信息', 1000) |
| 97 | }) | 105 | }) |
| 98 | } else { | 106 | } else { |
-
Please register or login to post a comment