chenqs

fix |> 频道编辑页首页设置问题修复

@@ -46,6 +46,7 @@ struct ChannelSubscriptionLayout { @@ -46,6 +46,7 @@ struct ChannelSubscriptionLayout {
46 navItem: BottomNavDTO = {} as BottomNavDTO 46 navItem: BottomNavDTO = {} as BottomNavDTO
47 // 顶部导航栏是否有临时跳转频道数据不 47 // 顶部导航栏是否有临时跳转频道数据不
48 @Prop haveTempTabData: boolean 48 @Prop haveTempTabData: boolean
  49 +
49 changeTab: (index: number) => void = () => { 50 changeTab: (index: number) => void = () => {
50 } 51 }
51 52
@@ -272,6 +273,25 @@ struct ChannelSubscriptionLayout { @@ -272,6 +273,25 @@ struct ChannelSubscriptionLayout {
272 } 273 }
273 } 274 }
274 275
  276 +
  277 + @Builder
  278 + firstSettingItemBuilder (item:TopNavDTO, index: number){
  279 + if (this.homeChannelList.length == 1) {
  280 + Image('')
  281 + .width('100%')
  282 + .height('100%')
  283 + .backgroundColor('#ED2800')
  284 + .borderRadius(4)
  285 + }else {
  286 + Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') :
  287 + $r('app.media.index_setting_button'))
  288 + .objectFit(ImageFit.Contain)
  289 + .rotate({
  290 + angle: index === 1 ? 180 : 0
  291 + })
  292 + }
  293 + }
  294 +
275 @Builder 295 @Builder
276 sheetBuilder() { 296 sheetBuilder() {
277 Column() { 297 Column() {
@@ -290,60 +310,64 @@ struct ChannelSubscriptionLayout { @@ -290,60 +310,64 @@ struct ChannelSubscriptionLayout {
290 .padding({ bottom: 10 }) 310 .padding({ bottom: 10 })
291 311
292 List() { 312 List() {
293 - ListItem() {  
294 - Row() {  
295 - Text(INDEX_SETTING_TITLE)  
296 - .fontSize(16)  
297 - .fontWeight(600)  
298 - .margin({ right: 4 })  
299 -  
300 - Text(INDEX_SETTING_SUBTITLE)  
301 - .fontSize(12)  
302 - .fontWeight(400)  
303 - .fontColor('#80222222') 313 +
  314 + if (this.homeChannelList.length > 0) {
  315 + ListItem() {
  316 + Row() {
  317 + Text(INDEX_SETTING_TITLE)
  318 + .fontSize(16)
  319 + .fontWeight(600)
  320 + .margin({ right: 4 })
  321 +
  322 + Text(INDEX_SETTING_SUBTITLE)
  323 + .fontSize(12)
  324 + .fontWeight(400)
  325 + .fontColor('#80222222')
  326 + }
  327 + .width('100%')
  328 + .margin({ top: 22, bottom: 16 })
  329 +
304 } 330 }
305 - .width('100%')  
306 - .margin({ top: 22, bottom: 16 })  
307 331
308 - } 332 + ListItem() {
  333 + Flex({ justifyContent: FlexAlign.SpaceBetween }) {
  334 + ForEach(this.homeChannelList, (item: TopNavDTO, index: number) => {
  335 + Stack() {
  336 + this.firstSettingItemBuilder(item,index)
  337 + // Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') :
  338 + // $r('app.media.index_setting_button'))
  339 + // .objectFit(ImageFit.Contain)
  340 + // .rotate({
  341 + // angle: index === 1 ? 180 : 0
  342 + // })
  343 + Row() {
  344 + if (index === 0) {
  345 + Image(item.channelId === this.indexSettingChannelId ? $r('app.media.recommend_icon') :
  346 + $r('app.media.recommend_icon_active'))
  347 + .width(20)
  348 + }
  349 + Text(item.name)
  350 + .textAlign(TextAlign.Center)
  351 + .fontSize(16)
  352 + .fontColor(item.channelId === this.indexSettingChannelId ? '#ffffff' : '#ED2800')
309 353
310 - ListItem() {  
311 - Flex({ justifyContent: FlexAlign.SpaceBetween }) {  
312 - ForEach(this.homeChannelList, (item: TopNavDTO, index: number) => {  
313 - Stack() {  
314 - Image(item.channelId === this.indexSettingChannelId ? $r('app.media.index_setting_button_active') :  
315 - $r('app.media.index_setting_button'))  
316 - .objectFit(ImageFit.Auto)  
317 - .rotate({  
318 - angle: index === 1 ? 180 : 0  
319 - })  
320 - Row() {  
321 - if (index === 0) {  
322 - Image(item.channelId === this.indexSettingChannelId ? $r('app.media.recommend_icon') :  
323 - $r('app.media.recommend_icon_active'))  
324 - .width(20)  
325 } 354 }
326 - Text(item.name)  
327 - .textAlign(TextAlign.Center)  
328 - .fontSize(16)  
329 - .fontColor(item.channelId === this.indexSettingChannelId ? '#ffffff' : '#ED2800')  
330 - 355 + .width('100%')
  356 + .justifyContent(FlexAlign.Center)
331 } 357 }
332 - .width('100%')  
333 - .justifyContent(FlexAlign.Center)  
334 - }  
335 - .alignContent(Alignment.Start)  
336 - .height(36)  
337 - .onClick(() => {  
338 - this.indexSettingChannelId = item.channelId  
339 - AppStorage.set('indexSettingChannelId', item.channelId) 358 + .alignContent(Alignment.Start)
  359 + .height(36)
  360 + .layoutWeight(1)
  361 + .onClick(() => {
  362 + this.indexSettingChannelId = item.channelId
  363 + AppStorage.set('indexSettingChannelId', item.channelId)
  364 + })
340 }) 365 })
341 - }) 366 + }
  367 + .height(36)
  368 + .margin({ bottom: 36 })
342 } 369 }
343 - .height(36)  
344 - .margin({ bottom: 36 })  
345 } 370 }
346 -  
347 ListItem() { 371 ListItem() {
348 Row() { 372 Row() {
349 Row() { 373 Row() {
@@ -366,7 +390,7 @@ struct ChannelSubscriptionLayout { @@ -366,7 +390,7 @@ struct ChannelSubscriptionLayout {
366 } 390 }
367 .width('100%') 391 .width('100%')
368 .justifyContent(FlexAlign.SpaceBetween) 392 .justifyContent(FlexAlign.SpaceBetween)
369 - .margin({ bottom: 12 }) 393 + .margin({ top:this.homeChannelList.length > 0?0:22,bottom: 12 })
370 } 394 }
371 395
372 // 我的频道列表 396 // 我的频道列表