wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix: 1)编辑我的频道-编辑中_退出页面,再次进入不该仍为编辑中状态
  电子报修改
  cms视频详情页缺少来源、详情信息,见截图
  fix(18876): 功能缺陷-必修-【生产】 专题页点击评论数没有弹出评论弹窗
  feat: 1)解开埋点
@@ -2,8 +2,8 @@ @@ -2,8 +2,8 @@
2 "app": { 2 "app": {
3 "bundleName": "com.peopledailychina.hosactivity", 3 "bundleName": "com.peopledailychina.hosactivity",
4 "vendor": "$string:app_vendor", 4 "vendor": "$string:app_vendor",
5 - "versionCode": 7370,  
6 - "versionName": "7.3.7.0", 5 + "versionCode": 7390,
  6 + "versionName": "7.3.9.0",
7 "icon": "$media:app_icon", 7 "icon": "$media:app_icon",
8 "label": "$string:app_name" 8 "label": "$string:app_name"
9 } 9 }
@@ -48,9 +48,9 @@ export struct ENewspaperItemComponent { @@ -48,9 +48,9 @@ export struct ENewspaperItemComponent {
48 this.isShowSkeleton = false 48 this.isShowSkeleton = false
49 }) 49 })
50 .objectFit(ImageFit.Fill) 50 .objectFit(ImageFit.Fill)
51 - .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) 51 + .zIndex(10)
52 newsSkeleton() 52 newsSkeleton()
53 - .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None) 53 + .zIndex(1)
54 if (this.contentWidth !== 0) { 54 if (this.contentWidth !== 0) {
55 Canvas(this.context) 55 Canvas(this.context)
56 .width(px2vp(this.contentWidth)) 56 .width(px2vp(this.contentWidth))
@@ -59,6 +59,7 @@ export struct ENewspaperItemComponent { @@ -59,6 +59,7 @@ export struct ENewspaperItemComponent {
59 .onReady(() => { 59 .onReady(() => {
60 60
61 }) 61 })
  62 + .zIndex(15)
62 } 63 }
63 } 64 }
64 .padding({ 65 .padding({
@@ -14,6 +14,7 @@ import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' @@ -14,6 +14,7 @@ import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
14 import { common } from '@kit.AbilityKit'; 14 import { common } from '@kit.AbilityKit';
15 import { PageRepository } from '../repository/PageRepository'; 15 import { PageRepository } from '../repository/PageRepository';
16 import { CommentDialogView } from './CommentDialogView'; 16 import { CommentDialogView } from './CommentDialogView';
  17 +import { faceDetector } from '@kit.CoreVisionKit';
17 18
18 const TAG: string = 'SpacialTopicPageComponent' 19 const TAG: string = 'SpacialTopicPageComponent'
19 20
@@ -40,7 +41,7 @@ export struct SpacialTopicPageComponent { @@ -40,7 +41,7 @@ export struct SpacialTopicPageComponent {
40 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 41 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
41 @State isNetConnected: boolean = true 42 @State isNetConnected: boolean = true
42 @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 43 @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
43 - 44 + @State showComment: boolean = false
44 private trySendData2H5() { 45 private trySendData2H5() {
45 if (!this.webPrepared || !this.dataPrepared) { 46 if (!this.webPrepared || !this.dataPrepared) {
46 return 47 return
@@ -204,14 +205,14 @@ export struct SpacialTopicPageComponent { @@ -204,14 +205,14 @@ export struct SpacialTopicPageComponent {
204 this.showCommentList = true 205 this.showCommentList = true
205 } 206 }
206 }) 207 })
207 - // //全部评论  
208 - // CommentDialogView({  
209 - // index: $index,  
210 - // currentIndex: $currentIndex,  
211 - // showCommentList: $showCommentList,  
212 - // publishCommentModel: $publishCommentModel,  
213 - // interactData: $interactData,  
214 - // }) 208 + //全部评论
  209 + CommentDialogView({
  210 + index: $index,
  211 + currentIndex: $currentIndex,
  212 + showCommentList: $showCommentList,
  213 + publishCommentModel: $publishCommentModel,
  214 + interactData: $interactData,
  215 + }).visibility(this.showComment?Visibility.Visible:Visibility.Hidden)
215 } 216 }
216 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) 217 }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
217 } 218 }
@@ -12,7 +12,9 @@ const MORE_CHANNEL: string = '更多频道' @@ -12,7 +12,9 @@ const MORE_CHANNEL: string = '更多频道'
12 const LOCAL_CHANNEL: string = '地方频道' 12 const LOCAL_CHANNEL: string = '地方频道'
13 13
14 const TAG: string = 'ChannelSubscriptionLayout' 14 const TAG: string = 'ChannelSubscriptionLayout'
  15 +
15 export { ChannelSubscriptionLayout } 16 export { ChannelSubscriptionLayout }
  17 +
16 @Component 18 @Component
17 struct ChannelSubscriptionLayout { 19 struct ChannelSubscriptionLayout {
18 @State indexSettingArray: string [] = ['推荐', '热点'] 20 @State indexSettingArray: string [] = ['推荐', '热点']
@@ -20,14 +22,13 @@ struct ChannelSubscriptionLayout { @@ -20,14 +22,13 @@ struct ChannelSubscriptionLayout {
20 @Link currentTopNavSelectedIndex: number; 22 @Link currentTopNavSelectedIndex: number;
21 @Prop homeChannelList: TopNavDTO [] 23 @Prop homeChannelList: TopNavDTO []
22 // 我的频道栏目的频道信息数组 24 // 我的频道栏目的频道信息数组
23 - @Link myChannelList: TopNavDTO [] 25 + @Link @Watch('changeMyChannelData') myChannelList: TopNavDTO []
24 // 更多频道栏目频道信息数组 26 // 更多频道栏目频道信息数组
25 @Link moreChannelList: TopNavDTO [] 27 @Link moreChannelList: TopNavDTO []
26 // 地方频道栏目频道信息数组 28 // 地方频道栏目频道信息数组
27 @Link localChannelList: TopNavDTO [] 29 @Link localChannelList: TopNavDTO []
28 // 收集到的我的频道栏目中的频道id 30 // 收集到的我的频道栏目中的频道id
29 @State channelIds: number [] = [] 31 @State channelIds: number [] = []
30 -  
31 @State isShow: boolean = false 32 @State isShow: boolean = false
32 @State dragItem: number = -1 33 @State dragItem: number = -1
33 private dragRefOffsetX: number = 0 34 private dragRefOffsetX: number = 0
@@ -38,17 +39,14 @@ struct ChannelSubscriptionLayout { @@ -38,17 +39,14 @@ struct ChannelSubscriptionLayout {
38 private FIX_VP_Y: number = 48 39 private FIX_VP_Y: number = 48
39 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 40 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
40 @State isEditIng: boolean = false 41 @State isEditIng: boolean = false
41 - // @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO  
42 changeTab: (index: number) => void = () => { 42 changeTab: (index: number) => void = () => {
43 } 43 }
44 44
45 aboutToAppear() { 45 aboutToAppear() {
46 - // this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]  
47 - this.myChannelList.forEach(item => {  
48 - if(item != undefined && item.channelId != undefined){  
49 - this.channelIds.push(item.channelId)  
50 - }  
51 - }) 46 + this.changeMyChannelData()
  47 + }
  48 +
  49 + aboutToDisappear(): void {
52 } 50 }
53 51
54 //交换我的频道数组中的位置 52 //交换我的频道数组中的位置
@@ -79,24 +77,22 @@ struct ChannelSubscriptionLayout { @@ -79,24 +77,22 @@ struct ChannelSubscriptionLayout {
79 77
80 78
81 // 删除频道的索引值大于 我的栏目中频道最大索引值 79 // 删除频道的索引值大于 我的栏目中频道最大索引值
82 - if(this.currentTopNavSelectedIndex > this.channelIds.length-1){ 80 + if (this.currentTopNavSelectedIndex > this.channelIds.length - 1) {
83 //使用默认频道 81 //使用默认频道
84 //缓存首页频道 82 //缓存首页频道
85 let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) 83 let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)
86 - console.debug('TopNavigationComponent','index='+index)  
87 if (index > -1) { 84 if (index > -1) {
88 this.currentTopNavSelectedIndex = index 85 this.currentTopNavSelectedIndex = index
89 } 86 }
90 - }else {  
91 - //检测删除频道后的当前频道是否是特殊频道  
92 - let item = this.myChannelList[this.currentTopNavSelectedIndex]  
93 - if(this.isBroadcast(item) || this.isLayout(item)){ 87 + } else {
  88 + //检测删除频道后的当前频道是否是特殊频道
  89 + let item = this.myChannelList[this.currentTopNavSelectedIndex]
  90 + if (this.isBroadcast(item) || this.isLayout(item)) {
94 91
95 this.changeTab(this.currentTopNavSelectedIndex) 92 this.changeTab(this.currentTopNavSelectedIndex)
96 this.isShow = false 93 this.isShow = false
97 94
98 let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) 95 let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)
99 - console.debug('TopNavigationComponent','index='+index)  
100 if (index > -1) { 96 if (index > -1) {
101 this.currentTopNavSelectedIndex = index 97 this.currentTopNavSelectedIndex = index
102 this.changeTab(this.currentTopNavSelectedIndex) 98 this.changeTab(this.currentTopNavSelectedIndex)
@@ -128,7 +124,12 @@ struct ChannelSubscriptionLayout { @@ -128,7 +124,12 @@ struct ChannelSubscriptionLayout {
128 addChannelItem(item: TopNavDTO) { 124 addChannelItem(item: TopNavDTO) {
129 this.channelIds.push(item.channelId) 125 this.channelIds.push(item.channelId)
130 this.myChannelList.push(item) 126 this.myChannelList.push(item)
  127 +
  128 +
131 AppStorage.setOrCreate('channelIds', this.channelIds.join(',')) 129 AppStorage.setOrCreate('channelIds', this.channelIds.join(','))
  130 +
  131 + let storageChannelIds: string = AppStorage.get<string>('channelIds') || ''
  132 + console.debug('TopNavigationComponent', 'addChannelItem==>' + storageChannelIds)
132 } 133 }
133 134
134 itemMove(index: number, newIndex: number): void { 135 itemMove(index: number, newIndex: number): void {
@@ -273,6 +274,7 @@ struct ChannelSubscriptionLayout { @@ -273,6 +274,7 @@ struct ChannelSubscriptionLayout {
273 .width(24) 274 .width(24)
274 .onClick(() => { 275 .onClick(() => {
275 this.isShow = false 276 this.isShow = false
  277 + this.isEditIng = false
276 }) 278 })
277 } 279 }
278 .width('100%') 280 .width('100%')
@@ -569,5 +571,20 @@ struct ChannelSubscriptionLayout { @@ -569,5 +571,20 @@ struct ChannelSubscriptionLayout {
569 }) 571 })
570 .bindContentCover(this.isShow, this.sheetBuilder()) 572 .bindContentCover(this.isShow, this.sheetBuilder())
571 } 573 }
  574 +
  575 + /**
  576 + * 改变我的频道栏目中频道id数据
  577 + */
  578 + changeMyChannelData() {
  579 +
  580 + this.channelIds = []
  581 + this.myChannelList.forEach(item => {
  582 + if (item != undefined && item.channelId != undefined) {
  583 + this.channelIds.push(item.channelId)
  584 + }
  585 + })
  586 +
  587 + console.debug('TopNavigationComponent', '--changeMyChannelData channelIds--->' + this.channelIds.join(','))
  588 + }
572 } 589 }
573 590
@@ -346,12 +346,11 @@ export struct TopNavigationComponentNew { @@ -346,12 +346,11 @@ export struct TopNavigationComponentNew {
346 }) 346 })
347 } 347 }
348 348
349 -  
350 /** 349 /**
351 * 频道信息跳转页面方法 350 * 频道信息跳转页面方法
352 * @param index 351 * @param index
353 */ 352 */
354 - private channelJumpToPage(index :number){ 353 + private channelJumpToPage(index: number) {
355 if (this.isBroadcastByIndex(index)) { 354 if (this.isBroadcastByIndex(index)) {
356 // 跳转到播报页面 355 // 跳转到播报页面
357 ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) 356 ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
@@ -375,104 +374,6 @@ export struct TopNavigationComponentNew { @@ -375,104 +374,6 @@ export struct TopNavigationComponentNew {
375 this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER) 374 this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
376 } 375 }
377 376
378 - //处理新闻tab顶导频道数据  
379 - topNavListHandle() {  
380 - let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string  
381 - let _myChannelList: TopNavDTO [] = []  
382 - let _storageChannelIds: string [] = [] //list1  
383 - let defaultMyChannelList: TopNavDTO[] = []  
384 - let defaultList = [...this.topNavList]  
385 - defaultList.sort((a, b) => {  
386 - return a.num - b.num;  
387 - });  
388 -  
389 - //defaultMyChannelList  
390 - defaultList.forEach(item => {  
391 - if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 ||  
392 - item.headlinesOn === 1) {  
393 - defaultMyChannelList.push(item);  
394 - }  
395 - if (item.defaultPermitted === 1) {  
396 - this.homeChannelList.push(item)  
397 - }  
398 - })  
399 -  
400 - //有缓存频道id  
401 - if (this.storageChannelIds) {  
402 - _storageChannelIds = this.storageChannelIds.split(',')  
403 - }  
404 -  
405 - defaultMyChannelList.forEach(item => {  
406 - item.myChannel = '1'  
407 - if (item.defaultPermitted === 1) {  
408 - item.homeChannel = '1'  
409 - }  
410 - let index = defaultList.findIndex(_item => _item.channelId === item.channelId)  
411 - if (index !== -1) {  
412 - defaultList.splice(index, 1)  
413 - }  
414 - })  
415 - defaultList.unshift(...defaultMyChannelList)  
416 - defaultList.forEach((item, index) => {  
417 - if (item.channelType === 2) {  
418 - if (cityName.includes(item.name)) {  
419 - item.myChannel = '1'  
420 - }  
421 - item.localChannel = '1'  
422 - }  
423 - if (index >= 11) {  
424 - if (item.channelType === 1) {  
425 - item.moreChannel = '1'  
426 - }  
427 - } else {  
428 - if (item.channelType === 1 && item.myChannel !== '1') {  
429 - item.moreChannel = '1'  
430 - }  
431 - }  
432 - if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) {  
433 - item.myChannel = '1'  
434 - }  
435 - //频道分类  
436 - //TODO 暂时隐藏播报  
437 - if (item.name !== '播报') {  
438 - if (item.myChannel === '1') {  
439 - _myChannelList.push(item)  
440 - }  
441 - if (item.moreChannel === '1' && item.myChannel !== '1') {  
442 - this.moreChannelList.push(item)  
443 - }  
444 - if (item.localChannel === '1' && item.myChannel !== '1') {  
445 - this.localChannelList.push(item)  
446 - }  
447 - }  
448 - })  
449 -  
450 - //根据缓存数组排序  
451 - if (this.storageChannelIds) {  
452 - let sortedyChannelList = _myChannelList.sort((item1, item2) => {  
453 - let index1 = this.storageChannelIds.indexOf(String(item1.channelId));  
454 - let index2 = this.storageChannelIds.indexOf(String(item2.channelId));  
455 - return index1 - index2;  
456 - });  
457 - _myChannelList = sortedyChannelList  
458 - }  
459 -  
460 -  
461 - if (cityName) {  
462 - let index = _myChannelList.findIndex(ele => cityName.includes(ele.name))  
463 - const localChannelitem = _myChannelList.splice(index, 1)[0];  
464 - // 将当前地区频道插入到第四个  
465 - _myChannelList.splice(3, 0, localChannelitem);  
466 - }  
467 -  
468 - this.myChannelList = _myChannelList  
469 -  
470 - //缓存首页频道  
471 - let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)  
472 - if (index > -1) {  
473 - this.currentTopNavSelectedIndex = index  
474 - }  
475 - }  
476 377
477 /** 378 /**
478 * 频道是播报 379 * 频道是播报
@@ -517,12 +418,24 @@ export struct TopNavigationComponentNew { @@ -517,12 +418,24 @@ export struct TopNavigationComponentNew {
517 return item?.channelType === 3 418 return item?.channelType === 3
518 } 419 }
519 420
520 - aboutToAppear() {  
521 - //处理新闻tab顶导频道数据  
522 - this.topNavListHandle()  
523 - this.changePage(this.currentTopNavSelectedIndex) 421 + async aboutToAppear() {
  422 +
  423 +
  424 + if (CompUtils.isNews(this.navItem)) {
  425 +
  426 + // 请求顶导网络数据
  427 + this.getTopNavList(this.navItem.id)
  428 +
  429 + } else {
  430 + // if(CompUtils.isNews(this.navItem)){
  431 + // //处理新闻tab顶导频道数据
  432 + // this.topNavListHandle()
  433 + // }
  434 +
  435 + this.changePage(this.currentTopNavSelectedIndex)
  436 + }
  437 +
524 438
525 - this.getTopNavList(this.navItem.id)  
526 } 439 }
527 440
528 onTopNavigationDataUpdated() { 441 onTopNavigationDataUpdated() {
@@ -534,7 +447,6 @@ export struct TopNavigationComponentNew { @@ -534,7 +447,6 @@ export struct TopNavigationComponentNew {
534 * 447 *
535 */ 448 */
536 updateCurrentTopNavSelectedIndex() { 449 updateCurrentTopNavSelectedIndex() {
537 - console.debug(TAG, 'updateCurrentTopNavSelectedIndex=>' + this.currentTopNavSelectedIndex)  
538 if (CompUtils.isNews(this.navItem)) { 450 if (CompUtils.isNews(this.navItem)) {
539 const tab = this.myChannelList[this.currentTopNavSelectedIndex] 451 const tab = this.myChannelList[this.currentTopNavSelectedIndex]
540 // 埋点 452 // 埋点
@@ -659,7 +571,6 @@ export struct TopNavigationComponentNew { @@ -659,7 +571,6 @@ export struct TopNavigationComponentNew {
659 return null 571 return null
660 } 572 }
661 573
662 -  
663 /** 574 /**
664 * 进入早晚报专题 575 * 进入早晚报专题
665 */ 576 */
@@ -704,11 +615,128 @@ export struct TopNavigationComponentNew { @@ -704,11 +615,128 @@ export struct TopNavigationComponentNew {
704 615
705 //请求顶导数据 616 //请求顶导数据
706 async getTopNavList(id: number) { 617 async getTopNavList(id: number) {
707 - let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id) 618 +
  619 + Logger.debug(TAG, 'getTopNavList==>' + this.storageChannelIds)
  620 +
  621 + let bottomNavDetail = await ChannelViewModel.getBottomNavDetailData(id, this.storageChannelIds)
708 let topNavList = bottomNavDetail?.topNavChannelList || [] 622 let topNavList = bottomNavDetail?.topNavChannelList || []
709 - // for (let topNav of topNavList) {  
710 - // console.debug(TAG, 'getTopNavList=>' + JSON.stringify(topNav))  
711 - // 623 +
  624 + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
  625 + let _myChannelList: TopNavDTO [] = []
  626 + let _storageChannelIds: string [] = [] //list1
  627 + let defaultMyChannelList: TopNavDTO[] = []
  628 + let defaultList = [...topNavList]
  629 +
  630 + Logger.debug(TAG, 'cityName=>' + cityName)
  631 + // 排序
  632 + defaultList.sort((a, b) => {
  633 + return a.num - b.num;
  634 + });
  635 +
  636 + //defaultMyChannelList
  637 + defaultList.forEach(item => {
  638 + if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 ||
  639 + item.headlinesOn === 1) {
  640 + defaultMyChannelList.push(item);
  641 + }
  642 + if (item.defaultPermitted === 1) {
  643 + this.homeChannelList.push(item)
  644 + }
  645 + })
  646 +
  647 + //有缓存频道id
  648 + if (this.storageChannelIds) {
  649 + _storageChannelIds = this.storageChannelIds.split(',')
  650 +
  651 + }
  652 +
  653 + defaultMyChannelList.forEach(item => {
  654 + item.myChannel = '1'
  655 + if (item.defaultPermitted === 1) {
  656 + item.homeChannel = '1'
  657 + }
  658 + let index = defaultList.findIndex(_item => _item.channelId === item.channelId)
  659 + if (index !== -1) {
  660 + defaultList.splice(index, 1)
  661 + }
  662 + })
  663 + defaultList.unshift(...defaultMyChannelList)
  664 +
  665 + defaultList.forEach((item, index) => {
  666 + if (item.channelType === 2) {
  667 + if (cityName.includes(item.name)) {
  668 + item.myChannel = '1'
  669 + }
  670 + item.localChannel = '1'
  671 + }
  672 + if (index >= 11) {
  673 + if (item.channelType === 1) {
  674 + item.moreChannel = '1'
  675 + }
  676 + } else {
  677 + if (item.channelType === 1 && item.myChannel !== '1') {
  678 + item.moreChannel = '1'
  679 + }
  680 + }
  681 + if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) {
  682 + item.myChannel = '1'
  683 + }
  684 + //频道分类
  685 + //TODO 暂时隐藏播报
  686 + if (item.name !== '播报') {
  687 + if (item.myChannel === '1') {
  688 + _myChannelList.push(item)
  689 + }
  690 + if (item.moreChannel === '1' && item.myChannel !== '1') {
  691 + this.moreChannelList.push(item)
  692 + }
  693 + if (item.localChannel === '1' && item.myChannel !== '1') {
  694 + this.localChannelList.push(item)
  695 + }
  696 + }
  697 + })
  698 +
  699 + //根据缓存数组排序
  700 + if (this.storageChannelIds) {
  701 +
  702 + // let sortedyChannelList: TopNavDTO [] = []
  703 + //
  704 + // _storageChannelIds.forEach((channelId) => {
  705 + // console.debug(TAG, 'getTopNavList=0=>' + channelId)
  706 + // for (let a of _myChannelList) {
  707 + //
  708 + // console.debug(TAG,
  709 + // 'getTopNavList=1=>' + channelId + ' ' + a.channelId + ' ' + (channelId == String(a.channelId)))
  710 + // if (channelId == String(a.channelId)) {
  711 + // sortedyChannelList.push(a)
  712 + // break;
  713 + // }
  714 + // }
  715 + //
  716 + // })
  717 +
  718 + let sortedyChannelList = _myChannelList.sort((item1, item2) => {
  719 + let index1 = this.storageChannelIds.indexOf(String(item1.channelId));
  720 + let index2 = this.storageChannelIds.indexOf(String(item2.channelId));
  721 + return index1 - index2;
  722 + });
  723 + _myChannelList = sortedyChannelList
  724 + }
  725 +
  726 + // if (cityName) {
  727 + // let index = _myChannelList.findIndex(ele => cityName.includes(ele.name))
  728 + // const localChannelitem = _myChannelList.splice(index, 1)[0];
  729 + // // 将当前地区频道插入到第四个
  730 + // _myChannelList.splice(3, 0, localChannelitem);
712 // } 731 // }
  732 +
  733 + this.myChannelList = _myChannelList
  734 +
  735 +
  736 + //缓存首页频道
  737 + let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId)
  738 + if (index > -1) {
  739 + this.currentTopNavSelectedIndex = index
  740 + }
713 } 741 }
714 } 742 }
@@ -226,8 +226,25 @@ export class PageRepository { @@ -226,8 +226,25 @@ export class PageRepository {
226 return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url) 226 return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url)
227 }; 227 };
228 228
229 - static fetchNavigationDetailDataApi(id:number = 210) { 229 + /**
  230 + * 获取顶导详情
  231 + * @param id
  232 + * @returns
  233 + */
  234 + static fetchNavigationDetailDataApi(id: number = 210, myChannelIds?: string) {
230 let url = PageRepository.getBottomNavGroupDetailUrl() + `?id=${id}`; 235 let url = PageRepository.getBottomNavGroupDetailUrl() + `?id=${id}`;
  236 +
  237 + let provinceCode = HttpUtils.getProvinceCode()
  238 + if (provinceCode) {
  239 + url = url + "&districtCode=" + HttpUtils.getDistrictCode()
  240 + + "&provinceCode=" + HttpUtils.getProvinceCode()
  241 + + "&cityCode=" + HttpUtils.getCityCode()
  242 + }
  243 + if (myChannelIds) {
  244 + url = url + `&channelIds=${myChannelIds}`
  245 + }
  246 +
  247 +
231 return WDHttp.get<ResponseDTO<NavigationDetailDTO>>(url) 248 return WDHttp.get<ResponseDTO<NavigationDetailDTO>>(url)
232 }; 249 };
233 250
@@ -486,5 +503,4 @@ export class PageRepository { @@ -486,5 +503,4 @@ export class PageRepository {
486 url = url + "?mliveId=" + mLiveId 503 url = url + "?mliveId=" + mLiveId
487 return WDHttp.get<ResponseDTO<boolean>>(url) 504 return WDHttp.get<ResponseDTO<boolean>>(url)
488 } 505 }
489 -  
490 } 506 }
@@ -75,9 +75,9 @@ export class ChannelViewModel { @@ -75,9 +75,9 @@ export class ChannelViewModel {
75 /** 75 /**
76 * 获取底导详情(顶导)接口数据 76 * 获取底导详情(顶导)接口数据
77 */ 77 */
78 - async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> { 78 + async getBottomNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO> {
79 Logger.info(TAG, `getBottomNavDetailData start`); 79 Logger.info(TAG, `getBottomNavDetailData start`);
80 - return this.getNavDetailData(id); 80 + return this.getNavDetailData(id,myChannelIds);
81 } 81 }
82 82
83 private getNavData(): Promise<NavigationBodyDTO> { 83 private getNavData(): Promise<NavigationBodyDTO> {
@@ -105,10 +105,16 @@ export class ChannelViewModel { @@ -105,10 +105,16 @@ export class ChannelViewModel {
105 }) 105 })
106 } 106 }
107 107
108 - private getNavDetailData(id: number): Promise<NavigationDetailDTO> { 108 + /**
  109 + * 请求获取顶部导航栏数据
  110 + * @param id
  111 + * @param myChannelIds
  112 + * @returns
  113 + */
  114 + private getNavDetailData(id: number, myChannelIds?: string): Promise<NavigationDetailDTO> {
109 return new Promise<NavigationDetailDTO>((success, error) => { 115 return new Promise<NavigationDetailDTO>((success, error) => {
110 Logger.info(TAG, `getNavData start`); 116 Logger.info(TAG, `getNavData start`);
111 - PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => { 117 + PageRepository.fetchNavigationDetailDataApi(id,myChannelIds).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => {
112 if (!navResDTO || !navResDTO.data) { 118 if (!navResDTO || !navResDTO.data) {
113 Logger.error(TAG, 'getNavData then navResDTO is empty'); 119 Logger.error(TAG, 'getNavData then navResDTO is empty');
114 error('navResDTO is empty'); 120 error('navResDTO is empty');
@@ -3,6 +3,7 @@ import { ContentDetailDTO } from 'wdBean/Index' @@ -3,6 +3,7 @@ import { ContentDetailDTO } from 'wdBean/Index'
3 import { DetailDialog } from './DetailDialog' 3 import { DetailDialog } from './DetailDialog'
4 import { componentUtils } from '@kit.ArkUI' 4 import { componentUtils } from '@kit.ArkUI'
5 5
  6 +const TAG = 'PlayerTitleView';
6 @Preview 7 @Preview
7 @Component 8 @Component
8 export struct PlayerTitleView { 9 export struct PlayerTitleView {
@@ -11,6 +12,9 @@ export struct PlayerTitleView { @@ -11,6 +12,9 @@ export struct PlayerTitleView {
11 @Consume isOpenDetail: boolean 12 @Consume isOpenDetail: boolean
12 @Consume isDragging: boolean 13 @Consume isDragging: boolean
13 @State titleHeight: number = 0 14 @State titleHeight: number = 0
  15 + @State rmhPlatform: number = 0 // 1是人民号
  16 + @State isOverLines: boolean = false
  17 + @State summary: string = ''
14 dialogController: CustomDialogController = new CustomDialogController({ 18 dialogController: CustomDialogController = new CustomDialogController({
15 builder: DetailDialog({ 19 builder: DetailDialog({
16 name: this.getName(), 20 name: this.getName(),
@@ -26,7 +30,11 @@ export struct PlayerTitleView { @@ -26,7 +30,11 @@ export struct PlayerTitleView {
26 30
27 getName(): string { 31 getName(): string {
28 // authTitle 32 // authTitle
29 - return this.contentDetailData?.rmhInfo?.rmhName || '' 33 + if (this.rmhPlatform == 0) {
  34 + return this.contentDetailData?.newsSourceName || ''
  35 + } else {
  36 + return this.contentDetailData?.rmhInfo?.rmhName || ''
  37 + }
30 } 38 }
31 39
32 getIcon(): string { 40 getIcon(): string {
@@ -41,7 +49,45 @@ export struct PlayerTitleView { @@ -41,7 +49,45 @@ export struct PlayerTitleView {
41 return this.contentDetailData?.newIntroduction || '' 49 return this.contentDetailData?.newIntroduction || ''
42 } 50 }
43 51
  52 + /**
  53 + * 截断文本
  54 + * @author liuzhendong(猩猩G)
  55 + * @param {string} str 要截断的文本 '啊啊啊啊啊'
  56 + * @param {number} fontSize 字体大小(px)
  57 + * @param {number} maxLines 最大行数 3
  58 + * @param {number} textWidth 文本宽度(px) vp 需要转换vp2px()
  59 + * @returns {string} clipStr 截断后的文本 '啊啊'
  60 + */
  61 + clipText(str: string, fontSize: number, maxLines: number, textWidth: number): string {
  62 + let strArr: string[] = str.split("")
  63 + let truncateContent: string = '啊啊啊啊啊啊' // ...比正常文字宽度更小,这里使用啊啊啊(任意三个文字)代替计算
  64 + let measureTruncateWidth: number = measure.measureText({
  65 + textContent: truncateContent,
  66 + fontSize: fontSize,
  67 + fontWeight: 400,
  68 + lineHeight: 20,
  69 + wordBreak:WordBreak.BREAK_ALL
  70 + })
  71 + let clipStr: string = ''
  72 + for (let i = 0; i < strArr.length; i++) {
  73 + if (measure.measureText({
  74 + textContent: clipStr,
  75 + fontSize: fontSize,
  76 + fontWeight: 400,
  77 + lineHeight: 20,
  78 + wordBreak:WordBreak.BREAK_ALL
  79 + }) >= textWidth * maxLines - measureTruncateWidth) {
  80 + this.isOverLines = true
  81 + break;
  82 + }
  83 + clipStr += strArr[i]
  84 + }
  85 + console.log(TAG, 'clipStr:', clipStr)
  86 + return clipStr
  87 + }
  88 +
44 aboutToAppear(): void { 89 aboutToAppear(): void {
  90 + this.rmhPlatform = this.contentDetailData?.rmhPlatform || 0
45 const info = measure.measureTextSize({ 91 const info = measure.measureTextSize({
46 textContent: this.getTitle(), 92 textContent: this.getTitle(),
47 fontSize: 15, 93 fontSize: 15,
@@ -52,6 +98,8 @@ export struct PlayerTitleView { @@ -52,6 +98,8 @@ export struct PlayerTitleView {
52 }) 98 })
53 this.titleHeight = info?.height as number || 0 99 this.titleHeight = info?.height as number || 0
54 console.log('titleHeight:', this.titleHeight,) 100 console.log('titleHeight:', this.titleHeight,)
  101 + console.log(TAG, 'this.contentDetailData:', JSON.stringify(this.contentDetailData))
  102 + this.summary = this.getSummary()
55 } 103 }
56 104
57 build() { 105 build() {
@@ -64,7 +112,7 @@ export struct PlayerTitleView { @@ -64,7 +112,7 @@ export struct PlayerTitleView {
64 .maxLines(1) 112 .maxLines(1)
65 .lineHeight(25) 113 .lineHeight(25)
66 .fontWeight(600) 114 .fontWeight(600)
67 - .fontFamily('PingFang SC-Regular') 115 + .fontFamily('PingFang SC-Semibold')
68 .textOverflow({ overflow: TextOverflow.Ellipsis }) 116 .textOverflow({ overflow: TextOverflow.Ellipsis })
69 117
70 if (this.getIcon()) { 118 if (this.getIcon()) {
@@ -87,26 +135,70 @@ export struct PlayerTitleView { @@ -87,26 +135,70 @@ export struct PlayerTitleView {
87 /** 135 /**
88 * 标题大于三行或存在简介显示查看详情按钮 136 * 标题大于三行或存在简介显示查看详情按钮
89 */ 137 */
90 - if (this.titleHeight > 200 || this.getSummary()) {  
91 - Text('查看详情 > ')  
92 - .padding({  
93 - left: 6,  
94 - right: 6,  
95 - top: 4,  
96 - bottom: 4  
97 - })  
98 - .borderRadius(2)  
99 - .backgroundColor('#99636363')  
100 - .fontFamily('PingFang SC-Regular')  
101 - .fontColor(Color.White)  
102 - .fontSize(12)  
103 - .lineHeight(14)  
104 - .fontWeight(400)  
105 - .margin({ bottom: 8 })  
106 - .onClick(() => {  
107 - this.isOpenDetail = true  
108 - this.dialogController?.open()  
109 - }) 138 + if (this.rmhPlatform == 1) {
  139 + if (this.titleHeight > 200 || this.summary) {
  140 + Text('查看详情 > ')
  141 + .padding({
  142 + left: 6,
  143 + right: 6,
  144 + top: 4,
  145 + bottom: 4
  146 + })
  147 + .borderRadius(2)
  148 + .backgroundColor('#99636363')
  149 + .fontFamily('PingFang SC-Regular')
  150 + .fontColor(Color.White)
  151 + .fontSize(12)
  152 + .lineHeight(14)
  153 + .fontWeight(400)
  154 + .margin({ bottom: 8 })
  155 + .onClick(() => {
  156 + this.isOpenDetail = true
  157 + this.dialogController?.open()
  158 + })
  159 + }
  160 + } else {
  161 + if(this.summary) {
  162 + Text() {
  163 + Span(this.clipText(this.summary, 14, 2, this.windowWidth - 150 - vp2px(50)))
  164 + .fontSize(14)
  165 + .fontColor(Color.White)
  166 + .lineHeight(21)
  167 + .fontWeight(400)
  168 + .fontFamily('PingFang SC-Regular')
  169 + if (this.isOverLines) {
  170 + Span('... 全文')
  171 + .fontColor('#888888')
  172 + .fontWeight(400)
  173 + .fontFamily('PingFang SC-Regular')
  174 + .fontSize(12)
  175 + .onClick(() => {
  176 + this.isOpenDetail = true
  177 + this.dialogController?.open()
  178 + })
  179 + ImageSpan($r('app.media.comment_unfold_svg'))
  180 + .width(14)
  181 + .height(14)
  182 + .objectFit(ImageFit.Fill)
  183 + .verticalAlign(ImageSpanAlignment.CENTER)
  184 + .padding({
  185 + bottom: 4
  186 + })
  187 + .onClick(() => {
  188 + this.isOpenDetail = true
  189 + this.dialogController?.open()
  190 + })
  191 +
  192 + }
  193 + }
  194 + .padding({
  195 + left: 6,
  196 + right: 6,
  197 + top: 4,
  198 + bottom: 4
  199 + })
  200 + .margin({ bottom: 8 })
  201 + }
110 } 202 }
111 203
112 } 204 }
  1 +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><g transform="matrix(0,-1,1,0,-16,16)"><g><path d="M10.303455641479491,17.960819560243227L4.363755241479492,23.900515460243227Q4.324434578479492,23.939835460243224,4.324704443879492,23.995445460243225Q4.324434578479492,24.051055460243226,4.363755241479492,24.090375460243223L10.303455641479491,30.030075460243225Q10.342505641479491,30.069075460243226,10.397735641479493,30.069075460243226Q10.452965641479492,30.069075460243226,10.492015641479492,30.030075460243225L11.387685641479493,29.134375460243227Q11.406435641479492,29.115675460243224,11.416585641479493,29.091175460243225Q11.426735641479493,29.066675460243225,11.426735641479493,29.040075460243223Q11.426735641479493,29.013575460243224,11.416585641479493,28.989075460243225Q11.406435641479492,28.964575460243225,11.387685641479493,28.945875460243226L6.437285641479493,23.995445460243225L11.387685641479493,19.045045460243227Q11.406435641479492,19.026295460243226,11.416585641479493,19.001795460243226Q11.426735641479493,18.977295460243226,11.426735641479493,18.950765460243225Q11.426735641479493,18.924245460243224,11.416585641479493,18.899744460243227Q11.406435641479492,18.875241460243224,11.387685641479493,18.856488460243224L10.492015641479492,17.960819560243227Q10.452965641479492,17.921767119783226,10.397735641479493,17.921767119783226Q10.342505641479491,17.921767119783226,10.303455641479491,17.960819560243227Z" fill-rule="evenodd" fill="#888888" fill-opacity="1"/></g></g></svg>
@@ -24,6 +24,7 @@ export class Tracking { @@ -24,6 +24,7 @@ export class Tracking {
24 // Logger.error('yyyy','event track failed') 24 // Logger.error('yyyy','event track failed')
25 // }) 25 // })
26 26
  27 + //TODO: 添加运行单独线程?
27 // let publicParams = new PublicParams() 28 // let publicParams = new PublicParams()
28 // publicParams.getPublicParams().then((pubParams) => { 29 // publicParams.getPublicParams().then((pubParams) => {
29 // 30 //