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: 17048 UI还原问题--【生产环境】正在直播,横滑动卡,字体问题,看图
  fix: 18616 必修-人民号动态4图样式卡多出一张无效图片
  人民号文章稿件中的图片滑动时,图片和对应数字不能同步显示
  fix: 1)适配 直播列表和预告列表页面全屏
  fix: 18476 同一用户登录安卓端和鸿蒙端-我的收藏页面_展示收藏数据不一致
  fix: 信息流卡片分割线置为1
  fix: 1)适配 直播列表和预告列表页面全屏
  fix: 信息流卡片分割线置为1
  fix(意见反馈页):顶部底部适配
  ref |> 早晚报桌面组件开发
  音频悬浮窗-悬浮窗播放暂停按钮icon与安卓不一致【uat环境-新闻>热点频道>标签为语音播报的素材】
  音频悬浮窗-悬浮窗标题未加粗加黑【uat环境-新闻>热点频道>标签为语音播报的素材】
  fix: 1)修改顶导UI布局
  音频悬浮窗问题
  fix: 1)进入视频直播,直播tab 留白距离比较大,看图
Showing 40 changed files with 702 additions and 135 deletions
  1 +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18" height="18" viewBox="0 0 18 18"><g><g><path d="M3.998507,2.688617622937622L6.59851,3.338617682937622C6.68754,3.360875682937622,6.75,3.440872682937622,6.75,3.532645682937622L6.75,15.870288682937622C6.75,16.000488682937622,6.62772,16.09588868293762,6.50149,16.064388682937622L3.901493,15.414388682937622C3.8124595,15.392088682937622,3.75,15.312088682937622,3.75,15.220288682937623L3.75,2.8826466829376223C3.75,2.752531882937622,3.872278,2.657060282937622,3.998507,2.688617622937622M11.49851,2.688617622937622L14.0985,3.338617682937622C14.1875,3.360875682937622,14.25,3.440872682937622,14.25,3.532645682937622L14.25,15.870288682937622C14.25,16.000488682937622,14.1277,16.09588868293762,14.0015,16.064388682937622L11.401489999999999,15.414388682937622C11.31246,15.392088682937622,11.25,15.312088682937622,11.25,15.220288682937623L11.25,2.8826466829376223C11.25,2.752531882937622,11.37228,2.657060282937622,11.49851,2.688617622937622" fill-rule="evenodd" fill="#ED2800" fill-opacity="1"/></g></g></svg>
  1 +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><defs><clipPath id="master_svg0_21088_095014"><rect x="0" y="0" width="24" height="24" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_21088_095014)"><g><path d="M5,3.3522614375L5,20.6458234375C5,20.8012234375,5.169594,20.8972234375,5.302899,20.8173234375L19.714199999999998,12.1705234375C19.843600000000002,12.0928434375,19.843600000000002,11.9052034375,19.714199999999998,11.8275234375L5.302899,3.1807634375C5.169594,3.1007804375,5,3.1968024375,5,3.3522614375" fill-rule="evenodd" fill="#ED2800" fill-opacity="1"/></g></g></svg>
@@ -101,3 +101,5 @@ export { viewBlogItemInsightIntentShare } from './src/main/ets/utils/InsightInte @@ -101,3 +101,5 @@ export { viewBlogItemInsightIntentShare } from './src/main/ets/utils/InsightInte
101 export { CommentListDialogView } from './src/main/ets/components/comment/view/CommentListDialog'; 101 export { CommentListDialogView } from './src/main/ets/components/comment/view/CommentListDialog';
102 102
103 export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPullToRefresh'; 103 export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPullToRefresh';
  104 +
  105 +export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel'
@@ -47,7 +47,7 @@ export struct CompParser { @@ -47,7 +47,7 @@ export struct CompParser {
47 47
48 48
49 49
50 - console.log('CompParser-compDTO', JSON.stringify(this.compDTO)) 50 + console.log('CompParser', JSON.stringify(this.compDTO))
51 this.pageName = this.pageModel.pageInfo.name 51 this.pageName = this.pageModel.pageInfo.name
52 // 轮播图屏蔽音频类型稿件 52 // 轮播图屏蔽音频类型稿件
53 if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { 53 if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
@@ -87,7 +87,7 @@ export struct CompParser { @@ -87,7 +87,7 @@ export struct CompParser {
87 this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 87 this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
88 if (this.compDTO.compStyle === CompStyle.Label_03) { 88 if (this.compDTO.compStyle === CompStyle.Label_03) {
89 LabelComponent({ compDTO: this.compDTO }) 89 LabelComponent({ compDTO: this.compDTO })
90 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 }) 90 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
91 } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { 91 } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
92 if (this.compDTO.operDataList.length > this.audioItems.length) { 92 if (this.compDTO.operDataList.length > this.audioItems.length) {
93 ZhCarouselLayout01({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 93 ZhCarouselLayout01({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
@@ -104,7 +104,7 @@ export struct CompParser { @@ -104,7 +104,7 @@ export struct CompParser {
104 } else { 104 } else {
105 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 105 HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
106 } 106 }
107 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 }) 107 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
108 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) { 108 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
109 ZhSingleRow02({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 109 ZhSingleRow02({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
110 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 110 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
@@ -121,27 +121,38 @@ export struct CompParser { @@ -121,27 +121,38 @@ export struct CompParser {
121 121
122 } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { 122 } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
123 ZhGridLayout03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 123 ZhGridLayout03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
124 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 }) 124 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
125 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) { 125 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
126 ZhSingleRow04({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 126 ZhSingleRow04({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
127 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 }) 127 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
128 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) { 128 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
129 // ZhSingleRow05({ compDTO }) 129 // ZhSingleRow05({ compDTO })
130 // Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) 130 // Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
131 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { 131 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
132 ZhSingleRow06({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 132 ZhSingleRow06({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
133 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 }) 133 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
134 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) { 134 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
135 //头图卡 和comStyle 2相同, 135 //头图卡 和comStyle 2相同,
136 - Card5Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy, pageId: this.pageId, pageName: this.pageName })  
137 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 }) 136 + Card5Component({
  137 + compDTO: this.compDTO,
  138 + contentDTO: this.compDTO.operDataList[0],
  139 + titleShowPolicy: this.compDTO.titleShowPolicy,
  140 + pageId: this.pageId,
  141 + pageName: this.pageName
  142 + })
  143 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
138 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) { 144 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
139 // 大图卡 145 // 大图卡
140 Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName }) 146 Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName })
141 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 147 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
142 } else if (this.compDTO.compStyle === CompStyle.Card_09) { 148 } else if (this.compDTO.compStyle === CompStyle.Card_09) {
143 //时间链卡 149 //时间链卡
144 - Card9Component({ compDTO: this.compDTO, contentDTO:this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName }) 150 + Card9Component({
  151 + compDTO: this.compDTO,
  152 + contentDTO:this.compDTO.operDataList[0],
  153 + pageId: this.pageId,
  154 + pageName: this.pageName
  155 + })
145 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 156 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
146 } else if(this.compDTO.compStyle === CompStyle.Card_13){ 157 } else if(this.compDTO.compStyle === CompStyle.Card_13){
147 Card6Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName }) 158 Card6Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName })
@@ -156,8 +167,6 @@ export struct CompParser { @@ -156,8 +167,6 @@ export struct CompParser {
156 // ZhSingleColumn05({ compDTO: compDTO }) 167 // ZhSingleColumn05({ compDTO: compDTO })
157 // Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) 168 // Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
158 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { 169 } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
159 - // Divider().strokeWidth(3).color('#ffffff').padding({ left: 0, right: 0 }).margin({ top: -3 })  
160 - // Divider().strokeWidth(6).color('#f5f5f5')  
161 ZhSingleColumn09({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) 170 ZhSingleColumn09({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
162 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) 171 Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
163 } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 172 } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
@@ -40,6 +40,10 @@ export struct FeedBackActivity { @@ -40,6 +40,10 @@ export struct FeedBackActivity {
40 @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] 40 @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[]
41 41
42 @State toastText:ResourceStr = "" 42 @State toastText:ResourceStr = ""
  43 +
  44 + // @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
  45 + @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
  46 +
43 dialogToast: CustomDialogController = new CustomDialogController({ 47 dialogToast: CustomDialogController = new CustomDialogController({
44 builder: CustomToast({ 48 builder: CustomToast({
45 bgColor:$r("app.color.color_B3000000"), 49 bgColor:$r("app.color.color_B3000000"),
@@ -60,6 +64,7 @@ export struct FeedBackActivity { @@ -60,6 +64,7 @@ export struct FeedBackActivity {
60 64
61 build() { 65 build() {
62 Column() { 66 Column() {
  67 + Blank().height(`${this.topSafeHeight}px`)
63 //标题栏目 68 //标题栏目
64 CustomTitleUI({ titleName: $r('app.string.feedback') }) 69 CustomTitleUI({ titleName: $r('app.string.feedback') })
65 Stack({ alignContent: Alignment.Bottom }) { 70 Stack({ alignContent: Alignment.Bottom }) {
@@ -285,7 +290,7 @@ export struct FeedBackActivity { @@ -285,7 +290,7 @@ export struct FeedBackActivity {
285 .height(CommonConstants.FULL_HEIGHT) 290 .height(CommonConstants.FULL_HEIGHT)
286 .scrollBar(BarState.Off) 291 .scrollBar(BarState.Off)
287 .alignSelf(ItemAlign.Start) 292 .alignSelf(ItemAlign.Start)
288 - .padding({ bottom: 44 }) 293 + .padding({ bottom: 64+64 })
289 Column(){ 294 Column(){
290 Text($r('app.string.submit')) 295 Text($r('app.string.submit'))
291 .textAlign(TextAlign.Center) 296 .textAlign(TextAlign.Center)
@@ -301,10 +306,9 @@ export struct FeedBackActivity { @@ -301,10 +306,9 @@ export struct FeedBackActivity {
301 } 306 }
302 this.reportCommit() 307 this.reportCommit()
303 }) 308 })
304 - .margin({bottom:64}) 309 + .margin({bottom:64+64})
305 } 310 }
306 } 311 }
307 - // .margin({bottom:64})  
308 } 312 }
309 .backgroundColor($r('app.color.color_fff')) 313 .backgroundColor($r('app.color.color_fff'))
310 } 314 }
@@ -27,6 +27,7 @@ import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' @@ -27,6 +27,7 @@ import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
27 import {TrackConstants,TrackParamConvert}from 'wdTracking/Index' 27 import {TrackConstants,TrackParamConvert}from 'wdTracking/Index'
28 import { ColorUtils } from '../../utils/ColorUtils'; 28 import { ColorUtils } from '../../utils/ColorUtils';
29 import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'; 29 import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent';
  30 +import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
30 31
31 const TAG = 'MorningEveningPaperComponent'; 32 const TAG = 'MorningEveningPaperComponent';
32 33
@@ -71,6 +72,7 @@ export struct MorningEveningPaperComponent { @@ -71,6 +72,7 @@ export struct MorningEveningPaperComponent {
71 @State bottomSafeHeight: number = 0; 72 @State bottomSafeHeight: number = 0;
72 @State isHasTopView: boolean = false; 73 @State isHasTopView: boolean = false;
73 @State scrollOffset: number = 0 74 @State scrollOffset: number = 0
  75 + @State currentStatus: number | string |undefined = 0;
74 76
75 private audioDataList: AudioDataList[] = [] 77 private audioDataList: AudioDataList[] = []
76 private playerController: WDPlayerController = new WDPlayerController(); 78 private playerController: WDPlayerController = new WDPlayerController();
@@ -182,6 +184,10 @@ export struct MorningEveningPaperComponent { @@ -182,6 +184,10 @@ export struct MorningEveningPaperComponent {
182 184
183 } 185 }
184 186
  187 + EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
  188 + this.currentStatus = val
  189 + })
  190 +
185 } 191 }
186 192
187 // 批量查询内容当前用户点赞、收藏状态评论个数 193 // 批量查询内容当前用户点赞、收藏状态评论个数
@@ -338,7 +344,7 @@ export struct MorningEveningPaperComponent { @@ -338,7 +344,7 @@ export struct MorningEveningPaperComponent {
338 .height('100%') 344 .height('100%')
339 .objectFit(ImageFit.Contain) 345 .objectFit(ImageFit.Contain)
340 346
341 - Image($r('app.media.ic_red_triangle')) 347 + Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause_svg") : $r("app.media.icon_audio_playing_svg"))
342 .width(24) 348 .width(24)
343 .height(24) 349 .height(24)
344 .margin({ left: 10 })// .alignSelf(ItemAlign.Center) 350 .margin({ left: 10 })// .alignSelf(ItemAlign.Center)
@@ -7,6 +7,7 @@ import { Notes } from './notes'; @@ -7,6 +7,7 @@ import { Notes } from './notes';
7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 7 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
8 import { InfomationCardClick } from '../../utils/infomationCardClick' 8 import { InfomationCardClick } from '../../utils/infomationCardClick'
9 import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; 9 import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
  10 +import router from '@ohos.router'
10 11
11 /** 12 /**
12 * 大专题卡--CompStyle: 10 13 * 大专题卡--CompStyle: 10
@@ -23,10 +24,19 @@ export struct Card10Component { @@ -23,10 +24,19 @@ export struct Card10Component {
23 @ObjectLink compDTO: CompDTO 24 @ObjectLink compDTO: CompDTO
24 @State titleMarked: boolean = false; 25 @State titleMarked: boolean = false;
25 @State textArr: textItem[] = [] 26 @State textArr: textItem[] = []
  27 + @State hideDetail: boolean = false;
26 28
27 async aboutToAppear(): Promise<void> { 29 async aboutToAppear(): Promise<void> {
28 this.titleInit(); 30 this.titleInit();
29 this.loadImg = await onlyWifiLoadImg(); 31 this.loadImg = await onlyWifiLoadImg();
  32 + this.initHideDetail();
  33 + }
  34 +
  35 + initHideDetail() {
  36 + const curRouter = router.getState().name;
  37 + if (curRouter === 'MyCollectionListPage') {
  38 + this.hideDetail = true;
  39 + }
30 } 40 }
31 41
32 titleInit() { 42 titleInit() {
@@ -83,19 +93,21 @@ export struct Card10Component { @@ -83,19 +93,21 @@ export struct Card10Component {
83 }.alignContent(Alignment.BottomStart) 93 }.alignContent(Alignment.BottomStart)
84 94
85 // 专题列表--后端返回三个, 95 // 专题列表--后端返回三个,
86 - Column() {  
87 - ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {  
88 - this.timelineItem(item, index)  
89 - if (index < this.contentDTO.slideShows.length - 1) {  
90 - // 在不是最后一个元素的情况下添加分隔符  
91 - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 });  
92 - }  
93 - }) 96 + if (!this.hideDetail) {
  97 + Column() {
  98 + ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {
  99 + this.timelineItem(item, index)
  100 + if (index < this.contentDTO.slideShows.length - 1) {
  101 + // 在不是最后一个元素的情况下添加分隔符
  102 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 0, right: 0 });
  103 + }
  104 + })
  105 + }
94 } 106 }
95 107
96 108
97 // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 109 // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多
98 - if (this.contentDTO.hasMore == 1) { 110 + if (this.contentDTO.hasMore == 1 && !this.hideDetail) {
99 Row() { 111 Row() {
100 Text("查看更多") 112 Text("查看更多")
101 .fontSize($r("app.float.font_size_14")) 113 .fontSize($r("app.float.font_size_14"))
@@ -233,7 +233,8 @@ struct createImg { @@ -233,7 +233,8 @@ struct createImg {
233 }) 233 })
234 } 234 }
235 } 235 }
236 - } else if (this.fullColumnImgUrls.length === 4) { 236 + } else if (this.fullColumnImgUrls.length === 5) {
  237 + // 四图卡里面塞了一张补位卡
237 GridCol({ 238 GridCol({
238 span: { xs: 4 } 239 span: { xs: 4 }
239 }) { 240 }) {
@@ -32,6 +32,7 @@ let preferenceTheme: dataPreferences.Preferences | null = null @@ -32,6 +32,7 @@ let preferenceTheme: dataPreferences.Preferences | null = null
32 struct LiveMorePage { 32 struct LiveMorePage {
33 @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); 33 @State data: LazyDataSource<ContentDTO> = new LazyDataSource();
34 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; 34 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
  35 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
35 type: number = 1; 36 type: number = 1;
36 pageSize: number = 20; 37 pageSize: number = 20;
37 operDataList: ContentDTO[] = []; 38 operDataList: ContentDTO[] = [];
@@ -100,6 +101,7 @@ struct LiveMorePage { @@ -100,6 +101,7 @@ struct LiveMorePage {
100 right: $r('app.float.card_comp_pagePadding_lf'), 101 right: $r('app.float.card_comp_pagePadding_lf'),
101 bottom: $r('app.float.card_comp_pagePadding_tb') 102 bottom: $r('app.float.card_comp_pagePadding_tb')
102 }) 103 })
  104 + .margin({bottom:px2vp(this.bottomSafeHeight)})
103 .onClick(() => { 105 .onClick(() => {
104 ProcessUtils.processPage(this.contentDTO) 106 ProcessUtils.processPage(this.contentDTO)
105 }) 107 })
@@ -244,6 +246,7 @@ struct LiveMorePage { @@ -244,6 +246,7 @@ struct LiveMorePage {
244 }) 246 })
245 } 247 }
246 .height(44) 248 .height(44)
  249 + .margin({top:this.topSafeHeight+'px'})
247 .width('100%') 250 .width('100%')
248 } 251 }
249 252
@@ -113,7 +113,7 @@ export struct TopNavigationComponentNew { @@ -113,7 +113,7 @@ export struct TopNavigationComponentNew {
113 'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center }, 113 'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center },
114 'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom } 114 'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom }
115 }) 115 })
116 - .onAnimationStart((curIndex: number, index: number)=>{ 116 + .onAnimationStart((curIndex: number, index: number) => {
117 Logger.info(TAG, `onAnimationStart ${curIndex} ${index}`); 117 Logger.info(TAG, `onAnimationStart ${curIndex} ${index}`);
118 if (curIndex === index) { 118 if (curIndex === index) {
119 return 119 return
@@ -233,7 +233,7 @@ export struct TopNavigationComponentNew { @@ -233,7 +233,7 @@ export struct TopNavigationComponentNew {
233 .listDirection(Axis.Horizontal) 233 .listDirection(Axis.Horizontal)
234 .scrollBar(BarState.Off) 234 .scrollBar(BarState.Off)
235 .edgeEffect(EdgeEffect.None) 235 .edgeEffect(EdgeEffect.None)
236 - .padding({ left: 8, top: 6, right: 0 }) 236 + .padding({ left: 8, top:0, right: 0 })
237 .height($r('app.float.top_tab_bar_height')) 237 .height($r('app.float.top_tab_bar_height'))
238 .backgroundColor(this.barBackgroundColor) 238 .backgroundColor(this.barBackgroundColor)
239 .onAreaChange((oldValue: Area, newValue: Area) => { 239 .onAreaChange((oldValue: Area, newValue: Area) => {
@@ -278,13 +278,12 @@ export struct TopNavigationComponentNew { @@ -278,13 +278,12 @@ export struct TopNavigationComponentNew {
278 .listDirection(Axis.Horizontal) 278 .listDirection(Axis.Horizontal)
279 .scrollBar(BarState.Off) 279 .scrollBar(BarState.Off)
280 .edgeEffect(EdgeEffect.None) 280 .edgeEffect(EdgeEffect.None)
281 - .height($r('app.float.top_tab_bar_height_common'))  
282 - .backgroundColor(this.barBackgroundColor)  
283 - .margin({ top: 10 })  
284 .onAreaChange((oldValue: Area, newValue: Area) => { 281 .onAreaChange((oldValue: Area, newValue: Area) => {
285 let width = Number.parseFloat(newValue.width.toString()) 282 let width = Number.parseFloat(newValue.width.toString())
286 this.tabsWidth = Number.isNaN(width) ? 0 : width 283 this.tabsWidth = Number.isNaN(width) ? 0 : width
287 }) 284 })
  285 + .height($r('app.float.top_tab_bar_height_common'))
  286 + .backgroundColor(this.barBackgroundColor)
288 .id('tabList') 287 .id('tabList')
289 .alignRules({ 288 .alignRules({
290 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top }, 289 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top },
@@ -327,12 +326,13 @@ export struct TopNavigationComponentNew { @@ -327,12 +326,13 @@ export struct TopNavigationComponentNew {
327 minWidth: $r('app.float.top_tab_item_min_width'), 326 minWidth: $r('app.float.top_tab_item_min_width'),
328 maxWidth: $r('app.float.top_tab_item_max_width') 327 maxWidth: $r('app.float.top_tab_item_max_width')
329 }) 328 })
  329 + .height('100%')
330 // .backgroundColor(Color.Transparent) 330 // .backgroundColor(Color.Transparent)
331 .padding({ 331 .padding({
332 left: $r('app.float.top_tab_item_padding_horizontal'), 332 left: $r('app.float.top_tab_item_padding_horizontal'),
333 right: $r('app.float.top_tab_item_padding_horizontal'), 333 right: $r('app.float.top_tab_item_padding_horizontal'),
334 - bottom: 2,  
335 }) 334 })
  335 + .justifyContent(FlexAlign.Center)
336 .id(`col_tabBar${index}`) 336 .id(`col_tabBar${index}`)
337 // .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 }) 337 // .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
338 .onClick(() => { 338 .onClick(() => {
@@ -497,7 +497,7 @@ export struct TopNavigationComponentNew { @@ -497,7 +497,7 @@ export struct TopNavigationComponentNew {
497 Logger.info(TAG, `currentTopNavSelectedIndex : ${this.currentTopNavSelectedIndex}、${this.currentBottomNavName}`); 497 Logger.info(TAG, `currentTopNavSelectedIndex : ${this.currentTopNavSelectedIndex}、${this.currentBottomNavName}`);
498 498
499 // 顶部tab埋点 499 // 顶部tab埋点
500 - if(this.currentBottomNavName === '新闻') { 500 + if (this.currentBottomNavName === '新闻') {
501 const tab = this.myChannelList[this.currentTopNavSelectedIndex] 501 const tab = this.myChannelList[this.currentTopNavSelectedIndex]
502 Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`); 502 Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`);
503 503
@@ -507,7 +507,7 @@ export struct TopNavigationComponentNew { @@ -507,7 +507,7 @@ export struct TopNavigationComponentNew {
507 "pageId": tab.pageId, 507 "pageId": tab.pageId,
508 } 508 }
509 Tracking.event("home_page_tab_click ", params) 509 Tracking.event("home_page_tab_click ", params)
510 - } else if(this.currentBottomNavName === '人民号') { 510 + } else if (this.currentBottomNavName === '人民号') {
511 const tab = this.topNavList[this.currentTopNavSelectedIndex] 511 const tab = this.topNavList[this.currentTopNavSelectedIndex]
512 Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`); 512 Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`);
513 513
@@ -519,6 +519,7 @@ export struct TopNavigationComponentNew { @@ -519,6 +519,7 @@ export struct TopNavigationComponentNew {
519 Tracking.event("People_account_page_tab_click", params) 519 Tracking.event("People_account_page_tab_click", params)
520 } 520 }
521 } 521 }
  522 +
522 onAutoRefresh() { 523 onAutoRefresh() {
523 if (this.bottomNavIndex != this._currentNavIndex) { 524 if (this.bottomNavIndex != this._currentNavIndex) {
524 return 525 return
@@ -619,32 +620,32 @@ export struct TopNavigationComponentNew { @@ -619,32 +620,32 @@ export struct TopNavigationComponentNew {
619 return null 620 return null
620 } 621 }
621 622
622 - private getTextInfo(index: number): Record<string, number> {  
623 - let strJson = getInspectorByKey(index.toString())  
624 - try {  
625 - let obj: Record<string, string> = JSON.parse(strJson)  
626 - let rectInfo: number[][] = JSON.parse('[' + obj.$rect + ']')  
627 - return { 'left': px2vp(rectInfo[0][0]), 'width': px2vp(rectInfo[1][0] - rectInfo[0][0]) }  
628 - } catch (error) {  
629 - return { 'left': 0, 'width': 0 }  
630 - }  
631 - }  
632 -  
633 - private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> {  
634 - let nextIndex = index  
635 - if (index > 0 && event.currentOffset > 0) {  
636 - nextIndex--  
637 - } else if (index < 3 && event.currentOffset < 0) {  
638 - nextIndex++  
639 - }  
640 - let indexInfo = this.getTextInfo(index)  
641 - let nextIndexInfo = this.getTextInfo(nextIndex)  
642 - let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth)  
643 - let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。  
644 - let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio  
645 - let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio  
646 - return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth }  
647 - } 623 + // private getTextInfo(index: number): Record<string, number> {
  624 + // let strJson = getInspectorByKey(index.toString())
  625 + // try {
  626 + // let obj: Record<string, string> = JSON.parse(strJson)
  627 + // let rectInfo: number[][] = JSON.parse('[' + obj.$rect + ']')
  628 + // return { 'left': px2vp(rectInfo[0][0]), 'width': px2vp(rectInfo[1][0] - rectInfo[0][0]) }
  629 + // } catch (error) {
  630 + // return { 'left': 0, 'width': 0 }
  631 + // }
  632 + // }
  633 +
  634 + // private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> {
  635 + // let nextIndex = index
  636 + // if (index > 0 && event.currentOffset > 0) {
  637 + // nextIndex--
  638 + // } else if (index < 3 && event.currentOffset < 0) {
  639 + // nextIndex++
  640 + // }
  641 + // let indexInfo = this.getTextInfo(index)
  642 + // let nextIndexInfo = this.getTextInfo(nextIndex)
  643 + // let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth)
  644 + // let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。
  645 + // let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio
  646 + // let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio
  647 + // return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth }
  648 + // }
648 649
649 private startAnimateTo(duration: number, leftMargin: number, width: number) { 650 private startAnimateTo(duration: number, leftMargin: number, width: number) {
650 animateTo({ 651 animateTo({
@@ -306,9 +306,10 @@ struct ReserveMorePage { @@ -306,9 +306,10 @@ struct ReserveMorePage {
306 middle: { anchor: "__container__", align: HorizontalAlign.Center } 306 middle: { anchor: "__container__", align: HorizontalAlign.Center }
307 }) 307 })
308 } 308 }
309 - .backgroundColor('#FFFFFF')  
310 - .height(44)  
311 - .width('100%') 309 + .height(vp2px(44) + this.topSafeHeight + 'px')
  310 + .padding({ top: this.topSafeHeight + 'px' })
  311 + .width('100%').backgroundColor('#FFFFFF')
  312 +
312 } 313 }
313 314
314 @Builder 315 @Builder
@@ -413,7 +414,9 @@ struct ReserveMorePage { @@ -413,7 +414,9 @@ struct ReserveMorePage {
413 this.reservedIds = [] 414 this.reservedIds = []
414 } 415 }
415 416
416 - liveReviewDTO.list.forEach((content) => { content.pageId = this.pageId }) 417 + liveReviewDTO.list.forEach((content) => {
  418 + content.pageId = this.pageId
  419 + })
417 this.data.push(...liveReviewDTO.list) 420 this.data.push(...liveReviewDTO.list)
418 //批量查询关注状态 421 //批量查询关注状态
419 this.getAppointmentInfo(liveReviewDTO.list) 422 this.getAppointmentInfo(liveReviewDTO.list)
@@ -518,7 +521,7 @@ struct ReserveMorePage { @@ -518,7 +521,7 @@ struct ReserveMorePage {
518 try { 521 try {
519 522
520 // 埋点 523 // 埋点
521 - Tracking.event(!reserveItem.subscribe ? "live_subscribe_click":"cancel_live_subscribe_click", 524 + Tracking.event(!reserveItem.subscribe ? "live_subscribe_click" : "cancel_live_subscribe_click",
522 TrackParamConvert.program(item)) 525 TrackParamConvert.program(item))
523 526
524 const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(), 527 const res = await LiveModel.liveAppointment(reserveItem.relationId, reserveItem.liveId.toString(),
@@ -555,6 +558,7 @@ struct ReserveMorePage { @@ -555,6 +558,7 @@ struct ReserveMorePage {
555 } 558 }
556 } 559 }
557 } 560 }
  561 +
558 getReserveDate(eventDateTimeString: string, type: number): string { 562 getReserveDate(eventDateTimeString: string, type: number): string {
559 // 解析事件的日期和时间 563 // 解析事件的日期和时间
560 const eventDateTime = new Date(eventDateTimeString); 564 const eventDateTime = new Date(eventDateTimeString);
@@ -570,15 +574,16 @@ struct ReserveMorePage { @@ -570,15 +574,16 @@ struct ReserveMorePage {
570 const currentDate = currentDateTime.setHours(0, 0, 0, 0); 574 const currentDate = currentDateTime.setHours(0, 0, 0, 0);
571 if (eventDate === currentDate) { 575 if (eventDate === currentDate) {
572 return `今天`; 576 return `今天`;
573 - }else{ 577 + } else {
574 const month = eventDateTime.getMonth() + 1; 578 const month = eventDateTime.getMonth() + 1;
575 const date = eventDateTime.getDate(); 579 const date = eventDateTime.getDate();
576 return `${month}月${date}日`; 580 return `${month}月${date}日`;
577 } 581 }
578 - }else { 582 + } else {
579 return `${eventTimeStr}`; 583 return `${eventTimeStr}`;
580 } 584 }
581 } 585 }
  586 +
582 // getReserveDate(eventDateTimeString: string, type: number): string { 587 // getReserveDate(eventDateTimeString: string, type: number): string {
583 // // 解析事件的日期和时间 588 // // 解析事件的日期和时间
584 // const eventDateTime = new Date(eventDateTimeString); 589 // const eventDateTime = new Date(eventDateTimeString);
@@ -166,9 +166,9 @@ export struct LiveHorizontalCardComponent { @@ -166,9 +166,9 @@ export struct LiveHorizontalCardComponent {
166 .textAlign(TextAlign.Start) 166 .textAlign(TextAlign.Start)
167 .margin({ top: 8 }) 167 .margin({ top: 8 })
168 .width(this.compDTO.operDataList.length == 2 ? 210 : 150) 168 .width(this.compDTO.operDataList.length == 2 ? 210 : 150)
169 - .height(42)  
170 .lineHeight(21) 169 .lineHeight(21)
171 } 170 }
  171 + .height(134)
172 .padding({ right: 16 }) 172 .padding({ right: 16 })
173 .onClick(() => { 173 .onClick(() => {
174 InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) 174 InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
@@ -20,7 +20,7 @@ import { http } from '@kit.NetworkKit'; @@ -20,7 +20,7 @@ import { http } from '@kit.NetworkKit';
20 import { BusinessError } from '@kit.BasicServicesKit'; 20 import { BusinessError } from '@kit.BasicServicesKit';
21 import ResponseCode from '@ohos.net.http'; 21 import ResponseCode from '@ohos.net.http';
22 22
23 -const resourceMgs: resourceManager.ResourceManager = getContext(this).resourceManager; 23 +// const resourceMgs: resourceManager.ResourceManager = getContext(this).resourceManager;
24 const PIXEL_MAP_SIZE_WIDTH: number = 40; 24 const PIXEL_MAP_SIZE_WIDTH: number = 40;
25 const PIXEL_MAP_SIZE_HEIGHT: number = 40; 25 const PIXEL_MAP_SIZE_HEIGHT: number = 40;
26 26
@@ -29,19 +29,19 @@ const PIXEL_MAP_SIZE_HEIGHT: number = 40; @@ -29,19 +29,19 @@ const PIXEL_MAP_SIZE_HEIGHT: number = 40;
29 * @param icon 图片地址,模拟数据存放于rawfile文件夹中 29 * @param icon 图片地址,模拟数据存放于rawfile文件夹中
30 * @returns 图片转换的PixelMap对象 30 * @returns 图片转换的PixelMap对象
31 */ 31 */
32 -export async function image2PixelMap(icon: string): Promise<image.PixelMap> {  
33 - // 读取rawfile文件夹下的文件  
34 - const rawFileDescriptor: resourceManager.RawFileDescriptor = resourceMgs.getRawFdSync(icon);  
35 - const imageSource: image.ImageSource = image.createImageSource(rawFileDescriptor);  
36 - // 通过ImageSource对象创建PixelMap对象,使用BGRA_8888格式,由4个字节表示一个像素  
37 - const pixelMap: Promise<PixelMap> = imageSource.createPixelMap({  
38 - editable: false,  
39 - desiredPixelFormat: image.PixelMapFormat.BGRA_8888,  
40 - // 高性能知识点:经测试,将图片的宽和高设置为40像素时,既可以保证提取颜色的准确性,也可以保证计算颜色的速度。  
41 - desiredSize: { width: PIXEL_MAP_SIZE_WIDTH, height: PIXEL_MAP_SIZE_HEIGHT }  
42 - })  
43 - return pixelMap;  
44 -} 32 +// export async function image2PixelMap(icon: string): Promise<image.PixelMap> {
  33 +// // 读取rawfile文件夹下的文件
  34 +// const rawFileDescriptor: resourceManager.RawFileDescriptor = resourceMgs.getRawFdSync(icon);
  35 +// const imageSource: image.ImageSource = image.createImageSource(rawFileDescriptor);
  36 +// // 通过ImageSource对象创建PixelMap对象,使用BGRA_8888格式,由4个字节表示一个像素
  37 +// const pixelMap: Promise<PixelMap> = imageSource.createPixelMap({
  38 +// editable: false,
  39 +// desiredPixelFormat: image.PixelMapFormat.BGRA_8888,
  40 +// // 高性能知识点:经测试,将图片的宽和高设置为40像素时,既可以保证提取颜色的准确性,也可以保证计算颜色的速度。
  41 +// desiredSize: { width: PIXEL_MAP_SIZE_WIDTH, height: PIXEL_MAP_SIZE_HEIGHT }
  42 +// })
  43 +// return pixelMap;
  44 +// }
45 45
46 /** 46 /**
47 * 通过http的request方法从网络下载图片资源 47 * 通过http的request方法从网络下载图片资源
@@ -16,6 +16,7 @@ export class AudioSuspensionModel { @@ -16,6 +16,7 @@ export class AudioSuspensionModel {
16 private url: string = '' 16 private url: string = ''
17 private expandWidth: number = vp2px(243) 17 private expandWidth: number = vp2px(243)
18 private expandHeight: number = vp2px(60) 18 private expandHeight: number = vp2px(60)
  19 + private initMoveX = vp2px(12)
19 // 窗口是否最小化 20 // 窗口是否最小化
20 private isMinimize: SubscribedAbstractProperty<boolean> = AppStorage.link<boolean>('isMinimize') 21 private isMinimize: SubscribedAbstractProperty<boolean> = AppStorage.link<boolean>('isMinimize')
21 constructor() { 22 constructor() {
@@ -27,7 +28,7 @@ export class AudioSuspensionModel { @@ -27,7 +28,7 @@ export class AudioSuspensionModel {
27 private initPlayerController() { 28 private initPlayerController() {
28 if(this.playerController === undefined) { 29 if(this.playerController === undefined) {
29 Logger.info(TAG, 'playerController undefined') 30 Logger.info(TAG, 'playerController undefined')
30 - AppStorage.setOrCreate('playerController', new WDPlayerController()); 31 + AppStorage.setOrCreate('playerController', new WDPlayerController({loop: false}));
31 this.playerController = AppStorage.link<WDPlayerController>('playerController') 32 this.playerController = AppStorage.link<WDPlayerController>('playerController')
32 Logger.info(TAG, 'playerController create success') 33 Logger.info(TAG, 'playerController create success')
33 this.playerController.get().onStatusChange = (status: number) => { 34 this.playerController.get().onStatusChange = (status: number) => {
@@ -42,8 +43,8 @@ export class AudioSuspensionModel { @@ -42,8 +43,8 @@ export class AudioSuspensionModel {
42 * 配置音频地址 43 * 配置音频地址
43 */ 44 */
44 public setPlayerUrl(url: string, srcTitle: string) { 45 public setPlayerUrl(url: string, srcTitle: string) {
45 - // console.log(TAG,'this.url', this.url)  
46 - // console.log(TAG,'url', url) 46 + /*console.log(TAG,'this.url', this.url)
  47 + console.log(TAG,'url', url)*/
47 if (this.url === url) { 48 if (this.url === url) {
48 this.isMinimize = AppStorage.link<boolean>('isMinimize') 49 this.isMinimize = AppStorage.link<boolean>('isMinimize')
49 console.log(TAG, 'this.isMinimize', this.isMinimize?.get()) 50 console.log(TAG, 'this.isMinimize', this.isMinimize?.get())
@@ -60,7 +61,7 @@ export class AudioSuspensionModel { @@ -60,7 +61,7 @@ export class AudioSuspensionModel {
60 } 61 }
61 this.srcTitle = srcTitle 62 this.srcTitle = srcTitle
62 EmitterUtils.sendEvent(EmitterEventId.AUDIO_CHANGE_TITLe, this.srcTitle) 63 EmitterUtils.sendEvent(EmitterEventId.AUDIO_CHANGE_TITLe, this.srcTitle)
63 - this.resizeWindow(this.expandWidth, this.expandHeight) 64 + EmitterUtils.sendEvent(EmitterEventId.AUDIO_WINDOW_EXPAND, 1)
64 } 65 }
65 this.showWindow() 66 this.showWindow()
66 } 67 }
@@ -99,9 +100,8 @@ export class AudioSuspensionModel { @@ -99,9 +100,8 @@ export class AudioSuspensionModel {
99 console.info(TAG, 'floatWindowClass Succeeded in changing the window size.'); 100 console.info(TAG, 'floatWindowClass Succeeded in changing the window size.');
100 }); 101 });
101 } 102 }
102 -  
103 - public moveWindow(y: number) {  
104 - this.floatWindowClass.get().moveWindowTo(0, vp2px(y), (err: BusinessError) => { 103 + public moveWindow(y: number) {
  104 + this.floatWindowClass.get().moveWindowTo(this.initMoveX, vp2px(y), (err: BusinessError) => {
105 let errCode: number = err.code; 105 let errCode: number = err.code;
106 if (errCode) { 106 if (errCode) {
107 console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err)); 107 console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
@@ -6,6 +6,33 @@ import { PageRepository } from '../repository/PageRepository'; @@ -6,6 +6,33 @@ import { PageRepository } from '../repository/PageRepository';
6 const TAG = 'MorningEveningViewModel' 6 const TAG = 'MorningEveningViewModel'
7 7
8 export class MorningEveningViewModel { 8 export class MorningEveningViewModel {
  9 +
  10 + static async getDailyPaperTopic(): Promise<PageInfoBean> {
  11 + return new Promise<PageInfoBean>((success, error) => {
  12 + Logger.info(TAG, `getDailyPaperTopic pageInfo start`);
  13 + PageRepository.fetchDailyPaperTopic()
  14 + .then((resDTO: ResponseDTO<PageInfoBean>) => {
  15 + if (!resDTO || !resDTO.data) {
  16 + Logger.error(TAG, 'getDailyPaperTopic then navResDTO is empty');
  17 + error('resDTO is empty');
  18 + return
  19 + }
  20 + if (resDTO.code != 0) {
  21 + Logger.error(TAG, `getDailyPaperTopic then code:${resDTO.code}, message:${resDTO.message}`);
  22 + error('resDTO Response Code is failure');
  23 + return
  24 + }
  25 + // let navResStr = JSON.stringify(navResDTO);
  26 + Logger.info(TAG, "getDailyPaperTopic then,navResDTO.timestamp:" + resDTO.timestamp);
  27 + success(resDTO.data);
  28 + })
  29 + .catch((err: Error) => {
  30 + Logger.error(TAG, `getDailyPaperTopic catch, error.name : ${err.name}, error.message:${err.message}`);
  31 + error(err);
  32 + })
  33 + })
  34 + }
  35 +
9 static async getMorningEveningPageInfo(pageId: string): Promise<PageInfoBean> { 36 static async getMorningEveningPageInfo(pageId: string): Promise<PageInfoBean> {
10 return new Promise<PageInfoBean>((success, error) => { 37 return new Promise<PageInfoBean>((success, error) => {
11 Logger.info(TAG, `getMorningEveningPageInfo pageInfo start`); 38 Logger.info(TAG, `getMorningEveningPageInfo pageInfo start`);
@@ -7,13 +7,17 @@ import { TrackingPlay } from 'wdTracking/Index'; @@ -7,13 +7,17 @@ import { TrackingPlay } from 'wdTracking/Index';
7 import { ParamType } from 'wdTracking/Index'; 7 import { ParamType } from 'wdTracking/Index';
8 import { DateTimeUtils } from 'wdKit/Index'; 8 import { DateTimeUtils } from 'wdKit/Index';
9 9
  10 +interface obj {
  11 + loop: boolean
  12 +}
  13 +
10 @Observed 14 @Observed
11 export class WDPlayerController { 15 export class WDPlayerController {
12 private initPromise: Promise<void>; 16 private initPromise: Promise<void>;
13 private avPlayer?: media.AVPlayer; 17 private avPlayer?: media.AVPlayer;
14 private duration: number = 0; 18 private duration: number = 0;
15 private status: number = PlayerConstants.STATUS_IDLE; 19 private status: number = PlayerConstants.STATUS_IDLE;
16 - private loop: boolean = false; 20 + private loop: boolean = true;
17 private url: string = ''; 21 private url: string = '';
18 private surfaceId: string = ''; // 若播放音频,无需设置surfaceId 22 private surfaceId: string = ''; // 若播放音频,无需设置surfaceId
19 private playSpeed: number = 1; 23 private playSpeed: number = 1;
@@ -41,9 +45,12 @@ export class WDPlayerController { @@ -41,9 +45,12 @@ export class WDPlayerController {
41 45
42 46
43 47
44 - constructor() { 48 + constructor(obj?: obj) {
45 Logger.error("初始化") 49 Logger.error("初始化")
46 this.initPromise = this.createAVPlayer(); 50 this.initPromise = this.createAVPlayer();
  51 + if(obj?.loop === false) {
  52 + this.loop = false
  53 + }
47 } 54 }
48 55
49 /** 56 /**
@@ -103,6 +110,7 @@ export class WDPlayerController { @@ -103,6 +110,7 @@ export class WDPlayerController {
103 if (this.onCanplay) { 110 if (this.onCanplay) {
104 this.onCanplay() 111 this.onCanplay()
105 } 112 }
  113 + this.avPlayer.loop = this.loop
106 break; 114 break;
107 case AVPlayerStatus.PLAYING: 115 case AVPlayerStatus.PLAYING:
108 if(this.onLoaded) { 116 if(this.onLoaded) {
@@ -122,9 +130,13 @@ export class WDPlayerController { @@ -122,9 +130,13 @@ export class WDPlayerController {
122 if (this.continue) { 130 if (this.continue) {
123 this.continue(); 131 this.continue();
124 } else { 132 } else {
125 - this.duration = 0;  
126 - this.url = this.avPlayer.url || '';  
127 - this.avPlayer.reset(); 133 + if(this.loop) {
  134 + this.duration = 0;
  135 + this.url = this.avPlayer.url || '';
  136 + this.avPlayer.reset();
  137 + }
  138 + this.status = PlayerConstants.STATUS_COMPLETION;
  139 + this.watchStatus();
128 } 140 }
129 break; 141 break;
130 case AVPlayerStatus.RELEASED: 142 case AVPlayerStatus.RELEASED:
@@ -396,7 +408,7 @@ export class WDPlayerController { @@ -396,7 +408,7 @@ export class WDPlayerController {
396 408
397 watchStatus() { 409 watchStatus() {
398 console.log('watchStatus', this.status) 410 console.log('watchStatus', this.status)
399 - if(this.status == 1){ 411 + if(this.status == PlayerConstants.STATUS_START){
400 console.log('播放视频') 412 console.log('播放视频')
401 console.log('播放视频prepareTime',JSON.stringify(this.prepareTime)) 413 console.log('播放视频prepareTime',JSON.stringify(this.prepareTime))
402 console.log('播放视频pageName',JSON.stringify(this.pageName)) 414 console.log('播放视频pageName',JSON.stringify(this.pageName))
@@ -404,7 +416,7 @@ export class WDPlayerController { @@ -404,7 +416,7 @@ export class WDPlayerController {
404 // 播放埋点 416 // 播放埋点
405 TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam) 417 TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam)
406 } 418 }
407 - if(this.status == 2){ 419 + if(this.status == PlayerConstants.STATUS_COMPLETION){
408 let initDuration = Math.floor(Number(this.duration)/1000) 420 let initDuration = Math.floor(Number(this.duration)/1000)
409 console.log('播放结束') 421 console.log('播放结束')
410 console.log('播放结束currentPlayTime',JSON.stringify(this.currentPlayTime)) 422 console.log('播放结束currentPlayTime',JSON.stringify(this.currentPlayTime))
1 1
2 export { WDShare } from './src/main/ets/WDShare' 2 export { WDShare } from './src/main/ets/WDShare'
3 3
  4 +export { DeepLinkUtil } from "./src/main/ets/utils/DeepLinkUtil"
1 -import { ContentDetailDTO, ContentDTO } from 'wdBean/Index'; 1 +import { ContentDetailDTO, ContentDTO, FrontLinkObject } from 'wdBean/Index';
2 import { BreakpointSystem } from 'wdKit/Index'; 2 import { BreakpointSystem } from 'wdKit/Index';
3 import { ContentType } from 'wdRouter/Index'; 3 import { ContentType } from 'wdRouter/Index';
4 4
@@ -16,6 +16,10 @@ export class DeepLinkUtil { @@ -16,6 +16,10 @@ export class DeepLinkUtil {
16 return DeepLinkUtil.generate(Number(content.objectType), content.objectId +'', content.relId, content.linkUrl) 16 return DeepLinkUtil.generate(Number(content.objectType), content.objectId +'', content.relId, content.linkUrl)
17 } 17 }
18 18
  19 + static generateDeepLinkWithFrontObjectLink(content: FrontLinkObject) {
  20 + return DeepLinkUtil.generate(Number(content.newsType), content.newsId +'', content.newsRelId + '', content.linkUrl)
  21 + }
  22 +
19 private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string { 23 private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string {
20 let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX 24 let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX
21 25
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
20 "wdJsBridge": "file:../../commons/wdJsBridge", 20 "wdJsBridge": "file:../../commons/wdJsBridge",
21 "wdLogin": "file:../../features/wdLogin", 21 "wdLogin": "file:../../features/wdLogin",
22 "wdTracking": "file:../../features/wdTracking", 22 "wdTracking": "file:../../features/wdTracking",
23 - "wdPlayer": "file:../../features/wdPlayer" 23 + "wdPlayer": "file:../../features/wdPlayer",
  24 + "wdShare": "file:../../features/wdShare",
24 } 25 }
25 } 26 }
  1 +import { formBindingData, FormExtensionAbility, formInfo, formProvider } from '@kit.FormKit';
  2 +import { Want } from '@kit.AbilityKit';
  3 +import { Logger, NetworkManager, SPHelper, StringUtils } from 'wdKit/Index';
  4 +import { BusinessError } from '@kit.BasicServicesKit';
  5 +import { FormDataType, NewspaperDataFetcher } from './NewspaperDataFetcher';
  6 +import { JSON } from '@kit.ArkTS';
  7 +import { FormNewspaperPaperType } from '../dailynewspaperwidget/common/NewspaperWidgetData';
  8 +import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index';
  9 +
  10 +const TAG = "DailyNewspaperFormAbility"
  11 +
  12 +export default class DailyNewspaperFormAbility extends FormExtensionAbility {
  13 + onAddForm(want: Want) {
  14 + Logger.debug(TAG, "onAddForm with " + JSON.stringify(want))
  15 +
  16 + this.initApp()
  17 +
  18 + if (want.parameters) {
  19 + let formId = want.parameters[formInfo.FormParam.IDENTITY_KEY] as string
  20 + let isTempCard = want.parameters[formInfo.FormParam.TEMPORARY_KEY] as boolean
  21 + if (isTempCard === false) { // 如果为常态卡片,直接进行信息持久化
  22 +
  23 + Logger.debug(TAG, "开始刷新数据");
  24 + NewspaperDataFetcher.refreshDailyPaper().then((data) => {
  25 +
  26 + let formData = formBindingData.createFormBindingData(data);
  27 + formProvider.updateForm(formId, formData).catch((err: BusinessError) => {
  28 + Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
  29 + });
  30 + })
  31 + }
  32 + }
  33 +
  34 + let obj: FormDataType = {}
  35 + obj.paperType = FormNewspaperPaperType.unknown
  36 + let formData = formBindingData.createFormBindingData(obj);
  37 + return formData;
  38 + }
  39 +
  40 + onCastToNormalForm(formId: string) {
  41 + // 使用方将临时卡片转换为常态卡片触发,提供方需要做相应的处理
  42 + Logger.debug(TAG, `onCastToNormalForm, formId: ${formId}`);
  43 + }
  44 +
  45 + onUpdateForm(formId: string) {
  46 + // 若卡片支持定时更新/定点更新/卡片使用方主动请求更新功能,则提供方需要重写该方法以支持数据更新
  47 + Logger.debug(TAG, 'onUpdateForm ' + formId);
  48 + NewspaperDataFetcher.refreshDailyPaper().then((data) => {
  49 +
  50 + let formData = formBindingData.createFormBindingData(data);
  51 + formProvider.updateForm(formId, formData).catch((err: BusinessError) => {
  52 + Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
  53 + });
  54 + })
  55 + }
  56 +
  57 + onFormEvent(formId: string, message: string) {
  58 + // 若卡片支持触发事件,则需要重写该方法并实现对事件的触发
  59 + Logger.debug(TAG, 'onFormEvent:' +" formId =>" + formId + " message =>" + message);
  60 + }
  61 +
  62 + onRemoveForm(formId: string) {
  63 + // 当对应的卡片删除时触发的回调,入参是被删除的卡片ID
  64 + Logger.debug(TAG, 'onRemoveForm');
  65 + }
  66 +
  67 + // onConfigurationUpdate(config: Configuration) {
  68 + // // 当前formExtensionAbility存活时更新系统配置信息时触发的回调。
  69 + // // 需注意:formExtensionAbility创建后5秒内无操作将会被清理。
  70 + // Logger.debug(TAG, 'onConfigurationUpdate:' + JSON.stringify(config));
  71 + // }
  72 +
  73 + onAcquireFormState(want: Want) {
  74 + // 卡片提供方接收查询卡片状态通知接口,默认返回卡片初始状态。
  75 + return formInfo.FormState.READY;
  76 + }
  77 +
  78 + initApp() {
  79 + // KV存储
  80 + SPHelper.init(this.context);
  81 +
  82 + // 网络模块
  83 + NetworkManager.getInstance().init()
  84 +
  85 + // App环境
  86 + const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string
  87 + if (StringUtils.isNotEmpty(spHostUrl)) {
  88 + HostManager.changeHost(spHostUrl as HostEnum)
  89 + }
  90 +
  91 + Logger.debug(TAG, "App 网络 初始化")
  92 + WDHttp.initHttpHeader()
  93 + }
  94 +};
  1 +import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index';
  2 +import { MorningEveningViewModel } from 'wdComponent/Index';
  3 +import { Logger } from 'wdKit/Index';
  4 +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index';
  5 +import { DeepLinkUtil } from 'wdShare/Index'
  6 +import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent } from "../dailynewspaperwidget/common/NewspaperWidgetData"
  7 +
  8 +const TAG = "NewspaperDataFetcher"
  9 +
  10 +export type FormDataType = Record<string, FormNewspaperPaperType | FormNewspaperPaperInfo | FormNewspaperPaperContent[]>
  11 +
  12 +export class NewspaperDataFetcher {
  13 +
  14 + public static async refreshDailyPaper(): Promise<FormDataType> {
  15 + return new Promise<FormDataType>(async (reslove, fail) => {
  16 +
  17 + let data: FormDataType = { 'paperType': FormNewspaperPaperType.unknown }
  18 + data.paperInfo = { showLeftImage: false }
  19 +
  20 + try {
  21 + let page: PageInfoBean = await MorningEveningViewModel.getDailyPaperTopic()
  22 + data.paperType = page.topicInfo?.frontFlag || FormNewspaperPaperType.unknown
  23 +
  24 + let currentTime = new Date().getTime()
  25 + let compInfo = await MorningEveningViewModel.getMorningEveningCompInfo(
  26 + page.id,
  27 + page.groups[0]?.id,
  28 + currentTime + "",
  29 + page.topicInfo?.topicId
  30 + )
  31 +
  32 + if (page.topicInfo.frontLinkObject) {
  33 + data.paperInfo.showLeftImage = true
  34 + data.paperInfo.leftImageUrl = page.topicInfo.frontLinkObject.coverUrl
  35 + data.paperInfo.leftTitle = page.topicInfo.frontLinkObject.title
  36 + data.paperInfo.leftDeepLink = DeepLinkUtil.generateDeepLinkWithFrontObjectLink(page.topicInfo.frontLinkObject)
  37 + }
  38 +
  39 + let contents: ContentDTO[] = compInfo.compList[0].operDataList as ContentDTO[]
  40 + if (contents && contents.length) {
  41 + data.paperContents = contents.map((contentDTO) => {
  42 + let content : FormNewspaperPaperContent = {
  43 + title: contentDTO.newsTitle,
  44 + coverUrl: contentDTO.coverUrl,
  45 + deepLink: DeepLinkUtil.generateDeepLinkWithProgram(contentDTO)
  46 + }
  47 + return content
  48 + })
  49 + }
  50 +
  51 + } catch (e) {
  52 + Logger.debug(TAG, "刷新早晚报数据失败" + JSON.stringify(e))
  53 + fail(e)
  54 + // reslove(NewspaperDataFetcher.fakeData())
  55 + return
  56 + }
  57 +
  58 + Logger.debug(TAG, "refresh Data " + JSON.stringify(data))
  59 + reslove(data)
  60 + })
  61 + }
  62 +
  63 + static fakeData(): FormDataType {
  64 + let data : FormNewspaperPaperContent = {
  65 + title: "标题标题标题标题标题标题标题标题",
  66 + coverUrl: "https://"
  67 + } as FormNewspaperPaperContent
  68 + return {
  69 + 'paperType': FormNewspaperPaperType.unknown,
  70 + "paperInfo": {
  71 + showLeftImage: true,
  72 + leftTitle: "leftTitleleftTitleleftTitleleftTitleleftTitleleftTitle"
  73 + },
  74 + "paperContents": [data, data, data]
  75 + }
  76 + }
  77 +}
  1 +export namespace NewspaperWidgetCommon {
  2 +
  3 + export enum JumpParam {
  4 + DeepLinkKey = "newspaper.widget.jump.deeplink",
  5 + FromNewspaperWidgetKey = "newspaper.widget.jump.fromNewspaperWidget"
  6 + }
  7 +
  8 + export enum PosterCardAction {
  9 +
  10 + ActionRouter = "router",
  11 + ActionCaller = "caller",
  12 +
  13 + MainAbilityName = "EntryAbility"
  14 + }
  15 +}
  1 +
  2 +export enum FormNewspaperPaperType {
  3 + unknown = 0,
  4 + morning = 1,
  5 + noon = 2,
  6 + evening = 3
  7 +}
  8 +
  9 +export class FormNewspaperPaperInfo {
  10 +
  11 + showLeftImage: boolean = false
  12 +
  13 + leftImageUrl?: string
  14 + leftTitle?: string
  15 + leftDeepLink?: string
  16 +
  17 + rightContentHasAnyImage?: boolean = false
  18 +}
  19 +
  20 +export class FormNewspaperPaperContent {
  21 + title: string = ""
  22 + coverUrl?: string
  23 + deepLink: string = ""
  24 +}
  1 +import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent } from "../common/NewspaperWidgetData"
  2 +import { FormTopComponent } from "./FormTopComponent"
  3 +import { NewspaperWidgetCommon } from "../common/NewspaperWidgetCommon"
  4 +
  5 +const TAG = "DailyNewspaperWidgetCard"
  6 +let storageWidgetImageUpdate = new LocalStorage();
  7 +
  8 +@Entry(storageWidgetImageUpdate)
  9 +@Component
  10 +struct DailyNewspaperWidgetCard {
  11 + @LocalStorageProp('paperType') paperType: FormNewspaperPaperType = FormNewspaperPaperType.unknown;
  12 + @LocalStorageProp('paperInfo') paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo;
  13 + @LocalStorageProp('paperContents') paperContents: FormNewspaperPaperContent[] = [];
  14 +
  15 + private DAILY_NEWSPAPER_DEEP_LINK = "rmrbapp://rmrb.app/openwith?type=topic&subType=moring_evening_news&pageId=&relId=&skipType=1"
  16 +
  17 + build() {
  18 +
  19 + Column() {
  20 + FormTopComponent({
  21 + paperType: this.paperType
  22 + })
  23 + .width("100%").height(36)
  24 + // .margin({top: 3})
  25 + .onClick(() => {
  26 + jumpWithDeepLink(this.DAILY_NEWSPAPER_DEEP_LINK, this)
  27 + })
  28 +
  29 + Row() {
  30 + if (this.paperInfo.showLeftImage) {
  31 + this.leftImageView()
  32 + }
  33 +
  34 + if (this.paperContents.length) {
  35 + this.listView()
  36 + } else {
  37 + EmptyView()
  38 + }
  39 + }.width("100%")
  40 + .layoutWeight(1)
  41 + }
  42 + }
  43 +
  44 + @Builder leftImageView() {
  45 + Stack({ alignContent: Alignment.Bottom }) {
  46 + Image(this.paperInfo.leftImageUrl)
  47 + // Image($r("app.media.desktop_card_comp_place_holder_16_9"))
  48 + .alt($r("app.media.desktop_card_comp_place_holder_16_9"))
  49 + .objectFit(ImageFit.Cover)
  50 + .aspectRatio(87/116)
  51 + .autoResize(true)
  52 + .borderRadius(6)
  53 + .onClick(() => {
  54 + jumpWithDeepLink(this.paperInfo.leftDeepLink || "", this)
  55 + })
  56 +
  57 + Text(this.paperInfo.leftTitle)
  58 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  59 + .fontSize(11)
  60 + .fontWeight(800)
  61 + .lineHeight(14)
  62 + .maxLines(2)
  63 + .fontColor(Color.White)
  64 + .padding({left: 4 + 4, bottom:6, right: 4 + 4})
  65 + }
  66 + .margin({left: 12, top: 2, bottom: 12})
  67 + // .backgroundColor(Color.Red)
  68 + .width(87)
  69 + }
  70 +
  71 + @Builder listView() {
  72 + List() {
  73 + ForEach(this.paperContents, (item: FormNewspaperPaperContent, index: number) => {
  74 + ListItem() {
  75 + ContentCellView({content: item, index: index, hasImage: (item.coverUrl && item.coverUrl.length > 0 ? true : false)})
  76 + }
  77 + }, (item: FormNewspaperPaperContent, index) => index + JSON.stringify(item))
  78 + }
  79 + .divider(
  80 + {strokeWidth: 0.5,
  81 + color: "#f5f5f5",
  82 + startMargin: 0,
  83 + endMargin: 0})
  84 + .width("100%")
  85 + .margin({left: this.paperInfo.showLeftImage ? 8 : 12, top: 0, bottom: 12, right: 12})
  86 + .layoutWeight(1)
  87 + }
  88 +}
  89 +
  90 +@Component
  91 +struct ContentCellView {
  92 + @Prop content: FormNewspaperPaperContent
  93 + private index : number = 0
  94 + private hasImage: boolean = false
  95 + build() {
  96 + Row() {
  97 + Text(this.content.title)
  98 + .maxLines((this.content.coverUrl && this.content.coverUrl.length > 0 ? 2 : 1))
  99 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  100 + .fontSize(14)
  101 + .lineHeight(20)
  102 + .fontWeight(FontWeight.Medium)
  103 + .fontColor(Color.Black)
  104 + .layoutWeight(1)
  105 + // .backgroundColor(Color.Red)
  106 + .offset({y: this.hasImage && this.index == 0 ? -3 : 0})
  107 + .margin({
  108 + top: this.hasImage ? 0 : 4,
  109 + bottom: this.hasImage ? 0 : 6})
  110 +
  111 + if (this.hasImage) {
  112 + Image(this.content.coverUrl)
  113 + // Image($r("app.media.desktop_card_comp_place_holder_3_4"))
  114 + .alt($r("app.media.desktop_card_comp_place_holder_3_4"))
  115 + .objectFit(ImageFit.Cover)
  116 + .height(40)
  117 + .aspectRatio(75/50)
  118 + .borderRadius(4)
  119 + .margin({left: 10, bottom: 8, top: this.index == 0 ? 2 : 8, right: 0})
  120 + .autoResize(true)
  121 + }
  122 + }
  123 + .justifyContent(FlexAlign.Start)
  124 + .onClick(() => {
  125 + jumpWithDeepLink(this.content.deepLink || "", this)
  126 + })
  127 + }
  128 +}
  129 +
  130 +@Component
  131 +struct EmptyView {
  132 + build() {
  133 + Row() {
  134 + Image($r("app.media.desktop_card_empty_bg"))
  135 + .objectFit(ImageFit.Fill)
  136 + // .width("100%")
  137 + // .height("100%")
  138 + .margin({left: 12, bottom: 12, right: 12, top: 4})
  139 + }
  140 + .height("100%")
  141 + .width("100%")
  142 +
  143 + // .backgroundColor(Color.Red)
  144 + }
  145 +
  146 +
  147 +}
  148 +
  149 +function jumpWithDeepLink(deepLink: string, component: Object) {
  150 + console.log(TAG + "jumpWithDeepLink: " + deepLink)
  151 + if (deepLink.length == 0) {
  152 + return
  153 + }
  154 + const deepLinkKey: string = NewspaperWidgetCommon.JumpParam.DeepLinkKey
  155 + const fromDailyNewspaperKey: string = NewspaperWidgetCommon.JumpParam.FromNewspaperWidgetKey
  156 + postCardAction(component, {
  157 + action: NewspaperWidgetCommon.PosterCardAction.ActionRouter,
  158 + abilityName: NewspaperWidgetCommon.PosterCardAction.MainAbilityName,
  159 + params: {
  160 + deepLinkKey: deepLink,
  161 + fromDailyNewspaperKey: true
  162 + }
  163 + });
  164 +}
  1 +import { FormNewspaperPaperType } from "../common/NewspaperWidgetData"
  2 +
  3 +@Component
  4 +export struct FormTopComponent {
  5 + @Prop paperType: FormNewspaperPaperType
  6 +
  7 + build() {
  8 +
  9 + Row() {
  10 +
  11 + if (this.paperType == FormNewspaperPaperType.noon) {
  12 + Image($r("app.media.desktop_card_newspaper_noon"))
  13 + .fancy()
  14 + } else if (this.paperType == FormNewspaperPaperType.evening) {
  15 + Image($r("app.media.desktop_card_newspaper_evening"))
  16 + .fancy()
  17 + } else {
  18 + Image($r("app.media.desktop_card_newspaper_moring"))
  19 + .fancy()
  20 + }
  21 +
  22 + Image($r("app.media.desktop_card_peopledaily_logo"))
  23 + .width(213).height(18)
  24 + .offset({right: -10})
  25 + }
  26 + .justifyContent(FlexAlign.SpaceBetween)
  27 + .alignItems(VerticalAlign.Center)
  28 + .width("100%").height("100%")
  29 + }
  30 +}
  31 +
  32 +@Extend(Image) function fancy() {
  33 + .width(58)
  34 + .height(20)
  35 + .margin({left: 12})
  36 +}
@@ -57,8 +57,9 @@ export default class EntryAbility extends UIAbility { @@ -57,8 +57,9 @@ export default class EntryAbility extends UIAbility {
57 AppStorage.setOrCreate('topSafeHeight', topSafeHeight); 57 AppStorage.setOrCreate('topSafeHeight', topSafeHeight);
58 AppStorage.setOrCreate('windowWidth', width); 58 AppStorage.setOrCreate('windowWidth', width);
59 AppStorage.setOrCreate('windowHeight', height); 59 AppStorage.setOrCreate('windowHeight', height);
60 - // 音频悬浮窗初始移动位置604为ui高度  
61 - let initMoveY = vp2px(604) 60 + // 音频悬浮窗初始移动位置604为ui高度, 下面的初始位置根据mate60 pro手动调整
  61 + let initMoveY = vp2px(576)
  62 + let initMoveX = vp2px(12)
62 63
63 this.onWindowSetup(windowClass) 64 this.onWindowSetup(windowClass)
64 65
@@ -81,7 +82,7 @@ export default class EntryAbility extends UIAbility { @@ -81,7 +82,7 @@ export default class EntryAbility extends UIAbility {
81 floatWindowClass = data; 82 floatWindowClass = data;
82 AppStorage.setOrCreate('floatWindowClass', floatWindowClass); 83 AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
83 // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。 84 // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
84 - floatWindowClass.moveWindowTo(0, initMoveY, (err: BusinessError) => { 85 + floatWindowClass.moveWindowTo(initMoveX, initMoveY, (err: BusinessError) => {
85 let errCode: number = err.code; 86 let errCode: number = err.code;
86 if (errCode) { 87 if (errCode) {
87 Logger.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err)); 88 Logger.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
@@ -40,11 +40,11 @@ struct Index { @@ -40,11 +40,11 @@ struct Index {
40 40
41 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => { 41 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
42 // val 2 pause 42 // val 2 pause
43 - if(val === 2) {  
44 - console.log(TAG,'this.currentStatus 2 ', val) 43 + if(val === PlayerConstants.STATUS_PAUSE || val === PlayerConstants.STATUS_COMPLETION) {
  44 + console.log(TAG,'AUDIO_CHANGE_STATUS this.currentStatus 2 ', val)
45 lottie.pause(this.name) 45 lottie.pause(this.name)
46 - } else if(val === 1) {  
47 - console.log(TAG,'this.currentStatus 1 ', val) 46 + } else if(val === PlayerConstants.STATUS_START) {
  47 + console.log(TAG,'AUDIO_CHANGE_STATUS this.currentStatus 1 ', val)
48 lottie.play(this.name) 48 lottie.play(this.name)
49 } 49 }
50 this.currentStatus = val 50 this.currentStatus = val
@@ -76,7 +76,7 @@ struct Index { @@ -76,7 +76,7 @@ struct Index {
76 76
77 build() { 77 build() {
78 Stack({ alignContent: Alignment.End }) { 78 Stack({ alignContent: Alignment.End }) {
79 - if(this.isExpand) { 79 + Stack({ alignContent: Alignment.End }) {
80 Column() { //标题 时间 进度条 80 Column() { //标题 时间 进度条
81 Marquee({ 81 Marquee({
82 start: true, 82 start: true,
@@ -89,6 +89,8 @@ struct Index { @@ -89,6 +89,8 @@ struct Index {
89 .height(20) 89 .height(20)
90 .fontColor('#222222') 90 .fontColor('#222222')
91 .fontSize(14) 91 .fontSize(14)
  92 + .fontFamily('PingFang SC-Medium')
  93 + .fontWeight(500)
92 .alignSelf(ItemAlign.Start) 94 .alignSelf(ItemAlign.Start)
93 .onStart(() => { 95 .onStart(() => {
94 console.info('Marquee animation complete onStart') 96 console.info('Marquee animation complete onStart')
@@ -129,7 +131,7 @@ struct Index { @@ -129,7 +131,7 @@ struct Index {
129 .justifyContent(FlexAlign.Start) 131 .justifyContent(FlexAlign.Start)
130 132
131 Row() { 133 Row() {
132 - Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause") : $r("app.media.icon_audio_playing")) 134 + Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause_svg") : $r("app.media.icon_audio_playing_svg"))
133 .objectFit(ImageFit.Contain) 135 .objectFit(ImageFit.Contain)
134 .width(24) 136 .width(24)
135 .height(24) 137 .height(24)
@@ -156,21 +158,23 @@ struct Index { @@ -156,21 +158,23 @@ struct Index {
156 } 158 }
157 .width(80) 159 .width(80)
158 .height(60) 160 .height(60)
159 - } else {  
160 - Row() {  
161 - LottieView({  
162 - name: this.name,  
163 - path: "lottie/audio_animation_playing.json",  
164 - lottieWidth: 24,  
165 - lottieHeight: 24,  
166 - autoplay: false,  
167 - loop: true  
168 - })  
169 - }  
170 - .justifyContent(FlexAlign.Center)  
171 - .width(60)  
172 - .height(60)  
173 } 161 }
  162 + .visibility(this.isExpand ? Visibility.Visible : Visibility.Hidden)
  163 +
  164 + Row() {
  165 + LottieView({
  166 + name: this.name,
  167 + path: "lottie/audio_animation_playing.json",
  168 + lottieWidth: 24,
  169 + lottieHeight: 24,
  170 + autoplay: false,
  171 + loop: true
  172 + })
  173 + }
  174 + .justifyContent(FlexAlign.Center)
  175 + .width(60)
  176 + .height(60)
  177 + .visibility(!this.isExpand ? Visibility.Visible : Visibility.Hidden)
174 } 178 }
175 .parallelGesture( 179 .parallelGesture(
176 GestureGroup(GestureMode.Parallel, 180 GestureGroup(GestureMode.Parallel,
@@ -321,8 +321,8 @@ export struct MultiPictureDetailPageComponent { @@ -321,8 +321,8 @@ export struct MultiPictureDetailPageComponent {
321 middle: { anchor: "__container__", align: HorizontalAlign.Center } 321 middle: { anchor: "__container__", align: HorizontalAlign.Center }
322 }) 322 })
323 .zIndex(1) 323 .zIndex(1)
324 - .onChange((index: number) => {  
325 - this.swiperIndex = index 324 + .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => {
  325 + this.swiperIndex = targetIndex
326 }) 326 })
327 .onClick(() => { 327 .onClick(() => {
328 this.showDownload = !this.showDownload 328 this.showDownload = !this.showDownload
@@ -125,7 +125,6 @@ export struct VideoChannelPage { @@ -125,7 +125,6 @@ export struct VideoChannelPage {
125 }, (item: TopNavDTO) => item.channelId + '') 125 }, (item: TopNavDTO) => item.channelId + '')
126 } 126 }
127 .width('100%') 127 .width('100%')
128 -  
129 .justifyContent(FlexAlign.Center) 128 .justifyContent(FlexAlign.Center)
130 129
131 // 搜索按钮 130 // 搜索按钮
@@ -182,7 +181,7 @@ export struct VideoChannelPage { @@ -182,7 +181,7 @@ export struct VideoChannelPage {
182 channelId: item.channelId + '', 181 channelId: item.channelId + '',
183 autoRefresh: this.autoRefresh 182 autoRefresh: this.autoRefresh
184 }) 183 })
185 - .padding({ top: px2vp(this.topSafeHeight) + 55 }) 184 + .padding({ top: px2vp(this.topSafeHeight) + 44 })
186 .backgroundColor(Color.White) 185 .backgroundColor(Color.White)
187 } 186 }
188 }, (item: TopNavDTO) => item.channelId + '') 187 }, (item: TopNavDTO) => item.channelId + '')
@@ -15,7 +15,8 @@ @@ -15,7 +15,8 @@
15 "pages": "$profile:main_pages", 15 "pages": "$profile:main_pages",
16 "abilities": [ 16 "abilities": [
17 { 17 {
18 - "name": "EntryAbility", // 这里不能改动,和后台推送有绑定 18 + "name": "EntryAbility",
  19 + // 这里不能改动,和后台推送有绑定
19 "srcEntry": "./ets/entryability/EntryAbility.ets", 20 "srcEntry": "./ets/entryability/EntryAbility.ets",
20 "description": "$string:EntryAbility_desc", 21 "description": "$string:EntryAbility_desc",
21 "icon": "$media:app_icon_layer", 22 "icon": "$media:app_icon_layer",
@@ -32,20 +33,24 @@ @@ -32,20 +33,24 @@
32 "action.system.home", 33 "action.system.home",
33 "com.test.pushaction" 34 "com.test.pushaction"
34 ], 35 ],
35 - "uris" : [{  
36 - "scheme": 'rmrbapp',  
37 - "host": 'rmrb.app',  
38 - 'port': '8080',  
39 - "path": 'openwith'  
40 - }] 36 + "uris": [
  37 + {
  38 + "scheme": 'rmrbapp',
  39 + "host": 'rmrb.app',
  40 + 'port': '8080',
  41 + "path": 'openwith'
  42 + }
  43 + ]
41 } 44 }
42 ] 45 ]
43 } 46 }
44 ], 47 ],
45 - "metadata": [{  
46 - "name": "client_id",  
47 - "value": "110737325"  
48 - }], 48 + "metadata": [
  49 + {
  50 + "name": "client_id",
  51 + "value": "110737325"
  52 + }
  53 + ],
49 "requestPermissions": [ 54 "requestPermissions": [
50 { 55 {
51 "name": "ohos.permission.CAMERA", 56 "name": "ohos.permission.CAMERA",
@@ -100,6 +105,22 @@ @@ -100,6 +105,22 @@
100 { 105 {
101 "name": "ohos.permission.INTERNET" 106 "name": "ohos.permission.INTERNET"
102 }, 107 },
  108 + ],
  109 + "extensionAbilities": [
  110 + {
  111 + "name": "DailyNewspaperFormAbility",
  112 + "srcEntry": "./ets/dailynewspaperformability/DailyNewspaperFormAbility.ets",
  113 + "label": "$string:DailyNewspaperFormAbility_label",
  114 + "description": "$string:DailyNewspaperFormAbility_desc",
  115 + "type": "form",
  116 + "metadata": [
  117 + {
  118 + "name": "ohos.extension.form",
  119 + "resource": "$profile:form_config"
  120 + }
  121 + ],
  122 +
  123 + }
103 ] 124 ]
104 } 125 }
105 } 126 }
@@ -63,6 +63,22 @@ @@ -63,6 +63,22 @@
63 { 63 {
64 "name": "reason_read_write_media", 64 "name": "reason_read_write_media",
65 "value": "user_grant" 65 "value": "user_grant"
  66 + },
  67 + {
  68 + "name": "DailyNewspaperFormAbility_desc",
  69 + "value": "早晚报卡片"
  70 + },
  71 + {
  72 + "name": "DailyNewspaperFormAbility_label",
  73 + "value": "早晚报卡片"
  74 + },
  75 + {
  76 + "name": "DailyNewspaperWidget_desc",
  77 + "value": "有品质的新闻"
  78 + },
  79 + {
  80 + "name": "DailyNewspaperWidget_display_name",
  81 + "value": "早晚报"
66 } 82 }
67 ] 83 ]
68 } 84 }
  1 +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="316" height="116" viewBox="0 0 316 116"><g><g><rect x="0" y="7" width="214" height="14" rx="0" fill="#F5F5F5" fill-opacity="1"/></g><g><rect x="0" y="73" width="214" height="14" rx="0" fill="#F5F5F5" fill-opacity="1"/></g><g><rect x="0" y="29" width="150" height="14" rx="0" fill="#F5F5F5" fill-opacity="1"/></g><g><rect x="0" y="95" width="150" height="14" rx="0" fill="#F5F5F5" fill-opacity="1"/></g><g><g><rect x="241" y="0" width="75" height="50" rx="4" fill="#F5F5F5" fill-opacity="1"/></g></g><g><g><rect x="241" y="66" width="75" height="50" rx="4" fill="#F5F5F5" fill-opacity="1"/></g></g><g><line x1="0" y1="57.75" x2="316.0000305175781" y2="57.75" fill-opacity="0" stroke-opacity="1" stroke="#EDEDED" fill="none" stroke-width="0.5"/></g></g></svg>
  1 +{
  2 + "forms": [
  3 + {
  4 + "name": "DailyNewspaperWidget",
  5 + "displayName": "$string:DailyNewspaperWidget_display_name",
  6 + "description": "$string:DailyNewspaperWidget_desc",
  7 + "src": "./ets/dailynewspaperwidget/pages/DailyNewspaperWidgetCard.ets",
  8 + "uiSyntax": "arkts",
  9 + "window": {
  10 + "designWidth": 720,
  11 + "autoDesignWidth": true
  12 + },
  13 + "colorMode": "light",
  14 + "isDynamic": true,
  15 + "isDefault": true,
  16 + "updateEnabled": true,
  17 + "scheduledUpdateTime": "10:30",
  18 + "updateDuration": 1,
  19 + "defaultDimension": "2*4",
  20 + "supportDimensions": [
  21 + "2*4"
  22 + ]
  23 + }
  24 + ]
  25 +}