陈剑华

Merge remote-tracking branch 'origin/main'

Showing 19 changed files with 370 additions and 77 deletions
@@ -350,12 +350,14 @@ export struct WdWebLocalComponent { @@ -350,12 +350,14 @@ export struct WdWebLocalComponent {
350 this.controller.pause() 350 this.controller.pause()
351 this.cancelProgressTimer() 351 this.cancelProgressTimer()
352 } 352 }
353 - }) 353 + }).margin({right:16})
  354 +
354 Row() { 355 Row() {
355 Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)) 356 Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000))
356 .fontSize(12) 357 .fontSize(12)
357 .fontColor(Color.White) 358 .fontColor(Color.White)
358 .fontWeight(600) 359 .fontWeight(600)
  360 +
359 Slider({ 361 Slider({
360 value: this.currentTime, 362 value: this.currentTime,
361 min: 0, 363 min: 0,
@@ -385,8 +387,8 @@ export struct WdWebLocalComponent { @@ -385,8 +387,8 @@ export struct WdWebLocalComponent {
385 .fontSize(12) 387 .fontSize(12)
386 .fontColor(Color.White) 388 .fontColor(Color.White)
387 .fontWeight(600) 389 .fontWeight(600)
388 - }  
389 - .justifyContent(FlexAlign.Center) 390 + }.alignItems(VerticalAlign.Center)
  391 + .height(48)
390 392
391 // Image($r('app.media.icon_full_screen')) 393 // Image($r('app.media.icon_full_screen'))
392 // .width(24) 394 // .width(24)
@@ -401,7 +403,9 @@ export struct WdWebLocalComponent { @@ -401,7 +403,9 @@ export struct WdWebLocalComponent {
401 colors: [[0x20000000, 0.0], [Color.Transparent, 1.0]] // [0x80000000, 0.5], 403 colors: [[0x20000000, 0.0], [Color.Transparent, 1.0]] // [0x80000000, 0.5],
402 }) 404 })
403 .width("100%") 405 .width("100%")
404 - .justifyContent(FlexAlign.SpaceAround) 406 + .height(48)
  407 + .padding({left:16})
  408 + .alignItems(VerticalAlign.Center)
405 } 409 }
406 } 410 }
407 411
@@ -139,29 +139,7 @@ export struct DynamicDetailComponent { @@ -139,29 +139,7 @@ export struct DynamicDetailComponent {
139 139
140 build() { 140 build() {
141 Column() { 141 Column() {
142 - //logo、日期  
143 - Row() {  
144 - Image($r('app.media.ic_article_rmh'))  
145 - .width($r('app.float.margin_80'))  
146 - .height($r('app.float.margin_28'))  
147 - .margin({ left: $r('app.float.margin_16') })  
148 - Blank()  
149 - Text(this.publishTime)  
150 - .fontColor($r('app.color.color_B0B0B0'))  
151 - .fontSize($r('app.float.font_size_12'))  
152 - .lineHeight($r('app.float.margin_28'))  
153 - .margin({ right: $r('app.float.margin_16') })  
154 - }  
155 - .height($r('app.float.margin_48'))  
156 - .width('100%')  
157 - .alignItems(VerticalAlign.Bottom)  
158 - .padding({ bottom: 5 })  
159 - .margin({top: `${this.topSafeHeight}px`})  
160 - //分割线  
161 - Image($r('app.media.ic_news_detail_division'))  
162 - .width('100%')  
163 - .height($r('app.float.margin_6'))  
164 - .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) 142 + this.topNav()
165 Stack({ alignContent: Alignment.Bottom }) { 143 Stack({ alignContent: Alignment.Bottom }) {
166 if (!this.isNetConnected) { 144 if (!this.isNetConnected) {
167 EmptyComponent({ 145 EmptyComponent({
@@ -704,6 +682,72 @@ export struct DynamicDetailComponent { @@ -704,6 +682,72 @@ export struct DynamicDetailComponent {
704 .height('100%') 682 .height('100%')
705 } 683 }
706 684
  685 + @Builder topNav() {
  686 + //logo、日期
  687 + Row() {
  688 + Image($r('app.media.ic_article_rmh'))
  689 + .width($r('app.float.margin_80'))
  690 + .height($r('app.float.margin_28'))
  691 + .margin({ left: $r('app.float.margin_16') })
  692 + Blank()
  693 + Text(this.publishTime)
  694 + .fontColor($r('app.color.color_B0B0B0'))
  695 + .fontSize($r('app.float.font_size_12'))
  696 + .lineHeight($r('app.float.margin_28'))
  697 + .margin({ right: $r('app.float.margin_16') })
  698 + }
  699 + .height($r('app.float.margin_48'))
  700 + .width('100%')
  701 + .alignItems(VerticalAlign.Bottom)
  702 + .padding({ bottom: 5 })
  703 + .margin({top: `${this.topSafeHeight}px`})
  704 + //分割线
  705 + Image($r('app.media.ic_news_detail_division'))
  706 + .width('100%')
  707 + .height($r('app.float.margin_6'))
  708 + .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
  709 +
  710 + // 发布时间 ,TODO:需要参考文章详情
  711 + // Column() {
  712 + // Row() {
  713 + // if (this.isNetConnected && this.contentDetailData) {
  714 + // if (this.contentDetailData.rmhPlatform == 1) { // 人民号
  715 + // if (this.contentDetailData?.rmhInfo?.userType == "5") { // 内容源账号
  716 + // Blank().height(1)
  717 + // } else {
  718 + // Image($r('app.media.logo_rmh')).width(80) .height(28)
  719 + // }
  720 + // } else if (this.contentDetailData.rmhPlatform == 2) { // 普通用户
  721 + // Blank().height(1)
  722 + // } else {
  723 + // Image($r('app.media.logo_rmrb')).width(80) .height(28)
  724 + // }
  725 + // Text(this.publishTime)
  726 + // .fontColor($r('app.color.color_B0B0B0'))
  727 + // .fontSize(13)
  728 + // .height(20)
  729 + // }
  730 + // }
  731 + // .width(CommonConstants.FULL_WIDTH)
  732 + // .height($r('app.float.margin_48'))
  733 + // .padding({ left: 15, right: 15, })
  734 + // .justifyContent(FlexAlign.SpaceBetween)
  735 + // .alignItems(VerticalAlign.Bottom)
  736 + //
  737 + // // if (this.isNetConnected && !this.detailContentEmpty) {
  738 + // Row() {
  739 + // Image($r('app.media.ic_news_detail_division'))
  740 + // .width('100%')
  741 + // .height(6)
  742 + // .margin({ top: 10 })
  743 + // .objectFit(ImageFit.Fill)
  744 + // }
  745 + // .padding({ left: 15, right: 15 })
  746 + // .backgroundColor(Color.White)
  747 + // // }
  748 + // }.backgroundColor(Color.White)
  749 + }
  750 +
707 private titleText() { 751 private titleText() {
708 if(!StringUtils.isEmpty(this.contentDetailData.newsContent)){ 752 if(!StringUtils.isEmpty(this.contentDetailData.newsContent)){
709 return this.contentDetailData.newsContent 753 return this.contentDetailData.newsContent
  1 +import display from '@ohos.display';
  2 +
  3 +const TAG = 'GalleryImage'
  4 +
  5 +@Component
  6 +export struct GalleryImage {
  7 + private url: string = "";
  8 + private index: number = 0;
  9 + @State downLoadEnable: boolean = true;
  10 + @Link isScaling: boolean
  11 + @State showLoading: boolean = false;
  12 + @State rotateAngle: number = 0;
  13 + @State showError: boolean = false;
  14 + @State scaleValue: number = 1;
  15 + @State pinchValue: number = 1;
  16 + @State pinchX: number | string = '50%';
  17 + @State pinchY: number | string = '50%';
  18 + private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.None, fingers: 1 })
  19 + @State offsetX: number = 0
  20 + @State offsetY: number = 0
  21 + @State positionX: number = 0
  22 + @State positionY: number = 0
  23 + private imageWith: number = 0;
  24 + @State sizeValue: number = 0;
  25 +
  26 + //alt app.media.picture_loading 设计稿尺寸
  27 + @State imageWidth:string | number = 167
  28 +
  29 + aboutToAppear(): void {
  30 + this.showLoading = true;
  31 + this.downLoadEnable = false;
  32 + console.info(TAG);
  33 + }
  34 +
  35 + aboutToDisAppear(): void {
  36 + console.info("");
  37 + }
  38 +
  39 + aboutToReuse(): void {
  40 + console.info("");
  41 + }
  42 +
  43 + build() {
  44 + Column() {
  45 + Image(this.url)
  46 + .width(this.imageWidth)
  47 + .height("100%")
  48 + .objectFit(ImageFit.Contain)//todo 加载失败时占位图没隐藏
  49 + .alt($r("app.media.datail_imageLoading_w"))
  50 + .interpolation(ImageInterpolation.High)
  51 + .onComplete(msg => {
  52 + if (msg) {
  53 + this.imageWidth = '100%'
  54 + console.info(TAG, "index:" + this.index + ", loadingStatus:" + msg.loadingStatus)
  55 + // 图片数据加载成功
  56 + if (msg.loadingStatus === 0) {
  57 + this.showLoading = true;
  58 + this.downLoadEnable = false;
  59 + } else if (msg.loadingStatus === 1) {
  60 + // 图片数据解码成功
  61 + this.showLoading = false;
  62 + this.downLoadEnable = true;
  63 + this.imageWith = px2vp(display.getDefaultDisplaySync().width)
  64 + }
  65 + }
  66 + })
  67 + .onError(() => {
  68 + console.info(TAG, "图片加载异常")
  69 + this.showLoading = false;
  70 + this.showError = true;
  71 + })// 在组件上绑定缩放比例,可以通过修改缩放比例来实现组件的缩小或者放大
  72 + .scale({
  73 + x: this.scaleValue,
  74 + y: this.scaleValue,
  75 + z: 1,
  76 + centerX: this.pinchX,
  77 + centerY: this.pinchY
  78 + })// 以组件左上角为坐标原点进行移动
  79 + .translate({ x: this.offsetX, y: this.offsetY, z: 0 })
  80 + .gesture(
  81 + GestureGroup(GestureMode.Parallel,
  82 + // 两指或以上的捏合手势
  83 + PinchGesture({ fingers: 2 })
  84 + .onActionStart(() => {
  85 + console.info(TAG, 'Pinch start');
  86 + })// 当捏合手势触发时,可以通过回调函数获取缩放比例,从而修改组件的缩放比例
  87 + .onActionUpdate((event: GestureEvent) => {
  88 + const scaleValue = this.pinchValue * event.scale;
  89 + if (scaleValue <= 3 && scaleValue >= 0.8) {
  90 + this.scaleValue = scaleValue;
  91 + this.pinchX = event.pinchCenterX;
  92 + this.pinchY = event.pinchCenterY;
  93 + }
  94 + })
  95 + .onActionEnd(() => {
  96 + this.pinchValue = this.scaleValue;
  97 + console.info(TAG, 'Pinch end');
  98 + if (this.pinchValue > 1) {
  99 + this.panOption.setDirection(PanDirection.Horizontal)
  100 + this.isScaling = true;
  101 + } else {
  102 + this.panOption.setDirection(PanDirection.None)
  103 + this.isScaling = false;
  104 + }
  105 + }),
  106 + // 绑定count为1的TapGesture
  107 + TapGesture({ count: 1 })
  108 + .onAction(() => {
  109 + }),
  110 + // 绑定count为2的TapGesture
  111 + TapGesture({ count: 2 })
  112 + .onAction(() => {
  113 + console.info(TAG, '双击 start')
  114 + animateTo({
  115 + duration: 400,
  116 + }, () => {
  117 + this.scaleValue = 1;
  118 + this.pinchX = '50%';
  119 + this.pinchY = '50%';
  120 + this.pinchValue = this.scaleValue;
  121 + this.offsetX = 0;
  122 + this.offsetY = 0;
  123 + this.positionX = 0;
  124 + this.positionY = 0;
  125 + this.panOption.setDirection(PanDirection.None);
  126 + this.isScaling = false;
  127 + })
  128 + }),
  129 + PanGesture(this.panOption)
  130 + .onActionStart(() => {
  131 + console.info(TAG, 'Pan start')
  132 + })
  133 + .onActionUpdate((event?: GestureEvent) => {
  134 + if (event) {
  135 + if (this.scaleValue > 1) {
  136 + this.offsetX = this.positionX + event.offsetX
  137 + this.offsetY = this.positionY + event.offsetY
  138 + this.sizeValue = this.imageWith
  139 + }
  140 + }
  141 + })
  142 + .onActionEnd(() => {
  143 + this.positionX = this.offsetX
  144 + this.positionY = this.offsetY
  145 + console.info(TAG, 'Pan end')
  146 + })
  147 + ))
  148 + }
  149 + .width('100%')
  150 + .height('100%')
  151 + .justifyContent(FlexAlign.Center)
  152 + }
  153 +}
@@ -5,7 +5,8 @@ import { @@ -5,7 +5,8 @@ import {
5 EmitterUtils, 5 EmitterUtils,
6 EmitterEventId, 6 EmitterEventId,
7 NetworkUtil, 7 NetworkUtil,
8 - DisplayUtils 8 + DisplayUtils,
  9 + ToastUtils
9 } from 'wdKit'; 10 } from 'wdKit';
10 import { 11 import {
11 Action, 12 Action,
@@ -185,8 +186,10 @@ export struct ImageAndTextPageComponent { @@ -185,8 +186,10 @@ export struct ImageAndTextPageComponent {
185 .justifyContent(FlexAlign.Center) 186 .justifyContent(FlexAlign.Center)
186 } 187 }
187 if (this.recommendList.length > 0) { 188 if (this.recommendList.length > 0) {
188 - Divider().strokeWidth(8).color('#f5f5f5')  
189 - RecommendList({ recommendList: this.recommendList }) 189 + Column(){
  190 + Divider().strokeWidth(8).color('#f5f5f5')
  191 + RecommendList({ recommendList: this.recommendList })
  192 + }.padding({bottom:this.contentDetailData?.openComment ? 0 : 44 })
190 } 193 }
191 // 评论 194 // 评论
192 if (this.contentDetailData?.openComment) { 195 if (this.contentDetailData?.openComment) {
@@ -264,9 +267,17 @@ export struct ImageAndTextPageComponent { @@ -264,9 +267,17 @@ export struct ImageAndTextPageComponent {
264 Column() { 267 Column() {
265 Row() { 268 Row() {
266 if (this.isNetConnected && !this.detailContentEmpty) { 269 if (this.isNetConnected && !this.detailContentEmpty) {
267 - Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))  
268 - .width(80)  
269 - .height(28) 270 + if (this.contentDetailData.rmhPlatform == 1) { // 人民号
  271 + if (this.contentDetailData?.rmhInfo?.userType == "5") { // 内容源账号
  272 + Blank().height(1)
  273 + } else {
  274 + Image($r('app.media.logo_rmh')).width(80) .height(28)
  275 + }
  276 + } else if (this.contentDetailData.rmhPlatform == 2) { // 普通用户
  277 + Blank().height(1)
  278 + } else {
  279 + Image($r('app.media.logo_rmrb')).width(80) .height(28)
  280 + }
270 Text(this.publishTime) 281 Text(this.publishTime)
271 .fontColor($r('app.color.color_B0B0B0')) 282 .fontColor($r('app.color.color_B0B0B0'))
272 .fontSize(13) 283 .fontSize(13)
@@ -439,22 +450,25 @@ export struct ImageAndTextPageComponent { @@ -439,22 +450,25 @@ export struct ImageAndTextPageComponent {
439 PageRepository.postExecuteLike(params).then(res => { 450 PageRepository.postExecuteLike(params).then(res => {
440 // console.log(TAG, '点赞、res', JSON.stringify(res)) 451 // console.log(TAG, '点赞、res', JSON.stringify(res))
441 // console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) 452 // console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
442 - if (this.newsStatusOfUser) {  
443 - //内容点赞、取消点赞Tracking 1点赞 0取消点赞  
444 - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'  
445 - if (this.newsStatusOfUser.likeStatus === '1') {  
446 - this.likeNum = Number(this.likeNum) + 1 453 + if (res.code != 0){
  454 + ToastUtils.showToast(res.message, 1000);
  455 + }else {
  456 + if (this.newsStatusOfUser) {
  457 + //内容点赞、取消点赞Tracking 1点赞 0取消点赞
  458 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
  459 + if (this.newsStatusOfUser.likeStatus === '1') {
  460 + this.likeNum = Number(this.likeNum) + 1
  461 + } else {
  462 + this.likeNum = Number(this.likeNum) - 1
  463 + }
  464 + // console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)
  465 + // this.queryContentInteractCount()
  466 + TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
447 } else { 467 } else {
448 - this.likeNum = Number(this.likeNum) - 1 468 + // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象
  469 + this.getInteractDataStatus()
449 } 470 }
450 - // console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)  
451 - // this.queryContentInteractCount()  
452 - TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)  
453 - } else {  
454 - // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象  
455 - this.getInteractDataStatus()  
456 } 471 }
457 -  
458 }) 472 })
459 } 473 }
460 474
@@ -114,8 +114,16 @@ export struct MultiPictureDetailItemComponent { @@ -114,8 +114,16 @@ export struct MultiPictureDetailItemComponent {
114 calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { 114 calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size {
115 let width = 0 115 let width = 0
116 let height = 0; 116 let height = 0;
117 - width = size.width;  
118 - height = size.width / imageWHRatio; 117 + // width = size.width;
  118 + // height = size.width / imageWHRatio;
  119 + if (imageWHRatio > size.width / size.height) {
  120 + // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示
  121 + width = size.width;
  122 + height = size.width / imageWHRatio;
  123 + } else {
  124 + height = size.height;
  125 + width = size.height * imageWHRatio;
  126 + }
119 return { width: width, height: height }; 127 return { width: width, height: height };
120 } 128 }
121 129
@@ -179,7 +187,9 @@ export struct MultiPictureDetailItemComponent { @@ -179,7 +187,9 @@ export struct MultiPictureDetailItemComponent {
179 Image(this.imagePixelMap || 'app.media.datail_imageLoading_w')// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 187 Image(this.imagePixelMap || 'app.media.datail_imageLoading_w')// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
180 .alt($r('app.media.datail_imageLoading_w')) 188 .alt($r('app.media.datail_imageLoading_w'))
181 .width(this.imageWidth) 189 .width(this.imageWidth)
  190 + .aspectRatio(this.imageWHRatio)
182 .objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 191 .objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
  192 + .autoResize(false)
183 .interpolation(ImageInterpolation.High) 193 .interpolation(ImageInterpolation.High)
184 .autoResize(false) 194 .autoResize(false)
185 .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 195 .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
@@ -229,11 +239,6 @@ export struct MultiPictureDetailItemComponent { @@ -229,11 +239,6 @@ export struct MultiPictureDetailItemComponent {
229 .gesture( 239 .gesture(
230 GestureGroup( 240 GestureGroup(
231 GestureMode.Exclusive, 241 GestureMode.Exclusive,
232 - // 单击返回上一层  
233 - // TapGesture({ count: 1 })  
234 - // .onAction(() => {  
235 - // router.back()  
236 - // }),  
237 // TODO:知识点:双击切换图片大小 242 // TODO:知识点:双击切换图片大小
238 TapGesture({ count: 2 }) 243 TapGesture({ count: 2 })
239 .onAction(() => { 244 .onAction(() => {
@@ -315,9 +320,10 @@ export struct MultiPictureDetailItemComponent { @@ -315,9 +320,10 @@ export struct MultiPictureDetailItemComponent {
315 } 320 }
316 this.imageScaleInfo.stash(); 321 this.imageScaleInfo.stash();
317 }), 322 }),
318 - // // TODO:知识点:滑动图片 323 + // TODO:知识点:滑动图片
319 // PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片 324 // PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片
320 // .onActionUpdate((event: GestureEvent) => { 325 // .onActionUpdate((event: GestureEvent) => {
  326 + // console.log(TAG, "PanGesture", JSON.stringify(event))
321 // if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) { 327 // if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) {
322 // // 默认大小下不允许移动 328 // // 默认大小下不允许移动
323 // return; 329 // return;
@@ -36,7 +36,7 @@ export struct CommentListDialogView { @@ -36,7 +36,7 @@ export struct CommentListDialogView {
36 showClose: false, 36 showClose: false,
37 maskColor: "#50000000", 37 maskColor: "#50000000",
38 dragBar: false, 38 dragBar: false,
39 - onDisappear: () => { 39 + onWillDisappear: () => {
40 this.showCommentList = false 40 this.showCommentList = false
41 if (this.onClose) { this.onClose() } 41 if (this.onClose) { this.onClose() }
42 }, 42 },
@@ -34,7 +34,9 @@ export struct FollowListDetailUI { @@ -34,7 +34,9 @@ export struct FollowListDetailUI {
34 if (arr[1] == "0") { 34 if (arr[1] == "0") {
35 this.data.getDataArray().forEach((element, index) => { 35 this.data.getDataArray().forEach((element, index) => {
36 if (element.creatorId === arr[0]) { 36 if (element.creatorId === arr[0]) {
37 - this.data.deleteItem(index) 37 + animateTo({}, () => {
  38 + this.data.deleteItem(index);
  39 + });
38 this.count = this.data.size() 40 this.count = this.data.size()
39 } 41 }
40 }); 42 });
@@ -92,6 +94,7 @@ export struct FollowListDetailUI { @@ -92,6 +94,7 @@ export struct FollowListDetailUI {
92 ListItem() { 94 ListItem() {
93 FollowChildComponent({ data: item, type: this.type }) 95 FollowChildComponent({ data: item, type: this.type })
94 } 96 }
  97 + .transition(TransitionEffect.OPACITY)
95 }, (item: FollowListDetailItem) => item.creatorId) 98 }, (item: FollowListDetailItem) => item.creatorId)
96 99
97 //没有更多数据 显示提示 100 //没有更多数据 显示提示
@@ -251,7 +251,11 @@ export struct EmptyComponent { @@ -251,7 +251,11 @@ export struct EmptyComponent {
251 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) { 251 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
252 imageString = $r('app.media.icon_no_result1') 252 imageString = $r('app.media.icon_no_result1')
253 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { 253 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
254 - imageString = $r('app.media.icon_no_net1') 254 + if(this.isBlack) {
  255 + imageString = $r('app.media.icon_no_net')
  256 + } else {
  257 + imageString = $r('app.media.icon_no_net1')
  258 + }
255 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) { 259 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
256 imageString = $r('app.media.icon_no_content') 260 imageString = $r('app.media.icon_no_content')
257 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) { 261 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) {
@@ -382,7 +382,7 @@ export struct LiveOperRowListView { @@ -382,7 +382,7 @@ export struct LiveOperRowListView {
382 this.publishCommentModel.rootCommentId = '-1'; 382 this.publishCommentModel.rootCommentId = '-1';
383 this.publishCommentModel.parentId = '-1'; 383 this.publishCommentModel.parentId = '-1';
384 this.publishCommentModel.placeHolderText = "说两句..." 384 this.publishCommentModel.placeHolderText = "说两句..."
385 - this.publishCommentModel.commentContent = "" 385 + // this.publishCommentModel.commentContent = ""
386 this.commentInputDialogController?.open(); 386 this.commentInputDialogController?.open();
387 } 387 }
388 388
1 -import { NumberFormatterUtils, SPHelper } from 'wdKit'; 1 +import { NumberFormatterUtils, SPHelper, ToastUtils } from 'wdKit';
2 import promptAction from '@ohos.promptAction'; 2 import promptAction from '@ohos.promptAction';
3 import { 3 import {
4 batchLikeAndCollectParams, 4 batchLikeAndCollectParams,
@@ -526,15 +526,19 @@ export struct OperRowListView { @@ -526,15 +526,19 @@ export struct OperRowListView {
526 526
527 console.log(TAG, '收藏点击', JSON.stringify(params)) 527 console.log(TAG, '收藏点击', JSON.stringify(params))
528 PageRepository.postExecuteCollectRecord(params).then(res => { 528 PageRepository.postExecuteCollectRecord(params).then(res => {
529 - if (this.newsStatusOfUser) {  
530 - this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1  
531 - if (this.newsStatusOfUser.collectStatus === 1) {  
532 - promptAction.showToast({ message: '收藏成功' })  
533 - TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam)  
534 - } else {  
535 - TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam) 529 + if (res.code != 0){
  530 + ToastUtils.showToast(res.message, 1000);
  531 + }else {
  532 + if (this.newsStatusOfUser) {
  533 + this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
  534 + if (this.newsStatusOfUser.collectStatus === 1) {
  535 + promptAction.showToast({ message: '收藏成功' })
  536 + TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam)
  537 + } else {
  538 + TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam)
  539 + }
  540 + this.queryContentInteractCount()
536 } 541 }
537 - this.queryContentInteractCount()  
538 } 542 }
539 console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) 543 console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
540 }) 544 })
@@ -100,6 +100,7 @@ export struct MultiPictureListPage { @@ -100,6 +100,7 @@ export struct MultiPictureListPage {
100 .vertical(false) 100 .vertical(false)
101 .autoPlay(false) 101 .autoPlay(false)
102 .loop(false) 102 .loop(false)
  103 + .disableSwipe(!this.isEnableSwipe)
103 .effectMode(EdgeEffect.None) 104 .effectMode(EdgeEffect.None)
104 .cachedCount(3) 105 .cachedCount(3)
105 .indicator(false) 106 .indicator(false)
@@ -48,6 +48,7 @@ struct OtherNormalUserHomePage { @@ -48,6 +48,7 @@ struct OtherNormalUserHomePage {
48 @State userName:string = "" 48 @State userName:string = ""
49 @State headPhotoUrl:string = "" 49 @State headPhotoUrl:string = ""
50 @State levelHead:string = "" 50 @State levelHead:string = ""
  51 + @State listLevelHead:string = ""
51 @State levelId:number = 0 52 @State levelId:number = 0
52 @State browseNum:number = 0//阅读数 53 @State browseNum:number = 0//阅读数
53 @State commentNum:number = 0//评论数 54 @State commentNum:number = 0//评论数
@@ -208,7 +209,7 @@ struct OtherNormalUserHomePage { @@ -208,7 +209,7 @@ struct OtherNormalUserHomePage {
208 Stack({ alignContent: Alignment.Top }){ 209 Stack({ alignContent: Alignment.Top }){
209 Tabs({controller: this.controller}) { 210 Tabs({controller: this.controller}) {
210 TabContent() { 211 TabContent() {
211 - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) 212 + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.listLevelHead,commentNum:$commentNum})
212 } 213 }
213 TabContent() { 214 TabContent() {
214 OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) 215 OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
@@ -422,6 +423,7 @@ struct OtherNormalUserHomePage { @@ -422,6 +423,7 @@ struct OtherNormalUserHomePage {
422 this.levelHead = value[0].levelHead 423 this.levelHead = value[0].levelHead
423 } 424 }
424 } 425 }
  426 + this.listLevelHead = value[0].levelHead
425 this.levelId = value[0].level 427 this.levelId = value[0].level
426 } 428 }
427 }).catch((err:Error)=>{ 429 }).catch((err:Error)=>{
  1 +import {
  2 + PhotoListBean,
  3 +} from 'wdBean';
  4 +
  5 +export class MyDataSource implements IDataSource {
  6 +
  7 + private list: PhotoListBean[] = []
  8 +
  9 + // private listener: DataChangeListener
  10 +
  11 + constructor(list: PhotoListBean[]) {
  12 + this.list = list
  13 + }
  14 +
  15 + totalCount(): number {
  16 + return this.list.length
  17 + }
  18 +
  19 + getData(index: number): PhotoListBean {
  20 + return this.list[index]
  21 + }
  22 +
  23 + getList(): PhotoListBean[] {
  24 + return this.list;
  25 + }
  26 +
  27 + registerDataChangeListener(listener: DataChangeListener): void {
  28 + // this.listener = listener
  29 + }
  30 +
  31 + unregisterDataChangeListener() {
  32 + }
  33 +}
@@ -41,6 +41,8 @@ export struct DetailPlayVLivePage { @@ -41,6 +41,8 @@ export struct DetailPlayVLivePage {
41 @Consume @Watch('closeFullScreen') pageHide: number 41 @Consume @Watch('closeFullScreen') pageHide: number
42 @Consume contentId: string 42 @Consume contentId: string
43 @State swiperIndex: number = 1 43 @State swiperIndex: number = 1
  44 + ///是否展示清屏按钮
  45 + @State showClearButton: boolean = false
44 @Consume liveDetailPageLogic: LiveDetailPageLogic 46 @Consume liveDetailPageLogic: LiveDetailPageLogic
45 @Provide lastInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的消息 47 @Provide lastInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的消息
46 //播放错误 48 //播放错误
@@ -198,6 +200,7 @@ export struct DetailPlayVLivePage { @@ -198,6 +200,7 @@ export struct DetailPlayVLivePage {
198 playerController: this.playerController, 200 playerController: this.playerController,
199 swiperController: this.swiperController, 201 swiperController: this.swiperController,
200 swiperIndex: $swiperIndex, 202 swiperIndex: $swiperIndex,
  203 + showClearButton: $showClearButton
201 }) 204 })
202 205
203 // 直播资源加载失败 206 // 直播资源加载失败
@@ -241,7 +244,7 @@ export struct DetailPlayVLivePage { @@ -241,7 +244,7 @@ export struct DetailPlayVLivePage {
241 Image($r('app.media.icon_live_more')) 244 Image($r('app.media.icon_live_more'))
242 .width(40) 245 .width(40)
243 .aspectRatio(1) 246 .aspectRatio(1)
244 - .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) 247 + .visibility(this.showClearButton ? Visibility.Visible : Visibility.Hidden)
245 .position({ x: '100%', y: '100%' }) 248 .position({ x: '100%', y: '100%' })
246 .markAnchor({ x: 56, y: this.bottomSafeHeight }) 249 .markAnchor({ x: 56, y: this.bottomSafeHeight })
247 .onClick(() => { 250 .onClick(() => {
@@ -130,13 +130,14 @@ export struct PlayUIComponent { @@ -130,13 +130,14 @@ export struct PlayUIComponent {
130 }) 130 })
131 if (this.contentDetailData.liveInfo?.liveState != 'wait') { 131 if (this.contentDetailData.liveInfo?.liveState != 'wait') {
132 //标题 132 //标题
133 - Text(this.contentDetailData.newsTitle)  
134 - .maxLines(1)  
135 - .textOverflow({ overflow: TextOverflow.MARQUEE }) 133 + Marquee({
  134 + start:true,
  135 + loop: 1,
  136 + src:this.contentDetailData.newsTitle
  137 + })
136 .fontSize(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '18vp' : '16vp') 138 .fontSize(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '18vp' : '16vp')
137 .fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500) 139 .fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500)
138 .fontColor(Color.White) 140 .fontColor(Color.White)
139 - .textAlign(TextAlign.Start)  
140 .layoutWeight(1) 141 .layoutWeight(1)
141 } else { 142 } else {
142 Blank() 143 Blank()
@@ -10,9 +10,9 @@ export struct PlayerInfoComponent { @@ -10,9 +10,9 @@ export struct PlayerInfoComponent {
10 @Consume liveState: string 10 @Consume liveState: string
11 @Consume isShowControl: boolean 11 @Consume isShowControl: boolean
12 @Link swiperIndex: number 12 @Link swiperIndex: number
  13 + @Link showClearButton: boolean
13 @Provide isFullScreen: boolean = false // 判断是否全屏,全屏状态下swiper禁止切换 14 @Provide isFullScreen: boolean = false // 判断是否全屏,全屏状态下swiper禁止切换
14 15
15 -  
16 build() { 16 build() {
17 Column() { 17 Column() {
18 Swiper(this.swiperController) { 18 Swiper(this.swiperController) {
@@ -35,12 +35,23 @@ export struct PlayerInfoComponent { @@ -35,12 +35,23 @@ export struct PlayerInfoComponent {
35 this.isShowControl = !this.isShowControl 35 this.isShowControl = !this.isShowControl
36 } 36 }
37 }) 37 })
38 - .onChange((index) => {  
39 - this.swiperIndex = index 38 + .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
  39 + this.dealShowClearButton(index,extraInfo.currentOffset)
  40 + })
  41 + .onAnimationEnd((index: number, extraInfo: SwiperAnimationEvent) => {
  42 + this.dealShowClearButton(index,extraInfo.currentOffset)
40 }) 43 })
41 .disableSwipe(this.isFullScreen) 44 .disableSwipe(this.isFullScreen)
42 } 45 }
43 .height('100%') 46 .height('100%')
44 .width('100%') 47 .width('100%')
45 } 48 }
  49 + dealShowClearButton(index:number, currentOffset: number) {
  50 + this.swiperIndex = index
  51 + if (index == 0) {
  52 + this.showClearButton = currentOffset >= 0;
  53 + }else if (index == 1) {
  54 + this.showClearButton = false
  55 + }
  56 + }
46 } 57 }
@@ -304,7 +304,7 @@ export struct DetailPlayShortVideoPage { @@ -304,7 +304,7 @@ export struct DetailPlayShortVideoPage {
304 } 304 }
305 305
306 showCommentListChanged() { 306 showCommentListChanged() {
307 - // console.log('DetailVideoListPage showCommentListChanged this.showCommentList', this.showCommentList) 307 + console.log('DetailVideoListPage showCommentListChanged this.showCommentList', this.showCommentList)
308 if (this.showCommentList) { 308 if (this.showCommentList) {
309 this.playerWidth = px2vp(this.windowWidth) 309 this.playerWidth = px2vp(this.windowWidth)
310 // this.playerHeight = px2vp(this.windowWidth) / (16 / 9.0) 310 // this.playerHeight = px2vp(this.windowWidth) / (16 / 9.0)
@@ -9,15 +9,24 @@ import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo' @@ -9,15 +9,24 @@ import { ReportDeviceInfo } from './reportDeviceInfo/ReportDeviceInfo'
9 import { common } from '@kit.AbilityKit' 9 import { common } from '@kit.AbilityKit'
10 10
11 class LoginJumpHandler implements JumpInterceptorAction { 11 class LoginJumpHandler implements JumpInterceptorAction {
  12 +
  13 + private logining = false
12 14
13 /// 说明是调用了跳转 WDRouterPage.loginPage 页面的行为 15 /// 说明是调用了跳转 WDRouterPage.loginPage 页面的行为
14 on(params?: object | undefined, singleMode?: boolean | undefined): boolean { 16 on(params?: object | undefined, singleMode?: boolean | undefined): boolean {
15 17
  18 + if (this.logining) {
  19 + return true
  20 + }
  21 + this.logining = true
  22 +
16 HuaweiAuth.sharedInstance().fetchAnonymousPhone().then((anonymousPhone) => { 23 HuaweiAuth.sharedInstance().fetchAnonymousPhone().then((anonymousPhone) => {
17 24
18 router.pushUrl({url: WDRouterPage.oneKeyLoginPage.url()}) 25 router.pushUrl({url: WDRouterPage.oneKeyLoginPage.url()})
  26 + this.logining = false
19 }).catch((error: string) => { 27 }).catch((error: string) => {
20 router.pushUrl({url: WDRouterPage.loginPage.url()}) 28 router.pushUrl({url: WDRouterPage.loginPage.url()})
  29 + this.logining = false
21 }) 30 })
22 return true 31 return true
23 } 32 }
@@ -337,6 +337,7 @@ export struct MultiPictureDetailPageComponent { @@ -337,6 +337,7 @@ export struct MultiPictureDetailPageComponent {
337 .indicator(false) 337 .indicator(false)
338 .displayCount(1) 338 .displayCount(1)
339 .loop(false) 339 .loop(false)
  340 + .disableSwipe(!this.isEnableSwipe)
340 .effectMode(EdgeEffect.Spring) 341 .effectMode(EdgeEffect.Spring)
341 .id('e_swiper_content') 342 .id('e_swiper_content')
342 .alignRules({ 343 .alignRules({