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: 回退app foreground background png
  fix: 替换app foreground background png
  fix |> 修复横屏直播点击暂停后,进入后台后,再进入前台,暂停播放按钮与播放器状态不一致问题
  fix: 修复已读的卡片内容置灰后杀进程再次返回频道页此时已读的内容变成未读状态
  title和summary总行数为4
  fix |> 修复人民号tab页头背景换肤与安卓和iOS不一致问题
  视频全屏时,支持横向滑动手势调整进度,功能未实现
  fix: WDPlayController play()增加prepare逻辑
  fix |> 修复tabbar来回多长切换出现多个选中的场景
  fix: 沉浸式视频网络差提示toast逻辑优化
  ref |> 华为分享增加标题和描述部分
  卡片来源显示规则调整未实现,单图卡,小视频卡,来源需要控制16个字,大图卡,三图卡,来源可以展示一行的就不需要控制16个字
Showing 21 changed files with 194 additions and 83 deletions
@@ -39,6 +39,7 @@ export interface ShareContentLink { @@ -39,6 +39,7 @@ export interface ShareContentLink {
39 desc?: string 39 desc?: string
40 link: string 40 link: string
41 icon?: string 41 icon?: string
  42 + posterImg?: Resource
42 deeplink: string // 根据内容详情,生成的深度链接 如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1 43 deeplink: string // 根据内容详情,生成的深度链接 如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1
43 44
44 } 45 }
@@ -7,19 +7,20 @@ import { common } from '@kit.AbilityKit'; @@ -7,19 +7,20 @@ import { common } from '@kit.AbilityKit';
7 import { systemShare } from '@kit.ShareKit'; 7 import { systemShare } from '@kit.ShareKit';
8 import { uniformTypeDescriptor as utd } from '@kit.ArkData'; 8 import { uniformTypeDescriptor as utd } from '@kit.ArkData';
9 import { JSON } from '@kit.ArkTS'; 9 import { JSON } from '@kit.ArkTS';
  10 +import { image } from '@kit.ImageKit';
  11 +import { WDShareBase } from '../WDShareBase';
10 12
11 const TAG = "WDSystemShare" 13 const TAG = "WDSystemShare"
12 14
13 export class WDSystemShare implements WDShareInterface { 15 export class WDSystemShare implements WDShareInterface {
14 16
15 - shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> { 17 + shareContent(scene: ShareScene, content: ShareContent, contentType: ShareContentType, context?: common.UIAbilityContext): Promise<string> {
16 18
17 - return new Promise((resolve, fail) => { 19 + return new Promise(async (resolve, fail) => {
18 try { 20 try {
19 21
20 - let data = this.getShareData(content, contentType) 22 + let data = await this.getShareData(content, contentType, context)
21 let controller: systemShare.ShareController = new systemShare.ShareController(data); 23 let controller: systemShare.ShareController = new systemShare.ShareController(data);
22 - let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext  
23 24
24 controller.on('dismiss', () => { 25 controller.on('dismiss', () => {
25 26
@@ -31,51 +32,78 @@ export class WDSystemShare implements WDShareInterface { @@ -31,51 +32,78 @@ export class WDSystemShare implements WDShareInterface {
31 selectionMode: systemShare.SelectionMode.SINGLE 32 selectionMode: systemShare.SelectionMode.SINGLE
32 }); 33 });
33 34
34 - console.log("分享控制器调用完成") 35 + console.log(TAG, "分享控制器调用完成")
35 } catch (e) { 36 } catch (e) {
  37 + console.log(TAG, "异常1" + JSON.stringify(e))
36 fail(e) 38 fail(e)
37 } 39 }
38 }) 40 })
39 } 41 }
40 42
41 - getShareData(content: ShareContent, contentType: ShareContentType) : systemShare.SharedData {  
42 - if (contentType === ShareContentType.PrueText) {  
43 - let prueText = content as ShareContentText  
44 - console.log("分享纯文本")  
45 - return new systemShare.SharedData({  
46 - utd: utd.UniformDataType.PLAIN_TEXT,  
47 - content: prueText.text  
48 - });  
49 - }  
50 -  
51 - if (contentType === ShareContentType.ImageAndText) {  
52 - let imageAndText = content as ShareContentImageAndText  
53 - console.log("分享图片和文本")  
54 - let data: systemShare.SharedData = new systemShare.SharedData({  
55 - utd: utd.UniformDataType.PLAIN_TEXT,  
56 - content: imageAndText.title  
57 - });  
58 - data.addRecord({  
59 - utd: utd.UniformDataType.PNG,  
60 - uri: imageAndText.imgURI // 这里必须为本地连接  
61 - });  
62 - return data  
63 - }  
64 -  
65 - console.log("分享链接和文本")  
66 - let link = content as ShareContentLink  
67 - let data: systemShare.SharedData = new systemShare.SharedData({  
68 - utd: utd.UniformDataType.PLAIN_TEXT,  
69 - content: link.title  
70 - });  
71 - let shareLink = this.generateShareLink(link)  
72 - console.log("分享 shareLink ==> " + shareLink)  
73 - data.addRecord({  
74 - utd: utd.UniformDataType.HYPERLINK,  
75 - // uri: link.link // SDK 设计 不能传这里  
76 - content: link.link  
77 - });  
78 - return data 43 + getShareData(content: ShareContent, contentType: ShareContentType, context?: common.UIAbilityContext) : Promise<systemShare.SharedData> {
  44 + return new Promise((resolve, fail) => {
  45 +
  46 + if (contentType === ShareContentType.PrueText) {
  47 + let prueText = content as ShareContentText
  48 + console.log(TAG, "分享纯文本")
  49 + resolve(new systemShare.SharedData({
  50 + utd: utd.UniformDataType.PLAIN_TEXT,
  51 + content: prueText.text
  52 + }))
  53 + return;
  54 + }
  55 +
  56 + if (contentType === ShareContentType.ImageAndText) {
  57 + let imageAndText = content as ShareContentImageAndText
  58 + console.log(TAG, "分享图片和文本")
  59 + let data: systemShare.SharedData = new systemShare.SharedData({
  60 + utd: utd.UniformDataType.PLAIN_TEXT,
  61 + content: imageAndText.title
  62 + });
  63 + data.addRecord({
  64 + utd: utd.UniformDataType.PNG,
  65 + uri: imageAndText.imgURI // 这里必须为本地连接
  66 + });
  67 + resolve(data)
  68 + return
  69 + }
  70 +
  71 + console.log(TAG, "分享链接和文本")
  72 + let link = content as ShareContentLink
  73 + let posterImg: Uint8Array | undefined = undefined
  74 + let shareLink = this.generateShareLink(link)
  75 + console.log("TAG, 分享 shareLink ==> " + shareLink)
  76 +
  77 + if (!context || !link.posterImg) {
  78 + let data: systemShare.SharedData = new systemShare.SharedData({
  79 + utd: utd.UniformDataType.HYPERLINK,
  80 + // uri: link.link // SDK 设计 不能传这里
  81 + content: link.link,
  82 + title: link.title,
  83 + description: link.desc,
  84 + thumbnail: posterImg
  85 + });
  86 + resolve(data)
  87 + return
  88 + }
  89 +
  90 + context.resourceManager.getMediaContent(link.posterImg)
  91 + .then((posterImg) => {
  92 + let data: systemShare.SharedData = new systemShare.SharedData({
  93 + utd: utd.UniformDataType.HYPERLINK,
  94 + // uri: link.link // SDK 设计 不能传这里
  95 + content: link.link,
  96 + title: link.title,
  97 + description: link.desc,
  98 + thumbnail: posterImg
  99 + });
  100 + resolve(data)
  101 + })
  102 + .catch((e: Error) => {
  103 + console.log(TAG, "异常" + JSON.stringify(e))
  104 + fail(e)
  105 + })
  106 + })
79 } 107 }
80 108
81 generateShareLink(shareContent: ShareContentLink) { 109 generateShareLink(shareContent: ShareContentLink) {
@@ -2,6 +2,7 @@ import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constan @@ -2,6 +2,7 @@ import { ShareContent, ShareContentType, ShareScene, ShareType } from './Constan
2 import { HashMap } from '@kit.ArkTS' 2 import { HashMap } from '@kit.ArkTS'
3 import { WDShareInterface } from './WDShareInterface' 3 import { WDShareInterface } from './WDShareInterface'
4 import { WDSystemShare } from './System/WDSystemShare' 4 import { WDSystemShare } from './System/WDSystemShare'
  5 +import { common } from '@kit.AbilityKit'
5 6
6 export interface WDShareObject { 7 export interface WDShareObject {
7 to: ShareType, 8 to: ShareType,
@@ -12,6 +13,8 @@ export interface WDShareObject { @@ -12,6 +13,8 @@ export interface WDShareObject {
12 13
13 export class WDShareBase { 14 export class WDShareBase {
14 15
  16 + public gotContextFunc?: () => common.UIAbilityContext
  17 +
15 private static instance?: WDShareBase 18 private static instance?: WDShareBase
16 static getInstance() : WDShareBase { 19 static getInstance() : WDShareBase {
17 if (!WDShareBase.instance) { 20 if (!WDShareBase.instance) {
@@ -30,7 +33,8 @@ export class WDShareBase { @@ -30,7 +33,8 @@ export class WDShareBase {
30 share(obj: WDShareObject) : null | Promise<string> { 33 share(obj: WDShareObject) : null | Promise<string> {
31 let shareHandler: WDShareInterface = this.handles.get(obj.to) 34 let shareHandler: WDShareInterface = this.handles.get(obj.to)
32 if (shareHandler) { 35 if (shareHandler) {
33 - return shareHandler.shareContent(obj.scene, obj.obj, obj.type) 36 + let context = this.gotContextFunc && this.gotContextFunc()
  37 + return shareHandler.shareContent(obj.scene, obj.obj, obj.type, context)
34 } 38 }
35 return null 39 return null
36 } 40 }
1 import { ShareContent, ShareContentType, ShareScene } from './Constant' 1 import { ShareContent, ShareContentType, ShareScene } from './Constant'
2 import { AsyncCallback } from '@kit.BasicServicesKit' 2 import { AsyncCallback } from '@kit.BasicServicesKit'
  3 +import { common } from '@kit.AbilityKit'
3 4
4 export interface WDShareInterface { 5 export interface WDShareInterface {
5 // shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void 6 // shareContent(scene:ShareScene, content: ShareContent, callback: AsyncCallback<void>): void
6 - shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType): Promise<string> 7 + shareContent(scene:ShareScene, content: ShareContent, contentType: ShareContentType, context?: common.UIAbilityContext): Promise<string>
7 8
8 9
9 10
@@ -147,21 +147,23 @@ export struct CardSourceInfo { @@ -147,21 +147,23 @@ export struct CardSourceInfo {
147 } 147 }
148 148
149 // 评论数 149 // 评论数
150 - if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&  
151 - this.showCommentNum()) {  
152 - Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)  
153 - .fontSize($r("app.float.font_size_11"))  
154 - .fontColor($r("app.color.color_B0B0B0"))  
155 - .flexShrink(0)  
156 - } else {  
157 -  
158 - if (this.contentDTO.objectType !=='2' && this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {  
159 - Text(`${this.handlerNum(this.contentDTO.interactData?.commentNum.toString())}评`) 150 + if (!this.contentDTO.cornerMark && !this.contentDTO.corner) {
  151 + if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
  152 + this.showCommentNum()) {
  153 + Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)
160 .fontSize($r("app.float.font_size_11")) 154 .fontSize($r("app.float.font_size_11"))
161 .fontColor($r("app.color.color_B0B0B0")) 155 .fontColor($r("app.color.color_B0B0B0"))
162 .flexShrink(0) 156 .flexShrink(0)
163 - } 157 + } else {
164 158
  159 + if (this.contentDTO.objectType !=='2' && this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
  160 + Text(`${this.handlerNum(this.contentDTO.interactData?.commentNum.toString())}评`)
  161 + .fontSize($r("app.float.font_size_11"))
  162 + .fontColor($r("app.color.color_B0B0B0"))
  163 + .flexShrink(0)
  164 + }
  165 +
  166 + }
165 } 167 }
166 168
167 } 169 }
@@ -92,6 +92,7 @@ export struct TopNavigationComponentNew { @@ -92,6 +92,7 @@ export struct TopNavigationComponentNew {
92 channelId: navItem?.channelId + '', 92 channelId: navItem?.channelId + '',
93 autoRefresh: this.autoRefresh2Page 93 autoRefresh: this.autoRefresh2Page
94 }) 94 })
  95 + .backgroundColor(Color.White)
95 } else { 96 } else {
96 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { 97 if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
97 if (CompUtils.isNews(this.navItem)) { 98 if (CompUtils.isNews(this.navItem)) {
@@ -172,7 +173,8 @@ export struct TopNavigationComponentNew { @@ -172,7 +173,8 @@ export struct TopNavigationComponentNew {
172 channelId: navItem?.channelId + '', 173 channelId: navItem?.channelId + '',
173 autoRefresh: this.autoRefresh2Page, 174 autoRefresh: this.autoRefresh2Page,
174 isMourning: mourningCheckFn(`${navItem.channelId}`), 175 isMourning: mourningCheckFn(`${navItem.channelId}`),
175 - }); 176 + })
  177 + .backgroundColor(CompUtils.isRMH(this.navItem)?Color.White:Color.Transparent)
176 } 178 }
177 179
178 /** 180 /**
@@ -259,10 +261,11 @@ export struct TopNavigationComponentNew { @@ -259,10 +261,11 @@ export struct TopNavigationComponentNew {
259 @Builder 261 @Builder
260 tabBar() { 262 tabBar() {
261 263
  264 + // 顶部背景图
  265 + Image(this.navItem.backgroundUrl).width('100%').height('100%')
  266 + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
  267 +
262 if (CompUtils.isNews(this.navItem)) { 268 if (CompUtils.isNews(this.navItem)) {
263 - // 顶部背景图  
264 - Image(this.navItem.backgroundUrl).width('100%')  
265 - .grayscale(this.GrayManage.get().isMourning() ? 1 : 0)  
266 // 顶部搜索、日报logo、早晚报 269 // 顶部搜索、日报logo、早晚报
267 this.topBar() 270 this.topBar()
268 271
@@ -306,10 +309,10 @@ export struct TopNavigationComponentNew { @@ -306,10 +309,10 @@ export struct TopNavigationComponentNew {
306 }) 309 })
307 } else { 310 } else {
308 // 顶部背景图 311 // 顶部背景图
309 - Image(this.navItem.backgroundUrl)  
310 - .width('100%')  
311 - .height(this.backgroundImageH)  
312 - .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) 312 + // Image(this.navItem.backgroundUrl)
  313 + // .width('100%')
  314 + // .height(this.backgroundImageH)
  315 + // .grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
313 316
314 Row() { 317 Row() {
315 Image($r('app.media.icon_search')) 318 Image($r('app.media.icon_search'))
@@ -261,8 +261,8 @@ export struct LiveHorizontalCardComponent { @@ -261,8 +261,8 @@ export struct LiveHorizontalCardComponent {
261 } 261 }
262 // .width(CommonConstants.FULL_WIDTH) 262 // .width(CommonConstants.FULL_WIDTH)
263 .padding({ 263 .padding({
264 - left: $r('app.float.card_comp_pagePadding_lf'),  
265 - right: $r('app.float.card_comp_pagePadding_lf'), 264 + left: 10,
  265 + right: 10,
266 top: $r('app.float.card_comp_pagePadding_tb'), 266 top: $r('app.float.card_comp_pagePadding_tb'),
267 bottom: 6 267 bottom: 6
268 }) 268 })
1 -PersistentStorage.persistProp('clickedIds', []);  
2 1
3 function persistentStorage(id: string | number, type: 'add' | 'remove' | undefined = 'add') { 2 function persistentStorage(id: string | number, type: 'add' | 'remove' | undefined = 'add') {
4 let _clickedIds = AppStorage.get<string[]>('clickedIds'); 3 let _clickedIds = AppStorage.get<string[]>('clickedIds');
@@ -31,6 +31,7 @@ export struct PlayUIComponent { @@ -31,6 +31,7 @@ export struct PlayUIComponent {
31 @Consume playSourceState: number 31 @Consume playSourceState: number
32 32
33 onChangeMenuVisible() { 33 onChangeMenuVisible() {
  34 + this.isPlayStatus = !this.isPlayStatus
34 if (!this.contentDetailData || !this.contentDetailData.liveInfo || 35 if (!this.contentDetailData || !this.contentDetailData.liveInfo ||
35 this.contentDetailData?.liveInfo?.liveState === 'wait') { 36 this.contentDetailData?.liveInfo?.liveState === 'wait') {
36 return 37 return
@@ -40,7 +40,6 @@ export struct TopPlayComponent { @@ -40,7 +40,6 @@ export struct TopPlayComponent {
40 @Consume @Watch('pageHideChange') pageHide: number 40 @Consume @Watch('pageHideChange') pageHide: number
41 init: boolean = false 41 init: boolean = false
42 @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息 42 @Prop @Watch("liveIMControlMessageChange") lastLiveControl: LiveRoomItemBean = {} as LiveRoomItemBean // IM 控制消息
43 -  
44 pageShowChange() { 43 pageShowChange() {
45 this.playerController?.play() 44 this.playerController?.play()
46 } 45 }
@@ -304,10 +304,11 @@ export struct DetailPlayShortVideoPage { @@ -304,10 +304,11 @@ export struct DetailPlayShortVideoPage {
304 } 304 }
305 }) 305 })
306 this.playerViewBuilder() 306 this.playerViewBuilder()
307 -  
308 - PlayerBottomView({  
309 - playerController: this.playerController  
310 - }) 307 + if(this.index === this.currentIndex) {
  308 + PlayerBottomView({
  309 + playerController: this.playerController
  310 + })
  311 + }
311 312
312 PlayerRightView({ 313 PlayerRightView({
313 playerController: this.playerController 314 playerController: this.playerController
@@ -2,7 +2,7 @@ import { ContentDetailDTO } from 'wdBean/Index' @@ -2,7 +2,7 @@ import { ContentDetailDTO } from 'wdBean/Index'
2 import { WDShare } from 'wdShare/Index' 2 import { WDShare } from 'wdShare/Index'
3 import { PlayerProgressFullScreenView } from './PlayerProgressFullScreenView' 3 import { PlayerProgressFullScreenView } from './PlayerProgressFullScreenView'
4 import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index' 4 import { PlayerConstants, WDPlayerController } from 'wdPlayer/Index'
5 -import { DateTimeUtils, WindowModel } from 'wdKit/Index' 5 +import { DateTimeUtils, Logger, WindowModel } from 'wdKit/Index'
6 import { DisplayDirection } from 'wdConstant/Index' 6 import { DisplayDirection } from 'wdConstant/Index'
7 import { window } from '@kit.ArkUI' 7 import { window } from '@kit.ArkUI'
8 8
@@ -64,7 +64,7 @@ export struct PlayerFullScreenView { @@ -64,7 +64,7 @@ export struct PlayerFullScreenView {
64 }) 64 })
65 65
66 this.headerBuilder() 66 this.headerBuilder()
67 - 67 + this.middleSlideBuilder()
68 this.bottomBuilder() 68 this.bottomBuilder()
69 } 69 }
70 .zIndex(99999) 70 .zIndex(99999)
@@ -187,4 +187,45 @@ export struct PlayerFullScreenView { @@ -187,4 +187,45 @@ export struct PlayerFullScreenView {
187 }) 187 })
188 188
189 } 189 }
  190 +
  191 + @Builder
  192 + middleSlideBuilder() {
  193 + Column() {
  194 + Slider({
  195 + value: this.progressVal,
  196 + step: 0.01,
  197 + style: SliderStyle.OutSet
  198 + })
  199 + .trackColor(Color.Transparent)// 设置轨道为透明
  200 + .selectedColor(Color.Transparent)// 设置已选择部分为透明
  201 + .blockColor(Color.Transparent)// 设置滑块为透明
  202 + .trackThickness(4)
  203 + .showSteps(false)// 不显示步进刻度
  204 + .showTips(false)// 不显示提示
  205 + .width('100%')
  206 + .height('100%')
  207 + .onChange((value: number, mode: SliderChangeMode) => {
  208 + this.progressVal = value
  209 + if (mode === SliderChangeMode.Moving) {
  210 + this.isDragging = true
  211 + }
  212 + if (mode === SliderChangeMode.End) {
  213 + this.isDragging = false
  214 + }
  215 +
  216 + console.log('Transparent slider value:', value)
  217 + })
  218 + }.margin({ top: 73, bottom: 73 })
  219 + .onTouch((event?: TouchEvent) => {
  220 + if (event) {
  221 + if (event.type === TouchType.Down) {
  222 + clearInterval(this.timer)
  223 + }
  224 + if (event.type === TouchType.Up) {
  225 + this.restartTimer();
  226 + this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End);
  227 + }
  228 + }
  229 + })
  230 + }
190 } 231 }
@@ -30,13 +30,10 @@ export struct PlayerProgressView { @@ -30,13 +30,10 @@ export struct PlayerProgressView {
30 if (this.onlyWifiLoadVideo) { 30 if (this.onlyWifiLoadVideo) {
31 this.showLoading = true 31 this.showLoading = true
32 } 32 }
33 - // console.log("PlayerProgressView11", this.timer)  
34 - if(this.timer) {  
35 - clearTimeout(this.timer)  
36 - }  
37 this.timer = setTimeout(() => { 33 this.timer = setTimeout(() => {
38 ToastUtils.shortToast('网络出小差了,请检查下网络') 34 ToastUtils.shortToast('网络出小差了,请检查下网络')
39 }, 10000) 35 }, 10000)
  36 + // console.log("PlayerProgressView11", this.timer)
40 } else { 37 } else {
41 // console.log("PlayerProgressView22", this.timer) 38 // console.log("PlayerProgressView22", this.timer)
42 clearTimeout(this.timer) 39 clearTimeout(this.timer)
@@ -16,6 +16,11 @@ export struct PlayerTitleView { @@ -16,6 +16,11 @@ export struct PlayerTitleView {
16 @State rmhPlatform: number = 0 // 1是人民号 16 @State rmhPlatform: number = 0 // 1是人民号
17 @State isOverLines: boolean = false 17 @State isOverLines: boolean = false
18 @State summary: string = '' 18 @State summary: string = ''
  19 +
  20 + @State private titleLines: number = 0
  21 + @State private summaryLines: number = 0
  22 +
  23 +
19 dialogController: CustomDialogController = new CustomDialogController({ 24 dialogController: CustomDialogController = new CustomDialogController({
20 builder: DetailDialog({ 25 builder: DetailDialog({
21 name: this.getName(), 26 name: this.getName(),
@@ -104,6 +109,13 @@ export struct PlayerTitleView { @@ -104,6 +109,13 @@ export struct PlayerTitleView {
104 this.summary = this.getSummary() 109 this.summary = this.getSummary()
105 } 110 }
106 111
  112 +
  113 + private updateSummaryLines() {
  114 + this.summaryLines = Math.max(1, 4 - this.titleLines)
  115 + this.isOverLines = this.summary.length > this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)).length
  116 + }
  117 +
  118 +
107 build() { 119 build() {
108 Column() { 120 Column() {
109 if (this.getName()) { 121 if (this.getName()) {
@@ -133,7 +145,10 @@ export struct PlayerTitleView { @@ -133,7 +145,10 @@ export struct PlayerTitleView {
133 .fontFamily('PingFang SC-Regular') 145 .fontFamily('PingFang SC-Regular')
134 .textOverflow({ overflow: TextOverflow.Ellipsis }) 146 .textOverflow({ overflow: TextOverflow.Ellipsis })
135 .margin({ bottom: 2 }) //8 147 .margin({ bottom: 2 }) //8
136 - 148 + .onAreaChange((oldArea: Area, newArea: Area) => {
  149 + this.titleLines = Math.ceil((newArea.height as number) / 20) // 20是行高
  150 + this.updateSummaryLines()
  151 + })
137 /** 152 /**
138 * 标题大于三行或存在简介显示查看详情按钮 153 * 标题大于三行或存在简介显示查看详情按钮
139 */ 154 */
@@ -161,7 +176,7 @@ export struct PlayerTitleView { @@ -161,7 +176,7 @@ export struct PlayerTitleView {
161 // } else { 176 // } else {
162 if(this.summary) { 177 if(this.summary) {
163 Text() { 178 Text() {
164 - Span(this.clipText(this.summary, 14, 3, this.windowWidth - 150 - vp2px(50))) 179 + Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)))
165 .fontSize(14) 180 .fontSize(14)
166 .fontColor(Color.White) 181 .fontColor(Color.White)
167 .lineHeight(21) 182 .lineHeight(21)
@@ -250,7 +250,11 @@ export class WDPlayerController { @@ -250,7 +250,11 @@ export class WDPlayerController {
250 // if (this.avPlayer == null) { 250 // if (this.avPlayer == null) {
251 // return 251 // return
252 // } 252 // }
253 - this.avPlayer?.play(); 253 + this.avPlayer?.prepare().then(() => {
  254 + this.avPlayer?.play()
  255 + }, (err: BusinessError) => {
  256 + console.error('Failed to prepare,error message is :' + err.message)
  257 + })
254 } 258 }
255 259
256 async startRenderFrame(cb: Function) { 260 async startRenderFrame(cb: Function) {
@@ -22,6 +22,7 @@ export class WDShare { @@ -22,6 +22,7 @@ export class WDShare {
22 desc: content.shareInfo.shareSummary, 22 desc: content.shareInfo.shareSummary,
23 link: content.shareInfo.shareUrl, 23 link: content.shareInfo.shareUrl,
24 deeplink:AppInnerLinkGenerator.generateDeepLinkWithConent(content), 24 deeplink:AppInnerLinkGenerator.generateDeepLinkWithConent(content),
  25 + // posterImg:$r("app.media.test_share_poster"),
25 } 26 }
26 }) 27 })
27 } 28 }
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
21 "wdTracking": "file:../../features/wdTracking", 21 "wdTracking": "file:../../features/wdTracking",
22 "wdPlayer": "file:../../features/wdPlayer", 22 "wdPlayer": "file:../../features/wdPlayer",
23 "wdShare": "file:../../features/wdShare", 23 "wdShare": "file:../../features/wdShare",
  24 + "wdShareBase": "file:../../commons/wdShareBase",
24 "wdDetailPlayLive": "file:../../features/wdDetailPlayLive" 25 "wdDetailPlayLive": "file:../../features/wdDetailPlayLive"
25 } 26 }
26 } 27 }
@@ -17,6 +17,7 @@ import { LaunchPageModel } from './viewModel/LaunchPageModel'; @@ -17,6 +17,7 @@ import { LaunchPageModel } from './viewModel/LaunchPageModel';
17 const TAG = 'MainPage'; 17 const TAG = 'MainPage';
18 18
19 PersistentStorage.persistProp('GestureLoadStrategy', 0); // 点播视频手势动画0为用户首次进入视频点播,1为用户已进入视频点播 19 PersistentStorage.persistProp('GestureLoadStrategy', 0); // 点播视频手势动画0为用户首次进入视频点播,1为用户已进入视频点播
  20 +PersistentStorage.persistProp('clickedIds', []); // 频道稿件已读存放稿件ID结合用户频道列表已读置灰回显
20 21
21 @Entry 22 @Entry
22 @Component 23 @Component
@@ -96,7 +96,7 @@ export struct BottomNavigationComponent { @@ -96,7 +96,7 @@ export struct BottomNavigationComponent {
96 navItem: navItem 96 navItem: navItem
97 }) 97 })
98 } else { 98 } else {
99 - // 其它带顶的页面,如 新闻、人民号、服务 99 + // 其它带顶的页面,如 新闻、人民号、服务
100 TopNavigationComponentNew({ 100 TopNavigationComponentNew({
101 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), 101 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
102 _currentNavIndex: $currentNavIndex, 102 _currentNavIndex: $currentNavIndex,
@@ -193,14 +193,17 @@ export struct BottomNavigationComponent { @@ -193,14 +193,17 @@ export struct BottomNavigationComponent {
193 } 193 }
194 194
195 getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption { 195 getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption {
  196 +
196 let defaultIcon = this.getBottomLocalIcon(navItem, isSelect) 197 let defaultIcon = this.getBottomLocalIcon(navItem, isSelect)
197 let url = this.getBottomIcon(navItem, isSelect) 198 let url = this.getBottomIcon(navItem, isSelect)
  199 + // Logger.info(TAG, `onChange111, 本地的地址: ${defaultIcon}`);
  200 +
198 let imageKnifeOption: ImageKnifeOption = { 201 let imageKnifeOption: ImageKnifeOption = {
199 loadSrc: url, 202 loadSrc: url,
200 // 占位图使用本地资源 203 // 占位图使用本地资源
201 placeholderSrc: defaultIcon, 204 placeholderSrc: defaultIcon,
202 // 失败占位图使用本地资源 205 // 失败占位图使用本地资源
203 - errorholderSrc: defaultIcon, 206 + // errorholderSrc: defaultIcon,
204 // 是否开启一级内存缓存 207 // 是否开启一级内存缓存
205 isCacheable: true, 208 isCacheable: true,
206 // 磁盘缓存 209 // 磁盘缓存
@@ -24,6 +24,7 @@ import { LiveRoomManager } from 'wdDetailPlayLive/Index' @@ -24,6 +24,7 @@ import { LiveRoomManager } from 'wdDetailPlayLive/Index'
24 import { initGlobalPlayerSettings } from 'wdPlayer/src/main/ets/utils/GlobalSetting' 24 import { initGlobalPlayerSettings } from 'wdPlayer/src/main/ets/utils/GlobalSetting'
25 import { BackgroundAudioController } from 'wdPlayer/Index' 25 import { BackgroundAudioController } from 'wdPlayer/Index'
26 import { SpConstants } from 'wdConstant' 26 import { SpConstants } from 'wdConstant'
  27 +import { WDShareBase } from 'wdShareBase/Index';
27 28
28 const TAG = "[StartupManager]" 29 const TAG = "[StartupManager]"
29 30
@@ -126,6 +127,8 @@ export class StartupManager { @@ -126,6 +127,8 @@ export class StartupManager {
126 this.initLiveChatRoom() 127 this.initLiveChatRoom()
127 128
128 this.initBackgroundAudioTask() 129 this.initBackgroundAudioTask()
  130 +
  131 + this.initShare()
129 Logger.debug(TAG, "App 必要初始化完成") 132 Logger.debug(TAG, "App 必要初始化完成")
130 } 133 }
131 134
@@ -233,6 +236,12 @@ export class StartupManager { @@ -233,6 +236,12 @@ export class StartupManager {
233 } 236 }
234 } 237 }
235 238
  239 + private initShare() {
  240 + WDShareBase.getInstance().gotContextFunc = () => {
  241 + return StartupManager.sharedInstance().context!
  242 + }
  243 + }
  244 +
236 private initThirdPlatformSDK() { 245 private initThirdPlatformSDK() {
237 246
238 } 247 }