陈剑华

Merge remote-tracking branch 'origin/main'

Showing 48 changed files with 1006 additions and 499 deletions
@@ -67,4 +67,8 @@ export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM' @@ -67,4 +67,8 @@ export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'
67 export { FastClickUtil } from './src/main/ets/utils/FastClickUtil'; 67 export { FastClickUtil } from './src/main/ets/utils/FastClickUtil';
68 68
69 // export { PublicPopupDialogView } from "./src/main/ets/pubComps/dialog/PublicPopupDialogView" 69 // export { PublicPopupDialogView } from "./src/main/ets/pubComps/dialog/PublicPopupDialogView"
70 -export { PublicDialogManager, CloseAction } from "./src/main/ets/pubComps/dialog/PublicDialogManager"  
  70 +export { PublicDialogManager, CloseAction } from "./src/main/ets/pubComps/dialog/PublicDialogManager"
  71 +
  72 +export { CrptoUtils } from "./src/main/ets/utils/CrptoUtils"
  73 +
  74 +export { FileUtils } from "./src/main/ets/utils/FileUtils"
  1 +import cryptoFramework from '@ohos.security.cryptoFramework';
  2 +import buffer from '@ohos.buffer';
  3 +
  4 +export class CrptoUtils {
  5 +
  6 + static md5(message: string) : Promise<string> {
  7 + return CrptoUtils.mdFunc(message, 'MD5')
  8 + }
  9 +
  10 + static mdFunc(message: string, algoName: string = 'MD5'): Promise<string> {
  11 + return new Promise<string>(async (reslove, fail) => {
  12 +
  13 + try {
  14 + let md = cryptoFramework.createMd(algoName);
  15 + // 数据量较少时,可以只做一次update,将数据全部传入,接口未对入参长度做限制
  16 + await md.update({ data: new Uint8Array(buffer.from(message, 'utf-8').buffer) });
  17 + let mdResult = await md.digest();
  18 + // console.info('Md result:' + mdResult.data);
  19 +
  20 + // const string = mdResult.data.map((charCode, index, array) => {
  21 + // return String.fromCharCode(charCode)
  22 + // }).join("")
  23 +
  24 + let string = "";
  25 + for (let i = 0; i < mdResult.data.length; i++) {
  26 + string += mdResult.data[i].toString(16).padStart(2, "0")
  27 + }
  28 +
  29 + // const string = mdResult.data.join('')
  30 +
  31 + reslove(string)
  32 + } catch (e) {
  33 + fail(e)
  34 + }
  35 + })
  36 + }
  37 +}
  38 +
  39 +
  40 +
  41 +
  1 +
  2 +import fs from '@ohos.file.fs';
  3 +import { BusinessError } from '@kit.BasicServicesKit';
  4 +
  5 +export class FileUtils {
  6 +
  7 + // 文件是否存在,忽略错误
  8 + static fileExsit(path: string) : Promise<boolean> {
  9 + return new Promise((reslove, fail) => {
  10 + fs.stat(path).then(() => {
  11 + reslove(true)
  12 + }).catch((error: BusinessError) => {
  13 + if (error.code = 13900002) {
  14 + reslove(false)
  15 + } else {
  16 + reslove(true)
  17 + }
  18 + })
  19 + });
  20 + }
  21 +
  22 + static makeDirIfNotExsit(path: string) : Promise<void> {
  23 + return new Promise((reslove, fail) => {
  24 + fs.stat(path).then(() => {
  25 + reslove()
  26 + }).catch((error: BusinessError) => {
  27 + if (error.code = 13900002) {
  28 + fs.mkdirSync(path)
  29 + }
  30 + reslove()
  31 + })
  32 + })
  33 + }
  34 +}
@@ -49,9 +49,9 @@ export function registerRouter() { @@ -49,9 +49,9 @@ export function registerRouter() {
49 // }) 49 // })
50 50
51 Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { 51 Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => {
52 - if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) { 52 + if (action.params?.detailPageType == 2) {
53 return WDRouterPage.detailPlayLiveCommon 53 return WDRouterPage.detailPlayLiveCommon
54 - } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { 54 + } else if (action.params?.detailPageType == 1) {
55 return WDRouterPage.detailVideoListPage 55 return WDRouterPage.detailVideoListPage
56 } else if (action.params?.detailPageType == 9) { 56 } else if (action.params?.detailPageType == 9) {
57 //图集详情页 57 //图集详情页
@@ -59,16 +59,19 @@ export function registerRouter() { @@ -59,16 +59,19 @@ export function registerRouter() {
59 } else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) { 59 } else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) {
60 //动态详情页 60 //动态详情页
61 return WDRouterPage.dynamicDetailPage 61 return WDRouterPage.dynamicDetailPage
62 - } else if (action.params?.detailPageType == 17) {  
63 - return WDRouterPage.multiPictureDetailPage  
64 } else if (action.params?.detailPageType == 13) { 62 } else if (action.params?.detailPageType == 13) {
65 return WDRouterPage.audioDetail 63 return WDRouterPage.audioDetail
66 - } else if (action.params?.detailPageType == 18) { 64 + } else if (action.params?.detailPageType == 30) {
  65 + return WDRouterPage.themeListPage
  66 + } else if (action.params?.detailPageType == 8) {
  67 + return WDRouterPage.imageTextDetailPage
  68 + }
  69 +
  70 + //TODO: 以下两个最好改为pageID方式,以上都是有具体内容类型 对应详情页面
  71 + else if (action.params?.detailPageType == 18) {
67 return WDRouterPage.multiPictureListPage 72 return WDRouterPage.multiPictureListPage
68 } else if (action.params?.detailPageType == 19) { 73 } else if (action.params?.detailPageType == 19) {
69 return WDRouterPage.videoPlayPage 74 return WDRouterPage.videoPlayPage
70 - }else if (action.params?.detailPageType == 30) {  
71 - return WDRouterPage.themeListPage  
72 } 75 }
73 return WDRouterPage.detailPlayVodPage 76 return WDRouterPage.detailPlayVodPage
74 }) 77 })
@@ -3,6 +3,7 @@ import App from '@system.app' @@ -3,6 +3,7 @@ import App from '@system.app'
3 import { Action, Params } from 'wdBean/Index' 3 import { Action, Params } from 'wdBean/Index'
4 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' 4 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
5 import { Logger } from 'wdKit/Index' 5 import { Logger } from 'wdKit/Index'
  6 +import { ContentType } from '../common/ContentType'
6 import { WDRouterRule } from '../router/WDRouterRule' 7 import { WDRouterRule } from '../router/WDRouterRule'
7 import { ProcessUtils } from './ProcessUtils' 8 import { ProcessUtils } from './ProcessUtils'
8 9
@@ -111,13 +112,13 @@ export class AppInnerLink { @@ -111,13 +112,13 @@ export class AppInnerLink {
111 } 112 }
112 private static contentTypeWithType(type?: string) : number | undefined { 113 private static contentTypeWithType(type?: string) : number | undefined {
113 switch (type) { 114 switch (type) {
114 - case "video": return 1  
115 - case "dynamic": return 14  
116 - case "live": return 2  
117 - case "audio": return 13  
118 - case "picture": return 9  
119 - case "article": return 8  
120 - case "ask": return 16 115 + case "video": return ContentType.Video
  116 + case "dynamic": return ContentType.DynamicImageText
  117 + case "live": return ContentType.Live
  118 + case "audio": return ContentType.Audio
  119 + case "picture": return ContentType.Pictures
  120 + case "article": return ContentType.ImageText
  121 + case "ask": return ContentType.Ask
121 } 122 }
122 return 123 return
123 } 124 }
1 import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean'; 1 import { Action, ContentDTO, Params, PhotoListBean, commentInfo } from 'wdBean';
2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; 2 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
3 -import { Logger, SPHelper } from 'wdKit'; 3 +import { Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
4 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; 4 import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
5 import { WDRouterRule, WDRouterPage } from '../../../../Index'; 5 import { WDRouterRule, WDRouterPage } from '../../../../Index';
6 import { ContentConstants, SpConstants } from 'wdConstant'; 6 import { ContentConstants, SpConstants } from 'wdConstant';
@@ -84,6 +84,13 @@ export class ProcessUtils { @@ -84,6 +84,13 @@ export class ProcessUtils {
84 Logger.error(TAG, "processPage, objectType is empty"); 84 Logger.error(TAG, "processPage, objectType is empty");
85 return; 85 return;
86 } 86 }
  87 + // 网络出小差了,请检查网络后重试
  88 + let netStatus = NetworkUtil.isNetConnected()
  89 + if(!netStatus){
  90 + ToastUtils.shortToast('网络出小差了,请检查网络后重试')
  91 + return
  92 + }
  93 +
87 let type = content.objectType; 94 let type = content.objectType;
88 if (typeof type == "number") { 95 if (typeof type == "number") {
89 type = `${type}` 96 type = `${type}`
@@ -304,7 +311,7 @@ export class ProcessUtils { @@ -304,7 +311,7 @@ export class ProcessUtils {
304 let taskAction: Action = { 311 let taskAction: Action = {
305 type: 'JUMP_DETAIL_PAGE', 312 type: 'JUMP_DETAIL_PAGE',
306 params: { 313 params: {
307 - detailPageType: 7, 314 + detailPageType: 1,
308 contentID: content?.objectId, 315 contentID: content?.objectId,
309 extra: { 316 extra: {
310 relType: content?.relType, 317 relType: content?.relType,
@@ -382,7 +389,7 @@ export class ProcessUtils { @@ -382,7 +389,7 @@ export class ProcessUtils {
382 let taskAction: Action = { 389 let taskAction: Action = {
383 type: 'JUMP_DETAIL_PAGE', 390 type: 'JUMP_DETAIL_PAGE',
384 params: { 391 params: {
385 - detailPageType: 17, 392 + detailPageType: 9,
386 contentID: content?.objectId, 393 contentID: content?.objectId,
387 extra: { 394 extra: {
388 relType: content?.relType, 395 relType: content?.relType,
@@ -10,16 +10,13 @@ export interface Params { @@ -10,16 +10,13 @@ export interface Params {
10 // 详情页类型 10 // 详情页类型
11 // 1.点播详情页 11 // 1.点播详情页
12 // 2.直播详情页 12 // 2.直播详情页
13 - // 3.图文详情页  
14 - // 4.全民播详情页  
15 - // 5.欢喜详情页  
16 - // 6.挂件详情页  
17 - // 7.沉浸式竖屏详情页  
18 - // 8.专辑竖屏详情页  
19 - // 13.音频详情页  
20 - // 17.多图(图集)详情页  
21 - // 18.大图列表页  
22 - // 19.单个视频播放页 13 + // 8.图文详情页
  14 + // 9.多图(图集)详情页
  15 + // 14和15 动态详情页
  16 + // 13 音频详情页
  17 + // 30 金刚位
  18 + // 18.大图列表页 - 图片预览 ------ 需要变更待定
  19 + // 19.单个视频播放页 - 视频播放 ----- 需要变更待定
23 detailPageType?: number; // 详情页类型 20 detailPageType?: number; // 详情页类型
24 liveStyle?: number; // 直播类型:0横屏,1竖屏 21 liveStyle?: number; // 直播类型:0横屏,1竖屏
25 creatorId?: string; //号主id 22 creatorId?: string; //号主id
@@ -25,6 +25,7 @@ import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; @@ -25,6 +25,7 @@ import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
25 */ 25 */
26 @Component 26 @Component
27 export struct CardParser { 27 export struct CardParser {
  28 +
28 @State pageId: string = ''; 29 @State pageId: string = '';
29 @State pageName: string = ''; 30 @State pageName: string = '';
30 @State contentDTO: ContentDTO = new ContentDTO(); 31 @State contentDTO: ContentDTO = new ContentDTO();
@@ -45,8 +45,6 @@ export struct CompParser { @@ -45,8 +45,6 @@ export struct CompParser {
45 45
46 aboutToAppear(): void { 46 aboutToAppear(): void {
47 47
48 -  
49 -  
50 console.log('CompParser', JSON.stringify(this.compDTO)) 48 console.log('CompParser', JSON.stringify(this.compDTO))
51 this.pageName = this.pageModel.pageInfo.name 49 this.pageName = this.pageModel.pageInfo.name
52 // 轮播图屏蔽音频类型稿件 50 // 轮播图屏蔽音频类型稿件
@@ -648,7 +648,7 @@ export struct DynamicDetailComponent { @@ -648,7 +648,7 @@ export struct DynamicDetailComponent {
648 { 648 {
649 contentId: this.contentDetailData?.newsId + '', 649 contentId: this.contentDetailData?.newsId + '',
650 contentType: this.contentDetailData?.newsType + '', 650 contentType: this.contentDetailData?.newsType + '',
651 - contentRelId: this.contentDetailData?.reLInfo?.relId + '', 651 + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
652 } 652 }
653 ] 653 ]
654 } 654 }
@@ -13,6 +13,10 @@ export struct ENewspaperItemComponent { @@ -13,6 +13,10 @@ export struct ENewspaperItemComponent {
13 private startY: number = 0 13 private startY: number = 0
14 private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean 14 private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean
15 @State isShowSkeleton: boolean = true 15 @State isShowSkeleton: boolean = true
  16 + @State contentWidth: number = 0
  17 + @State contentHeight: number = 0
  18 + @Consume itemPicWidth: number
  19 + @Consume itemPicHeight: number
16 20
17 aboutToAppear(): void { 21 aboutToAppear(): void {
18 for (let index = 0; index < this.newspaperListItemBean.items.length; index++) { 22 for (let index = 0; index < this.newspaperListItemBean.items.length; index++) {
@@ -33,23 +37,28 @@ export struct ENewspaperItemComponent { @@ -33,23 +37,28 @@ export struct ENewspaperItemComponent {
33 newsSkeleton() 37 newsSkeleton()
34 .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None) 38 .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
35 Image(this.newspaperListItemBean.pagePic) 39 Image(this.newspaperListItemBean.pagePic)
36 - .width('100%')  
37 - .onComplete(() => { 40 + .width(px2vp(this.itemPicWidth))
  41 + .height(px2vp(this.itemPicHeight))
  42 + .onComplete((event) => {
  43 + if (event?.loadingStatus == 1) {
  44 + this.contentWidth = event?.contentWidth
  45 + this.contentHeight = event?.contentHeight
  46 + }
38 this.isShowSkeleton = false 47 this.isShowSkeleton = false
39 }) 48 })
40 - .objectFit(ImageFit.Contain) 49 + .objectFit(ImageFit.Fill)
41 .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) 50 .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
  51 + if (this.contentWidth !== 0) {
  52 + Canvas(this.context)
  53 + .width(px2vp(this.contentWidth))
  54 + .height(px2vp(this.contentHeight))
  55 + .backgroundColor(Color.Transparent)
  56 + .onReady(() => {
42 57
43 - Canvas(this.context)  
44 - .width('100%')  
45 - .height('100%')  
46 - .backgroundColor(Color.Transparent)  
47 - .onReady(() => {  
48 -  
49 - }) 58 + })
  59 + }
50 } 60 }
51 .padding({ top:14, right: 10, bottom: 14, left: 10 }) 61 .padding({ top:14, right: 10, bottom: 14, left: 10 })
52 - .margin({ left: 10, right: 10 })  
53 .backgroundColor(Color.White) 62 .backgroundColor(Color.White)
54 .width('100%') 63 .width('100%')
55 .onTouch((event: TouchEvent) => { 64 .onTouch((event: TouchEvent) => {
@@ -59,6 +68,7 @@ export struct ENewspaperItemComponent { @@ -59,6 +68,7 @@ export struct ENewspaperItemComponent {
59 this.startX = x; 68 this.startX = x;
60 this.startY = y; 69 this.startY = y;
61 let points: number[][] = this.getArea(x, y, this.newspaperListItemBean.items); 70 let points: number[][] = this.getArea(x, y, this.newspaperListItemBean.items);
  71 + console.log("event.points", JSON.stringify(points))
62 if (points && points.length > 2) { 72 if (points && points.length > 2) {
63 let path = new Path2D(); 73 let path = new Path2D();
64 path.moveTo(px2vp(points[0][0]), px2vp(points[0][1])); 74 path.moveTo(px2vp(points[0][0]), px2vp(points[0][1]));
@@ -21,8 +21,10 @@ export struct ENewspaperPageComponent { @@ -21,8 +21,10 @@ export struct ENewspaperPageComponent {
21 private windowClass?: window.Window; 21 private windowClass?: window.Window;
22 private displayTool = display.getDefaultDisplaySync() 22 private displayTool = display.getDefaultDisplaySync()
23 private screenWidth: number = 0 23 private screenWidth: number = 0
24 - private picWidth: number = 0 24 + @State picWidth: number = 0
25 @State picHeight: number = 0 25 @State picHeight: number = 0
  26 + @Provide itemPicWidth: number = 0
  27 + @Provide itemPicHeight: number = 0
26 @State newspaperListBean: NewspaperListBean = {} as NewspaperListBean 28 @State newspaperListBean: NewspaperListBean = {} as NewspaperListBean
27 @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' 29 @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
28 @State pageDialogShow: boolean = false 30 @State pageDialogShow: boolean = false
@@ -131,13 +133,19 @@ export struct ENewspaperPageComponent { @@ -131,13 +133,19 @@ export struct ENewspaperPageComponent {
131 this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width 133 this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width
132 console.log('ENewspaperPageComponent this.screenWidth', this.screenWidth) 134 console.log('ENewspaperPageComponent this.screenWidth', this.screenWidth)
133 // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 135 // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
134 - this.ratio = this.screenWidth > 2000 ? '60%' : '100%' 136 + this.ratio = this.screenWidth > 2000 ? '50%' : '100%'
135 //获取宽高尺寸 137 //获取宽高尺寸
136 - this.picWidth = this.screenWidth - vp2px(52) 138 + // Swiper .margin({ left: 10, right: 10 })
  139 + this.picWidth = this.screenWidth - vp2px(20)
137 let screenHeight = this.displayTool.height; 140 let screenHeight = this.displayTool.height;
138 // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度 141 // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
139 - let height = screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) 142 + // newspaper_shadow 49 高度 e_newspaper_content 59 margin top
  143 + let height = screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) - vp2px(49) -vp2px(59)
140 this.picHeight = height 144 this.picHeight = height
  145 +
  146 + let ratio = this.ratio == '100%' ? 1 : 0.5
  147 + this.picWidth = this.picWidth * ratio
  148 + this.picHeight = this.picHeight
141 // 默认日期 149 // 默认日期
142 const date = new Date() 150 const date = new Date()
143 const month = date.getMonth() + 1 151 const month = date.getMonth() + 1
@@ -168,7 +176,10 @@ export struct ENewspaperPageComponent { @@ -168,7 +176,10 @@ export struct ENewspaperPageComponent {
168 this.windowClass?.on('windowSizeChange', () => { 176 this.windowClass?.on('windowSizeChange', () => {
169 this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width 177 this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.displayTool.width
170 // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件 178 // 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
171 - this.ratio = this.screenWidth > 2000 ? '60%' : '100%' 179 + this.ratio = this.screenWidth > 2000 ? '50%' : '100%'
  180 + let ratio = this.ratio == '100%' ? 1 : 0.5
  181 + this.picWidth = this.screenWidth - vp2px(20)
  182 + this.picWidth = this.picWidth * ratio
172 }); 183 });
173 } 184 }
174 185
@@ -248,7 +259,7 @@ export struct ENewspaperPageComponent { @@ -248,7 +259,7 @@ export struct ENewspaperPageComponent {
248 .id('news_skeleton_id') 259 .id('news_skeleton_id')
249 .width('100%') 260 .width('100%')
250 .height(px2vp(this.picHeight) + 32) 261 .height(px2vp(this.picHeight) + 32)
251 - .margin({ top: 35, left: 10, right: 10 }) 262 + .margin({ top: 59, left: 10, right: 10 })
252 } 263 }
253 264
254 if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { 265 if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
@@ -259,16 +270,15 @@ export struct ENewspaperPageComponent { @@ -259,16 +270,15 @@ export struct ENewspaperPageComponent {
259 } 270 }
260 .itemSpace(10) 271 .itemSpace(10)
261 .index(this.swiperIndex) 272 .index(this.swiperIndex)
262 - .width(this.ratio)  
263 - // newspaper_shadow 44 高度 e_newspaper_content 35 margin top  
264 - .height(px2vp(this.picHeight) - 44 - 35) 273 + .width(px2vp(this.picWidth))
  274 + .height(px2vp(this.picHeight))
265 .vertical(true) 275 .vertical(true)
266 .autoPlay(false) 276 .autoPlay(false)
267 .cachedCount(1) 277 .cachedCount(1)
268 .indicator(false) 278 .indicator(false)
269 .loop(false) 279 .loop(false)
270 .displayCount(1) 280 .displayCount(1)
271 - .margin({ top: 35, left: 10, right: 10 }) 281 + .margin({ top: 59, left: 10, right: 10 })
272 .id('e_newspaper_content') 282 .id('e_newspaper_content')
273 .alignRules({ 283 .alignRules({
274 top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom }, 284 top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },
@@ -298,6 +308,7 @@ export struct ENewspaperPageComponent { @@ -298,6 +308,7 @@ export struct ENewspaperPageComponent {
298 '滑动查看下一版') 308 '滑动查看下一版')
299 .fontColor(Color.White) 309 .fontColor(Color.White)
300 .fontSize($r('app.float.font_size_14')) 310 .fontSize($r('app.float.font_size_14'))
  311 + .lineHeight(20)
301 Image($r('app.media.icon_next_page')) 312 Image($r('app.media.icon_next_page'))
302 .width($r('app.float.vp_16')) 313 .width($r('app.float.vp_16'))
303 .height($r('app.float.vp_16')) 314 .height($r('app.float.vp_16'))
@@ -305,7 +316,7 @@ export struct ENewspaperPageComponent { @@ -305,7 +316,7 @@ export struct ENewspaperPageComponent {
305 Visibility.Visible) 316 Visibility.Visible)
306 } 317 }
307 .justifyContent(FlexAlign.Center) 318 .justifyContent(FlexAlign.Center)
308 - .margin({ top: $r('app.float.margin_16') }) 319 + .margin({ top: 17 })
309 .alignRules({ 320 .alignRules({
310 top: { anchor: "e_newspaper_shadow", align: VerticalAlign.Bottom }, 321 top: { anchor: "e_newspaper_shadow", align: VerticalAlign.Bottom },
311 middle: { anchor: "__container__", align: HorizontalAlign.Center } 322 middle: { anchor: "__container__", align: HorizontalAlign.Center }
@@ -434,10 +445,15 @@ export struct ENewspaperPageComponent { @@ -434,10 +445,15 @@ export struct ENewspaperPageComponent {
434 } 445 }
435 446
436 private async getNewspaperList() { 447 private async getNewspaperList() {
  448 + // ENewspaperItemComponent .padding({ top:14, right: 10, bottom: 14, left: 10 })
  449 + // 计算图片的内容宽高
  450 + let ratio = this.ratio == '100%' ? 1 : 0.6
  451 + this.itemPicWidth = this.picWidth * ratio - vp2px(20)
  452 + this.itemPicHeight = this.picHeight - vp2px(28)
437 try { 453 try {
438 if (NetworkUtil.isNetConnected()) { 454 if (NetworkUtil.isNetConnected()) {
439 let listBean = 455 let listBean =
440 - await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) 456 + await NewspaperViewModel.getNewspaperList(this.calendarDate, this.itemPicWidth + 'x' + this.itemPicHeight)
441 this.newspaperListBean = listBean; 457 this.newspaperListBean = listBean;
442 } else { 458 } else {
443 this.showToastTip('网络出小差了,请检查网络后重试') 459 this.showToastTip('网络出小差了,请检查网络后重试')
@@ -95,7 +95,7 @@ export struct ImageAndTextPageComponent { @@ -95,7 +95,7 @@ export struct ImageAndTextPageComponent {
95 if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) { 95 if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) {
96 Row() { 96 Row() {
97 Row() { 97 Row() {
98 - if (this.newsStatusOfUser?.likeStatus === '1') { 98 + if (this.newsStatusOfUser?.likeStatus == '1') {
99 Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.ic_like_check') : 99 Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.ic_like_check') :
100 (this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer_active') : 100 (this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
101 $r('app.media.icon_candle_active'))) 101 $r('app.media.icon_candle_active')))
@@ -112,7 +112,7 @@ export struct ImageAndTextPageComponent { @@ -112,7 +112,7 @@ export struct ImageAndTextPageComponent {
112 if (this.likeNum > 0) { 112 if (this.likeNum > 0) {
113 Text(NumberFormatterUtils.formatNumberWithWan(this.likeNum)) 113 Text(NumberFormatterUtils.formatNumberWithWan(this.likeNum))
114 .fontSize(16) 114 .fontSize(16)
115 - .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999') 115 + .fontColor(this.newsStatusOfUser?.likeStatus == '1' ? '#ED2800' : '#999999')
116 .fontWeight(500) 116 .fontWeight(500)
117 .margin({ left: 5 }) 117 .margin({ left: 5 })
118 } 118 }
@@ -343,7 +343,7 @@ export struct ImageAndTextPageComponent { @@ -343,7 +343,7 @@ export struct ImageAndTextPageComponent {
343 { 343 {
344 contentId: this.contentDetailData?.newsId + '', 344 contentId: this.contentDetailData?.newsId + '',
345 contentType: this.contentDetailData?.newsType + '', 345 contentType: this.contentDetailData?.newsType + '',
346 - contentRelId: this.contentDetailData?.reLInfo?.relId + '', 346 + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
347 } 347 }
348 ] 348 ]
349 } 349 }
@@ -367,7 +367,7 @@ export struct ImageAndTextPageComponent { @@ -367,7 +367,7 @@ export struct ImageAndTextPageComponent {
367 return 367 return
368 } 368 }
369 const params: postExecuteLikeParams = { 369 const params: postExecuteLikeParams = {
370 - status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1', 370 + status: this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1',
371 contentId: this.contentDetailData?.newsId + '', 371 contentId: this.contentDetailData?.newsId + '',
372 contentType: this.contentDetailData?.newsType + '', 372 contentType: this.contentDetailData?.newsType + '',
373 } 373 }
@@ -375,7 +375,7 @@ export struct ImageAndTextPageComponent { @@ -375,7 +375,7 @@ export struct ImageAndTextPageComponent {
375 console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',) 375 console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
376 if (this.newsStatusOfUser) { 376 if (this.newsStatusOfUser) {
377 //内容点赞、取消点赞Tracking 1点赞 0取消点赞 377 //内容点赞、取消点赞Tracking 1点赞 0取消点赞
378 - TrackingContent.like(this.newsStatusOfUser?.likeStatus === '1', TrackConstants.PageName.My, TrackConstants.PageName.My) 378 + TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
379 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' 379 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
380 this.queryContentInteractCount() 380 this.queryContentInteractCount()
381 } 381 }
@@ -395,6 +395,7 @@ export struct ImageAndTextPageComponent { @@ -395,6 +395,7 @@ export struct ImageAndTextPageComponent {
395 }] 395 }]
396 } 396 }
397 PageRepository.getContentInteract(params).then(res => { 397 PageRepository.getContentInteract(params).then(res => {
  398 + console.error(TAG, 'res', JSON.stringify(res))
398 if (res.data) { 399 if (res.data) {
399 this.interactData = res.data[0] 400 this.interactData = res.data[0]
400 this.likeNum = Number(res.data[0]?.likeNum) || 0 401 this.likeNum = Number(res.data[0]?.likeNum) || 0
@@ -17,6 +17,7 @@ import { CommentDialogView } from './CommentDialogView'; @@ -17,6 +17,7 @@ import { CommentDialogView } from './CommentDialogView';
17 17
18 const TAG: string = 'SpacialTopicPageComponent' 18 const TAG: string = 'SpacialTopicPageComponent'
19 19
  20 +//专题详情页
20 @Component 21 @Component
21 export struct SpacialTopicPageComponent { 22 export struct SpacialTopicPageComponent {
22 webviewControl: BridgeWebViewControl = new BridgeWebViewControl() 23 webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
@@ -38,6 +39,7 @@ export struct SpacialTopicPageComponent { @@ -38,6 +39,7 @@ export struct SpacialTopicPageComponent {
38 @State operationButtonList: string[] = ['comment', 'collect', 'share'] 39 @State operationButtonList: string[] = ['comment', 'collect', 'share']
39 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 40 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
40 @State isNetConnected: boolean = true 41 @State isNetConnected: boolean = true
  42 + @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
41 43
42 private trySendData2H5() { 44 private trySendData2H5() {
43 if (!this.webPrepared || !this.dataPrepared) { 45 if (!this.webPrepared || !this.dataPrepared) {
@@ -189,7 +191,7 @@ export struct SpacialTopicPageComponent { @@ -189,7 +191,7 @@ export struct SpacialTopicPageComponent {
189 }).padding({ bottom: 200 }) 191 }).padding({ bottom: 200 })
190 } else { 192 } else {
191 if (!this.isPageEnd) { 193 if (!this.isPageEnd) {
192 - detailedSkeleton().padding({ bottom: this.bottomSafeHeight }) 194 + detailedSkeleton().padding({ top:`${this.topSafeHeight}px`,bottom: this.bottomSafeHeight })
193 } 195 }
194 } 196 }
195 //底部交互区 197 //底部交互区
@@ -120,7 +120,7 @@ export struct Card17Component { @@ -120,7 +120,7 @@ export struct Card17Component {
120 let taskAction: Action = { 120 let taskAction: Action = {
121 type: 'JUMP_DETAIL_PAGE', 121 type: 'JUMP_DETAIL_PAGE',
122 params: { 122 params: {
123 - detailPageType: 17, 123 + detailPageType: 9,
124 contentID: this.contentDTO.objectId, 124 contentID: this.contentDTO.objectId,
125 extra: { 125 extra: {
126 relType: this.contentDTO.relType, 126 relType: this.contentDTO.relType,
@@ -50,6 +50,7 @@ export struct HomePageBottomCommentComponent { @@ -50,6 +50,7 @@ export struct HomePageBottomCommentComponent {
50 CustomPullToRefresh({ 50 CustomPullToRefresh({
51 alldata:this.data_comment, 51 alldata:this.data_comment,
52 scroller:this.scroller, 52 scroller:this.scroller,
  53 + hasMore:this.hasMore,
53 customList:()=>{ 54 customList:()=>{
54 this.ListLayout() 55 this.ListLayout()
55 }, 56 },
@@ -184,7 +185,7 @@ export struct HomePageBottomCommentComponent { @@ -184,7 +185,7 @@ export struct HomePageBottomCommentComponent {
184 185
185 this.count = this.data_comment.totalCount() 186 this.count = this.data_comment.totalCount()
186 this.commentNum = value.totalCount 187 this.commentNum = value.totalCount
187 - if (this.data_comment.totalCount() < value.totalCount) { 188 + if (value.pageNum === 1) {
188 this.curPageNum++ 189 this.curPageNum++
189 } else { 190 } else {
190 this.hasMore = false 191 this.hasMore = false
@@ -217,7 +218,7 @@ export struct HomePageBottomCommentComponent { @@ -217,7 +218,7 @@ export struct HomePageBottomCommentComponent {
217 218
218 this.count = this.data_comment.totalCount() 219 this.count = this.data_comment.totalCount()
219 this.commentNum = value.totalCount 220 this.commentNum = value.totalCount
220 - if (this.data_comment.totalCount() < value.totalCount) { 221 + if (value.pageNum === 1) {
221 this.curPageNum++ 222 this.curPageNum++
222 } else { 223 } else {
223 this.hasMore = false 224 this.hasMore = false
@@ -50,6 +50,7 @@ export struct OtherHomePageBottomCommentComponent { @@ -50,6 +50,7 @@ export struct OtherHomePageBottomCommentComponent {
50 CustomPullToRefresh({ 50 CustomPullToRefresh({
51 alldata:this.data_comment, 51 alldata:this.data_comment,
52 scroller:this.scroller, 52 scroller:this.scroller,
  53 + hasMore:this.hasMore,
53 customList:()=>{ 54 customList:()=>{
54 this.ListLayout() 55 this.ListLayout()
55 }, 56 },
@@ -69,6 +70,7 @@ export struct OtherHomePageBottomCommentComponent { @@ -69,6 +70,7 @@ export struct OtherHomePageBottomCommentComponent {
69 this.isLoading = true 70 this.isLoading = true
70 //加载分页数据 71 //加载分页数据
71 this.getNewPageData() 72 this.getNewPageData()
  73 + if(resolve) resolve('刷新成功')
72 } 74 }
73 } 75 }
74 }) 76 })
@@ -96,6 +98,7 @@ export struct OtherHomePageBottomCommentComponent { @@ -96,6 +98,7 @@ export struct OtherHomePageBottomCommentComponent {
96 }).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { 98 }).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
97 if (isVisible) { 99 if (isVisible) {
98 let contentDTO = getParams(item) 100 let contentDTO = getParams(item)
  101 + //埋点crash 后面看看
99 TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO)) 102 TrackingContent.common(TrackConstants.EventType.Show, TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal, TrackParamConvert.program(contentDTO))
100 } 103 }
101 }) 104 })
@@ -126,7 +129,7 @@ export struct OtherHomePageBottomCommentComponent { @@ -126,7 +129,7 @@ export struct OtherHomePageBottomCommentComponent {
126 .borderRadius(12) 129 .borderRadius(12)
127 } 130 }
128 131
129 - getNewPageData() { 132 + getNewPageData() {
130 this.isLoading = true 133 this.isLoading = true
131 if (this.hasMore) { 134 if (this.hasMore) {
132 let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) 135 let time = encodeURI(DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
@@ -185,7 +188,7 @@ export struct OtherHomePageBottomCommentComponent { @@ -185,7 +188,7 @@ export struct OtherHomePageBottomCommentComponent {
185 188
186 this.count = this.data_comment.totalCount() 189 this.count = this.data_comment.totalCount()
187 this.commentNum = value.totalCount 190 this.commentNum = value.totalCount
188 - if (this.data_comment.totalCount() < value.totalCount) { 191 + if (value.hasNext === 1) {
189 this.curPageNum++ 192 this.curPageNum++
190 } else { 193 } else {
191 this.hasMore = false 194 this.hasMore = false
@@ -214,7 +217,7 @@ export struct OtherHomePageBottomCommentComponent { @@ -214,7 +217,7 @@ export struct OtherHomePageBottomCommentComponent {
214 217
215 this.count = this.data_comment.totalCount() 218 this.count = this.data_comment.totalCount()
216 this.commentNum = value.totalCount 219 this.commentNum = value.totalCount
217 - if (this.data_comment.totalCount() < value.totalCount) { 220 + if (value.hasNext === 1) {
218 this.curPageNum++ 221 this.curPageNum++
219 } else { 222 } else {
220 this.hasMore = false 223 this.hasMore = false
1 import { ContentDTO, LiveRoomDataBean } from 'wdBean'; 1 import { ContentDTO, LiveRoomDataBean } from 'wdBean';
2 import { ProcessUtils } from 'wdRouter'; 2 import { ProcessUtils } from 'wdRouter';
3 import PageViewModel from '../../viewmodel/PageViewModel'; 3 import PageViewModel from '../../viewmodel/PageViewModel';
4 -import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index'; 4 +import { DateTimeUtils, LazyDataSource, Logger, NetworkUtil } from 'wdKit/Index';
5 import { router } from '@kit.ArkUI'; 5 import { router } from '@kit.ArkUI';
6 import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; 6 import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
7 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; 7 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
8 import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; 8 import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
9 -import { EmptyComponent } from '../view/EmptyComponent'; 9 +import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent';
10 import { ErrorComponent } from '../view/ErrorComponent'; 10 import { ErrorComponent } from '../view/ErrorComponent';
11 import LoadMoreLayout from '../page/LoadMoreLayout'; 11 import LoadMoreLayout from '../page/LoadMoreLayout';
12 import { LottieView } from '../../components/lottie/LottieView'; 12 import { LottieView } from '../../components/lottie/LottieView';
13 import dataPreferences from '@ohos.data.preferences'; 13 import dataPreferences from '@ohos.data.preferences';
14 import { BusinessError } from '@ohos.base'; 14 import { BusinessError } from '@ohos.base';
15 import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; 15 import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
  16 +import { channelSkeleton } from '../skeleton/channelSkeleton';
16 17
17 const TAG: string = 'LiveMorePage'; 18 const TAG: string = 'LiveMorePage';
18 19
@@ -41,12 +42,13 @@ struct LiveMorePage { @@ -41,12 +42,13 @@ struct LiveMorePage {
41 @State private hasMore: boolean = true 42 @State private hasMore: boolean = true
42 @State private currentPage: number = 1 43 @State private currentPage: number = 1
43 @State private isLoading: boolean = false 44 @State private isLoading: boolean = false
44 - @State viewType: ViewType = ViewType.LOADING  
45 private scroller: Scroller = new Scroller() 45 private scroller: Scroller = new Scroller()
46 @State liveRoomList: LiveRoomDataBean[] = [] 46 @State liveRoomList: LiveRoomDataBean[] = []
47 // 点击过的数据 47 // 点击过的数据
48 @State clickDatas: Array<string> = [] 48 @State clickDatas: Array<string> = []
49 @State loadImg: boolean = false; 49 @State loadImg: boolean = false;
  50 + @State viewType: ViewType = ViewType.LOADING
  51 + emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
50 52
51 async aboutToAppear(): Promise<void> { 53 async aboutToAppear(): Promise<void> {
52 await this.getPreferencesFromStorage() 54 await this.getPreferencesFromStorage()
@@ -63,15 +65,14 @@ struct LiveMorePage { @@ -63,15 +65,14 @@ struct LiveMorePage {
63 this.TabbarNormal() 65 this.TabbarNormal()
64 if (this.viewType == ViewType.LOADING) { 66 if (this.viewType == ViewType.LOADING) {
65 this.LoadingLayout() 67 this.LoadingLayout()
66 - } else if (this.viewType == ViewType.ERROR) {  
67 - ErrorComponent()  
68 - .onTouch(() => {  
69 - if (this.viewType === ViewType.ERROR) {  
70 - this.getData()  
71 - }  
72 - })  
73 - } else if (this.viewType == ViewType.EMPTY) {  
74 - EmptyComponent() 68 + } else if (this.viewType == ViewType.EMPTY || this.viewType == ViewType.ERROR) {
  69 + EmptyComponent({
  70 + emptyType: this.emptyType,
  71 + emptyButton: true,
  72 + retry: () => {
  73 + this.getData()
  74 + }
  75 + })
75 } else { 76 } else {
76 CustomPullToRefresh({ 77 CustomPullToRefresh({
77 alldata: this.data, 78 alldata: this.data,
@@ -91,13 +92,15 @@ struct LiveMorePage { @@ -91,13 +92,15 @@ struct LiveMorePage {
91 .padding({ 92 .padding({
92 left: $r('app.float.card_comp_pagePadding_lf'), 93 left: $r('app.float.card_comp_pagePadding_lf'),
93 right: $r('app.float.card_comp_pagePadding_lf'), 94 right: $r('app.float.card_comp_pagePadding_lf'),
94 - top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight) 95 + top: px2vp(this.topSafeHeight),
  96 + bottom: px2vp(this.bottomSafeHeight)
95 }) 97 })
96 98
97 } 99 }
98 100
99 @Builder 101 @Builder
100 LoadingLayout() { 102 LoadingLayout() {
  103 + channelSkeleton()
101 } 104 }
102 105
103 @Builder 106 @Builder
@@ -208,6 +211,7 @@ struct LiveMorePage { @@ -208,6 +211,7 @@ struct LiveMorePage {
208 /*导航栏*/ 211 /*导航栏*/
209 @Builder 212 @Builder
210 TabbarNormal() { 213 TabbarNormal() {
  214 +
211 RelativeContainer() { 215 RelativeContainer() {
212 //标题栏目 216 //标题栏目
213 Image($r('app.media.icon_arrow_left')) 217 Image($r('app.media.icon_arrow_left'))
@@ -223,7 +227,7 @@ struct LiveMorePage { @@ -223,7 +227,7 @@ struct LiveMorePage {
223 router.back() 227 router.back()
224 }) 228 })
225 229
226 - Text(this.title)// .height('42lpx') 230 + Text(this.title)
227 .maxLines(1) 231 .maxLines(1)
228 .id("title") 232 .id("title")
229 .fontSize('18vp') 233 .fontSize('18vp')
@@ -298,6 +302,18 @@ struct LiveMorePage { @@ -298,6 +302,18 @@ struct LiveMorePage {
298 } 302 }
299 return 303 return
300 } 304 }
  305 +
  306 + // 检测网络
  307 + let netStatus = NetworkUtil.isNetConnected()
  308 + if (!netStatus) {
  309 +
  310 + this.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork
  311 + this.viewType = ViewType.ERROR
  312 +
  313 + return
  314 + }
  315 +
  316 +
301 this.isLoading = true 317 this.isLoading = true
302 try { 318 try {
303 const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize) 319 const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize)
@@ -319,17 +335,12 @@ struct LiveMorePage { @@ -319,17 +335,12 @@ struct LiveMorePage {
319 this.resolveEnd(true, resolve) 335 this.resolveEnd(true, resolve)
320 if (liveReviewDTO.list.length == 0 && this.currentPage == 1) { 336 if (liveReviewDTO.list.length == 0 && this.currentPage == 1) {
321 this.viewType = ViewType.EMPTY 337 this.viewType = ViewType.EMPTY
  338 + this.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent
322 } 339 }
323 } catch (exception) { 340 } catch (exception) {
324 this.resolveEnd(false, resolve) 341 this.resolveEnd(false, resolve)
325 } 342 }
326 - // PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {  
327 - // // this.operDataList = []  
328 - // // this.operDataList.push(...liveReviewDTO.list)  
329 - // this.data.push(...liveReviewDTO.list)  
330 - //  
331 - // // this.getAppointmentInfo()  
332 - // }) 343 +
333 } 344 }
334 345
335 private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) { 346 private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) {
@@ -341,7 +352,9 @@ struct LiveMorePage { @@ -341,7 +352,9 @@ struct LiveMorePage {
341 } 352 }
342 } 353 }
343 if (this.currentPage == 1 && !isTop) { 354 if (this.currentPage == 1 && !isTop) {
  355 +
344 this.viewType = ViewType.ERROR 356 this.viewType = ViewType.ERROR
  357 + this.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent
345 } else { 358 } else {
346 this.viewType = ViewType.LOADED 359 this.viewType = ViewType.LOADED
347 } 360 }
@@ -11,6 +11,7 @@ import { channelSkeleton } from '../skeleton/channelSkeleton'; @@ -11,6 +11,7 @@ import { channelSkeleton } from '../skeleton/channelSkeleton';
11 import { TrackConstants, TrackingButton } from 'wdTracking/Index'; 11 import { TrackConstants, TrackingButton } from 'wdTracking/Index';
12 import DailyPaperTopicModel from '../../model/DailyPaperTopicModel' 12 import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
13 import { ParamType, Tracking } from 'wdTracking/Index'; 13 import { ParamType, Tracking } from 'wdTracking/Index';
  14 +import { CompUtils } from '../../utils/CompUtils';
14 15
15 const TAG = 'TopNavigationComponent'; 16 const TAG = 'TopNavigationComponent';
16 17
@@ -23,27 +24,16 @@ const storage = LocalStorage.getShared(); @@ -23,27 +24,16 @@ const storage = LocalStorage.getShared();
23 @Component 24 @Component
24 export struct TopNavigationComponentNew { 25 export struct TopNavigationComponentNew {
25 private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px'; 26 private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px';
26 - /**  
27 - * @deprecated  
28 - */  
29 - private groupId: number = 0  
30 - /**  
31 - * @deprecated TODO type判断  
32 - */  
33 - private currentBottomNavName: string = ''  
34 private pageName: string = '' 27 private pageName: string = ''
35 private pageId: number = 0 28 private pageId: number = 0
36 private swiperController: SwiperController = new SwiperController() 29 private swiperController: SwiperController = new SwiperController()
37 private listScroller: Scroller = new Scroller() 30 private listScroller: Scroller = new Scroller()
38 - @Consume barBackgroundColor: Color  
39 - /**  
40 - * @deprecated  
41 - */  
42 - @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0  
43 /** 31 /**
44 - * @deprecated 32 + * 首页 底导 某个tab 对象
45 */ 33 */
46 - @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 34 + navItem: BottomNavDTO = {} as BottomNavDTO
  35 + @Consume barBackgroundColor: Color
  36 +
47 @Link _currentNavIndex?: number; 37 @Link _currentNavIndex?: number;
48 // 顶导当前选中/焦点下标 38 // 顶导当前选中/焦点下标
49 @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0; 39 @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0;
@@ -70,7 +60,6 @@ export struct TopNavigationComponentNew { @@ -70,7 +60,6 @@ export struct TopNavigationComponentNew {
70 @State animationDuration: number = 0 60 @State animationDuration: number = 0
71 @State indicatorLeftMargin: number = 0 61 @State indicatorLeftMargin: number = 0
72 @State indicatorWidth: number = 0 62 @State indicatorWidth: number = 0
73 - private tabsWidth: number = 0  
74 63
75 build() { 64 build() {
76 Column() { 65 Column() {
@@ -78,9 +67,10 @@ export struct TopNavigationComponentNew { @@ -78,9 +67,10 @@ export struct TopNavigationComponentNew {
78 RelativeContainer() { 67 RelativeContainer() {
79 this.tabBar() 68 this.tabBar()
80 Swiper(this.swiperController) { 69 Swiper(this.swiperController) {
81 - ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, 70 + ForEach(CompUtils.isNews(this.navItem) ? this.myChannelList : this.topNavList,
82 (navItem: TopNavDTO, index: number) => { 71 (navItem: TopNavDTO, index: number) => {
83 - if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { 72 + if (CompUtils.isRMH(this.navItem) && navItem.channelType === 3) {
  73 + // 人民号 -- 关注tab
84 PeopleShipMainComponent({ 74 PeopleShipMainComponent({
85 currentTopNavSelectedIndex: $currentTopNavSelectedIndex, 75 currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
86 navIndex: index, 76 navIndex: index,
@@ -203,8 +193,7 @@ export struct TopNavigationComponentNew { @@ -203,8 +193,7 @@ export struct TopNavigationComponentNew {
203 193
204 @Builder 194 @Builder
205 tabBar() { 195 tabBar() {
206 - // TODO 判断是否新闻tab,修改方法(,_currentNavIndex==0 都不对,需要用type)(用topStyle)  
207 - if (this.currentBottomNavName === '新闻') { 196 + if (CompUtils.isNews(this.navItem)) {
208 // 顶部搜索、日报logo、早晚报 197 // 顶部搜索、日报logo、早晚报
209 this.topBar() 198 this.topBar()
210 ChannelSubscriptionLayout({ 199 ChannelSubscriptionLayout({
@@ -233,13 +222,9 @@ export struct TopNavigationComponentNew { @@ -233,13 +222,9 @@ export struct TopNavigationComponentNew {
233 .listDirection(Axis.Horizontal) 222 .listDirection(Axis.Horizontal)
234 .scrollBar(BarState.Off) 223 .scrollBar(BarState.Off)
235 .edgeEffect(EdgeEffect.None) 224 .edgeEffect(EdgeEffect.None)
236 - .padding({ left: 8, top:0, right: 0 }) 225 + .padding({ left: 8, top: 0, right: 0 })
237 .height($r('app.float.top_tab_bar_height')) 226 .height($r('app.float.top_tab_bar_height'))
238 .backgroundColor(this.barBackgroundColor) 227 .backgroundColor(this.barBackgroundColor)
239 - .onAreaChange((oldValue: Area, newValue: Area) => {  
240 - let width = Number.parseFloat(newValue.width.toString())  
241 - this.tabsWidth = Number.isNaN(width) ? 0 : width  
242 - })  
243 .id('tabList') 228 .id('tabList')
244 .alignRules({ 229 .alignRules({
245 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, 230 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom },
@@ -278,10 +263,6 @@ export struct TopNavigationComponentNew { @@ -278,10 +263,6 @@ export struct TopNavigationComponentNew {
278 .listDirection(Axis.Horizontal) 263 .listDirection(Axis.Horizontal)
279 .scrollBar(BarState.Off) 264 .scrollBar(BarState.Off)
280 .edgeEffect(EdgeEffect.None) 265 .edgeEffect(EdgeEffect.None)
281 - .onAreaChange((oldValue: Area, newValue: Area) => {  
282 - let width = Number.parseFloat(newValue.width.toString())  
283 - this.tabsWidth = Number.isNaN(width) ? 0 : width  
284 - })  
285 .height($r('app.float.top_tab_bar_height_common')) 266 .height($r('app.float.top_tab_bar_height_common'))
286 .backgroundColor(this.barBackgroundColor) 267 .backgroundColor(this.barBackgroundColor)
287 .id('tabList') 268 .id('tabList')
@@ -347,14 +328,18 @@ export struct TopNavigationComponentNew { @@ -347,14 +328,18 @@ export struct TopNavigationComponentNew {
347 } else if (this.isLayoutByIndex(index)) { 328 } else if (this.isLayoutByIndex(index)) {
348 ProcessUtils.gotoENewsPaper() 329 ProcessUtils.gotoENewsPaper()
349 } else { 330 } else {
350 - this.currentTopNavSelectedIndex = index  
351 this.changePage(index) 331 this.changePage(index)
352 } 332 }
353 } 333 }
354 }) 334 })
355 } 335 }
356 336
  337 + /**
  338 + * 改变频道页
  339 + * @param index 频道所在的序列号
  340 + */
357 private changePage(index: number) { 341 private changePage(index: number) {
  342 + this.currentTopNavSelectedIndex = index
358 this.swiperController.changeIndex(index) 343 this.swiperController.changeIndex(index)
359 this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER) 344 this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER)
360 } 345 }
@@ -494,10 +479,9 @@ export struct TopNavigationComponentNew { @@ -494,10 +479,9 @@ export struct TopNavigationComponentNew {
494 } 479 }
495 480
496 updateCurrentTopNavSelectedIndex() { 481 updateCurrentTopNavSelectedIndex() {
497 - Logger.info(TAG, `currentTopNavSelectedIndex : ${this.currentTopNavSelectedIndex}、${this.currentBottomNavName}`);  
498 482
499 // 顶部tab埋点 483 // 顶部tab埋点
500 - if (this.currentBottomNavName === '新闻') { 484 + if (CompUtils.isVideo(this.navItem)) {
501 const tab = this.myChannelList[this.currentTopNavSelectedIndex] 485 const tab = this.myChannelList[this.currentTopNavSelectedIndex]
502 Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`); 486 Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`);
503 487
@@ -507,7 +491,7 @@ export struct TopNavigationComponentNew { @@ -507,7 +491,7 @@ export struct TopNavigationComponentNew {
507 "pageId": tab.pageId, 491 "pageId": tab.pageId,
508 } 492 }
509 Tracking.event("home_page_tab_click ", params) 493 Tracking.event("home_page_tab_click ", params)
510 - } else if (this.currentBottomNavName === '人民号') { 494 + } else if (CompUtils.isRMH(this.navItem)) {
511 const tab = this.topNavList[this.currentTopNavSelectedIndex] 495 const tab = this.topNavList[this.currentTopNavSelectedIndex]
512 Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`); 496 Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`);
513 497
1 import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent'; 1 import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent';
2 import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; 2 import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
3 -import { HttpUtils } from 'wdNetwork/Index'; 3 +import { HttpUtils } from 'wdNetwork/Index';
4 import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit'; 4 import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit';
5 import { 5 import {
6 RmhRecommendDTO, 6 RmhRecommendDTO,
@@ -21,25 +21,27 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; @@ -21,25 +21,27 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem';
21 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; 21 import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
22 import PageModel from '../../viewmodel/PageModel'; 22 import PageModel from '../../viewmodel/PageModel';
23 import PageAdModel from '../../viewmodel/PageAdvModel'; 23 import PageAdModel from '../../viewmodel/PageAdvModel';
24 -import PageHelper from '../../viewmodel/PageHelper';  
25 import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' 24 import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent'
26 import { CardParser } from '../CardParser' 25 import { CardParser } from '../CardParser'
27 import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; 26 import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
  27 +import PageFollowHelper from '../../viewmodel/PageFollowHelper';
  28 +
28 const TAG = 'PeopleShipMainComponent'; 29 const TAG = 'PeopleShipMainComponent';
29 -@Preview 30 +
  31 +/**
  32 + * 人民号 --- 关注
  33 + */
30 @Component 34 @Component
31 export struct PeopleShipMainComponent { 35 export struct PeopleShipMainComponent {
32 @State private pageModel: PageModel = new PageModel(); 36 @State private pageModel: PageModel = new PageModel();
33 - @State private pageAdvModel: PageAdModel = new PageAdModel();  
34 // 自动刷新通知 37 // 自动刷新通知
35 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 38 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0
36 navIndex: number = 0; 39 navIndex: number = 0;
37 pageId: string = ""; 40 pageId: string = "";
38 channelId: string = ""; 41 channelId: string = "";
39 @Link @Watch('onChange') currentTopNavSelectedIndex: number 42 @Link @Watch('onChange') currentTopNavSelectedIndex: number
40 - private scroller: Scroller = new Scroller() 43 + // private scroller: Scroller = new Scroller()
41 private listScroller: Scroller = new Scroller() 44 private listScroller: Scroller = new Scroller()
42 -  
43 @State rmhList: RmhRecommendDTO[] = [] 45 @State rmhList: RmhRecommendDTO[] = []
44 @Provide rmhSelectedList: string[] = [] 46 @Provide rmhSelectedList: string[] = []
45 @State viewType: ViewType = ViewType.LOADING 47 @State viewType: ViewType = ViewType.LOADING
@@ -54,7 +56,6 @@ export struct PeopleShipMainComponent { @@ -54,7 +56,6 @@ export struct PeopleShipMainComponent {
54 @State private currentPage: number = 1 56 @State private currentPage: number = 1
55 @State private isLoading: boolean = false 57 @State private isLoading: boolean = false
56 @State private loadTime: string = '' 58 @State private loadTime: string = ''
57 -  
58 // 页面展示监听 59 // 页面展示监听
59 @Consume @Watch('onPageShowChange') pageShow: number 60 @Consume @Watch('onPageShowChange') pageShow: number
60 @State private pageAttentionChange: boolean = false 61 @State private pageAttentionChange: boolean = false
@@ -84,7 +85,7 @@ export struct PeopleShipMainComponent { @@ -84,7 +85,7 @@ export struct PeopleShipMainComponent {
84 if (this.followList.length == 0) { 85 if (this.followList.length == 0) {
85 CustomPullToRefresh({ 86 CustomPullToRefresh({
86 alldata: this.rmhList, 87 alldata: this.rmhList,
87 - scroller: this.scroller, 88 + scroller: this.listScroller,
88 hasMore: false, 89 hasMore: false,
89 customList: () => { 90 customList: () => {
90 this.ListLayout() 91 this.ListLayout()
@@ -94,7 +95,7 @@ export struct PeopleShipMainComponent { @@ -94,7 +95,7 @@ export struct PeopleShipMainComponent {
94 this.getData(resolve) 95 this.getData(resolve)
95 }, 96 },
96 }) 97 })
97 - }else { 98 + } else {
98 CustomPullToRefresh({ 99 CustomPullToRefresh({
99 alldata: this.attentionList, 100 alldata: this.attentionList,
100 scroller: this.listScroller, 101 scroller: this.listScroller,
@@ -106,19 +107,19 @@ export struct PeopleShipMainComponent { @@ -106,19 +107,19 @@ export struct PeopleShipMainComponent {
106 this.currentPage = 1 107 this.currentPage = 1
107 this.getData(resolve) 108 this.getData(resolve)
108 }, 109 },
109 - onLoadMore:(resolve)=> { 110 + onLoadMore: (resolve) => {
110 if (this.hasMore === false) { 111 if (this.hasMore === false) {
111 - if(resolve) { 112 + if (resolve) {
112 resolve('') 113 resolve('')
113 } 114 }
114 return 115 return
115 } 116 }
116 - if(!this.isLoading && this.hasMore){ 117 + if (!this.isLoading && this.hasMore) {
117 //加载分页数据 118 //加载分页数据
118 this.currentPage++; 119 this.currentPage++;
119 this.getAttentionContentListData(resolve) 120 this.getAttentionContentListData(resolve)
120 - }else {  
121 - if(resolve) { 121 + } else {
  122 + if (resolve) {
122 resolve('') 123 resolve('')
123 } 124 }
124 } 125 }
@@ -135,13 +136,16 @@ export struct PeopleShipMainComponent { @@ -135,13 +136,16 @@ export struct PeopleShipMainComponent {
135 136
136 @Builder 137 @Builder
137 ListLayout() { 138 ListLayout() {
138 - Scroll(this.scroller) {  
139 - // 推荐人民号  
140 - PeopleShipRecommendComponent({  
141 - rmhList: this.rmhList,  
142 - oneKeyFollow: this.oneKeyFollow,  
143 - changeButton: this.changeButton  
144 - }) 139 +
  140 + List({ scroller: this.listScroller }) {
  141 + // 头部关注列表
  142 + ListItem() {
  143 + PeopleShipRecommendComponent({
  144 + rmhList: this.rmhList,
  145 + oneKeyFollow: this.oneKeyFollow,
  146 + changeButton: this.changeButton
  147 + })
  148 + }
145 } 149 }
146 .edgeEffect(EdgeEffect.None) 150 .edgeEffect(EdgeEffect.None)
147 .scrollBar(BarState.Off) 151 .scrollBar(BarState.Off)
@@ -151,20 +155,25 @@ export struct PeopleShipMainComponent { @@ -151,20 +155,25 @@ export struct PeopleShipMainComponent {
151 155
152 @Builder 156 @Builder
153 ListAttentionLayout() { 157 ListAttentionLayout() {
154 - List({scroller: this.listScroller}){ 158 + List({ scroller: this.listScroller }) {
155 // 头部关注列表 159 // 头部关注列表
156 - ListItem(){ 160 + ListItem() {
157 PeopleShipAttentionContentListTopComponent({ 161 PeopleShipAttentionContentListTopComponent({
158 followList: this.followList 162 followList: this.followList
159 }) 163 })
160 } 164 }
  165 +
161 ForEach(this.attentionList, (item: ContentDTO) => { 166 ForEach(this.attentionList, (item: ContentDTO) => {
162 ListItem() { 167 ListItem() {
163 - CardParser({compDTO:new CompDTO, contentDTO: item }) 168 + Column(){
  169 + CardParser({ compDTO: new CompDTO, contentDTO: item })
  170 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
  171 + }.width('100%')
  172 +
164 }.width("100%") 173 }.width("100%")
165 .backgroundColor(Color.Transparent) 174 .backgroundColor(Color.Transparent)
166 175
167 - }, (item: ContentDTO, index: number) => item.objectId + index.toString()) 176 + }, (item: ContentDTO, index: number) => item.objectId + index.toString())
168 177
169 // 加载更多 178 // 加载更多
170 ListItem() { 179 ListItem() {
@@ -191,7 +200,8 @@ export struct PeopleShipMainComponent { @@ -191,7 +200,8 @@ export struct PeopleShipMainComponent {
191 } 200 }
192 201
193 onChange() { 202 onChange() {
194 - if (this.navIndex === this.currentTopNavSelectedIndex && (this.viewType == ViewType.LOADING || this.pageAttentionChange)) { 203 + if (this.navIndex === this.currentTopNavSelectedIndex &&
  204 + (this.viewType == ViewType.LOADING || this.pageAttentionChange)) {
195 this.getData(); 205 this.getData();
196 } 206 }
197 } 207 }
@@ -219,7 +229,6 @@ export struct PeopleShipMainComponent { @@ -219,7 +229,6 @@ export struct PeopleShipMainComponent {
219 this.getRmhRecommendInfo(resolve) 229 this.getRmhRecommendInfo(resolve)
220 } else { 230 } else {
221 this.followList = [] 231 this.followList = []
222 - // this.followList = followInfo.list  
223 this.followList.push(...followInfo.list) 232 this.followList.push(...followInfo.list)
224 this.attentionList = [] 233 this.attentionList = []
225 this.currentPage = 1 234 this.currentPage = 1
@@ -287,7 +296,7 @@ export struct PeopleShipMainComponent { @@ -287,7 +296,7 @@ export struct PeopleShipMainComponent {
287 } 296 }
288 //批量查询各类型内容动态数据接口 297 //批量查询各类型内容动态数据接口
289 this.checkContentInteractData(listData.list, resolve) 298 this.checkContentInteractData(listData.list, resolve)
290 - } else { 299 + } else {
291 this.hasMore = false; 300 this.hasMore = false;
292 this.resolveEnd(true, resolve) 301 this.resolveEnd(true, resolve)
293 } 302 }
@@ -317,7 +326,7 @@ export struct PeopleShipMainComponent { @@ -317,7 +326,7 @@ export struct PeopleShipMainComponent {
317 this.resolveEnd(true, resolve) 326 this.resolveEnd(true, resolve)
318 list.forEach((element: ContentDTO) => { 327 list.forEach((element: ContentDTO) => {
319 // 获取 interactData 数据 328 // 获取 interactData 数据
320 - if (listData && listData.length > 0) { 329 + if (listData && listData.length > 0) {
321 const objc = listData.find((interactModel: InteractDataDTO) => { 330 const objc = listData.find((interactModel: InteractDataDTO) => {
322 return element.objectId == interactModel.contentId 331 return element.objectId == interactModel.contentId
323 }) 332 })
@@ -341,7 +350,7 @@ export struct PeopleShipMainComponent { @@ -341,7 +350,7 @@ export struct PeopleShipMainComponent {
341 if (resolve) { 350 if (resolve) {
342 if (this.currentPage == 1 && isTop) { 351 if (this.currentPage == 1 && isTop) {
343 resolve('已更新至最新') 352 resolve('已更新至最新')
344 - }else { 353 + } else {
345 resolve('') 354 resolve('')
346 } 355 }
347 } 356 }
@@ -355,12 +364,13 @@ export struct PeopleShipMainComponent { @@ -355,12 +364,13 @@ export struct PeopleShipMainComponent {
355 364
356 // 说是首页必须要调用 365 // 说是首页必须要调用
357 async getInitData() { 366 async getInitData() {
358 - Logger.debug('PeopleShipMainComponent', `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`); 367 + Logger.debug('PeopleShipMainComponent',
  368 + `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
359 this.pageModel.pageId = this.pageId; 369 this.pageModel.pageId = this.pageId;
360 this.pageModel.groupId = this.pageId; 370 this.pageModel.groupId = this.pageId;
361 this.pageModel.channelId = this.channelId; 371 this.pageModel.channelId = this.channelId;
362 this.pageModel.currentPage = 1; 372 this.pageModel.currentPage = 1;
363 - PageHelper.getInitData(this.pageModel, this.pageAdvModel) 373 + PageFollowHelper.getInitData(this.pageModel)
364 } 374 }
365 375
366 // 点击一键关注 376 // 点击一键关注
@@ -386,7 +396,7 @@ export struct PeopleShipMainComponent { @@ -386,7 +396,7 @@ export struct PeopleShipMainComponent {
386 // 获取列表数据 396 // 获取列表数据
387 let objects = new AttentionBatchDTO() 397 let objects = new AttentionBatchDTO()
388 this.rmhList.forEach((element: RmhRecommendDTO) => { 398 this.rmhList.forEach((element: RmhRecommendDTO) => {
389 - if ( this.rmhSelectedList.indexOf(element.creatorId) != -1) { 399 + if (this.rmhSelectedList.indexOf(element.creatorId) != -1) {
390 const creator = new CreatorDTO(element.userType, element.userId, element.creatorId) 400 const creator = new CreatorDTO(element.userType, element.userId, element.creatorId)
391 objects.creators.push(creator) 401 objects.creators.push(creator)
392 } 402 }
@@ -411,7 +421,7 @@ export struct PeopleShipMainComponent { @@ -411,7 +421,7 @@ export struct PeopleShipMainComponent {
411 421
412 // 页面展示监听 422 // 页面展示监听
413 onPageShowChange() { 423 onPageShowChange() {
414 - if (this.navIndex === this.currentTopNavSelectedIndex && this.pageAttentionChange ) { 424 + if (this.navIndex === this.currentTopNavSelectedIndex && this.pageAttentionChange) {
415 this.getData() 425 this.getData()
416 } 426 }
417 } 427 }
@@ -422,6 +432,7 @@ export struct PeopleShipMainComponent { @@ -422,6 +432,7 @@ export struct PeopleShipMainComponent {
422 } 432 }
423 // 当前页面,自动刷新数据 433 // 当前页面,自动刷新数据
424 Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh) 434 Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
  435 + this.listScroller.scrollToIndex(0)
425 this.currentPage = 1 436 this.currentPage = 1
426 this.getData() 437 this.getData()
427 } 438 }
@@ -56,7 +56,6 @@ export struct PeopleShipRecommendComponent { @@ -56,7 +56,6 @@ export struct PeopleShipRecommendComponent {
56 .width('100%') 56 .width('100%')
57 .alignSelf(ItemAlign.Start) 57 .alignSelf(ItemAlign.Start)
58 .margin({ 58 .margin({
59 - top: '-50vp',  
60 bottom: '10vp' 59 bottom: '10vp'
61 }) 60 })
62 61
@@ -294,11 +294,12 @@ export struct SearchResultContentComponent { @@ -294,11 +294,12 @@ export struct SearchResultContentComponent {
294 CardParser({compDTO:new CompDTO, contentDTO: item }) 294 CardParser({compDTO:new CompDTO, contentDTO: item })
295 } 295 }
296 if (index != this.data.totalCount() - 1) { 296 if (index != this.data.totalCount() - 1) {
297 - Divider()  
298 - .width('100%')  
299 - .height('1lpx')  
300 - .color($r('app.color.color_F5F5F5'))  
301 - .strokeWidth('1lpx') 297 + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
  298 + // Divider()
  299 + // .width('100%')
  300 + // .height('1lpx')
  301 + // .color($r('app.color.color_F5F5F5'))
  302 + // .strokeWidth('1lpx')
302 } 303 }
303 } 304 }
304 } 305 }
1 -import { EmptyComponent } from '../view/EmptyComponent'  
2 -  
3 -@Entry  
4 -@Component  
5 -export struct DefaultPage {  
6 - @State type: number = 15  
7 -  
8 - retry() {  
9 - console.log('daj点击了重试')  
10 - }  
11 -  
12 - build() {  
13 - Row() {  
14 - EmptyComponent({  
15 - emptyType: this.type,  
16 - retry: () => {  
17 - this.retry()  
18 - }  
19 - })  
20 - // .height('612lpx')  
21 - // .width('100%')  
22 - }  
23 - }  
24 -}  
@@ -96,17 +96,11 @@ export struct EmptyComponent { @@ -96,17 +96,11 @@ export struct EmptyComponent {
96 } 96 }
97 } 97 }
98 98
99 - onPageShow(): void {  
100 - this.createTimer()  
101 - }  
102 99
103 aboutToAppear(): void { 100 aboutToAppear(): void {
104 this.createTimer() 101 this.createTimer()
105 } 102 }
106 103
107 - onPageHide(): void {  
108 - this.destroyTimer()  
109 - }  
110 104
111 aboutToDisappear() { 105 aboutToDisappear() {
112 this.destroyTimer() 106 this.destroyTimer()
1 @Component 1 @Component
2 export struct PermissionDesComponent { 2 export struct PermissionDesComponent {
3 @State translateY: number = 0 3 @State translateY: number = 0
  4 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
4 5
5 aboutToAppear(): void { 6 aboutToAppear(): void {
6 this.startDismiss() 7 this.startDismiss()
@@ -29,7 +30,7 @@ export struct PermissionDesComponent { @@ -29,7 +30,7 @@ export struct PermissionDesComponent {
29 // .height(60) 30 // .height(60)
30 .backgroundColor('#FFFFFF') 31 .backgroundColor('#FFFFFF')
31 .border({ radius: 5 }) 32 .border({ radius: 5 })
32 - .margin({ top: 12 }) 33 + .margin({ top: px2vp(this.topSafeHeight) })
33 .padding(12) 34 .padding(12)
34 .zIndex(20) 35 .zIndex(20)
35 } 36 }
@@ -74,9 +74,9 @@ export struct MultiPictureListPage { @@ -74,9 +74,9 @@ export struct MultiPictureListPage {
74 center: { anchor: "__container__", align: VerticalAlign.Center }, 74 center: { anchor: "__container__", align: VerticalAlign.Center },
75 middle: { anchor: "__container__", align: HorizontalAlign.Center } 75 middle: { anchor: "__container__", align: HorizontalAlign.Center }
76 }) 76 })
77 - .onChange((index: number) => {  
78 - this.swiperIndex = index  
79 - this.currentUrl = this.photoList[index]?.picPath 77 + .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => {
  78 + this.swiperIndex = targetIndex
  79 + this.currentUrl = this.photoList[targetIndex]?.picPath
80 }) 80 })
81 81
82 Row() { 82 Row() {
@@ -63,213 +63,214 @@ struct OtherNormalUserHomePage { @@ -63,213 +63,214 @@ struct OtherNormalUserHomePage {
63 63
64 64
65 build() { 65 build() {
66 - if(this.isConnectNetwork){  
67 - Stack({ alignContent: Alignment.Top }){ 66 + Column(){
  67 + if(this.isConnectNetwork){
68 Stack({ alignContent: Alignment.Top }){ 68 Stack({ alignContent: Alignment.Top }){
69 - Image($r('app.media.title_bg'))  
70 - .width('100%')  
71 - .height(`calc(${295 + this.topSafeHeight + 'lpx'})`)  
72 - .objectFit(ImageFit.Cover)  
73 -  
74 - Row()  
75 - .height(px2vp(this.topSafeHeight))  
76 - .width("100%")  
77 - .backgroundColor($r('app.color.white'))  
78 - .visibility(this.tileOpacity > 0 ? 0 : 1)  
79 - .opacity(this.tileOpacity )  
80 - }  
81 -  
82 - Column(){  
83 Stack({ alignContent: Alignment.Top }){ 69 Stack({ alignContent: Alignment.Top }){
84 - this.MineHomeTitleTransparent()  
85 - this.MineHomeTitleWhite()  
86 - }.margin({top:px2vp(this.topSafeHeight)})  
87 -  
88 - Scroll() {  
89 - Column() {  
90 - //用户信息区域  
91 - Row() {  
92 - Stack(){  
93 - Image(this.headPhotoUrl)  
94 - .alt($r('app.media.default_head'))  
95 - .width('115lpx')  
96 - .height('115lpx')  
97 - .objectFit(ImageFit.Cover)  
98 - .clip(new Circle({ width: '115lpx', height: '115lpx' }))  
99 - Image(this.levelHead)  
100 - .width('165lpx')  
101 - .height('165lpx')  
102 - .objectFit(ImageFit.Cover)  
103 - } 70 + Image($r('app.media.title_bg'))
  71 + .width('100%')
  72 + .height(`calc(${295 + this.topSafeHeight + 'lpx'})`)
  73 + .objectFit(ImageFit.Cover)
  74 +
  75 + Row()
  76 + .height(px2vp(this.topSafeHeight))
  77 + .width("100%")
  78 + .backgroundColor($r('app.color.white'))
  79 + .visibility(this.tileOpacity > 0 ? 0 : 1)
  80 + .opacity(this.tileOpacity )
  81 + }
104 82
105 - Column() {  
106 - Row() {  
107 - Text(`${this.userName}`)  
108 - .fontColor($r('app.color.white'))  
109 - .maxLines(1)  
110 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
111 - .fontSize('38lpx')  
112 - .lineHeight('50lpx')  
113 - .fontWeight('500lpx')  
114 -  
115 - if(this.levelId>0){  
116 - Text(`等级${this.levelId}`)  
117 - .fontColor($r('app.color.color_ED2800'))  
118 - .fontSize('23lpx')  
119 - .fontWeight(500)  
120 - .margin({ left: '10lpx' })  
121 - .backgroundImage($r("app.media.my_grade_bg"))  
122 - .backgroundImageSize(ImageSize.Cover)  
123 - .padding({left:"17lpx",right:"8lpx"})  
124 - .height('35lpx')  
125 - }  
126 - Blank()  
127 - }.width('507lpx') 83 + Column(){
  84 + Stack({ alignContent: Alignment.Top }){
  85 + this.MineHomeTitleTransparent()
  86 + this.MineHomeTitleWhite()
  87 + }.margin({top:px2vp(this.topSafeHeight)})
  88 +
  89 + Scroll() {
  90 + Column() {
  91 + //用户信息区域
  92 + Row() {
  93 + Stack(){
  94 + Image(this.headPhotoUrl)
  95 + .alt($r('app.media.default_head'))
  96 + .width('115lpx')
  97 + .height('115lpx')
  98 + .objectFit(ImageFit.Cover)
  99 + .clip(new Circle({ width: '115lpx', height: '115lpx' }))
  100 + Image(this.levelHead)
  101 + .width('165lpx')
  102 + .height('165lpx')
  103 + .objectFit(ImageFit.Cover)
  104 + }
128 105
129 - Row() {  
130 - Row() {  
131 - Text(`${this.browseNum}`)  
132 - .textStyle()  
133 - Text("阅读")  
134 - .textStyle2()  
135 - }  
136 - .margin({ right: '15lpx' })  
137 -  
138 - Divider()  
139 - .height('19lpx')  
140 - .width('2lpx')  
141 - .color($r('app.color.white'))  
142 - .vertical(true)  
143 - .opacity(0.4) 106 + Column() {
144 Row() { 107 Row() {
145 - Text(`${this.commentNum}`)  
146 - .textStyle()  
147 - Text("评论")  
148 - .textStyle2()  
149 - }.margin({ right: '15lpx', left: '15lpx' })  
150 -  
151 - Divider()  
152 - .height('19lpx')  
153 - .width('2lpx')  
154 - .color($r('app.color.white'))  
155 - .vertical(true)  
156 - .opacity(0.4) 108 + Text(`${this.userName}`)
  109 + .fontColor($r('app.color.white'))
  110 + .maxLines(1)
  111 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  112 + .fontSize('38lpx')
  113 + .lineHeight('50lpx')
  114 + .fontWeight('500lpx')
  115 +
  116 + if(this.levelId>0){
  117 + Text(`等级${this.levelId}`)
  118 + .fontColor($r('app.color.color_ED2800'))
  119 + .fontSize('23lpx')
  120 + .fontWeight(500)
  121 + .margin({ left: '10lpx' })
  122 + .backgroundImage($r("app.media.my_grade_bg"))
  123 + .backgroundImageSize(ImageSize.Cover)
  124 + .padding({left:"17lpx",right:"8lpx"})
  125 + .height('35lpx')
  126 + }
  127 + Blank()
  128 + }.width('507lpx')
  129 +
157 Row() { 130 Row() {
158 - Text(`${this.attentionNum}`)  
159 - .textStyle()  
160 - Text("关注")  
161 - .textStyle2()  
162 - }.margin({ left: '15lpx' })  
163 - }.margin({ top: '23lpx' })  
164 - }.alignItems(HorizontalAlign.Start)  
165 - .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" })  
166 - }  
167 - .onAreaChange((oldValue: Area, newValue: Area) => {  
168 - if (this.firstPositionY === 0) {  
169 - this.firstPositionY = newValue.globalPosition.y as number  
170 - }else{  
171 - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3)  
172 - if(persent > 1){  
173 - persent = 1  
174 - }  
175 - this.tileOpacity = persent 131 + Row() {
  132 + Text(`${this.browseNum}`)
  133 + .textStyle()
  134 + Text("阅读")
  135 + .textStyle2()
  136 + }
  137 + .margin({ right: '15lpx' })
  138 +
  139 + Divider()
  140 + .height('19lpx')
  141 + .width('2lpx')
  142 + .color($r('app.color.white'))
  143 + .vertical(true)
  144 + .opacity(0.4)
  145 + Row() {
  146 + Text(`${this.commentNum}`)
  147 + .textStyle()
  148 + Text("评论")
  149 + .textStyle2()
  150 + }.margin({ right: '15lpx', left: '15lpx' })
  151 +
  152 + Divider()
  153 + .height('19lpx')
  154 + .width('2lpx')
  155 + .color($r('app.color.white'))
  156 + .vertical(true)
  157 + .opacity(0.4)
  158 + Row() {
  159 + Text(`${this.attentionNum}`)
  160 + .textStyle()
  161 + Text("关注")
  162 + .textStyle2()
  163 + }.margin({ left: '15lpx' })
  164 + }.margin({ top: '23lpx' })
  165 + }.alignItems(HorizontalAlign.Start)
  166 + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" })
176 } 167 }
177 - })  
178 - // .backgroundColor($r('app.color.color_transparent'))  
179 - .height('184lpx')  
180 - .width('100%')  
181 - .padding({ left: '6lpx' })  
182 -  
183 - //用户简介区域  
184 - if(StringUtils.isNotEmpty(this.desc)){  
185 - Column() {  
186 - Row() {  
187 - Text('简介:'+this.desc)  
188 - .fontSize('27lpx')  
189 - .maxLines(3)  
190 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
191 - .lineHeight('40lpx')  
192 - .fontWeight('400lpx')  
193 - .fontColor($r('app.color.color_222222'))  
194 - .textAlign(TextAlign.Start)  
195 -  
196 - }  
197 - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})  
198 - .alignItems(HorizontalAlign.Start)  
199 - .justifyContent(FlexAlign.Center)  
200 - .width('100%')  
201 - .backgroundColor($r('app.color.white'))  
202 - }  
203 - //间隔符  
204 - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')  
205 -  
206 - //tab 页面  
207 - Stack({ alignContent: Alignment.Top }){  
208 - Tabs({controller: this.controller}) {  
209 - TabContent() {  
210 - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})  
211 - }  
212 - TabContent() {  
213 - OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) 168 + .onAreaChange((oldValue: Area, newValue: Area) => {
  169 + if (this.firstPositionY === 0) {
  170 + this.firstPositionY = newValue.globalPosition.y as number
  171 + }else{
  172 + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3)
  173 + if(persent > 1){
  174 + persent = 1
  175 + }
  176 + this.tileOpacity = persent
214 } 177 }
215 - }  
216 - .backgroundColor($r('app.color.white'))  
217 - .animationDuration(0)  
218 - .onChange((index: number) => {  
219 - this.currentIndex = index  
220 - trackTabFirstClick(index === 0 ? "评论":"关注")  
221 }) 178 })
222 - .vertical(false)  
223 - .barHeight('77lpx') 179 + // .backgroundColor($r('app.color.color_transparent'))
  180 + .height('184lpx')
  181 + .width('100%')
  182 + .padding({ left: '6lpx' })
224 183
225 - Column() {  
226 - // 页签  
227 - Row({ space: 7 }) {  
228 - Scroll() {  
229 - Row() {  
230 - this.TabBuilder(0,"评论")  
231 - this.TabBuilder(1,"关注") 184 + //用户简介区域
  185 + if(StringUtils.isNotEmpty(this.desc)){
  186 + Column() {
  187 + Row() {
  188 + Text('简介:'+this.desc)
  189 + .fontSize('27lpx')
  190 + .maxLines(3)
  191 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  192 + .lineHeight('40lpx')
  193 + .fontWeight('400lpx')
  194 + .fontColor($r('app.color.color_222222'))
  195 + .textAlign(TextAlign.Start)
  196 +
  197 + }
  198 + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})
  199 + .alignItems(HorizontalAlign.Start)
  200 + .justifyContent(FlexAlign.Center)
  201 + .width('100%')
  202 + .backgroundColor($r('app.color.white'))
  203 + }
  204 + //间隔符
  205 + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
  206 +
  207 + //tab 页面
  208 + Stack({ alignContent: Alignment.Top }){
  209 + Tabs({controller: this.controller}) {
  210 + TabContent() {
  211 + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
  212 + }
  213 + TabContent() {
  214 + OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
  215 + }
  216 + }
  217 + .backgroundColor($r('app.color.white'))
  218 + .animationDuration(0)
  219 + .onChange((index: number) => {
  220 + this.currentIndex = index
  221 + trackTabFirstClick(index === 0 ? "评论":"关注")
  222 + })
  223 + .vertical(false)
  224 + .barHeight('77lpx')
  225 +
  226 + Column() {
  227 + // 页签
  228 + Row({ space: 7 }) {
  229 + Scroll() {
  230 + Row() {
  231 + this.TabBuilder(0,"评论")
  232 + this.TabBuilder(1,"关注")
  233 + }
  234 + .justifyContent(FlexAlign.Start)
232 } 235 }
233 - .justifyContent(FlexAlign.Start) 236 + .align(Alignment.Start)
  237 + .scrollable(ScrollDirection.Horizontal)
  238 + .scrollBar(BarState.Off)
  239 + .width('90%')
  240 + .padding({left:'31lpx'})
234 } 241 }
235 - .align(Alignment.Start)  
236 - .scrollable(ScrollDirection.Horizontal)  
237 - .scrollBar(BarState.Off)  
238 - .width('90%')  
239 - .padding({left:'31lpx'}) 242 + .alignItems(VerticalAlign.Bottom)
  243 + .width('100%')
240 } 244 }
241 - .alignItems(VerticalAlign.Bottom) 245 + .backgroundColor($r('app.color.white'))
  246 + .alignItems(HorizontalAlign.Start)
242 .width('100%') 247 .width('100%')
  248 + .height('77lpx')
243 } 249 }
244 - .backgroundColor($r('app.color.white'))  
245 - .alignItems(HorizontalAlign.Start)  
246 - .width('100%')  
247 - .height('77lpx')  
248 - }  
249 - }.width("100%") 250 + }.width("100%")
  251 + }
  252 + .edgeEffect(EdgeEffect.None)
  253 + .scrollBar(BarState.Off)
  254 + .width('100%')
  255 + .layoutWeight(1)
250 } 256 }
251 - .edgeEffect(EdgeEffect.None)  
252 - .scrollBar(BarState.Off)  
253 - .width('100%')  
254 - .layoutWeight(1) 257 + }.width('100%')
  258 + .layoutWeight(1)
  259 + }else{
  260 + Column(){
  261 + CustomTitleUI({ titleName: "" })
  262 +
  263 + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
  264 + this.isConnectNetwork = NetworkUtil.isNetConnected()
  265 + if(this.isChangeToUserEdit){
  266 + this.getUserInfo()
  267 + }
  268 + },})
  269 + .layoutWeight(1)
  270 + .width('100%')
255 } 271 }
256 - }.width('100%')  
257 - .layoutWeight(1)  
258 - }else{  
259 - Column(){  
260 - CustomTitleUI({ titleName: "" })  
261 -  
262 - EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {  
263 - this.isConnectNetwork = NetworkUtil.isNetConnected()  
264 - if(this.isChangeToUserEdit){  
265 - this.getUserInfo()  
266 - }  
267 - },})  
268 - .layoutWeight(1)  
269 - .width('100%')  
270 } 272 }
271 - }  
272 - 273 + }.padding({bottom:px2vp(this.bottomSafeHeight)})
273 } 274 }
274 @Builder MineHomeTitleTransparent() { 275 @Builder MineHomeTitleTransparent() {
275 RelativeContainer() { 276 RelativeContainer() {
@@ -32,6 +32,45 @@ export class CompUtils { @@ -32,6 +32,45 @@ export class CompUtils {
32 } 32 }
33 33
34 /** 34 /**
  35 + * 是视频tab
  36 + * @param navItem
  37 + * @returns
  38 + */
  39 + static isVideo(navItem: BottomNavDTO) : boolean{
  40 + if (navItem == null) {
  41 + return false;
  42 +
  43 + }
  44 + return navItem.topStyle === '13';
  45 + }
  46 +
  47 + /**
  48 + * 是新闻tab
  49 + * @param navItem
  50 + * @returns
  51 + */
  52 + static isNews(navItem: BottomNavDTO) : boolean{
  53 + if (navItem == null) {
  54 + return false;
  55 +
  56 + }
  57 + return navItem.topStyle === '11';
  58 + }
  59 +
  60 + /**
  61 + * 是人民号tab
  62 + * @param navItem
  63 + * @returns
  64 + */
  65 + static isRMH(navItem: BottomNavDTO) : boolean{
  66 + if (navItem == null) {
  67 + return false;
  68 +
  69 + }
  70 + return navItem.topStyle === '12';
  71 + }
  72 +
  73 + /**
35 * 获取Label标题 74 * 获取Label标题
36 * 75 *
37 * @param component 组件bean 76 * @param component 组件bean
  1 +import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean';
  2 +import { CompStyle, ViewType } from 'wdConstant/Index';
  3 +import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils, ToastUtils } from 'wdKit';
  4 +import { closeRefresh } from '../utils/PullDownRefresh';
  5 +import PageModel from './PageModel';
  6 +import PageViewModel from './PageViewModel';
  7 +import { promptAction } from '@kit.ArkUI';
  8 +import { CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
  9 +import PageAdModel from './PageAdvModel';
  10 +import { ArrayList } from '@kit.ArkTS';
  11 +import { WDViewDefaultType } from '../components/view/EmptyComponent';
  12 +import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
  13 +import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
  14 +import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare'
  15 +import { common } from '@kit.AbilityKit';
  16 +import { CacheData } from 'wdNetwork/Index';
  17 +import { closeLoadMore } from '../utils/PullUpLoadMore';
  18 +
  19 +const TAG = 'PageHelper';
  20 +
  21 +
  22 +/**
  23 + * 处理返回后的数据
  24 + */
  25 +export class PageFollowHelper {
  26 + private refreshUIEnd(pageModel: PageModel, isRefreshSuccess: boolean) {
  27 + if (pageModel.loadStrategy != 2) {
  28 + return
  29 + }
  30 + closeRefresh(pageModel, isRefreshSuccess)
  31 + }
  32 +
  33 +
  34 +
  35 + /**
  36 + * 进页面请求数据
  37 + */
  38 + async getInitData(pageModel: PageModel) {
  39 + pageModel.loadStrategy = 1
  40 + let netStatus = NetworkUtil.isNetConnected()
  41 + if (netStatus) {
  42 + this.getPageInfo(pageModel)
  43 + } else if (pageModel.compList.size() > 0) {
  44 + // 加载缓存数据了,不用无网络提示
  45 + } else {
  46 + pageModel.viewType = ViewType.EMPTY;
  47 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
  48 + }
  49 + }
  50 +
  51 + getPageInfo(pageModel: PageModel) {
  52 + pageModel.currentPage = 1;
  53 + Logger.debug(TAG, 'getPageInfo')
  54 + PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
  55 + Logger.debug(TAG, 'getPageInfo back: ' + JSON.stringify(pageInfo))
  56 + if (pageInfo == null) {
  57 + pageModel.viewType = ViewType.EMPTY;
  58 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
  59 + return;
  60 + }
  61 + pageModel.pageInfo = pageInfo;
  62 +
  63 + Logger.debug(TAG, 'getPageInfo go on')
  64 + }).catch(() => {
  65 + this.refreshUIEnd(pageModel, false)
  66 + if (this.isPageLoaded(pageModel)) {
  67 + return
  68 + }
  69 + pageModel.viewType = ViewType.EMPTY;
  70 + pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed;
  71 + })
  72 + }
  73 +
  74 + private isPageLoaded(pageModel: PageModel) {
  75 + if (pageModel.compList.size() > 0) {
  76 + return true
  77 + }
  78 + return false
  79 + }
  80 +}
  81 +
  82 +
  83 +
  84 +
  85 +let pageHelper = new PageFollowHelper();
  86 +
  87 +export default pageHelper as PageFollowHelper;
@@ -127,7 +127,7 @@ export interface postExecuteLikeParams { @@ -127,7 +127,7 @@ export interface postExecuteLikeParams {
127 title?: string; 127 title?: string;
128 contentRelId?: string; 128 contentRelId?: string;
129 userHeaderUrl?: string; 129 userHeaderUrl?: string;
130 - channelId?: string; 130 + channelId?: string | number;
131 } 131 }
132 132
133 export interface postExecuteCollectRecordParamsItem { 133 export interface postExecuteCollectRecordParamsItem {
@@ -43,6 +43,7 @@ export struct DetailPlayShortVideoPage { @@ -43,6 +43,7 @@ export struct DetailPlayShortVideoPage {
43 @Consume @Watch("showCommentListChanged") showCommentList: boolean 43 @Consume @Watch("showCommentListChanged") showCommentList: boolean
44 @Consume displayDirection: DisplayDirection 44 @Consume displayDirection: DisplayDirection
45 @Consume @Watch('videoStatusChange') switchVideoStatus: boolean 45 @Consume @Watch('videoStatusChange') switchVideoStatus: boolean
  46 + @State isPlay: boolean = true // 视频手动播放暂停
46 @Consume @Watch('pageShowChange') pageShow: number 47 @Consume @Watch('pageShowChange') pageShow: number
47 @Consume windowWidth: number 48 @Consume windowWidth: number
48 @Consume windowHeight: number 49 @Consume windowHeight: number
@@ -61,7 +62,7 @@ export struct DetailPlayShortVideoPage { @@ -61,7 +62,7 @@ export struct DetailPlayShortVideoPage {
61 async pageShowChange() { 62 async pageShowChange() {
62 if (this.currentIndex === this.index) { 63 if (this.currentIndex === this.index) {
63 this.queryNewsInfoOfUser() 64 this.queryNewsInfoOfUser()
64 - if (this.switchVideoStatus) { 65 + if (this.switchVideoStatus && this.isPlay) {
65 await this.playerController.play() 66 await this.playerController.play()
66 this.imageVisible = false 67 this.imageVisible = false
67 } 68 }
@@ -74,7 +75,7 @@ export struct DetailPlayShortVideoPage { @@ -74,7 +75,7 @@ export struct DetailPlayShortVideoPage {
74 */ 75 */
75 async videoStatusChange() { 76 async videoStatusChange() {
76 if (this.currentIndex === this.index) { 77 if (this.currentIndex === this.index) {
77 - if (this.switchVideoStatus) { 78 + if (this.switchVideoStatus && this.isPlay) {
78 await this.playerController.play() 79 await this.playerController.play()
79 this.imageVisible = false 80 this.imageVisible = false
80 } else { 81 } else {
@@ -183,14 +184,6 @@ export struct DetailPlayShortVideoPage { @@ -183,14 +184,6 @@ export struct DetailPlayShortVideoPage {
183 } 184 }
184 if (this.contentDetailData.newsType == 1) { 185 if (this.contentDetailData.newsType == 1) {
185 this.PageName = TrackConstants.PageName.VideoDetail // 点播 186 this.PageName = TrackConstants.PageName.VideoDetail // 点播
186 - } else if (this.contentDetailData.newsType == 2) {  
187 - this.PageName = TrackConstants.PageName.Live_Detail // 直播  
188 - } else if (this.contentDetailData.newsType == 5) {  
189 - this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页  
190 - } else if (this.contentDetailData.newsType == 8) {  
191 - this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页  
192 - } else if (this.contentDetailData.newsType == 9) {  
193 - this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页  
194 } else if (this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) { 187 } else if (this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
195 this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频 188 this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
196 } 189 }
@@ -268,6 +261,13 @@ export struct DetailPlayShortVideoPage { @@ -268,6 +261,13 @@ export struct DetailPlayShortVideoPage {
268 .layoutWeight(1) 261 .layoutWeight(1)
269 .onClick(() => { 262 .onClick(() => {
270 this.playerController?.switchPlayOrPause(); 263 this.playerController?.switchPlayOrPause();
  264 + this.playerController.onStatusChange = (status: number) => {
  265 + if (status === PlayerConstants.STATUS_PAUSE) {
  266 + this.isPlay = false
  267 + } else if(status === PlayerConstants.STATUS_START) {
  268 + this.isPlay = true
  269 + }
  270 + }
271 }) 271 })
272 272
273 // 显示评论且非全屏模式(视频频道无评论showComment=false) 273 // 显示评论且非全屏模式(视频频道无评论showComment=false)
@@ -140,8 +140,6 @@ export struct VideoChannelDetail { @@ -140,8 +140,6 @@ export struct VideoChannelDetail {
140 // navigationBarColor: '#000000', 140 // navigationBarColor: '#000000',
141 // navigationBarContentColor: '#ffffff' 141 // navigationBarContentColor: '#ffffff'
142 }) 142 })
143 - // WindowModel.shared.setWindowLayoutFullScreen(true)  
144 - // WindowModel.shared.setWindowSystemBarEnable([])  
145 } 143 }
146 144
147 /** 145 /**
@@ -156,8 +154,6 @@ export struct VideoChannelDetail { @@ -156,8 +154,6 @@ export struct VideoChannelDetail {
156 // navigationBarContentColor: '#0xE5FFFFFF' 154 // navigationBarContentColor: '#0xE5FFFFFF'
157 155
158 }) 156 })
159 - // WindowModel.shared.setWindowLayoutFullScreen(false)  
160 - // WindowModel.shared.setWindowSystemBarEnable(['status', 'navigation'])  
161 } 157 }
162 158
163 onBackPress(): boolean | void { 159 onBackPress(): boolean | void {
@@ -75,13 +75,13 @@ export struct PlayerRightView { @@ -75,13 +75,13 @@ export struct PlayerRightView {
75 return 75 return
76 } 76 }
77 const params: postExecuteLikeParams = { 77 const params: postExecuteLikeParams = {
78 - status: this.newsStatusOfUser?.likeStatus === '1' ? 0 : 1, 78 + status: this.newsStatusOfUser?.likeStatus == '1' ? 0 : 1,
79 contentId: this.contentDetailData?.newsId + '', 79 contentId: this.contentDetailData?.newsId + '',
80 contentType: this.contentDetailData?.newsType + '', 80 contentType: this.contentDetailData?.newsType + '',
81 userName: this.contentDetailData?.userInfo?.userName || '' + '', 81 userName: this.contentDetailData?.userInfo?.userName || '' + '',
82 contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '', 82 contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
83 title: this.contentDetailData?.newsTitle || '' + '', 83 title: this.contentDetailData?.newsTitle || '' + '',
84 - channelId: this.contentDetailData?.reLInfo?.channelId + '', 84 + channelId: this.contentDetailData?.reLInfo?.channelId || '' + '',
85 relType: this.contentDetailData?.reLInfo?.relType || '' + '', 85 relType: this.contentDetailData?.reLInfo?.relType || '' + '',
86 userHeaderUrl: this.contentDetailData?.userInfo?.headPhotoUrl || '' + '', 86 userHeaderUrl: this.contentDetailData?.userInfo?.headPhotoUrl || '' + '',
87 } 87 }
@@ -115,7 +115,7 @@ struct LoginPage { @@ -115,7 +115,7 @@ struct LoginPage {
115 Image($r("app.media.login_logo")) 115 Image($r("app.media.login_logo"))
116 .width(120) 116 .width(120)
117 .height(66) 117 .height(66)
118 - .margin({ top: 78 }) 118 + .margin({ top: 78 + px2vp(this.topSafeHeight) })
119 .align(Alignment.Center) 119 .align(Alignment.Center)
120 120
121 LoginInputComponent({ 121 LoginInputComponent({
@@ -225,7 +225,7 @@ struct LoginPage { @@ -225,7 +225,7 @@ struct LoginPage {
225 Image($r('app.media.login_closed')) 225 Image($r('app.media.login_closed'))
226 .width(24) 226 .width(24)
227 .height(24) 227 .height(24)
228 - .margin({ top: 10, right: 15 }) 228 + .margin({ top:px2vp(this.topSafeHeight), right: 15 })
229 .alignRules({ 229 .alignRules({
230 top: { anchor: "__container__", align: VerticalAlign.Top }, 230 top: { anchor: "__container__", align: VerticalAlign.Top },
231 right: { anchor: "__container__", align: HorizontalAlign.End } 231 right: { anchor: "__container__", align: HorizontalAlign.End }
@@ -249,7 +249,7 @@ struct LoginPage { @@ -249,7 +249,7 @@ struct LoginPage {
249 .backgroundColor(Color.White) 249 .backgroundColor(Color.White)
250 }.width("100%") 250 }.width("100%")
251 .height("100%") 251 .height("100%")
252 - .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)}) 252 + // .padding({top:px2vp(this.topSafeHeight),bottom:px2vp(this.bottomSafeHeight)})
253 253
254 } 254 }
255 255
@@ -7,6 +7,8 @@ import { Logger, ToastUtils, CustomToast, EmitterUtils, EmitterEventId } from 'w @@ -7,6 +7,8 @@ import { Logger, ToastUtils, CustomToast, EmitterUtils, EmitterEventId } from 'w
7 import { LoginViewModel } from './LoginViewModel' 7 import { LoginViewModel } from './LoginViewModel'
8 import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel' 8 import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
9 import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index' 9 import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'
  10 +import { loginComponentManager, LoginWithHuaweiIDButton } from '@kit.AccountKit'
  11 +import { JSON } from '@kit.ArkTS'
10 12
11 const TAG = "OneKeyLoginPage" 13 const TAG = "OneKeyLoginPage"
12 14
@@ -29,6 +31,30 @@ struct OneKeyLoginPage { @@ -29,6 +31,30 @@ struct OneKeyLoginPage {
29 customStyle: true, 31 customStyle: true,
30 maskColor:"#00000000" 32 maskColor:"#00000000"
31 }) 33 })
  34 + // 构造LoginWithHuaweiIDButton组件的控制器。
  35 + controller: loginComponentManager.LoginWithHuaweiIDButtonController =
  36 + new loginComponentManager.LoginWithHuaweiIDButtonController()
  37 + /**
  38 + * 当应用使用自定义的登录页时,如果用户未同意协议,需要设置协议状态为NOT_ACCEPTED,当用户同意协议后再设置
  39 + * 协议状态为ACCEPTED,才可以使用华为帐号一键登录功能。
  40 + */
  41 + .setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED)
  42 + .onClickLoginWithHuaweiIDButton((error: BusinessError, response: loginComponentManager.HuaweiIDCredential) => {
  43 + if (error) {
  44 + Logger.debug("HuaweiOneKeyAuth", "onClickLoginWithHuaweiIDButton error: " + JSON.stringify(error))
  45 + this.toastText = "请阅读并勾选用户协议、隐私政策和华为账号用户认证协议"
  46 + this.dialogToast.open()
  47 + return;
  48 + }
  49 + if (response) {
  50 + // 获取到Authorization Code
  51 + let authorizationCode = response.authorizationCode;
  52 + // hilog.info(0x0000, 'testTag', 'response: %{public}s', JSON.stringify(response));
  53 + TrackingButton.click("oneClickLoginPageLoginButton", this.pageName, this.pageName)
  54 + this.requestLogin()
  55 + return;
  56 + }
  57 + });
32 58
33 // 埋点计算页面浏览时长 59 // 埋点计算页面浏览时长
34 private pageStartDate: number = 0 60 private pageStartDate: number = 0
@@ -85,30 +111,7 @@ struct OneKeyLoginPage { @@ -85,30 +111,7 @@ struct OneKeyLoginPage {
85 111
86 this.ProtocolRow() 112 this.ProtocolRow()
87 113
88 - Row() {  
89 - Button() {  
90 - Row() {  
91 - Image($r("app.media.huawei_one_key_login_icon"))  
92 - .width(24).height(24)  
93 - Text("华为账号一键登录")  
94 - .fontColor(Color.White)  
95 - }  
96 - }  
97 - .type(ButtonType.Normal)  
98 - .height(48)  
99 - .backgroundColor(!this.agreeProtocol ? "#60ED2800" : "#ED2800")  
100 - .width("100%")  
101 - .onClick((event) => {  
102 - if (!this.agreeProtocol) {  
103 - return  
104 - }  
105 -  
106 - TrackingButton.click("oneClickLoginPageLoginButton", this.pageName, this.pageName)  
107 - this.requestLogin()  
108 - })  
109 - }  
110 - .padding({ left: 25, right: 25 })  
111 - .margin({top: 20}) 114 + this.loginButton()
112 115
113 Button("账号密码登录") 116 Button("账号密码登录")
114 .type(ButtonType.Normal) 117 .type(ButtonType.Normal)
@@ -125,6 +128,58 @@ struct OneKeyLoginPage { @@ -125,6 +128,58 @@ struct OneKeyLoginPage {
125 .padding({top: `${this.topSafeHeight}px`}) 128 .padding({top: `${this.topSafeHeight}px`})
126 } 129 }
127 130
  131 + @Builder loginButton() {
  132 + Column() {
  133 + LoginWithHuaweiIDButton({
  134 + params: {
  135 + // LoginWithHuaweiIDButton支持的样式。
  136 + style: loginComponentManager.Style.BUTTON_CUSTOM,
  137 + // LoginWithHuaweiIDButton的边框圆角半径。
  138 + borderRadius: 4,
  139 + // LoginWithHuaweiIDButton支持的登录类型。
  140 + loginType: loginComponentManager.LoginType.QUICK_LOGIN,
  141 + // LoginWithHuaweiIDButton支持按钮的样式跟随系统深浅色模式切换。
  142 + supportDarkMode: true,
  143 + customButtonParams: {
  144 + fontColor: loginComponentManager.FontColor.WHITE,
  145 + // backgroundColor:!this.agreeProtocol ? "#60ED2800" : "#ED2800"
  146 + backgroundColor:"#ED2800"
  147 + }
  148 + },
  149 + controller: this.controller
  150 + })
  151 + }
  152 + .height(48)
  153 + .margin({ top: 20 ,left: 25, right: 25 })
  154 + }
  155 +
  156 + // @Builder loginButton() {
  157 + // Row() {
  158 + // Button() {
  159 + // Row() {
  160 + // Image($r("app.media.huawei_one_key_login_icon"))
  161 + // .width(24).height(24)
  162 + // Text("华为账号一键登录")
  163 + // .fontColor(Color.White)
  164 + // }
  165 + // }
  166 + // .type(ButtonType.Normal)
  167 + // .height(48)
  168 + // .backgroundColor(!this.agreeProtocol ? "#60ED2800" : "#ED2800")
  169 + // .width("100%")
  170 + // .onClick((event) => {
  171 + // if (!this.agreeProtocol) {
  172 + // return
  173 + // }
  174 + //
  175 + // TrackingButton.click("oneClickLoginPageLoginButton", this.pageName, this.pageName)
  176 + // this.requestLogin()
  177 + // })
  178 + // }
  179 + // .padding({ left: 25, right: 25 })
  180 + // .margin({top: 20})
  181 + // }
  182 +
128 @Builder ProtocolRow() { 183 @Builder ProtocolRow() {
129 Row({space: 4}) { 184 Row({space: 4}) {
130 Image(this.agreeProtocol ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected')) 185 Image(this.agreeProtocol ? $r('app.media.login_checkbox_select') : $r('app.media.login_checkbox_unselected'))
@@ -133,6 +188,11 @@ struct OneKeyLoginPage { @@ -133,6 +188,11 @@ struct OneKeyLoginPage {
133 .margin({top: 3}) 188 .margin({top: 3})
134 .onClick(() => { 189 .onClick(() => {
135 this.agreeProtocol = !this.agreeProtocol 190 this.agreeProtocol = !this.agreeProtocol
  191 + if (this.agreeProtocol) {
  192 + this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.ACCEPTED)
  193 + } else {
  194 + this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.NOT_ACCEPTED)
  195 + }
136 }) 196 })
137 Text() { 197 Text() {
138 Span("我已阅读并同意").fontColor("#999999").fontSize(12).lineHeight(18) 198 Span("我已阅读并同意").fontColor("#999999").fontSize(12).lineHeight(18)
@@ -173,7 +233,7 @@ struct OneKeyLoginPage { @@ -173,7 +233,7 @@ struct OneKeyLoginPage {
173 233
174 async requestLogin() { 234 async requestLogin() {
175 try { 235 try {
176 - let authorizeCode = await HuaweiAuth.sharedInstance().oneKeyLogin() 236 + let authorizeCode = await HuaweiAuth.sharedInstance().requestProfile()
177 237
178 let data = await this.viewModel.huaweiOneKeyLogin(authorizeCode) 238 let data = await this.viewModel.huaweiOneKeyLogin(authorizeCode)
179 239
@@ -84,7 +84,7 @@ export default class HuaweiAuth { @@ -84,7 +84,7 @@ export default class HuaweiAuth {
84 84
85 // 华为账号一键登录授权 85 // 华为账号一键登录授权
86 // 返回结果为 Authorization Code 86 // 返回结果为 Authorization Code
87 - oneKeyLogin() : Promise<string> { 87 + requestProfile() : Promise<string> {
88 88
89 // let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest(); 89 // let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
90 // // 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面 90 // // 当用户未登录华为帐号时,是否强制拉起华为帐号登录界面
@@ -94,7 +94,7 @@ export default class HuaweiAuth { @@ -94,7 +94,7 @@ export default class HuaweiAuth {
94 // 创建授权请求,并设置参数 94 // 创建授权请求,并设置参数
95 let loginRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest(); 95 let loginRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
96 // 获取头像昵称需要传如下scope 96 // 获取头像昵称需要传如下scope
97 - loginRequest.scopes = ['profile', 'phone']; 97 + loginRequest.scopes = ['profile']; //, 'phone'
98 // 若开发者需要进行服务端开发,则需传如下permission获取authorizationCode 98 // 若开发者需要进行服务端开发,则需传如下permission获取authorizationCode
99 loginRequest.permissions = ['serviceauthcode']; 99 loginRequest.permissions = ['serviceauthcode'];
100 // 用户是否需要登录授权,该值为true且用户未登录或未授权时,会拉起用户登录或授权页面 100 // 用户是否需要登录授权,该值为true且用户未登录或未授权时,会拉起用户登录或授权页面
@@ -4,7 +4,7 @@ import { ContentType } from 'wdRouter/Index'; @@ -4,7 +4,7 @@ import { ContentType } from 'wdRouter/Index';
4 4
5 export class DeepLinkUtil { 5 export class DeepLinkUtil {
6 6
7 - private static DEEP_LINK_PREFIX = "rmrbapp:rmrb.app/openwith" 7 + private static DEEP_LINK_PREFIX = "rmrbapp://rmrb.app/openwith"
8 8
9 static generateDeepLinkWithConent(content: ContentDetailDTO): string { 9 static generateDeepLinkWithConent(content: ContentDetailDTO): string {
10 10
@@ -23,7 +23,7 @@ export class DeepLinkUtil { @@ -23,7 +23,7 @@ export class DeepLinkUtil {
23 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 {
24 let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX 24 let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX
25 25
26 - let pubParam = `&contentId=${contentId}}&relId=${relId}&skipType=1` 26 + let pubParam = `&contentId=${contentId}&relId=${relId}&skipType=1`
27 27
28 let type: ContentType = Number(contentType) 28 let type: ContentType = Number(contentType)
29 switch (type) { 29 switch (type) {
@@ -38,7 +38,7 @@ export class DeepLinkUtil { @@ -38,7 +38,7 @@ export class DeepLinkUtil {
38 deeplink += "?type=article&subType=h5" 38 deeplink += "?type=article&subType=h5"
39 deeplink += "&url=" + encodeURIComponent(link) 39 deeplink += "&url=" + encodeURIComponent(link)
40 } else { 40 } else {
41 - deeplink += "type=article&subType=h5_template_article" 41 + deeplink += "?type=article&subType=h5_template_article"
42 } 42 }
43 break 43 break
44 case ContentType.DynamicImageText: 44 case ContentType.DynamicImageText:
@@ -2,7 +2,7 @@ import { Logger } from 'wdKit/Index'; @@ -2,7 +2,7 @@ import { Logger } from 'wdKit/Index';
2 import { TrackingModule } from '../TrackingModule'; 2 import { TrackingModule } from '../TrackingModule';
3 import sensors from '@sensorsdata/analytics'; 3 import sensors from '@sensorsdata/analytics';
4 import { ParamType, PublicParams } from '../common/PublicParams'; 4 import { ParamType, PublicParams } from '../common/PublicParams';
5 -import { HashMap } from '@kit.ArkTS'; 5 +import { taskpool } from '@kit.ArkTS';
6 import { TrackConstants } from '../common/TrackConstants'; 6 import { TrackConstants } from '../common/TrackConstants';
7 7
8 const TAG = "WDTracking" 8 const TAG = "WDTracking"
@@ -18,17 +18,37 @@ export class Tracking { @@ -18,17 +18,37 @@ export class Tracking {
18 } 18 }
19 19
20 //TODO: 添加运行单独线程? 20 //TODO: 添加运行单独线程?
  21 + taskpool.execute(doTrack, eventId, params).then(() => {
  22 + Logger.error('yyyy','event track success')
  23 + }).catch(()=>{
  24 + Logger.error('yyyy','event track failed')
  25 + })
  26 +
  27 + // let publicParams = new PublicParams()
  28 + // publicParams.getPublicParams().then((pubParams) => {
  29 + //
  30 + // if (params) {
  31 + // for (const obj of Object.entries(params)) {
  32 + // // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
  33 + // pubParams[obj[0]] = obj[1]
  34 + // }
  35 + // }
  36 + // sensors.track(eventId, pubParams)
  37 + // })
  38 + }
  39 +}
21 40
22 - let publicParams = new PublicParams()  
23 - publicParams.getPublicParams().then((pubParams) => { 41 +@Concurrent
  42 +function doTrack(eventId: string, params?: ParamType): void {
  43 + let publicParams = new PublicParams()
  44 + publicParams.getPublicParams().then((pubParams) => {
24 45
25 - if (params) {  
26 - for (const obj of Object.entries(params)) {  
27 - // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);  
28 - pubParams[obj[0]] = obj[1]  
29 - } 46 + if (params) {
  47 + for (const obj of Object.entries(params)) {
  48 + // Logger.info(TAG, ` ${obj[0]} => ` + `${obj[1]}`);
  49 + pubParams[obj[0]] = obj[1]
30 } 50 }
31 - sensors.track(eventId, pubParams)  
32 - })  
33 - } 51 + }
  52 + sensors.track(eventId, pubParams)
  53 + })
34 } 54 }
1 import { formBindingData, FormExtensionAbility, formInfo, formProvider } from '@kit.FormKit'; 1 import { formBindingData, FormExtensionAbility, formInfo, formProvider } from '@kit.FormKit';
2 import { Want } from '@kit.AbilityKit'; 2 import { Want } from '@kit.AbilityKit';
3 -import { Logger, NetworkManager, SPHelper, StringUtils } from 'wdKit/Index'; 3 +import { FileUtils, Logger, NetworkManager, SPHelper, StringUtils } from 'wdKit/Index';
4 import { BusinessError } from '@kit.BasicServicesKit'; 4 import { BusinessError } from '@kit.BasicServicesKit';
5 -import { FormDataType, NewspaperDataFetcher } from './NewspaperDataFetcher'; 5 +import { NewspaperDataFetcher } from './NewspaperDataFetcher';
6 import { JSON } from '@kit.ArkTS'; 6 import { JSON } from '@kit.ArkTS';
7 -import { FormNewspaperPaperType } from '../dailynewspaperwidget/common/NewspaperWidgetData'; 7 +import { FormNewspaperData, FormNewspaperPaperType } from '../dailynewspaperwidget/common/NewspaperWidgetData';
8 import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index'; 8 import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index';
  9 +import fs from '@ohos.file.fs';
9 10
10 const TAG = "DailyNewspaperFormAbility" 11 const TAG = "DailyNewspaperFormAbility"
11 12
12 export default class DailyNewspaperFormAbility extends FormExtensionAbility { 13 export default class DailyNewspaperFormAbility extends FormExtensionAbility {
  14 + lastDatas: Record<string, FormNewspaperData> = {}
  15 +
13 onAddForm(want: Want) { 16 onAddForm(want: Want) {
14 Logger.debug(TAG, "onAddForm with " + JSON.stringify(want)) 17 Logger.debug(TAG, "onAddForm with " + JSON.stringify(want))
15 18
16 this.initApp() 19 this.initApp()
17 - 20 +
18 if (want.parameters) { 21 if (want.parameters) {
19 let formId = want.parameters[formInfo.FormParam.IDENTITY_KEY] as string 22 let formId = want.parameters[formInfo.FormParam.IDENTITY_KEY] as string
20 let isTempCard = want.parameters[formInfo.FormParam.TEMPORARY_KEY] as boolean 23 let isTempCard = want.parameters[formInfo.FormParam.TEMPORARY_KEY] as boolean
21 if (isTempCard === false) { // 如果为常态卡片,直接进行信息持久化 24 if (isTempCard === false) { // 如果为常态卡片,直接进行信息持久化
22 25
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 - }) 26 + this.fetchAndRefreshData(formId)
31 } 27 }
32 } 28 }
33 29
34 - let obj: FormDataType = {} 30 + let obj: FormNewspaperData = {} as FormNewspaperData
35 obj.paperType = FormNewspaperPaperType.unknown 31 obj.paperType = FormNewspaperPaperType.unknown
36 let formData = formBindingData.createFormBindingData(obj); 32 let formData = formBindingData.createFormBindingData(obj);
37 return formData; 33 return formData;
@@ -45,13 +41,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility { @@ -45,13 +41,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
45 onUpdateForm(formId: string) { 41 onUpdateForm(formId: string) {
46 // 若卡片支持定时更新/定点更新/卡片使用方主动请求更新功能,则提供方需要重写该方法以支持数据更新 42 // 若卡片支持定时更新/定点更新/卡片使用方主动请求更新功能,则提供方需要重写该方法以支持数据更新
47 Logger.debug(TAG, 'onUpdateForm ' + formId); 43 Logger.debug(TAG, 'onUpdateForm ' + formId);
48 - NewspaperDataFetcher.refreshDailyPaper().then((data) => {  
49 44
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 - }) 45 + this.initApp()
  46 + this.fetchAndRefreshData(formId)
55 } 47 }
56 48
57 onFormEvent(formId: string, message: string) { 49 onFormEvent(formId: string, message: string) {
@@ -61,7 +53,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility { @@ -61,7 +53,9 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
61 53
62 onRemoveForm(formId: string) { 54 onRemoveForm(formId: string) {
63 // 当对应的卡片删除时触发的回调,入参是被删除的卡片ID 55 // 当对应的卡片删除时触发的回调,入参是被删除的卡片ID
64 - Logger.debug(TAG, 'onRemoveForm'); 56 + Logger.debug(TAG, 'onRemoveForm / formId: ' + formId);
  57 + let data = this.lastDatas[formId]
  58 + NewspaperDataFetcher.closeFilesWith(data)
65 } 59 }
66 60
67 // onConfigurationUpdate(config: Configuration) { 61 // onConfigurationUpdate(config: Configuration) {
@@ -75,6 +69,32 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility { @@ -75,6 +69,32 @@ export default class DailyNewspaperFormAbility extends FormExtensionAbility {
75 return formInfo.FormState.READY; 69 return formInfo.FormState.READY;
76 } 70 }
77 71
  72 + fetchAndRefreshData(formId: string) {
  73 + Logger.debug(TAG, "开始刷新数据");
  74 + NewspaperDataFetcher.refreshDailyPaper().then(async (data) => {
  75 +
  76 + let formData = formBindingData.createFormBindingData(data);
  77 + formProvider.updateForm(formId, formData).then(() => {
  78 + this.lastDatas[formId] = data
  79 + }).catch((err: BusinessError) => {
  80 + Logger.debug(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
  81 + });
  82 +
  83 + let fileDir = this.context.getApplicationContext().filesDir + "/widget-daily-newspaper"
  84 + await FileUtils.makeDirIfNotExsit(fileDir)
  85 +
  86 + NewspaperDataFetcher.dealWithPictures(data, formId, fileDir, (data) => {
  87 + Logger.debug(TAG, `refresh ui with new pictuers`);
  88 + let formData = formBindingData.createFormBindingData(data);
  89 + formProvider.updateForm(formId, formData).then(() => {
  90 + this.lastDatas[formId] = data
  91 + }).catch((err: BusinessError) => {
  92 + Logger.error(TAG, ` xFailed to updateForm. Code: ${err.code}, message: ${err.message}`);
  93 + });
  94 + })
  95 + })
  96 + }
  97 +
78 initApp() { 98 initApp() {
79 // KV存储 99 // KV存储
80 SPHelper.init(this.context); 100 SPHelper.init(this.context);
1 import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index'; 1 import { CompInfoBean, ContentDTO, PageInfoBean } from 'wdBean/Index';
2 import { MorningEveningViewModel } from 'wdComponent/Index'; 2 import { MorningEveningViewModel } from 'wdComponent/Index';
3 -import { Logger } from 'wdKit/Index'; 3 +import { CrptoUtils, FileUtils, Logger } from 'wdKit/Index';
4 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index'; 4 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork/Index';
5 import { DeepLinkUtil } from 'wdShare/Index' 5 import { DeepLinkUtil } from 'wdShare/Index'
6 -import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent } from "../dailynewspaperwidget/common/NewspaperWidgetData" 6 +import { FormNewspaperPaperType, FormNewspaperPaperInfo, FormNewspaperPaperContent,
  7 + FormNewspaperData } from "../dailynewspaperwidget/common/NewspaperWidgetData"
  8 +import { http } from '@kit.NetworkKit';
  9 +import fs from '@ohos.file.fs';
  10 +import { BusinessError } from '@kit.BasicServicesKit';
  11 +import { JSON } from '@kit.ArkTS';
7 12
8 const TAG = "NewspaperDataFetcher" 13 const TAG = "NewspaperDataFetcher"
9 14
10 -export type FormDataType = Record<string, FormNewspaperPaperType | FormNewspaperPaperInfo | FormNewspaperPaperContent[]> 15 +// export type FormDataType = Record<string, FormNewspaperPaperType | FormNewspaperPaperInfo | FormNewspaperPaperContent[]>
11 16
12 export class NewspaperDataFetcher { 17 export class NewspaperDataFetcher {
13 18
14 - public static async refreshDailyPaper(): Promise<FormDataType> {  
15 - return new Promise<FormDataType>(async (reslove, fail) => { 19 + public static async refreshDailyPaper(): Promise<FormNewspaperData> {
  20 + return new Promise<FormNewspaperData>(async (reslove, fail) => {
16 21
17 - let data: FormDataType = { 'paperType': FormNewspaperPaperType.unknown } 22 + let data: FormNewspaperData = new FormNewspaperData()
18 data.paperInfo = { showLeftImage: false } 23 data.paperInfo = { showLeftImage: false }
19 24
20 try { 25 try {
21 let page: PageInfoBean = await MorningEveningViewModel.getDailyPaperTopic() 26 let page: PageInfoBean = await MorningEveningViewModel.getDailyPaperTopic()
22 - data.paperType = page.topicInfo?.frontFlag || FormNewspaperPaperType.unknown 27 + data.paperType = page.topicInfo?.topicPattern || FormNewspaperPaperType.unknown
23 28
24 let currentTime = new Date().getTime() 29 let currentTime = new Date().getTime()
25 let compInfo = await MorningEveningViewModel.getMorningEveningCompInfo( 30 let compInfo = await MorningEveningViewModel.getMorningEveningCompInfo(
@@ -29,7 +34,7 @@ export class NewspaperDataFetcher { @@ -29,7 +34,7 @@ export class NewspaperDataFetcher {
29 page.topicInfo?.topicId 34 page.topicInfo?.topicId
30 ) 35 )
31 36
32 - if (page.topicInfo.frontLinkObject) { 37 + if (page.topicInfo?.frontFlag && page.topicInfo.frontLinkObject) {
33 data.paperInfo.showLeftImage = true 38 data.paperInfo.showLeftImage = true
34 data.paperInfo.leftImageUrl = page.topicInfo.frontLinkObject.coverUrl 39 data.paperInfo.leftImageUrl = page.topicInfo.frontLinkObject.coverUrl
35 data.paperInfo.leftTitle = page.topicInfo.frontLinkObject.title 40 data.paperInfo.leftTitle = page.topicInfo.frontLinkObject.title
@@ -60,7 +65,7 @@ export class NewspaperDataFetcher { @@ -60,7 +65,7 @@ export class NewspaperDataFetcher {
60 }) 65 })
61 } 66 }
62 67
63 - static fakeData(): FormDataType { 68 + static fakeData(): FormNewspaperData {
64 let data : FormNewspaperPaperContent = { 69 let data : FormNewspaperPaperContent = {
65 title: "标题标题标题标题标题标题标题标题", 70 title: "标题标题标题标题标题标题标题标题",
66 coverUrl: "https://" 71 coverUrl: "https://"
@@ -72,6 +77,137 @@ export class NewspaperDataFetcher { @@ -72,6 +77,137 @@ export class NewspaperDataFetcher {
72 leftTitle: "leftTitleleftTitleleftTitleleftTitleleftTitleleftTitle" 77 leftTitle: "leftTitleleftTitleleftTitleleftTitleleftTitleleftTitle"
73 }, 78 },
74 "paperContents": [data, data, data] 79 "paperContents": [data, data, data]
  80 + } as FormNewspaperData
  81 + }
  82 +
  83 + static dealWithPictures(data: FormNewspaperData, formId: string ,tempDir: string, refreshCallback:(data: FormNewspaperData) => void) {
  84 +
  85 + let donwloadCount = data.paperContents.filter((value) => {
  86 + return value.coverUrl && value.coverUrl.length > 0
  87 + }).length
  88 +
  89 + let fileFDs: Record<string, string | number> = {};
  90 + if (data.paperInfo.leftImageUrl) {
  91 + donwloadCount += 1
  92 +
  93 + CrptoUtils.md5(data.paperInfo.leftImageUrl).then((md5String) => {
  94 +
  95 + const fileName = formId + "file" + md5String;
  96 + const filePath = tempDir + "/" + fileName
  97 + NewspaperDataFetcher.downloadUrlToPath(data.paperInfo.leftImageUrl!, filePath).then(() => {
  98 + let file = fs.openSync(filePath)
  99 + fileFDs[fileName] = file.fd
  100 + data.paperInfo.localLeftImageFileName = fileName
  101 + data.paperInfo.localLeftImageFilePath = filePath
  102 + data.formImages = fileFDs
  103 +
  104 + if (--donwloadCount == 0) { refreshCallback(data) }
  105 + }).catch((e : BusinessError) => {
  106 + Logger.debug(TAG, "download file failed.");
  107 + if (--donwloadCount == 0) { refreshCallback(data) }
  108 + })
  109 + }).catch((e: BusinessError) => {
  110 + if (--donwloadCount == 0) { refreshCallback(data) }
  111 + })
  112 + }
  113 +
  114 +
  115 + for (let index = 0; index < data.paperContents.length; index++) {
  116 + const content = data.paperContents[index];
  117 + if (!content.coverUrl || content.coverUrl.length == 0) {
  118 + continue
  119 + }
  120 +
  121 + CrptoUtils.md5(content.coverUrl).then((md5String) => {
  122 + const fileName = formId + "file" + md5String;
  123 + const filePath = tempDir + "/" + fileName
  124 + NewspaperDataFetcher.downloadUrlToPath(content.coverUrl!, filePath).then(() => {
  125 + Logger.debug(TAG, "open file for display ");
  126 + let file = fs.openSync(filePath)
  127 + fileFDs[fileName] = file.fd
  128 + data.paperContents[index].localCoverFileName = fileName
  129 + data.paperContents[index].localCoverFilePath = filePath
  130 + data.formImages = fileFDs
  131 +
  132 + if (--donwloadCount == 0) { refreshCallback(data) }
  133 + }).catch((e : BusinessError) => {
  134 + Logger.debug(TAG, "download file failed." + JSON.stringify(e));
  135 + if (--donwloadCount == 0) { refreshCallback(data) }
  136 + })
  137 + }).catch((e: BusinessError) => {
  138 + if (--donwloadCount == 0) { refreshCallback(data) }
  139 + })
75 } 140 }
76 } 141 }
  142 +
  143 + static closeFilesWith(data?: FormNewspaperData) {
  144 + if (data && data.formImages) {
  145 + for (const obj of Object.entries(data.formImages)) {
  146 + const fileName = obj[0]
  147 + let fd: number = obj[1] as number
  148 + fs.close(fd)
  149 + }
  150 + }
  151 + }
  152 +
  153 + static downloadUrlToPath(url: string, toFilePath: string): Promise<void> {
  154 + Logger.debug(TAG, "will donwload url:" + url + " ======> " + toFilePath);
  155 +
  156 + return new Promise((reslove, fail) => {
  157 +
  158 + FileUtils.fileExsit(toFilePath).then((exsit: boolean) => {
  159 + if (exsit) {
  160 + Logger.debug(TAG, "file is exsit. " + toFilePath);
  161 + reslove()
  162 + return
  163 + }
  164 +
  165 + NewspaperDataFetcher.downloadUrlToPathWithout(url, toFilePath).then(() => {
  166 + reslove()
  167 + }).catch((e: BusinessError) => {
  168 + fail(e)
  169 + })
  170 + }).catch((e: BusinessError) => {
  171 + NewspaperDataFetcher.downloadUrlToPathWithout(url, toFilePath).then(() => {
  172 + reslove()
  173 + }).catch((e: BusinessError) => {
  174 + fail(e)
  175 + })
  176 + })
  177 + })
  178 + }
  179 +
  180 + static downloadUrlToPathWithout(url: string, toFilePath: string): Promise<void> {
  181 + Logger.debug(TAG, "will donwload url:" + url + " ======> " + toFilePath);
  182 +
  183 + return new Promise((reslove, fail) => {
  184 +
  185 + let httpRequest = http.createHttp()
  186 + httpRequest.request(url, (err, data) => {
  187 +
  188 + if (!err && data.responseCode == http.ResponseCode.OK) {
  189 + let imgFile = fs.openSync(toFilePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
  190 + let wroteLength = 0
  191 + fs.write(imgFile.fd, data.result as ArrayBuffer).then((writeLen: number) => {
  192 + Logger.debug(TAG, "write data to file succeed and size is:" + writeLen);
  193 + wroteLength = writeLen
  194 + }).catch((err: BusinessError) => {
  195 + Logger.error(TAG, "write data to file failed with error message: " + err.message + ", error code: " + err.code);
  196 + }).finally(() => {
  197 + fs.closeSync(imgFile);
  198 + httpRequest.destroy()
  199 +
  200 + wroteLength > 0 ? reslove() : fail("failed")
  201 + });
  202 + return
  203 + }
  204 +
  205 + httpRequest.destroy()
  206 + fail("failed")
  207 + });
  208 +
  209 + })
  210 + }
  211 +
  212 +
77 } 213 }
@@ -11,6 +11,9 @@ export class FormNewspaperPaperInfo { @@ -11,6 +11,9 @@ export class FormNewspaperPaperInfo {
11 showLeftImage: boolean = false 11 showLeftImage: boolean = false
12 12
13 leftImageUrl?: string 13 leftImageUrl?: string
  14 + localLeftImageFileName?: ResourceStr // 传递图片用
  15 + localLeftImageFileFD? : number // 传递图片用
  16 + localLeftImageFilePath? : string // 传递图片用
14 leftTitle?: string 17 leftTitle?: string
15 leftDeepLink?: string 18 leftDeepLink?: string
16 19
@@ -20,5 +23,16 @@ export class FormNewspaperPaperInfo { @@ -20,5 +23,16 @@ export class FormNewspaperPaperInfo {
20 export class FormNewspaperPaperContent { 23 export class FormNewspaperPaperContent {
21 title: string = "" 24 title: string = ""
22 coverUrl?: string 25 coverUrl?: string
  26 + localCoverFileName?: ResourceStr // 传递图片用
  27 + localCoverFileFD? : number // 传递图片用
  28 + localCoverFilePath? : string // 传递图片用
23 deepLink: string = "" 29 deepLink: string = ""
24 } 30 }
  31 +
  32 +export class FormNewspaperData {
  33 + paperType: FormNewspaperPaperType = FormNewspaperPaperType.unknown
  34 + paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo
  35 + paperContents: FormNewspaperPaperContent[] = []
  36 +
  37 + formImages: Record<string, string | number> = {}
  38 +}
@@ -43,8 +43,8 @@ struct DailyNewspaperWidgetCard { @@ -43,8 +43,8 @@ struct DailyNewspaperWidgetCard {
43 43
44 @Builder leftImageView() { 44 @Builder leftImageView() {
45 Stack({ alignContent: Alignment.Bottom }) { 45 Stack({ alignContent: Alignment.Bottom }) {
46 - Image(this.paperInfo.leftImageUrl)  
47 - // Image($r("app.media.desktop_card_comp_place_holder_16_9")) 46 + Image("memory://" + this.paperInfo.localLeftImageFileName)
  47 + // Image(this.paperInfo.leftImageUrl)
48 .alt($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) 49 .objectFit(ImageFit.Cover)
50 .aspectRatio(87/116) 50 .aspectRatio(87/116)
@@ -109,8 +109,9 @@ struct ContentCellView { @@ -109,8 +109,9 @@ struct ContentCellView {
109 bottom: this.hasImage ? 0 : 6}) 109 bottom: this.hasImage ? 0 : 6})
110 110
111 if (this.hasImage) { 111 if (this.hasImage) {
112 - Image(this.content.coverUrl)  
113 - // Image($r("app.media.desktop_card_comp_place_holder_3_4")) 112 + // Image(this.content.localCoverFilePath)
  113 + Image("memory://" + this.content.localCoverFileName)
  114 + // Image(this.content.coverUrl)
114 .alt($r("app.media.desktop_card_comp_place_holder_3_4")) 115 .alt($r("app.media.desktop_card_comp_place_holder_3_4"))
115 .objectFit(ImageFit.Cover) 116 .objectFit(ImageFit.Cover)
116 .height(40) 117 .height(40)
@@ -151,14 +152,12 @@ function jumpWithDeepLink(deepLink: string, component: Object) { @@ -151,14 +152,12 @@ function jumpWithDeepLink(deepLink: string, component: Object) {
151 if (deepLink.length == 0) { 152 if (deepLink.length == 0) {
152 return 153 return
153 } 154 }
154 - const deepLinkKey: string = NewspaperWidgetCommon.JumpParam.DeepLinkKey  
155 - const fromDailyNewspaperKey: string = NewspaperWidgetCommon.JumpParam.FromNewspaperWidgetKey  
156 postCardAction(component, { 155 postCardAction(component, {
157 action: NewspaperWidgetCommon.PosterCardAction.ActionRouter, 156 action: NewspaperWidgetCommon.PosterCardAction.ActionRouter,
158 abilityName: NewspaperWidgetCommon.PosterCardAction.MainAbilityName, 157 abilityName: NewspaperWidgetCommon.PosterCardAction.MainAbilityName,
159 params: { 158 params: {
160 - deepLinkKey: deepLink,  
161 - fromDailyNewspaperKey: true 159 + "newspaper.widget.jump.deeplink": deepLink,
  160 + "newspaper.widget.jump.fromNewspaperWidget": 1
162 } 161 }
163 }); 162 });
164 } 163 }
@@ -44,7 +44,7 @@ struct LaunchInterestsHobbiesPage { @@ -44,7 +44,7 @@ struct LaunchInterestsHobbiesPage {
44 .fontColor('#333333') 44 .fontColor('#333333')
45 .width('54lpx') 45 .width('54lpx')
46 .height('35lpx') 46 .height('35lpx')
47 - .margin({right:'46lpx'}) 47 + .margin({top:'30lpx',right:'46lpx'})
48 .onClick(()=>{ 48 .onClick(()=>{
49 //直接跳过到首页 49 //直接跳过到首页
50 //跳转首页 50 //跳转首页
@@ -64,7 +64,7 @@ struct LaunchInterestsHobbiesPage { @@ -64,7 +64,7 @@ struct LaunchInterestsHobbiesPage {
64 .fontColor('#333333') 64 .fontColor('#333333')
65 .width('100%') 65 .width('100%')
66 .height('61lpx') 66 .height('61lpx')
67 - .margin({top:'84lpx'}) 67 + .margin({top:'54lpx'})
68 Text('完善信息,将为您推荐个性化的内容') 68 Text('完善信息,将为您推荐个性化的内容')
69 .fontSize('27lpx') 69 .fontSize('27lpx')
70 .textAlign(TextAlign.Center) 70 .textAlign(TextAlign.Center)
@@ -76,6 +76,7 @@ struct LaunchInterestsHobbiesPage { @@ -76,6 +76,7 @@ struct LaunchInterestsHobbiesPage {
76 if(!this.isConnectNetwork){ 76 if(!this.isConnectNetwork){
77 EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => { 77 EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => {
78 this.isConnectNetwork = NetworkUtil.isNetConnected() 78 this.isConnectNetwork = NetworkUtil.isNetConnected()
  79 + this.requestInterestsData()
79 }}) 80 }})
80 .layoutWeight(1) 81 .layoutWeight(1)
81 .width('100%') 82 .width('100%')
@@ -53,7 +53,7 @@ export struct BottomNavigationComponent { @@ -53,7 +53,7 @@ export struct BottomNavigationComponent {
53 // 自动刷新触发(双击tab自动刷新) 53 // 自动刷新触发(双击tab自动刷新)
54 @State autoRefresh: number = 0 54 @State autoRefresh: number = 0
55 // 顶导数据,从接口获取 TODO 顶导业务逻辑没看懂,暂时不替换顶导list。频道管理数据待梳理 55 // 顶导数据,从接口获取 TODO 顶导业务逻辑没看懂,暂时不替换顶导list。频道管理数据待梳理
56 - @State topNavMap: Record<string, TopNavDTO[]> = {} 56 + // @State topNavMap: Record<string, TopNavDTO[]> = {}
57 57
58 async aboutToAppear() { 58 async aboutToAppear() {
59 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`); 59 Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
@@ -81,7 +81,7 @@ export struct BottomNavigationComponent { @@ -81,7 +81,7 @@ export struct BottomNavigationComponent {
81 if (CompUtils.isMine(navItem)) { 81 if (CompUtils.isMine(navItem)) {
82 // 我的页面组件数据列表 82 // 我的页面组件数据列表
83 MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 }) 83 MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 })
84 - } else if (navItem.name === '视频') { 84 + } else if (CompUtils.isVideo(navItem)) {
85 // 视频频道,包含视频和直播 85 // 视频频道,包含视频和直播
86 VideoChannelPage({ 86 VideoChannelPage({
87 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), 87 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
@@ -89,14 +89,14 @@ export struct BottomNavigationComponent { @@ -89,14 +89,14 @@ export struct BottomNavigationComponent {
89 autoRefresh: this.autoRefresh 89 autoRefresh: this.autoRefresh
90 }) 90 })
91 } else { 91 } else {
  92 + // 其它带顶到的页面,如 新闻、人民号、服务
92 TopNavigationComponentNew({ 93 TopNavigationComponentNew({
93 - groupId: navItem.id,  
94 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), 94 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
95 _currentNavIndex: $currentNavIndex, 95 _currentNavIndex: $currentNavIndex,
96 bottomNavIndex: index, 96 bottomNavIndex: index,
97 - currentBottomNavName: navItem.name,  
98 assignChannel: this.assignChannel, 97 assignChannel: this.assignChannel,
99 - autoRefresh: this.autoRefresh 98 + autoRefresh: this.autoRefresh,
  99 + navItem: navItem
100 }) 100 })
101 } 101 }
102 } 102 }
@@ -246,7 +246,7 @@ export struct BottomNavigationComponent { @@ -246,7 +246,7 @@ export struct BottomNavigationComponent {
246 } 246 }
247 247
248 onBottomNavigationDataUpdated() { 248 onBottomNavigationDataUpdated() {
249 - Logger.error('yyyy','onBottomNavigationDataUpdated '+JSON.stringify(this.bottomNavList)) 249 + Logger.error('yyyy', 'onBottomNavigationDataUpdated ' + JSON.stringify(this.bottomNavList))
250 // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); 250 // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`);
251 } 251 }
252 252
@@ -353,11 +353,20 @@ export struct BottomNavigationComponent { @@ -353,11 +353,20 @@ export struct BottomNavigationComponent {
353 list = list.filter(item => item.name !== '服务'); 353 list = list.filter(item => item.name !== '服务');
354 list.forEach(item => { 354 list.forEach(item => {
355 switch (item.name) { 355 switch (item.name) {
356 - case '新闻': item.pageName = 'NEWS'; break;  
357 - case '人民号': item.pageName = 'PEOPLE'; break;  
358 - case '视频': item.pageName = 'VIDEOS'; break;  
359 - case '我的': item.pageName = 'MY'; break;  
360 - default : item.pageName = 'NEWS'; break; 356 + case '新闻':
  357 + item.pageName = 'NEWS';
  358 + break;
  359 + case '人民号':
  360 + item.pageName = 'PEOPLE';
  361 + break;
  362 + case '视频':
  363 + item.pageName = 'VIDEOS';
  364 + break;
  365 + case '我的':
  366 + item.pageName = 'MY';
  367 + break;
  368 + default:
  369 + item.pageName = 'NEWS'; break;
361 } 370 }
362 }) 371 })
363 this.bottomNavList = list 372 this.bottomNavList = list
@@ -72,7 +72,8 @@ export default struct CustomDialogComponent { @@ -72,7 +72,8 @@ export default struct CustomDialogComponent {
72 Row() { 72 Row() {
73 Text($r('app.string.dialog_text_privacy_statement')) 73 Text($r('app.string.dialog_text_privacy_statement'))
74 .fontColor($r('app.color.dialog_text_color')) 74 .fontColor($r('app.color.dialog_text_color'))
75 - .fontSize(14).margin({top:20}) 75 + .fontSize(14).fontFamily('PingFang SC')
  76 + .margin({top:20})
76 }.width('90%') 77 }.width('90%')
77 .justifyContent(FlexAlign.Center) 78 .justifyContent(FlexAlign.Center)
78 79
@@ -58,7 +58,7 @@ export struct VideoChannelPage { @@ -58,7 +58,7 @@ export struct VideoChannelPage {
58 * TODO:根据顶导配置获取颜色展示效果不对,待确认 58 * TODO:根据顶导配置获取颜色展示效果不对,待确认
59 */ 59 */
60 getTopNavFontColor(item: TopNavDTO, index: number): Color | string { 60 getTopNavFontColor(item: TopNavDTO, index: number): Color | string {
61 - if (item.name === '视频' && this.currentBottomNavInfo.name === '视频') { 61 + if (item.channelStyle === 1) {
62 return this.currentTopNavSelectedIndex === index ? Color.White : '#949494' 62 return this.currentTopNavSelectedIndex === index ? Color.White : '#949494'
63 } else { 63 } else {
64 return this.currentTopNavSelectedIndex === index ? Color.Black : "#B2B2B2" 64 return this.currentTopNavSelectedIndex === index ? Color.Black : "#B2B2B2"
@@ -12,13 +12,14 @@ import { DeviceUtil, @@ -12,13 +12,14 @@ import { DeviceUtil,
12 UmengStats } from 'wdKit/Index' 12 UmengStats } from 'wdKit/Index'
13 import { LoginModule } from 'wdLogin/Index' 13 import { LoginModule } from 'wdLogin/Index'
14 import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index' 14 import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index'
15 -import { registerRouter } from 'wdRouter/Index' 15 +import { AppInnerLink, registerRouter } from 'wdRouter/Index'
16 import { TrackingModule } from 'wdTracking/Index' 16 import { TrackingModule } from 'wdTracking/Index'
17 import { JSON } from '@kit.ArkTS' 17 import { JSON } from '@kit.ArkTS'
18 import app from '@system.app' 18 import app from '@system.app'
19 import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index' 19 import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index'
20 import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife' 20 import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife'
21 import { webview } from '@kit.ArkWeb' 21 import { webview } from '@kit.ArkWeb'
  22 +import { NewspaperWidgetCommon } from '../dailynewspaperwidget/common/NewspaperWidgetCommon'
22 23
23 const TAG = "[StartupManager]" 24 const TAG = "[StartupManager]"
24 25
@@ -26,6 +27,7 @@ const TAG = "[StartupManager]" @@ -26,6 +27,7 @@ const TAG = "[StartupManager]"
26 export class StartupManager { 27 export class StartupManager {
27 28
28 private context?: common.UIAbilityContext 29 private context?: common.UIAbilityContext
  30 + private lastStartupWant?: Want
29 31
30 private constructor() { 32 private constructor() {
31 } 33 }
@@ -74,10 +76,14 @@ export class StartupManager { @@ -74,10 +76,14 @@ export class StartupManager {
74 // 通知栏点击后启动 76 // 通知栏点击后启动
75 GetuiPush.sharedInstance().onWant(want) 77 GetuiPush.sharedInstance().onWant(want)
76 Logger.debug(TAG, "App onCreate: finised") 78 Logger.debug(TAG, "App onCreate: finised")
  79 +
  80 + this.lastStartupWant = want
77 } 81 }
78 82
79 appOnNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) { 83 appOnNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) {
80 GetuiPush.sharedInstance().onNewWant(want) 84 GetuiPush.sharedInstance().onNewWant(want)
  85 +
  86 + this.dealWithDeepLink(want)
81 } 87 }
82 88
83 appOnDestory() { 89 appOnDestory() {
@@ -124,6 +130,10 @@ export class StartupManager { @@ -124,6 +130,10 @@ export class StartupManager {
124 //TODO: 130 //TODO:
125 // 提前初始化webview 131 // 提前初始化webview
126 webview.WebviewController.initializeWebEngine() 132 webview.WebviewController.initializeWebEngine()
  133 +
  134 + if (this.lastStartupWant && this.dealWithDeepLink(this.lastStartupWant)) {
  135 + this.lastStartupWant = undefined
  136 + }
127 resolve() 137 resolve()
128 }) 138 })
129 } 139 }
@@ -195,4 +205,20 @@ export class StartupManager { @@ -195,4 +205,20 @@ export class StartupManager {
195 private initOthers() { 205 private initOthers() {
196 206
197 } 207 }
  208 +
  209 + private dealWithDeepLink(want: Want): boolean {
  210 +
  211 + if (!want.parameters) {
  212 + return false
  213 + }
  214 +
  215 + let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
  216 +
  217 + if (deepLink && deepLink.length) {
  218 +
  219 + AppInnerLink.jumpWithLink(deepLink)
  220 + return true
  221 + }
  222 + return false
  223 + }
198 } 224 }
@@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
14 "isDynamic": true, 14 "isDynamic": true,
15 "isDefault": true, 15 "isDefault": true,
16 "updateEnabled": true, 16 "updateEnabled": true,
17 - "scheduledUpdateTime": "10:30",  
18 - "updateDuration": 1, 17 + "scheduledUpdateTime": "18:26",
  18 + "updateDuration": 4,
19 "defaultDimension": "2*4", 19 "defaultDimension": "2*4",
20 "supportDimensions": [ 20 "supportDimensions": [
21 "2*4" 21 "2*4"