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
yuzhilin
2024-04-28 19:22:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c06379ebdf0626100856d33af1f1efcf3919a117
c06379eb
1 parent
91703364
fix:频道订阅逻辑优化
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
35 deletions
sight_harmony/commons/wdJsBridge/src/main/ets/bean/CallBackMessage.ets
sight_harmony/commons/wdJsBridge/src/main/ets/core/BridgeWebViewControl.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextWebComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
sight_harmony/commons/wdJsBridge/src/main/ets/bean/CallBackMessage.ets
View file @
c06379e
...
...
@@ -7,7 +7,7 @@ export class CallBackMessage {
callbackId: string = ""; //callbackId
responseId: string = ""; //responseId
responseData: string = ""; //responseData
data?:
string
; //data of message
data?:
object
; //data of message
handlerName: string = ""; //name of handler
/**
...
...
sight_harmony/commons/wdJsBridge/src/main/ets/core/BridgeWebViewControl.ets
View file @
c06379e
...
...
@@ -128,11 +128,11 @@ export class BridgeWebViewControl extends webview.WebviewController {
* native 主动调用JSBridge方法
* @param msg
*/
callHandle(handlerName: string, data:
string
, callBack: Callback) {
callHandle(handlerName: string, data:
object
, callBack: Callback) {
this.doSend(handlerName, data, callBack)
}
private doSend(handlerName: string, data:
string
, callBack: Callback) {
private doSend(handlerName: string, data:
object
, callBack: Callback) {
let msg: CallBackMessage = new CallBackMessage()
if (StringUtils.isNotEmpty(data)) {
msg.data = data
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextWebComponent.ets
View file @
c06379e
...
...
@@ -119,7 +119,7 @@ export struct ImageAndTextWebComponent {
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
Logger.debug('ImageAndTextWebComponent', 'jsCall_receiveAppData');
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
JSON.stringify(h5ReceiveAppData)
, (data: string) => {
h5ReceiveAppData
, (data: string) => {
Logger.debug('ImageAndTextWebComponent', "from js data = " + data);
})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/SpacialTopicPageComponent.ets
View file @
c06379e
...
...
@@ -39,7 +39,7 @@ export struct SpacialTopicPageComponent {
private sendContentData2H5(h5ReceiveAppData: H5ReceiveDetailBean) {
this.webviewControl.callHandle(NativeCallH5Type.jsCall_receiveAppData,
JSON.stringify(h5ReceiveAppData)
, (data: string) => {
h5ReceiveAppData
, (data: string) => {
})
}
...
...
@@ -91,13 +91,14 @@ export struct SpacialTopicPageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 12
6 })
// .padding({ bottom: 7
6 })
if (!this.isPageEnd) {
detailedSkeleton()
}
//底部交互区
OperRowListView({ contentDetailData: this.contentDetailData[0],
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel
})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
c06379e
...
...
@@ -250,10 +250,10 @@ struct ChannelDialog {
.fontSize(16)
.fontWeight(600)
.margin({ right: 4 })
Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
.fontSize(12)
.fontWeight(400)
.fontColor('#222222')
// Text(!this.isEditIng ? MY_CHANNEL_TIP1 : MY_CHANNEL_TIP2)
// .fontSize(12)
// .fontWeight(400)
// .fontColor('#222222')
}
Text(this.isEditIng ? EDIT_DOWN : EDIT_TEXT)
...
...
@@ -276,9 +276,9 @@ struct ChannelDialog {
Row() {
Text(item.name)
.fontSize(14)
.fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.h
omeChannel === '1'
|| item.movePermitted === 0 ? '#999999' : '#222222'))
.fontColor(this.currentTopNavSelectedItem.channelId === item.channelId ? '#ED2800' : (item.h
eadlinesOn === 1
|| item.movePermitted === 0 ? '#999999' : '#222222'))
if (this.isEditIng && item.delPermitted === 1) {
if (this.isEditIng && item.delPermitted === 1
&& item.movePermitted === 1
) {
Image($r('app.media.icon_audio_close'))
.width(12)
.margin({ left: 1 })
...
...
@@ -287,12 +287,12 @@ struct ChannelDialog {
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor(item.h
omeChannel === '1'
|| item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
.backgroundColor(item.h
eadlinesOn === 1
|| item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
}
.width('23%')
.height(40)
.border({
width: item.h
omeChannel === '1'
? 0 : 1,
width: item.h
eadlinesOn === 1 || item.movePermitted === 0
? 0 : 1,
color: '#EDEDED',
radius: 3
})
...
...
@@ -303,7 +303,7 @@ struct ChannelDialog {
TapGesture()
.onAction((event?: GestureEvent) => {
if (this.isEditIng) {
if (item.delPermitted === 1) {
if (item.delPermitted === 1
&& item.movePermitted === 1
) {
this.delChannelItem(index)
}
} else {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
View file @
c06379e
...
...
@@ -59,7 +59,6 @@ export struct TopNavigationComponent {
@State autoRefresh2Page: number = 0
// 当前底导index
@State navIndex: number = 0
@State animationDuration: number = 0
@State indicatorLeftMargin: number = 0
@State indicatorWidth: number = 0
...
...
@@ -93,7 +92,8 @@ export struct TopNavigationComponent {
//defaultMyChannelList
defaultList.forEach(item => {
if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || item.headlinesOn === 1) {
if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 ||
item.headlinesOn === 1) {
defaultMyChannelList.push(item);
}
if (item.defaultPermitted === 1) {
...
...
@@ -136,7 +136,8 @@ export struct TopNavigationComponent {
}
//频道分类
if (item.myChannel === '1' && item.name !== '播报') {
if (item.name !== '播报') { //暂时隐藏播报
if (item.myChannel === '1') {
_myChannelList.push(item)
_channelIds.push(item.channelId)
} else if (item.moreChannel === '1') {
...
...
@@ -144,6 +145,7 @@ export struct TopNavigationComponent {
} else if (item.localChannel === '1') {
this.localChannelList.push(item)
}
}
})
...
...
@@ -169,7 +171,6 @@ export struct TopNavigationComponent {
return item.name === '版面'
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
...
...
@@ -216,7 +217,8 @@ export struct TopNavigationComponent {
// 频道分类list
Stack({ alignContent: Alignment.TopEnd }) {
Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList,
(navItem: TopNavDTO, index: number) => {
TabContent() {
if (this.currentBottomNavName === '视频' && navItem.name === '视频') {
VideoChannelDetail({
...
...
@@ -226,16 +228,14 @@ export struct TopNavigationComponent {
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
})
}
else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
} else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
PeopleShipMainComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
})
}
else
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
...
...
@@ -254,13 +254,14 @@ export struct TopNavigationComponent {
.barMode(BarMode.Scrollable)
.vertical(false)
.barBackgroundColor(this.barBackgroundColor)
.onAreaChange((oldValue: Area,
newValue: Area)
=> {
.onAreaChange((oldValue: Area,
newValue: Area)
=> {
let width = Number.parseFloat(newValue.width.toString())
this.tabsWidth = Number.isNaN(width) ? 0 : width
})
.animationDuration(this.animationDuration)
.onChange((index: number) => {
this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
this.currentTopNavName =
this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name
Logger.info(TAG, `onChange index : ${index}`);
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
...
...
@@ -288,24 +289,24 @@ export struct TopNavigationComponent {
let targetIndexInfo = this.getTextInfo(targetIndex)
this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width)
})
.onAnimationEnd((index: number,event: TabsAnimationEvent) => {
.onAnimationEnd((index: number,
event: TabsAnimationEvent) => {
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
) {
return
}
// 切换动画结束时触发该回调。下划线动画停止。
let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,event)
this.startAnimateTo(0,currentIndicatorInfo.left,currentIndicatorInfo.width)
let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event)
this.startAnimateTo(0, currentIndicatorInfo.left, currentIndicatorInfo.width)
})
.onGestureSwipe((index: number,event: TabsAnimationEvent) => {
.onGestureSwipe((index: number,
event: TabsAnimationEvent) => {
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
) {
return
}
// 在页面跟手滑动过程中,逐帧触发该回调。
let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,
event)
let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,
event)
this.currentTopNavSelectedIndex = currentIndicatorInfo.index
this.indicatorLeftMargin = currentIndicatorInfo.left
this.indicatorWidth = currentIndicatorInfo.width
...
...
@@ -351,8 +352,9 @@ export struct TopNavigationComponent {
.padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
.maxLines(this.MAX_LINE)
.id(index.toString())
.onAreaChange((oldValue: Area,newValue: Area) => {
if (this.currentTopNavSelectedIndex === index && (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)){
.onAreaChange((oldValue: Area, newValue: Area) => {
if (this.currentTopNavSelectedIndex === index &&
(this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {
if (newValue.position.x != undefined) {
let positionX = Number.parseFloat(newValue.position.x.toString())
this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX
...
...
@@ -396,7 +398,8 @@ export struct TopNavigationComponent {
}
onTopNavigationDataUpdated() {
Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
Logger.info(TAG,
`onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
}
onAutoRefresh() {
...
...
Please
register
or
login
to post a comment