liyubing

Merge remote-tracking branch 'origin/main'

import { url } from '@kit.ArkTS'
import App from '@system.app'
import { Action, Params } from 'wdBean/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { Logger } from 'wdKit/Index'
import { WDRouterRule } from '../router/WDRouterRule'
import { ProcessUtils } from './ProcessUtils'
const TAG = "AppInnerLink"
... ... @@ -8,7 +12,7 @@ export class AppInnerLink {
static readonly INNER_LINK_PROTCOL = "rmrbapp:"
static readonly INNER_LINK_HOSTNAME = "rmrb.app"
static readonly INNER_LINK_PATHNAME = "openwith"
static readonly INNER_LINK_PATHNAME = "/openwith"
// 内链跳转
// 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1
... ... @@ -48,19 +52,110 @@ export class AppInnerLink {
}
private static jumpParams(params: InnerLinkParam) {
if (!AppInnerLink.validTypes(params.type)) {
return
}
const contentType = AppInnerLink.contentTypeWithType(params.type)
if (params.type == "article") {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: params.contentId,
pageID: 'IMAGE_TEXT_DETAIL',
extra: {
relType: params.relType,
relId: params.relId,
sourcePage: '5', // ???
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
return
}
if (params.type == "video"
|| params.type == "dynamic"
|| params.type == "live"
|| params.type == "audio"
|| params.type == "picture") {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: contentType,
contentID: params.contentId,
extra: {
relType: params.relType,
relId: params.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
return
}
if (params.type == "owner_page" && params.creatorId) {
ProcessUtils.gotoPeopleShipHomePage(params.creatorId)
return
}
if (params.type == "topic") {
}
if (params.type == "channel") {
}
}
private static contentTypeWithType(type?: string) : number | undefined {
switch (type) {
case "video": return 1
case "dynamic": return 14
case "live": return 2
case "audio": return 13
case "picture": return 9
case "article": return 8
case "ask": return 16
}
return
}
private static validTypes(type?: string) : boolean {
if (!type) {
return false
}
let typeArray = ["article", "dynamic", "live", "video", "topic", "audio", "ask", "picture", "owner_page", "topic", "channel"]
return typeArray.indexOf(type) != -1
}
private static jumpNoParams(params: InnerLinkParam) {
if (!params.type || params.type != "app" || !params.subType) {
return
}
if (params.subType == "login") {
ProcessUtils.gotoLoginPage();
} else if (params.subType == "search") {
} else if (params.subType == "home") {
} else if (params.subType == "mine") {
}
private static jumpAppH5(params: InnerLinkParam) {
}
private static jumpAppH5(params: InnerLinkParam) {
if (params.type && params.type == "h5" && params.url) {
ProcessUtils.gotoDefaultWebPage(params.url);
}
}
private static jumpOutH5(params: InnerLinkParam) {
if (params.type && params.type == "h5" && params.url) {
ProcessUtils.jumpExternalWebPage(params.url);
}
}
private static jumpThirdApp(params: InnerLinkParam) {
//TODO:
}
static parseParams(link: string) : InnerLinkParam | undefined {
... ...
... ... @@ -114,7 +114,7 @@ export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo';
export { slideShows } from './src/main/ets/bean/morningevening/slideShows';
export { LiveDetailsBean } from './src/main/ets/bean/live/LiveDetailsBean';
export { LiveDetailsBean, joinPeopleNum } from './src/main/ets/bean/live/LiveDetailsBean';
export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO';
... ...
... ... @@ -208,3 +208,11 @@ export interface Vlive {
export interface ReLInfo {
relId: string
}
export interface joinPeopleNum {
barrageNum: number,
likeNum: number,
liveId: number,
pv: number,
subscribeNum: number
}
\ No newline at end of file
... ...
... ... @@ -7,17 +7,20 @@ import { TopNavDTO } from './TopNavDTO';
export class NavigationBodyDTO {
backgroundColor: string = ''; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavList: BottomNavDTO[] = [];
// greyBottomNav: GreyBottomNav; // 灰度皮肤
immersiveBackgroundColor: string = ''; // 迭代二新增-底部导航背景色(沉浸式频道)
nightBackgroundColor: string = ''; // 迭代三新增-底部导航背景色(夜间模式)
greyBottomNav?: GreyBottomNavBean; // 灰度皮肤
md5: string = ''
}
export class GreyBottomNavBean {
bottomNavList: BottomNavDTO[] = [];
greyUserList: string[] = [];
}
export class NavigationDetailDTO {
id: string = ''; // 迭代二新增-底部导航背景色(信息流频道)
bottomNavCompList: BottomNavCompDTO[] = [];
topNavChannelList: TopNavDTO[] = [];
md5: string = ''
}
... ...
... ... @@ -258,7 +258,7 @@ export struct MorningEveningPaperComponent {
})
}
}
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`).scrollBar(BarState.Off)
PaperTitleComponent()
}
... ...
import { ContentDTO } from 'wdBean/Index'
import { ContentDTO, joinPeopleNum } from 'wdBean/Index'
import { DateTimeUtils } from 'wdKit/Index'
import { LottieView } from '../../components/lottie/LottieView';
import { LiveModel } from '../../viewmodel/LiveModel'
import font from '@ohos.font';
/**
* 这里是样式卡中,右下角显示的音视频信息
... ... @@ -10,10 +13,55 @@ import { DateTimeUtils } from 'wdKit/Index'
@Component
export struct CardMediaInfo {
@State contentDTO: ContentDTO = new ContentDTO() // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
@State joinPeopleNum: number = 0;
// objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
// 14动态图文,15动态视频16问政;100人民号,101标签
aboutToAppear(): void {
this.getJoinPeopleNum();
font.registerFont({
familyName: 'BebasNeue',
familySrc: $rawfile('font/BebasNeue.ttf')
})
}
/**
* 全域数字显示规则
* 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585
* 2、当数量为万位~1亿时,显示xx 万,保留小数点后一位,比如1517.9w、2.9w
* 3、当数量为1亿~千亿时,显示XX 亿,保留小数点后一位,比如1517.9亿、2.9亿
* 4、不进行四舍五入
* 5、0 和空 不显示
*/
handlerNum(number: string) {
const num = number??'0';
if (Number.parseInt(num) <= 9999) {
return Number.parseInt(num).toString()
} else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) {
const num1: string = num.slice(0, -4); // 万
const num2: string = num.slice(-4, -3); // 千
return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万'
} else if (Number.parseInt(num) > 99999999) {
const num1: string = num.slice(0, -8); // 亿
const num2: string = num.slice(-8, -7);
return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿'
}
return num
}
//
/**
* 获取直播节目参与人数
*/
async getJoinPeopleNum() {
if (this.contentDTO.objectType !== '2') return;
console.log('getJoinPeopleNum-ContentDTO', JSON.stringify(this.contentDTO.objectId))
let liveIdList: string = this.contentDTO.objectId
let data: joinPeopleNum[] = await LiveModel.getJoinPeopleNum(liveIdList)
this.joinPeopleNum = data[0].pv;
}
build() {
Row() {
if (this.contentDTO?.objectType === '1' || this.contentDTO?.objectType === '15') {
... ... @@ -24,6 +72,7 @@ export struct CardMediaInfo {
if (this.contentDTO.videoInfo != null) {
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
.fontFamily('BebasNeue')
}
}
} else if (this.contentDTO.objectType === '2') {
... ... @@ -36,8 +85,19 @@ export struct CardMediaInfo {
Text('预约')
.mediaText()
} else if (this.contentDTO?.liveInfo?.liveState === 'running') {
Image($r('app.media.card_live'))
.mediaLogo()
LottieView({
name: 'live_status_wait',
path: "lottie/live_detail_living.json",
lottieWidth: 14,
lottieHeight: 14,
autoplay: true,
loop: true,
})
.margin({
right: '2vp'
})
// Image($r('app.media.card_live'))
// .mediaLogo()
Text('直播中')
.mediaText()
} else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo?.replayUri) {
... ... @@ -50,6 +110,12 @@ export struct CardMediaInfo {
Text('已结束')
.mediaText()
}
if (!!this.joinPeopleNum) {
Text(' | ')
.mediaText()
Text(`${this.handlerNum(this.joinPeopleNum.toString())}人参加`)
.mediaText()
}
// } else if (this.contentDTO?.liveInfo?.liveState === 'end' && this.contentDTO?.liveInfo
// ?.replayUri) {
// // Image($r('app.media.card_live'))
... ... @@ -73,6 +139,7 @@ export struct CardMediaInfo {
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
.mediaText()
.fontFamily('BebasNeue')
}
} else if (this.contentDTO.objectType === '4') {//广告标签
Text($r('app.string.comp_advertisement'))
... ...
... ... @@ -422,12 +422,13 @@ struct footerExpandedView {
build() {
Row() {
if (this.item.expanded) {
if (this.item.childsHasMore) {
Row() {
Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 })
if (this.item.childsHasMore) {
Row() {
Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14)
Image($r('app.media.comment_unfold')).width(12).height(12)
}.margin({ left: 53 })
}.margin({ left: 6 })
.onClick(() => {
if (this.item.isLoading) {
return
... ... @@ -439,13 +440,14 @@ struct footerExpandedView {
Row() {
Text('收起').fontColor($r('app.color.color_222222')).fontSize(14)
Image($r('app.media.comment_pickUp')).width(12).height(12)
}.margin({ left: this.item.childsHasMore ? 32 : 213 })
}.margin({ left: 6 })
.onClick(() => {
this.item.pageNum = 1
this.item.expanded = false
this.item.childComments = []
this.item.childCommentsLazyDataSource.clear()
})
}.margin({ left: 53 })
} else {
Row() {
Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
... ... @@ -568,6 +570,7 @@ struct commentHeaderView {
publishCommentModel: this.publishCommentModel
}).margin({ left: 59, right: 16 })
}.alignItems(HorizontalAlign.Start)
.padding({bottom: 8})
}
replyComment() {
... ...
... ... @@ -129,8 +129,10 @@ export struct CommentText {
// Stack({ alignContent: Alignment.BottomEnd }) {
Text(this.longMessage) {
Span(this.expandedStates ? this.longMessage : this.maxLineMesssage)
.lineHeight(this.lineHeight)
Span(this.collapseText)
.fontColor("#999999")
.lineHeight(this.lineHeight)
.onClick(() => {
if (this.collapseText == collapseString) {
this.collapseText = uncollapseString;
... ... @@ -171,6 +173,7 @@ export struct CommentText {
else {
Text(this.longMessage)
.width('100%')
.lineHeight(this.lineHeight)
.fontSize(this.fontSize)
.fontWeight(this.fontWeight)
.fontColor(this.fontColor)
... ...
import { BottomNavi, CommonConstants } from 'wdConstant';
import { BottomNavDTO, NavigationBodyDTO, TopNavDTO } from 'wdBean';
import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { BottomNavDTO, NavigationBodyDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean';
import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit';
import { TopNavigationComponent } from './TopNavigationComponent';
import { MinePageComponent } from './MinePageComponent';
import { CompUtils } from '../../utils/CompUtils';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import HomeChannelUtils, { AssignChannelParam } from 'wdRouter';
import { VideoChannelPage } from './VideoChannelPage';
import { HttpUtils } from 'wdNetwork/Index';
const TAG = 'BottomNavigationComponent';
let storage = LocalStorage.getShared();
... ... @@ -225,7 +226,7 @@ export struct BottomNavigationComponent {
}
private getBottomDetail() {
// 1、获取顶导缓存数据
// // 1、获取顶导缓存数据
// this.bottomNavList.forEach((value) => {
// // 先用底导带回的list初始化
// this.topNavMap[value.id] = value.topNavChannelList
... ... @@ -249,11 +250,32 @@ export struct BottomNavigationComponent {
private setData(data: NavigationBodyDTO) {
Logger.debug(TAG, 'setData')
if (data && data.bottomNavList != null) {
Logger.info(TAG, `setData, bottomNav.length: ${data.bottomNavList.length}`);
if (data == null) {
return
}
let list: BottomNavDTO[] = []
let userId: string = HttpUtils.getUserId()
// 先匹配换肤
if (data.greyBottomNav != null && data.greyBottomNav.greyUserList != null &&
data.greyBottomNav.greyUserList.length > 0) {
// data.greyBottomNav.greyUserList.includes(userId)不生效,直接用循环匹配
for (let i = 0; i < data.greyBottomNav.greyUserList.length; i++) {
let id = data.greyBottomNav.greyUserList[i]
if (id == userId) {
list = data.greyBottomNav.bottomNavList
break
}
}
}
// 没有匹配到换肤,则直接用data.bottomNavList
if (list.length <= 0) {
list = data.bottomNavList
}
if (list.length > 0) {
Logger.info(TAG, `setData, bottomNav.length: ${list.length}`);
// 使用filter方法移除name为'服务'的项
data.bottomNavList = data.bottomNavList.filter(item => item.name !== '服务');
this.bottomNavList = data.bottomNavList
list = list.filter(item => item.name !== '服务');
this.bottomNavList = list
}
}
}
\ No newline at end of file
... ...
... ... @@ -412,7 +412,7 @@ export struct PaperSingleColumn999CardView {
} else if (hours < 24) {
result = `${hours}小时前`;
} else {
result = `${days}天前`;
result = '';
}
console.log(result);
... ... @@ -422,12 +422,13 @@ export struct PaperSingleColumn999CardView {
build() {
Column() {
Text(this.item?.newsTitle)
.fontColor('#222222')
.fontSize(16)
.fontWeight(FontWeight.Bold)
.alignSelf(ItemAlign.Start)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.margin({ left: 22, right: 22, top: 28 })
.margin({ left: 16, right: 16, top: 16 })
if (this.item?.coverUrl) {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.item?.coverUrl)
... ... @@ -462,35 +463,36 @@ export struct PaperSingleColumn999CardView {
.width(CommonConstants.FULL_PARENT)
.justifyContent(FlexAlign.End)
}
}.margin({ left: 22, right: 22 })
}.margin({ left: 16, right: 16 })
}
if (this.item?.newsSummary) {
Text(this.item?.newsSummary)
.fontColor('#6666666')
.fontSize(14)
.padding({ top: 10 })
.alignSelf(ItemAlign.Start)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.margin({ left: 22, right: 22 })
.margin({ left: 16, right: 16 })
}
if (this.item) {
Row() {
Row() {
Text(this.item?.source)
.fontSize(12)
.fontColor(Color.Gray)
.margin({ left: 22 })
.fontColor('#B0B0B0')
.margin({ left: 16 })
Image($r('app.media.point'))
.width(16)
.height(16)
.margin({ top: 10, bottom: 10 })
Text(this.getPublishTime())
.fontSize(12)
.fontColor(Color.Gray)
if (this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) {
.fontColor('#B0B0B0')
if (this.item.objectType != '2' && this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) {
Text(this.interactData.commentNum + "评")
.fontSize(12)
.fontColor(Color.Gray)
.fontColor('#B0B0B0')
.margin({ left: 6 })
}
}
... ...
... ... @@ -12,7 +12,7 @@ export default struct NoMoreLayout {
Text($r('app.string.footer_text'))
.fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT)
.textAlign(TextAlign.Center)
.fontColor('#CCCCCC')
.fontColor('#999999')
.margin({bottom:40})
}
.width(RefreshConstants.FULL_WIDTH)
... ...
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger, ToastUtils, EmitterEventId, EmitterUtils } from 'wdKit';
import { LiveDetailsBean, ReserveBean, ReserveItemBean } from 'wdBean/Index';
import { LiveDetailsBean, ReserveBean, ReserveItemBean, joinPeopleNum } from 'wdBean/Index';
const TAG = 'LiveModel'
... ... @@ -105,5 +105,34 @@ export class LiveModel {
})
})
}
/**
* 查询直播参与人数
*/
static getJoinPeopleNum(liveIdList: string) {
return new Promise<Array<joinPeopleNum>>((success, fail) => {
HttpRequest.get<ResponseDTO<Array<joinPeopleNum>>>(
HttpUrlUtils.getJoinPeopleNum() + `?liveIdList=${liveIdList}`,
).then((data: ResponseDTO<Array<joinPeopleNum>>) => {
Logger.debug(TAG, 'getJoinPeopleNum:' + `${JSON.stringify(data)}`)
Logger.debug(TAG, 'liveIdList:' + liveIdList)
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
ToastUtils.shortToast(data.message)
return
}
success(data.data)
Logger.info('getJoinPeopleNum', JSON.stringify(data.data))
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", JSON.stringify(error))
})
})
}
}
... ...
... ... @@ -149,6 +149,9 @@ export class GetuiPush {
}
setAlias(bind: boolean, alias: string, sn: string = this.ALIAS_SN_USERID) {
if (typeof alias == "number") {
alias = `${alias}`
}
if (!this.initialed) { return }
if (bind) {
Logger.debug(TAG, "推送 绑定别名 " + alias)
... ...
... ... @@ -56,9 +56,15 @@ export class PushContentParser {
},*/
let gtData = want.parameters[PushContentParser.LAUNCH_PARAM_GETUI_DATA] as Record<string, string | number | object>
if (gtData[PushContentParser.LAUNCH_PARAM_GETUI_TASKID] != undefined) {
let json = JSON.parse(gtData["wantUri"] as string) as Record<string, string | number>
if (json && json[PushContentParser.PUSH_PARAM_PUSH_LINK] != null) {
const pushLink = json[PushContentParser.PUSH_PARAM_PUSH_LINK] as string
// let json = JSON.parse(gtData["wantUri"] as string) as Record<string, string | number>
// if (json && json[PushContentParser.PUSH_PARAM_PUSH_LINK] != null) {
// const pushLink = json[PushContentParser.PUSH_PARAM_PUSH_LINK] as string
// return {
// isPush: true, online: true, pushLink: pushLink, want: want
// }
// }
if (want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK]) {
let pushLink = want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK] as string
return {
isPush: true, online: true, pushLink: pushLink, want: want
}
... ...
... ... @@ -29,12 +29,15 @@ struct MultiPictureDetailPage {
.backgroundColor(Color.Black)
}
pageTransition(){
// 定义页面进入时的效果,从右边侧滑入
PageTransitionEnter({ type: RouteType.None, duration: 300 })
pageTransition() {
// 为目标页面时,进入:从右边侧滑入,退出:是右侧划出;跳转别的页面:左侧划出,返回:左侧划入。
PageTransitionEnter({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Right)
// 定义页面退出时的效果,向右边侧滑出
PageTransitionExit({ type: RouteType.None, duration: 300 })
PageTransitionEnter({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Push, duration: 300 })
.slide(SlideEffect.Left)
PageTransitionExit({ type: RouteType.Pop, duration: 300 })
.slide(SlideEffect.Right)
}
... ... @@ -62,6 +65,17 @@ struct MultiPictureDetailPage {
this.closeFullScreen()
}
onPageShow(): void {
console.log(TAG, 'onPageShow')
this.openFullScreen()
}
onPageHide(): void {
console.log(TAG, 'onPageHide')
this.closeFullScreen()
}
/**
* 开启沉浸式
* TODO:颜色待根据业务接口修改
... ...