Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
王士厅
2024-08-26 17:15:37 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f5a5e94f2e986df92283f52c6f22d55812c4a156
f5a5e94f
1 parent
9083bf96
fix: 音频悬浮窗跳转稿件详情开发部分,注释log代码
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
56 deletions
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
sight_harmony/commons/wdRouter/src/main/ets/router/WDRouterRule.ets
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperItemComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/products/phone/src/main/ets/pages/view/AudioComponent.ets
sight_harmony/commons/wdConstant/src/main/ets/constants/SpConstants.ets
View file @
f5a5e94
...
...
@@ -47,6 +47,9 @@ export class SpConstants{
//国殇模式数据存储key
static APP_MOURNS_INFO_DATA_MODEL = 'app_mourns_info_model'
//稿件详情音频播放跳转存储key
static APP_NEWS_INFO_DATA_MODEL = 'app_news_info_model'
//频道信息流页面左右挂角
static APP_PAGE_CORNER_ADV = 'app_page_corner_adv_'
...
...
sight_harmony/commons/wdRouter/src/main/ets/router/WDRouterRule.ets
View file @
f5a5e94
...
...
@@ -28,12 +28,10 @@ export class WDRouterRule {
}
if (params) {
// router.pushUrl({ url: 'pages/routerpage2', , params: params })
console.log('page.url()==',page.url(),JSON.stringify(params))
//
console.log('page.url()==',page.url(),JSON.stringify(params))
router.pushUrl({ url: page.url(), params: params })
} else {
router.pushUrl({ url: page.url() }, mode).catch((error: Error) => {
console.log("err", JSON.stringify(error)) //100002 uri is not exist
})
router.pushUrl({ url: page.url() }, mode)
}
} else {
ToastUtils.showToast("功能开发中", 1000);
...
...
@@ -50,9 +48,7 @@ export class WDRouterRule {
// router.pushUrl({ url: 'pages/routerpage2', , params: params })
router.replaceUrl({ url: page.url(), params: params })
} else {
router.replaceUrl({ url: page.url() }).catch((error:Error)=>{
console.log("err",JSON.stringify(error))//100002 uri is not exist
})
router.replaceUrl({ url: page.url() })
}
} else {
ToastUtils.showToast("功能开发中", 1000);
...
...
sight_harmony/commons/wdRouter/src/main/ets/utils/ProcessUtils.ets
View file @
f5a5e94
...
...
@@ -170,11 +170,11 @@ export class ProcessUtils {
*/
static processPage(content: ContentDTO) {
if (content == null) {
Logger.error(TAG, "processPage, content is null");
//
Logger.error(TAG, "processPage, content is null");
return;
}
if (StringUtils.isEmpty(content.objectType)) {
Logger.error(TAG, "processPage, objectType is empty");
//
Logger.error(TAG, "processPage, objectType is empty");
return;
}
// 网络出小差了,请检查网络后重试
...
...
@@ -189,13 +189,13 @@ export class ProcessUtils {
if (typeof type == "number") {
type = `${type}`
}
console.log(TAG, 'objectType', `${JSON.stringify(content)}`);
//
console.log(TAG, 'objectType', `${JSON.stringify(content)}`);
switch (type) {
case ContentConstants.TYPE_NONE:
Logger.debug(TAG, "processPage, do nothing");
//
Logger.debug(TAG, "processPage, do nothing");
break;
case ContentConstants.TYPE_VOD:
Logger.debug(TAG, "processPage, nonsupport!!!");
//
Logger.debug(TAG, "processPage, nonsupport!!!");
ProcessUtils.gotoVod(content)
break;
case ContentConstants.TYPE_LIVE:
...
...
@@ -432,7 +432,7 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoH5NewsWeb, ${content.objectId}`);
//
Logger.debug(TAG, `gotoH5NewsWeb, ${content.objectId}`);
}
public static gotoWeb(content: ContentDTO) {
...
...
@@ -454,7 +454,7 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
//
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}
public static gotoVod(content: ContentDTO) {
...
...
@@ -473,7 +473,7 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoVod, ${content.objectId}`);
//
Logger.debug(TAG, `gotoVod, ${content.objectId}`);
}
/**
...
...
@@ -495,7 +495,7 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoLive, ${content.objectId}`);
//
Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
//音频详情页
...
...
@@ -514,7 +514,7 @@ export class ProcessUtils {
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAudio, ${content.objectId}`);
//
Logger.debug(TAG, `gotoAudio, ${content.objectId}`);
}
/**
...
...
@@ -538,7 +538,7 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
//
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
}
/**
...
...
@@ -561,7 +561,7 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
//
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
}
/**
...
...
@@ -575,11 +575,12 @@ export class ProcessUtils {
entities: ['entity.system.browsable'],
uri: url
}
context.startAbility(wantInfo).then(() => {
Logger.debug(TAG, 'jumpExternalWebPage success')
}).catch((err: BusinessError) => {
Logger.error(TAG, 'jumpExternalWebPage success, error: ' + JSON.stringify(err))
})
context.startAbility(wantInfo)
// .then(() => {
// Logger.debug(TAG, 'jumpExternalWebPage success')
// }).catch((err: BusinessError) => {
// Logger.error(TAG, 'jumpExternalWebPage success, error: ' + JSON.stringify(err))
// })
}
/**
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperItemComponent.ets
View file @
f5a5e94
...
...
@@ -79,7 +79,7 @@ export struct ENewspaperItemComponent {
this.startX = x;
this.startY = y;
let points: number[][] = this.getArea(x, y, this.newspaperListItemBean.items);
console.log("event.points", JSON.stringify(points))
//
console.log("event.points", JSON.stringify(points))
if (points && points.length > 2) {
let path = new Path2D();
path.moveTo(px2vp(points[0][0]), px2vp(points[0][1]));
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
f5a5e94
...
...
@@ -27,6 +27,7 @@ import { common } from '@kit.AbilityKit';
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent';
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { ColorUtils } from '../../utils/ColorUtils';
import { SpConstants } from 'wdConstant';
const TAG = 'MorningEveningPaperComponent';
...
...
@@ -35,7 +36,7 @@ const TAG = 'MorningEveningPaperComponent';
@Component
export struct MorningEveningPaperComponent {
@State pageInfoBean: PageInfoBean = {} as PageInfoBean
//
@State compInfoBean: CompInfoBean = {} as CompInfoBean
@State compInfoBean: CompInfoBean = {} as CompInfoBean
@State compListItem: CompList = {} as CompList
@Provide commentList: InteractDataDTO[] = []
@State audioPlayUrl: string = ""
...
...
@@ -96,14 +97,14 @@ export struct MorningEveningPaperComponent {
private AudioSuspension = new AudioSuspensionModel()
onCancel() {
console.log(TAG, "cj2024 onCancel = ")
//
console.log(TAG, "cj2024 onCancel = ")
}
/**
* 回调无用
**/
onConfirm() {
console.log(TAG, "cj2024 onConfirm = ")
//
console.log(TAG, "cj2024 onConfirm = ")
// if (this.playerController != undefined) {
//
// }
...
...
@@ -113,10 +114,10 @@ export struct MorningEveningPaperComponent {
// 续播判断
changeContinue() {
console.log(TAG, "cj2024 changeContinue = 1")
//
console.log(TAG, "cj2024 changeContinue = 1")
// if (this.nextContId) {
this.playerController.continue = () => {
console.log(TAG, "cj2024 changeContinue = 2")
//
console.log(TAG, "cj2024 changeContinue = 2")
this.playerController?.stop();
// this.playVM.playWithContentId(this.nextContId ?? '');
}
...
...
@@ -128,10 +129,10 @@ export struct MorningEveningPaperComponent {
async aboutToAppear() {
this.dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as string
console.info(TAG, `aboutToAppear = ` + this.dailyPaperTopicPageId)
//
console.info(TAG, `aboutToAppear = ` + this.dailyPaperTopicPageId)
const currentTime = new Date().getTime()
console.log(TAG, "currentTime = " + currentTime)
console.log(TAG, `currentTime = ${currentTime}`)
// console.log(TAG, "currentTime = " + currentTime)
// console.log(TAG, `currentTime = ${currentTime}`)
try {
// let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
...
...
@@ -144,46 +145,44 @@ export struct MorningEveningPaperComponent {
let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN)
const dateShow = new Date(dateTime)
this.subTitle = `${dateShow.getFullYear()}年\n${(dateShow.getMonth() + 1)}月${dateShow.getDate()}日`
console.log(TAG, "pageInfoBean topicDate = " + this.pageInfoBean?.topicInfo?.topicDate)
console.log(TAG, "pageInfoBean title = " + this.pageInfoBean?.topicInfo?.title)
console.log(TAG, "pageInfoBean dateTime = " + dateTime)
console.log(TAG, "pageInfoBean subTitle = " + this.subTitle)
console.log(TAG, "this.pageInfoBean = " + JSON.stringify(this.pageInfoBean))
// console.log(TAG, "pageInfoBean topicDate = " + this.pageInfoBean?.topicInfo?.topicDate)
// console.log(TAG, "pageInfoBean title = " + this.pageInfoBean?.topicInfo?.title)
//
// console.log(TAG, "pageInfoBean dateTime = " + dateTime)
// console.log(TAG, "pageInfoBean subTitle = " + this.subTitle)
//
// console.log(TAG, "this.pageInfoBean = " + JSON.stringify(this.pageInfoBean))
this.isHasTopView = this.pageInfoBean?.topicInfo?.frontLinkObject?true:false
let coverUrl = this.isHasTopView?this.pageInfoBean?.topicInfo?.frontLinkObject?.coverUrl as string :''
this.setComponentBgColor(coverUrl)
// this.compInfoBean = compInfoBean
//信息流缓存
let BeanString = SPHelper.default.getSync('MorningEveningComp'+this.dailyPaperTopicPageId,'') as string
let compInfoBean = {} as CompInfoBean
if (BeanString.length > 0) {
compInfoBean = JSON.parse(BeanString)
}else {
}
else {
SPHelper.default.delete('MorningEveningComp'+this.dailyPaperTopicPageId)
compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId)
SPHelper.default.saveSync('MorningEveningComp'+this.dailyPaperTopicPageId,JSON.stringify(compInfoBean))
}
console.log(TAG, "compInfoBean = " + JSON.stringify(compInfoBean))
if (compInfoBean?.compList[0]) {
this.compListItem = compInfoBean?.compList[0]
console.log(TAG, '获取评论数据' + `${this.compListItem.operDataList.length}`)
//
console.log(TAG, '获取评论数据' + `${this.compListItem.operDataList.length}`)
if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) {
this.getAllContentInteractData(this.compListItem.operDataList)
}
console.log(TAG, 'compInfoBean?.compList[0].audioDataList', JSON.stringify(compInfoBean?.compList[0].audioDataList))
//
console.log(TAG, 'compInfoBean?.compList[0].audioDataList', JSON.stringify(compInfoBean?.compList[0].audioDataList))
if (compInfoBean?.compList[0].audioDataList.length > 0) {
this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0]?.audioUrl
this.audioTitle = compInfoBean?.compList[0].audioDataList[0]?.title
console.log(TAG, 'this.audioPlayUrl', this.audioPlayUrl)
//
console.log(TAG, 'this.audioPlayUrl', this.audioPlayUrl)
}
}
console.log(TAG, "compInfoBean compStyle = " + compInfoBean.compList[0].compStyle)
//
console.log(TAG, "compInfoBean compStyle = " + compInfoBean.compList[0].compStyle)
this.playerController.onTimeUpdate = (position, duration) => {
this.currentTime = DateFormatUtil.secondToTime(position);
this.totalTime = DateFormatUtil.secondToTime(duration);
...
...
@@ -195,6 +194,11 @@ export struct MorningEveningPaperComponent {
compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId)
SPHelper.default.saveSync('MorningEveningComp'+this.dailyPaperTopicPageId,JSON.stringify(compInfoBean))
}
// 音频悬浮窗跳转数据
this.compInfoBean = compInfoBean
// console.log('AudioSuspensionModel', "compInfoBean = " + JSON.stringify(compInfoBean))
// console.log('AudioSuspensionModel', "compInfoBean11 = " + JSON.stringify(this.compInfoBean))
} catch (exception) {
this.isContentFailed = true
...
...
@@ -219,10 +223,10 @@ export struct MorningEveningPaperComponent {
contentType: Number(item.objectType ?? '1')
})
})
console.log(TAG, '获取评论数据' + `${JSON.stringify(params)}`)
//
console.log(TAG, '获取评论数据' + `${JSON.stringify(params)}`)
this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params)
console.log(TAG, '获取评论数据' + `${JSON.stringify(this.commentList)}`)
//
console.log(TAG, '获取评论数据' + `${JSON.stringify(this.commentList)}`)
} catch (exception) {
...
...
@@ -232,7 +236,7 @@ export struct MorningEveningPaperComponent {
async setComponentBgColor(imageUrl: string) {
// 图片转换为PixelMap对象
// const pixelMap: image.PixelMap = await image2PixelMap(item.icon);
console.log(TAG, "compInfoBean compStyle = " + imageUrl)
//
console.log(TAG, "compInfoBean compStyle = " + imageUrl)
if (this.pageInfoBean.backgroundColor.length > 0){
let colorDatas = ColorUtils.hexColorValueToRGB(this.pageInfoBean.backgroundColor)
...
...
@@ -270,11 +274,11 @@ export struct MorningEveningPaperComponent {
const pixelMap: image.PixelMap = await imageNet2PixelMap(imageSource);
effectKit.createColorPicker(pixelMap, (err, colorPicker) => {
let color = colorPicker.getLargestProportionColor();
console.log(TAG, "compInfoBean compStyle = " + color)
//
console.log(TAG, "compInfoBean compStyle = " + color)
color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#ff" + color.alpha.toString(16) + color.red.toString(16).padStart(2,'0') + color.green.toString(16).padStart(2,'0') + color.blue.toString(16).padStart(2,'0');
console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
//
console.log(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
});
}
}
...
...
@@ -398,12 +402,13 @@ export struct MorningEveningPaperComponent {
.margin({ left: this.currentStatus === PlayerConstants.STATUS_START ?6:9 })// .alignSelf(ItemAlign.Center)
.objectFit(ImageFit.Contain)
.onClick(() => {
console.log("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying)
//
console.log("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying)
// dialog.open()
// this.playerController.firstPlay(this.audioPlayUrl, this.audioTitle)
// SPHelper.default.save(SpConstants.APP_NEWS_INFO_DATA_MODEL, JSON.stringify(this.compInfoBean))
this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle)
console.log(TAG, "this.audioPlayUrl = " + this.audioPlayUrl)
console.log("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying)
// console.log(TAG, "this.audioPlayUrl = " + this.audioPlayUrl)
// console.log("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying)
})
}
.height('100%')
...
...
sight_harmony/products/phone/src/main/ets/pages/view/AudioComponent.ets
View file @
f5a5e94
import { AudioSuspensionModel } from 'wdComponent'
import { PlayerConstants, DateFormatUtil } from 'wdPlayer'
import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
import { EmitterEventId, EmitterUtils
, SPHelper
} from 'wdKit/Index'
import window from '@ohos.window';
import lottie from '@ohos/lottie';
import { LottieView } from 'wdComponent/Index'
// import { ProcessUtils } from 'wdRouter';
// import { CompInfoBean, ContentDTO } from 'wdBean';
// import { SpConstants } from 'wdConstant';
const TAG = 'AudioSuspensionModel'
...
...
@@ -153,6 +156,19 @@ struct Index {
.width(243)
.height(60)
.justifyContent(FlexAlign.Start)
.onClick(() => {
// let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_NEWS_INFO_DATA_MODEL,'') as string
// console.log(TAG, dataModelStr)
// let dataModel : CompInfoBean = JSON.parse(dataModelStr)
// // //公共跳转
// let content: ContentDTO = {
// objectId: this.itemBeanClicked.newsId + '',
// objectType: this.itemBeanClicked.newsType + '',
// relId: this.itemBeanClicked.relId + '',
// relType: this.itemBeanClicked.relType ?? '0'
// } as ContentDTO
// ProcessUtils.processPage(content)
})
Row() {
Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause_svg") : $r("app.media.icon_audio_playing_svg"))
...
...
Please
register
or
login
to post a comment