陈剑华

Merge remote-tracking branch 'origin/main'

Showing 19 changed files with 264 additions and 146 deletions
1 import data_preferences from '@ohos.data.preferences'; 1 import data_preferences from '@ohos.data.preferences';
2 import { Logger } from './Logger'; 2 import { Logger } from './Logger';
  3 +import { JSON } from '@kit.ArkTS';
3 4
4 const TAG = 'SPHelper' 5 const TAG = 'SPHelper'
5 6
  7 +const logEnable = false
  8 +
6 /** 9 /**
7 * sp存储,单条数据,value<1k;业务数据超过1k的,建议使用KVStoreHelper 10 * sp存储,单条数据,value<1k;业务数据超过1k的,建议使用KVStoreHelper
8 */ 11 */
@@ -12,10 +15,14 @@ export class SPHelper { @@ -12,10 +15,14 @@ export class SPHelper {
12 15
13 static init(context: Context) { 16 static init(context: Context) {
14 SPHelper.context = context; 17 SPHelper.context = context;
  18 + if (context) {
  19 + Logger.debug(TAG, '初始化context')
  20 + }
15 } 21 }
16 22
17 static setSpFilename(spFilename: string) { 23 static setSpFilename(spFilename: string) {
18 SPHelper.spFilename = spFilename; 24 SPHelper.spFilename = spFilename;
  25 + Logger.debug(TAG, '设置文件名: ' + spFilename)
19 } 26 }
20 27
21 // 静态属性 28 // 静态属性
@@ -37,47 +44,75 @@ export class SPHelper { @@ -37,47 +44,75 @@ export class SPHelper {
37 } 44 }
38 45
39 async save(key: string, value: data_preferences.ValueType) { 46 async save(key: string, value: data_preferences.ValueType) {
  47 + try {
40 const preferences: data_preferences.Preferences = await this.getVideoPreferences(); 48 const preferences: data_preferences.Preferences = await this.getVideoPreferences();
41 await preferences.put(key, value) 49 await preferences.put(key, value)
42 await preferences.flush() 50 await preferences.flush()
  51 + if (logEnable) {
  52 + Logger.debug(TAG, '保存 key: ' + key + " value => " + value)
  53 + }
  54 + } catch (e) {
  55 + Logger.error(TAG, '保存 key: ' + key + " value => " + value + " 报错:" + JSON.stringify(e))
  56 + }
43 } 57 }
44 58
45 saveSync(key: string, value: data_preferences.ValueType) { 59 saveSync(key: string, value: data_preferences.ValueType) {
46 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 60 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
47 preferences.putSync(key, value) 61 preferences.putSync(key, value)
48 preferences.flush().then(() => { 62 preferences.flush().then(() => {
49 - Logger.debug(TAG, 'saveSync flush success') 63 + if (logEnable) {
  64 + Logger.debug(TAG, 'sync保存 key: ' + key + " value => " + value)
  65 + }
50 }).catch((error: object) => { 66 }).catch((error: object) => {
51 - Logger.debug(TAG, 'saveSync flush failed: ' + JSON.stringify(error)) 67 + Logger.error(TAG, 'sync保存 key: ' + key + " value => " + value + " 报错:" + JSON.stringify(error))
52 }); 68 });
53 } 69 }
54 70
55 async get(key: string, defValue: data_preferences.ValueType): Promise<data_preferences.ValueType> { 71 async get(key: string, defValue: data_preferences.ValueType): Promise<data_preferences.ValueType> {
56 const preferences: data_preferences.Preferences = await this.getVideoPreferences(); 72 const preferences: data_preferences.Preferences = await this.getVideoPreferences();
57 - return await preferences.get(key, defValue); 73 + const data = await preferences.get(key, defValue);
  74 + if (logEnable) {
  75 + Logger.debug(TAG, '获取 key: ' + key + " value => " + data + "| 默认值:" + defValue)
  76 + }
  77 + return data
58 } 78 }
59 79
60 getSync(key: string, defValue: data_preferences.ValueType): data_preferences.ValueType { 80 getSync(key: string, defValue: data_preferences.ValueType): data_preferences.ValueType {
61 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 81 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
62 - return preferences.getSync(key, defValue); 82 + const data = preferences.getSync(key, defValue);
  83 + if (logEnable) {
  84 + Logger.debug(TAG, 'sync获取 key: ' + key + " value => " + data + "| 默认值:" + defValue)
  85 + }
  86 + return data
63 } 87 }
64 88
65 async has(key: string): Promise<boolean> { 89 async has(key: string): Promise<boolean> {
66 const preferences: data_preferences.Preferences = await this.getVideoPreferences(); 90 const preferences: data_preferences.Preferences = await this.getVideoPreferences();
67 - return await preferences.has(key); 91 + const data = await preferences.has(key);
  92 + if (logEnable) {
  93 + Logger.debug(TAG, 'has key: ' + key + ' => ' + data)
  94 + }
  95 + return data
68 } 96 }
69 97
70 hasSync(key: string): boolean { 98 hasSync(key: string): boolean {
71 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 99 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
72 - return preferences.hasSync(key); 100 + const data = preferences.hasSync(key);
  101 + if (logEnable) {
  102 + Logger.debug(TAG, 'synchas key: ' + key + ' => ' + data)
  103 + }
  104 + return data
73 } 105 }
74 106
75 async delete(key: string) { 107 async delete(key: string) {
76 const preferences: data_preferences.Preferences = await this.getVideoPreferences(); 108 const preferences: data_preferences.Preferences = await this.getVideoPreferences();
77 preferences.delete(key).then(async () => { 109 preferences.delete(key).then(async () => {
78 await preferences.flush(); 110 await preferences.flush();
  111 + if (logEnable) {
  112 + Logger.debug(TAG, '删除 key: ' + key)
  113 + }
79 }).catch((err: Error) => { 114 }).catch((err: Error) => {
80 - // Logger.error(TAG, 'Failed to delete the key. Cause: ' + err); 115 + Logger.error(TAG, '删除 key失败:' + JSON.stringify(err));
81 }); 116 });
82 } 117 }
83 118
@@ -85,9 +120,11 @@ export class SPHelper { @@ -85,9 +120,11 @@ export class SPHelper {
85 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync(); 120 const preferences: data_preferences.Preferences = this.getVideoPreferencesSync();
86 preferences.deleteSync(key) 121 preferences.deleteSync(key)
87 preferences.flush().then(() => { 122 preferences.flush().then(() => {
88 - Logger.debug(TAG, 'deleteSync flush success') 123 + if (logEnable) {
  124 + Logger.debug(TAG, 'sync删除 key: ' + key)
  125 + }
89 }).catch((error: object) => { 126 }).catch((error: object) => {
90 - Logger.debug(TAG, 'deleteSync flush failed: ' + JSON.stringify(error)) 127 + Logger.error(TAG, 'sync删除 key失败:' + JSON.stringify(error));
91 }); 128 });
92 } 129 }
93 130
@@ -95,8 +132,9 @@ export class SPHelper { @@ -95,8 +132,9 @@ export class SPHelper {
95 this.getVideoPreferences().then(async (preferences: data_preferences.Preferences) => { 132 this.getVideoPreferences().then(async (preferences: data_preferences.Preferences) => {
96 preferences.clearSync() 133 preferences.clearSync()
97 await preferences.flush() 134 await preferences.flush()
  135 + Logger.debug(TAG, 'sync清除所有数据');
98 }).catch((err: Error) => { 136 }).catch((err: Error) => {
99 - // Logger.error(TAG, 'get the preferences failed, Cause: ' + err); 137 + Logger.error(TAG, 'sync清除所有数据,失败:' + JSON.stringify(err));
100 }); 138 });
101 } 139 }
102 140
@@ -9,6 +9,16 @@ import { commentInfo } from './commentInfo'; @@ -9,6 +9,16 @@ import { commentInfo } from './commentInfo';
9 import { BaseDTO } from '../component/BaseDTO'; 9 import { BaseDTO } from '../component/BaseDTO';
10 import { LiveRoomDataBean } from '../live/LiveRoomDataBean'; 10 import { LiveRoomDataBean } from '../live/LiveRoomDataBean';
11 11
  12 +export class ContentShareInfoDTO {
  13 + shareTitle: string = ''
  14 + shareUrl: string = ''
  15 + shareSummary: string = ''
  16 + shareCoverUrl: string = ''
  17 + sharePosterCoverUrl: string = ''
  18 + shareOpen: number = 0
  19 + sharePosterOpen: number = 0
  20 +}
  21 +
12 @Observed 22 @Observed
13 export class ContentDTO implements BaseDTO { 23 export class ContentDTO implements BaseDTO {
14 seoTags: string = ''; 24 seoTags: string = '';
@@ -70,6 +80,7 @@ export class ContentDTO implements BaseDTO { @@ -70,6 +80,7 @@ export class ContentDTO implements BaseDTO {
70 fullColumnImgUrls: FullColumnImgUrlDTO[] = []; 80 fullColumnImgUrls: FullColumnImgUrlDTO[] = [];
71 liveInfo: LiveInfoDTO = {} as LiveInfoDTO; // 直播新闻信息【BFF聚合】 81 liveInfo: LiveInfoDTO = {} as LiveInfoDTO; // 直播新闻信息【BFF聚合】
72 videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 82 videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的
  83 + shareInfo: ContentShareInfoDTO = {} as ContentShareInfoDTO
73 84
74 newsSummary: string = ''; //appstyle:2 ,新闻详情 85 newsSummary: string = ''; //appstyle:2 ,新闻详情
75 contentText?: string = ''; 86 contentText?: string = '';
@@ -154,6 +165,7 @@ export class ContentDTO implements BaseDTO { @@ -154,6 +165,7 @@ export class ContentDTO implements BaseDTO {
154 content.fullColumnImgUrls = old.fullColumnImgUrls; 165 content.fullColumnImgUrls = old.fullColumnImgUrls;
155 content.liveInfo = old.liveInfo; 166 content.liveInfo = old.liveInfo;
156 content.videoInfo = old.videoInfo; 167 content.videoInfo = old.videoInfo;
  168 + content.shareInfo = old.shareInfo
157 content.newsSummary = old.newsSummary; 169 content.newsSummary = old.newsSummary;
158 content.interactData = old.interactData; 170 content.interactData = old.interactData;
159 content.hasMore = old.hasMore; 171 content.hasMore = old.hasMore;
@@ -14,37 +14,37 @@ export interface ShareInfoDTO { @@ -14,37 +14,37 @@ export interface ShareInfoDTO {
14 //分享链接 14 //分享链接
15 shareUrl: string; 15 shareUrl: string;
16 //首发时间 16 //首发时间
17 - publishTime:string; 17 + appCustomPublishTime:string;
18 //图片 18 //图片
19 - imageUrl:string; 19 + appCustomImageUrl:string;
20 //直播和内容的举报,仅针对人民号发布的才能举报,cms创建的没有举报按钮 20 //直播和内容的举报,仅针对人民号发布的才能举报,cms创建的没有举报按钮
21 - showReport:boolean; 21 + appCustomShowReport:boolean;
22 //点赞按钮显示 -1:不展示 0:未点赞 1:已点赞 22 //点赞按钮显示 -1:不展示 0:未点赞 1:已点赞
23 - showLike:number; 23 + appCustomShowLike:number;
24 //0 分享海报关闭,1 分享海报开启 24 //0 分享海报关闭,1 分享海报开启
25 - posterShareControl:string; 25 + appCustomPosterShareControl:string;
26 //是否展示海报 -1-不展示图标 26 //是否展示海报 -1-不展示图标
27 - showPoster:number; 27 + appCustomShowPoster:number;
28 //海报展示类型 1:专题、文章、图文、视频、直播 2:人民号 3:评论 4:电子报海报 5:音频专题海报 6:早晚报专题海报 7:榜单H5 8:H5普通文章专题,包含时间链 28 //海报展示类型 1:专题、文章、图文、视频、直播 2:人民号 3:评论 4:电子报海报 5:音频专题海报 6:早晚报专题海报 7:榜单H5 8:H5普通文章专题,包含时间链
29 - showPosterType:number; 29 + appCustomShowPosterType:number;
30 //接口返回: 内容id、内容类型 30 //接口返回: 内容id、内容类型
31 - contentId:string; 31 + appCustomContentId:string;
32 //内容类型,分享的类型 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频 32 //内容类型,分享的类型 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频
33 - contentType:string; 33 + appCustomContentType:string;
34 //关系id 34 //关系id
35 - targetRelId:string; 35 + appCustomTargetRelId:string;
36 //关系类型,1.频道关系;2.专题关系 36 //关系类型,1.频道关系;2.专题关系
37 - targetRelType:string; 37 + appCustomTargetRelType:string;
38 //21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题 38 //21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题
39 - topicType:string; 39 + appCustomTopicType:string;
40 //早晚报;1-早报;2-午报;3-晚报 40 //早晚报;1-早报;2-午报;3-晚报
41 - topicPattern:number; 41 + appCustomTopicPattern:number;
42 //是否有头版 42 //是否有头版
43 - isFrontDaily:boolean; 43 + appCustomIsFrontDaily:boolean;
44 //分享海报简介 44 //分享海报简介
45 - posterSummary:string;  
46 - sharePosterItemList: SharePosterItemBean[] 45 + appCustomPosterSummary:string;
  46 + appCustomSharePosterItemList: SharePosterItemBean[]
47 //分享海报标题 47 //分享海报标题
48 - posterTitle:string; 48 + appCustomPosterTitle:string;
49 49
50 } 50 }
@@ -444,17 +444,17 @@ export struct ENewspaperPageComponent { @@ -444,17 +444,17 @@ export struct ENewspaperPageComponent {
444 let contentDetailData: ContentDetailDTO = { 444 let contentDetailData: ContentDetailDTO = {
445 shareInfo:{ 445 shareInfo:{
446 shareTitle:this.newspaperListBean?.list[this.swiperIndex].pageName, 446 shareTitle:this.newspaperListBean?.list[this.swiperIndex].pageName,
447 - publishTime:this.newspaperListBean?.list[this.swiperIndex].periodNum,  
448 - imageUrl:this.newspaperListBean?.list[this.swiperIndex].pagePic, 447 + appCustomPublishTime:this.newspaperListBean?.list[this.swiperIndex].periodNum,
  448 + appCustomImageUrl:this.newspaperListBean?.list[this.swiperIndex].pagePic,
449 shareUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.shareUrl, 449 shareUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.shareUrl,
450 sharePosterCoverUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.sharePosterCoverUrl, 450 sharePosterCoverUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.sharePosterCoverUrl,
451 - showReport:false,  
452 - showLike:-1, 451 + appCustomShowReport:false,
  452 + appCustomShowLike:-1,
453 shareOpen:1, 453 shareOpen:1,
454 sharePosterOpen:1, 454 sharePosterOpen:1,
455 - posterShareControl:'-1',  
456 - showPoster:-1,  
457 - showPosterType:4, 455 + appCustomPosterShareControl:'-1',
  456 + appCustomShowPoster:-1,
  457 + appCustomShowPosterType:4,
458 } 458 }
459 } as ContentDetailDTO 459 } as ContentDetailDTO
460 WDShare.shareContent(contentDetailData,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage) 460 WDShare.shareContent(contentDetailData,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage)
@@ -157,20 +157,20 @@ export struct PaperTitleComponent { @@ -157,20 +157,20 @@ export struct PaperTitleComponent {
157 let contentDetailData: ContentDetailDTO = { 157 let contentDetailData: ContentDetailDTO = {
158 newsId:Number.parseInt(this.topicInfo.topicId), 158 newsId:Number.parseInt(this.topicInfo.topicId),
159 shareInfo:{ 159 shareInfo:{
160 - contentId:this.topicInfo.topicId,  
161 - contentType:this.topicInfo.topicType+'', 160 + appCustomContentId:this.topicInfo.topicId,
  161 + appCustomContentType:this.topicInfo.topicType+'',
162 shareTitle:this.topicInfo.shareTitle, 162 shareTitle:this.topicInfo.shareTitle,
163 shareSummary:this.topicInfo.shareSummary, 163 shareSummary:this.topicInfo.shareSummary,
164 - imageUrl:this.topicInfo.shareCoverUrl, 164 + appCustomImageUrl:this.topicInfo.shareCoverUrl,
165 sharePosterCoverUrl:this.topicInfo.sharePosterCoverUrl, 165 sharePosterCoverUrl:this.topicInfo.sharePosterCoverUrl,
166 shareUrl:this.topicInfo.shareUrl, 166 shareUrl:this.topicInfo.shareUrl,
167 - targetRelId:this.topicInfo.relId,  
168 - targetRelType:this.topicInfo.relType,  
169 - showReport:false,  
170 - showLike:-1, 167 + appCustomTargetRelId:this.topicInfo.relId,
  168 + appCustomTargetRelType:this.topicInfo.relType,
  169 + appCustomShowReport:false,
  170 + appCustomShowLike:-1,
171 shareOpen:1, 171 shareOpen:1,
172 sharePosterOpen:this.topicInfo.posterFlag, 172 sharePosterOpen:this.topicInfo.posterFlag,
173 - showPoster:this.topicInfo.posterFlag>0?1:-1, 173 + appCustomShowPoster:this.topicInfo.posterFlag>0?1:-1,
174 } 174 }
175 } as ContentDetailDTO 175 } as ContentDetailDTO
176 WDShare.setTopicBeanToShareBean(contentDetailData.shareInfo,this.topicInfo) 176 WDShare.setTopicBeanToShareBean(contentDetailData.shareInfo,this.topicInfo)
@@ -6,6 +6,7 @@ import { ProcessUtils, WDRouterRule } from 'wdRouter'; @@ -6,6 +6,7 @@ import { ProcessUtils, WDRouterRule } from 'wdRouter';
6 import { TrackConstants, 6 import { TrackConstants,
7 TrackingButton, 7 TrackingButton,
8 TrackingContent, TrackingPageBrowse, TrackParamConvert } from 'wdTracking/Index'; 8 TrackingContent, TrackingPageBrowse, TrackParamConvert } from 'wdTracking/Index';
  9 +import { WDShare } from 'wdShare/Index';
9 10
10 const TAG: string = 'CardView'; 11 const TAG: string = 'CardView';
11 12
@@ -588,7 +589,7 @@ export struct PaperSingleColumn999CardView { @@ -588,7 +589,7 @@ export struct PaperSingleColumn999CardView {
588 right: { anchor: '__container__', align: HorizontalAlign.End } 589 right: { anchor: '__container__', align: HorizontalAlign.End }
589 }) 590 })
590 .onClick(() => { 591 .onClick(() => {
591 - ToastUtils.showToast('分享为公共方法,待开发', 1000) 592 + WDShare.shareProgram(this.item)
592 }) 593 })
593 }.width(CommonConstants.FULL_PARENT) 594 }.width(CommonConstants.FULL_PARENT)
594 .justifyContent(FlexAlign.SpaceBetween) 595 .justifyContent(FlexAlign.SpaceBetween)
1 import { SpConstants } from 'wdConstant'; 1 import { SpConstants } from 'wdConstant';
2 import { Logger, SPHelper, ToastUtils, EmitterEventId, EmitterUtils, DateTimeUtils, CustomToast } from 'wdKit'; 2 import { Logger, SPHelper, ToastUtils, EmitterEventId, EmitterUtils, DateTimeUtils, CustomToast } from 'wdKit';
3 import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem'; 3 import {MineMainSettingFunctionItem} from '../../viewmodel/MineMainSettingFunctionItem';
4 -import MineSettingDatasModel from '../../model/MineSettingDatasModel'; 4 +import { MineSettingDatasModel } from '../../model/MineSettingDatasModel';
5 import router from '@ohos.router'; 5 import router from '@ohos.router';
6 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 6 import { WDRouterPage, WDRouterRule } from 'wdRouter';
7 import { Params } from 'wdBean'; 7 import { Params } from 'wdBean';
@@ -9,13 +9,15 @@ import { Params } from 'wdBean'; @@ -9,13 +9,15 @@ import { Params } from 'wdBean';
9 // import { common } from '@kit.AbilityKit'; 9 // import { common } from '@kit.AbilityKit';
10 import fs from '@ohos.file.fs'; 10 import fs from '@ohos.file.fs';
11 import { CustomCacheDialog } from './CustomCacheDialog'; 11 import { CustomCacheDialog } from './CustomCacheDialog';
12 -import MineSettingDatasModel from '../../model/MineSettingDatasModel'; 12 +import { MineSettingDatasModel } from '../../model/MineSettingDatasModel';
13 import { MineMainSettingFunctionItem } from '../../viewmodel/MineMainSettingFunctionItem'; 13 import { MineMainSettingFunctionItem } from '../../viewmodel/MineMainSettingFunctionItem';
14 import common from '@ohos.app.ability.common'; 14 import common from '@ohos.app.ability.common';
15 import dataPreferences from '@ohos.data.preferences'; 15 import dataPreferences from '@ohos.data.preferences';
16 import { TitleBackComponent } from './TitleBackComponent'; 16 import { TitleBackComponent } from './TitleBackComponent';
17 import { MyCustomDialog } from '../reusable/MyCustomDialog'; 17 import { MyCustomDialog } from '../reusable/MyCustomDialog';
18 import { TrackingButton, TrackConstants } from 'wdTracking/Index'; 18 import { TrackingButton, TrackConstants } from 'wdTracking/Index';
  19 +import { JSON } from '@kit.ArkTS';
  20 +import { HttpUtils } from 'wdNetwork/Index';
19 21
20 @Component 22 @Component
21 export struct MineSettingComponent { 23 export struct MineSettingComponent {
@@ -82,10 +84,9 @@ export struct MineSettingComponent { @@ -82,10 +84,9 @@ export struct MineSettingComponent {
82 84
83 async getSettingPageData() { 85 async getSettingPageData() {
84 let oldList = MineSettingDatasModel.getMineMainSettingFunctionItemData(); 86 let oldList = MineSettingDatasModel.getMineMainSettingFunctionItemData();
85 - let userId=await SPHelper.default.get(SpConstants.USER_ID,'') as string  
86 - if(userId==''){  
87 - this.listData=oldList.slice(1,oldList.length)  
88 - }else { 87 + if (!HttpUtils.isLogin()) {
  88 + this.listData = oldList.slice(1,oldList.length)
  89 + } else {
89 this.listData = oldList; 90 this.listData = oldList;
90 } 91 }
91 92
@@ -167,6 +168,7 @@ export struct MineSettingComponent { @@ -167,6 +168,7 @@ export struct MineSettingComponent {
167 .margin({ left: `${this.calcHeight(81)}lpx`, right: `${this.calcHeight(29)}lpx` }) 168 .margin({ left: `${this.calcHeight(81)}lpx`, right: `${this.calcHeight(29)}lpx` })
168 .selectedColor("#ED2800") 169 .selectedColor("#ED2800")
169 .onChange((isOn: boolean) => { 170 .onChange((isOn: boolean) => {
  171 + Logger.debug("SPHelper", "数据 : " + JSON.stringify(item))
170 if(item.itemType=='push_switch'){ 172 if(item.itemType=='push_switch'){
171 trackButtonClick("settingPagePushSwitch") 173 trackButtonClick("settingPagePushSwitch")
172 //推送 174 //推送
@@ -296,7 +296,6 @@ export struct LiveOperRowListView { @@ -296,7 +296,6 @@ export struct LiveOperRowListView {
296 .aspectRatio(1) 296 .aspectRatio(1)
297 .interpolation(ImageInterpolation.High) 297 .interpolation(ImageInterpolation.High)
298 .onClick((event: ClickEvent) => { 298 .onClick((event: ClickEvent) => {
299 - // ToastUtils.showToast('分享为公共方法,待开发', 1000);  
300 this.share() 299 this.share()
301 }) 300 })
302 } 301 }
@@ -391,7 +391,6 @@ export struct OperRowListView { @@ -391,7 +391,6 @@ export struct OperRowListView {
391 .aspectRatio(1) 391 .aspectRatio(1)
392 .interpolation(ImageInterpolation.High) 392 .interpolation(ImageInterpolation.High)
393 .onClick((event: ClickEvent) => { 393 .onClick((event: ClickEvent) => {
394 - // ToastUtils.showToast('分享为公共方法,待开发', 1000);  
395 this.share() 394 this.share()
396 }) 395 })
397 } 396 }
@@ -12,74 +12,49 @@ const TAG = "MineSettingDatasModel" @@ -12,74 +12,49 @@ const TAG = "MineSettingDatasModel"
12 /** 12 /**
13 * 我的设置页面 所有数据 获取封装类 13 * 我的设置页面 所有数据 获取封装类
14 */ 14 */
15 -class MineSettingDatasModel{  
16 - private static instance: MineSettingDatasModel;  
17 - mainSettingData:Array<MineMainSettingFunctionItem> = []  
18 - accountAndSecurityData:Array<MineMainSettingFunctionItem> = []  
19 -  
20 - private constructor() { }  
21 -  
22 - /**  
23 - * 单例模式  
24 - * @returns  
25 - */  
26 - public static getInstance(): MineSettingDatasModel {  
27 - if (!MineSettingDatasModel.instance) {  
28 - MineSettingDatasModel.instance = new MineSettingDatasModel();  
29 - }  
30 - return MineSettingDatasModel.instance;  
31 - }  
32 -  
33 -  
34 - 15 +export class MineSettingDatasModel {
35 16
36 /** 17 /**
37 * 评论 关注 收藏 等7个数据 18 * 评论 关注 收藏 等7个数据
38 * 包含名字和图标 19 * 包含名字和图标
39 */ 20 */
40 - getMineMainSettingFunctionItemData():MineMainSettingFunctionItem[]{  
41 - if(this.mainSettingData.length === 7){  
42 - return this.mainSettingData  
43 - }  
44 - this.mainSettingData = []  
45 - this.mainSettingData.push(new MineMainSettingFunctionItem(null, '账户与安全', '18888888888', 0, false,"account")) 21 + static getMineMainSettingFunctionItemData() {
  22 + let mainSettingData: MineMainSettingFunctionItem[] = []
  23 + mainSettingData.push(new MineMainSettingFunctionItem(null, '账户与安全', '18888888888', 0, false,"account"))
46 let pushState=SPHelper.default.getSync(SpConstants.SETTING_PUSH_SWITCH,false) as boolean 24 let pushState=SPHelper.default.getSync(SpConstants.SETTING_PUSH_SWITCH,false) as boolean
47 - this.mainSettingData.push(new MineMainSettingFunctionItem(null, '接收推送', null, 1, pushState,"push_switch"))  
48 - this.mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false,"private_setting")) 25 + mainSettingData.push(new MineMainSettingFunctionItem(null, '接收推送', null, 1, pushState,"push_switch"))
  26 + mainSettingData.push(new MineMainSettingFunctionItem(null, '隐私设罝', null, 0, false,"private_setting"))
49 let wifiState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_IMAGE_SWITCH,false) as boolean 27 let wifiState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_IMAGE_SWITCH,false) as boolean
50 - this.mainSettingData.push(new MineMainSettingFunctionItem(null, '仅wifi网络加载图片', null, 1, wifiState,"wifi_switch")) 28 + mainSettingData.push(new MineMainSettingFunctionItem(null, '仅wifi网络加载图片', null, 1, wifiState,"wifi_switch"))
51 let videoState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_VIDEO_SWITCH,false) as boolean 29 let videoState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_VIDEO_SWITCH,false) as boolean
52 - this.mainSettingData.push(new MineMainSettingFunctionItem(null, 'wifi网络情况下自动播放视频', null, 1, videoState,"video_switch")) 30 + mainSettingData.push(new MineMainSettingFunctionItem(null, 'wifi网络情况下自动播放视频', null, 1, videoState,"video_switch"))
53 let suspensionState=SPHelper.default.getSync(SpConstants.SETTING_SUSPENSION_SWITCH,false) as boolean 31 let suspensionState=SPHelper.default.getSync(SpConstants.SETTING_SUSPENSION_SWITCH,false) as boolean
54 - this.mainSettingData.push(new MineMainSettingFunctionItem(null, '开启播放器悬浮窗', null, 1, suspensionState,"suspensionState_switch")) 32 + mainSettingData.push(new MineMainSettingFunctionItem(null, '开启播放器悬浮窗', null, 1, suspensionState,"suspensionState_switch"))
55 // this.mainSettingData.push(new MineMainSettingFunctionItem(null, null, null, 2, null,"")) 33 // this.mainSettingData.push(new MineMainSettingFunctionItem(null, null, null, 2, null,""))
56 - this.mainSettingData.push(new MineMainSettingFunctionItem(null, '清理缓存', '32MB', 0, false,"clear_cache")) 34 + mainSettingData.push(new MineMainSettingFunctionItem(null, '清理缓存', '32MB', 0, false,"clear_cache"))
57 // this.mainSettingData.push(new MineMainSettingFunctionItem(null, '评价我们', null, 0, false,"")) 35 // this.mainSettingData.push(new MineMainSettingFunctionItem(null, '评价我们', null, 0, false,""))
58 36
59 - return this.mainSettingData 37 + return mainSettingData
60 } 38 }
61 39
62 /** 40 /**
63 * 评论 关注 收藏 等7个数据 41 * 评论 关注 收藏 等7个数据
64 * 包含名字和图标 42 * 包含名字和图标
65 */ 43 */
66 - getAccountAndSecuritySettingData():MineMainSettingFunctionItem[]{  
67 - if(this.accountAndSecurityData.length === 7){  
68 - return this.accountAndSecurityData  
69 - }  
70 - this.accountAndSecurityData = []  
71 - this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '更换手机号', '18888888888', 0, false,""))  
72 - this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '设置密码', null, 0, false,""))  
73 - this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, null, null, 2, null,"")) 44 + static getAccountAndSecuritySettingData():MineMainSettingFunctionItem[]{
  45 + let accountAndSecurityData: MineMainSettingFunctionItem[] = []
  46 + accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '更换手机号', '18888888888', 0, false,""))
  47 + accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '设置密码', null, 0, false,""))
  48 + accountAndSecurityData.push(new MineMainSettingFunctionItem(null, null, null, 2, null,""))
74 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_qqicon'), '绑定QQ', '立即绑定', 0, false,"")) 49 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_qqicon'), '绑定QQ', '立即绑定', 0, false,""))
75 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_wechaticon'), '绑定微信', '立即绑定', 0, false,"")) 50 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_wechaticon'), '绑定微信', '立即绑定', 0, false,""))
76 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_weiboicon'), '绑定新浪微博', '立即绑定', 0, false,"")) 51 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_weiboicon'), '绑定新浪微博', '立即绑定', 0, false,""))
77 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_appleicon'), 'Apple ID', null, 0, false,"")) 52 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem($r('app.media.account_appleicon'), 'Apple ID', null, 0, false,""))
78 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, null, null, 2, null,"")) 53 // this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, null, null, 2, null,""))
79 54
80 - this.accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '注销账号', null, 0, false,"")) 55 + accountAndSecurityData.push(new MineMainSettingFunctionItem(null, '注销账号', null, 0, false,""))
81 56
82 - return this.accountAndSecurityData 57 + return accountAndSecurityData
83 } 58 }
84 59
85 60
@@ -113,10 +88,10 @@ class MineSettingDatasModel{ @@ -113,10 +88,10 @@ class MineSettingDatasModel{
113 /** 88 /**
114 * 判断是否设置过密码 89 * 判断是否设置过密码
115 */ 90 */
116 - checkSetPassword(): Promise<CheckSetPasswordItem> { 91 + static checkSetPassword(): Promise<CheckSetPasswordItem> {
117 return new Promise<CheckSetPasswordItem>((success, error) => { 92 return new Promise<CheckSetPasswordItem>((success, error) => {
118 Logger.info(TAG, `checkSetPassword start`); 93 Logger.info(TAG, `checkSetPassword start`);
119 - this.fetchCheckSetPassword().then((navResDTO: ResponseDTO<CheckSetPasswordItem>) => { 94 + MineSettingDatasModel.fetchCheckSetPassword().then((navResDTO: ResponseDTO<CheckSetPasswordItem>) => {
120 if (!navResDTO || navResDTO.code != 0) { 95 if (!navResDTO || navResDTO.code != 0) {
121 error(null) 96 error(null)
122 return 97 return
@@ -131,13 +106,9 @@ class MineSettingDatasModel{ @@ -131,13 +106,9 @@ class MineSettingDatasModel{
131 }) 106 })
132 } 107 }
133 108
134 - fetchCheckSetPassword() { 109 + static fetchCheckSetPassword() {
135 let url = HttpUrlUtils.checkSetPassword() 110 let url = HttpUrlUtils.checkSetPassword()
136 return WDHttp.get<ResponseDTO<CheckSetPasswordItem>>(url) 111 return WDHttp.get<ResponseDTO<CheckSetPasswordItem>>(url)
137 }; 112 };
138 113
139 } 114 }
140 -  
141 -const mineSettingDatasModel = MineSettingDatasModel.getInstance()  
142 -export default mineSettingDatasModel as MineSettingDatasModel  
143 -// export default MineMainSettingFunctionItem as MineMainSettingFunctionItem  
@@ -7,7 +7,7 @@ import { DetailPlayVLivePage } from './DetailPlayVLivePage'; @@ -7,7 +7,7 @@ import { DetailPlayVLivePage } from './DetailPlayVLivePage';
7 import { DateTimeUtils, Logger, ToastUtils } from 'wdKit/Index'; 7 import { DateTimeUtils, Logger, ToastUtils } from 'wdKit/Index';
8 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; 8 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
9 import { PictureLoading } from '../widgets/vertical/PictureLoading'; 9 import { PictureLoading } from '../widgets/vertical/PictureLoading';
10 -import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'; 10 +import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
11 import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic'; 11 import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
12 12
13 const TAG = 'DetailPlayLiveCommon' 13 const TAG = 'DetailPlayLiveCommon'
@@ -36,8 +36,7 @@ export struct DetailPlayLiveCommon { @@ -36,8 +36,7 @@ export struct DetailPlayLiveCommon {
36 @Provide liveStyle: number = -1 36 @Provide liveStyle: number = -1
37 // 直播地址 37 // 直播地址
38 @Provide playUrl: string = '' 38 @Provide playUrl: string = ''
39 - // // 直播间背景图  
40 - // @Provide imgUrl: string = '' 39 +
41 // 全屏展示 40 // 全屏展示
42 @Provide pageShow: number = -1 41 @Provide pageShow: number = -1
43 // 关闭全屏 42 // 关闭全屏
@@ -45,7 +44,6 @@ export struct DetailPlayLiveCommon { @@ -45,7 +44,6 @@ export struct DetailPlayLiveCommon {
45 // 返回功能 44 // 返回功能
46 @Provide pageBackPress: number = -1 45 @Provide pageBackPress: number = -1
47 46
48 -  
49 @Provide liveDetailPageLogic :LiveDetailPageLogic = new LiveDetailPageLogic 47 @Provide liveDetailPageLogic :LiveDetailPageLogic = new LiveDetailPageLogic
50 // 直播详情内容 48 // 直播详情内容
51 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 49 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@@ -106,20 +104,22 @@ export struct DetailPlayLiveCommon { @@ -106,20 +104,22 @@ export struct DetailPlayLiveCommon {
106 let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url 104 let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url
107 detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl 105 detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl
108 this.playUrl = m3u8uUrl 106 this.playUrl = m3u8uUrl
109 - // console.log(TAG, ' GetPullAddressBean:', m3u8uUrl)  
110 } 107 }
111 } 108 }
112 109
113 -  
114 -  
115 this.liveState = detailData.liveInfo?.liveState 110 this.liveState = detailData.liveInfo?.liveState
116 111
117 this.contentDetailData = data[0] 112 this.contentDetailData = data[0]
118 113
119 this.liveDetailPageLogic.contentDetailData = this.contentDetailData 114 this.liveDetailPageLogic.contentDetailData = this.contentDetailData
  115 +
120 this.liveDetailPageLogic.liveLandscape = detailData?.liveInfo?.liveLandScape 116 this.liveDetailPageLogic.liveLandscape = detailData?.liveInfo?.liveLandScape
  117 +
121 this.liveDetailPageLogic.liveState = detailData.liveInfo?.liveState 118 this.liveDetailPageLogic.liveState = detailData.liveInfo?.liveState
122 - this.liveDetailPageLogic.resolvingRoomBackgroundImgUrl() 119 +
  120 + this.liveDetailPageLogic.resolvingRoomImgSource()
  121 +
  122 + this.liveDetailPageLogic.resolvingRoomVliveData(0)
123 123
124 this.publishCommentModel.targetId = String(detailData?.newsId || '') 124 this.publishCommentModel.targetId = String(detailData?.newsId || '')
125 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '') 125 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '')
@@ -131,13 +131,6 @@ export struct DetailPlayLiveCommon { @@ -131,13 +131,6 @@ export struct DetailPlayLiveCommon {
131 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '') 131 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '')
132 this.publishCommentModel.commentContent = '' 132 this.publishCommentModel.commentContent = ''
133 this.liveStyle = detailData.liveInfo?.liveStyle 133 this.liveStyle = detailData.liveInfo?.liveStyle
134 - //  
135 - // if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&  
136 - // this.contentDetailData.liveInfo.previewUrl.length > 0) {  
137 - // this.imgUrl = this.contentDetailData.liveInfo.previewUrl  
138 - // } else if (detailData.fullColumnImgUrls && detailData.fullColumnImgUrls.length > 0) {  
139 - // this.imgUrl = detailData.fullColumnImgUrls[0].url  
140 - // }  
141 134
142 if (detailData.liveInfo.liveState == 'end') { 135 if (detailData.liveInfo.liveState == 'end') {
143 this.playUrl = detailData.liveInfo.vlive[0].replayUri 136 this.playUrl = detailData.liveInfo.vlive[0].replayUri
@@ -7,9 +7,10 @@ import mediaquery from '@ohos.mediaquery'; @@ -7,9 +7,10 @@ import mediaquery from '@ohos.mediaquery';
7 import { Logger, WindowModel } from 'wdKit/Index'; 7 import { Logger, WindowModel } from 'wdKit/Index';
8 import { router, window } from '@kit.ArkUI'; 8 import { router, window } from '@kit.ArkUI';
9 import { WDAliPlayerController } from 'wdPlayer/Index'; 9 import { WDAliPlayerController } from 'wdPlayer/Index';
10 -import { LiveOperRowListView } from 'wdComponent'; 10 +import { LiveEmptyComponent, LiveOperRowListView } from 'wdComponent';
11 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; 11 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
12 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; 12 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index';
  13 +import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
13 14
14 let TAG: string = 'DetailPlayLivePage'; 15 let TAG: string = 'DetailPlayLivePage';
15 16
@@ -39,6 +40,8 @@ export struct DetailPlayLivePage { @@ -39,6 +40,8 @@ export struct DetailPlayLivePage {
39 @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息 40 @State lastInputedLiveComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的直播间消息
40 @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息 41 @State lastInputedChatComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的大家聊消息
41 42
  43 +
  44 +
42 aboutToAppear(): void { 45 aboutToAppear(): void {
43 Logger.info(TAG, `wyj-aboutToAppear`) 46 Logger.info(TAG, `wyj-aboutToAppear`)
44 47
@@ -69,6 +72,7 @@ export struct DetailPlayLivePage { @@ -69,6 +72,7 @@ export struct DetailPlayLivePage {
69 TopPlayComponent({ playerController: this.playerController }) 72 TopPlayComponent({ playerController: this.playerController })
70 .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%') 73 .height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
71 74
  75 +
72 TabComponent({ 76 TabComponent({
73 tabs: this.tabs, 77 tabs: this.tabs,
74 changeToTab: this.changeToTab, 78 changeToTab: this.changeToTab,
@@ -35,8 +35,7 @@ export struct DetailPlayVLivePage { @@ -35,8 +35,7 @@ export struct DetailPlayVLivePage {
35 @Consume @Watch('closeFullScreen') pageHide: number 35 @Consume @Watch('closeFullScreen') pageHide: number
36 @Consume contentId: string 36 @Consume contentId: string
37 @State swiperIndex: number = 1 37 @State swiperIndex: number = 1
38 -  
39 - @Consume liveDetailPageLogic :LiveDetailPageLogic 38 + @Consume liveDetailPageLogic: LiveDetailPageLogic
40 39
41 aboutToAppear(): void { 40 aboutToAppear(): void {
42 this.openFullScreen() 41 this.openFullScreen()
@@ -62,7 +61,7 @@ export struct DetailPlayVLivePage { @@ -62,7 +61,7 @@ export struct DetailPlayVLivePage {
62 61
63 build() { 62 build() {
64 63
65 - Stack() { 64 + Stack({ alignContent: Alignment.Top }) {
66 // 直播背景图,模糊处理 65 // 直播背景图,模糊处理
67 Image(this.liveDetailPageLogic.imgUrl) 66 Image(this.liveDetailPageLogic.imgUrl)
68 .height('100%') 67 .height('100%')
@@ -79,13 +78,33 @@ export struct DetailPlayVLivePage { @@ -79,13 +78,33 @@ export struct DetailPlayVLivePage {
79 LiveEmptyComponent({ 78 LiveEmptyComponent({
80 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend 79 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
81 }) 80 })
82 - .height('60%') 81 + .height('30%').margin({top:this.topSafeHeight })
83 } else { 82 } else {
  83 +
  84 + if (this.liveDetailPageLogic.showPad) {
  85 + // 有垫片
  86 + if(this.liveDetailPageLogic.padImageUri.length > 0){
  87 + // 配置了垫片资源
  88 + Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%')
  89 +
  90 + }else {
  91 + // 没有配置垫片资源
  92 + LiveEmptyComponent({
  93 + emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
  94 + })
  95 + .height('30%').margin({top:this.topSafeHeight })
  96 + }
  97 +
  98 +
  99 + } else {
  100 + // 播放器
84 PlayerComponent({ 101 PlayerComponent({
85 playerController: this.playerController 102 playerController: this.playerController
86 }) 103 })
87 } 104 }
  105 + }
88 106
  107 + // 直播详情 左右滑动业务数据
89 PlayerInfoComponent({ 108 PlayerInfoComponent({
90 playerController: this.playerController, 109 playerController: this.playerController,
91 swiperController: this.swiperController, 110 swiperController: this.swiperController,
1 import { ContentDetailDTO } from 'wdBean/Index' 1 import { ContentDetailDTO } from 'wdBean/Index'
2 2
3 - 3 +const TAG = 'LiveDetailPageLogic'
4 /** 4 /**
5 * 直播信息对象逻辑加工处理的工具类 5 * 直播信息对象逻辑加工处理的工具类
6 */ 6 */
@@ -14,6 +14,10 @@ export class LiveDetailPageLogic { @@ -14,6 +14,10 @@ export class LiveDetailPageLogic {
14 // 预告片图片/视频url 14 // 预告片图片/视频url
15 imgUrl: string = '' 15 imgUrl: string = ''
16 16
  17 + // 垫片资源
  18 + padImageUri:string = ''
  19 + // 垫片是否开启
  20 + showPad:boolean = false
17 21
18 22
19 /** 23 /**
@@ -42,15 +46,42 @@ export class LiveDetailPageLogic { @@ -42,15 +46,42 @@ export class LiveDetailPageLogic {
42 46
43 47
44 /** 48 /**
45 - * 解析背景图片资源 49 + * 解析直播间的图片资源
46 */ 50 */
47 - resolvingRoomBackgroundImgUrl() { 51 + resolvingRoomImgSource() {
48 52
  53 + // 背景图资源
49 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl && 54 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&
50 this.contentDetailData.liveInfo.previewUrl.length > 0) { 55 this.contentDetailData.liveInfo.previewUrl.length > 0) {
51 this.imgUrl = this.contentDetailData.liveInfo.previewUrl 56 this.imgUrl = this.contentDetailData.liveInfo.previewUrl
52 } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { 57 } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
53 this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url 58 this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url
54 } 59 }
  60 +
  61 + // 垫图资源
  62 + if (this.contentDetailData.liveInfo){
  63 +
  64 + if(this.contentDetailData.liveInfo.padImageUri.length > 0){
  65 + this.padImageUri =this.contentDetailData.liveInfo.padImageUri
  66 + }
  67 + //this.padImageUri = 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240515/image/display/cdb84fe86b1440d58f3fc585841b928d.jpg'
  68 +
  69 + }
  70 +
  71 + console.log(TAG, ' this.imgUrl===>', this.imgUrl)
  72 + }
  73 +
  74 + /**
  75 + * 解析直播详情里面的 vlive资源
  76 + * @param index
  77 + */
  78 + resolvingRoomVliveData(index:number){
  79 +
  80 + // 只有直播中的才会有垫片
  81 + if(this.liveState === 'running'){
  82 +
  83 + this.showPad = this.contentDetailData.liveInfo.vlive[index].showPad
  84 + }
  85 +
55 } 86 }
56 } 87 }
@@ -4,6 +4,8 @@ import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from ' @@ -4,6 +4,8 @@ import { PlayerConstants, WDAliPlayerController, WDPlayerRenderLiveView } from '
4 import { PlayUIComponent } from './PlayUIComponent'; 4 import { PlayUIComponent } from './PlayUIComponent';
5 import { PictureLoading } from '../../vertical/PictureLoading'; 5 import { PictureLoading } from '../../vertical/PictureLoading';
6 import { TrackConstants } from 'wdTracking/Index'; 6 import { TrackConstants } from 'wdTracking/Index';
  7 +import { LiveDetailPageLogic } from '../../../viewModel/LiveDetailPageLogic';
  8 +import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
7 9
8 const TAG: string = 'TopPlayComponent' 10 const TAG: string = 'TopPlayComponent'
9 11
@@ -32,6 +34,7 @@ export struct TopPlayComponent { @@ -32,6 +34,7 @@ export struct TopPlayComponent {
32 @Provide playSourceState: number = 0 34 @Provide playSourceState: number = 0
33 private playUrl: string = "" 35 private playUrl: string = ""
34 private xComponentIsLoaded: boolean = false 36 private xComponentIsLoaded: boolean = false
  37 + @Consume liveDetailPageLogic: LiveDetailPageLogic
35 38
36 aboutToAppear(): void { 39 aboutToAppear(): void {
37 if (this.playerController) { 40 if (this.playerController) {
@@ -66,6 +69,15 @@ export struct TopPlayComponent { @@ -66,6 +69,15 @@ export struct TopPlayComponent {
66 * 更新直播播放数据 69 * 更新直播播放数据
67 */ 70 */
68 updateData() { 71 updateData() {
  72 +
  73 + // 检测垫片
  74 + if (this.liveDetailPageLogic.showPad){
  75 + this.isHideLoading = true
  76 + this.isWait = true
  77 + this.previewUrl = this.liveDetailPageLogic.imgUrl
  78 + return
  79 + }
  80 +
69 // 检测直播等待状态的直播预告是否视频资源 81 // 检测直播等待状态的直播预告是否视频资源
70 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 82 if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1
71 && this.contentDetailData?.liveInfo?.liveState == 'wait' 83 && this.contentDetailData?.liveInfo?.liveState == 'wait'
@@ -140,7 +152,8 @@ export struct TopPlayComponent { @@ -140,7 +152,8 @@ export struct TopPlayComponent {
140 this.previewUrl = '' 152 this.previewUrl = ''
141 } 153 }
142 } 154 }
143 - // Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd+' -->'+this.isVideoSource) 155 + Logger.debug(TAG,
  156 + `---0------>` + this.isWait + ' ->' + this.isHideLoading + ' ->' + this.isEnd + ' -->' + this.isVideoSource)
144 } 157 }
145 158
146 tryToPlay() { 159 tryToPlay() {
@@ -163,6 +176,11 @@ export struct TopPlayComponent { @@ -163,6 +176,11 @@ export struct TopPlayComponent {
163 176
164 build() { 177 build() {
165 Stack() { 178 Stack() {
  179 +
  180 + if (this.liveDetailPageLogic.showPad) {
  181 +
  182 +
  183 + } else {
166 // 视频资源播放 184 // 视频资源播放
167 WDPlayerRenderLiveView({ 185 WDPlayerRenderLiveView({
168 playerController: this.playerController, 186 playerController: this.playerController,
@@ -179,6 +197,8 @@ export struct TopPlayComponent { @@ -179,6 +197,8 @@ export struct TopPlayComponent {
179 .height('100%') 197 .height('100%')
180 .width('100%') 198 .width('100%')
181 .visibility(this.isWait ? Visibility.None : Visibility.Visible) 199 .visibility(this.isWait ? Visibility.None : Visibility.Visible)
  200 + }
  201 +
182 202
183 if (this.isVideoSource) { 203 if (this.isVideoSource) {
184 204
@@ -187,10 +207,25 @@ export struct TopPlayComponent { @@ -187,10 +207,25 @@ export struct TopPlayComponent {
187 Image(this.previewUrl) 207 Image(this.previewUrl)
188 .objectFit(ImageFit.Cover) 208 .objectFit(ImageFit.Cover)
189 .alt($r('app.media.live_room_image_fail')) 209 .alt($r('app.media.live_room_image_fail'))
190 - .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None)  
191 - // .contrast(this.isEnd ? 0.4 : 1) 210 + .visibility(this.isWait || this.isEnd ? Visibility.Visible :
  211 + Visibility.None)// .contrast(this.isEnd ? 0.4 : 1)
192 .blur(this.isEnd ? 20 : 0) 212 .blur(this.isEnd ? 20 : 0)
193 .width('100%') 213 .width('100%')
  214 +
  215 + if (this.liveDetailPageLogic.showPad) {
  216 + // 有垫片
  217 + if (this.liveDetailPageLogic.padImageUri.length > 0) {
  218 + // 配置了垫片资源
  219 + Image(this.liveDetailPageLogic.padImageUri).objectFit(ImageFit.Fill).width('100%').height('100%')
  220 +
  221 + } else {
  222 + // 没有配置垫片资源
  223 + LiveEmptyComponent({
  224 + emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
  225 + }).width('100%').height('100%')
  226 + }
  227 +
  228 + }
194 } 229 }
195 230
196 // loading 231 // loading
@@ -13,6 +13,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; @@ -13,6 +13,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
13 import { WDPlayerController } from 'wdPlayer/Index'; 13 import { WDPlayerController } from 'wdPlayer/Index';
14 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 14 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
15 import { SpConstants } from 'wdConstant/Index' 15 import { SpConstants } from 'wdConstant/Index'
  16 +import { WDShare } from 'wdShare/Index';
16 17
17 export interface OperationItem { 18 export interface OperationItem {
18 icon: Resource; 19 icon: Resource;
@@ -282,7 +283,7 @@ export struct OperationListView { @@ -282,7 +283,7 @@ export struct OperationListView {
282 .width(32) 283 .width(32)
283 .aspectRatio(1) 284 .aspectRatio(1)
284 .onClick((event: ClickEvent) => { 285 .onClick((event: ClickEvent) => {
285 - ToastUtils.showToast('分享为公共方法,待开发', 1000); 286 + WDShare.shareContent(this.contentDetailData)
286 }) 287 })
287 Text(item.text) 288 Text(item.text)
288 .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown) 289 .width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
@@ -22,7 +22,18 @@ export class WDShare { @@ -22,7 +22,18 @@ export class WDShare {
22 } 22 }
23 23
24 static shareProgram(program: ContentDTO, pageName: string ="", pageId: string = "") { 24 static shareProgram(program: ContentDTO, pageName: string ="", pageId: string = "") {
  25 + //TODO: 处理分享弹框交互和 海报逻辑
25 26
  27 + WDShareBase.getInstance().share({
  28 + to: ShareType.System,
  29 + scene: ShareScene.System,
  30 + type: ShareContentType.Link,
  31 + obj: {
  32 + title: program.shareInfo.shareTitle,
  33 + desc: program.shareInfo.shareSummary,
  34 + link: program.shareInfo.shareUrl,
  35 + }
  36 + })
26 } 37 }
27 38
28 static shareSubject(subject: PageInfoDTO) { 39 static shareSubject(subject: PageInfoDTO) {
@@ -32,21 +43,21 @@ export class WDShare { @@ -32,21 +43,21 @@ export class WDShare {
32 43
33 //专题分享数据转换 44 //专题分享数据转换
34 static setTopicBeanToShareBean(shareBean: ShareInfoDTO, topicInfoBean: TopicInfo){ 45 static setTopicBeanToShareBean(shareBean: ShareInfoDTO, topicInfoBean: TopicInfo){
35 - shareBean.topicType = topicInfoBean.topicType+'' 46 + shareBean.appCustomTopicType = topicInfoBean.topicType+''
36 //21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题,26:时间链 47 //21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题,26:时间链
37 if(25 == topicInfoBean.topicType){ 48 if(25 == topicInfoBean.topicType){
38 - shareBean.showPosterType = 6  
39 - shareBean.topicPattern = topicInfoBean.topicPattern  
40 - shareBean.publishTime = topicInfoBean.topicDate 49 + shareBean.appCustomShowPosterType = 6
  50 + shareBean.appCustomTopicPattern = topicInfoBean.topicPattern
  51 + shareBean.appCustomPublishTime = topicInfoBean.topicDate
41 if(topicInfoBean.frontLinkObject == null){ 52 if(topicInfoBean.frontLinkObject == null){
42 - shareBean.isFrontDaily = false 53 + shareBean.appCustomIsFrontDaily = false
43 if(topicInfoBean.shareContentList != null && topicInfoBean.shareContentList.length>0){ 54 if(topicInfoBean.shareContentList != null && topicInfoBean.shareContentList.length>0){
44 - shareBean.sharePosterItemList = [] as SharePosterItemBean[]  
45 - shareBean.sharePosterItemList.length = topicInfoBean.shareContentList.length 55 + shareBean.appCustomSharePosterItemList = [] as SharePosterItemBean[]
  56 + shareBean.appCustomSharePosterItemList.length = topicInfoBean.shareContentList.length
46 for (let index = 0; index < topicInfoBean.shareContentList.length; index++) { 57 for (let index = 0; index < topicInfoBean.shareContentList.length; index++) {
47 let element = topicInfoBean.shareContentList[index] 58 let element = topicInfoBean.shareContentList[index]
48 if(element != null){ 59 if(element != null){
49 - shareBean.sharePosterItemList[index] = { 60 + shareBean.appCustomSharePosterItemList[index] = {
50 title:topicInfoBean.shareContentList[index].newsTitle, 61 title:topicInfoBean.shareContentList[index].newsTitle,
51 imageUrl:topicInfoBean.shareContentList[index].coverUrl, 62 imageUrl:topicInfoBean.shareContentList[index].coverUrl,
52 } as SharePosterItemBean 63 } as SharePosterItemBean
@@ -54,25 +65,25 @@ export class WDShare { @@ -54,25 +65,25 @@ export class WDShare {
54 } 65 }
55 } 66 }
56 }else{ 67 }else{
57 - shareBean.isFrontDaily = true 68 + shareBean.appCustomIsFrontDaily = true
58 shareBean.sharePosterCoverUrl = topicInfoBean.frontLinkObject.coverUrl 69 shareBean.sharePosterCoverUrl = topicInfoBean.frontLinkObject.coverUrl
59 - shareBean.posterSummary = topicInfoBean.frontLinkObject.summary 70 + shareBean.appCustomPosterSummary = topicInfoBean.frontLinkObject.summary
60 } 71 }
61 }else{ 72 }else{
62 //文章/直播/话题专题(H5普通文章专题,包含时间链) 73 //文章/直播/话题专题(H5普通文章专题,包含时间链)
63 - shareBean.showPosterType = 8 74 + shareBean.appCustomShowPosterType = 8
64 //海报的头图 75 //海报的头图
65 shareBean.sharePosterCoverUrl = topicInfoBean.backgroundImgUrl 76 shareBean.sharePosterCoverUrl = topicInfoBean.backgroundImgUrl
66 - shareBean.isFrontDaily = false  
67 - shareBean.posterTitle = topicInfoBean.title  
68 - shareBean.posterSummary = topicInfoBean.summary 77 + shareBean.appCustomIsFrontDaily = false
  78 + shareBean.appCustomPosterTitle = topicInfoBean.title
  79 + shareBean.appCustomPosterSummary = topicInfoBean.summary
69 if(topicInfoBean.shareContentList != null && topicInfoBean.shareContentList.length>0){ 80 if(topicInfoBean.shareContentList != null && topicInfoBean.shareContentList.length>0){
70 - shareBean.sharePosterItemList = [] as SharePosterItemBean[]  
71 - shareBean.sharePosterItemList.length = topicInfoBean.shareContentList.length 81 + shareBean.appCustomSharePosterItemList = [] as SharePosterItemBean[]
  82 + shareBean.appCustomSharePosterItemList.length = topicInfoBean.shareContentList.length
72 for (let index = 0; index < topicInfoBean.shareContentList.length; index++) { 83 for (let index = 0; index < topicInfoBean.shareContentList.length; index++) {
73 let element = topicInfoBean.shareContentList[index] 84 let element = topicInfoBean.shareContentList[index]
74 if(element != null){ 85 if(element != null){
75 - shareBean.sharePosterItemList[index] = { 86 + shareBean.appCustomSharePosterItemList[index] = {
76 title:topicInfoBean.shareContentList[index].newsTitle, 87 title:topicInfoBean.shareContentList[index].newsTitle,
77 imageUrl:topicInfoBean.shareContentList[index].coverUrl, 88 imageUrl:topicInfoBean.shareContentList[index].coverUrl,
78 timeNode:topicInfoBean.shareContentList[index].publishTime, 89 timeNode:topicInfoBean.shareContentList[index].publishTime,
@@ -138,10 +138,12 @@ struct LaunchAdvertisingPage { @@ -138,10 +138,12 @@ struct LaunchAdvertisingPage {
138 }) 138 })
139 } 139 }
140 if(this.defaultModel.screenType === '1') { 140 if(this.defaultModel.screenType === '1') {
  141 + Column(){
141 Image($r('app.media.LaunchPage_logo')) 142 Image($r('app.media.LaunchPage_logo'))
142 .width('278lpx') 143 .width('278lpx')
143 .height('154lpx') 144 .height('154lpx')
144 - .margin({top: '28lpx',bottom:'28lpx'}) 145 + .margin({top:20})
  146 + }.width('100%').height('16%').backgroundColor(Color.White).expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
145 } 147 }
146 } 148 }
147 .width('100%') 149 .width('100%')