Showing
35 changed files
with
512 additions
and
800 deletions
| @@ -40,15 +40,10 @@ export class Logger { | @@ -40,15 +40,10 @@ export class Logger { | ||
| 40 | Logger.domain = domain; | 40 | Logger.domain = domain; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | - static debug(prefixStr?:string,...args: string[]) { | 43 | + static debug(...args: string[]) { |
| 44 | if (!Logger.isDebug) { | 44 | if (!Logger.isDebug) { |
| 45 | return | 45 | return |
| 46 | } | 46 | } |
| 47 | - if(prefixStr){ | ||
| 48 | - Logger.prefix = prefixStr | ||
| 49 | - }else { | ||
| 50 | - Logger.prefix = 'SightApp'; | ||
| 51 | - } | ||
| 52 | Logger.logContent(LogLevel.DEBUG, ...args) | 47 | Logger.logContent(LogLevel.DEBUG, ...args) |
| 53 | } | 48 | } |
| 54 | 49 | ||
| @@ -90,55 +85,68 @@ export class Logger { | @@ -90,55 +85,68 @@ export class Logger { | ||
| 90 | 85 | ||
| 91 | static logContent(level: LogLevel, ...args: string[]) { | 86 | static logContent(level: LogLevel, ...args: string[]) { |
| 92 | let msg = Logger.getMsg(...args) | 87 | let msg = Logger.getMsg(...args) |
| 88 | + let tag = Logger.getTag(...args) | ||
| 93 | let length = msg.length | 89 | let length = msg.length |
| 94 | if (length < Logger.CHUNK_SIZE) { | 90 | if (length < Logger.CHUNK_SIZE) { |
| 95 | // 不超限,保持原来的打印 | 91 | // 不超限,保持原来的打印 |
| 96 | - Logger.print(level, ...args) | 92 | + Logger.print(tag, level, ...args) |
| 97 | } else { | 93 | } else { |
| 98 | // 超限,分段打印 | 94 | // 超限,分段打印 |
| 99 | for (let i = 0; i < length; i += Logger.CHUNK_SIZE) { | 95 | for (let i = 0; i < length; i += Logger.CHUNK_SIZE) { |
| 100 | let count = Math.min(length - i, Logger.CHUNK_SIZE); | 96 | let count = Math.min(length - i, Logger.CHUNK_SIZE); |
| 101 | - Logger.printExt(level, msg.substring(i, i + count)); | 97 | + Logger.printExt(tag, level, msg.substring(i, i + count)); |
| 102 | } | 98 | } |
| 103 | } | 99 | } |
| 104 | } | 100 | } |
| 105 | 101 | ||
| 106 | - static print(level: LogLevel, ...msg: string[]) { | 102 | + static print(tag: string, level: LogLevel, ...msg: string[]) { |
| 103 | + | ||
| 104 | + let prefix = Logger.prefix | ||
| 105 | + if (tag) { | ||
| 106 | + prefix = tag | ||
| 107 | + } | ||
| 108 | + | ||
| 107 | switch (level) { | 109 | switch (level) { |
| 108 | case LogLevel.DEBUG: | 110 | case LogLevel.DEBUG: |
| 109 | - hilog.debug(Logger.domain, Logger.prefix, Logger.format, msg); | 111 | + hilog.debug(Logger.domain, prefix, Logger.format, msg); |
| 110 | break | 112 | break |
| 111 | case LogLevel.INFO: | 113 | case LogLevel.INFO: |
| 112 | - hilog.info(Logger.domain, Logger.prefix, Logger.format, msg); | 114 | + hilog.info(Logger.domain, prefix, Logger.format, msg); |
| 113 | break | 115 | break |
| 114 | case LogLevel.WARN: | 116 | case LogLevel.WARN: |
| 115 | - hilog.warn(Logger.domain, Logger.prefix, Logger.format, msg); | 117 | + hilog.warn(Logger.domain, prefix, Logger.format, msg); |
| 116 | break | 118 | break |
| 117 | case LogLevel.ERROR: | 119 | case LogLevel.ERROR: |
| 118 | - hilog.error(Logger.domain, Logger.prefix, Logger.format, msg); | 120 | + hilog.error(Logger.domain, prefix, Logger.format, msg); |
| 119 | break | 121 | break |
| 120 | case LogLevel.FATAL: | 122 | case LogLevel.FATAL: |
| 121 | - hilog.fatal(Logger.domain, Logger.prefix, Logger.format, msg); | 123 | + hilog.fatal(Logger.domain, prefix, Logger.format, msg); |
| 122 | break | 124 | break |
| 123 | } | 125 | } |
| 124 | } | 126 | } |
| 125 | 127 | ||
| 126 | - static printExt(level: LogLevel, msg: string) { | 128 | + static printExt(tag: string, level: LogLevel, msg: string) { |
| 129 | + | ||
| 130 | + let prefix = Logger.prefix | ||
| 131 | + if (tag) { | ||
| 132 | + prefix = tag | ||
| 133 | + } | ||
| 134 | + | ||
| 127 | switch (level) { | 135 | switch (level) { |
| 128 | case LogLevel.DEBUG: | 136 | case LogLevel.DEBUG: |
| 129 | - hilog.debug(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 137 | + hilog.debug(Logger.domain, prefix, Logger.format_ext, msg); |
| 130 | break | 138 | break |
| 131 | case LogLevel.INFO: | 139 | case LogLevel.INFO: |
| 132 | - hilog.info(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 140 | + hilog.info(Logger.domain, prefix, Logger.format_ext, msg); |
| 133 | break | 141 | break |
| 134 | case LogLevel.WARN: | 142 | case LogLevel.WARN: |
| 135 | - hilog.warn(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 143 | + hilog.warn(Logger.domain, prefix, Logger.format_ext, msg); |
| 136 | break | 144 | break |
| 137 | case LogLevel.ERROR: | 145 | case LogLevel.ERROR: |
| 138 | - hilog.error(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 146 | + hilog.error(Logger.domain, prefix, Logger.format_ext, msg); |
| 139 | break | 147 | break |
| 140 | case LogLevel.FATAL: | 148 | case LogLevel.FATAL: |
| 141 | - hilog.fatal(Logger.domain, Logger.prefix, Logger.format_ext, msg); | 149 | + hilog.fatal(Logger.domain, prefix, Logger.format_ext, msg); |
| 142 | break | 150 | break |
| 143 | } | 151 | } |
| 144 | } | 152 | } |
| @@ -153,6 +161,20 @@ export class Logger { | @@ -153,6 +161,20 @@ export class Logger { | ||
| 153 | }) | 161 | }) |
| 154 | return msg.substring(2, msg.length); | 162 | return msg.substring(2, msg.length); |
| 155 | } | 163 | } |
| 164 | + | ||
| 165 | + static getTag(...args: string[]): string { | ||
| 166 | + if (args == null || args.length <= 0) { | ||
| 167 | + return ''; | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + if (args.length > 1) { | ||
| 171 | + | ||
| 172 | + return args[0] | ||
| 173 | + } else { | ||
| 174 | + return '' | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + } | ||
| 156 | } | 178 | } |
| 157 | 179 | ||
| 158 | // export default new Logger('SightApp', 0xFF00) | 180 | // export default new Logger('SightApp', 0xFF00) |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | "main": "Index.ets", | 7 | "main": "Index.ets", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | - "@ohos/lottie": "2.0.10", | ||
| 11 | "wdConstant": "file:../../commons/wdConstant", | 10 | "wdConstant": "file:../../commons/wdConstant", |
| 12 | "wdPlayer": "file:../../features/wdPlayer", | 11 | "wdPlayer": "file:../../features/wdPlayer", |
| 13 | "wdLogin": "file:../../features/wdLogin", | 12 | "wdLogin": "file:../../features/wdLogin", |
| @@ -186,8 +186,8 @@ export struct CardParser { | @@ -186,8 +186,8 @@ export struct CardParser { | ||
| 186 | contentDTO: contentDTO, | 186 | contentDTO: contentDTO, |
| 187 | compDTO: this.compDTO, | 187 | compDTO: this.compDTO, |
| 188 | pageId: this.pageId, | 188 | pageId: this.pageId, |
| 189 | - pageName: this.pageName | ||
| 190 | - | 189 | + pageName: this.pageName, |
| 190 | + index:this.compIndex | ||
| 191 | }) | 191 | }) |
| 192 | } else { | 192 | } else { |
| 193 | // todo:组件未实现 / Component Not Implemented | 193 | // todo:组件未实现 / Component Not Implemented |
| @@ -5,6 +5,7 @@ import { promptAction } from '@kit.ArkUI'; | @@ -5,6 +5,7 @@ import { promptAction } from '@kit.ArkUI'; | ||
| 5 | import { image } from '@kit.ImageKit'; | 5 | import { image } from '@kit.ImageKit'; |
| 6 | import { photoAccessHelper } from '@kit.MediaLibraryKit'; | 6 | import { photoAccessHelper } from '@kit.MediaLibraryKit'; |
| 7 | import fs from '@ohos.file.fs'; | 7 | import fs from '@ohos.file.fs'; |
| 8 | +import { NetworkUtil } from 'wdKit'; | ||
| 8 | 9 | ||
| 9 | const PERMISSIONS: Array<Permissions> = [ | 10 | const PERMISSIONS: Array<Permissions> = [ |
| 10 | 'ohos.permission.READ_IMAGEVIDEO', | 11 | 'ohos.permission.READ_IMAGEVIDEO', |
| @@ -47,7 +48,12 @@ export struct ImageDownloadComponent { | @@ -47,7 +48,12 @@ export struct ImageDownloadComponent { | ||
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | aboutToAppear(): void { | 50 | aboutToAppear(): void { |
| 50 | - this.onChangeUrl() | 51 | + // 注册监听网络连接 |
| 52 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 53 | + if (netStatus) { | ||
| 54 | + // 有网络 | ||
| 55 | + this.onChangeUrl() | ||
| 56 | + } | ||
| 51 | } | 57 | } |
| 52 | 58 | ||
| 53 | async onChangeUrl(): Promise<void> { | 59 | async onChangeUrl(): Promise<void> { |
| @@ -27,6 +27,7 @@ export struct MultiPictureDetailItemComponent { | @@ -27,6 +27,7 @@ export struct MultiPictureDetailItemComponent { | ||
| 27 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean | 27 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean |
| 28 | //alt app.media.picture_loading 设计稿尺寸 | 28 | //alt app.media.picture_loading 设计稿尺寸 |
| 29 | @State imageWidth:string | number = 167 | 29 | @State imageWidth:string | number = 167 |
| 30 | + private scroller: Scroller = new Scroller() | ||
| 30 | 31 | ||
| 31 | 32 | ||
| 32 | async aboutToAppear() { | 33 | async aboutToAppear() { |
| @@ -179,41 +180,46 @@ export struct MultiPictureDetailItemComponent { | @@ -179,41 +180,46 @@ export struct MultiPictureDetailItemComponent { | ||
| 179 | 180 | ||
| 180 | build() { | 181 | build() { |
| 181 | Row() { | 182 | Row() { |
| 182 | - if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ | ||
| 183 | - Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 184 | - .alt($r('app.media.datail_imageLoading_w')) | ||
| 185 | - .width(this.imageWidth) | ||
| 186 | - .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 187 | - .interpolation(ImageInterpolation.High) | ||
| 188 | - .autoResize(false) | ||
| 189 | - .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 190 | - .defaultFocus(true) | ||
| 191 | - .offset({ | ||
| 192 | - // TODO:知识点:通过offset控制图片的偏移 | ||
| 193 | - x: this.imageOffsetInfo.currentX, | ||
| 194 | - y: this.imageOffsetInfo.currentY | ||
| 195 | - }) | ||
| 196 | - .onComplete(event => { | ||
| 197 | - this.imageWidth = '100%' | ||
| 198 | - }) | ||
| 199 | - }else{ | ||
| 200 | - Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 201 | - .alt($r('app.media.datail_imageLoading_w')) | ||
| 202 | - .width(this.imageWidth) | ||
| 203 | - .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 204 | - .interpolation(ImageInterpolation.High) | ||
| 205 | - .autoResize(false) | ||
| 206 | - .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 207 | - .defaultFocus(true) | ||
| 208 | - .offset({ | ||
| 209 | - // TODO:知识点:通过offset控制图片的偏移 | ||
| 210 | - x: this.imageOffsetInfo.currentX, | ||
| 211 | - y: this.imageOffsetInfo.currentY | ||
| 212 | - }) | ||
| 213 | - .onComplete(event => { | ||
| 214 | - this.imageWidth = '100%' | ||
| 215 | - }) | 183 | + Scroll(this.scroller) { |
| 184 | + if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ | ||
| 185 | + Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 186 | + .alt($r('app.media.datail_imageLoading_w')) | ||
| 187 | + .width(this.imageWidth) | ||
| 188 | + .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 189 | + .interpolation(ImageInterpolation.High) | ||
| 190 | + .autoResize(false) | ||
| 191 | + .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 192 | + .defaultFocus(true) | ||
| 193 | + .offset({ | ||
| 194 | + // TODO:知识点:通过offset控制图片的偏移 | ||
| 195 | + x: this.imageOffsetInfo.currentX, | ||
| 196 | + y: this.imageOffsetInfo.currentY | ||
| 197 | + }) | ||
| 198 | + .onComplete(event => { | ||
| 199 | + this.imageWidth = '100%' | ||
| 200 | + }) | ||
| 201 | + }else{ | ||
| 202 | + Image(this.imagePixelMap || 'app.media.datail_imageLoading_w')// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 203 | + .alt($r('app.media.datail_imageLoading_w')) | ||
| 204 | + .width(this.imageWidth) | ||
| 205 | + .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 206 | + .interpolation(ImageInterpolation.High) | ||
| 207 | + .autoResize(false) | ||
| 208 | + .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 209 | + .defaultFocus(true) | ||
| 210 | + .offset({ | ||
| 211 | + // TODO:知识点:通过offset控制图片的偏移 | ||
| 212 | + x: this.imageOffsetInfo.currentX, | ||
| 213 | + y: this.imageOffsetInfo.currentY | ||
| 214 | + }) | ||
| 215 | + .onComplete(event => { | ||
| 216 | + this.imageWidth = '100%' | ||
| 217 | + }) | ||
| 218 | + } | ||
| 216 | } | 219 | } |
| 220 | + .scrollable(ScrollDirection.Vertical) | ||
| 221 | + .scrollBarWidth(0) | ||
| 222 | + .height(this.imageDefaultSize.height || "100%") | ||
| 217 | } | 223 | } |
| 218 | .onBlur(() => { | 224 | .onBlur(() => { |
| 219 | this.resetCurrentImageInfo(); | 225 | this.resetCurrentImageInfo(); |
| @@ -19,7 +19,7 @@ export struct LiveBigImage02Component { | @@ -19,7 +19,7 @@ export struct LiveBigImage02Component { | ||
| 19 | @State contentDTO: ContentDTO = new ContentDTO(); | 19 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 20 | @State loadImg: boolean = false; | 20 | @State loadImg: boolean = false; |
| 21 | @State clicked: boolean = false; | 21 | @State clicked: boolean = false; |
| 22 | - | 22 | + index: number = 0 |
| 23 | async aboutToAppear() { | 23 | async aboutToAppear() { |
| 24 | const curRouter = router.getState().name; | 24 | const curRouter = router.getState().name; |
| 25 | this.clicked = hasClicked(this.contentDTO.objectId,curRouter) | 25 | this.clicked = hasClicked(this.contentDTO.objectId,curRouter) |
| @@ -102,8 +102,7 @@ export struct LiveBigImage02Component { | @@ -102,8 +102,7 @@ export struct LiveBigImage02Component { | ||
| 102 | lottieWidth: 14, | 102 | lottieWidth: 14, |
| 103 | lottieHeight: 14, | 103 | lottieHeight: 14, |
| 104 | autoplay: true, | 104 | autoplay: true, |
| 105 | - loop: true, | ||
| 106 | - title: item.newsTitle | 105 | + loop: true |
| 107 | }) | 106 | }) |
| 108 | .margin({ | 107 | .margin({ |
| 109 | right: '2vp' | 108 | right: '2vp' |
| @@ -161,7 +161,7 @@ export struct ZhSingleColumn09 { | @@ -161,7 +161,7 @@ export struct ZhSingleColumn09 { | ||
| 161 | .height(90) | 161 | .height(90) |
| 162 | .columnsTemplate('1fr 1fr 1fr 1fr') | 162 | .columnsTemplate('1fr 1fr 1fr 1fr') |
| 163 | .rowsTemplate('1fr 1fr') | 163 | .rowsTemplate('1fr 1fr') |
| 164 | - .margin({bottom: 10}) | 164 | + .margin({bottom: 5}) |
| 165 | 165 | ||
| 166 | Row() { | 166 | Row() { |
| 167 | Row() { | 167 | Row() { |
| @@ -188,7 +188,7 @@ export struct ZhSingleColumn09 { | @@ -188,7 +188,7 @@ export struct ZhSingleColumn09 { | ||
| 188 | this.selfClosed = true; | 188 | this.selfClosed = true; |
| 189 | }) | 189 | }) |
| 190 | } | 190 | } |
| 191 | - .height(40) | 191 | + .height(20) |
| 192 | .width('100%') | 192 | .width('100%') |
| 193 | .borderRadius(3) | 193 | .borderRadius(3) |
| 194 | .justifyContent(FlexAlign.SpaceBetween) | 194 | .justifyContent(FlexAlign.SpaceBetween) |
| @@ -14,28 +14,16 @@ export struct LottieView { | @@ -14,28 +14,16 @@ export struct LottieView { | ||
| 14 | private politeChickyController: CanvasRenderingContext2D = | 14 | private politeChickyController: CanvasRenderingContext2D = |
| 15 | new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象 | 15 | new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象 |
| 16 | private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象 | 16 | private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象 |
| 17 | - @Prop title: string | ||
| 18 | 17 | ||
| 19 | - // 页面隐藏销毁动画 | ||
| 20 | - // onPageHide(): void { | ||
| 21 | - // this.animateItem?.destroy() | ||
| 22 | - // | ||
| 23 | - // if (this.onComplete) { | ||
| 24 | - // this.animateItem?.removeEventListener('complete', this.onComplete) | ||
| 25 | - // } | ||
| 26 | - // } | 18 | + |
| 27 | 19 | ||
| 28 | /** | 20 | /** |
| 29 | * 加载动画 | 21 | * 加载动画 |
| 30 | * @param autoplay 控制动画是否自动播放参数 | 22 | * @param autoplay 控制动画是否自动播放参数 |
| 31 | */ | 23 | */ |
| 32 | loadAnimation() { | 24 | loadAnimation() { |
| 33 | - // 销毁动画,减少缓存 | ||
| 34 | - if (this.animateItem !== null) { | ||
| 35 | - this.animateItem.destroy(this.name); | ||
| 36 | - this.animateItem = null; | ||
| 37 | - } | ||
| 38 | 25 | ||
| 26 | + this.onDestroyAnimation() | ||
| 39 | this.animateItem = lottie.loadAnimation({ | 27 | this.animateItem = lottie.loadAnimation({ |
| 40 | container: this.politeChickyController, | 28 | container: this.politeChickyController, |
| 41 | renderer: 'canvas', | 29 | renderer: 'canvas', |
| @@ -55,31 +43,18 @@ export struct LottieView { | @@ -55,31 +43,18 @@ export struct LottieView { | ||
| 55 | 43 | ||
| 56 | } | 44 | } |
| 57 | 45 | ||
| 58 | - aboutToAppear(): void { | ||
| 59 | - // console.error('XXXXZZZZ', '-------aboutToAppear-------' + this.title) | ||
| 60 | - //lottie?.play() | ||
| 61 | - | ||
| 62 | - // if(this.init){ | ||
| 63 | - // if(this.animateItem = null){ | ||
| 64 | - // this.loadAnimation(); | ||
| 65 | - // } | ||
| 66 | - // } | ||
| 67 | - | 46 | + /** |
| 47 | + * 摧毁动画 | ||
| 48 | + */ | ||
| 49 | + onDestroyAnimation(){ | ||
| 50 | + // 销毁动画,减少缓存 | ||
| 51 | + if (this.animateItem !== null) { | ||
| 52 | + this.animateItem.destroy(this.name); | ||
| 53 | + this.animateItem = null; | ||
| 54 | + } | ||
| 68 | 55 | ||
| 69 | } | 56 | } |
| 70 | 57 | ||
| 71 | - aboutToDisappear(): void { | ||
| 72 | - // console.error('XXXXZZZZ', '-------aboutToDisappear-------' + this.title) | ||
| 73 | - // if(this.init){ | ||
| 74 | - // lottie?.destroy(this.name) | ||
| 75 | - // | ||
| 76 | - // if (this.onComplete) { | ||
| 77 | - // this.animateItem?.removeEventListener('complete', this.onComplete) | ||
| 78 | - // } | ||
| 79 | - // this.animateItem = null; | ||
| 80 | - // // } | ||
| 81 | - | ||
| 82 | - } | ||
| 83 | 58 | ||
| 84 | build() { | 59 | build() { |
| 85 | Stack({ alignContent: Alignment.TopStart }) { | 60 | Stack({ alignContent: Alignment.TopStart }) { |
| @@ -92,10 +67,10 @@ export struct LottieView { | @@ -92,10 +67,10 @@ export struct LottieView { | ||
| 92 | this.onReady(this.animateItem) | 67 | this.onReady(this.animateItem) |
| 93 | } | 68 | } |
| 94 | }) | 69 | }) |
| 95 | - .onDisAppear(() => { | ||
| 96 | - lottie.destroy(this.name) | ||
| 97 | - this.animateItem = null; | ||
| 98 | - }).onAppear(()=>{ | 70 | + .onDisAppear(()=>{ |
| 71 | + this.onDestroyAnimation() | ||
| 72 | + }) | ||
| 73 | + .onAppear(()=>{ | ||
| 99 | this.loadAnimation(); | 74 | this.loadAnimation(); |
| 100 | }) | 75 | }) |
| 101 | 76 |
| @@ -34,20 +34,13 @@ export default struct MinePageUserSimpleInfoUI { | @@ -34,20 +34,13 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 34 | Row(){ | 34 | Row(){ |
| 35 | //头像 | 35 | //头像 |
| 36 | Stack(){ | 36 | Stack(){ |
| 37 | - if (this.headPhotoUrl.length > 0){ | ||
| 38 | - Image(this.headPhotoUrl) | ||
| 39 | - .alt(this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')) | ||
| 40 | - .width(`${this.calcHeight(100)}lpx`) | ||
| 41 | - .height(`${this.calcHeight(100)}lpx`) | ||
| 42 | - .objectFit(ImageFit.Cover) | ||
| 43 | - .borderRadius(50) | ||
| 44 | - }else { | ||
| 45 | - Image(this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')) | ||
| 46 | - .width(`${this.calcHeight(100)}lpx`) | ||
| 47 | - .height(`${this.calcHeight(100)}lpx`) | ||
| 48 | - .objectFit(ImageFit.Cover) | ||
| 49 | - .borderRadius(50) | ||
| 50 | - } | 37 | + |
| 38 | + Image(this.isLogin?(this.headPhotoUrl?this.headPhotoUrl:this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')):$r('app.media.default_head')) | ||
| 39 | + .alt($r('app.media.default_head')) | ||
| 40 | + .width(`${this.calcHeight(100)}lpx`) | ||
| 41 | + .height(`${this.calcHeight(100)}lpx`) | ||
| 42 | + .objectFit(ImageFit.Cover) | ||
| 43 | + .borderRadius(50) | ||
| 51 | 44 | ||
| 52 | if(StringUtils.isNotEmpty(this.levelHead)){ | 45 | if(StringUtils.isNotEmpty(this.levelHead)){ |
| 53 | Image(this.levelHead) | 46 | Image(this.levelHead) |
| @@ -41,6 +41,7 @@ export default struct TemplatePageComponent { | @@ -41,6 +41,7 @@ export default struct TemplatePageComponent { | ||
| 41 | 41 | ||
| 42 | extra: string = '' | 42 | extra: string = '' |
| 43 | 43 | ||
| 44 | + | ||
| 44 | async aboutToAppear() { | 45 | async aboutToAppear() { |
| 45 | Logger.debug(TAG, 'aboutToAppear') | 46 | Logger.debug(TAG, 'aboutToAppear') |
| 46 | this.requestPageData() | 47 | this.requestPageData() |
| @@ -78,9 +79,6 @@ export default struct TemplatePageComponent { | @@ -78,9 +79,6 @@ export default struct TemplatePageComponent { | ||
| 78 | }) | 79 | }) |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | - aboutToDisappear(): void { | ||
| 82 | - | ||
| 83 | - } | ||
| 84 | 82 | ||
| 85 | build() { | 83 | build() { |
| 86 | if (this.templatePage.pageCompType === TemplatePageStateType.LOADING) { | 84 | if (this.templatePage.pageCompType === TemplatePageStateType.LOADING) { |
| 1 | -import { ContentDTO } from 'wdBean/Index'; | ||
| 2 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; | 1 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; |
| 3 | import { LazyDataSource } from 'wdKit/Index'; | 2 | import { LazyDataSource } from 'wdKit/Index'; |
| 4 | import { WDViewDefaultType } from '../../view/EmptyComponent'; | 3 | import { WDViewDefaultType } from '../../view/EmptyComponent'; |
| @@ -5,7 +5,7 @@ export struct PeopleShipHomeAttentionComponent { | @@ -5,7 +5,7 @@ export struct PeopleShipHomeAttentionComponent { | ||
| 5 | @Consume isAttention: string | 5 | @Consume isAttention: string |
| 6 | @Consume isLoadingAttention: boolean | 6 | @Consume isLoadingAttention: boolean |
| 7 | build() { | 7 | build() { |
| 8 | - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { | 8 | + Flex({ alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { |
| 9 | Button({type: ButtonType.Normal, stateEffect: false } ) { | 9 | Button({type: ButtonType.Normal, stateEffect: false } ) { |
| 10 | Stack() { | 10 | Stack() { |
| 11 | Row() | 11 | Row() |
| @@ -117,7 +117,6 @@ export struct PeopleShipHomeAttentionComponent { | @@ -117,7 +117,6 @@ export struct PeopleShipHomeAttentionComponent { | ||
| 117 | ToastUtils.showToast('分享为公共方法,待开发', 1000); | 117 | ToastUtils.showToast('分享为公共方法,待开发', 1000); |
| 118 | }) | 118 | }) |
| 119 | .visibility(Visibility.Hidden) | 119 | .visibility(Visibility.Hidden) |
| 120 | - | ||
| 121 | } | 120 | } |
| 122 | 121 | ||
| 123 | } | 122 | } |
| @@ -253,7 +253,7 @@ export struct PeopleShipHomePageTopComponent { | @@ -253,7 +253,7 @@ export struct PeopleShipHomePageTopComponent { | ||
| 253 | 253 | ||
| 254 | // 分享-关注 | 254 | // 分享-关注 |
| 255 | PeopleShipHomeAttentionComponent() | 255 | PeopleShipHomeAttentionComponent() |
| 256 | - .width('100%') | 256 | + .width(`calc(100% - ${32 + 'vp'})`) |
| 257 | .margin({ | 257 | .margin({ |
| 258 | top: '10vp', | 258 | top: '10vp', |
| 259 | bottom: '16vp' | 259 | bottom: '16vp' |
| @@ -85,8 +85,8 @@ export default struct CustomLayout { | @@ -85,8 +85,8 @@ export default struct CustomLayout { | ||
| 85 | name: this.animateName, | 85 | name: this.animateName, |
| 86 | path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | 86 | path: "lottie/refresh_step1.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 |
| 87 | }) | 87 | }) |
| 88 | + this.animateItem.goToAndStop(1) | ||
| 88 | } | 89 | } |
| 89 | - this.animateItem.goToAndStop(1) | ||
| 90 | let total = CustomLayout.REFRESH_HEIGHT | 90 | let total = CustomLayout.REFRESH_HEIGHT |
| 91 | let progress = offset * 100 / total | 91 | let progress = offset * 100 / total |
| 92 | this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true); | 92 | this.animateItem?.goToAndStop(this.getFramesByProgress(progress), true); |
| @@ -103,9 +103,6 @@ export default struct CustomLayout { | @@ -103,9 +103,6 @@ export default struct CustomLayout { | ||
| 103 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | 103 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 |
| 104 | }) | 104 | }) |
| 105 | } | 105 | } |
| 106 | - // this.animateItem2.isLoaded | ||
| 107 | - // TODO 是否拦截重复触发 | ||
| 108 | - this.animateItem2.goToAndPlay(1) | ||
| 109 | } | 106 | } |
| 110 | 107 | ||
| 111 | getFramesByProgress(progress: number): number { | 108 | getFramesByProgress(progress: number): number { |
| @@ -18,14 +18,18 @@ export struct CustomPullToRefresh { | @@ -18,14 +18,18 @@ export struct CustomPullToRefresh { | ||
| 18 | .setAnimDuration(500); | 18 | .setAnimDuration(500); |
| 19 | private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true) | 19 | private refreshSettings: RenderingContextSettings = new RenderingContextSettings(true) |
| 20 | private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings) | 20 | private refreshContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshSettings) |
| 21 | + private refreshingSettings: RenderingContextSettings = new RenderingContextSettings(true) | ||
| 22 | + private refreshingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.refreshingSettings) | ||
| 21 | private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true) | 23 | private loadMoreSettings: RenderingContextSettings = new RenderingContextSettings(true) |
| 22 | private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings) | 24 | private loadMoreContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.loadMoreSettings) |
| 23 | private refreshAnimation: AnimationItem | null = null; | 25 | private refreshAnimation: AnimationItem | null = null; |
| 26 | + private refreshingAnimation: AnimationItem | null = null; | ||
| 24 | private loadMoreAnimation: AnimationItem | null = null; | 27 | private loadMoreAnimation: AnimationItem | null = null; |
| 25 | private refreshAnimName: string = "refresh"; | 28 | private refreshAnimName: string = "refresh"; |
| 26 | private refreshingAnimName: string = "refreshing"; | 29 | private refreshingAnimName: string = "refreshing"; |
| 27 | private loadMoreAnimName: string = "loadMore"; | 30 | private loadMoreAnimName: string = "loadMore"; |
| 28 | private refreshAnimationDestroy = true | 31 | private refreshAnimationDestroy = true |
| 32 | + private refreshingAnimationDestroy = true | ||
| 29 | // refresh-1,refreshing-2,refreshed-3,idle-4 | 33 | // refresh-1,refreshing-2,refreshed-3,idle-4 |
| 30 | @State @Watch('stateChange') private refreshState: number = 4; | 34 | @State @Watch('stateChange') private refreshState: number = 4; |
| 31 | 35 | ||
| @@ -120,9 +124,23 @@ export struct CustomPullToRefresh { | @@ -120,9 +124,23 @@ export struct CustomPullToRefresh { | ||
| 120 | }) | 124 | }) |
| 121 | .onDisAppear(() => { | 125 | .onDisAppear(() => { |
| 122 | lottie.destroy(this.refreshAnimName); | 126 | lottie.destroy(this.refreshAnimName); |
| 127 | + }) | ||
| 128 | + .visibility(this.refreshState == 1 ? Visibility.Visible : Visibility.Hidden) | ||
| 129 | + | ||
| 130 | + Canvas(this.refreshingContext) | ||
| 131 | + .width(60) | ||
| 132 | + .height(60) | ||
| 133 | + .backgroundColor(Color.Transparent) | ||
| 134 | + .onReady(() => { | ||
| 135 | + // 可在此生命回调周期中加载动画,可以保证动画尺寸正确 | ||
| 136 | + //抗锯齿的设置 | ||
| 137 | + this.refreshContext.imageSmoothingEnabled = true; | ||
| 138 | + this.refreshContext.imageSmoothingQuality = 'medium' | ||
| 139 | + }) | ||
| 140 | + .onDisAppear(() => { | ||
| 123 | lottie.destroy(this.refreshingAnimName); | 141 | lottie.destroy(this.refreshingAnimName); |
| 124 | }) | 142 | }) |
| 125 | - .visibility((this.refreshState == 1 || this.refreshState == 2) ? Visibility.Visible : Visibility.Hidden) | 143 | + .visibility(this.refreshState == 2 ? Visibility.Visible : Visibility.Hidden) |
| 126 | 144 | ||
| 127 | Text('已更新至最新') | 145 | Text('已更新至最新') |
| 128 | .fontSize(14) | 146 | .fontSize(14) |
| @@ -175,10 +193,7 @@ export struct CustomPullToRefresh { | @@ -175,10 +193,7 @@ export struct CustomPullToRefresh { | ||
| 175 | } | 193 | } |
| 176 | 194 | ||
| 177 | private refreshAnim(percent: number) { | 195 | private refreshAnim(percent: number) { |
| 178 | - if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshAnimName || | ||
| 179 | - this.refreshAnimationDestroy) { | ||
| 180 | - this.refreshAnimation?.destroy(this.refreshAnimName) | ||
| 181 | - this.refreshAnimation?.destroy(this.refreshingAnimName) | 196 | + if (this.refreshAnimation == null || this.refreshAnimationDestroy) { |
| 182 | this.refreshAnimation = lottie.loadAnimation({ | 197 | this.refreshAnimation = lottie.loadAnimation({ |
| 183 | container: this.refreshContext, | 198 | container: this.refreshContext, |
| 184 | renderer: 'canvas', // canvas 渲染模式 | 199 | renderer: 'canvas', // canvas 渲染模式 |
| @@ -212,21 +227,19 @@ export struct CustomPullToRefresh { | @@ -212,21 +227,19 @@ export struct CustomPullToRefresh { | ||
| 212 | } | 227 | } |
| 213 | 228 | ||
| 214 | private refreshingAnim() { | 229 | private refreshingAnim() { |
| 215 | - // Logger.error('zzzz', 'animate2, 1') | ||
| 216 | // 先销毁之前的动画 | 230 | // 先销毁之前的动画 |
| 217 | - if (this.refreshAnimation == null || this.refreshAnimation.name != this.refreshingAnimName || | ||
| 218 | - this.refreshAnimationDestroy) { | ||
| 219 | - this.refreshAnimation?.destroy(this.refreshAnimName) | ||
| 220 | - this.refreshAnimation?.destroy(this.refreshingAnimName) | ||
| 221 | - this.refreshAnimation = lottie.loadAnimation({ | ||
| 222 | - container: this.refreshContext, | 231 | + if (this.refreshingAnimation == null || this.refreshingAnimationDestroy) { |
| 232 | + this.refreshingAnimation?.destroy(this.refreshingAnimName) | ||
| 233 | + this.refreshingAnimation = lottie.loadAnimation({ | ||
| 234 | + container: this.refreshingContext, | ||
| 223 | renderer: 'canvas', // canvas 渲染模式 | 235 | renderer: 'canvas', // canvas 渲染模式 |
| 224 | loop: 10, | 236 | loop: 10, |
| 225 | autoplay: true, | 237 | autoplay: true, |
| 226 | name: this.refreshingAnimName, | 238 | name: this.refreshingAnimName, |
| 227 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 | 239 | path: "lottie/refresh_step2.json", // 路径加载动画只支持entry/src/main/ets 文件夹下的相对路径 |
| 228 | }) | 240 | }) |
| 229 | - this.addRefreshAnimListener() | 241 | + this.refreshingAnimationDestroy = false |
| 242 | + this.addRefreshingAnimListener() | ||
| 230 | } | 243 | } |
| 231 | // Logger.error('zzzz', 'animate2, 2') | 244 | // Logger.error('zzzz', 'animate2, 2') |
| 232 | } | 245 | } |
| @@ -242,6 +255,13 @@ export struct CustomPullToRefresh { | @@ -242,6 +255,13 @@ export struct CustomPullToRefresh { | ||
| 242 | }); | 255 | }); |
| 243 | } | 256 | } |
| 244 | 257 | ||
| 258 | + private addRefreshingAnimListener() { | ||
| 259 | + this.refreshingAnimation?.addEventListener('destroy', (args: Object): void => { | ||
| 260 | + // Logger.error('zzzz', "lottie destroy"); | ||
| 261 | + this.refreshingAnimationDestroy = true | ||
| 262 | + }); | ||
| 263 | + } | ||
| 264 | + | ||
| 245 | loadMoreAnimate() { | 265 | loadMoreAnimate() { |
| 246 | if (this.loadMoreAnimation == null) { | 266 | if (this.loadMoreAnimation == null) { |
| 247 | this.loadMoreAnimation = lottie.loadAnimation({ | 267 | this.loadMoreAnimation = lottie.loadAnimation({ |
| @@ -66,31 +66,31 @@ export struct SearchComponent { | @@ -66,31 +66,31 @@ export struct SearchComponent { | ||
| 66 | this.breakpointSystem.unregister(); | 66 | this.breakpointSystem.unregister(); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | - getRelatedSearchContent() { | ||
| 70 | - if (StringUtils.isNotEmpty(this.searchText)) { | ||
| 71 | - SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText), getContext(this)).then((value) => { | 69 | + getRelatedSearchContent(searchText: string) { |
| 70 | + if (StringUtils.isNotEmpty(searchText)) { | ||
| 71 | + SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(searchText), getContext(this)).then((value) => { | ||
| 72 | if (value != null && value.length > 0) { | 72 | if (value != null && value.length > 0) { |
| 73 | this.relatedSearchContentsData = [] | 73 | this.relatedSearchContentsData = [] |
| 74 | value.forEach(item => { | 74 | value.forEach(item => { |
| 75 | let tempValue: string = item | 75 | let tempValue: string = item |
| 76 | let tempArr: string[] = [] | 76 | let tempArr: string[] = [] |
| 77 | - if (tempValue.indexOf(this.searchText) === -1) { | 77 | + if (tempValue.indexOf(searchText) === -1) { |
| 78 | tempArr.push(item) | 78 | tempArr.push(item) |
| 79 | this.relatedSearchContentsData.push(new SearchRelatedItem(item, tempArr)) | 79 | this.relatedSearchContentsData.push(new SearchRelatedItem(item, tempArr)) |
| 80 | } else { | 80 | } else { |
| 81 | - while (tempValue.indexOf(this.searchText) != -1) { | ||
| 82 | - let index = tempValue.indexOf(this.searchText) | 81 | + while (tempValue.indexOf(searchText) != -1) { |
| 82 | + let index = tempValue.indexOf(searchText) | ||
| 83 | if (index === 0) { | 83 | if (index === 0) { |
| 84 | try { | 84 | try { |
| 85 | - tempArr.push(this.searchText) | ||
| 86 | - tempValue = tempValue.substring(this.searchText.length, tempValue.length) | 85 | + tempArr.push(searchText) |
| 86 | + tempValue = tempValue.substring(searchText.length, tempValue.length) | ||
| 87 | } catch (e) { | 87 | } catch (e) { |
| 88 | } | 88 | } |
| 89 | } else { | 89 | } else { |
| 90 | try { | 90 | try { |
| 91 | tempArr.push(tempValue.substring(0, index)) | 91 | tempArr.push(tempValue.substring(0, index)) |
| 92 | - tempArr.push(this.searchText) | ||
| 93 | - tempValue = tempValue.substring(index + this.searchText.length, tempValue.length) | 92 | + tempArr.push(searchText) |
| 93 | + tempValue = tempValue.substring(index + searchText.length, tempValue.length) | ||
| 94 | } catch (e) { | 94 | } catch (e) { |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| @@ -356,7 +356,7 @@ export struct SearchComponent { | @@ -356,7 +356,7 @@ export struct SearchComponent { | ||
| 356 | this.resetSearch() | 356 | this.resetSearch() |
| 357 | } else { | 357 | } else { |
| 358 | if (this.hasInputContent) { | 358 | if (this.hasInputContent) { |
| 359 | - this.getRelatedSearchContent() | 359 | + this.getRelatedSearchContent(value) |
| 360 | } | 360 | } |
| 361 | } | 361 | } |
| 362 | }) | 362 | }) |
| @@ -142,7 +142,7 @@ export struct SearchResultComponent { | @@ -142,7 +142,7 @@ export struct SearchResultComponent { | ||
| 142 | SearchResultContentComponent({ keywords: this.searchText, searchType: item ,sameSearch:this.sameSearch,isCurrentShow:this.currentIndex === index}) | 142 | SearchResultContentComponent({ keywords: this.searchText, searchType: item ,sameSearch:this.sameSearch,isCurrentShow:this.currentIndex === index}) |
| 143 | }.tabBar(this.TabBuilder(index, item)) | 143 | }.tabBar(this.TabBuilder(index, item)) |
| 144 | .layoutWeight(1) | 144 | .layoutWeight(1) |
| 145 | - }, (item: string, index: number) => index.toString()) | 145 | + }, (item: string) => item) |
| 146 | } | 146 | } |
| 147 | .vertical(false) | 147 | .vertical(false) |
| 148 | .barMode(BarMode.Fixed) | 148 | .barMode(BarMode.Fixed) |
| @@ -10,7 +10,7 @@ import { | @@ -10,7 +10,7 @@ import { | ||
| 10 | } from 'wdBean/Index' | 10 | } from 'wdBean/Index' |
| 11 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' | 11 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' |
| 12 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' | 12 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' |
| 13 | -import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index' | 13 | +import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index' |
| 14 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 14 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 15 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 15 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 16 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' | 16 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' |
| @@ -19,8 +19,7 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' | @@ -19,8 +19,7 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' | ||
| 19 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' | 19 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' |
| 20 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' | 20 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' |
| 21 | import { SearchResultContentData } from '../../viewmodel/SearchResultContentData' | 21 | import { SearchResultContentData } from '../../viewmodel/SearchResultContentData' |
| 22 | -import { | ||
| 23 | - SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | 22 | +import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' |
| 24 | import { CardParser } from '../CardParser' | 23 | import { CardParser } from '../CardParser' |
| 25 | import { FollowChildComponent } from '../mine/follow/FollowChildComponent' | 24 | import { FollowChildComponent } from '../mine/follow/FollowChildComponent' |
| 26 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' | 25 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' |
| @@ -30,7 +29,7 @@ import { JSON } from '@kit.ArkTS' | @@ -30,7 +29,7 @@ import { JSON } from '@kit.ArkTS' | ||
| 30 | import { MoreComponent } from '../cardview/MoreComponent' | 29 | import { MoreComponent } from '../cardview/MoreComponent' |
| 31 | import { Card9Component } from '../cardview/Card9Component' | 30 | import { Card9Component } from '../cardview/Card9Component' |
| 32 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 31 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 33 | - | 32 | +import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 34 | const TAG = "SearchResultContentComponent" | 33 | const TAG = "SearchResultContentComponent" |
| 35 | 34 | ||
| 36 | @Component | 35 | @Component |
| @@ -38,7 +37,7 @@ export struct SearchResultContentComponent { | @@ -38,7 +37,7 @@ export struct SearchResultContentComponent { | ||
| 38 | @State keywords: string = "" | 37 | @State keywords: string = "" |
| 39 | @State searchType: string = "" | 38 | @State searchType: string = "" |
| 40 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 39 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 41 | - tempList : ContentDTO[] = [] | 40 | + tempList: ContentDTO[] = [] |
| 42 | @State data_rmh: SearchRmhDescription[] = [] | 41 | @State data_rmh: SearchRmhDescription[] = [] |
| 43 | @State count: number = -1; | 42 | @State count: number = -1; |
| 44 | @State isLoading: boolean = false | 43 | @State isLoading: boolean = false |
| @@ -48,14 +47,14 @@ export struct SearchResultContentComponent { | @@ -48,14 +47,14 @@ export struct SearchResultContentComponent { | ||
| 48 | scroller: Scroller = new Scroller() | 47 | scroller: Scroller = new Scroller() |
| 49 | private scroller2: Scroller = new Scroller() | 48 | private scroller2: Scroller = new Scroller() |
| 50 | @State ellipseW: number = 0 | 49 | @State ellipseW: number = 0 |
| 51 | - @State moreWidth:number = 20 | 50 | + @State moreWidth: number = 20 |
| 52 | @State listLeft: number = 0 | 51 | @State listLeft: number = 0 |
| 53 | @State isEnd: boolean = false | 52 | @State isEnd: boolean = false |
| 54 | - @Watch('updateData') @Prop sameSearch:number = 0 | ||
| 55 | - @Prop isCurrentShow:boolean = false; | 53 | + @Watch('updateData') @Prop sameSearch: number = 0 |
| 54 | + @Prop isCurrentShow: boolean = false; | ||
| 56 | 55 | ||
| 57 | - updateData(){ | ||
| 58 | - if(this.isCurrentShow){ | 56 | + updateData() { |
| 57 | + if (this.isCurrentShow) { | ||
| 59 | this.data_rmh = [] | 58 | this.data_rmh = [] |
| 60 | 59 | ||
| 61 | this.data.clearAllData() | 60 | this.data.clearAllData() |
| @@ -115,7 +114,7 @@ export struct SearchResultContentComponent { | @@ -115,7 +114,7 @@ export struct SearchResultContentComponent { | ||
| 115 | data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] | 114 | data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] |
| 116 | data.mainControl = item.mainControl + "" | 115 | data.mainControl = item.mainControl + "" |
| 117 | 116 | ||
| 118 | - if(data_temp.length === 1){ | 117 | + if (data_temp.length === 1) { |
| 119 | this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0] | 118 | this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0] |
| 120 | this.bean.cnUserName = item.userName | 119 | this.bean.cnUserName = item.userName |
| 121 | this.bean.creatorId = item.creatorId | 120 | this.bean.creatorId = item.creatorId |
| @@ -133,8 +132,8 @@ export struct SearchResultContentComponent { | @@ -133,8 +132,8 @@ export struct SearchResultContentComponent { | ||
| 133 | } else { | 132 | } else { |
| 134 | this.bean.cnFansNum = item.fansNum + "" | 133 | this.bean.cnFansNum = item.fansNum + "" |
| 135 | } | 134 | } |
| 136 | - let regex:RegExp = new RegExp('\n','g') | ||
| 137 | - this.bean.introduction = item.introduction.replace(regex,'') | 135 | + let regex: RegExp = new RegExp('\n', 'g') |
| 136 | + this.bean.introduction = item.introduction.replace(regex, '') | ||
| 138 | 137 | ||
| 139 | this.bean.mainControl = item.mainControl | 138 | this.bean.mainControl = item.mainControl |
| 140 | this.bean.banControl = item.banControl | 139 | this.bean.banControl = item.banControl |
| @@ -148,9 +147,13 @@ export struct SearchResultContentComponent { | @@ -148,9 +147,13 @@ export struct SearchResultContentComponent { | ||
| 148 | data_temp.forEach((data) => { | 147 | data_temp.forEach((data) => { |
| 149 | this.data_rmh.push(data) | 148 | this.data_rmh.push(data) |
| 150 | }) | 149 | }) |
| 150 | + | ||
| 151 | + if(this.data_rmh.length > 0){ | ||
| 152 | + this.count = 1 | ||
| 153 | + } | ||
| 151 | //只有一条创作者,获取 创作者信息 | 154 | //只有一条创作者,获取 创作者信息 |
| 152 | if (this.data_rmh.length === 1) { | 155 | if (this.data_rmh.length === 1) { |
| 153 | - if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){ | 156 | + if (StringUtils.isNotEmpty(UserDataLocal.getUserId())) { |
| 154 | //查询是否被关注 | 157 | //查询是否被关注 |
| 155 | let status = new FollowListStatusRequestItem() | 158 | let status = new FollowListStatusRequestItem() |
| 156 | status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId)) | 159 | status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId)) |
| @@ -159,7 +162,7 @@ export struct SearchResultContentComponent { | @@ -159,7 +162,7 @@ export struct SearchResultContentComponent { | ||
| 159 | }).catch((err: Error) => { | 162 | }).catch((err: Error) => { |
| 160 | console.log(TAG, "请求失败") | 163 | console.log(TAG, "请求失败") |
| 161 | }) | 164 | }) |
| 162 | - }else{ | 165 | + } else { |
| 163 | this.bean.status = "" | 166 | this.bean.status = "" |
| 164 | } | 167 | } |
| 165 | } | 168 | } |
| @@ -192,53 +195,55 @@ export struct SearchResultContentComponent { | @@ -192,53 +195,55 @@ export struct SearchResultContentComponent { | ||
| 192 | }) | 195 | }) |
| 193 | }) | 196 | }) |
| 194 | 197 | ||
| 195 | - SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => { | ||
| 196 | - newValue.forEach((item) => { | ||
| 197 | - resultData.list.forEach((data) => { | ||
| 198 | - if (item.contentId == data.data.id) { | ||
| 199 | - data.data.collectNum = item.collectNum + "" | ||
| 200 | - data.data.commentNum = item.commentNum + "" | ||
| 201 | - data.data.likeNum = item.likeNum + "" | ||
| 202 | - data.data.readNum = item.readNum + "" | ||
| 203 | - data.data.shareNum = item.shareNum + "" | ||
| 204 | - } | 198 | + if (data.contentList.length > 0) { |
| 199 | + | ||
| 200 | + SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => { | ||
| 201 | + newValue.forEach((item) => { | ||
| 202 | + resultData.list.forEach((data) => { | ||
| 203 | + if (item.contentId == data.data.id) { | ||
| 204 | + data.data.collectNum = item.collectNum + "" | ||
| 205 | + data.data.commentNum = item.commentNum + "" | ||
| 206 | + data.data.likeNum = item.likeNum + "" | ||
| 207 | + data.data.readNum = item.readNum + "" | ||
| 208 | + data.data.shareNum = item.shareNum + "" | ||
| 209 | + } | ||
| 210 | + }) | ||
| 205 | }) | 211 | }) |
| 206 | - }) | ||
| 207 | - // 批量号主信息 | ||
| 208 | - let creatorIdList: string[] = [] | ||
| 209 | - resultData.list.forEach((value:SearchResultContentItem) => { | ||
| 210 | - creatorIdList.push(value.data.creatorId) | ||
| 211 | - }) | ||
| 212 | - SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => { | 212 | + // 批量号主信息 |
| 213 | + let creatorIdList: string[] = [] | ||
| 213 | resultData.list.forEach((value: SearchResultContentItem) => { | 214 | resultData.list.forEach((value: SearchResultContentItem) => { |
| 214 | - const landscape = value.data.landscape | ||
| 215 | - let photos: FullColumnImgUrlDTO[] = [] | ||
| 216 | - // if (value.data.appStyle === 4) { | 215 | + creatorIdList.push(value.data.creatorId) |
| 216 | + }) | ||
| 217 | + SearcherAboutDataModel.getCreatorDetailListData({ creatorIdList: creatorIdList }).then((rem) => { | ||
| 218 | + resultData.list.forEach((value: SearchResultContentItem) => { | ||
| 219 | + const landscape = value.data.landscape | ||
| 220 | + let photos: FullColumnImgUrlDTO[] = [] | ||
| 221 | + // if (value.data.appStyle === 4) { | ||
| 217 | value.data.appStyleImages.split("&&").forEach((value) => { | 222 | value.data.appStyleImages.split("&&").forEach((value) => { |
| 218 | let resizeParams = MinePageDatasModel.extractResizeParams(value) | 223 | let resizeParams = MinePageDatasModel.extractResizeParams(value) |
| 219 | - if(resizeParams && resizeParams.length === 2){ | 224 | + if (resizeParams && resizeParams.length === 2) { |
| 220 | photos.push( | 225 | photos.push( |
| 221 | { | 226 | { |
| 222 | fullUrl: value, | 227 | fullUrl: value, |
| 223 | - weight:resizeParams[0], | ||
| 224 | - height:resizeParams[1], | 228 | + weight: resizeParams[0], |
| 229 | + height: resizeParams[1], | ||
| 225 | landscape: Number(landscape), | 230 | landscape: Number(landscape), |
| 226 | } as FullColumnImgUrlDTO | 231 | } as FullColumnImgUrlDTO |
| 227 | ) | 232 | ) |
| 228 | } | 233 | } |
| 229 | }) | 234 | }) |
| 230 | - // } | ||
| 231 | - let contentDTO = this.dataTransform(rem,value, photos); | ||
| 232 | - if(value.data.type != "13"){ | ||
| 233 | - this.data.push(contentDTO) | ||
| 234 | - if(value.data.sameContentList != null && value.data.sameContentList.length > 0) { | ||
| 235 | - let contentDTO2 = new ContentDTO(); | ||
| 236 | - contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList) | ||
| 237 | - contentDTO2.sameContentListSize = value.data.sameContentList.length | ||
| 238 | - this.data.push(contentDTO2) | 235 | + // } |
| 236 | + let contentDTO = this.dataTransform(rem, value, photos); | ||
| 237 | + if (value.data.type != "13") { | ||
| 238 | + this.data.push(contentDTO) | ||
| 239 | + if (value.data.sameContentList != null && value.data.sameContentList.length > 0) { | ||
| 240 | + let contentDTO2 = new ContentDTO(); | ||
| 241 | + contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList) | ||
| 242 | + contentDTO2.sameContentListSize = value.data.sameContentList.length | ||
| 243 | + this.data.push(contentDTO2) | ||
| 244 | + } | ||
| 239 | } | 245 | } |
| 240 | - } | ||
| 241 | - }) | 246 | + }) |
| 242 | 247 | ||
| 243 | this.tempList = [] | 248 | this.tempList = [] |
| 244 | this.data.notifyDataReload() | 249 | this.data.notifyDataReload() |
| @@ -249,30 +254,38 @@ export struct SearchResultContentComponent { | @@ -249,30 +254,38 @@ export struct SearchResultContentComponent { | ||
| 249 | this.hasMore = false | 254 | this.hasMore = false |
| 250 | } | 255 | } |
| 251 | this.isLoading = false | 256 | this.isLoading = false |
| 257 | + }).catch((err: Error) => { | ||
| 258 | + console.log(TAG, JSON.stringify(err)) | ||
| 259 | + }) | ||
| 252 | }).catch((err: Error) => { | 260 | }).catch((err: Error) => { |
| 253 | - console.log(TAG, JSON.stringify(err)) | 261 | + console.log(TAG, "请求失败") |
| 262 | + this.isLoading = false | ||
| 263 | + this.count = this.count === -1 ? 0 : this.count | ||
| 254 | }) | 264 | }) |
| 255 | - }).catch((err: Error) => { | ||
| 256 | - console.log(TAG, "请求失败") | ||
| 257 | - this.isLoading = false | ||
| 258 | - this.count = this.count === -1 ? 0 : this.count | ||
| 259 | - }) | 265 | + }else { |
| 266 | + this.hasMore = false | ||
| 267 | + } | ||
| 260 | } | 268 | } |
| 261 | 269 | ||
| 262 | build() { | 270 | build() { |
| 263 | Column() { | 271 | Column() { |
| 264 | if (this.count == 0) { | 272 | if (this.count == 0) { |
| 265 | - ListHasNoMoreDataUI({ style: 2 }) | 273 | + // ListHasNoMoreDataUI({ style: 2 }) |
| 274 | + EmptyComponent({ | ||
| 275 | + emptyType: WDViewDefaultType.WDViewDefaultType_NoSearchResult, | ||
| 276 | + emptyButton: false, | ||
| 277 | + | ||
| 278 | + }) | ||
| 266 | } else { | 279 | } else { |
| 267 | - List({scroller:this.scroller2}) { | ||
| 268 | - if (this.data_rmh != null && this.data_rmh.length > 0){ | ||
| 269 | - if (this.data_rmh.length === 1){ | ||
| 270 | - ListItem(){ | 280 | + List({ scroller: this.scroller2 }) { |
| 281 | + if (this.data_rmh != null && this.data_rmh.length > 0) { | ||
| 282 | + if (this.data_rmh.length === 1) { | ||
| 283 | + ListItem() { | ||
| 271 | FollowChildComponent({ data: this.bean, type: 1 }) | 284 | FollowChildComponent({ data: this.bean, type: 1 }) |
| 272 | - }.padding({left:"31lpx",right:"31lpx"}) | ||
| 273 | - }else{ | ||
| 274 | - ListItem(){ | ||
| 275 | - Column(){ | 285 | + }.padding({ left: "31lpx", right: "31lpx" }) |
| 286 | + } else { | ||
| 287 | + ListItem() { | ||
| 288 | + Column() { | ||
| 276 | this.SearchListUI() | 289 | this.SearchListUI() |
| 277 | } | 290 | } |
| 278 | } | 291 | } |
| @@ -283,36 +296,37 @@ export struct SearchResultContentComponent { | @@ -283,36 +296,37 @@ export struct SearchResultContentComponent { | ||
| 283 | Column() { | 296 | Column() { |
| 284 | if (this.searchType == "activity") { | 297 | if (this.searchType == "activity") { |
| 285 | ActivityItemComponent({ contentDTO: item }) | 298 | ActivityItemComponent({ contentDTO: item }) |
| 286 | - }else if(item.sameContentListSize > 0){ | 299 | + } else if (item.sameContentListSize > 0) { |
| 287 | MoreComponent({ contentDTO: item }) | 300 | MoreComponent({ contentDTO: item }) |
| 288 | - }else if(item.appStyle == "9"){ | ||
| 289 | - Column(){ | ||
| 290 | - Card9Component({ compDTO: new CompDTO, contentDTO:item, pageId: "", pageName: "" }) | 301 | + } else if (item.appStyle == "9") { |
| 302 | + Column() { | ||
| 303 | + Card9Component({ | ||
| 304 | + compDTO: new CompDTO, | ||
| 305 | + contentDTO: item, | ||
| 306 | + pageId: "", | ||
| 307 | + pageName: "" | ||
| 308 | + }) | ||
| 291 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 309 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) |
| 292 | } | 310 | } |
| 293 | } else { | 311 | } else { |
| 294 | - if(this.data?.get(index + 1)?.sameContentListSize > 0) { | 312 | + if (this.data?.get(index + 1)?.sameContentListSize > 0) { |
| 295 | Divider() | 313 | Divider() |
| 296 | .width('100%') | 314 | .width('100%') |
| 297 | .color($r('app.color.color_F5F5F5')) | 315 | .color($r('app.color.color_F5F5F5')) |
| 298 | .strokeWidth(4) | 316 | .strokeWidth(4) |
| 299 | } | 317 | } |
| 300 | - CardParser({compDTO:new CompDTO, contentDTO: item }) | 318 | + CardParser({ compDTO: new CompDTO, contentDTO: item }) |
| 301 | } | 319 | } |
| 302 | if (index != this.data.totalCount() - 1) { | 320 | if (index != this.data.totalCount() - 1) { |
| 303 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 321 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 304 | - // Divider() | ||
| 305 | - // .width('100%') | ||
| 306 | - // .height('1lpx') | ||
| 307 | - // .color($r('app.color.color_F5F5F5')) | ||
| 308 | - // .strokeWidth('1lpx') | 322 | + |
| 309 | } | 323 | } |
| 310 | } | 324 | } |
| 311 | } | 325 | } |
| 312 | }, (item: ContentDTO, index: number) => index.toString()) | 326 | }, (item: ContentDTO, index: number) => index.toString()) |
| 313 | 327 | ||
| 314 | //没有更多数据 显示提示 | 328 | //没有更多数据 显示提示 |
| 315 | - if (!this.hasMore && this.data.totalCount() > 0) { | 329 | + if (!this.hasMore && (this.data.totalCount() > 0|| (this.data_rmh != null && this.data_rmh.length > 0))) { |
| 316 | ListItem() { | 330 | ListItem() { |
| 317 | ListHasNoMoreDataUI() | 331 | ListHasNoMoreDataUI() |
| 318 | } | 332 | } |
| @@ -320,6 +334,7 @@ export struct SearchResultContentComponent { | @@ -320,6 +334,7 @@ export struct SearchResultContentComponent { | ||
| 320 | }.cachedCount(5) | 334 | }.cachedCount(5) |
| 321 | .edgeEffect(EdgeEffect.None) | 335 | .edgeEffect(EdgeEffect.None) |
| 322 | .scrollBar(BarState.Off) | 336 | .scrollBar(BarState.Off) |
| 337 | + .height('100%') | ||
| 323 | .onReachEnd(() => { | 338 | .onReachEnd(() => { |
| 324 | console.log(TAG, "触底了"); | 339 | console.log(TAG, "触底了"); |
| 325 | if (!this.isLoading) { | 340 | if (!this.isLoading) { |
| @@ -334,23 +349,23 @@ export struct SearchResultContentComponent { | @@ -334,23 +349,23 @@ export struct SearchResultContentComponent { | ||
| 334 | 349 | ||
| 335 | @Builder | 350 | @Builder |
| 336 | SearchListUI() { | 351 | SearchListUI() { |
| 337 | - List({initialIndex: 0,space:'8lpx',scroller: this.scroller}) { | ||
| 338 | - ListItemGroup(){ | 352 | + List({ initialIndex: 0, space: '8lpx', scroller: this.scroller }) { |
| 353 | + ListItemGroup() { | ||
| 339 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | 354 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { |
| 340 | ListItem() { | 355 | ListItem() { |
| 341 | - SearchCreatorComponent({item:item}) | 356 | + SearchCreatorComponent({ item: item }) |
| 342 | } | 357 | } |
| 343 | .width('150lpx') | 358 | .width('150lpx') |
| 344 | .height('100%') | 359 | .height('100%') |
| 345 | }) | 360 | }) |
| 346 | }.offset({ left: this.listLeft }) | 361 | }.offset({ left: this.listLeft }) |
| 347 | 362 | ||
| 348 | - ListItem(){ | ||
| 349 | - if (this.data_rmh.length === 10){ | 363 | + ListItem() { |
| 364 | + if (this.data_rmh.length === 10) { | ||
| 350 | this.itemEnd() | 365 | this.itemEnd() |
| 351 | } | 366 | } |
| 352 | }.height('100%') | 367 | }.height('100%') |
| 353 | - .margin({left:'23lpx'}) | 368 | + .margin({ left: '23lpx' }) |
| 354 | } | 369 | } |
| 355 | .edgeEffect(EdgeEffect.None) | 370 | .edgeEffect(EdgeEffect.None) |
| 356 | .scrollBar(BarState.Off) | 371 | .scrollBar(BarState.Off) |
| @@ -359,10 +374,10 @@ export struct SearchResultContentComponent { | @@ -359,10 +374,10 @@ export struct SearchResultContentComponent { | ||
| 359 | .height('219lpx') | 374 | .height('219lpx') |
| 360 | .onReachEnd(() => { | 375 | .onReachEnd(() => { |
| 361 | this.isEnd = true | 376 | this.isEnd = true |
| 362 | - console.log(TAG,'is end') | 377 | + console.log(TAG, 'is end') |
| 363 | }) | 378 | }) |
| 364 | .onScrollFrameBegin((offset: number, state: ScrollState) => { | 379 | .onScrollFrameBegin((offset: number, state: ScrollState) => { |
| 365 | - console.log(TAG,'offset', offset) | 380 | + console.log(TAG, 'offset', offset) |
| 366 | if (!this.scroller.isAtEnd()) { | 381 | if (!this.scroller.isAtEnd()) { |
| 367 | this.isEnd = false | 382 | this.isEnd = false |
| 368 | } | 383 | } |
| @@ -374,31 +389,35 @@ export struct SearchResultContentComponent { | @@ -374,31 +389,35 @@ export struct SearchResultContentComponent { | ||
| 374 | .parallelGesture( | 389 | .parallelGesture( |
| 375 | PanGesture({ direction: PanDirection.Horizontal, distance: 1 }) | 390 | PanGesture({ direction: PanDirection.Horizontal, distance: 1 }) |
| 376 | .onActionStart((event: GestureEvent) => { | 391 | .onActionStart((event: GestureEvent) => { |
| 377 | - console.info(TAG,'Pan start') | 392 | + console.info(TAG, 'Pan start') |
| 378 | }) | 393 | }) |
| 379 | .onActionUpdate((event: GestureEvent) => { | 394 | .onActionUpdate((event: GestureEvent) => { |
| 380 | ///小于10个不展示滑动 | 395 | ///小于10个不展示滑动 |
| 381 | - if (this.data_rmh.length < 10) return; | 396 | + if (this.data_rmh.length < 10) { |
| 397 | + return; | ||
| 398 | + } | ||
| 382 | if (event && this.isEnd) { | 399 | if (event && this.isEnd) { |
| 383 | // console.log('event.offsetX',event.offsetX) | 400 | // console.log('event.offsetX',event.offsetX) |
| 384 | this.listLeft = event.offsetX < -60 ? -60 : event.offsetX > 0 ? 0 : event.offsetX | 401 | this.listLeft = event.offsetX < -60 ? -60 : event.offsetX > 0 ? 0 : event.offsetX |
| 385 | this.ellipseW = (-this.listLeft) / 1.5 | 402 | this.ellipseW = (-this.listLeft) / 1.5 |
| 386 | 403 | ||
| 387 | - console.log(TAG,"this.ellipseW==>" + this.ellipseW) | 404 | + console.log(TAG, "this.ellipseW==>" + this.ellipseW) |
| 388 | } | 405 | } |
| 389 | }) | 406 | }) |
| 390 | .onActionEnd((event: GestureEvent) => { | 407 | .onActionEnd((event: GestureEvent) => { |
| 391 | - if (this.data_rmh.length < 10) return; | ||
| 392 | - console.info(TAG,'Pan end') | 408 | + if (this.data_rmh.length < 10) { |
| 409 | + return; | ||
| 410 | + } | ||
| 411 | + console.info(TAG, 'Pan end') | ||
| 393 | this.listLeft = 0 | 412 | this.listLeft = 0 |
| 394 | // this.moreWidth = 20 | 413 | // this.moreWidth = 20 |
| 395 | 414 | ||
| 396 | - if (event.offsetX < 0 && this.ellipseW >=20) { | ||
| 397 | - console.log(TAG,'跳转') | 415 | + if (event.offsetX < 0 && this.ellipseW >= 20) { |
| 416 | + console.log(TAG, '跳转') | ||
| 398 | let params: Params = { | 417 | let params: Params = { |
| 399 | pageID: this.keywords | 418 | pageID: this.keywords |
| 400 | } | 419 | } |
| 401 | - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params) | 420 | + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage, params) |
| 402 | } | 421 | } |
| 403 | this.ellipseW = 0 | 422 | this.ellipseW = 0 |
| 404 | }) | 423 | }) |
| @@ -411,18 +430,17 @@ export struct SearchResultContentComponent { | @@ -411,18 +430,17 @@ export struct SearchResultContentComponent { | ||
| 411 | .strokeWidth('12lpx') | 430 | .strokeWidth('12lpx') |
| 412 | } | 431 | } |
| 413 | 432 | ||
| 414 | - | ||
| 415 | @Builder | 433 | @Builder |
| 416 | itemEnd() { | 434 | itemEnd() { |
| 417 | Row() { | 435 | Row() { |
| 418 | Ellipse() | 436 | Ellipse() |
| 419 | - .width(2* this.ellipseW) | 437 | + .width(2 * this.ellipseW) |
| 420 | .height('100%') | 438 | .height('100%') |
| 421 | .fill('rgb(240,235,238)') | 439 | .fill('rgb(240,235,238)') |
| 422 | .position({ left: -this.ellipseW, top: 0 }) | 440 | .position({ left: -this.ellipseW, top: 0 }) |
| 423 | 441 | ||
| 424 | - Column(){ | ||
| 425 | - Text(this.ellipseW === 0 ? '' : this.ellipseW < 20? '查看更多' : '松手查看') | 442 | + Column() { |
| 443 | + Text(this.ellipseW === 0 ? '' : this.ellipseW < 20 ? '查看更多' : '松手查看') | ||
| 426 | .width('19lpx') | 444 | .width('19lpx') |
| 427 | .fontSize('19lpx') | 445 | .fontSize('19lpx') |
| 428 | .fontWeight('400lpx') | 446 | .fontWeight('400lpx') |
| @@ -437,153 +455,153 @@ export struct SearchResultContentComponent { | @@ -437,153 +455,153 @@ export struct SearchResultContentComponent { | ||
| 437 | .height('100%') | 455 | .height('100%') |
| 438 | } | 456 | } |
| 439 | 457 | ||
| 440 | - private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { | ||
| 441 | - let rmhInfo = this.getRmhInfo(rem,value) | ||
| 442 | - console.log('获取photos',JSON.stringify(photos)) | ||
| 443 | - console.log('获取value2',JSON.stringify(value)) | ||
| 444 | - let liveType = value.data?.liveType; | ||
| 445 | - let seoTags = value.data?.seoTags | ||
| 446 | - let cornerMark = value.data?.cornerMark | ||
| 447 | - let contentDTO = new ContentDTO(); | ||
| 448 | - contentDTO.liveType = liveType?liveType: "" | ||
| 449 | - contentDTO.seoTags = seoTags?seoTags: "" | ||
| 450 | - contentDTO.cornerMark = cornerMark?cornerMark: "" | ||
| 451 | - contentDTO.appStyle = value.data.appStyle + "" | ||
| 452 | - contentDTO.cityCode = value.data.cityCode | ||
| 453 | - contentDTO.coverSize = "" | ||
| 454 | - contentDTO.coverType = value.data.type == "5" ? 1 : -1 | ||
| 455 | - contentDTO.coverUrl = | ||
| 456 | - this.searchType == "activity" ? value.data.zhChannelPageImg : value.data.appStyleImages.split("&&")[0]; | ||
| 457 | - contentDTO.description = value.data.description | ||
| 458 | - contentDTO.districtCode = value.data.districtCode | ||
| 459 | - contentDTO.endTime = value.data.endTime | ||
| 460 | - contentDTO.hImageUrl = "" | ||
| 461 | - contentDTO.heatValue = "" | ||
| 462 | - contentDTO.innerUrl = "" | ||
| 463 | - contentDTO.landscape = Number.parseInt(value.data.landscape) | ||
| 464 | - contentDTO.linkUrl = value.data.linkUrl | ||
| 465 | - contentDTO.openLikes = Number.parseInt(value.data.openLikes) | ||
| 466 | - contentDTO.openUrl = "" | ||
| 467 | - contentDTO.pageId = value.data.pageId | ||
| 468 | - contentDTO.programAuth = "" | ||
| 469 | - contentDTO.programId = "" | ||
| 470 | - contentDTO.programName = "" | ||
| 471 | - contentDTO.programSource = -1 | ||
| 472 | - contentDTO.programType = Number.parseInt(value.data.status) | ||
| 473 | - contentDTO.provinceCode = value.data.provinceCode | ||
| 474 | - contentDTO.showTitleEd = value.data.showTitleEd | ||
| 475 | - contentDTO.showTitleIng = value.data.showTitleIng | ||
| 476 | - contentDTO.showTitleNo = value.data.showTitleNo | ||
| 477 | - contentDTO.startTime = value.data.startTime | ||
| 478 | - contentDTO.subType = "" | ||
| 479 | - contentDTO.subtitle = "" | ||
| 480 | - contentDTO.title = value.data.title | ||
| 481 | - contentDTO.vImageUrl = "" | ||
| 482 | - contentDTO.screenType = "" | ||
| 483 | - contentDTO.source = StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName | ||
| 484 | - contentDTO.objectId = value.data.id | ||
| 485 | - contentDTO.objectType = value.data.type | ||
| 486 | - contentDTO.channelId = value.data.channelId | ||
| 487 | - contentDTO.relId = value.data.relId | ||
| 488 | - contentDTO.relType = value.data.relType | ||
| 489 | - contentDTO.newsTitle = value.data.titleLiteral; | ||
| 490 | - contentDTO.publishTime = | ||
| 491 | - StringUtils.isNotEmpty(value.data.firstPublishTime) ? value.data.firstPublishTime : value.data.publishTime | ||
| 492 | - contentDTO.visitorComment = -1 | ||
| 493 | - contentDTO.fullColumnImgUrls = photos | ||
| 494 | - contentDTO.newsSummary = "" | ||
| 495 | - contentDTO.hasMore = -1 | ||
| 496 | - contentDTO.slideShows = [] | ||
| 497 | - contentDTO.voiceInfo = {} as VoiceInfoDTO | ||
| 498 | - contentDTO.tagWord = -1 | ||
| 499 | - contentDTO.isSelect = true | ||
| 500 | - contentDTO.rmhInfo = {} as RmhInfoDTO | ||
| 501 | - contentDTO.photoNum = StringUtils.isEmpty(value.data.picCount) ? 0 : Number(value.data.picCount) | ||
| 502 | - contentDTO.liveInfo = {} as LiveInfoDTO; | ||
| 503 | - contentDTO.videoInfo = { | ||
| 504 | - videoDuration: Number.parseInt(value.data.duration) | ||
| 505 | - } as VideoInfoDTO; | ||
| 506 | - | ||
| 507 | - let interact = new InteractDataDTO() | ||
| 508 | - interact.collectNum = value.data.collectNum | ||
| 509 | - interact.commentNum = value.data.commentNum | ||
| 510 | - interact.contentId = value.data.id | ||
| 511 | - interact.contentType = Number.parseInt(value.data.type) | ||
| 512 | - interact.likeNum = value.data.likeNum | ||
| 513 | - interact.readNum = Number.parseInt(value.data.readNum) | ||
| 514 | - interact.shareNum = Number.parseInt(value.data.shareNum) | ||
| 515 | - contentDTO.interactData = interact | ||
| 516 | - contentDTO.corner = '' | ||
| 517 | - contentDTO.rmhPlatform = 0 | ||
| 518 | - contentDTO.newTags = '' | ||
| 519 | - contentDTO.isSearch = true | ||
| 520 | - contentDTO.publishTimestamp = "" | ||
| 521 | - contentDTO.bottomNavId = ''; | ||
| 522 | - contentDTO.openType = ''; | ||
| 523 | - contentDTO.extra = ''; | ||
| 524 | - contentDTO.titleShow = value.data.titleShow == "1" ? 0 : 1 | ||
| 525 | - contentDTO.rmhInfo = rmhInfo | ||
| 526 | - contentDTO.shareFlag = value.data.shareFlag | ||
| 527 | - contentDTO.contentText = value.data.contentText | ||
| 528 | - return contentDTO; | 458 | + private dataTransform(rem: CreatorDetailResponseItem[], value: SearchResultContentItem, |
| 459 | + photos: FullColumnImgUrlDTO[]): ContentDTO { | ||
| 460 | + let rmhInfo = this.getRmhInfo(rem, value) | ||
| 461 | + console.log('获取photos', JSON.stringify(photos)) | ||
| 462 | + console.log('获取value2', JSON.stringify(value)) | ||
| 463 | + let liveType = value.data?.liveType; | ||
| 464 | + let seoTags = value.data?.seoTags | ||
| 465 | + let cornerMark = value.data?.cornerMark | ||
| 466 | + let contentDTO = new ContentDTO(); | ||
| 467 | + contentDTO.liveType = liveType ? liveType : "" | ||
| 468 | + contentDTO.seoTags = seoTags ? seoTags : "" | ||
| 469 | + contentDTO.cornerMark = cornerMark ? cornerMark : "" | ||
| 470 | + contentDTO.appStyle = value.data.appStyle + "" | ||
| 471 | + contentDTO.cityCode = value.data.cityCode | ||
| 472 | + contentDTO.coverSize = "" | ||
| 473 | + contentDTO.coverType = value.data.type == "5" ? 1 : -1 | ||
| 474 | + contentDTO.coverUrl = | ||
| 475 | + this.searchType == "activity" ? value.data.zhChannelPageImg : value.data.appStyleImages.split("&&")[0]; | ||
| 476 | + contentDTO.description = value.data.description | ||
| 477 | + contentDTO.districtCode = value.data.districtCode | ||
| 478 | + contentDTO.endTime = value.data.endTime | ||
| 479 | + contentDTO.hImageUrl = "" | ||
| 480 | + contentDTO.heatValue = "" | ||
| 481 | + contentDTO.innerUrl = "" | ||
| 482 | + contentDTO.landscape = Number.parseInt(value.data.landscape) | ||
| 483 | + contentDTO.linkUrl = value.data.linkUrl | ||
| 484 | + contentDTO.openLikes = Number.parseInt(value.data.openLikes) | ||
| 485 | + contentDTO.openUrl = "" | ||
| 486 | + contentDTO.pageId = value.data.pageId | ||
| 487 | + contentDTO.programAuth = "" | ||
| 488 | + contentDTO.programId = "" | ||
| 489 | + contentDTO.programName = "" | ||
| 490 | + contentDTO.programSource = -1 | ||
| 491 | + contentDTO.programType = Number.parseInt(value.data.status) | ||
| 492 | + contentDTO.provinceCode = value.data.provinceCode | ||
| 493 | + contentDTO.showTitleEd = value.data.showTitleEd | ||
| 494 | + contentDTO.showTitleIng = value.data.showTitleIng | ||
| 495 | + contentDTO.showTitleNo = value.data.showTitleNo | ||
| 496 | + contentDTO.startTime = value.data.startTime | ||
| 497 | + contentDTO.subType = "" | ||
| 498 | + contentDTO.subtitle = "" | ||
| 499 | + contentDTO.title = value.data.title | ||
| 500 | + contentDTO.vImageUrl = "" | ||
| 501 | + contentDTO.screenType = "" | ||
| 502 | + contentDTO.source = StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName | ||
| 503 | + contentDTO.objectId = value.data.id | ||
| 504 | + contentDTO.objectType = value.data.type | ||
| 505 | + contentDTO.channelId = value.data.channelId | ||
| 506 | + contentDTO.relId = value.data.relId | ||
| 507 | + contentDTO.relType = value.data.relType | ||
| 508 | + contentDTO.newsTitle = value.data.titleLiteral; | ||
| 509 | + contentDTO.publishTime = | ||
| 510 | + StringUtils.isNotEmpty(value.data.firstPublishTime) ? value.data.firstPublishTime : value.data.publishTime | ||
| 511 | + contentDTO.visitorComment = -1 | ||
| 512 | + contentDTO.fullColumnImgUrls = photos | ||
| 513 | + contentDTO.newsSummary = "" | ||
| 514 | + contentDTO.hasMore = -1 | ||
| 515 | + contentDTO.slideShows = [] | ||
| 516 | + contentDTO.voiceInfo = {} as VoiceInfoDTO | ||
| 517 | + contentDTO.tagWord = -1 | ||
| 518 | + contentDTO.isSelect = true | ||
| 519 | + contentDTO.rmhInfo = {} as RmhInfoDTO | ||
| 520 | + contentDTO.photoNum = StringUtils.isEmpty(value.data.picCount) ? 0 : Number(value.data.picCount) | ||
| 521 | + contentDTO.liveInfo = {} as LiveInfoDTO; | ||
| 522 | + contentDTO.videoInfo = { | ||
| 523 | + videoDuration: Number.parseInt(value.data.duration) | ||
| 524 | + } as VideoInfoDTO; | ||
| 525 | + | ||
| 526 | + let interact = new InteractDataDTO() | ||
| 527 | + interact.collectNum = value.data.collectNum | ||
| 528 | + interact.commentNum = value.data.commentNum | ||
| 529 | + interact.contentId = value.data.id | ||
| 530 | + interact.contentType = Number.parseInt(value.data.type) | ||
| 531 | + interact.likeNum = value.data.likeNum | ||
| 532 | + interact.readNum = Number.parseInt(value.data.readNum) | ||
| 533 | + interact.shareNum = Number.parseInt(value.data.shareNum) | ||
| 534 | + contentDTO.interactData = interact | ||
| 535 | + contentDTO.corner = '' | ||
| 536 | + contentDTO.rmhPlatform = 0 | ||
| 537 | + contentDTO.newTags = '' | ||
| 538 | + contentDTO.isSearch = true | ||
| 539 | + contentDTO.publishTimestamp = "" | ||
| 540 | + contentDTO.bottomNavId = ''; | ||
| 541 | + contentDTO.openType = ''; | ||
| 542 | + contentDTO.extra = ''; | ||
| 543 | + contentDTO.titleShow = value.data.titleShow == "1" ? 0 : 1 | ||
| 544 | + contentDTO.rmhInfo = rmhInfo | ||
| 545 | + contentDTO.shareFlag = value.data.shareFlag | ||
| 546 | + contentDTO.contentText = value.data.contentText | ||
| 547 | + return contentDTO; | ||
| 529 | } | 548 | } |
| 530 | 549 | ||
| 531 | - // 搜索数据转化rmhInfo | ||
| 532 | - private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){ | ||
| 533 | - let obj = value.data | ||
| 534 | - let rmhInfo:RmhInfoDTO = { | ||
| 535 | - rmhHeadUrl:obj.headerPhotoUrl, | ||
| 536 | - rmhName:obj.creatorName, | ||
| 537 | - rmhId:obj.creatorId, | ||
| 538 | - authIcon:obj.authIcon, | ||
| 539 | - authTitle: obj.authTitle, | ||
| 540 | - authTitle2: '', | ||
| 541 | - banControl: 0, | ||
| 542 | - cnIsAttention: 0, | ||
| 543 | - cnAttention: 0, | ||
| 544 | - cnlsComment: 0, | ||
| 545 | - cnlsLike: 0, | ||
| 546 | - cnMainControl: 0, | ||
| 547 | - cnShareControl: 0, | ||
| 548 | - cnIsComment: 0, | ||
| 549 | - cnIsLike:0, | ||
| 550 | - posterShareControl: 0, | ||
| 551 | - rmhDesc: obj.introduction, | ||
| 552 | - userId: obj.userId, | ||
| 553 | - userType: obj.userType, | ||
| 554 | - honoraryIcon:'', | ||
| 555 | - rmhPlatform:0 | ||
| 556 | - } | ||
| 557 | - if(rem.length>0){ | ||
| 558 | - rem.forEach(item=>{ | ||
| 559 | - if(item.creatorId === obj.creatorId){ | ||
| 560 | - rmhInfo = { | ||
| 561 | - rmhHeadUrl:item.headPhotoUrl, | ||
| 562 | - rmhName:item.userName, | ||
| 563 | - rmhId:item.creatorId, | ||
| 564 | - authIcon:item.authIcon, | ||
| 565 | - authTitle: item.authTitle, | ||
| 566 | - authTitle2: '', | ||
| 567 | - banControl: 0, | ||
| 568 | - cnIsAttention:item.isAttention, | ||
| 569 | - cnAttention: 0, | ||
| 570 | - cnlsComment: 0, | ||
| 571 | - cnlsLike: 0, | ||
| 572 | - cnMainControl: 0, | ||
| 573 | - cnShareControl: 0, | ||
| 574 | - cnIsComment: 0, | ||
| 575 | - cnIsLike:0, | ||
| 576 | - posterShareControl: 0, | ||
| 577 | - rmhDesc: item.introduction, | ||
| 578 | - userId: item.userId, | ||
| 579 | - userType: item.userType, | ||
| 580 | - honoraryIcon:'', | ||
| 581 | - rmhPlatform:0 | ||
| 582 | - } | 550 | + // 搜索数据转化rmhInfo |
| 551 | + private getRmhInfo(rem: CreatorDetailResponseItem[], value: SearchResultContentItem) { | ||
| 552 | + let obj = value.data | ||
| 553 | + let rmhInfo: RmhInfoDTO = { | ||
| 554 | + rmhHeadUrl: obj.headerPhotoUrl, | ||
| 555 | + rmhName: obj.creatorName, | ||
| 556 | + rmhId: obj.creatorId, | ||
| 557 | + authIcon: obj.authIcon, | ||
| 558 | + authTitle: obj.authTitle, | ||
| 559 | + authTitle2: '', | ||
| 560 | + banControl: 0, | ||
| 561 | + cnIsAttention: 0, | ||
| 562 | + cnAttention: 0, | ||
| 563 | + cnlsComment: 0, | ||
| 564 | + cnlsLike: 0, | ||
| 565 | + cnMainControl: 0, | ||
| 566 | + cnShareControl: 0, | ||
| 567 | + cnIsComment: 0, | ||
| 568 | + cnIsLike: 0, | ||
| 569 | + posterShareControl: 0, | ||
| 570 | + rmhDesc: obj.introduction, | ||
| 571 | + userId: obj.userId, | ||
| 572 | + userType: obj.userType, | ||
| 573 | + honoraryIcon: '', | ||
| 574 | + rmhPlatform: 0 | ||
| 575 | + } | ||
| 576 | + if (rem.length > 0) { | ||
| 577 | + rem.forEach(item => { | ||
| 578 | + if (item.creatorId === obj.creatorId) { | ||
| 579 | + rmhInfo = { | ||
| 580 | + rmhHeadUrl: item.headPhotoUrl, | ||
| 581 | + rmhName: item.userName, | ||
| 582 | + rmhId: item.creatorId, | ||
| 583 | + authIcon: item.authIcon, | ||
| 584 | + authTitle: item.authTitle, | ||
| 585 | + authTitle2: '', | ||
| 586 | + banControl: 0, | ||
| 587 | + cnIsAttention: item.isAttention, | ||
| 588 | + cnAttention: 0, | ||
| 589 | + cnlsComment: 0, | ||
| 590 | + cnlsLike: 0, | ||
| 591 | + cnMainControl: 0, | ||
| 592 | + cnShareControl: 0, | ||
| 593 | + cnIsComment: 0, | ||
| 594 | + cnIsLike: 0, | ||
| 595 | + posterShareControl: 0, | ||
| 596 | + rmhDesc: item.introduction, | ||
| 597 | + userId: item.userId, | ||
| 598 | + userType: item.userType, | ||
| 599 | + honoraryIcon: '', | ||
| 600 | + rmhPlatform: 0 | ||
| 583 | } | 601 | } |
| 584 | - }) | ||
| 585 | - } | ||
| 586 | - return rmhInfo | 602 | + } |
| 603 | + }) | ||
| 587 | } | 604 | } |
| 588 | - | 605 | + return rmhInfo |
| 606 | + } | ||
| 589 | } | 607 | } |
| @@ -58,6 +58,7 @@ export struct EmptyComponent { | @@ -58,6 +58,7 @@ export struct EmptyComponent { | ||
| 58 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; | 58 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; |
| 59 | @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举 | 59 | @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举 |
| 60 | @State emptyButton: boolean = false | 60 | @State emptyButton: boolean = false |
| 61 | + @State isBlack: boolean = false // 背景是否为黑色 默认白色 | ||
| 61 | @State timeNum: number = 10 | 62 | @State timeNum: number = 10 |
| 62 | /** | 63 | /** |
| 63 | * The empty image width percentage setting. | 64 | * The empty image width percentage setting. |
| @@ -135,7 +136,7 @@ export struct EmptyComponent { | @@ -135,7 +136,7 @@ export struct EmptyComponent { | ||
| 135 | }) | 136 | }) |
| 136 | 137 | ||
| 137 | if (this.isShowButton()) { | 138 | if (this.isShowButton()) { |
| 138 | - if (this.emptyType !== 15) { | 139 | + if (this.emptyType !== 15 && !this.isBlack) { |
| 139 | Button('点击重试') | 140 | Button('点击重试') |
| 140 | .type(ButtonType.Normal) | 141 | .type(ButtonType.Normal) |
| 141 | .width(80) | 142 | .width(80) |
| @@ -253,7 +254,7 @@ export struct EmptyComponent { | @@ -253,7 +254,7 @@ export struct EmptyComponent { | ||
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | isShowButton() { | 256 | isShowButton() { |
| 256 | - if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) { | 257 | + if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15 && this.emptyButton) { |
| 257 | return true | 258 | return true |
| 258 | } else { | 259 | } else { |
| 259 | return false | 260 | return false |
| @@ -57,10 +57,10 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -57,10 +57,10 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 57 | 57 | ||
| 58 | liveToMore() { | 58 | liveToMore() { |
| 59 | if (!!this.compDTO.dataSourceType) { | 59 | if (!!this.compDTO.dataSourceType) { |
| 60 | - if (this.compDTO.dataSourceType === 'OBJECT_POS') { | ||
| 61 | - ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | ||
| 62 | - return; | ||
| 63 | - } | 60 | + // if (this.compDTO.dataSourceType === 'OBJECT_POS') { |
| 61 | + // ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | ||
| 62 | + // return; | ||
| 63 | + // } | ||
| 64 | if (this.compDTO.linkUrl) { | 64 | if (this.compDTO.linkUrl) { |
| 65 | let taskAction: Action = { | 65 | let taskAction: Action = { |
| 66 | type: 'JUMP_H5_BY_WEB_VIEW', | 66 | type: 'JUMP_H5_BY_WEB_VIEW', |
sight_harmony/features/wdComponent/src/main/ets/components/view/ImageItemView.ets
deleted
100644 → 0
| 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'; | ||
| 10 | - | ||
| 11 | -// TODO:知识点:组件复用 | ||
| 12 | -@Reusable | ||
| 13 | -@Component | ||
| 14 | -export struct ImageItemView { | ||
| 15 | - // @Consume private bgc: Color; | ||
| 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 | - private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean | ||
| 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() | ||
| 31 | - | ||
| 32 | - aboutToAppear(): void { | ||
| 33 | - this.imageUri = this.MultiPictureDetailItem.picPath | ||
| 34 | - this.getPicture() | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 通过http的request方法从网络下载图片资源 | ||
| 39 | - */ | ||
| 40 | - async getPicture() { | ||
| 41 | - // 每一个httpRequest对应一个HTTP请求任务,不可复用 | ||
| 42 | - let httpRequest = http.createHttp(); | ||
| 43 | - // 用于订阅HTTP响应头事件 | ||
| 44 | - httpRequest.on('headersReceive', (header: Object) => { | ||
| 45 | - console.info('header: ' + JSON.stringify(header)); | ||
| 46 | - }); | ||
| 47 | - // 用于订阅HTTP流式响应数据接收事件 | ||
| 48 | - let res = new ArrayBuffer(0); | ||
| 49 | - httpRequest.on('dataReceive', (data: ArrayBuffer) => { | ||
| 50 | - const newRes = new ArrayBuffer(res.byteLength + data.byteLength); | ||
| 51 | - const resView = new Uint8Array(newRes); | ||
| 52 | - resView.set(new Uint8Array(res)); | ||
| 53 | - resView.set(new Uint8Array(data), res.byteLength); | ||
| 54 | - res = newRes; | ||
| 55 | - // console.info('dataReceive res length: ' + res.byteLength); | ||
| 56 | - }); | ||
| 57 | - // 用于订阅HTTP流式响应数据接收完毕事件 | ||
| 58 | - httpRequest.on('dataEnd', () => { | ||
| 59 | - this.transcodePixelMap(res); | ||
| 60 | - // 判断网络获取到的资源是否为ArrayBuffer类型 | ||
| 61 | - console.info(`dataEnd getPicture ${res}`) | ||
| 62 | - if (res instanceof ArrayBuffer) { | ||
| 63 | - console.info(`dataEnd getPicture`) | ||
| 64 | - this.imageBuffer = res as ArrayBuffer; | ||
| 65 | - } | ||
| 66 | - console.info('No more data in response, data receive end'); | ||
| 67 | - }); | ||
| 68 | - httpRequest.requestInStream(this.imageUri, | ||
| 69 | - (error: BusinessError, data: number) => { | ||
| 70 | - if (error) { | ||
| 71 | - // 下载失败时弹窗提示检查网络,不执行后续逻辑 | ||
| 72 | - promptAction.showToast({ | ||
| 73 | - message: $r('app.string.image_request_fail'), | ||
| 74 | - duration: 2000 | ||
| 75 | - }) | ||
| 76 | - this.getPicture() | ||
| 77 | - console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`); | ||
| 78 | - return; | ||
| 79 | - } | ||
| 80 | - // 取消订阅HTTP响应头事件 | ||
| 81 | - httpRequest.off('headersReceive'); | ||
| 82 | - // 取消订阅HTTP流式响应数据接收事件 | ||
| 83 | - httpRequest.off('dataReceive'); | ||
| 84 | - // 取消订阅HTTP流式响应数据接收完毕事件 | ||
| 85 | - httpRequest.off('dataEnd'); | ||
| 86 | - // 当该请求使用完毕时,调用destroy方法主动销毁 | ||
| 87 | - httpRequest.destroy(); | ||
| 88 | - } | ||
| 89 | - ) | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - /** | ||
| 93 | - * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型 | ||
| 94 | - * @param data:网络获取到的资源 | ||
| 95 | - */ | ||
| 96 | - transcodePixelMap(data: ArrayBuffer) { | ||
| 97 | - const imageData: ArrayBuffer = data; | ||
| 98 | - // 通过ArrayBuffer创建图片源实例。 | ||
| 99 | - const imageSource: image.ImageSource = image.createImageSource(imageData); | ||
| 100 | - this.initCurrentImageInfo(imageSource); | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - /** | ||
| 104 | - * 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 | ||
| 105 | - * @param imageWHRatio:图片原始宽高比 | ||
| 106 | - * @param size:窗口大小{with:number,height:number} | ||
| 107 | - * @returns image.Size | ||
| 108 | - */ | ||
| 109 | - calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { | ||
| 110 | - let width = 0 | ||
| 111 | - let height = 0; | ||
| 112 | - width = size.width; | ||
| 113 | - height = size.width / imageWHRatio; | ||
| 114 | - return { width: width, height: height }; | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - /** | ||
| 118 | - * TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率 | ||
| 119 | - * @param imageSize:图片当前大小 | ||
| 120 | - * @param windowSize:窗口大小 | ||
| 121 | - * @returns:缩放倍率 | ||
| 122 | - */ | ||
| 123 | - calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { | ||
| 124 | - let ratio: number = 1.0; | ||
| 125 | - if (windowSize.width > imageSize.width) { | ||
| 126 | - ratio = windowSize.width / imageSize.width; | ||
| 127 | - } else { | ||
| 128 | - ratio = windowSize.height / imageSize.height; | ||
| 129 | - } | ||
| 130 | - return ratio; | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - /** | ||
| 134 | - * 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue | ||
| 135 | - * TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算 | ||
| 136 | - */ | ||
| 137 | - initCurrentImageInfo(imageSource: image.ImageSource): void { | ||
| 138 | - this.matrix = matrix4.identity().copy(); | ||
| 139 | - // const imageSource: image.ImageSource = image.createImageSource(this.imageUri); | ||
| 140 | - imageSource.getImageInfo(0).then((data: image.ImageInfo) => { | ||
| 141 | - this.imageWHRatio = data.size.width / data.size.height; | ||
| 142 | - console.error(`this.imageDefaultSize this.imageWHRatio = ${this.imageWHRatio}`); | ||
| 143 | - console.error(`this.imageDefaultSize width = ${data.size.width}`); | ||
| 144 | - console.error(`this.imageDefaultSize height = ${data.size.height}`); | ||
| 145 | - this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSizeManager.get()); | ||
| 146 | - console.error(`this.imageDefaultSize = ${JSON.stringify(windowSizeManager.get())}`); | ||
| 147 | - console.error(`this.imageDefaultSize = ${JSON.stringify(this.imageDefaultSize)}`); | ||
| 148 | - if (this.imageDefaultSize.width === windowSizeManager.get().width) { | ||
| 149 | - this.fitWH = "width"; | ||
| 150 | - } else { | ||
| 151 | - this.fitWH = "height"; | ||
| 152 | - } | ||
| 153 | - this.imageScaleInfo.maxScaleValue += this.fitWH === "width" ? | ||
| 154 | - (windowSizeManager.get().height / this.imageDefaultSize.height) : | ||
| 155 | - (windowSizeManager.get().width / this.imageDefaultSize.width); | ||
| 156 | - }).catch((err: BusinessError) => { | ||
| 157 | - console.error(`[error][getImageInfo]${err.message}`); | ||
| 158 | - }); | ||
| 159 | - imageSource.createPixelMap().then((data: image.PixelMap) => { | ||
| 160 | - this.imagePixelMap = data; | ||
| 161 | - }).catch((err: BusinessError) => { | ||
| 162 | - console.error(`[error][createPixelMap]${err.message}`); | ||
| 163 | - }); | ||
| 164 | - this.isEnableOffset = false; | ||
| 165 | - this.imageScaleInfo.reset(); | ||
| 166 | - this.imageOffsetInfo.reset(); | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - /** | ||
| 170 | - * 在图片消失时,将当前图片的信息设置为默认值 | ||
| 171 | - */ | ||
| 172 | - resetCurrentImageInfo(): void { | ||
| 173 | - this.imageScaleInfo.reset(); | ||
| 174 | - this.imageOffsetInfo.reset(); | ||
| 175 | - this.matrix = matrix4.identity().copy(); | ||
| 176 | - } | ||
| 177 | - | ||
| 178 | - /** | ||
| 179 | - * TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换 | ||
| 180 | - * @returns:长度为4的boolean数组,表示上下左右是否到达边界 | ||
| 181 | - */ | ||
| 182 | - evaluateBound(): boolean[] { | ||
| 183 | - return [false, false, false, false]; | ||
| 184 | - } | ||
| 185 | - | ||
| 186 | - build() { | ||
| 187 | - Stack() { | ||
| 188 | - Scroll(this.scroller) { | ||
| 189 | - if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){ | ||
| 190 | - Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 191 | - .alt($r('app.media.datail_imageLoading_w')) | ||
| 192 | - .width(this.imageWidth) | ||
| 193 | - .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 194 | - .interpolation(ImageInterpolation.High) | ||
| 195 | - .autoResize(false) | ||
| 196 | - .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 197 | - .defaultFocus(true) | ||
| 198 | - .offset({ | ||
| 199 | - // TODO:知识点:通过offset控制图片的偏移 | ||
| 200 | - x: this.imageOffsetInfo.currentX, | ||
| 201 | - y: this.imageOffsetInfo.currentY | ||
| 202 | - }) | ||
| 203 | - .onComplete(event => { | ||
| 204 | - this.imageWidth = '100%' | ||
| 205 | - }) | ||
| 206 | - } else { | ||
| 207 | - Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 208 | - .alt($r('app.media.datail_imageLoading_w')) | ||
| 209 | - .width(this.imageWidth) | ||
| 210 | - .objectFit(ImageFit.Auto)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 211 | - .interpolation(ImageInterpolation.High) | ||
| 212 | - .autoResize(false) | ||
| 213 | - .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 214 | - .defaultFocus(true) | ||
| 215 | - .offset({ | ||
| 216 | - // TODO:知识点:通过offset控制图片的偏移 | ||
| 217 | - x: this.imageOffsetInfo.currentX, | ||
| 218 | - y: this.imageOffsetInfo.currentY | ||
| 219 | - }) | ||
| 220 | - .onComplete(event => { | ||
| 221 | - this.imageWidth = '100%' | ||
| 222 | - }) | ||
| 223 | - } | ||
| 224 | - } | ||
| 225 | - .scrollable(ScrollDirection.Vertical) | ||
| 226 | - .scrollBarWidth(0) | ||
| 227 | - .constraintSize({ | ||
| 228 | - maxHeight: this.imageDefaultSize.height | ||
| 229 | - }) | ||
| 230 | - } | ||
| 231 | - .onBlur(() => { | ||
| 232 | - this.resetCurrentImageInfo(); | ||
| 233 | - }) | ||
| 234 | - // .backgroundColor(this.bgc) | ||
| 235 | - .alignContent(Alignment.Center) | ||
| 236 | - .width("100%") | ||
| 237 | - .height("100%") | ||
| 238 | - .backgroundColor(Color.Black) | ||
| 239 | - .gesture( | ||
| 240 | - GestureGroup( | ||
| 241 | - GestureMode.Exclusive, | ||
| 242 | - // TODO:知识点:双击切换图片大小 | ||
| 243 | - TapGesture({ count: 2 }) | ||
| 244 | - .onAction(() => { | ||
| 245 | - let fn: Function; | ||
| 246 | - // 已经是放大状态下,双击缩小 | ||
| 247 | - if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.defaultScaleValue) { | ||
| 248 | - fn = () => { | ||
| 249 | - this.isEnableSwipe = true; | ||
| 250 | - this.imageScaleInfo.reset(); | ||
| 251 | - this.imageOffsetInfo.reset(); | ||
| 252 | - this.matrix = matrix4.identity().copy(); | ||
| 253 | - }; | ||
| 254 | - } else { | ||
| 255 | - // 已经是缩小状态,双击放大 | ||
| 256 | - fn = () => { | ||
| 257 | - this.isEnableSwipe = false; | ||
| 258 | - const ratio: number = this.calcFitScaleRatio(this.imageDefaultSize, windowSizeManager.get()); | ||
| 259 | - this.imageScaleInfo.scaleValue = ratio; | ||
| 260 | - this.imageOffsetInfo.reset(); | ||
| 261 | - this.matrix = matrix4.identity().scale({ | ||
| 262 | - x: ratio, | ||
| 263 | - y: ratio, | ||
| 264 | - }).copy(); | ||
| 265 | - this.imageScaleInfo.stash(); | ||
| 266 | - } | ||
| 267 | - } | ||
| 268 | - runWithAnimation(fn); | ||
| 269 | - }), | ||
| 270 | - // 单击切换背景色 | ||
| 271 | - // TapGesture({ count: 1 }).onAction(() => { | ||
| 272 | - // runWithAnimation(() => { | ||
| 273 | - // this.bgc = this.bgc === Color.White ? Color.Black : Color.White; | ||
| 274 | - // }); | ||
| 275 | - // }), | ||
| 276 | - // TODO:知识点:双指捏合缩放图片 | ||
| 277 | - PinchGesture({ fingers: 2, distance: 1 }) | ||
| 278 | - .onActionUpdate((event: GestureEvent) => { | ||
| 279 | - this.imageScaleInfo.scaleValue = this.imageScaleInfo.lastValue * event.scale; | ||
| 280 | - // TODO:知识点:缩放时不允许大于最大缩放因子+额外缩放因子,不允许小于默认大小-额外缩放因子,额外缩放因子用于提升用户体验 | ||
| 281 | - if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue * | ||
| 282 | - (1 + this.imageScaleInfo.extraScaleValue) | ||
| 283 | - ) { | ||
| 284 | - this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue * | ||
| 285 | - (1 + this.imageScaleInfo.extraScaleValue); | ||
| 286 | - } | ||
| 287 | - if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue * | ||
| 288 | - (1 - this.imageScaleInfo.extraScaleValue)) { | ||
| 289 | - this.imageScaleInfo.scaleValue = this.imageScaleInfo.defaultScaleValue * | ||
| 290 | - (1 - this.imageScaleInfo.extraScaleValue); | ||
| 291 | - } | ||
| 292 | - // TODO:知识点:matrix默认缩放中心为组件中心 | ||
| 293 | - this.matrix = matrix4.identity().scale({ | ||
| 294 | - x: this.imageScaleInfo.scaleValue, | ||
| 295 | - y: this.imageScaleInfo.scaleValue, | ||
| 296 | - }).copy(); | ||
| 297 | - console.debug(this.imageScaleInfo.toString()); | ||
| 298 | - }) | ||
| 299 | - .onActionEnd((event: GestureEvent) => { | ||
| 300 | - /** | ||
| 301 | - * TODO:知识点:当小于默认大小时,恢复为默认大小 | ||
| 302 | - */ | ||
| 303 | - if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue) { | ||
| 304 | - runWithAnimation(() => { | ||
| 305 | - this.imageScaleInfo.reset(); | ||
| 306 | - this.imageOffsetInfo.reset(); | ||
| 307 | - this.matrix = matrix4.identity().copy(); | ||
| 308 | - }) | ||
| 309 | - } | ||
| 310 | - // TODO:知识点:当大于最大缩放因子时,恢复到最大 | ||
| 311 | - if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue) { | ||
| 312 | - runWithAnimation(() => { | ||
| 313 | - this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue; | ||
| 314 | - this.matrix = matrix4.identity() | ||
| 315 | - .scale({ | ||
| 316 | - x: this.imageScaleInfo.maxScaleValue, | ||
| 317 | - y: this.imageScaleInfo.maxScaleValue | ||
| 318 | - }); | ||
| 319 | - }) | ||
| 320 | - } | ||
| 321 | - this.imageScaleInfo.stash(); | ||
| 322 | - }), | ||
| 323 | - // // TODO:知识点:滑动图片 | ||
| 324 | - // PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片 | ||
| 325 | - // .onActionUpdate((event: GestureEvent) => { | ||
| 326 | - // if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) { | ||
| 327 | - // // 默认大小下不允许移动 | ||
| 328 | - // return; | ||
| 329 | - // } | ||
| 330 | - // this.imageOffsetInfo.currentX = this.imageOffsetInfo.lastX + event.offsetX; | ||
| 331 | - // this.imageOffsetInfo.currentY = this.imageOffsetInfo.lastY + event.offsetY; | ||
| 332 | - // }) | ||
| 333 | - // .onActionEnd((event: GestureEvent) => { | ||
| 334 | - // this.imageOffsetInfo.stash(); | ||
| 335 | - // }) | ||
| 336 | - ), | ||
| 337 | - ) | ||
| 338 | - } | ||
| 339 | -} |
| 1 | import { PhotoListBean } from 'wdBean/Index'; | 1 | import { PhotoListBean } from 'wdBean/Index'; |
| 2 | import { display, router } from '@kit.ArkUI'; | 2 | import { display, router } from '@kit.ArkUI'; |
| 3 | -import { ImageItemView } from '../components/view/ImageItemView'; | ||
| 4 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; | 3 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; |
| 4 | +import { MultiPictureDetailItemComponent } from '../components/MultiPictureDetailItemComponent'; | ||
| 5 | + | ||
| 5 | import { Action } from 'wdBean'; | 6 | import { Action } from 'wdBean'; |
| 6 | import { WindowModel } from 'wdKit/Index'; | 7 | import { WindowModel } from 'wdKit/Index'; |
| 7 | 8 | ||
| @@ -68,11 +69,10 @@ export struct MultiPictureListPage { | @@ -68,11 +69,10 @@ export struct MultiPictureListPage { | ||
| 68 | }) | 69 | }) |
| 69 | .id("backImg") | 70 | .id("backImg") |
| 70 | 71 | ||
| 71 | - | ||
| 72 | if (this.photoList && this.photoList?.length > 0) { | 72 | if (this.photoList && this.photoList?.length > 0) { |
| 73 | Swiper(this.swiperController) { | 73 | Swiper(this.swiperController) { |
| 74 | ForEach(this.photoList, (item: PhotoListBean) => { | 74 | ForEach(this.photoList, (item: PhotoListBean) => { |
| 75 | - ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) | 75 | + MultiPictureDetailItemComponent({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) |
| 76 | }) | 76 | }) |
| 77 | } | 77 | } |
| 78 | .index(this.swiperIndex) | 78 | .index(this.swiperIndex) |
| @@ -135,7 +135,6 @@ export struct MultiPictureListPage { | @@ -135,7 +135,6 @@ export struct MultiPictureListPage { | ||
| 135 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 135 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 136 | }) | 136 | }) |
| 137 | } | 137 | } |
| 138 | - | ||
| 139 | ImageDownloadComponent({ url: this.currentUrl }) | 138 | ImageDownloadComponent({ url: this.currentUrl }) |
| 140 | .alignRules({ | 139 | .alignRules({ |
| 141 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 140 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| @@ -152,6 +151,7 @@ export struct MultiPictureListPage { | @@ -152,6 +151,7 @@ export struct MultiPictureListPage { | ||
| 152 | .width('100%') | 151 | .width('100%') |
| 153 | .height('100%') | 152 | .height('100%') |
| 154 | .id('e_picture_container') | 153 | .id('e_picture_container') |
| 154 | + .backgroundColor(Color.Black) | ||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | aboutToDisappear(): void { | 157 | aboutToDisappear(): void { |
| @@ -5,11 +5,25 @@ | @@ -5,11 +5,25 @@ | ||
| 5 | */ | 5 | */ |
| 6 | export class SearchResultCountItem{ | 6 | export class SearchResultCountItem{ |
| 7 | 7 | ||
| 8 | + /* | ||
| 9 | + "allTotal":0, | ||
| 10 | + "activityTotal":0, | ||
| 11 | + "cmsTotal":0, | ||
| 12 | + "trueTotal":0, | ||
| 13 | + "pageSize":1, | ||
| 14 | + "keyword":"wuhuhuan", | ||
| 15 | + "totalCount":0, | ||
| 16 | + "pageNum":1, | ||
| 17 | + "videoTotal":0, | ||
| 18 | + "rmhTotal":5 | ||
| 19 | + */ | ||
| 8 | 20 | ||
| 21 | + keyword:string ='' //搜索关键字 | ||
| 9 | allTotal: number = 0 //所有tab总量 | 22 | allTotal: number = 0 //所有tab总量 |
| 10 | cmsTotal: number = 0 //精选总量 | 23 | cmsTotal: number = 0 //精选总量 |
| 11 | rmhTotal: number = 0 //人民号总量 | 24 | rmhTotal: number = 0 //人民号总量 |
| 12 | videoTotal: number = 0 //视频总量 | 25 | videoTotal: number = 0 //视频总量 |
| 13 | activityTotal: number = 0 //活动数据总量 | 26 | activityTotal: number = 0 //活动数据总量 |
| 14 | 27 | ||
| 28 | + | ||
| 15 | } | 29 | } |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | "main": "Index.ets", | 7 | "main": "Index.ets", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | - "@ohos/lottie": "2.0.10", | ||
| 11 | "wdComponent": "file:../../features/wdComponent", | 10 | "wdComponent": "file:../../features/wdComponent", |
| 12 | "wdPlayer": "file:../../features/wdPlayer", | 11 | "wdPlayer": "file:../../features/wdPlayer", |
| 13 | "wdNetwork": "file:../../commons/wdNetwork", | 12 | "wdNetwork": "file:../../commons/wdNetwork", |
| @@ -370,6 +370,7 @@ export struct PlayUIComponent { | @@ -370,6 +370,7 @@ export struct PlayUIComponent { | ||
| 370 | this.playerController?.pause() | 370 | this.playerController?.pause() |
| 371 | } else { | 371 | } else { |
| 372 | this.isPlayStatus = true | 372 | this.isPlayStatus = true |
| 373 | + this.playerController?.firstPlay(this.liveUrl) | ||
| 373 | this.playerController?.play() | 374 | this.playerController?.play() |
| 374 | } | 375 | } |
| 375 | }) | 376 | }) |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | "main": "Index.ets", | 7 | "main": "Index.ets", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | - "@ohos/lottie": "2.0.0", | ||
| 11 | "wdPlayer": "file:../../features/wdPlayer", | 10 | "wdPlayer": "file:../../features/wdPlayer", |
| 12 | "wdKit": "file:../../commons/wdKit", | 11 | "wdKit": "file:../../commons/wdKit", |
| 13 | "wdBean": "file:../../features/wdBean", | 12 | "wdBean": "file:../../features/wdBean", |
| @@ -204,7 +204,7 @@ export struct DetailVideoListPage { | @@ -204,7 +204,7 @@ export struct DetailVideoListPage { | ||
| 204 | build() { | 204 | build() { |
| 205 | if (this.netStatus !== undefined) { | 205 | if (this.netStatus !== undefined) { |
| 206 | EmptyComponent({ | 206 | EmptyComponent({ |
| 207 | - emptyType: 1, emptyButton: true, retry: () => { | 207 | + emptyType: 1, emptyButton: true, isBlack: true, retry: () => { |
| 208 | this.getContentDetail(this.contentId, this.relId, this.relType) | 208 | this.getContentDetail(this.contentId, this.relId, this.relType) |
| 209 | } | 209 | } |
| 210 | }) | 210 | }) |
| @@ -36,6 +36,7 @@ struct GuidePages { | @@ -36,6 +36,7 @@ struct GuidePages { | ||
| 36 | ChildItem(index: number) { | 36 | ChildItem(index: number) { |
| 37 | RelativeContainer() { | 37 | RelativeContainer() { |
| 38 | Image(this.guideImage[index]) | 38 | Image(this.guideImage[index]) |
| 39 | + .objectFit(ImageFit.Contain) | ||
| 39 | .alignRules({ | 40 | .alignRules({ |
| 40 | top: { anchor: "__container__", align: VerticalAlign.Top }, | 41 | top: { anchor: "__container__", align: VerticalAlign.Top }, |
| 41 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom } | 42 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom } |
| @@ -122,7 +122,16 @@ struct LoginPage { | @@ -122,7 +122,16 @@ struct LoginPage { | ||
| 122 | this.disableScreenCapture() | 122 | this.disableScreenCapture() |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | + | ||
| 125 | onPageHide(): void { | 126 | onPageHide(): void { |
| 127 | + ///关闭禁止截图 | ||
| 128 | + this.isPrivacyMode = false | ||
| 129 | + this.disableScreenCapture() | ||
| 130 | + | ||
| 131 | + this.loginPageBrowse() | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + loginPageBrowse(){ | ||
| 126 | this.pageHideTime = DateTimeUtils.getTimeStamp() | 135 | this.pageHideTime = DateTimeUtils.getTimeStamp() |
| 127 | let duration = 0 | 136 | let duration = 0 |
| 128 | duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | 137 | duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) |
| @@ -132,8 +141,6 @@ struct LoginPage { | @@ -132,8 +141,6 @@ struct LoginPage { | ||
| 132 | }else{ | 141 | }else{ |
| 133 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page,duration) | 142 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page,duration) |
| 134 | } | 143 | } |
| 135 | - this.isPrivacyMode = false | ||
| 136 | - this.disableScreenCapture() | ||
| 137 | } | 144 | } |
| 138 | 145 | ||
| 139 | build() { | 146 | build() { |
| @@ -372,7 +379,7 @@ struct LoginPage { | @@ -372,7 +379,7 @@ struct LoginPage { | ||
| 372 | .lineHeight(`${this.calcHeight(38)}lpx`) | 379 | .lineHeight(`${this.calcHeight(38)}lpx`) |
| 373 | } | 380 | } |
| 374 | .onClick(() => { | 381 | .onClick(() => { |
| 375 | - this.onPageHide() | 382 | + this.loginPageBrowse() |
| 376 | 383 | ||
| 377 | if(this.checkCodePage){ | 384 | if(this.checkCodePage){ |
| 378 | trackTypeClick(0,TrackConstants.PageName.Phone_Login_Page) | 385 | trackTypeClick(0,TrackConstants.PageName.Phone_Login_Page) |
| @@ -10,7 +10,8 @@ | @@ -10,7 +10,8 @@ | ||
| 10 | "main": "", | 10 | "main": "", |
| 11 | "version": "1.0.0", | 11 | "version": "1.0.0", |
| 12 | "dependencies": { | 12 | "dependencies": { |
| 13 | - "@ohos/pulltorefresh": "^2.0.5", | 13 | + "@ohos/pulltorefresh": "^2.0.6-rc.0", |
| 14 | + "@ohos/lottie": "v2.0.11-rc.6", | ||
| 14 | "@mpaas/udid": "0.0.2", | 15 | "@mpaas/udid": "0.0.2", |
| 15 | "@mpaas/upgrade": "0.0.2", | 16 | "@mpaas/upgrade": "0.0.2", |
| 16 | "@mpaas/framework": "0.0.2", | 17 | "@mpaas/framework": "0.0.2", |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | "main": "", | 7 | "main": "", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | - "@ohos/lottie": "v2.0.11-rc.6", | ||
| 11 | "wdComponent": "file:../../features/wdComponent", | 10 | "wdComponent": "file:../../features/wdComponent", |
| 12 | "wdConstant": "file:../../commons/wdConstant", | 11 | "wdConstant": "file:../../commons/wdConstant", |
| 13 | "wdKit": "file:../../commons/wdKit", | 12 | "wdKit": "file:../../commons/wdKit", |
| @@ -91,11 +91,11 @@ struct LaunchAdvertisingPage { | @@ -91,11 +91,11 @@ struct LaunchAdvertisingPage { | ||
| 91 | Text('广告') | 91 | Text('广告') |
| 92 | .fontColor(Color.White) | 92 | .fontColor(Color.White) |
| 93 | .textAlign(TextAlign.Center) | 93 | .textAlign(TextAlign.Center) |
| 94 | - .fontSize('24lpx') | ||
| 95 | - .width('72lpx') | ||
| 96 | - .height('36lpx') | 94 | + .fontSize(12) |
| 95 | + .width(36) | ||
| 96 | + .height(18) | ||
| 97 | .borderRadius(2) | 97 | .borderRadius(2) |
| 98 | - .margin({top:'15lpx',left:'19lpx'}) | 98 | + .margin({top:'8px',left:'10px'}) |
| 99 | .backgroundColor('#80000000') | 99 | .backgroundColor('#80000000') |
| 100 | .margin({left:16}) | 100 | .margin({left:16}) |
| 101 | } | 101 | } |
| @@ -104,13 +104,13 @@ struct LaunchAdvertisingPage { | @@ -104,13 +104,13 @@ struct LaunchAdvertisingPage { | ||
| 104 | 104 | ||
| 105 | Button(){ | 105 | Button(){ |
| 106 | Text(this.time + 's 跳过') | 106 | Text(this.time + 's 跳过') |
| 107 | - .fontSize('27lpx') | 107 | + .fontSize(14) |
| 108 | .fontColor(Color.White) | 108 | .fontColor(Color.White) |
| 109 | - .margin({left:'28lpx',right:'28lpx'}) | 109 | + .margin({left:14,right:14}) |
| 110 | } | 110 | } |
| 111 | - .width('148lpx') | ||
| 112 | - .height('56lpx') | ||
| 113 | - .margin({top:'10lpx',right:'19lpx'}) | 111 | + .width(74) |
| 112 | + .height(28) | ||
| 113 | + .margin({top:5,right:10}) | ||
| 114 | .backgroundColor('#80000000') | 114 | .backgroundColor('#80000000') |
| 115 | .onClick(() => { | 115 | .onClick(() => { |
| 116 | this.trackingLaunchJumpOver() | 116 | this.trackingLaunchJumpOver() |
| @@ -125,21 +125,21 @@ struct LaunchAdvertisingPage { | @@ -125,21 +125,21 @@ struct LaunchAdvertisingPage { | ||
| 125 | Button(){ | 125 | Button(){ |
| 126 | Row(){ | 126 | Row(){ |
| 127 | Text(this.defaultModel.isAd == '1'?'点击跳转至详情或第三方应用':'点击跳转至详情') | 127 | Text(this.defaultModel.isAd == '1'?'点击跳转至详情或第三方应用':'点击跳转至详情') |
| 128 | - .fontSize('31lpx') | 128 | + .fontSize(16) |
| 129 | .fontColor(Color.White) | 129 | .fontColor(Color.White) |
| 130 | .margin({ | 130 | .margin({ |
| 131 | - left:'55lpx' | 131 | + left:28 |
| 132 | }) | 132 | }) |
| 133 | Image($r('app.media.Slice')) | 133 | Image($r('app.media.Slice')) |
| 134 | - .width('46lpx') | ||
| 135 | - .height('46lpx') | ||
| 136 | - .margin({right:'55lpx'}) | 134 | + .width(28) |
| 135 | + .height(23) | ||
| 136 | + .margin({right:28}) | ||
| 137 | }.alignItems(VerticalAlign.Center) | 137 | }.alignItems(VerticalAlign.Center) |
| 138 | } | 138 | } |
| 139 | - .width('566lpx') | ||
| 140 | - .height('111lpx') | 139 | + .width(284) |
| 140 | + .height(56) | ||
| 141 | .margin({ | 141 | .margin({ |
| 142 | - bottom: '51lpx' | 142 | + bottom: 26 |
| 143 | }) | 143 | }) |
| 144 | .borderWidth(1) | 144 | .borderWidth(1) |
| 145 | .borderColor(Color.White) | 145 | .borderColor(Color.White) |
| @@ -151,8 +151,8 @@ struct LaunchAdvertisingPage { | @@ -151,8 +151,8 @@ struct LaunchAdvertisingPage { | ||
| 151 | if(this.defaultModel.screenType == '1') { | 151 | if(this.defaultModel.screenType == '1') { |
| 152 | Column(){ | 152 | Column(){ |
| 153 | Image($r('app.media.LaunchPage_logo')) | 153 | Image($r('app.media.LaunchPage_logo')) |
| 154 | - .width('278lpx') | ||
| 155 | - .height('154lpx') | 154 | + .width(140) |
| 155 | + .height(77) | ||
| 156 | .margin({top:20}) | 156 | .margin({top:20}) |
| 157 | }.width('100%').height('16%').backgroundColor(Color.White) | 157 | }.width('100%').height('16%').backgroundColor(Color.White) |
| 158 | // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 158 | // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| @@ -40,11 +40,11 @@ struct LaunchInterestsHobbiesPage { | @@ -40,11 +40,11 @@ struct LaunchInterestsHobbiesPage { | ||
| 40 | Row(){ | 40 | Row(){ |
| 41 | Blank() | 41 | Blank() |
| 42 | Text('跳过') | 42 | Text('跳过') |
| 43 | - .fontSize('27lpx') | 43 | + .fontSize(14) |
| 44 | .fontColor('#333333') | 44 | .fontColor('#333333') |
| 45 | - .width('54lpx') | ||
| 46 | - .height('35lpx') | ||
| 47 | - .margin({top:'30lpx',right:'46lpx'}) | 45 | + .width(30) |
| 46 | + .height(18) | ||
| 47 | + .margin({top:15,right:23}) | ||
| 48 | .onClick(()=>{ | 48 | .onClick(()=>{ |
| 49 | //直接跳过到首页 | 49 | //直接跳过到首页 |
| 50 | //跳转首页 | 50 | //跳转首页 |
| @@ -58,20 +58,20 @@ struct LaunchInterestsHobbiesPage { | @@ -58,20 +58,20 @@ struct LaunchInterestsHobbiesPage { | ||
| 58 | .justifyContent(FlexAlign.End) | 58 | .justifyContent(FlexAlign.End) |
| 59 | 59 | ||
| 60 | Text('选择感兴趣的内容') | 60 | Text('选择感兴趣的内容') |
| 61 | - .fontSize('46lpx') | 61 | + .fontSize(23) |
| 62 | .fontWeight(FontWeight.Bold) | 62 | .fontWeight(FontWeight.Bold) |
| 63 | .textAlign(TextAlign.Center) | 63 | .textAlign(TextAlign.Center) |
| 64 | .fontColor('#333333') | 64 | .fontColor('#333333') |
| 65 | .width('100%') | 65 | .width('100%') |
| 66 | - .height('61lpx') | ||
| 67 | - .margin({top:'54lpx'}) | 66 | + .height(30) |
| 67 | + .margin({top:27}) | ||
| 68 | Text('完善信息,将为您推荐个性化的内容') | 68 | Text('完善信息,将为您推荐个性化的内容') |
| 69 | - .fontSize('27lpx') | 69 | + .fontSize(14) |
| 70 | .textAlign(TextAlign.Center) | 70 | .textAlign(TextAlign.Center) |
| 71 | .fontColor('#9E9E9E') | 71 | .fontColor('#9E9E9E') |
| 72 | .width('100%') | 72 | .width('100%') |
| 73 | - .height('35lpx') | ||
| 74 | - .margin({top:'12lpx'}) | 73 | + .height(17) |
| 74 | + .margin({top:6}) | ||
| 75 | 75 | ||
| 76 | if(!this.isConnectNetwork){ | 76 | if(!this.isConnectNetwork){ |
| 77 | EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => { | 77 | EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => { |
| @@ -141,39 +141,36 @@ struct LaunchInterestsHobbiesPage { | @@ -141,39 +141,36 @@ struct LaunchInterestsHobbiesPage { | ||
| 141 | }) | 141 | }) |
| 142 | } | 142 | } |
| 143 | .width('90%') | 143 | .width('90%') |
| 144 | - .margin({top:'61lpx',bottom:'300lpx'}) | 144 | + .margin({top:30,bottom:150}) |
| 145 | .columnsTemplate('1fr 1fr 1fr') | 145 | .columnsTemplate('1fr 1fr 1fr') |
| 146 | .columnsGap('23lpx') | 146 | .columnsGap('23lpx') |
| 147 | .rowsGap('23lpx') | 147 | .rowsGap('23lpx') |
| 148 | .scrollBar(BarState.Off) | 148 | .scrollBar(BarState.Off) |
| 149 | } | 149 | } |
| 150 | - | ||
| 151 | - | ||
| 152 | } | 150 | } |
| 153 | .width('100%') | 151 | .width('100%') |
| 154 | .height('100%') | 152 | .height('100%') |
| 155 | } | 153 | } |
| 156 | .width('100%') | 154 | .width('100%') |
| 157 | - .height(`calc(100% - ${158 + 'lpx'})`) | ||
| 158 | - // .backgroundColor(Color.Red) | 155 | + .height(`calc(100% - ${260 + 'px'})`) |
| 159 | 156 | ||
| 160 | Stack({alignContent:Alignment.Center}){ | 157 | Stack({alignContent:Alignment.Center}){ |
| 161 | Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') | 158 | Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') |
| 162 | - .fontSize('35lpx') | 159 | + .fontSize(18) |
| 163 | .fontColor('#FFFFFF') | 160 | .fontColor('#FFFFFF') |
| 164 | .backgroundColor('#ED2800') | 161 | .backgroundColor('#ED2800') |
| 165 | .type(ButtonType.Normal) | 162 | .type(ButtonType.Normal) |
| 166 | - .borderRadius('10lpx') | ||
| 167 | - .width('662lpx') | ||
| 168 | - .height('84lpx') | ||
| 169 | - .margin({top:'10lpx'}) | 163 | + .borderRadius(5) |
| 164 | + .width(320) | ||
| 165 | + .height(44) | ||
| 166 | + .margin({top:5}) | ||
| 170 | Image('') | 167 | Image('') |
| 171 | - .width('662lpx') | ||
| 172 | - .height('84lpx') | ||
| 173 | - .margin({top:'10lpx'}) | 168 | + .width(320) |
| 169 | + .height(44) | ||
| 170 | + .margin({top:5}) | ||
| 174 | .backgroundColor(Color.White) | 171 | .backgroundColor(Color.White) |
| 175 | .opacity(this.selectCount == 0 ? 0.6 : 0) | 172 | .opacity(this.selectCount == 0 ? 0.6 : 0) |
| 176 | - .borderRadius('10lpx') | 173 | + .borderRadius(5) |
| 177 | .onClick(()=>{ | 174 | .onClick(()=>{ |
| 178 | if (this.selectCount == 0) { | 175 | if (this.selectCount == 0) { |
| 179 | this.dialogToast.open() | 176 | this.dialogToast.open() |
| @@ -188,8 +185,8 @@ struct LaunchInterestsHobbiesPage { | @@ -188,8 +185,8 @@ struct LaunchInterestsHobbiesPage { | ||
| 188 | }) | 185 | }) |
| 189 | } | 186 | } |
| 190 | .width('100%') | 187 | .width('100%') |
| 191 | - .height('108lpx') | ||
| 192 | - .margin({top:0}) | 188 | + .height(54) |
| 189 | + .margin({top:5}) | ||
| 193 | // .backgroundColor(Color.Orange) | 190 | // .backgroundColor(Color.Orange) |
| 194 | } | 191 | } |
| 195 | .width('100%') | 192 | .width('100%') |
| @@ -166,10 +166,10 @@ struct LaunchPage { | @@ -166,10 +166,10 @@ struct LaunchPage { | ||
| 166 | 166 | ||
| 167 | Stack({alignContent:Alignment.Bottom}){ | 167 | Stack({alignContent:Alignment.Bottom}){ |
| 168 | Image($r('app.media.LaunchPage_logo')) | 168 | Image($r('app.media.LaunchPage_logo')) |
| 169 | - .width('278lpx') | ||
| 170 | - .height('154lpx') | 169 | + .width(139) |
| 170 | + .height(87) | ||
| 171 | .margin({ | 171 | .margin({ |
| 172 | - bottom:'48lpx' | 172 | + bottom:24 |
| 173 | }) | 173 | }) |
| 174 | 174 | ||
| 175 | } | 175 | } |
| @@ -525,7 +525,7 @@ export struct MultiPictureDetailPageComponent { | @@ -525,7 +525,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 525 | @Builder | 525 | @Builder |
| 526 | noNet() { | 526 | noNet() { |
| 527 | EmptyComponent({ | 527 | EmptyComponent({ |
| 528 | - emptyType: 1, emptyButton: true, retry: () => { | 528 | + emptyType: 1, emptyButton: true, isBlack: true, retry: () => { |
| 529 | this.getContentDetailData() | 529 | this.getContentDetailData() |
| 530 | } | 530 | } |
| 531 | }) | 531 | }) |
| @@ -534,6 +534,7 @@ export struct MultiPictureDetailPageComponent { | @@ -534,6 +534,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 534 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 534 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 535 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 535 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 536 | }) | 536 | }) |
| 537 | + .backgroundColor(Color.Black) | ||
| 537 | } | 538 | } |
| 538 | 539 | ||
| 539 | @Builder | 540 | @Builder |
-
Please register or login to post a comment