王士厅
... ... @@ -15,3 +15,5 @@ export { AssignChannelParam } from './src/main/ets/utils/HomeChannelUtils';
export { RouterJumpInterceptor, JumpInterceptorAction } from './src/main/ets/router/RouterJumpInterceptor'
export { AppInnerLink } from './src/main/ets/utils/AppInnerLink'
export { ContentType } from './src/main/ets/common/ContentType'
\ No newline at end of file
... ...
export enum ContentType {
/// 不跳转
Unknown = 0,
///点播
Video = 1,
///直播
Live = 2,
///活动
Activity = 3,
///信息流广告
InfoflowAD = 4,
///专题
Subject = 5,
///链接
Link = 6,
///榜单
RankList = 7,
/// 图文
ImageText = 8,
/// 组图
Pictures = 9,
/// H5新闻 (仅海外版存在,视界和中文端无此类型。中文端按照图文8类型+link)
H5News = 10,
/// 频道
Channel = 11,
///组件
Module = 12,
///音频
Audio = 13,
///动态图文
DynamicImageText = 14,
///动态视频
DynamicVideo = 15,
///问政留言
Ask = 16,
/// 金刚位
KeyPosition = 30,
/// 合集
Serials = 101,
}
\ No newline at end of file
... ...
... ... @@ -39,6 +39,8 @@ export interface ShareContentLink {
desc?: string
link: string
icon?: string
deeplink: string // 根据内容详情,生成的深度链接 如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1
}
export type ShareContent = ShareContentText | ShareContentImageAndText | ShareContentLink
... ...
... ... @@ -6,6 +6,9 @@ import { AsyncCallback } from '@kit.BasicServicesKit';
import { common } from '@kit.AbilityKit';
import { systemShare } from '@kit.ShareKit';
import { uniformTypeDescriptor as utd } from '@kit.ArkData';
import { JSON } from '@kit.ArkTS';
const TAG = "WDSystemShare"
export class WDSystemShare implements WDShareInterface {
... ... @@ -14,7 +17,8 @@ export class WDSystemShare implements WDShareInterface {
return new Promise((resolve, fail) => {
try {
let controller: systemShare.ShareController = new systemShare.ShareController(this.getShareData(content, contentType));
let data = this.getShareData(content, contentType)
let controller: systemShare.ShareController = new systemShare.ShareController(data);
let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
controller.on('dismiss', () => {
... ... @@ -53,7 +57,7 @@ export class WDSystemShare implements WDShareInterface {
});
data.addRecord({
utd: utd.UniformDataType.PNG,
uri: imageAndText.imgURI
uri: imageAndText.imgURI // 这里必须为本地连接
});
return data
}
... ... @@ -64,12 +68,35 @@ export class WDSystemShare implements WDShareInterface {
utd: utd.UniformDataType.PLAIN_TEXT,
content: link.title
});
let shareLink = this.generateShareLink(link)
console.log("分享 shareLink ==> " + shareLink)
data.addRecord({
utd: utd.UniformDataType.HYPERLINK,
uri: link.link
// uri: link.link // SDK 设计 不能传这里
content: link.link
});
return data
}
generateShareLink(shareContent: ShareContentLink) {
let link = "https://peopledailychinahosactivity.drcn.agconnect.link?deeplink=" + encodeURIComponent(shareContent.deeplink)
link += "&harmonyos_deeplink=" + encodeURIComponent(shareContent.deeplink)
link += "&harmonyos_package_name=com.peopledailychina.hosactivity"
link += "&harmonyos_fallback_url=" + encodeURIComponent(shareContent.link)
// link += "&android_deeplink=" + encodeURIComponent(shareContent.deeplink)
// link += "&android_fallback_url=" + encodeURIComponent(shareContent.link)
//
// link += "&ios_link=" + encodeURIComponent(shareContent.deeplink)
// link += "&ios_fallback_url=" + encodeURIComponent(shareContent.link)
link += "&preview_type=1"
link += "&landing_page_type=1"
// link += "&social_desc=" + encodeURIComponent(shareContent.desc || " ")
// link += "&social_image=" + encodeURIComponent(shareContent.icon || " ")
// link += "&social_title=" + encodeURIComponent(shareContent.title)
link += "&region_id=0"
return link
}
}
\ No newline at end of file
... ...
... ... @@ -112,13 +112,12 @@ export struct QualityCommentsComponent {
Image($r('app.media.comment_img_banner')).width('100%')
.height(283)
// .aspectRatio(375 / 283);
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
.onAreaChange((oldValue: Area, newValue: Area) => {
if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) {
this.firstPositionY = Number(newValue.globalPosition.y)
return
}
// if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) {
// this.firstPositionY = Number(newValue.globalPosition.y)
// return
// }
Logger.debug(TAG, "oldValue.globalPosition.y : " + oldValue.globalPosition.y)
Logger.debug(TAG,
"newValue.globalPosition.y : " + newValue.globalPosition.y + `,this.topSafeHeight : ` + this.topSafeHeight)
... ... @@ -128,9 +127,16 @@ export struct QualityCommentsComponent {
persent = 1
}
this.tileOpacity = persent
this.topOpacityChange()
})
}
topOpacityChange(){
if(this.tileOpacity > 0.8){
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}else{
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'})
}
}
/*透明导航栏*/
@Builder
... ... @@ -164,16 +170,20 @@ export struct QualityCommentsComponent {
@Builder
TabbarNormal() {
Stack({ alignContent: Alignment.Top }) {
//// 默认显示的白色返回按钮
Row() {
}
.width('100%')
.height(px2vp(this.topSafeHeight))
.backgroundColor($r('app.color.white'))
.opacity(this.tileOpacity)
.visibility(this.tileOpacity > 0 ? 0 : 1)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
Image($r('app.media.icon_arrow_left_white'))
.width(24).height(24)
.objectFit(ImageFit.Auto)
.margin({ left: 16, top: px2vp(this.topSafeHeight) + (44 - 24)/2})
.onClick(() => {
router.back()
})
}.width('100%').height(px2vp(this.topSafeHeight) + 44)
.opacity(1- this.tileOpacity)
Stack({ alignContent: Alignment.Start }) {
//// 上滑显示的黑色按钮和标题
Stack({ alignContent: Alignment.Top }) {
Row() {
Text('精选评论')// .height('42lpx')
.maxLines(1)
... ... @@ -182,25 +192,25 @@ export struct QualityCommentsComponent {
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.visibility(this.tileOpacity < 0.8 ? 1 : 0)
}
.height(44)
.width('100%')
.height(44).width('100%')
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.opacity(this.tileOpacity)
.backgroundColor($r('app.color.white'))
Image(this.tileOpacity < 0.8 ? $r('app.media.icon_arrow_left_white') : $r('app.media.icon_arrow_left'))
.width(24)
.height(24)
Row() {
Image($r('app.media.icon_arrow_left'))
.width(24).height(24)
.objectFit(ImageFit.Auto)
.margin({ left: 16 })
.margin({ left: 16, top: (44-24)/2})
.onClick(() => {
router.back()
})
}.height(44).width('100%')
}
.width('100%').height(px2vp(this.topSafeHeight) + 44)
.backgroundColor($r('app.color.white'))
.opacity(this.tileOpacity)
.padding({top:px2vp(this.topSafeHeight)})
}
}
... ...
... ... @@ -113,9 +113,11 @@ export struct TopNavigationComponentNew {
'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center },
'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom }
})
.onChange((index) => {
Logger.info(TAG, `onChange index : ${index}`);
.onAnimationStart((curIndex: number, index: number)=>{
Logger.info(TAG, `onAnimationStart ${curIndex} ${index}`);
if (curIndex === index) {
return
}
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
... ... @@ -133,7 +135,12 @@ export struct TopNavigationComponentNew {
this.currentTopNavSelectedIndex = index;
this.changePage(this.currentTopNavSelectedIndex)
}
})
// .onAnimationEnd((index: number)=>{
// Logger.info(TAG, `onAnimationEnd ${index}`);
// })
.onChange((index) => {
Logger.info(TAG, `onChange index : ${index}`);
})
}
.width('100%')
... ...
... ... @@ -7,10 +7,9 @@ import mediaquery from '@ohos.mediaquery';
import { Logger, WindowModel } from 'wdKit/Index';
import { router, window } from '@kit.ArkUI';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { LiveEmptyComponent, LiveOperRowListView } from 'wdComponent';
import { LiveOperRowListView } from 'wdComponent';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index';
import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
let TAG: string = 'DetailPlayLivePage';
... ... @@ -57,7 +56,6 @@ export struct DetailPlayLivePage {
this.getLiveDetails()
this.getLiveRoomData()
console.error(TAG, 'this.publishCommentModel', this.publishCommentModel.targetId)
}
async aboutToDisappear() {
... ...
... ... @@ -306,12 +306,13 @@ export struct PlayUIComponent {
.width(24)
.height(24)
.onClick(() => {
WindowModel.shared.setSpecificSystemBarEnabled(false)
this.displayDirection =
this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL :
DisplayDirection.VERTICAL
WindowModel.shared.setSpecificSystemBarEnabled(false)
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE_INVERTED)
... ...
... ... @@ -35,6 +35,17 @@ export struct TopPlayComponent {
private playUrl: string = ""
private xComponentIsLoaded: boolean = false
@Consume liveDetailPageLogic: LiveDetailPageLogic
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
init: boolean = false
pageShowChange() {
this.playerController?.play()
}
pageHideChange() {
this.playerController?.pause()
}
aboutToAppear(): void {
if (this.playerController) {
... ... @@ -71,7 +82,7 @@ export struct TopPlayComponent {
updateData() {
// 检测垫片
if (this.liveDetailPageLogic.showPad){
if (this.liveDetailPageLogic.showPad) {
this.isHideLoading = true
this.isWait = true
this.previewUrl = this.liveDetailPageLogic.imgUrl
... ...
... ... @@ -13,6 +13,7 @@ const TAG = "OneKeyLoginPage"
@Entry
@Component
struct OneKeyLoginPage {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
anonymousPhone: string = ''
@State agreeProtocol: boolean = false
viewModel: LoginViewModel = new LoginViewModel()
... ... @@ -121,6 +122,7 @@ struct OneKeyLoginPage {
})
}
.backgroundColor("#FFFFFF")
.padding({top: `${this.topSafeHeight}px`})
}
@Builder ProtocolRow() {
... ...
... ... @@ -43,22 +43,26 @@ export struct WDPlayerRenderLiveView {
private playerController?: WDAliPlayerController;
private xComponentController: XComponentController = new XComponentController();
onLoad?: ((event?: object) => void);
videoWidth: number = 0
videoHeight: number = 0
@State videoWidth: number = 0
@State videoHeight: number = 0
@State videoRatio: number = 16 / 9
@State selfSize: Size = new Size('100%', '100%');
private insId: string = "WDPlayerRenderLiveView" + insIndex;
aboutToAppear() {
MGPlayRenderViewIns.add();
insIndex++;
if (!this.playerController) {
return
}
//this.init = true
this.playerController.onVideoSizeChange = (width: number, height: number) => {
// console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
this.videoWidth = width;
this.videoHeight = height;
this.videoRatio = width / height
this.updateLayout()
}
}
... ... @@ -80,9 +84,9 @@ export struct WDPlayerRenderLiveView {
.onLoad(async (event) => {
Logger.info(TAG, 'onLoad')
let surfaceId = this.xComponentController.getXComponentSurfaceId()
this.xComponentController.setXComponentSurfaceSize({
surfaceWidth: 1920,
surfaceHeight: 720
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: this.videoWidth,
surfaceHeight: this.videoHeight
});
if (enableAliPlayer) {
this.playerController?.setSurfaceId(this.insId)
... ... @@ -93,8 +97,8 @@ export struct WDPlayerRenderLiveView {
this.onLoad(event)
}
})
.width(this.selfSize.width)
.height(this.selfSize.height)
// .width(this.selfSize.width)
// .height(this.selfSize.height)
}
.id(this.insId)
.onAreaChange(() => {
... ... @@ -107,15 +111,40 @@ export struct WDPlayerRenderLiveView {
}
updateLayout() {
let info = componentUtils.getRectangleById(this.insId);
if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {
if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) {
let scale = info.size.height / this.videoHeight;
this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%');
} else {
let scale = info.size.width / this.videoWidth;
this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%");
Logger.debug(TAG, "播放器区域变化: " + JSON.stringify(info))
Logger.debug(TAG, "xComponent rect: " + JSON.stringify(this.xComponentController.getXComponentSurfaceRect()))
if (info.size.width > 0 && info.size.height > 0) {
// 竖屏
if (this.videoHeight > 0 && this.videoWidth > 0 && this.videoWidth < this.videoHeight) {
let ratio = this.videoWidth / this.videoHeight
const height = info.size.width / ratio
// 竖屏,缩放高度大于 视频区域高度
if (height > info.size.height) {
Logger.debug(TAG, "ratio = " + ratio + " ==> new height = " + height)
Logger.debug(TAG, "高度固定,求宽度: " + info.size.height * ratio)
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.height * ratio,
surfaceHeight: info.size.height
});
return
}
}
this.xComponentController.setXComponentSurfaceRect({
surfaceWidth: info.size.width,
surfaceHeight: info.size.height
});
}
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ import { ContentDetailDTO, ContentDTO, PageInfoDTO, ShareInfoDTO, TopicInfo } fr
import { SharePosterItemBean } from 'wdBean/src/main/ets/bean/detail/SharePosterItemBean';
import { ShareScene, ShareType, WDShareBase } from 'wdShareBase/Index';
import { ShareContentType } from 'wdShareBase/src/main/ets/Constant';
import { DeepLinkUtil } from './utils/DeepLinkUtil';
export class WDShare {
... ... @@ -17,6 +18,7 @@ export class WDShare {
title: content.shareInfo.shareTitle,
desc: content.shareInfo.shareSummary,
link: content.shareInfo.shareUrl,
deeplink:DeepLinkUtil.generateDeepLinkWithConent(content),
}
})
}
... ... @@ -32,6 +34,7 @@ export class WDShare {
title: program.shareInfo.shareTitle,
desc: program.shareInfo.shareSummary,
link: program.shareInfo.shareUrl,
deeplink:DeepLinkUtil.generateDeepLinkWithProgram(program),
}
})
}
... ...
import { ContentDetailDTO, ContentDTO } from 'wdBean/Index';
import { BreakpointSystem } from 'wdKit/Index';
import { ContentType } from 'wdRouter/Index';
export class DeepLinkUtil {
private static DEEP_LINK_PREFIX = "rmrbapp:rmrb.app/openwith"
static generateDeepLinkWithConent(content: ContentDetailDTO): string {
return DeepLinkUtil.generate(content.newsType, content.newsId +'', content.reLInfo?.relId, content.newsLinkUrl)
}
static generateDeepLinkWithProgram(content: ContentDTO) {
return DeepLinkUtil.generate(Number(content.objectType), content.objectId +'', content.relId, content.linkUrl)
}
private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string {
let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX
let pubParam = `&contentId=${contentId}}&relId=${relId}&skipType=1`
let type: ContentType = Number(contentType)
switch (type) {
case ContentType.Video:
deeplink += "?type=video&subType=vod_video"
break
case ContentType.Live:
deeplink += "?type=live"
break
case ContentType.ImageText:
if (link && link.length) {
deeplink += "?type=article&subType=h5"
deeplink += "&url=" + encodeURIComponent(link)
} else {
deeplink += "type=article&subType=h5_template_article"
}
break
case ContentType.DynamicImageText:
deeplink += "?type=dynamic"
break
case ContentType.DynamicVideo:
deeplink += "?type=dynamic"
break
case ContentType.Pictures:
deeplink += "?type=picture"
break
case ContentType.Audio:
deeplink += "?type=audio"
break
case ContentType.Ask:
deeplink += "?type=ask"
break
default:
pubParam = ""
break;
}
deeplink += pubParam
return deeplink
}
}
\ No newline at end of file
... ...
... ... @@ -65,7 +65,7 @@ struct LaunchInterestsHobbiesPage {
ForEach(this.interestsArray,(item:InterestsList,index:number)=>{
GridItem(){
Stack({alignContent:Alignment.TopStart}){
ImageKnifeComponent({imageKnifeOption:{loadSrc:item.pic,mainScaleType:ScaleType.FIT_XY}})
ImageKnifeComponent({imageKnifeOption:{loadSrc:item.pic?item.pic:'',mainScaleType:ScaleType.FIT_XY}})
.width('100%')
.height('100%')
.backgroundColor(Color.White)
... ...
... ... @@ -123,30 +123,16 @@ export struct BottomNavigationComponent {
@Builder
tabBarBuilder(navItem: BottomNavDTO, index: number) {
Stack({ alignContent: Alignment.Bottom }) {
// Image(this.getBottomIcon(navItem, this.currentNavIndex === index))
// .height(CommonConstants.FULL_PARENT)
// .padding({
// bottom: 15,
// left: 10,
// right: 10,
// top: 2
// })
// .aspectRatio(this.ASPECT_RATIO_1_1)
// .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index))
Column() {
ImageKnifeComponent({ imageKnifeOption: this.getBottomImageKnifeOption(navItem, this.currentNavIndex === index) })
.padding({
bottom: 15,
left: 10,
right: 10,
top: 2
})
.width('100%')
.height('100%')
.padding(1)
.margin({ top: 2 })
.width(32)
.height(32)
.enabled(false)
Text(navItem.name)
.margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
.margin({ top: 2 })
.fontWeight(this.currentNavIndex === index ? FontWeight.Bold : FontWeight.Normal)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_10'))// .fontColor(this.currentNavIndex === index ? Color.Red : Color.Gray)
... ...