liyubing

feat:

1)编辑我的频道- 临时频道需要点击进入编辑页面,临时频道才能被录入我的频道栏目
1 import { TopNavDTO } from 'wdBean'; 1 import { TopNavDTO } from 'wdBean';
2 import curves from '@ohos.curves'; 2 import curves from '@ohos.curves';
  3 +import { Logger } from 'wdKit/Index';
3 4
4 const INDEX_SETTING_TITLE: string = '首页设置' 5 const INDEX_SETTING_TITLE: string = '首页设置'
5 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页' 6 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页'
@@ -29,6 +30,7 @@ struct ChannelSubscriptionLayout { @@ -29,6 +30,7 @@ struct ChannelSubscriptionLayout {
29 @Link localChannelList: TopNavDTO [] 30 @Link localChannelList: TopNavDTO []
30 // 收集到的我的频道栏目中的频道id 31 // 收集到的我的频道栏目中的频道id
31 @State channelIds: number [] = [] 32 @State channelIds: number [] = []
  33 + // 是否显示频道编辑页面
32 @State isShow: boolean = false 34 @State isShow: boolean = false
33 @State dragItem: number = -1 35 @State dragItem: number = -1
34 private dragRefOffsetX: number = 0 36 private dragRefOffsetX: number = 0
@@ -39,6 +41,9 @@ struct ChannelSubscriptionLayout { @@ -39,6 +41,9 @@ struct ChannelSubscriptionLayout {
39 private FIX_VP_Y: number = 48 41 private FIX_VP_Y: number = 48
40 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 42 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
41 @State isEditIng: boolean = false 43 @State isEditIng: boolean = false
  44 + // 顶部导航栏是否有临时跳转频道数据不
  45 + @Prop haveTempTabData: boolean
  46 +
42 changeTab: (index: number) => void = () => { 47 changeTab: (index: number) => void = () => {
43 } 48 }
44 49
@@ -566,15 +571,21 @@ struct ChannelSubscriptionLayout { @@ -566,15 +571,21 @@ struct ChannelSubscriptionLayout {
566 .backgroundColor(Color.White) 571 .backgroundColor(Color.White)
567 .onClick(() => { 572 .onClick(() => {
568 this.isShow = true 573 this.isShow = true
  574 + if(this.haveTempTabData){
  575 + // 存储数据
  576 + AppStorage.setOrCreate('channelIds', this.channelIds.join(','))
  577 + this.haveTempTabData = false
  578 + }
569 }) 579 })
570 .bindContentCover(this.isShow, this.sheetBuilder(), { 580 .bindContentCover(this.isShow, this.sheetBuilder(), {
571 modalTransition: ModalTransition.DEFAULT, 581 modalTransition: ModalTransition.DEFAULT,
572 onWillAppear: () => {console.log("BindContentCover onWillAppear.")}, 582 onWillAppear: () => {console.log("BindContentCover onWillAppear.")},
573 onAppear: () => {console.log("BindContentCover onAppear.")}, 583 onAppear: () => {console.log("BindContentCover onAppear.")},
574 - onWillDisappear: () => {console.log("BindContentCover onWillDisappear.")},  
575 - onDisappear: () => {console.log("BindContentCover onDisappear.") 584 + onWillDisappear: () => {console.log("BindContentCover onWillDisappear.")
576 this.isShow = false 585 this.isShow = false
577 - this.isEditIng = false} 586 + this.isEditIng = false},
  587 + onDisappear: () => {console.log("BindContentCover onDisappear.")
  588 + }
578 }) 589 })
579 } 590 }
580 591
@@ -591,6 +602,8 @@ struct ChannelSubscriptionLayout { @@ -591,6 +602,8 @@ struct ChannelSubscriptionLayout {
591 this.channelIds.push(item.channelId) 602 this.channelIds.push(item.channelId)
592 } 603 }
593 }) 604 })
  605 + // console.debug('TopNavigationComponent', '--changeMyChannelData channelIds--->' + this.channelIds.join(','))
  606 +
594 } 607 }
595 } 608 }
596 609
@@ -64,6 +64,8 @@ export struct TopNavigationComponentNew { @@ -64,6 +64,8 @@ export struct TopNavigationComponentNew {
64 @State indicatorLeftMargin: number = 0 64 @State indicatorLeftMargin: number = 0
65 @State indicatorWidth: number = 0 65 @State indicatorWidth: number = 0
66 @State isClickMorningEveningPaper: boolean = false 66 @State isClickMorningEveningPaper: boolean = false
  67 + // 顶部导航栏是否有临时跳转频道数据不
  68 + @State haveTempTabData : boolean = false
67 69
68 build() { 70 build() {
69 Column() { 71 Column() {
@@ -215,6 +217,7 @@ export struct TopNavigationComponentNew { @@ -215,6 +217,7 @@ export struct TopNavigationComponentNew {
215 myChannelList: $myChannelList, 217 myChannelList: $myChannelList,
216 moreChannelList: $moreChannelList, 218 moreChannelList: $moreChannelList,
217 localChannelList: $localChannelList, 219 localChannelList: $localChannelList,
  220 + haveTempTabData:this.haveTempTabData,
218 changeTab: (index) => { 221 changeTab: (index) => {
219 this.channelJumpToPage(index) 222 this.channelJumpToPage(index)
220 } 223 }
@@ -501,8 +504,6 @@ export struct TopNavigationComponentNew { @@ -501,8 +504,6 @@ export struct TopNavigationComponentNew {
501 } 504 }
502 let channelId = this.assignChannel.channelId 505 let channelId = this.assignChannel.channelId
503 506
504 - Logger.debug(TAG,'------onAssignChannelChange--------->'+channelId+' ==>'+this._currentNavIndex)  
505 -  
506 let index = -1 507 let index = -1
507 if (this._currentNavIndex === 0) { 508 if (this._currentNavIndex === 0) {
508 // 第一个,新闻,先拿我的,再拿其他 509 // 第一个,新闻,先拿我的,再拿其他
@@ -556,6 +557,7 @@ export struct TopNavigationComponentNew { @@ -556,6 +557,7 @@ export struct TopNavigationComponentNew {
556 return -1 557 return -1
557 } 558 }
558 559
  560 +
559 /** 561 /**
560 * 新闻,从其他里拿数据 562 * 新闻,从其他里拿数据
561 */ 563 */
@@ -564,6 +566,7 @@ export struct TopNavigationComponentNew { @@ -564,6 +566,7 @@ export struct TopNavigationComponentNew {
564 let topNavDTO: TopNavDTO = this.moreChannelList[i] 566 let topNavDTO: TopNavDTO = this.moreChannelList[i]
565 if (topNavDTO.channelId?.toString() === channelId) { 567 if (topNavDTO.channelId?.toString() === channelId) {
566 this.moreChannelList.splice(i,1) 568 this.moreChannelList.splice(i,1)
  569 + this.haveTempTabData = true
567 return topNavDTO 570 return topNavDTO
568 } 571 }
569 } 572 }
@@ -571,6 +574,7 @@ export struct TopNavigationComponentNew { @@ -571,6 +574,7 @@ export struct TopNavigationComponentNew {
571 let topNavDTO: TopNavDTO = this.localChannelList[j] 574 let topNavDTO: TopNavDTO = this.localChannelList[j]
572 if (topNavDTO.channelId?.toString() === channelId) { 575 if (topNavDTO.channelId?.toString() === channelId) {
573 this.localChannelList.splice(j,1) 576 this.localChannelList.splice(j,1)
  577 + this.haveTempTabData = true
574 return topNavDTO 578 return topNavDTO
575 } 579 }
576 } 580 }
@@ -729,11 +733,14 @@ export struct TopNavigationComponentNew { @@ -729,11 +733,14 @@ export struct TopNavigationComponentNew {
729 _myChannelList = sortedyChannelList 733 _myChannelList = sortedyChannelList
730 } 734 }
731 735
  736 + Logger.debug(TAG,'cityName===>'+cityName)
732 // if (cityName) { 737 // if (cityName) {
733 // let index = _myChannelList.findIndex(ele => cityName.includes(ele.name)) 738 // let index = _myChannelList.findIndex(ele => cityName.includes(ele.name))
734 - // const localChannelitem = _myChannelList.splice(index, 1)[0]; 739 + // Logger.debug(TAG,'index===>'+index)
  740 + // const localChannelitem = _myChannelList.splice(index, 1)[0];
735 // // 将当前地区频道插入到第四个 741 // // 将当前地区频道插入到第四个
736 // _myChannelList.splice(3, 0, localChannelitem); 742 // _myChannelList.splice(3, 0, localChannelitem);
  743 + // //_myChannelList[3] = localChannelitem
737 // } 744 // }
738 745
739 this.myChannelList = _myChannelList 746 this.myChannelList = _myChannelList