陈剑华

Merge remote-tracking branch 'origin/main'

Showing 23 changed files with 578 additions and 219 deletions
... ... @@ -14,6 +14,9 @@ export class AppUtils {
AppUtils.buildVersion = BuildProfile.BUILD_VERSION;
}
// 全局应用context
public static gotApplicationContextFunc?: () => common.UIAbilityContext
/**
* 获取应用名称
* 即:人民日报
... ...
... ... @@ -49,5 +49,8 @@ export enum EmitterEventId {
// 全屏
FULL_SCREEN = 14,
// 图文详情页点赞状态
LIKE_CHANGE_STATUS = 15,
}
... ...
... ... @@ -6,6 +6,7 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { Logger } from 'wdKit/Index'
import { ContentType } from '../common/ContentType'
import { WDRouterRule } from '../router/WDRouterRule'
import HomeChannelUtils from './HomeChannelUtils'
import { ProcessUtils } from './ProcessUtils'
const TAG = "AppInnerLink"
... ... @@ -123,8 +124,18 @@ export class AppInnerLink {
WDRouterRule.jumpWithAction(taskAction)
}
if (params.type == "channel") {
if (params.type == "topic" && params.subType == "audio_news") {
}
if (params.type == "topic" && params.subType == "moring_evening_news") {
ProcessUtils.gotoMorningEveningPaper()
}
if (params.type == "channel") {
if (params.subType == "electronic_newspapers") {
ProcessUtils.gotoENewsPaper();
return
}
HomeChannelUtils.jumpChannelTab(params.firstChannelId ?? "", params.pageId ?? "", "")
}
}
... ...
... ... @@ -12,14 +12,16 @@ export class AppInnerLinkGenerator {
static generateDeepLinkWithProgram(content: ContentDTO) {
return AppInnerLinkGenerator.generate(Number(content.objectType), content.objectId +'', content.relId, content.linkUrl)
return AppInnerLinkGenerator.generate(Number(content.objectType), content.objectId +'', content.relId
, content.linkUrl, content.pageId, Number(content.objectLevel))
}
static generateDeepLinkWithFrontObjectLink(content: FrontLinkObject) {
return AppInnerLinkGenerator.generate(Number(content.newsType), content.newsId +'', content.newsRelId + '', content.linkUrl)
return AppInnerLinkGenerator.generate(Number(content.newsType), content.newsId +''
, content.newsRelId + '', content.linkUrl, content.newsPageId, Number(content.newsLevel))
}
static generate(contentType: number, contentId?: string, relId?: string, link?: string): string {
static generate(contentType: number, contentId?: string, relId?: string, link?: string, pageId?: string, objectLevel?: number): string {
let deeplink = AppInnerLinkGenerator.DEEP_LINK_PREFIX
let pubParam = `&contentId=${contentId ?? ""}&relId=${relId ?? ""}&skipType=1`
... ... @@ -55,6 +57,20 @@ export class AppInnerLinkGenerator {
case ContentType.Ask:
deeplink += "?type=ask"
break
case ContentType.Subject:
if (objectLevel && objectLevel == 25) { // 早晚报专题
deeplink += `?type=topic&subType=moring_evening_news&pageId=${pageId}&relId=${relId}&skipType=1`
return deeplink
}
if (objectLevel && objectLevel == 22) { // 音频专题
deeplink += `?type=topic&subType=audio_news&pageId=${pageId}&relId=${relId}&skipType=1`
return deeplink
}
if (link) {
deeplink += `?type=topic&subType=h5&pageId=${pageId}&relId=&url=${encodeURIComponent(link)}&skipType=1`
return deeplink
}
break
default:
pubParam = ""
break;
... ...
... ... @@ -315,8 +315,7 @@ export struct WdWebLocalComponent {
Text('重播').fontColor(Color.White).fontSize(14)
}
.backgroundColor(Color.Black)
.opacity(0.5)
.backgroundColor("#80000000")
.justifyContent(FlexAlign.Center)
.width(this.positionWidth)
.height(this.positionHeight)
... ...
... ... @@ -4,9 +4,9 @@ export interface FrontLinkObject {
linkUrl: string;
newsId: string;
newsLevel: string;
// newsPageId?: any;
newsPageId: string;
newsRelId: number;
// newsRelType?: any;
newsRelType: string;
newsType: number;
publishTime: string;
source: string;
... ...
import { SPHelper, Logger, ToastUtils } from 'wdKit';
import { SPHelper, Logger, ToastUtils, EmitterUtils, EmitterEventId } from 'wdKit';
import { ContentDetailDTO, Action, ContentDTO, batchLikeAndCollectResult } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
... ... @@ -11,6 +11,11 @@ import { TrackConstants } from 'wdTracking/Index';
const TAG = 'CarderInteraction'
interface parsedObj {
contentId: string,
likeStatus: string
}
/**
* 卡片 分享、评论、点赞公用组件
*/
... ... @@ -47,6 +52,25 @@ export struct CarderInteraction {
// console.log(TAG, 'this.isShowComment', this.isShowComment)
// console.log(TAG, 'this.isShowLike', this.isShowLike)
// console.log(TAG, 'router.getState().name', router.getState().name)
EmitterUtils.receiveEvent(EmitterEventId.LIKE_CHANGE_STATUS, (val: string | undefined) => {
// console.log(TAG,'val点赞', val)
if (val === undefined) {
console.error('Value is undefined');
return;
}
try {
const parsedVal: parsedObj = JSON.parse(val);
if (parsedVal.contentId === this.contentDetailData.newsId + '') {
// console.log(TAG,'params点赞状态', parsedVal.likeStatus)
this.likeBean['likeStatus'] = parsedVal.likeStatus
// console.log(TAG,'this.likeBean点赞状态', this.likeBean['likeStatus'])
}
} catch (error) {
console.error('Error parsing JSON:', error);
}
});
}
... ...
... ... @@ -48,9 +48,16 @@ import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index';
import { componentUtils, window } from '@kit.ArkUI';
import { onlyWifiLoadImg } from '../utils/lazyloadImg';
const TAG = 'DynamicDetailComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
interface parsedObj {
contentId: string,
likeStatus: string
}
/**
* 动态详情页UI
... ... @@ -124,6 +131,7 @@ export struct DynamicDetailComponent {
}
aboutToDisappear() {
this.viewBlogInsightIntentShare()
}
onPageHide() {
... ... @@ -308,127 +316,128 @@ export struct DynamicDetailComponent {
//附件内容:图片/视频
if (this.contentDetailData.photoList != null && this.contentDetailData.photoList.length > 0) {
// 图片-从无图到9图展示
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
if (this.contentDetailData.photoList.length === 1) {
if (this.getPicType(item) !== 3) {
GridCol({
span: this.getPicType(item) === 1 ? 12 : 8
}) {
Stack({
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType(item) === 1) {
Image(item.picPath)
.width('100%')
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType(item) === 2) {
Image(item.picPath)
.width('100%')
.height(305)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
}
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.padding({ bottom: 9 })
}
}
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
} else {
createImg({fullColumnImgUrls:this.contentDetailData.photoList})
// GridRow({
// gutter: { x: 2, y: 2 }
// }) {
// ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
// if (this.contentDetailData.photoList.length === 1) {
// if (this.getPicType(item) !== 3) {
// GridCol({
// span: { xs: 8 }
// span: this.getPicType(item) === 1 ? 12 : 8
// }) {
// Stack({
// alignContent: Alignment.BottomEnd
// }) {
// if (this.getPicType(item) === 1) {
// Image(item.picPath)
// .width('100%')
// .height(172)
// .autoResize(true)
// .borderRadius(this.caclImageRadius(index))
// } else if (this.getPicType(item) === 2) {
// Image(item.picPath)
// .width('100%')
// .height(305)
// .autoResize(true)
// .borderRadius(this.caclImageRadius(index))
// }
// Flex({ direction: FlexDirection.Row }) {
// Image($r('app.media.icon_long_pic'))
// .width(12)
// .height(12)
// .margin({ right: 4 })
// Text('长图')
// .fontSize(10)
// .fontWeight(400)
// .textShadow({
// radius: 1,
// color: `rgba(0,0,0,0.5)`,
// offsetY:1,
// offsetX:1
// })
// .fontColor(0xffffff)
// .fontFamily('PingFang SC')
// }
// .width(48)
// .padding({ bottom: 9 })
// }
//
// }
// .onClick(async (event: ClickEvent) => {
// let retvalue = await FastClickUtil.isMinDelayTime()
// if(retvalue){
// return
// }
// ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
// })
// } else {
// // GridCol({
// // span: { xs: 8 }
// // }) {
// // Image(item.picPath)
// // .width('100%')
// // .borderRadius(this.caclImageRadius(index))
// // .autoResize(true)
// // .opacity(!item.width && !item.height ? 0 : 1)
// // .onComplete(callback => {
// // item.width = callback?.width || 0;
// // item.height = callback?.height || 0;
// // })
// // }
// GridCol({
// span: this.onePicW > this.onePicH ? 12 : 8
// }) {
// Stack({alignContent: Alignment.BottomEnd}) {
// Image(item.picPath)
// .backgroundColor(0xf5f5f5)
// .width('100%')
// .autoResize(true)
// .objectFit(ImageFit.Cover)
// .autoResize(true)
// .aspectRatio(3/4)
// .borderRadius(this.caclImageRadius(index))
// .borderStyle(BorderStyle.Solid)
// .borderWidth(0.5)
// .borderColor($r('app.color.color_0D000000'))
// .opacity(!item.width && !item.height ? 0 : 1)
// .onComplete(callback => {
// item.width = callback?.width || 0;
// item.height = callback?.height || 0;
// .onComplete((event?) => {
// this.onePicW = event?.width || 0;
// this.onePicH = event?.height || 0;
// })
// if(this.getPicType(item) !== 3){
// Flex({ direction: FlexDirection.Row }) {
// Image($r('app.media.icon_long_pic'))
// .width(12)
// .height(12)
// .margin({ right: 4 })
// Text('长图')
// .fontSize(10)
// .fontWeight(400)
// .textShadow({
// radius: 1,
// color: `rgba(0,0,0,0.5)`,
// offsetY:1,
// offsetX:1
// })
// .fontColor(0xffffff)
// .fontFamily('PingFang SC')
// }
// .width(48)
// .align(Alignment.BottomEnd)
// .padding({ bottom: 3 })
// }
// }
// }
// .onClick(async (event: ClickEvent) => {
// let retvalue = await FastClickUtil.isMinDelayTime()
// if(retvalue){
// return
// }
// ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
// })
// }
// }
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(item.picPath)
.backgroundColor(0xf5f5f5)
.width('100%')
.autoResize(true)
.objectFit(ImageFit.Cover)
.autoResize(true)
.aspectRatio(3/4)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.opacity(!item.width && !item.height ? 0 : 1)
.onComplete((event?) => {
this.onePicW = event?.width || 0;
this.onePicH = event?.height || 0;
})
if(this.getPicType(item) !== 3){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3 })
}
}
}
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
}
}
// else if (this.contentDetailData.photoList.length === 4) {
// GridCol({
// span: { xs: 4 }
... ... @@ -469,53 +478,53 @@ export struct DynamicDetailComponent {
// ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
// })
// }
else {
GridCol({
span: { sm: 4, lg: 3 }
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(item.picPath)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
if(this.getPicType(item) !== 3){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3})
}
}
}
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
}
})
}
.margin({
left: $r('app.float.margin_16'),
right: $r('app.float.margin_16'),
top: $r('app.float.margin_8')
})
// else {
// GridCol({
// span: { sm: 4, lg: 3 }
// }) {
// Stack({alignContent: Alignment.BottomEnd}) {
// Image(item.picPath)
// .aspectRatio(1)
// .borderRadius(this.caclImageRadius(index))
// if(this.getPicType(item) !== 3){
// Flex({ direction: FlexDirection.Row }) {
// Image($r('app.media.icon_long_pic'))
// .width(12)
// .height(12)
// .margin({ right: 4 })
// Text('长图')
// .fontSize(10)
// .fontWeight(400)
// .textShadow({
// radius: 1,
// color: `rgba(0,0,0,0.5)`,
// offsetY:1,
// offsetX:1
// })
// .fontColor(0xffffff)
// .fontFamily('PingFang SC')
// }
// .width(48)
// .align(Alignment.BottomEnd)
// .padding({ bottom: 3})
// }
// }
// }
// .onClick(async (event: ClickEvent) => {
// let retvalue = await FastClickUtil.isMinDelayTime()
// if(retvalue){
// return
// }
// ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
// })
// }
// })
// }
// .margin({
// left: $r('app.float.margin_16'),
// right: $r('app.float.margin_16'),
// top: $r('app.float.margin_8')
// })
}
} else {
if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) {
... ... @@ -637,7 +646,7 @@ export struct DynamicDetailComponent {
// 评论
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
Divider().strokeWidth(8).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
CommentComponent({
publishCommentModel: this.publishCommentModel
})
... ... @@ -778,11 +787,11 @@ export struct DynamicDetailComponent {
}
]
}
console.error(TAG, JSON.stringify(this.contentDetailData))
// console.error(TAG,'CarderInteraction', JSON.stringify(params.contentList))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
// console.error(TAG, 'CarderInteraction 查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
// Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
}
... ... @@ -804,7 +813,7 @@ export struct DynamicDetailComponent {
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
// Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
this.followStatus = '0';
}
... ... @@ -878,7 +887,7 @@ export struct DynamicDetailComponent {
status: this.followStatus == '0' ? 1 : 0,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('关注号主==', JSON.stringify(res.data))
// console.log('关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
TrackingContent.follow(true,this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId,this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhName,TrackConstants.PageName.DynamicDetail,TrackConstants.PageName.DynamicDetail,this.pageParam)
... ... @@ -911,7 +920,14 @@ export struct DynamicDetailComponent {
} else {
this.interactDataDTO.likeNum = Number(this.interactDataDTO.likeNum) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
let parsedVal: parsedObj = {
contentId: params.contentId,
likeStatus: this.newsStatusOfUser.likeStatus
}
EmitterUtils.sendEvent(EmitterEventId.LIKE_CHANGE_STATUS, JSON.stringify(parsedVal))
// console.log(TAG, 'CarderInteraction 点赞parsedVal', JSON.stringify(parsedVal))
// console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
//内容点赞、取消点赞Tracking 1点赞 0取消点赞
TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.DynamicDetail, TrackConstants.PageName.DynamicDetail,
... ... @@ -955,6 +971,259 @@ export struct DynamicDetailComponent {
}
}
@Component
struct createImg {
@State fullColumnImgUrls: PhotoListBean[] = []
@State loadImg: boolean = false;
@State onePicW: number = 0; // 只有一张图时候图片的宽度
@State onePicH: number = 0; // 只有一张图时候图片的高度
async aboutToAppear(): Promise<void> {
if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2, 0, {
picPath: ''
} as PhotoListBean)
}
this.loadImg = await onlyWifiLoadImg();
console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls))
}
caclImageRadius(index: number) {
let radius: radiusType = {
topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
topRight: 0,
bottomLeft: 0,
bottomRight: 0,
}
if (this.fullColumnImgUrls.length === 1) {
radius.topRight = index === 0 ? $r('app.float.image_border_radius') : 0
radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 0 ? $r('app.float.image_border_radius') : 0
} else if (this.fullColumnImgUrls.length === 2) {
radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0
radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 1 ? $r('app.float.image_border_radius') : 0
} else if (this.fullColumnImgUrls.length === 3) {
radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0
radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 2 ? $r('app.float.image_border_radius') : 0
} else if (this.fullColumnImgUrls.length === 6) {
radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0
radius.bottomLeft = index === 3 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 5 ? $r('app.float.image_border_radius') : 0
} else if (this.fullColumnImgUrls.length === 5 && !this.fullColumnImgUrls[2].picPath) {
radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0
radius.bottomLeft = index === 3 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 4 ? $r('app.float.image_border_radius') : 0
} else {
radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0
radius.bottomLeft = index === 6 ? $r('app.float.image_border_radius') : 0
radius.bottomRight = index === 8 ? $r('app.float.image_border_radius') : 0
}
return radius
}
getPicType(picWidth: number, picHeight: number) {
//console.info(`cj2024 getPicType picWidth = ${picWidth} picHeight = ${picHeight} picWidth / picHeight = ${picWidth / picHeight}`)
if (picWidth && picHeight) {
if (picWidth / picHeight > 2/1) {
return 1; //横长图
} else if (picWidth/picHeight > 1/2 && picWidth/picHeight < 3/4) { //截取图片
return 4;
} else if (picWidth/picHeight < 1/2) {
return 2; //竖长图
} else {
return 3
}
} else {
return 3; //普通图
}
}
@Builder
longPicTip(weight: number, height: number) {
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
weight / height > 2 || height / weight > 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 8 })
}
build() {
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.fullColumnImgUrls, (item: PhotoListBean, index: number) => {
if (this.fullColumnImgUrls.length === 1) {
if (this.getPicType(item.width, item.height) < 3) {
GridCol({
span: this.getPicType(item.width, item.height) === 1 ? 12 : 8
}){
Stack({
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType(item.width, item.height) === 1) {
Image(this.loadImg ? item.picPath : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(198)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.onClick(() => {
ProcessUtils.gotoMultiPictureListPage(this.fullColumnImgUrls, index)
})
} else if (this.getPicType(item.width, item.height) === 2) {
Image(this.loadImg ? item.picPath : '')
.width('100%')
.height(305)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.onClick(() => {
ProcessUtils.gotoMultiPictureListPage(this.fullColumnImgUrls, index)
})
}
this.longPicTip(item.width, item.height)
}
}
} else if (this.getPicType(item.width, item.height) === 4) {
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Image(this.loadImg ? item.picPath : '')
.backgroundColor(0xf5f5f5)
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.autoResize(true)
.objectFit(ImageFit.Cover)
.autoResize(true)
.aspectRatio(3/4)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.opacity(!item.width && !item.height ? 0 : 1)
.onComplete((event?) => {
this.onePicW = event?.width || 0;
this.onePicH = event?.height || 0;
})
.onClick(() => {
ProcessUtils.gotoMultiPictureListPage(this.fullColumnImgUrls, index)
})
}
} else {
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(this.loadImg ? item.picPath : '')
.backgroundColor(0xf5f5f5)
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.constraintSize({
maxHeight: this.onePicW > this.onePicH ? 198 : 305
})
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.opacity(!item.width && !item.height ? 0 : 1)
.onComplete((event?) => {
this.onePicW = event?.width || 0;
this.onePicH = event?.height || 0;
})
if (this.onePicW && this.onePicH) {
this.longPicTip(this.onePicW, this.onePicH)
}
}
.onClick(() => {
ProcessUtils.gotoMultiPictureListPage(this.fullColumnImgUrls, index)
})
}
}
} else if (this.fullColumnImgUrls.length === 5) {
// 四图卡里面塞了一张补位卡
GridCol({
span: { xs: 4 }
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(this.loadImg ? item.picPath : '')
.backgroundColor(index === 2 ? 0xffffff : 0xf5f5f5)
.aspectRatio(1)
.width('226lvp')
.height('226lvp')
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
if(this.getPicType(item.width, item.height) !== 3){
this.longPicTip(item.width, item.height)
}
}
.onClick(() => {
const photoList: PhotoListBean[] = []
this.fullColumnImgUrls.forEach((element,index) => {
if (index !== 2) {
photoList.push(element)
}
})
ProcessUtils.gotoMultiPictureListPage(photoList, index>2?index-1:index)
})
}
} else {
GridCol({
span: { sm: 4, lg: 3 }
}) {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.loadImg ? item.picPath : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.width('100%')
.autoResize(true)
if (this.getPicType(item.width, item.height) !== 3) {
this.longPicTip(item.width, item.height)
}
}
.onClick(() => {
ProcessUtils.gotoMultiPictureListPage(this.fullColumnImgUrls, index)
})
}
}
})
}
}
}
interface radiusType {
topLeft: number | Resource;
topRight: number | Resource;
... ...
... ... @@ -190,12 +190,12 @@ export struct ImageAndTextPageComponent {
.justifyContent(FlexAlign.Center)
}
if (this.recommendList.length > 0) {
Divider().strokeWidth(6).color('#f5f5f5')
Divider().strokeWidth(8).color('#f5f5f5')
RecommendList({ recommendList: this.recommendList })
}
// 评论
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
Divider().strokeWidth(8).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel,
fixedHeightMode: false,
... ... @@ -440,10 +440,10 @@ export struct ImageAndTextPageComponent {
userName:this.contentDetailData?.userInfo?.userName || '' + '',
channelId:String(this.contentDetailData?.reLInfo?.channelId) || '' + ''
}
console.log(TAG, '点赞、取消点赞params', JSON.stringify(params))
// console.log(TAG, '点赞、取消点赞params', JSON.stringify(params))
PageRepository.postExecuteLike(params).then(res => {
// console.log(TAG, '点赞、res', JSON.stringify(res))
console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
// console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
if (this.newsStatusOfUser) {
//内容点赞、取消点赞Tracking 1点赞 0取消点赞
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
... ... @@ -452,7 +452,7 @@ export struct ImageAndTextPageComponent {
} else {
this.likeNum = Number(this.likeNum) - 1
}
console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)
// console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)
// this.queryContentInteractCount()
TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
} else {
... ...
... ... @@ -28,7 +28,7 @@ export struct Card19Component {
this.titleInit();
const curRouter = router.getState().name;
this.clicked = hasClicked(this.contentDTO.objectId, curRouter)
console.log('card19',JSON.stringify(this.contentDTO))
// console.log('card19',JSON.stringify(this.contentDTO))
}
titleInit() {
... ...
... ... @@ -132,7 +132,7 @@ export struct CommentComponent {
Column() {
if (showGapLine) {
Blank().height(12)
Divider().strokeWidth(6).color('#f5f5f5')
Divider().strokeWidth(8).color('#f5f5f5')
}
Row() {
... ... @@ -427,7 +427,7 @@ struct ChildCommentItem {
@Link dialogController: CustomDialogController | null
@ObjectLink item: commentItemModel
@Consume contentDetailData: ContentDetailDTO
private leftGap: number = 95 + 4
@Consume inDialog: boolean
private dialogBeforeJumpOtherPageAction: () => void = () => {}
... ... @@ -490,14 +490,14 @@ struct ChildCommentItem {
fontWeight: FontWeight.Regular,
marginWidth: (95 + 16)
})
.margin({ left: 95, right: 16, top: -15 })
.margin({ left: this.leftGap, right: 16, top: -15 })
.onClick(() => {
this.replyComment()
})
if (this.item.commentPics.length > 0) {
Image(this.item.commentPics)
.width(88).height(88)
.margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: 95})
.margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: this.leftGap})
}
commentFooterView({
... ... @@ -505,7 +505,7 @@ struct ChildCommentItem {
dialogController: this.dialogController,
publishCommentModel: this.publishCommentModel,
dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction
}).margin({ left: 95, right: 16 })
}).margin({ left: this.leftGap, right: 16 })
}.alignItems(HorizontalAlign.Start)
.width('100%')
}
... ... @@ -540,7 +540,7 @@ struct ChildCommentItem {
}
}
.width(48).height(48)
.margin({ left: 47 })
.margin({ left: 47 + 4 })
.alignContent(Alignment.Center)
.onClick(() => {
... ... @@ -628,6 +628,7 @@ struct footerExpandedView {
}.height(20)
// .backgroundColor(Color.Green)
}.height(24)
.padding({left: 4})
.alignItems(VerticalAlign.Top)
// .backgroundColor(Color.Gray)
}
... ... @@ -663,6 +664,7 @@ struct commentHeaderView {
@Consume inDialog: boolean
private dialogBeforeJumpOtherPageAction: () => void = () => {}
private leftGap: number = 64
build() {
Column() {
... ... @@ -712,7 +714,7 @@ struct commentHeaderView {
fontWeight: FontWeight.Regular,
marginWidth: (59 + 16)
})
.margin({ left: 60, right: 16,top:-15 })
.margin({ left: this.leftGap, right: 16,top:-12 })
.onClick(() => {
this.replyComment()
})
... ... @@ -720,7 +722,7 @@ struct commentHeaderView {
if (this.item.commentPics.length > 0) {
Image(this.item.commentPics)
.width(88).height(88)
.margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: 60})
.margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: this.leftGap})
}
commentFooterView({
... ... @@ -728,7 +730,7 @@ struct commentHeaderView {
dialogController: this.dialogController,
publishCommentModel: this.publishCommentModel,
dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction
}).margin({ left: 60, right: 16 })
}).margin({ left: this.leftGap, right: 16 })
}.alignItems(HorizontalAlign.Start)
.padding({bottom: 0})
}
... ... @@ -763,7 +765,7 @@ struct commentHeaderView {
}
}
.width(48).height(48)
.margin({ left: 8 })
.margin({ left: 8 + 4 })
.alignContent(Alignment.Center)
.onClick(() => {
... ...
... ... @@ -58,7 +58,7 @@ export default struct MinePageUserSimpleInfoUI {
.alt(this.userType === "1"?$r('app.media.default_head_userPage'):$r('app.media.AccountOwner_DefaultIcon'))
.width(63.21)
.height(63.21)
.objectFit(ImageFit.Fill)
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
... ...
... ... @@ -358,7 +358,7 @@ export struct FollowChildComponent{
jumpCreatorHomePage() {
if(this.data.mainControl === 0){
ToastUtils.shortToast("无法查看此用户主页")
ToastUtils.shortToast("暂时无法查看该创作者主页")
}else if(this.data.banControl === 1){
ToastUtils.shortToast("该账号已封禁,不予访问")
}else{
... ...
... ... @@ -69,7 +69,7 @@ export struct SearchCreatorComponent{
jumpCreatorHomePage() {
if(Number.parseInt(this.item.mainControl) === 0){
ToastUtils.shortToast("无法查看此用户主页")
ToastUtils.shortToast("暂时无法查看该创作者主页")
}else if(Number.parseInt(this.item.banControl) === 1){
ToastUtils.shortToast("该账号已封禁,不予访问")
}else{
... ...
... ... @@ -19,6 +19,10 @@ interface ILikeStyleResp {
url: Resource;
name: string;
}
interface parsedObj {
contentId: string,
likeStatus: string
}
@Component
export struct LikeComponent {
... ... @@ -59,18 +63,18 @@ export struct LikeComponent {
this.likesStyle = this.contentDetailData.likesStyle
this.openLikes = this.contentDetailData.openLikes == 1 ? true : false
}
console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData))
console.log(TAG, 'this.componentType', this.componentType)
console.log(TAG, 'this.likesStyle', this.likesStyle)
console.log(TAG, 'this.openLikes', this.openLikes)
// console.log(TAG, 'this.contentDetailData', JSON.stringify(this.contentDetailData))
// console.log(TAG, 'this.componentType', this.componentType)
// console.log(TAG, 'this.likesStyle', this.likesStyle)
// console.log(TAG, 'this.openLikes', this.openLikes)
this.onDataUpdated()
this.contentTrackingDict()
}
onDataUpdated() {
console.log(TAG, '点赞点击')
if (this.data) {
if (this.data['contentType'] !== undefined ) {
console.log(TAG, 'CarderInteraction 点赞点击')
//获取点赞状态
this.getLikeStatus()
//获取点赞数
... ... @@ -458,6 +462,7 @@ export struct LikeComponent {
this.likeCount--
TrackingContent.like(false,this.pageId,this.pageName,this.pageParam)
}
}
if (this.likeCount <= 0) {
... ... @@ -479,19 +484,25 @@ export struct LikeComponent {
{
contentId: this.data['contentId'],
contentType: this.data['contentType'],
contentRelId: this.data['contentRelId'] || '' + '',
contentRelId: this.data['contentRelId'] == "0" ? '' : this.data['contentRelId'] || '' + '',
}
]
}
console.log(TAG, "查询点赞状态params", JSON.stringify(params))
// console.log(TAG, "CarderInteraction 查询点赞状态params", JSON.stringify(params))
ContentDetailRequest.postBatchLikeAndCollectStatus(params).then(res => {
console.log(TAG, '查询点赞、收藏状态==', JSON.stringify(res.data))
// console.log(TAG, 'CarderInteraction 查询点赞、收藏状态==', JSON.stringify(res.data))
if (res.data) {
if(res.data[0].likeStatus) {
this.likeStatus = res.data[0].likeStatus ? true : false
} else {
this.likeStatus = false
}
// CarderInteraction组件交互
if (this.data['likeStatus'] == "1") {
this.likeStatus = true
} else if (this.data['likeStatus'] == "0") {
this.likeStatus = false
}
}
}).catch(() => {
this.likeStatus = false
... ...
... ... @@ -30,7 +30,7 @@ export struct RecommendList {
ForEach(this.recommendList, (item: ContentDTO, index: number) => {
Row() {
CardParser({ compDTO:new CompDTO,contentDTO: item });
}
}.padding({ left: 6, right: 6 })
if (this.recommendList.length !== index + 1) {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
... ...
... ... @@ -102,9 +102,10 @@ export struct DetailPlayLiveCommon {
}
const detailData = data[0];
///直播方式 0 视频直播 1 文字直播
const liveWay = detailData.liveInfo?.liveWay as number;
// 人民号类型单独获取直播地址
if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running') {
if (detailData.rmhPlatform === 1 && detailData.liveInfo?.liveState === 'running' && liveWay == 0) {
const vliveId = detailData.liveInfo.vlive[0].vliveId as string;
const pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean;
... ... @@ -135,13 +136,14 @@ export struct DetailPlayLiveCommon {
publishCommentModel.commentContent = '';
this.liveStyle = detailData.liveInfo?.liveStyle;
if (detailData.liveInfo?.liveState === 'end') {
if (detailData.liveInfo?.liveState === 'end' && liveWay == 0) {
this.playUrl = detailData.liveInfo.vlive[0].replayUri;
}
resolve();
})
.catch(() => {
.catch((error:Error) => {
Logger.debug(TAG + "error",error.message,error.name)
this.isHideLoading = true;
ToastUtils.shortToast('内容不存在');
router.back();
... ...
... ... @@ -79,9 +79,10 @@ export class LiveDetailPageLogic {
// 只有直播中的才会有垫片
if(this.liveState === 'running'){
if (this.contentDetailData.liveInfo.vlive.count > 0) {
this.showPad = this.contentDetailData.liveInfo.vlive[index].showPad
}
}
}
... ...
... ... @@ -99,7 +99,7 @@ export struct DetailVideoListPage {
aboutToAppear() {
// 在视频详情页
this.peopleShipHomeCreatorId = AppStorage.get<string>('peopleShipHomeCreatorId') || '';
// console.info(TAG, `cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`)
console.info(TAG, `cj2024 peopleShipHomeCreatorId = ${this.peopleShipHomeCreatorId}`)
if (this.peopleShipHomeCreatorId) {
// 从人民号号主传过来的
this.getPeopleShipHomeDetail(this.peopleShipHomeCreatorId);
... ... @@ -120,13 +120,16 @@ export struct DetailVideoListPage {
if (action) {
this.contentId = action.params?.contentID || '';
if (action.params && action.params.extra) {
this.relId = action.params.extra.relId || '';
this.relType = action.params.extra.relType || '';
this.relId = action.params.extra.relId != "undefined" && action.params.extra.relId != '' ? action.params.extra.relId : '';
this.relType = action.params.extra.relType != "undefined" && action.params.extra.relType != '' ? action.params.extra.relType : '';
}
// console.info(TAG, `cj2024 getPeopleShipHomeDetail contentId = ${this.contentId}`)
// console.info(TAG, `cj2024 getPeopleShipHomeDetail relId = ${this.relId}`)
// console.info(TAG, `cj2024 getPeopleShipHomeDetail relType = ${this.relType}`)
await this.getRmhContentDetail(this.contentId, this.relId, this.relType)
this.getRmhPublishNexts(peopleShipHomeCreatorId, this.contentId, 1, 1, 10, systemDateTime.getTime(false));
}
// console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
} else {
// 无网络
this.netStatus = 1
... ...
... ... @@ -71,6 +71,8 @@ export class GetuiPush {
Logger.error(TAG, "个推SDK初始化失败,error = " + error)
}
})
this.setBadgeNumber(0)
}
async requestEnableNotifications(context: common.UIAbilityContext) : Promise<boolean> {
... ... @@ -120,6 +122,9 @@ export class GetuiPush {
this.setAlias(false, this.currentUserId)
}
})
EmitterUtils.receiveEvent(EmitterEventId.APP_ENTER_FOREGROUD, () => {
this.setBadgeNumber(0)
})
PushManager.setPushCallback({
// cid
... ... @@ -387,6 +392,7 @@ export class GetuiPush {
},
notificationSlotType: notificationManager.SlotType.CONTENT_INFORMATION,
wantAgent:want,
badgeNumber:1
};
notificationManager.publish(notificationRequest).then(() => {
Logger.debug(TAG, "本地发送系统通知完成")
... ...
import { Logger } from 'wdKit/src/main/ets/utils/Logger'
import { LoginModel } from './LoginModel'
import { LoginBean } from './LoginBean'
import { EmitterEventId, EmitterUtils, SPHelper, StringUtils, UserDataLocal } from 'wdKit'
import { AppUtils, EmitterEventId, EmitterUtils, SPHelper, StringUtils, UserDataLocal } from 'wdKit'
import { CheckVerifyBean } from './CheckVerifyBean'
import cryptoFramework from '@ohos.security.cryptoFramework'
import buffer from '@ohos.buffer'
... ... @@ -105,7 +105,7 @@ export class LoginViewModel {
SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName ?? "")
EmitterUtils.sendEmptyEvent(EmitterEventId.LOGIN_SUCCESS)
LoginModule.reportDeviceInfo()
LoginModule.reportDeviceInfo(AppUtils.gotApplicationContextFunc!())
}
async appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
... ...
... ... @@ -5,6 +5,8 @@ import { NewspaperWidgetCommon } from "../common/NewspaperWidgetCommon"
const TAG = "DailyNewspaperWidgetCard"
let storageWidgetImageUpdate = new LocalStorage();
const DAILY_NEWSPAPER_DEEP_LINK = "rmrbapp://rmrb.app/openwith?type=topic&subType=moring_evening_news&pageId=&relId=&skipType=1"
@Entry(storageWidgetImageUpdate)
@Component
struct DailyNewspaperWidgetCard {
... ... @@ -12,8 +14,6 @@ struct DailyNewspaperWidgetCard {
@LocalStorageProp('paperInfo') paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo;
@LocalStorageProp('paperContents') paperContents: FormNewspaperPaperContent[] = [];
private DAILY_NEWSPAPER_DEEP_LINK = "rmrbapp://rmrb.app/openwith?type=topic&subType=moring_evening_news&pageId=&relId=&skipType=1"
build() {
Column() {
... ... @@ -23,7 +23,7 @@ struct DailyNewspaperWidgetCard {
.width("100%").height(36)
// .margin({top: 3})
.onClick(() => {
jumpWithDeepLink(this.DAILY_NEWSPAPER_DEEP_LINK, this)
jumpWithDeepLink(DAILY_NEWSPAPER_DEEP_LINK, this)
})
Row() {
... ... @@ -51,7 +51,8 @@ struct DailyNewspaperWidgetCard {
.autoResize(true)
.borderRadius(6)
.onClick(() => {
jumpWithDeepLink(this.paperInfo.leftDeepLink || "", this)
// jumpWithDeepLink(this.paperInfo.leftDeepLink || "", this)
jumpWithDeepLink(DAILY_NEWSPAPER_DEEP_LINK, this)
})
Text(this.paperInfo.leftTitle)
... ... @@ -123,7 +124,8 @@ struct ContentCellView {
}
.justifyContent(FlexAlign.Start)
.onClick(() => {
jumpWithDeepLink(this.content.deepLink || "", this)
// jumpWithDeepLink(this.content.deepLink || "", this)
jumpWithDeepLink(DAILY_NEWSPAPER_DEEP_LINK, this)
})
}
}
... ...
import { AbilityConstant, common, Want } from '@kit.AbilityKit'
import { DeviceUtil,
import {
AppUtils,
DeviceUtil,
EmitterEventId,
EmitterUtils,
KVStoreHelper,
... ... @@ -58,6 +60,11 @@ export class StartupManager {
// 路由注册
registerRouter();
// 设置全局context
AppUtils.gotApplicationContextFunc = () => {
return this.context!
}
// 网络模块
NetworkManager.getInstance().init()
... ...