yuzhilin

纯滑动事件处理拖拽

1 import { TopNavDTO } from 'wdBean'; 1 import { TopNavDTO } from 'wdBean';
  2 +import curves from '@ohos.curves';
2 3
3 const INDEX_SETTING_TITLE: string = '首页设置' 4 const INDEX_SETTING_TITLE: string = '首页设置'
4 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页' 5 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页'
5 const MY_CHANNEL: string = '我的频道' 6 const MY_CHANNEL: string = '我的频道'
6 const EDIT_TEXT: string = '编辑' 7 const EDIT_TEXT: string = '编辑'
7 const EDIT_DOWN: string = '完成' 8 const EDIT_DOWN: string = '完成'
  9 +const MY_CHANNEL_TIP1: string = '点击进入频道'
  10 +const MY_CHANNEL_TIP2: string = '拖动调整频道顺序'
8 const MORE_CHANNEL: string = '更多频道' 11 const MORE_CHANNEL: string = '更多频道'
9 const LOCAL_CHANNEL: string = '地方频道' 12 const LOCAL_CHANNEL: string = '地方频道'
10 13
  14 +
11 @CustomDialog 15 @CustomDialog
12 struct ChannelDialog { 16 struct ChannelDialog {
  17 + @State dragItem: number = -1
  18 + @State item: number = -1
  19 + private dragRefOffsetX: number = 0
  20 + private dragRefOffsetY: number = 0
  21 + @State offsetX: number = 0
  22 + @State offsetY: number = 0
  23 + private FIX_VP_X: number = 80
  24 + private FIX_VP_Y: number = 48
13 @State indexSettingTabIndex: number = 0 25 @State indexSettingTabIndex: number = 0
14 @State isEditIng: boolean = false 26 @State isEditIng: boolean = false
  27 + @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
15 @Link currentTopNavSelectedIndex: number 28 @Link currentTopNavSelectedIndex: number
16 @Link myChannelList: TopNavDTO[] 29 @Link myChannelList: TopNavDTO[]
17 @Link moreChannelList: TopNavDTO[] 30 @Link moreChannelList: TopNavDTO[]
@@ -20,48 +33,153 @@ struct ChannelDialog { @@ -20,48 +33,153 @@ struct ChannelDialog {
20 controller?: CustomDialogController 33 controller?: CustomDialogController
21 confirm: (index: number) => void = () => { 34 confirm: (index: number) => void = () => {
22 } 35 }
23 - changeChannelIndex : (index1:number, index2:number) => void = ()=>{}  
24 - myChannelItemEditHandle = (index: number): void => {  
25 - let item = this.myChannelList.splice(index, 1)[0]  
26 - if (item.moreChannel === '1') {  
27 - this.moreChannelList.unshift(item)  
28 - }  
29 - if (item.localChannel === '1') {  
30 - this.localChannelList.unshift(item) 36 + changeChannelIndex: (index1: number, index2: number) => void = () => {
  37 + }
  38 + delChannelItem: (index: number) => void = () => {
  39 + }
  40 + addChannelItem: (item: TopNavDTO) => void = () => {
  41 + }
  42 +
  43 + aboutToAppear() {
  44 + this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
  45 + }
  46 +
  47 + itemMove(index: number, newIndex: number): void {
  48 + let targetItem = this.myChannelList[newIndex]
  49 + if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) {
  50 + this.changeChannelIndex(index, newIndex)
  51 + if (index <= this.currentTopNavSelectedIndex || newIndex <= this.currentTopNavSelectedIndex) {
  52 + // this.currentTopNavSelectedIndex = this.myChannelList.findIndex(ele => ele.channelId === currentTopNavSelectedItem.channelId)
  53 + }
31 } 54 }
32 } 55 }
33 56
34 - @Builder  
35 - pixelMapBuilder(item: TopNavDTO, index: number) { //拖拽过程样式  
36 - Row() {  
37 - Row() {  
38 - Text(item.name)  
39 - .fontSize(14)  
40 - .fontColor(this.currentTopNavSelectedIndex === index ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222')) 57 + //向下滑
  58 + down(index: number): void {
  59 + console.info(`向下滑`)
  60 + this.offsetY -= this.FIX_VP_Y
  61 + this.dragRefOffsetY += this.FIX_VP_Y
  62 + this.itemMove(index, index + 4)
  63 + }
41 64
42 - if (this.isEditIng && item.myChannel !== '1') {  
43 - Image($r('app.media.icon_audio_close'))  
44 - .width(12)  
45 - .margin({ left: 1 })  
46 - } 65 + //向下滑(右下角为空)
  66 + down2(index: number): void {
  67 + this.offsetY -= this.FIX_VP_Y
  68 + this.dragRefOffsetY += this.FIX_VP_Y
  69 + this.itemMove(index, index + 4)
  70 + }
  71 +
  72 + //向上滑
  73 + up(index: number): void {
  74 + console.info(`向上滑`)
  75 + this.offsetY += this.FIX_VP_Y
  76 + this.dragRefOffsetY -= this.FIX_VP_Y
  77 + this.itemMove(index, index - 4)
  78 + }
  79 +
  80 + //向左滑
  81 + left(index: number): void {
  82 + console.info(`向左滑`)
  83 + this.offsetX += this.FIX_VP_X
  84 + this.dragRefOffsetX -= this.FIX_VP_X
  85 + this.itemMove(index, index - 1)
  86 + }
  87 +
  88 + //向右滑
  89 + right(index: number): void {
  90 + console.info(`向右滑`)
  91 + this.offsetX -= this.FIX_VP_X
  92 + this.dragRefOffsetX += this.FIX_VP_X
  93 + this.itemMove(index, index + 1)
  94 + }
  95 +
  96 + //向右下滑
  97 + lowerRight(index: number): void {
  98 + console.info(`向右下滑`)
  99 + this.offsetX -= this.FIX_VP_X
  100 + this.dragRefOffsetX += this.FIX_VP_X
  101 + this.offsetY -= this.FIX_VP_Y
  102 + this.dragRefOffsetY += this.FIX_VP_Y
  103 + this.itemMove(index, index + 5)
  104 + }
  105 +
  106 + //向右上滑
  107 + upperRight(index: number): void {
  108 + console.info(`向右上滑`)
  109 + this.offsetX -= this.FIX_VP_X
  110 + this.dragRefOffsetX += this.FIX_VP_X
  111 + this.offsetY += this.FIX_VP_Y
  112 + this.dragRefOffsetY -= this.FIX_VP_Y
  113 + this.itemMove(index, index - 3)
  114 + }
  115 +
  116 + //向左下滑
  117 + lowerLeft(index: number): void {
  118 + console.info(`向左下滑`)
  119 + this.offsetX += this.FIX_VP_X
  120 + this.dragRefOffsetX -= this.FIX_VP_X
  121 + this.offsetY -= this.FIX_VP_Y
  122 + this.dragRefOffsetY += this.FIX_VP_Y
  123 + this.itemMove(index, index + 3)
  124 + }
  125 +
  126 + //向左上滑
  127 + upperLeft(index: number): void {
  128 + console.info(`向左上滑`)
  129 + this.offsetX += this.FIX_VP_X
  130 + this.dragRefOffsetX -= this.FIX_VP_X
  131 + this.offsetY += this.FIX_VP_Y
  132 + this.dragRefOffsetY -= this.FIX_VP_Y
  133 + this.itemMove(index, index - 5)
  134 + }
  135 +
  136 + handleAnimationTo(item: TopNavDTO, event: GestureEvent) {
  137 + let index = this.myChannelList.findIndex(ele => ele.num === this.dragItem)
  138 + if (!(item.headlinesOn === 1 || item.movePermitted === 0 || item.homeChannel === '1') && this.isEditIng) {
  139 + this.offsetY = event.offsetY - this.dragRefOffsetY
  140 + this.offsetX = event.offsetX - this.dragRefOffsetX
  141 + if (this.offsetY >= this.FIX_VP_Y / 2 && (this.offsetX <= 44 && this.offsetX >= -44)
  142 + ) {
  143 + //向下滑
  144 + this.down(index)
  145 + } else if (this.offsetY <= -this.FIX_VP_Y / 2 && (this.offsetX <= 44 && this.offsetX >= -44)
  146 + ) {
  147 + //向上滑
  148 + this.up(index)
  149 + } else if (this.offsetX >= this.FIX_VP_X / 2 && (this.offsetY <= 20 && this.offsetY >= -20)
  150 + ) {
  151 + //向右滑
  152 + this.right(index)
  153 + } else if (this.offsetX <= -this.FIX_VP_X / 2 && (this.offsetY <= 20 && this.offsetY >= -20)
  154 + ) {
  155 + //向左滑
  156 + this.left(index)
  157 + } else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
  158 + ) {
  159 + //向右下滑
  160 + this.lowerRight(index)
  161 + } else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY <= -this.FIX_VP_Y / 2
  162 + ) {
  163 + //向右上滑
  164 + this.upperRight(index)
  165 + } else if (this.offsetX <= -this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
  166 + ) {
  167 + //向左下滑
  168 + this.lowerLeft(index)
  169 + } else if (this.offsetX <= -this.FIX_VP_X / 2 && this.offsetY <= -this.FIX_VP_Y / 2
  170 + ) {
  171 + //向左上滑
  172 + this.upperLeft(index)
  173 + } else if (this.offsetX >= this.FIX_VP_X / 2 && this.offsetY >= this.FIX_VP_Y / 2
  174 + ) {
  175 + //向右下滑(右下角为空)
  176 + this.down2(index)
47 } 177 }
48 - .width('100%')  
49 - .height('100%')  
50 - .justifyContent(FlexAlign.Center)  
51 - .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')  
52 } 178 }
53 - .width('23%')  
54 - .height(40)  
55 - .border({  
56 - width: item.homeChannel === '1' ? 0 : 1,  
57 - color: '#EDEDED',  
58 - radius: 3  
59 - })  
60 } 179 }
61 180
62 build() { 181 build() {
63 Column() { 182 Column() {
64 -  
65 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 183 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
66 Image($r('app.media.icon_ren_min_ri_bao')) 184 Image($r('app.media.icon_ren_min_ri_bao'))
67 .width(72) 185 .width(72)
@@ -73,7 +191,7 @@ struct ChannelDialog { @@ -73,7 +191,7 @@ struct ChannelDialog {
73 }) 191 })
74 } 192 }
75 .width('100%') 193 .width('100%')
76 - .padding({ top: 30, bottom: 10 }) 194 + .padding({ bottom: 10 })
77 195
78 List() { 196 List() {
79 197
@@ -87,6 +205,7 @@ struct ChannelDialog { @@ -87,6 +205,7 @@ struct ChannelDialog {
87 Text(INDEX_SETTING_SUBTITLE) 205 Text(INDEX_SETTING_SUBTITLE)
88 .fontSize(12) 206 .fontSize(12)
89 .fontWeight(400) 207 .fontWeight(400)
  208 + .fontColor('#222222')
90 } 209 }
91 .width('100%') 210 .width('100%')
92 .margin({ top: 22, bottom: 16 }) 211 .margin({ top: 22, bottom: 16 })
@@ -128,9 +247,17 @@ struct ChannelDialog { @@ -128,9 +247,17 @@ struct ChannelDialog {
128 247
129 ListItem() { 248 ListItem() {
130 Row() { 249 Row() {
131 - Text(MY_CHANNEL)  
132 - .fontSize(16)  
133 - .fontWeight(600) 250 + Row() {
  251 + Text(MY_CHANNEL)
  252 + .fontSize(16)
  253 + .fontWeight(600)
  254 + .margin({ right: 4 })
  255 + Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
  256 + .fontSize(12)
  257 + .fontWeight(400)
  258 + .fontColor('#222222')
  259 + }
  260 +
134 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT) 261 Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT)
135 .fontSize(14) 262 .fontSize(14)
136 .fontColor('#ED2800') 263 .fontColor('#ED2800')
@@ -151,7 +278,7 @@ struct ChannelDialog { @@ -151,7 +278,7 @@ struct ChannelDialog {
151 Row() { 278 Row() {
152 Text(item.name) 279 Text(item.name)
153 .fontSize(14) 280 .fontSize(14)
154 - .fontColor(this.currentTopNavSelectedIndex === index ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222')) 281 + .fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.homeChannel === '1' || item.movePermitted === 0 ? '#999999' : '#222222'))
155 282
156 if (this.isEditIng && item.myChannel !== '1') { 283 if (this.isEditIng && item.myChannel !== '1') {
157 Image($r('app.media.icon_audio_close')) 284 Image($r('app.media.icon_audio_close'))
@@ -162,15 +289,14 @@ struct ChannelDialog { @@ -162,15 +289,14 @@ struct ChannelDialog {
162 .width('100%') 289 .width('100%')
163 .height('100%') 290 .height('100%')
164 .justifyContent(FlexAlign.Center) 291 .justifyContent(FlexAlign.Center)
165 - .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '') 292 + .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
166 .onClick(() => { 293 .onClick(() => {
167 if (this.isEditIng) { 294 if (this.isEditIng) {
168 if (item.myChannel !== '1') { 295 if (item.myChannel !== '1') {
169 - this.myChannelItemEditHandle(index) 296 + this.delChannelItem(index)
170 } 297 }
171 } else { 298 } else {
172 this.confirm(index) 299 this.confirm(index)
173 - this.currentTopNavSelectedIndex = index  
174 this.controller?.close() 300 this.controller?.close()
175 } 301 }
176 }) 302 })
@@ -182,6 +308,33 @@ struct ChannelDialog { @@ -182,6 +308,33 @@ struct ChannelDialog {
182 color: '#EDEDED', 308 color: '#EDEDED',
183 radius: 3 309 radius: 3
184 }) 310 })
  311 + .zIndex(this.dragItem == item.num ? 1 : 0)
  312 + .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 })
  313 + .gesture(
  314 + GestureGroup(GestureMode.Sequence,
  315 + PanGesture({ fingers: 1, direction: null, distance: 0 })
  316 + .onActionStart((event: GestureEvent) => {
  317 + this.dragItem = item.num
  318 + this.dragRefOffsetX = 0
  319 + this.dragRefOffsetY = 0
  320 + })
  321 + .onActionUpdate((event: GestureEvent) => {
  322 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  323 + this.handleAnimationTo(item, event)
  324 + })
  325 + })
  326 + .onActionEnd((event: GestureEvent) => {
  327 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  328 + this.dragItem = -1
  329 + })
  330 + })
  331 + )
  332 + .onCancel(() => {
  333 + animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
  334 + this.dragItem = -1
  335 + })
  336 + }))
  337 +
185 }, (item: TopNavDTO) => JSON.stringify(item)) 338 }, (item: TopNavDTO) => JSON.stringify(item))
186 } 339 }
187 .width('100%') 340 .width('100%')
@@ -189,22 +342,7 @@ struct ChannelDialog { @@ -189,22 +342,7 @@ struct ChannelDialog {
189 .columnsTemplate('1fr 1fr 1fr 1fr') 342 .columnsTemplate('1fr 1fr 1fr 1fr')
190 .columnsGap(8) 343 .columnsGap(8)
191 .rowsGap(8) 344 .rowsGap(8)
192 - .height(Math.ceil(this.myChannelList.length / 4 ) * 48)  
193 - .editMode(this.isEditIng)  
194 - .supportAnimation(true) //设置Grid是否开启拖拽补位动画  
195 - .onItemDragStart((event: ItemDragInfo, itemIndex: number) => {  
196 - if(this.myChannelList[itemIndex].headlinesOn===1 || this.myChannelList[itemIndex].movePermitted===0){  
197 - return  
198 - }else{  
199 - return this.pixelMapBuilder(this.myChannelList[itemIndex], itemIndex) //设置拖拽过程中显示的元素。  
200 - }  
201 - })  
202 - .onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => { //绑定此事件的组件可作为拖拽释放目标,当在本组件范围内停止拖拽行为时,触发回调。  
203 - if (!isSuccess || insertIndex >= this.myChannelList.length || this.myChannelList[insertIndex].headlinesOn===1 || this.myChannelList[insertIndex].movePermitted===0) {  
204 - return  
205 - }  
206 - this.changeChannelIndex(itemIndex,insertIndex)  
207 - }) 345 + .height(Math.ceil(this.myChannelList.length / 4) * 48)
208 } 346 }
209 347
210 //更多频道列表 348 //更多频道列表
@@ -233,7 +371,7 @@ struct ChannelDialog { @@ -233,7 +371,7 @@ struct ChannelDialog {
233 .width('100%').height('100%') 371 .width('100%').height('100%')
234 .justifyContent(FlexAlign.Center) 372 .justifyContent(FlexAlign.Center)
235 .onClick(() => { 373 .onClick(() => {
236 - this.myChannelList.push(this.moreChannelList.splice(index, 1)[0]) 374 + this.addChannelItem(this.moreChannelList.splice(index, 1)[0])
237 }) 375 })
238 } 376 }
239 .width(80) 377 .width(80)
@@ -277,7 +415,7 @@ struct ChannelDialog { @@ -277,7 +415,7 @@ struct ChannelDialog {
277 .width('100%').height('100%') 415 .width('100%').height('100%')
278 .justifyContent(FlexAlign.Center) 416 .justifyContent(FlexAlign.Center)
279 .onClick(() => { 417 .onClick(() => {
280 - this.myChannelList.push(this.localChannelList.splice(index, 1)[0]) 418 + this.addChannelItem(this.localChannelList.splice(index, 1)[0])
281 }) 419 })
282 } 420 }
283 .width(80) 421 .width(80)
@@ -295,9 +433,8 @@ struct ChannelDialog { @@ -295,9 +433,8 @@ struct ChannelDialog {
295 } 433 }
296 434
297 }.width('100%').height('100%') 435 }.width('100%').height('100%')
298 -  
299 } 436 }
300 - .padding(15) 437 + .padding({ top: 40, right: 15, bottom: 20, left: 15 })
301 .backgroundColor('#ffffff') 438 .backgroundColor('#ffffff')
302 } 439 }
303 } 440 }
@@ -305,18 +442,42 @@ struct ChannelDialog { @@ -305,18 +442,42 @@ struct ChannelDialog {
305 // @Entry 442 // @Entry
306 @Component 443 @Component
307 struct ChannelSubscriptionLayout { 444 struct ChannelSubscriptionLayout {
308 - changeTab: (index: number) => void = () => {  
309 - }  
310 @State indexSettingArray: string [] = ['推荐', '热点'] 445 @State indexSettingArray: string [] = ['推荐', '热点']
311 //当前选中的频道 446 //当前选中的频道
312 @Link currentTopNavSelectedIndex: number; 447 @Link currentTopNavSelectedIndex: number;
313 @Link myChannelList: TopNavDTO [] 448 @Link myChannelList: TopNavDTO []
314 @Link moreChannelList: TopNavDTO [] 449 @Link moreChannelList: TopNavDTO []
315 @Link localChannelList: TopNavDTO [] 450 @Link localChannelList: TopNavDTO []
  451 + @Link @Watch('onChannelIdsUpdate') channelIds: number []
  452 + changeTab: (index: number) => void = () => {
  453 + }
  454 + //频道弹窗点击切换频道
316 onAccept = (index: number) => { 455 onAccept = (index: number) => {
317 - console.log(`onAccept${index}`)  
318 this.changeTab(index) 456 this.changeTab(index)
319 } 457 }
  458 + //交换我的频道数组中的位置
  459 + changeChannelIndex = (index1: number, index2: number) => {
  460 + let tmp = this.myChannelList.splice(index1, 1)
  461 + let channelIdTmp = this.channelIds.splice(index1, 1)
  462 + this.myChannelList.splice(index2, 0, tmp[0])
  463 + this.channelIds.splice(index2, 0, channelIdTmp[0])
  464 + }
  465 + //删除频道
  466 + delChannelItem = (index: number) => {
  467 + let item = this.myChannelList.splice(index, 1)[0]
  468 + this.channelIds.splice(index, 1)
  469 + if (item.moreChannel === '1') {
  470 + this.moreChannelList.unshift(item)
  471 + }
  472 + if (item.localChannel === '1') {
  473 + this.localChannelList.unshift(item)
  474 + }
  475 + }
  476 + // 添加频道
  477 + addChannelItem = (item: TopNavDTO) => {
  478 + this.channelIds.push(item.channelId)
  479 + this.myChannelList.push(item)
  480 + }
320 // @State currentTopNavSelectedIndex: number = 0 481 // @State currentTopNavSelectedIndex: number = 0
321 // @State topNavList: TopNavDTO [] = [ 482 // @State topNavList: TopNavDTO [] = [
322 // { 483 // {
@@ -1831,22 +1992,14 @@ struct ChannelSubscriptionLayout { @@ -1831,22 +1992,14 @@ struct ChannelSubscriptionLayout {
1831 moreChannelList: $moreChannelList, 1992 moreChannelList: $moreChannelList,
1832 localChannelList: $localChannelList, 1993 localChannelList: $localChannelList,
1833 confirm: this.onAccept, 1994 confirm: this.onAccept,
1834 - changeChannelIndex: this.changeChannelIndex 1995 + changeChannelIndex: this.changeChannelIndex,
  1996 + delChannelItem: this.delChannelItem,
  1997 + addChannelItem: this.addChannelItem
1835 }), 1998 }),
1836 alignment: DialogAlignment.TopEnd, 1999 alignment: DialogAlignment.TopEnd,
1837 customStyle: true, 2000 customStyle: true,
1838 }) 2001 })
1839 2002
1840 - changeChannelIndex(index1:number, index2:number) { //交换数组中的位置  
1841 - const temp = this.myChannelList[index1];  
1842 - if (index1 > index2) {  
1843 - this.myChannelList.splice(index2, 0, temp);  
1844 - this.myChannelList.splice(index1 + 1, 1);  
1845 - } else {  
1846 - this.myChannelList.splice(index2 + 1, 0, temp);  
1847 - this.myChannelList.splice(index1, 1);  
1848 - }  
1849 - }  
1850 // topNavListHandle() { 2003 // topNavListHandle() {
1851 // let defaultMyChannelList: TopNavDTO[] = [] 2004 // let defaultMyChannelList: TopNavDTO[] = []
1852 // let handledTopNavList = [...this.topNavList] 2005 // let handledTopNavList = [...this.topNavList]
@@ -1896,8 +2049,13 @@ struct ChannelSubscriptionLayout { @@ -1896,8 +2049,13 @@ struct ChannelSubscriptionLayout {
1896 // }) 2049 // })
1897 // } 2050 // }
1898 2051
  2052 + onChannelIdsUpdate(){
  2053 + AppStorage.SetOrCreate('channelIds', this.channelIds.join(','));
  2054 + console.log(`AppStorage.get('channelIds')${AppStorage.get('channelIds')}`)
  2055 + }
1899 2056
1900 aboutToAppear() { 2057 aboutToAppear() {
  2058 + console.log(`myChannelListzz${this.channelIds}}`)
1901 // this.topNavListHandle() 2059 // this.topNavListHandle()
1902 } 2060 }
1903 2061
@@ -68,6 +68,7 @@ export struct TopNavigationComponent { @@ -68,6 +68,7 @@ export struct TopNavigationComponent {
68 68
69 if (item.myChannel === '1') { 69 if (item.myChannel === '1') {
70 this.myChannelList.push(item) 70 this.myChannelList.push(item)
  71 + this.channelIds.push(item.channelId)
71 } 72 }
72 if (item.moreChannel === '1') { 73 if (item.moreChannel === '1') {
73 this.moreChannelList.push(item) 74 this.moreChannelList.push(item)
@@ -81,6 +82,7 @@ export struct TopNavigationComponent { @@ -81,6 +82,7 @@ export struct TopNavigationComponent {
81 isBroadcast (item: TopNavDTO) { 82 isBroadcast (item: TopNavDTO) {
82 return item.name === '播报' 83 return item.name === '播报'
83 } 84 }
  85 +
84 build() { 86 build() {
85 Column() { 87 Column() {
86 // 顶部搜索、日报logo、早晚报 88 // 顶部搜索、日报logo、早晚报
@@ -208,15 +210,15 @@ export struct TopNavigationComponent { @@ -208,15 +210,15 @@ export struct TopNavigationComponent {
208 }) 210 })
209 // 分类列表最右侧频道设置 211 // 分类列表最右侧频道设置
210 ChannelSubscriptionLayout({ 212 ChannelSubscriptionLayout({
211 - changeTab: (index) => {  
212 - this.tabsController.changeIndex(index)  
213 - }, 213 + currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
214 myChannelList: $myChannelList, 214 myChannelList: $myChannelList,
215 moreChannelList: $moreChannelList, 215 moreChannelList: $moreChannelList,
216 localChannelList: $localChannelList, 216 localChannelList: $localChannelList,
217 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex 217 + channelIds: $channelIds,
  218 + changeTab: (index) => {
  219 + this.tabsController.changeIndex(index)
  220 + }
218 }) 221 })
219 - // ChannelSubscriptionLayout()  
220 } 222 }
221 223
222 } 224 }