Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix:长内容渲染 fix: 18839 UI还原问题-【uat】进入直播,更多按钮粗细和android不一致,看图 fix: 18692 UI还原问题--【生产环境】直播预告日期字体和ios不一致看图 fix: 18033 健康频道-时间轴专题_当天的数据不该展示日期 动态图集优化,图集双击放大 fix: 16764 收藏列表-稿件封面图未展示,专题样式展示错误。 fix:web 长内容修复 fix: 18511 UI还原问题-【uat】地方精选卡,出版方名称超过一行没有省略显示 fix: 18465 UI还原问题-【uat】顶部广告,滑动效果和android不一致,看视频
Showing
13 changed files
with
431 additions
and
107 deletions
| @@ -49,16 +49,24 @@ export struct WdWebLocalComponent { | @@ -49,16 +49,24 @@ export struct WdWebLocalComponent { | ||
| 49 | 49 | ||
| 50 | Row() { | 50 | Row() { |
| 51 | RelativeContainer() { | 51 | RelativeContainer() { |
| 52 | - // Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER }) | ||
| 53 | - Web({ src: this.webResource, controller: this.webviewControl }) | 52 | + Web({ |
| 53 | + src: this.webResource, | ||
| 54 | + controller: this.webviewControl, | ||
| 55 | + renderMode: RenderMode.SYNC_RENDER | ||
| 56 | + })// Web({ src: this.webResource, controller: this.webviewControl }) | ||
| 54 | .domStorageAccess(true) | 57 | .domStorageAccess(true) |
| 55 | .databaseAccess(true) | 58 | .databaseAccess(true) |
| 56 | .javaScriptAccess(true) | 59 | .javaScriptAccess(true) |
| 57 | .imageAccess(true) | 60 | .imageAccess(true) |
| 58 | .mixedMode(MixedMode.All) | 61 | .mixedMode(MixedMode.All) |
| 59 | .onlineImageAccess(true) | 62 | .onlineImageAccess(true) |
| 60 | - .enableNativeEmbedMode(true)// .layoutMode(WebLayoutMode.FIT_CONTENT) | ||
| 61 | - // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | 63 | + // .enableNativeEmbedMode(true) |
| 64 | + // .layoutMode(WebLayoutMode.FIT_CONTENT) | ||
| 65 | + .nestedScroll({ | ||
| 66 | + scrollForward: NestedScrollMode.SELF_FIRST, | ||
| 67 | + scrollBackward: NestedScrollMode.PARENT_FIRST | ||
| 68 | + }) | ||
| 69 | + .width('100%') | ||
| 62 | .height(this.webHeight) | 70 | .height(this.webHeight) |
| 63 | .onPageBegin((event) => { | 71 | .onPageBegin((event) => { |
| 64 | this.onPageBegin(event?.url); | 72 | this.onPageBegin(event?.url); |
| @@ -241,6 +249,7 @@ export struct WdWebLocalComponent { | @@ -241,6 +249,7 @@ export struct WdWebLocalComponent { | ||
| 241 | Logger.debug(TAG, 'onLoadIntercept return false'); | 249 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 242 | return false | 250 | return false |
| 243 | } | 251 | } |
| 252 | + | ||
| 244 | onReloadStateChanged() { | 253 | onReloadStateChanged() { |
| 245 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | 254 | Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); |
| 246 | if (this.reload > 0) { | 255 | if (this.reload > 0) { |
| 1 | -import { PhotoListBean } from 'wdBean'; | ||
| 2 | -import { Logger } from 'wdKit'; | 1 | +import { image } from '@kit.ImageKit'; |
| 2 | +import { matrix4, promptAction, window } from '@kit.ArkUI'; | ||
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 4 | +import { ScaleModel } from '../model/ScaleModel'; | ||
| 5 | +import { OffsetModel } from '../model/OffsetModel'; | ||
| 6 | +import { windowSizeManager } from '../utils/Managers'; | ||
| 7 | +import { runWithAnimation } from '../utils/FuncUtils'; | ||
| 8 | +import { PhotoListBean } from 'wdBean/Index'; | ||
| 9 | +import { http } from '@kit.NetworkKit'; | ||
| 3 | 10 | ||
| 4 | -const TAG = 'MultiPictureDetailPageComponent'; | 11 | +const TAG = 'MultiPictureDetailItemComponent'; |
| 5 | 12 | ||
| 6 | @Reusable | 13 | @Reusable |
| 7 | @Component | 14 | @Component |
| 8 | export struct MultiPictureDetailItemComponent { | 15 | export struct MultiPictureDetailItemComponent { |
| 16 | + @Link isEnableSwipe: boolean; // TODO:需求:多图切换 | ||
| 17 | + @State isEnableOffset: boolean = false; | ||
| 18 | + @State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3); | ||
| 19 | + @State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0); | ||
| 20 | + @State matrix: matrix4.Matrix4Transit = matrix4.identity().copy(); | ||
| 21 | + @State imagePixelMap: image.PixelMap | null = null; // 当前图片pixelMap,用于Image组件显示 | ||
| 22 | + @State fitWH: "width" | "height" | undefined = undefined; // 表示当前图片是根据宽度适配还是高度适配 | ||
| 23 | + @State imageDefaultSize: image.Size = { width: 0, height: 0 }; // 图片默认大小,即,与屏幕大小最适配的显示大小 | ||
| 24 | + imageUri: string = ""; // 当前图片uri | ||
| 25 | + imageWHRatio: number = 0; // 图片原始宽高比 | ||
| 26 | + @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | ||
| 9 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean | 27 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean |
| 10 | //alt app.media.picture_loading 设计稿尺寸 | 28 | //alt app.media.picture_loading 设计稿尺寸 |
| 11 | @State imageWidth:string | number = 167 | 29 | @State imageWidth:string | number = 167 |
| 12 | 30 | ||
| 13 | 31 | ||
| 14 | async aboutToAppear() { | 32 | async aboutToAppear() { |
| 15 | - // Logger.info(TAG, 'pictures preview' | 33 | + this.imageUri = this.MultiPictureDetailItem.picPath |
| 34 | + this.getPicture() | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 通过http的request方法从网络下载图片资源 | ||
| 39 | + */ | ||
| 40 | + async getPicture() { | ||
| 41 | + console.info(`cj2024 getPicture`) | ||
| 42 | + http.createHttp() | ||
| 43 | + .request(this.imageUri, | ||
| 44 | + (error: BusinessError, data: http.HttpResponse) => { | ||
| 45 | + if (error) { | ||
| 46 | + // 下载失败时弹窗提示检查网络,不执行后续逻辑 | ||
| 47 | + promptAction.showToast({ | ||
| 48 | + message: $r('app.string.image_request_fail'), | ||
| 49 | + duration: 2000 | ||
| 50 | + }) | ||
| 51 | + return; | ||
| 52 | + } | ||
| 53 | + this.transcodePixelMap(data); | ||
| 54 | + // 判断网络获取到的资源是否为ArrayBuffer类型 | ||
| 55 | + console.info(`cj2024 getPicture ${data.result}`) | ||
| 56 | + if (data.result instanceof ArrayBuffer) { | ||
| 57 | + console.info(`cj2024 getPicture 222`) | ||
| 58 | + this.imageBuffer = data.result as ArrayBuffer; | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + ) | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型 | ||
| 66 | + * @param data:网络获取到的资源 | ||
| 67 | + */ | ||
| 68 | + transcodePixelMap(data: http.HttpResponse) { | ||
| 69 | + console.info(`cj2024 transcodePixelMap ${data.responseCode}`) | ||
| 70 | + if (http.ResponseCode.OK === data.responseCode) { | ||
| 71 | + const imageData: ArrayBuffer = data.result as ArrayBuffer; | ||
| 72 | + // 通过ArrayBuffer创建图片源实例。 | ||
| 73 | + const imageSource: image.ImageSource = image.createImageSource(imageData); | ||
| 74 | + this.initCurrentImageInfo(imageSource); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue | ||
| 80 | + * TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算 | ||
| 81 | + */ | ||
| 82 | + initCurrentImageInfo(imageSource: image.ImageSource): void { | ||
| 83 | + this.matrix = matrix4.identity().copy(); | ||
| 84 | + // const imageSource: image.ImageSource = image.createImageSource(this.imageUri); | ||
| 85 | + imageSource.getImageInfo(0).then((data: image.ImageInfo) => { | ||
| 86 | + this.imageWHRatio = data.size.width / data.size.height; | ||
| 87 | + this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSizeManager.get()); | ||
| 88 | + if (this.imageDefaultSize.width === windowSizeManager.get().width) { | ||
| 89 | + this.fitWH = "width"; | ||
| 90 | + } else { | ||
| 91 | + this.fitWH = "height"; | ||
| 92 | + } | ||
| 93 | + this.imageScaleInfo.maxScaleValue += this.fitWH === "width" ? | ||
| 94 | + (windowSizeManager.get().height / this.imageDefaultSize.height) : | ||
| 95 | + (windowSizeManager.get().width / this.imageDefaultSize.width); | ||
| 96 | + }).catch((err: BusinessError) => { | ||
| 97 | + console.error(`[error][getImageInfo]${err.message}`); | ||
| 98 | + }); | ||
| 99 | + imageSource.createPixelMap().then((data: image.PixelMap) => { | ||
| 100 | + this.imagePixelMap = data; | ||
| 101 | + }).catch((err: BusinessError) => { | ||
| 102 | + console.error(`[error][createPixelMap]${err.message}`); | ||
| 103 | + }); | ||
| 104 | + this.isEnableOffset = false; | ||
| 105 | + this.imageScaleInfo.reset(); | ||
| 106 | + this.imageOffsetInfo.reset(); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + /** | ||
| 110 | + * 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 | ||
| 111 | + * @param imageWHRatio:图片原始宽高比 | ||
| 112 | + * @param size:窗口大小{with:number,height:number} | ||
| 113 | + * @returns image.Size | ||
| 114 | + */ | ||
| 115 | + calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { | ||
| 116 | + let width = 0 | ||
| 117 | + let height = 0; | ||
| 118 | + width = size.width; | ||
| 119 | + height = size.width / imageWHRatio; | ||
| 120 | + return { width: width, height: height }; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率 | ||
| 125 | + * @param imageSize:图片当前大小 | ||
| 126 | + * @param windowSize:窗口大小 | ||
| 127 | + * @returns:缩放倍率 | ||
| 128 | + */ | ||
| 129 | + calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { | ||
| 130 | + let ratio: number = 1.0; | ||
| 131 | + if (windowSize.width > imageSize.width) { | ||
| 132 | + ratio = windowSize.width / imageSize.width; | ||
| 133 | + } else { | ||
| 134 | + ratio = windowSize.height / imageSize.height; | ||
| 135 | + } | ||
| 136 | + return ratio; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * 在图片消失时,将当前图片的信息设置为默认值 | ||
| 141 | + */ | ||
| 142 | + resetCurrentImageInfo(): void { | ||
| 143 | + this.imageScaleInfo.reset(); | ||
| 144 | + this.imageOffsetInfo.reset(); | ||
| 145 | + this.matrix = matrix4.identity().copy(); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换 | ||
| 150 | + * @returns:长度为4的boolean数组,表示上下左右是否到达边界 | ||
| 151 | + */ | ||
| 152 | + evaluateBound(): boolean[] { | ||
| 153 | + return [false, false, false, false]; | ||
| 16 | } | 154 | } |
| 17 | 155 | ||
| 18 | build() { | 156 | build() { |
| 19 | Row() { | 157 | Row() { |
| 20 | - Image(this.MultiPictureDetailItem.picPath) | ||
| 21 | - .alt($r('app.media.datail_imageLoading_w')) | ||
| 22 | - | ||
| 23 | - .width(this.imageWidth) | ||
| 24 | - .objectFit(ImageFit.Auto) | ||
| 25 | - .interpolation(ImageInterpolation.High) | ||
| 26 | - .onComplete(event => { | ||
| 27 | - this.imageWidth = '100%' | ||
| 28 | - }) | 158 | + if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ |
| 159 | + Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 160 | + .alt($r('app.media.datail_imageLoading_w')) | ||
| 161 | + .width(this.imageWidth) | ||
| 162 | + .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 163 | + .interpolation(ImageInterpolation.High) | ||
| 164 | + .autoResize(false) | ||
| 165 | + .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 166 | + .defaultFocus(true) | ||
| 167 | + .offset({ | ||
| 168 | + // TODO:知识点:通过offset控制图片的偏移 | ||
| 169 | + x: this.imageOffsetInfo.currentX, | ||
| 170 | + y: this.imageOffsetInfo.currentY | ||
| 171 | + }) | ||
| 172 | + .onComplete(event => { | ||
| 173 | + this.imageWidth = '100%' | ||
| 174 | + }) | ||
| 175 | + }else{ | ||
| 176 | + Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 177 | + .alt($r('app.media.datail_imageLoading_w')) | ||
| 178 | + .width(this.imageWidth) | ||
| 179 | + .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 180 | + .interpolation(ImageInterpolation.High) | ||
| 181 | + .autoResize(false) | ||
| 182 | + .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 183 | + .defaultFocus(true) | ||
| 184 | + .offset({ | ||
| 185 | + // TODO:知识点:通过offset控制图片的偏移 | ||
| 186 | + x: this.imageOffsetInfo.currentX, | ||
| 187 | + y: this.imageOffsetInfo.currentY | ||
| 188 | + }) | ||
| 189 | + .onComplete(event => { | ||
| 190 | + this.imageWidth = '100%' | ||
| 191 | + }) | ||
| 192 | + } | ||
| 29 | } | 193 | } |
| 194 | + .onBlur(() => { | ||
| 195 | + this.resetCurrentImageInfo(); | ||
| 196 | + }) | ||
| 30 | .height('100%') | 197 | .height('100%') |
| 31 | .width('100%') | 198 | .width('100%') |
| 32 | .backgroundColor(Color.Black) | 199 | .backgroundColor(Color.Black) |
| 33 | .justifyContent(FlexAlign.Center) | 200 | .justifyContent(FlexAlign.Center) |
| 201 | + .gesture( | ||
| 202 | + GestureGroup( | ||
| 203 | + GestureMode.Exclusive, | ||
| 204 | + // TODO:知识点:双击切换图片大小 | ||
| 205 | + TapGesture({ count: 2 }) | ||
| 206 | + .onAction(() => { | ||
| 207 | + let fn: Function; | ||
| 208 | + // 已经是放大状态下,双击缩小 | ||
| 209 | + if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.defaultScaleValue) { | ||
| 210 | + fn = () => { | ||
| 211 | + this.isEnableSwipe = true; | ||
| 212 | + this.imageScaleInfo.reset(); | ||
| 213 | + this.imageOffsetInfo.reset(); | ||
| 214 | + this.matrix = matrix4.identity().copy(); | ||
| 215 | + }; | ||
| 216 | + } else { | ||
| 217 | + // 已经是缩小状态,双击放大 | ||
| 218 | + fn = () => { | ||
| 219 | + this.isEnableSwipe = false; | ||
| 220 | + const ratio: number = this.calcFitScaleRatio(this.imageDefaultSize, windowSizeManager.get()); | ||
| 221 | + this.imageScaleInfo.scaleValue = ratio; | ||
| 222 | + this.imageOffsetInfo.reset(); | ||
| 223 | + this.matrix = matrix4.identity().scale({ | ||
| 224 | + x: ratio, | ||
| 225 | + y: ratio, | ||
| 226 | + }).copy(); | ||
| 227 | + this.imageScaleInfo.stash(); | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + runWithAnimation(fn); | ||
| 231 | + }), | ||
| 232 | + // 单击切换背景色 | ||
| 233 | + // TapGesture({ count: 1 }).onAction(() => { | ||
| 234 | + // runWithAnimation(() => { | ||
| 235 | + // this.bgc = this.bgc === Color.White ? Color.Black : Color.White; | ||
| 236 | + // }); | ||
| 237 | + // }), | ||
| 238 | + // TODO:知识点:双指捏合缩放图片 | ||
| 239 | + PinchGesture({ fingers: 2, distance: 1 }) | ||
| 240 | + .onActionUpdate((event: GestureEvent) => { | ||
| 241 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.lastValue * event.scale; | ||
| 242 | + // TODO:知识点:缩放时不允许大于最大缩放因子+额外缩放因子,不允许小于默认大小-额外缩放因子,额外缩放因子用于提升用户体验 | ||
| 243 | + if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue * | ||
| 244 | + (1 + this.imageScaleInfo.extraScaleValue) | ||
| 245 | + ) { | ||
| 246 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue * | ||
| 247 | + (1 + this.imageScaleInfo.extraScaleValue); | ||
| 248 | + } | ||
| 249 | + if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue * | ||
| 250 | + (1 - this.imageScaleInfo.extraScaleValue)) { | ||
| 251 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.defaultScaleValue * | ||
| 252 | + (1 - this.imageScaleInfo.extraScaleValue); | ||
| 253 | + } | ||
| 254 | + // TODO:知识点:matrix默认缩放中心为组件中心 | ||
| 255 | + this.matrix = matrix4.identity().scale({ | ||
| 256 | + x: this.imageScaleInfo.scaleValue, | ||
| 257 | + y: this.imageScaleInfo.scaleValue, | ||
| 258 | + }).copy(); | ||
| 259 | + console.debug(this.imageScaleInfo.toString()); | ||
| 260 | + }) | ||
| 261 | + .onActionEnd((event: GestureEvent) => { | ||
| 262 | + /** | ||
| 263 | + * TODO:知识点:当小于默认大小时,恢复为默认大小 | ||
| 264 | + */ | ||
| 265 | + if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue) { | ||
| 266 | + runWithAnimation(() => { | ||
| 267 | + this.imageScaleInfo.reset(); | ||
| 268 | + this.imageOffsetInfo.reset(); | ||
| 269 | + this.matrix = matrix4.identity().copy(); | ||
| 270 | + }) | ||
| 271 | + } | ||
| 272 | + // TODO:知识点:当大于最大缩放因子时,恢复到最大 | ||
| 273 | + if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue) { | ||
| 274 | + runWithAnimation(() => { | ||
| 275 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue; | ||
| 276 | + this.matrix = matrix4.identity() | ||
| 277 | + .scale({ | ||
| 278 | + x: this.imageScaleInfo.maxScaleValue, | ||
| 279 | + y: this.imageScaleInfo.maxScaleValue | ||
| 280 | + }); | ||
| 281 | + }) | ||
| 282 | + } | ||
| 283 | + this.imageScaleInfo.stash(); | ||
| 284 | + }), | ||
| 285 | + // // TODO:知识点:滑动图片 | ||
| 286 | + // PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片 | ||
| 287 | + // .onActionUpdate((event: GestureEvent) => { | ||
| 288 | + // if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) { | ||
| 289 | + // // 默认大小下不允许移动 | ||
| 290 | + // return; | ||
| 291 | + // } | ||
| 292 | + // this.imageOffsetInfo.currentX = this.imageOffsetInfo.lastX + event.offsetX; | ||
| 293 | + // this.imageOffsetInfo.currentY = this.imageOffsetInfo.lastY + event.offsetY; | ||
| 294 | + // }) | ||
| 295 | + // .onActionEnd((event: GestureEvent) => { | ||
| 296 | + // this.imageOffsetInfo.stash(); | ||
| 297 | + // }) | ||
| 298 | + ), | ||
| 299 | + ) | ||
| 34 | } | 300 | } |
| 35 | } | 301 | } |
| @@ -27,11 +27,19 @@ export struct Card9Component { | @@ -27,11 +27,19 @@ export struct Card9Component { | ||
| 27 | @State textArr: textItem[] = [] | 27 | @State textArr: textItem[] = [] |
| 28 | pageShowTime:number = 0; | 28 | pageShowTime:number = 0; |
| 29 | pageHideTime:number = 0; | 29 | pageHideTime:number = 0; |
| 30 | + @State hideDetail: boolean = false; | ||
| 30 | 31 | ||
| 31 | onPageShow() { | 32 | onPageShow() { |
| 32 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 33 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 36 | + initHideDetail() { | ||
| 37 | + const curRouter = router.getState().name; | ||
| 38 | + if (curRouter === 'MyCollectionListPage') { | ||
| 39 | + this.hideDetail = true; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 35 | //内容浏览Tracking | 43 | //内容浏览Tracking |
| 36 | onPageHide(): void { | 44 | onPageHide(): void { |
| 37 | this.pageHideTime = DateTimeUtils.getTimeStamp() | 45 | this.pageHideTime = DateTimeUtils.getTimeStamp() |
| @@ -46,6 +54,7 @@ export struct Card9Component { | @@ -46,6 +54,7 @@ export struct Card9Component { | ||
| 46 | // this.loadImg = await onlyWifiLoadImg(); | 54 | // this.loadImg = await onlyWifiLoadImg(); |
| 47 | const curRouter = router.getState().name; | 55 | const curRouter = router.getState().name; |
| 48 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) | 56 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) |
| 57 | + this.initHideDetail(); | ||
| 49 | } | 58 | } |
| 50 | 59 | ||
| 51 | titleInit() { | 60 | titleInit() { |
| @@ -54,6 +63,14 @@ export struct Card9Component { | @@ -54,6 +63,14 @@ export struct Card9Component { | ||
| 54 | this.textArr = titleInitRes.textArr; | 63 | this.textArr = titleInitRes.textArr; |
| 55 | } | 64 | } |
| 56 | 65 | ||
| 66 | + formatTime(timeStamp: number) { | ||
| 67 | + let todayDate = new Date().setHours(0,0,0,0); | ||
| 68 | + let paramsDate = new Date(timeStamp).setHours(0,0,0,0); | ||
| 69 | + let isToday = todayDate === paramsDate | ||
| 70 | + let format: string = isToday ? 'HH:mm' : 'MM月dd日 HH:mm'; | ||
| 71 | + return DateTimeUtils.formatDate(timeStamp, format) | ||
| 72 | + } | ||
| 73 | + | ||
| 57 | build() { | 74 | build() { |
| 58 | Column() { | 75 | Column() { |
| 59 | // 顶部标题,最多两行 | 76 | // 顶部标题,最多两行 |
| @@ -108,14 +125,16 @@ export struct Card9Component { | @@ -108,14 +125,16 @@ export struct Card9Component { | ||
| 108 | }.alignContent(Alignment.BottomStart) | 125 | }.alignContent(Alignment.BottomStart) |
| 109 | 126 | ||
| 110 | // 时间线--后端返回三个, | 127 | // 时间线--后端返回三个, |
| 111 | - Column() { | ||
| 112 | - ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => { | ||
| 113 | - this.timelineItem(item, index, index === this.contentDTO.slideShows.length - 1) | ||
| 114 | - }) | 128 | + if (!this.hideDetail) { |
| 129 | + Column() { | ||
| 130 | + ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => { | ||
| 131 | + this.timelineItem(item, index, index === this.contentDTO.slideShows.length - 1) | ||
| 132 | + }) | ||
| 133 | + } | ||
| 115 | } | 134 | } |
| 116 | 135 | ||
| 117 | // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 | 136 | // 底部-查看更多。根据接口返回的isMore判断是否显示查看更多 |
| 118 | - if (this.contentDTO.hasMore == 1) { | 137 | + if (this.contentDTO.hasMore == 1 && !this.hideDetail) { |
| 119 | Row() { | 138 | Row() { |
| 120 | Text("查看更多") | 139 | Text("查看更多") |
| 121 | .fontSize($r("app.float.font_size_14")) | 140 | .fontSize($r("app.float.font_size_14")) |
| @@ -197,7 +216,7 @@ export struct Card9Component { | @@ -197,7 +216,7 @@ export struct Card9Component { | ||
| 197 | .margin({ right: 5 }) | 216 | .margin({ right: 5 }) |
| 198 | .fillColor(item.newsTitleColor) | 217 | .fillColor(item.newsTitleColor) |
| 199 | 218 | ||
| 200 | - Text(DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm")) | 219 | + Text(this.formatTime(item.publishTime)) |
| 201 | .fontSize($r('app.float.font_size_12')) | 220 | .fontSize($r('app.float.font_size_12')) |
| 202 | .fontColor($r('app.color.color_222222')) | 221 | .fontColor($r('app.color.color_222222')) |
| 203 | .fontWeight(600) | 222 | .fontWeight(600) |
| @@ -292,6 +292,10 @@ struct indicatorAnimations { | @@ -292,6 +292,10 @@ struct indicatorAnimations { | ||
| 292 | // Image($r('app.media.swiper_indicator_gray')) | 292 | // Image($r('app.media.swiper_indicator_gray')) |
| 293 | // .width('100%') | 293 | // .width('100%') |
| 294 | // .height(2) | 294 | // .height(2) |
| 295 | + | ||
| 296 | + Image($r('app.media.swiper_indicator_gray')) | ||
| 297 | + .width('100%') | ||
| 298 | + .height(2) | ||
| 295 | Image($r('app.media.swiper_indicator_white')) | 299 | Image($r('app.media.swiper_indicator_white')) |
| 296 | .width(this.leftW) | 300 | .width(this.leftW) |
| 297 | .height(2) | 301 | .height(2) |
| @@ -323,6 +327,9 @@ struct indicatorAnimations { | @@ -323,6 +327,9 @@ struct indicatorAnimations { | ||
| 323 | // Image($r('app.media.swiper_indicator_gray')) | 327 | // Image($r('app.media.swiper_indicator_gray')) |
| 324 | // .width('100%') | 328 | // .width('100%') |
| 325 | // .height(2) | 329 | // .height(2) |
| 330 | + Image($r('app.media.swiper_indicator_gray')) | ||
| 331 | + .width('100%') | ||
| 332 | + .height(2) | ||
| 326 | Image($r('app.media.swiper_indicator_white')) | 333 | Image($r('app.media.swiper_indicator_white')) |
| 327 | .width(this.rightW) | 334 | .width(this.rightW) |
| 328 | .height(2) | 335 | .height(2) |
| @@ -45,7 +45,7 @@ export struct ZhGridLayout02NewsContent { | @@ -45,7 +45,7 @@ export struct ZhGridLayout02NewsContent { | ||
| 45 | buildItemCard(item: ContentDTO, index: number) { | 45 | buildItemCard(item: ContentDTO, index: number) { |
| 46 | Column() { | 46 | Column() { |
| 47 | Stack({ alignContent: Alignment.BottomEnd }) { | 47 | Stack({ alignContent: Alignment.BottomEnd }) { |
| 48 | - Image(this.loadImg ? item == undefined ? '' : item.fullColumnImgUrls[0].url : '') | 48 | + Image(this.loadImg ? item == undefined ? '' : item.fullColumnImgUrls?.[0]?.url : '') |
| 49 | .backgroundColor(0xf5f5f5) | 49 | .backgroundColor(0xf5f5f5) |
| 50 | .width('100%') | 50 | .width('100%') |
| 51 | // .height(95) | 51 | // .height(95) |
| @@ -19,8 +19,8 @@ export struct ZhSingleRow02 { | @@ -19,8 +19,8 @@ export struct ZhSingleRow02 { | ||
| 19 | @State pageId: string = ''; | 19 | @State pageId: string = ''; |
| 20 | @State pageName: string = ''; | 20 | @State pageName: string = ''; |
| 21 | @State compDTO: CompDTO = {} as CompDTO | 21 | @State compDTO: CompDTO = {} as CompDTO |
| 22 | - @State initMoreWidth: number = 16; | ||
| 23 | - @State moreWidth:number = 16 | 22 | + @State initMoreWidth: number = 22; |
| 23 | + @State moreWidth:number = 22 | ||
| 24 | @State moreTips: string = '' | 24 | @State moreTips: string = '' |
| 25 | scroller: Scroller = new Scroller() | 25 | scroller: Scroller = new Scroller() |
| 26 | 26 | ||
| @@ -53,7 +53,7 @@ export struct ZhSingleRow02 { | @@ -53,7 +53,7 @@ export struct ZhSingleRow02 { | ||
| 53 | 53 | ||
| 54 | resetEdgeAnimation() { | 54 | resetEdgeAnimation() { |
| 55 | if (this.moreWidth > this.initMoreWidth) { | 55 | if (this.moreWidth > this.initMoreWidth) { |
| 56 | - this.moreWidth = 16 | 56 | + this.moreWidth = 22 |
| 57 | } | 57 | } |
| 58 | this.resetMoreTips() | 58 | this.resetMoreTips() |
| 59 | } | 59 | } |
| @@ -43,8 +43,8 @@ export struct ZhSingleRow03 { | @@ -43,8 +43,8 @@ export struct ZhSingleRow03 { | ||
| 43 | // @State reserveStatus: reserveItem[] = [] | 43 | // @State reserveStatus: reserveItem[] = [] |
| 44 | @State reservedIds: string[] = []; | 44 | @State reservedIds: string[] = []; |
| 45 | @State loadImg: boolean = false; | 45 | @State loadImg: boolean = false; |
| 46 | - @State initMoreWidth: number = 16; | ||
| 47 | - @State moreWidth:number = 16 | 46 | + @State initMoreWidth: number = 22; |
| 47 | + @State moreWidth:number = 22 | ||
| 48 | @State moreTips: string = '' | 48 | @State moreTips: string = '' |
| 49 | scroller: Scroller = new Scroller() | 49 | scroller: Scroller = new Scroller() |
| 50 | 50 | ||
| @@ -78,7 +78,7 @@ export struct ZhSingleRow03 { | @@ -78,7 +78,7 @@ export struct ZhSingleRow03 { | ||
| 78 | 78 | ||
| 79 | resetEdgeAnimation() { | 79 | resetEdgeAnimation() { |
| 80 | if (this.moreWidth > this.initMoreWidth) { | 80 | if (this.moreWidth > this.initMoreWidth) { |
| 81 | - this.moreWidth = 16 | 81 | + this.moreWidth = 22 |
| 82 | } | 82 | } |
| 83 | this.resetMoreTips() | 83 | this.resetMoreTips() |
| 84 | } | 84 | } |
| @@ -260,7 +260,7 @@ export struct ZhSingleRow03 { | @@ -260,7 +260,7 @@ export struct ZhSingleRow03 { | ||
| 260 | .fontSize(12) | 260 | .fontSize(12) |
| 261 | .textAlign(TextAlign.Start) | 261 | .textAlign(TextAlign.Start) |
| 262 | .fontFamily('PingFang SC-Semibold') | 262 | .fontFamily('PingFang SC-Semibold') |
| 263 | - .fontWeight(600) | 263 | + .fontWeight(500) |
| 264 | Image($r('app.media.timeline_rect')) | 264 | Image($r('app.media.timeline_rect')) |
| 265 | .width(4) | 265 | .width(4) |
| 266 | .height(3) | 266 | .height(3) |
| @@ -270,7 +270,7 @@ export struct ZhSingleRow03 { | @@ -270,7 +270,7 @@ export struct ZhSingleRow03 { | ||
| 270 | .fontColor(0x000000) | 270 | .fontColor(0x000000) |
| 271 | .fontSize(12) | 271 | .fontSize(12) |
| 272 | .fontFamily('PingFang SC-Semibold') | 272 | .fontFamily('PingFang SC-Semibold') |
| 273 | - .fontWeight(600) | 273 | + .fontWeight(500) |
| 274 | Text('开始直播') | 274 | Text('开始直播') |
| 275 | .fontColor(0xC8C8C8) | 275 | .fontColor(0xC8C8C8) |
| 276 | .fontSize(12) | 276 | .fontSize(12) |
| @@ -110,6 +110,7 @@ struct localCard { | @@ -110,6 +110,7 @@ struct localCard { | ||
| 110 | .margin({ bottom: 6 }) | 110 | .margin({ bottom: 6 }) |
| 111 | .flexShrink(0) | 111 | .flexShrink(0) |
| 112 | .maxLines(1) | 112 | .maxLines(1) |
| 113 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 113 | 114 | ||
| 114 | Text(this.operDataListItem.newsTitle) | 115 | Text(this.operDataListItem.newsTitle) |
| 115 | .width(CommonConstants.FULL_PARENT) | 116 | .width(CommonConstants.FULL_PARENT) |
| @@ -9,8 +9,8 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -9,8 +9,8 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 9 | @State compDTO: CompDTO = {} as CompDTO | 9 | @State compDTO: CompDTO = {} as CompDTO |
| 10 | @State pageId: string = ''; | 10 | @State pageId: string = ''; |
| 11 | @State pageName: string = ''; | 11 | @State pageName: string = ''; |
| 12 | - @State initMoreWidth: number = 16; | ||
| 13 | - @State moreWidth:number = 16 | 12 | + @State initMoreWidth: number = 22; |
| 13 | + @State moreWidth:number = 22 | ||
| 14 | @State moreTips: string = '' | 14 | @State moreTips: string = '' |
| 15 | scroller: Scroller = new Scroller() | 15 | scroller: Scroller = new Scroller() |
| 16 | 16 | ||
| @@ -44,7 +44,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -44,7 +44,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 44 | 44 | ||
| 45 | resetEdgeAnimation() { | 45 | resetEdgeAnimation() { |
| 46 | if (this.moreWidth > this.initMoreWidth) { | 46 | if (this.moreWidth > this.initMoreWidth) { |
| 47 | - this.moreWidth = 16 | 47 | + this.moreWidth = 22 |
| 48 | } | 48 | } |
| 49 | this.resetMoreTips() | 49 | this.resetMoreTips() |
| 50 | } | 50 | } |
| @@ -25,6 +25,9 @@ export struct ImageItemView { | @@ -25,6 +25,9 @@ export struct ImageItemView { | ||
| 25 | imageWHRatio: number = 0; // 图片原始宽高比 | 25 | imageWHRatio: number = 0; // 图片原始宽高比 |
| 26 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean | 26 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean |
| 27 | @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | 27 | @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer |
| 28 | + //alt app.media.picture_loading 设计稿尺寸 | ||
| 29 | + @State imageWidth:string | number = 167 | ||
| 30 | + private scroller: Scroller = new Scroller() | ||
| 28 | 31 | ||
| 29 | aboutToAppear(): void { | 32 | aboutToAppear(): void { |
| 30 | this.imageUri = this.MultiPictureDetailItem.picPath | 33 | this.imageUri = this.MultiPictureDetailItem.picPath |
| @@ -81,14 +84,8 @@ export struct ImageItemView { | @@ -81,14 +84,8 @@ export struct ImageItemView { | ||
| 81 | calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { | 84 | calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { |
| 82 | let width = 0 | 85 | let width = 0 |
| 83 | let height = 0; | 86 | let height = 0; |
| 84 | - if (imageWHRatio > size.width / size.height) { | ||
| 85 | - // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示 | ||
| 86 | - width = size.width; | ||
| 87 | - height = size.width / imageWHRatio; | ||
| 88 | - } else { | ||
| 89 | - height = size.height; | ||
| 90 | - width = size.height * imageWHRatio; | ||
| 91 | - } | 87 | + width = size.width; |
| 88 | + height = size.width / imageWHRatio; | ||
| 92 | return { width: width, height: height }; | 89 | return { width: width, height: height }; |
| 93 | } | 90 | } |
| 94 | 91 | ||
| @@ -117,7 +114,12 @@ export struct ImageItemView { | @@ -117,7 +114,12 @@ export struct ImageItemView { | ||
| 117 | // const imageSource: image.ImageSource = image.createImageSource(this.imageUri); | 114 | // const imageSource: image.ImageSource = image.createImageSource(this.imageUri); |
| 118 | imageSource.getImageInfo(0).then((data: image.ImageInfo) => { | 115 | imageSource.getImageInfo(0).then((data: image.ImageInfo) => { |
| 119 | this.imageWHRatio = data.size.width / data.size.height; | 116 | this.imageWHRatio = data.size.width / data.size.height; |
| 117 | + console.error(`this.imageDefaultSize this.imageWHRatio = ${this.imageWHRatio}`); | ||
| 118 | + console.error(`this.imageDefaultSize width = ${data.size.width}`); | ||
| 119 | + console.error(`this.imageDefaultSize height = ${data.size.height}`); | ||
| 120 | this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSizeManager.get()); | 120 | this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSizeManager.get()); |
| 121 | + console.error(`this.imageDefaultSize = ${JSON.stringify(windowSizeManager.get())}`); | ||
| 122 | + console.error(`this.imageDefaultSize = ${JSON.stringify(this.imageDefaultSize)}`); | ||
| 121 | if (this.imageDefaultSize.width === windowSizeManager.get().width) { | 123 | if (this.imageDefaultSize.width === windowSizeManager.get().width) { |
| 122 | this.fitWH = "width"; | 124 | this.fitWH = "width"; |
| 123 | } else { | 125 | } else { |
| @@ -158,47 +160,57 @@ export struct ImageItemView { | @@ -158,47 +160,57 @@ export struct ImageItemView { | ||
| 158 | 160 | ||
| 159 | build() { | 161 | build() { |
| 160 | Stack() { | 162 | Stack() { |
| 161 | - if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ | ||
| 162 | - Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 163 | - .width(this.fitWH === "width" ? "100%" : undefined) | ||
| 164 | - .height(this.fitWH === "height" ? "100%" : undefined) | ||
| 165 | - .aspectRatio(this.imageWHRatio) | ||
| 166 | - .objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 167 | - .autoResize(false) | ||
| 168 | - .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 169 | - .defaultFocus(true) | ||
| 170 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 171 | - .offset({ | ||
| 172 | - // TODO:知识点:通过offset控制图片的偏移 | ||
| 173 | - x: this.imageOffsetInfo.currentX, | ||
| 174 | - y: this.imageOffsetInfo.currentY | ||
| 175 | - }) | ||
| 176 | - }else{ | ||
| 177 | - Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 178 | - .width(this.fitWH === "width" ? "100%" : undefined) | ||
| 179 | - .height(this.fitWH === "height" ? "100%" : undefined) | ||
| 180 | - .aspectRatio(this.imageWHRatio) | ||
| 181 | - .objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 182 | - .autoResize(false) | ||
| 183 | - .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 184 | - .defaultFocus(true) | ||
| 185 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 186 | - .offset({ | ||
| 187 | - // TODO:知识点:通过offset控制图片的偏移 | ||
| 188 | - x: this.imageOffsetInfo.currentX, | ||
| 189 | - y: this.imageOffsetInfo.currentY | ||
| 190 | - }) | 163 | + Scroll(this.scroller) { |
| 164 | + if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ | ||
| 165 | + Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 166 | + .alt($r('app.media.datail_imageLoading_w')) | ||
| 167 | + .width(this.imageWidth) | ||
| 168 | + .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 169 | + .interpolation(ImageInterpolation.High) | ||
| 170 | + .autoResize(false) | ||
| 171 | + .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 172 | + .defaultFocus(true) | ||
| 173 | + .offset({ | ||
| 174 | + // TODO:知识点:通过offset控制图片的偏移 | ||
| 175 | + x: this.imageOffsetInfo.currentX, | ||
| 176 | + y: this.imageOffsetInfo.currentY | ||
| 177 | + }) | ||
| 178 | + .onComplete(event => { | ||
| 179 | + this.imageWidth = '100%' | ||
| 180 | + }) | ||
| 181 | + } else { | ||
| 182 | + Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 183 | + .alt($r('app.media.datail_imageLoading_w')) | ||
| 184 | + .width(this.imageWidth) | ||
| 185 | + .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 186 | + .interpolation(ImageInterpolation.High) | ||
| 187 | + .autoResize(false) | ||
| 188 | + .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 189 | + .defaultFocus(true) | ||
| 190 | + .offset({ | ||
| 191 | + // TODO:知识点:通过offset控制图片的偏移 | ||
| 192 | + x: this.imageOffsetInfo.currentX, | ||
| 193 | + y: this.imageOffsetInfo.currentY | ||
| 194 | + }) | ||
| 195 | + .onComplete(event => { | ||
| 196 | + this.imageWidth = '100%' | ||
| 197 | + }) | ||
| 198 | + } | ||
| 191 | } | 199 | } |
| 192 | - | 200 | + .scrollable(ScrollDirection.Vertical) |
| 201 | + .scrollBarWidth(0) | ||
| 202 | + .constraintSize({ | ||
| 203 | + maxHeight: this.imageDefaultSize.height | ||
| 204 | + }) | ||
| 193 | } | 205 | } |
| 194 | .onBlur(() => { | 206 | .onBlur(() => { |
| 195 | this.resetCurrentImageInfo(); | 207 | this.resetCurrentImageInfo(); |
| 196 | }) | 208 | }) |
| 197 | // .backgroundColor(this.bgc) | 209 | // .backgroundColor(this.bgc) |
| 198 | .alignContent(Alignment.Center) | 210 | .alignContent(Alignment.Center) |
| 199 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 200 | .width("100%") | 211 | .width("100%") |
| 201 | .height("100%") | 212 | .height("100%") |
| 213 | + .backgroundColor(Color.Black) | ||
| 202 | .gesture( | 214 | .gesture( |
| 203 | GestureGroup( | 215 | GestureGroup( |
| 204 | GestureMode.Exclusive, | 216 | GestureMode.Exclusive, |
| @@ -18,8 +18,8 @@ export struct LiveHorizontalCardComponent { | @@ -18,8 +18,8 @@ export struct LiveHorizontalCardComponent { | ||
| 18 | @State pageName: string = ''; | 18 | @State pageName: string = ''; |
| 19 | @State compDTO: CompDTO = {} as CompDTO | 19 | @State compDTO: CompDTO = {} as CompDTO |
| 20 | @State loadImg: boolean = false; | 20 | @State loadImg: boolean = false; |
| 21 | - @State initMoreWidth: number = 16; | ||
| 22 | - @State moreWidth:number = 16 | 21 | + @State initMoreWidth: number = 22; |
| 22 | + @State moreWidth:number = 22 | ||
| 23 | @State moreTips: string = '' | 23 | @State moreTips: string = '' |
| 24 | scroller: Scroller = new Scroller() | 24 | scroller: Scroller = new Scroller() |
| 25 | 25 | ||
| @@ -53,7 +53,7 @@ export struct LiveHorizontalCardComponent { | @@ -53,7 +53,7 @@ export struct LiveHorizontalCardComponent { | ||
| 53 | 53 | ||
| 54 | resetEdgeAnimation() { | 54 | resetEdgeAnimation() { |
| 55 | if (this.moreWidth > this.initMoreWidth) { | 55 | if (this.moreWidth > this.initMoreWidth) { |
| 56 | - this.moreWidth = 16 | 56 | + this.moreWidth = 22 |
| 57 | } | 57 | } |
| 58 | this.resetMoreTips() | 58 | this.resetMoreTips() |
| 59 | } | 59 | } |
| @@ -3,6 +3,7 @@ import { display, router } from '@kit.ArkUI'; | @@ -3,6 +3,7 @@ import { display, router } from '@kit.ArkUI'; | ||
| 3 | import { ImageItemView } from '../components/view/ImageItemView'; | 3 | import { ImageItemView } from '../components/view/ImageItemView'; |
| 4 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; | 4 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; |
| 5 | import { Action } from 'wdBean'; | 5 | import { Action } from 'wdBean'; |
| 6 | +import { WindowModel } from 'wdKit/Index'; | ||
| 6 | 7 | ||
| 7 | const TAG = 'MultiPictureListPage'; | 8 | const TAG = 'MultiPictureListPage'; |
| 8 | 9 | ||
| @@ -36,22 +37,37 @@ export struct MultiPictureListPage { | @@ -36,22 +37,37 @@ export struct MultiPictureListPage { | ||
| 36 | this.currentUrl = this.photoList[this.swiperIndex]?.picPath | 37 | this.currentUrl = this.photoList[this.swiperIndex]?.picPath |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | + onPageShow(): void { | ||
| 41 | + console.log(TAG, 'onPageShow') | ||
| 42 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'}) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + onPageHide(): void { | ||
| 46 | + console.log(TAG, 'onPageHide') | ||
| 47 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'}) | ||
| 48 | + } | ||
| 49 | + | ||
| 39 | build() { | 50 | build() { |
| 40 | RelativeContainer() { | 51 | RelativeContainer() { |
| 41 | - Image($r('app.media.icon_arrow_left_white')) | ||
| 42 | - .width(24) | ||
| 43 | - .height(24) | ||
| 44 | - .aspectRatio(1) | ||
| 45 | - .interpolation(ImageInterpolation.High) | ||
| 46 | - .alignRules({ | ||
| 47 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 48 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 49 | - }) | ||
| 50 | - .onClick(() => { | ||
| 51 | - this.onBack(); | ||
| 52 | - router.back(); | ||
| 53 | - }) | ||
| 54 | - .id("backImg") | 52 | + Row(){ |
| 53 | + Image($r('app.media.icon_arrow_left_white')) | ||
| 54 | + .width(24) | ||
| 55 | + .height(24) | ||
| 56 | + .aspectRatio(1) | ||
| 57 | + .interpolation(ImageInterpolation.High) | ||
| 58 | + } | ||
| 59 | + .zIndex(10) | ||
| 60 | + .margin({ top: `${this.topSafeHeight}px` }) | ||
| 61 | + .alignRules({ | ||
| 62 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 63 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 64 | + }) | ||
| 65 | + .onClick(() => { | ||
| 66 | + this.onBack(); | ||
| 67 | + router.back(); | ||
| 68 | + }) | ||
| 69 | + .id("backImg") | ||
| 70 | + | ||
| 55 | 71 | ||
| 56 | if (this.photoList && this.photoList?.length > 0) { | 72 | if (this.photoList && this.photoList?.length > 0) { |
| 57 | Swiper(this.swiperController) { | 73 | Swiper(this.swiperController) { |
| @@ -61,7 +77,7 @@ export struct MultiPictureListPage { | @@ -61,7 +77,7 @@ export struct MultiPictureListPage { | ||
| 61 | } | 77 | } |
| 62 | .index(this.swiperIndex) | 78 | .index(this.swiperIndex) |
| 63 | .width('100%') | 79 | .width('100%') |
| 64 | - .height(px2vp(this.picHeight) + 32) | 80 | + .height('100%') |
| 65 | .vertical(false) | 81 | .vertical(false) |
| 66 | .autoPlay(false) | 82 | .autoPlay(false) |
| 67 | .loop(false) | 83 | .loop(false) |
| @@ -83,8 +99,8 @@ export struct MultiPictureListPage { | @@ -83,8 +99,8 @@ export struct MultiPictureListPage { | ||
| 83 | Scroll(this.scroller) { | 99 | Scroll(this.scroller) { |
| 84 | Row() { | 100 | Row() { |
| 85 | Flex({ | 101 | Flex({ |
| 86 | - direction: FlexDirection.Column, | ||
| 87 | - justifyContent: FlexAlign.Start | 102 | + direction: FlexDirection.Row, |
| 103 | + justifyContent: FlexAlign.SpaceBetween | ||
| 88 | }) { | 104 | }) { |
| 89 | Text() { | 105 | Text() { |
| 90 | Span(`${this.swiperIndex + 1}`) | 106 | Span(`${this.swiperIndex + 1}`) |
| @@ -97,7 +113,9 @@ export struct MultiPictureListPage { | @@ -97,7 +113,9 @@ export struct MultiPictureListPage { | ||
| 97 | .fontFamily('PingFang SC-Medium') | 113 | .fontFamily('PingFang SC-Medium') |
| 98 | .fontWeight(500) | 114 | .fontWeight(500) |
| 99 | .lineHeight(19) | 115 | .lineHeight(19) |
| 100 | - }.fontColor(Color.White).margin(4) | 116 | + } |
| 117 | + .fontColor(Color.White) | ||
| 118 | + .margin(4) | ||
| 101 | } | 119 | } |
| 102 | } | 120 | } |
| 103 | .width('100%') | 121 | .width('100%') |
| @@ -133,8 +151,6 @@ export struct MultiPictureListPage { | @@ -133,8 +151,6 @@ export struct MultiPictureListPage { | ||
| 133 | } | 151 | } |
| 134 | .width('100%') | 152 | .width('100%') |
| 135 | .height('100%') | 153 | .height('100%') |
| 136 | - .padding({top: `${this.topSafeHeight}px`,bottom:`${this.bottomSafeHeight}px`}) | ||
| 137 | - .backgroundColor(Color.Black) | ||
| 138 | .id('e_picture_container') | 154 | .id('e_picture_container') |
| 139 | } | 155 | } |
| 140 | 156 |
| @@ -36,9 +36,6 @@ export struct MultiPictureDetailPageComponent { | @@ -36,9 +36,6 @@ export struct MultiPictureDetailPageComponent { | ||
| 36 | private contentId: string = '' | 36 | private contentId: string = '' |
| 37 | private relType: string = '' | 37 | private relType: string = '' |
| 38 | private displayTool = display.getDefaultDisplaySync() | 38 | private displayTool = display.getDefaultDisplaySync() |
| 39 | - private screenWidth: number = 0 | ||
| 40 | - private picWidth: number = 0 | ||
| 41 | - @State picHeight: number = 0 | ||
| 42 | @State titleHeight: number = 0 | 39 | @State titleHeight: number = 0 |
| 43 | @State index: number = 0 | 40 | @State index: number = 0 |
| 44 | @State currentIndex: number = 0 | 41 | @State currentIndex: number = 0 |
| @@ -65,6 +62,7 @@ export struct MultiPictureDetailPageComponent { | @@ -65,6 +62,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 65 | pageParam: ParamType = {} | 62 | pageParam: ParamType = {} |
| 66 | followUserId: string = '' | 63 | followUserId: string = '' |
| 67 | followUserName: string = '' | 64 | followUserName: string = '' |
| 65 | + @State isEnableSwipe: boolean = true; | ||
| 68 | 66 | ||
| 69 | //watch监听页码回调 | 67 | //watch监听页码回调 |
| 70 | onCurrentPageNumUpdated(): void { | 68 | onCurrentPageNumUpdated(): void { |
| @@ -76,11 +74,7 @@ export struct MultiPictureDetailPageComponent { | @@ -76,11 +74,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 76 | 74 | ||
| 77 | async aboutToAppear() { | 75 | async aboutToAppear() { |
| 78 | //获取宽高尺寸 | 76 | //获取宽高尺寸 |
| 79 | - this.screenWidth = this.displayTool.width | ||
| 80 | - // this.picWidth = this.screenWidth - vp2px(52) | ||
| 81 | - this.picWidth = this.screenWidth | ||
| 82 | - this.picHeight = this.picWidth * 578 / 375 | ||
| 83 | - this.titleHeight = this.screenWidth * 178 / 375 | 77 | + this.titleHeight = this.displayTool.width * 178 / 375 |
| 84 | //注册字体 | 78 | //注册字体 |
| 85 | // font.registerFont({ | 79 | // font.registerFont({ |
| 86 | // familyName: 'BebasNeueBold', | 80 | // familyName: 'BebasNeueBold', |
| @@ -306,7 +300,7 @@ export struct MultiPictureDetailPageComponent { | @@ -306,7 +300,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 306 | Swiper(this.swiperController) { | 300 | Swiper(this.swiperController) { |
| 307 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { | 301 | ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => { |
| 308 | Swiper(this.swiperControllerItem) { | 302 | Swiper(this.swiperControllerItem) { |
| 309 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 303 | + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) |
| 310 | } | 304 | } |
| 311 | .width('100%') | 305 | .width('100%') |
| 312 | .height('100%') | 306 | .height('100%') |
-
Please register or login to post a comment