wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix |> 19984 图文稿件详情页,播放稿件中的视频,进度滑块与已播放进度条重叠
  fix: 17669 早晚报>多图类型稿件详情页-评论数据样式与安卓不一致
  ref |> 修复竖屏直播后台结束直播,未显示直播结束页面问题
  fix: 20364 人民号>推荐,推荐动态内容,号主简介较长时缺少省略,与关注按钮重叠。
  fix |> 20377 个人评论列表,点击已评论图文稿件,进入稿件情页,未锚定评论区
  fix |> 18815 互动消息-点击历史评论,鸿蒙版视频和图集详情页无法直接跳转到对应详情页的评论区
  fix: 19347 卡片来源显示规则-来源过长时,不符合省略优先级
  fix: 图集替换ir单方案,修改了部分,方案还有问题
  fix |> 20448 不能评论的稿件详情页面,最下方的推荐阅读,展示不完整
  ref |> 修复缺陷 19128-进入热点-大图卡-姜尚竖屏直播,向右滑动,点击清屏按钮,返回卡顿,清屏按钮没立马消失
  ref |> 解决多次点击需要登录的按钮时,会多次弹窗登录页面问题
  ref |> 调整横屏直播直播直播标题滚动实现,滚动速度和安卓保持基本一致
  fix |> 20479 图文稿件详情页中视频播放器控件,播放按钮与右侧进度条要居中对齐,播放按钮与视频时长间距过大
Showing 18 changed files with 264 additions and 64 deletions
... ... @@ -257,9 +257,9 @@ export struct WdWebLocalComponent {
startProgressTimer() {
this.progressTimerNumber = setTimeout(() => {
animateTo({duration: 1000}, () => {
// animateTo({duration: 1000}, () => {
this.progressOpacity = 0
})
// })
}, 3000)
}
cancelProgressTimer() {
... ... @@ -313,13 +313,13 @@ export struct WdWebLocalComponent {
}
})
.onClick(() => {
animateTo({duration: 1000}, () => {
// animateTo({duration: 1000}, () => {
if (this.progressOpacity <= 0) {
this.progressOpacity = 1
} else {
this.progressOpacity = 0
}
})
// })
})
if (this.isEndPlay){
... ... @@ -350,12 +350,14 @@ export struct WdWebLocalComponent {
this.controller.pause()
this.cancelProgressTimer()
}
})
}).margin({right:16})
Row() {
Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000))
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
Slider({
value: this.currentTime,
min: 0,
... ... @@ -385,8 +387,8 @@ export struct WdWebLocalComponent {
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
}
.justifyContent(FlexAlign.Center)
}.alignItems(VerticalAlign.Center)
.height(48)
// Image($r('app.media.icon_full_screen'))
// .width(24)
... ... @@ -401,7 +403,9 @@ export struct WdWebLocalComponent {
colors: [[0x20000000, 0.0], [Color.Transparent, 1.0]] // [0x80000000, 0.5],
})
.width("100%")
.justifyContent(FlexAlign.SpaceAround)
.height(48)
.padding({left:16})
.alignItems(VerticalAlign.Center)
}
}
... ...
import display from '@ohos.display';
const TAG = 'GalleryImage'
@Component
export struct GalleryImage {
private url: string = "";
private index: number = 0;
@State downLoadEnable: boolean = true;
@Link isScaling: boolean
@State showLoading: boolean = false;
@State rotateAngle: number = 0;
@State showError: boolean = false;
@State scaleValue: number = 1;
@State pinchValue: number = 1;
@State pinchX: number | string = '50%';
@State pinchY: number | string = '50%';
private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.None, fingers: 1 })
@State offsetX: number = 0
@State offsetY: number = 0
@State positionX: number = 0
@State positionY: number = 0
private imageWith: number = 0;
@State sizeValue: number = 0;
//alt app.media.picture_loading 设计稿尺寸
@State imageWidth:string | number = 167
aboutToAppear(): void {
this.showLoading = true;
this.downLoadEnable = false;
console.info(TAG);
}
aboutToDisAppear(): void {
console.info("");
}
aboutToReuse(): void {
console.info("");
}
build() {
Column() {
Image(this.url)
.width(this.imageWidth)
.height("100%")
.objectFit(ImageFit.Contain)//todo 加载失败时占位图没隐藏
.alt($r("app.media.datail_imageLoading_w"))
.interpolation(ImageInterpolation.High)
.onComplete(msg => {
if (msg) {
this.imageWidth = '100%'
console.info(TAG, "index:" + this.index + ", loadingStatus:" + msg.loadingStatus)
// 图片数据加载成功
if (msg.loadingStatus === 0) {
this.showLoading = true;
this.downLoadEnable = false;
} else if (msg.loadingStatus === 1) {
// 图片数据解码成功
this.showLoading = false;
this.downLoadEnable = true;
this.imageWith = px2vp(display.getDefaultDisplaySync().width)
}
}
})
.onError(() => {
console.info(TAG, "图片加载异常")
this.showLoading = false;
this.showError = true;
})// 在组件上绑定缩放比例,可以通过修改缩放比例来实现组件的缩小或者放大
.scale({
x: this.scaleValue,
y: this.scaleValue,
z: 1,
centerX: this.pinchX,
centerY: this.pinchY
})// 以组件左上角为坐标原点进行移动
.translate({ x: this.offsetX, y: this.offsetY, z: 0 })
.gesture(
GestureGroup(GestureMode.Parallel,
// 两指或以上的捏合手势
PinchGesture({ fingers: 2 })
.onActionStart(() => {
console.info(TAG, 'Pinch start');
})// 当捏合手势触发时,可以通过回调函数获取缩放比例,从而修改组件的缩放比例
.onActionUpdate((event: GestureEvent) => {
const scaleValue = this.pinchValue * event.scale;
if (scaleValue <= 3 && scaleValue >= 0.8) {
this.scaleValue = scaleValue;
this.pinchX = event.pinchCenterX;
this.pinchY = event.pinchCenterY;
}
})
.onActionEnd(() => {
this.pinchValue = this.scaleValue;
console.info(TAG, 'Pinch end');
if (this.pinchValue > 1) {
this.panOption.setDirection(PanDirection.Horizontal)
this.isScaling = true;
} else {
this.panOption.setDirection(PanDirection.None)
this.isScaling = false;
}
}),
// 绑定count为1的TapGesture
TapGesture({ count: 1 })
.onAction(() => {
}),
// 绑定count为2的TapGesture
TapGesture({ count: 2 })
.onAction(() => {
console.info(TAG, '双击 start')
animateTo({
duration: 400,
}, () => {
this.scaleValue = 1;
this.pinchX = '50%';
this.pinchY = '50%';
this.pinchValue = this.scaleValue;
this.offsetX = 0;
this.offsetY = 0;
this.positionX = 0;
this.positionY = 0;
this.panOption.setDirection(PanDirection.None);
this.isScaling = false;
})
}),
PanGesture(this.panOption)
.onActionStart(() => {
console.info(TAG, 'Pan start')
})
.onActionUpdate((event?: GestureEvent) => {
if (event) {
if (this.scaleValue > 1) {
this.offsetX = this.positionX + event.offsetX
this.offsetY = this.positionY + event.offsetY
this.sizeValue = this.imageWith
}
}
})
.onActionEnd(() => {
this.positionX = this.offsetX
this.positionY = this.offsetY
console.info(TAG, 'Pan end')
})
))
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
}
}
\ No newline at end of file
... ...
... ... @@ -186,8 +186,10 @@ export struct ImageAndTextPageComponent {
.justifyContent(FlexAlign.Center)
}
if (this.recommendList.length > 0) {
Divider().strokeWidth(8).color('#f5f5f5')
RecommendList({ recommendList: this.recommendList })
Column(){
Divider().strokeWidth(8).color('#f5f5f5')
RecommendList({ recommendList: this.recommendList })
}.padding({bottom:this.contentDetailData?.openComment ? 0 : 44 })
}
// 评论
if (this.contentDetailData?.openComment) {
... ...
... ... @@ -84,6 +84,8 @@ export struct InteractMComponent {
contentDTO.objectId = this.messageModel.InteractMsubM.contentId
contentDTO.relId = this.messageModel.InteractMsubM.contentRelId
contentDTO.relType = this.messageModel.InteractMsubM.contentRelType
contentDTO.customParamTargetLayout = "comment"
ProcessUtils.processPage(contentDTO)
})
}
... ...
... ... @@ -114,8 +114,16 @@ export struct MultiPictureDetailItemComponent {
calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size {
let width = 0
let height = 0;
width = size.width;
height = size.width / imageWHRatio;
// width = size.width;
// height = size.width / imageWHRatio;
if (imageWHRatio > size.width / size.height) {
// 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示
width = size.width;
height = size.width / imageWHRatio;
} else {
height = size.height;
width = size.height * imageWHRatio;
}
return { width: width, height: height };
}
... ... @@ -179,7 +187,9 @@ export struct MultiPictureDetailItemComponent {
Image(this.imagePixelMap || 'app.media.datail_imageLoading_w')// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.alt($r('app.media.datail_imageLoading_w'))
.width(this.imageWidth)
.aspectRatio(this.imageWHRatio)
.objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.autoResize(false)
.interpolation(ImageInterpolation.High)
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
... ... @@ -229,11 +239,6 @@ export struct MultiPictureDetailItemComponent {
.gesture(
GestureGroup(
GestureMode.Exclusive,
// 单击返回上一层
// TapGesture({ count: 1 })
// .onAction(() => {
// router.back()
// }),
// TODO:知识点:双击切换图片大小
TapGesture({ count: 2 })
.onAction(() => {
... ... @@ -315,9 +320,10 @@ export struct MultiPictureDetailItemComponent {
}
this.imageScaleInfo.stash();
}),
// // TODO:知识点:滑动图片
// TODO:知识点:滑动图片
// PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片
// .onActionUpdate((event: GestureEvent) => {
// console.log(TAG, "PanGesture", JSON.stringify(event))
// if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) {
// // 默认大小下不允许移动
// return;
... ...
... ... @@ -100,12 +100,6 @@ export struct CardSourceInfo {
return flag;
}
showCommentNum() {
const curRouter = router.getState().name;
// return curRouter !== 'PeopleShipHomePage'
return true
}
/**
* 全域数字显示规则
* 1、当数量为千位以內时,显示数字,不保留小数点,比如 4585
... ... @@ -150,25 +144,12 @@ export struct CardSourceInfo {
}
showDot() {
// return (this.showTime() && (this.contentDTO.rmhPlatform === 1 || this.contentDTO.source)) || ((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName &&
// this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) &&
// (this.getContentDtoBean()?.interactData?.commentNum
// // || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != ''
// || (this.contentDTO.isSearch || this.contentDTO.isCollection ||
// !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
// (Number
// .parseFloat(this
// .contentDTO.publishTime))
// .indexOf
// ('-') === -1)
// )
let flag = false;
if (this.contentDTO.rmhPlatform === 1 || this.contentDTO.source) {
if (this.showTime() && !this.isEllipsisActive) {
flag = true
} else if (!this.isEllipsisActive) {
if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
this.showCommentNum()) {
if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0) {
flag = true;
} else if (this.contentDTO.objectType !=='2' && this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
flag = true;
... ... @@ -271,10 +252,8 @@ export struct CardSourceInfo {
}
// 评论数
// if (!this.contentDTO.cornerMark && !this.contentDTO.corner && !this.isEllipsisActive) {
if (!this.isEllipsisActive) {
if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
this.showCommentNum()) {
if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0) {
Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)
.fontSize(12)
.fontColor($r("app.color.color_B0B0B0"))
... ... @@ -328,17 +307,11 @@ export struct CardSourceInfo {
* @returns
*/
private getContentDtoBean(): ContentDTO {
let content = new ContentDTO
if (this.compDTO == undefined) {
content = this.contentDTO
}
if (this.compDTO.operDataList.length == 0) {
content = this.contentDTO
}
if (!content) {
content = this.compDTO.operDataList[0]
if (this.compDTO.operDataList.length > 0) {
return this.compDTO.operDataList[0]
} else {
return this.contentDTO
}
return content;
}
/**
... ... @@ -366,8 +339,7 @@ export struct CardSourceInfo {
}
// 评论数
if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
this.showCommentNum()) {
if (this.contentDTO.objectType !=='2' && !this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0) {
have = true
} else {
if (this.contentDTO.objectType !=='2' && this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
... ...
... ... @@ -196,7 +196,7 @@ export struct RmhTitle {
.textAlign(TextAlign.Start)
.height(14)
.lineHeight(14)
.width('calc(100% - 54vp)')
.width('calc(100% - 65vp)')
// .constraintSize({maxWidth:(DisplayUtils.getDeviceWidth() - 32 - 36 - 18 - this.getTextWidth(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))))})
}
... ...
... ... @@ -300,6 +300,7 @@ function getParams(item: CommentListItem) : ContentDTO{
contentDTO.objectType = item.targetType + "";
contentDTO.newsTitle = item.targetTitle
contentDTO.showComment = true
contentDTO.customParamTargetLayout = "comment"
return contentDTO
}
... ...
... ... @@ -361,7 +361,7 @@ export struct LikeComponent {
.height(24)
if (this.likeCount > 0){
RelativeContainer() {
Image($r('app.media.ic_like_white_Select'))
Image(this.styleType == 1 ? $r('app.media.ic_like_white_Select') : $r('app.media.ic_like_back_Select'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
... ...
... ... @@ -100,6 +100,7 @@ export struct MultiPictureListPage {
.vertical(false)
.autoPlay(false)
.loop(false)
.disableSwipe(!this.isEnableSwipe)
.effectMode(EdgeEffect.None)
.cachedCount(3)
.indicator(false)
... ...
import {
PhotoListBean,
} from 'wdBean';
export class MyDataSource implements IDataSource {
private list: PhotoListBean[] = []
// private listener: DataChangeListener
constructor(list: PhotoListBean[]) {
this.list = list
}
totalCount(): number {
return this.list.length
}
getData(index: number): PhotoListBean {
return this.list[index]
}
getList(): PhotoListBean[] {
return this.list;
}
registerDataChangeListener(listener: DataChangeListener): void {
// this.listener = listener
}
unregisterDataChangeListener() {
}
}
\ No newline at end of file
... ...
... ... @@ -41,6 +41,8 @@ export struct DetailPlayVLivePage {
@Consume @Watch('closeFullScreen') pageHide: number
@Consume contentId: string
@State swiperIndex: number = 1
///是否展示清屏按钮
@State showClearButton: boolean = false
@Consume liveDetailPageLogic: LiveDetailPageLogic
@Provide lastInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的消息
//播放错误
... ... @@ -124,6 +126,7 @@ export struct DetailPlayVLivePage {
} break
case LiveMessageOptType.ZH_STOP_LIVE: {
this.liveState = "end"
this.playUrl = ""
this.contentDetailData.liveInfo.liveState = "end"
} break
case LiveMessageOptType.ZH_CHANGE_PAD: {
... ... @@ -198,6 +201,7 @@ export struct DetailPlayVLivePage {
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex,
showClearButton: $showClearButton
})
// 直播资源加载失败
... ... @@ -241,7 +245,7 @@ export struct DetailPlayVLivePage {
Image($r('app.media.icon_live_more'))
.width(40)
.aspectRatio(1)
.visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)
.visibility(this.showClearButton ? Visibility.Visible : Visibility.Hidden)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: 56, y: this.bottomSafeHeight })
.onClick(() => {
... ...
... ... @@ -130,13 +130,14 @@ export struct PlayUIComponent {
})
if (this.contentDetailData.liveInfo?.liveState != 'wait') {
//标题
Text(this.contentDetailData.newsTitle)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.MARQUEE })
Marquee({
start:true,
loop: 1,
src:this.contentDetailData.newsTitle
})
.fontSize(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '18vp' : '16vp')
.fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500)
.fontColor(Color.White)
.textAlign(TextAlign.Start)
.layoutWeight(1)
} else {
Blank()
... ...
... ... @@ -28,7 +28,7 @@ export struct PlayerEndView {
DateTimeUtils.parseDate(this.contentDetailData.liveInfo.startTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
let en = DateTimeUtils.parseDate(this.contentDetailData.liveInfo.endTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
if (this.contentDetailData.liveInfo?.endTime == null) {
en = DateTimeUtils.getTimeStamp()
en = DateTimeUtils.parseDate(DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN),DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
}
const sd = DateTimeUtils.getDuration(sn, en)
this.duration = DateTimeUtils.liveDurationSecondToTime(sd / 1000)
... ...
... ... @@ -10,9 +10,9 @@ export struct PlayerInfoComponent {
@Consume liveState: string
@Consume isShowControl: boolean
@Link swiperIndex: number
@Link showClearButton: boolean
@Provide isFullScreen: boolean = false // 判断是否全屏,全屏状态下swiper禁止切换
build() {
Column() {
Swiper(this.swiperController) {
... ... @@ -35,12 +35,23 @@ export struct PlayerInfoComponent {
this.isShowControl = !this.isShowControl
}
})
.onChange((index) => {
this.swiperIndex = index
.onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
this.dealShowClearButton(index,extraInfo.currentOffset)
})
.onAnimationEnd((index: number, extraInfo: SwiperAnimationEvent) => {
this.dealShowClearButton(index,extraInfo.currentOffset)
})
.disableSwipe(this.isFullScreen)
}
.height('100%')
.width('100%')
}
dealShowClearButton(index:number, currentOffset: number) {
this.swiperIndex = index
if (index == 0) {
this.showClearButton = currentOffset >= 0;
}else if (index == 1) {
this.showClearButton = false
}
}
}
\ No newline at end of file
... ...
... ... @@ -9,15 +9,24 @@ import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo'
import { common } from '@kit.AbilityKit'
class LoginJumpHandler implements JumpInterceptorAction {
private logining = false
/// 说明是调用了跳转 WDRouterPage.loginPage 页面的行为
on(params?: object | undefined, singleMode?: boolean | undefined): boolean {
if (this.logining) {
return true
}
this.logining = true
HuaweiAuth.sharedInstance().fetchAnonymousPhone().then((anonymousPhone) => {
router.pushUrl({url: WDRouterPage.oneKeyLoginPage.url()})
this.logining = false
}).catch((error: string) => {
router.pushUrl({url: WDRouterPage.loginPage.url()})
this.logining = false
})
return true
}
... ...
... ... @@ -337,6 +337,7 @@ export struct MultiPictureDetailPageComponent {
.indicator(false)
.displayCount(1)
.loop(false)
.disableSwipe(!this.isEnableSwipe)
.effectMode(EdgeEffect.Spring)
.id('e_swiper_content')
.alignRules({
... ...