Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
liyubing
2024-06-17 11:19:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5514b987e387157dc2427b6ebdb62dfd29275541
5514b987
1 parent
d548d76b
feat:
1)频道编辑页面,删除的频道留存的索引值无法指引顶导频道时,使用默认频道
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
41 deletions
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
5514b98
...
...
@@ -19,10 +19,15 @@ struct ChannelSubscriptionLayout {
//当前选中的频道
@Link currentTopNavSelectedIndex: number;
@Prop homeChannelList: TopNavDTO []
// 我的频道栏目的频道信息数组
@Link myChannelList: TopNavDTO []
// 更多频道栏目频道信息数组
@Link moreChannelList: TopNavDTO []
// 地方频道栏目频道信息数组
@Link localChannelList: TopNavDTO []
// 收集到的我的频道栏目中的频道id
@State channelIds: number [] = []
@State isShow: boolean = false
@State dragItem: number = -1
private dragRefOffsetX: number = 0
...
...
@@ -33,12 +38,12 @@ struct ChannelSubscriptionLayout {
private FIX_VP_Y: number = 48
@State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
@State isEditIng: boolean = false
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
//
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
changeTab: (index: number) => void = () => {
}
aboutToAppear() {
this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
//
this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
this.myChannelList.forEach(item => {
if(item != undefined && item.channelId != undefined){
this.channelIds.push(item.channelId)
...
...
@@ -57,15 +62,32 @@ struct ChannelSubscriptionLayout {
//删除频道
delChannelItem(index: number) {
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
AppStorage.setOrCreate('channelIds', JSON.stringify(this.channelIds))
/*
删除的频道信息回到原栏目中去
*/
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
if (item.localChannel === '1') {
this.localChannelList.unshift(item)
}
// 删除频道的索引值大于 我的栏目中频道最大索引值
if(this.currentTopNavSelectedIndex > this.channelIds.length-1){
//使用默认频道
//缓存首页频道
let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)
console.debug('TopNavigationComponent','index='+index)
if (index > -1) {
this.currentTopNavSelectedIndex = index
}
}
}
// 添加频道
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
View file @
5514b98
...
...
@@ -12,8 +12,6 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel';
import { CompUtils } from '../../utils/CompUtils';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import { JSON } from '@kit.ArkTS';
import text from '@ohos.graphics.text';
const TAG = 'TopNavigationComponent';
...
...
@@ -95,7 +93,6 @@ export struct TopNavigationComponentNew {
})
} else {
channelSkeleton()
//Text('特殊频道').fontColor(Color.Red).fontSize(20).width('100%').height('100%')
}
}
})
...
...
@@ -153,6 +150,8 @@ export struct TopNavigationComponentNew {
// 极左极右有特殊频道,用旧值
this.changePage(this.currentTopNavSelectedIndex)
}
} else {
//this.currentTopNavSelectedIndex = index
}
})
...
...
@@ -369,6 +368,7 @@ export struct TopNavigationComponentNew {
* @param index 频道所在的序列号
*/
private changePage(index: number) {
Logger.info(TAG, `修改页面 changePage index : ${index}`);
this.currentTopNavSelectedIndex = index
this.swiperController.changeIndex(index)
this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
...
...
@@ -521,7 +521,6 @@ export struct TopNavigationComponentNew {
this.topNavListHandle()
this.changePage(this.currentTopNavSelectedIndex)
console.log('XY', '----TopNavigation-------aboutToAppear' + this.navItem.name)
this.getTopNavList(this.navItem.id)
}
...
...
@@ -534,11 +533,9 @@ export struct TopNavigationComponentNew {
*
*/
updateCurrentTopNavSelectedIndex() {
console.debug(TAG, 'updateCurrentTopNavSelectedIndex=>' + this.currentTopNavSelectedIndex)
if (CompUtils.isNews(this.navItem)) {
const tab = this.myChannelList[this.currentTopNavSelectedIndex]
//Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`);
// 埋点
const params: ParamType = {
"pageName": tab.name,
...
...
@@ -548,8 +545,6 @@ export struct TopNavigationComponentNew {
Tracking.event("home_page_tab_click", params)
} else if (CompUtils.isRMH(this.navItem)) {
const tab = this.topNavList[this.currentTopNavSelectedIndex]
Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`);
// 埋点
const params: ParamType = {
"pageName": tab.name,
...
...
@@ -663,21 +658,6 @@ export struct TopNavigationComponentNew {
return null
}
//
// private startAnimateTo(duration: number, leftMargin: number, width: number) {
// animateTo({
// duration: duration, // 动画时长
// curve: Curve.Linear, // 动画曲线
// iterations: 1, // 播放次数
// playMode: PlayMode.Normal, // 动画模式
// onFinish: () => {
// console.info('play end')
// }
// }, () => {
// this.indicatorLeftMargin = leftMargin
// this.indicatorWidth = width
// })
// }
/**
* 进入早晚报专题
...
...
@@ -717,9 +697,9 @@ export struct TopNavigationComponentNew {
async getTopNavList(id: number) {
let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id)
let topNavList = bottomNavDetail?.topNavChannelList || []
for (let topNav of topNavList) {
console.debug(TAG, 'getTopNavList=>' + JSON.stringify(topNav))
}
// for (let topNav of topNavList) {
// console.debug(TAG, 'getTopNavList=>' + JSON.stringify(topNav))
//
// }
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/Tracking.ets
View file @
5514b98
...
...
@@ -24,17 +24,17 @@ export class Tracking {
// Logger.error('yyyy','event track failed')
// })
let publicParams = new PublicParams()
publicParams.getPublicParams().then((pubParams) => {
if (params) {
for (const obj of Object.entries(params)) {
// Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
pubParams[obj[0]] = obj[1]
}
}
sensors.track(eventId, pubParams)
})
// let publicParams = new PublicParams()
// publicParams.getPublicParams().then((pubParams) => {
//
// if (params) {
// for (const obj of Object.entries(params)) {
// // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
// pubParams[obj[0]] = obj[1]
// }
// }
// sensors.track(eventId, pubParams)
// })
}
}
...
...
Please
register
or
login
to post a comment