Showing
5 changed files
with
130 additions
and
35 deletions
| @@ -2,8 +2,8 @@ | @@ -2,8 +2,8 @@ | ||
| 2 | "app": { | 2 | "app": { |
| 3 | "bundleName": "com.peopledailychina.hosactivity", | 3 | "bundleName": "com.peopledailychina.hosactivity", |
| 4 | "vendor": "$string:app_vendor", | 4 | "vendor": "$string:app_vendor", |
| 5 | - "versionCode": 7370, | ||
| 6 | - "versionName": "7.3.7.0", | 5 | + "versionCode": 7390, |
| 6 | + "versionName": "7.3.9.0", | ||
| 7 | "icon": "$media:app_icon", | 7 | "icon": "$media:app_icon", |
| 8 | "label": "$string:app_name" | 8 | "label": "$string:app_name" |
| 9 | } | 9 | } |
| @@ -48,9 +48,9 @@ export struct ENewspaperItemComponent { | @@ -48,9 +48,9 @@ export struct ENewspaperItemComponent { | ||
| 48 | this.isShowSkeleton = false | 48 | this.isShowSkeleton = false |
| 49 | }) | 49 | }) |
| 50 | .objectFit(ImageFit.Fill) | 50 | .objectFit(ImageFit.Fill) |
| 51 | - .visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible) | 51 | + .zIndex(10) |
| 52 | newsSkeleton() | 52 | newsSkeleton() |
| 53 | - .visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None) | 53 | + .zIndex(1) |
| 54 | if (this.contentWidth !== 0) { | 54 | if (this.contentWidth !== 0) { |
| 55 | Canvas(this.context) | 55 | Canvas(this.context) |
| 56 | .width(px2vp(this.contentWidth)) | 56 | .width(px2vp(this.contentWidth)) |
| @@ -59,6 +59,7 @@ export struct ENewspaperItemComponent { | @@ -59,6 +59,7 @@ export struct ENewspaperItemComponent { | ||
| 59 | .onReady(() => { | 59 | .onReady(() => { |
| 60 | 60 | ||
| 61 | }) | 61 | }) |
| 62 | + .zIndex(15) | ||
| 62 | } | 63 | } |
| 63 | } | 64 | } |
| 64 | .padding({ | 65 | .padding({ |
| @@ -14,6 +14,7 @@ import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | @@ -14,6 +14,7 @@ import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 14 | import { common } from '@kit.AbilityKit'; | 14 | import { common } from '@kit.AbilityKit'; |
| 15 | import { PageRepository } from '../repository/PageRepository'; | 15 | import { PageRepository } from '../repository/PageRepository'; |
| 16 | import { CommentDialogView } from './CommentDialogView'; | 16 | import { CommentDialogView } from './CommentDialogView'; |
| 17 | +import { faceDetector } from '@kit.CoreVisionKit'; | ||
| 17 | 18 | ||
| 18 | const TAG: string = 'SpacialTopicPageComponent' | 19 | const TAG: string = 'SpacialTopicPageComponent' |
| 19 | 20 | ||
| @@ -40,7 +41,7 @@ export struct SpacialTopicPageComponent { | @@ -40,7 +41,7 @@ export struct SpacialTopicPageComponent { | ||
| 40 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 41 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 41 | @State isNetConnected: boolean = true | 42 | @State isNetConnected: boolean = true |
| 42 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 43 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 43 | - | 44 | + @State showComment: boolean = false |
| 44 | private trySendData2H5() { | 45 | private trySendData2H5() { |
| 45 | if (!this.webPrepared || !this.dataPrepared) { | 46 | if (!this.webPrepared || !this.dataPrepared) { |
| 46 | return | 47 | return |
| @@ -204,14 +205,14 @@ export struct SpacialTopicPageComponent { | @@ -204,14 +205,14 @@ export struct SpacialTopicPageComponent { | ||
| 204 | this.showCommentList = true | 205 | this.showCommentList = true |
| 205 | } | 206 | } |
| 206 | }) | 207 | }) |
| 207 | - // //全部评论 | ||
| 208 | - // CommentDialogView({ | ||
| 209 | - // index: $index, | ||
| 210 | - // currentIndex: $currentIndex, | ||
| 211 | - // showCommentList: $showCommentList, | ||
| 212 | - // publishCommentModel: $publishCommentModel, | ||
| 213 | - // interactData: $interactData, | ||
| 214 | - // }) | 208 | + //全部评论 |
| 209 | + CommentDialogView({ | ||
| 210 | + index: $index, | ||
| 211 | + currentIndex: $currentIndex, | ||
| 212 | + showCommentList: $showCommentList, | ||
| 213 | + publishCommentModel: $publishCommentModel, | ||
| 214 | + interactData: $interactData, | ||
| 215 | + }).visibility(this.showComment?Visibility.Visible:Visibility.Hidden) | ||
| 215 | } | 216 | } |
| 216 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 217 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 217 | } | 218 | } |
| @@ -3,6 +3,7 @@ import { ContentDetailDTO } from 'wdBean/Index' | @@ -3,6 +3,7 @@ import { ContentDetailDTO } from 'wdBean/Index' | ||
| 3 | import { DetailDialog } from './DetailDialog' | 3 | import { DetailDialog } from './DetailDialog' |
| 4 | import { componentUtils } from '@kit.ArkUI' | 4 | import { componentUtils } from '@kit.ArkUI' |
| 5 | 5 | ||
| 6 | +const TAG = 'PlayerTitleView'; | ||
| 6 | @Preview | 7 | @Preview |
| 7 | @Component | 8 | @Component |
| 8 | export struct PlayerTitleView { | 9 | export struct PlayerTitleView { |
| @@ -11,6 +12,9 @@ export struct PlayerTitleView { | @@ -11,6 +12,9 @@ export struct PlayerTitleView { | ||
| 11 | @Consume isOpenDetail: boolean | 12 | @Consume isOpenDetail: boolean |
| 12 | @Consume isDragging: boolean | 13 | @Consume isDragging: boolean |
| 13 | @State titleHeight: number = 0 | 14 | @State titleHeight: number = 0 |
| 15 | + @State rmhPlatform: number = 0 // 1是人民号 | ||
| 16 | + @State isOverLines: boolean = false | ||
| 17 | + @State summary: string = '' | ||
| 14 | dialogController: CustomDialogController = new CustomDialogController({ | 18 | dialogController: CustomDialogController = new CustomDialogController({ |
| 15 | builder: DetailDialog({ | 19 | builder: DetailDialog({ |
| 16 | name: this.getName(), | 20 | name: this.getName(), |
| @@ -26,7 +30,11 @@ export struct PlayerTitleView { | @@ -26,7 +30,11 @@ export struct PlayerTitleView { | ||
| 26 | 30 | ||
| 27 | getName(): string { | 31 | getName(): string { |
| 28 | // authTitle | 32 | // authTitle |
| 29 | - return this.contentDetailData?.rmhInfo?.rmhName || '' | 33 | + if (this.rmhPlatform == 0) { |
| 34 | + return this.contentDetailData?.newsSourceName || '' | ||
| 35 | + } else { | ||
| 36 | + return this.contentDetailData?.rmhInfo?.rmhName || '' | ||
| 37 | + } | ||
| 30 | } | 38 | } |
| 31 | 39 | ||
| 32 | getIcon(): string { | 40 | getIcon(): string { |
| @@ -41,7 +49,45 @@ export struct PlayerTitleView { | @@ -41,7 +49,45 @@ export struct PlayerTitleView { | ||
| 41 | return this.contentDetailData?.newIntroduction || '' | 49 | return this.contentDetailData?.newIntroduction || '' |
| 42 | } | 50 | } |
| 43 | 51 | ||
| 52 | + /** | ||
| 53 | + * 截断文本 | ||
| 54 | + * @author liuzhendong(猩猩G) | ||
| 55 | + * @param {string} str 要截断的文本 '啊啊啊啊啊' | ||
| 56 | + * @param {number} fontSize 字体大小(px) | ||
| 57 | + * @param {number} maxLines 最大行数 3 | ||
| 58 | + * @param {number} textWidth 文本宽度(px) vp 需要转换vp2px() | ||
| 59 | + * @returns {string} clipStr 截断后的文本 '啊啊' | ||
| 60 | + */ | ||
| 61 | + clipText(str: string, fontSize: number, maxLines: number, textWidth: number): string { | ||
| 62 | + let strArr: string[] = str.split("") | ||
| 63 | + let truncateContent: string = '啊啊啊啊啊啊' // ...比正常文字宽度更小,这里使用啊啊啊(任意三个文字)代替计算 | ||
| 64 | + let measureTruncateWidth: number = measure.measureText({ | ||
| 65 | + textContent: truncateContent, | ||
| 66 | + fontSize: fontSize, | ||
| 67 | + fontWeight: 400, | ||
| 68 | + lineHeight: 20, | ||
| 69 | + wordBreak:WordBreak.BREAK_ALL | ||
| 70 | + }) | ||
| 71 | + let clipStr: string = '' | ||
| 72 | + for (let i = 0; i < strArr.length; i++) { | ||
| 73 | + if (measure.measureText({ | ||
| 74 | + textContent: clipStr, | ||
| 75 | + fontSize: fontSize, | ||
| 76 | + fontWeight: 400, | ||
| 77 | + lineHeight: 20, | ||
| 78 | + wordBreak:WordBreak.BREAK_ALL | ||
| 79 | + }) >= textWidth * maxLines - measureTruncateWidth) { | ||
| 80 | + this.isOverLines = true | ||
| 81 | + break; | ||
| 82 | + } | ||
| 83 | + clipStr += strArr[i] | ||
| 84 | + } | ||
| 85 | + console.log(TAG, 'clipStr:', clipStr) | ||
| 86 | + return clipStr | ||
| 87 | + } | ||
| 88 | + | ||
| 44 | aboutToAppear(): void { | 89 | aboutToAppear(): void { |
| 90 | + this.rmhPlatform = this.contentDetailData?.rmhPlatform || 0 | ||
| 45 | const info = measure.measureTextSize({ | 91 | const info = measure.measureTextSize({ |
| 46 | textContent: this.getTitle(), | 92 | textContent: this.getTitle(), |
| 47 | fontSize: 15, | 93 | fontSize: 15, |
| @@ -52,6 +98,8 @@ export struct PlayerTitleView { | @@ -52,6 +98,8 @@ export struct PlayerTitleView { | ||
| 52 | }) | 98 | }) |
| 53 | this.titleHeight = info?.height as number || 0 | 99 | this.titleHeight = info?.height as number || 0 |
| 54 | console.log('titleHeight:', this.titleHeight,) | 100 | console.log('titleHeight:', this.titleHeight,) |
| 101 | + console.log(TAG, 'this.contentDetailData:', JSON.stringify(this.contentDetailData)) | ||
| 102 | + this.summary = this.getSummary() | ||
| 55 | } | 103 | } |
| 56 | 104 | ||
| 57 | build() { | 105 | build() { |
| @@ -64,7 +112,7 @@ export struct PlayerTitleView { | @@ -64,7 +112,7 @@ export struct PlayerTitleView { | ||
| 64 | .maxLines(1) | 112 | .maxLines(1) |
| 65 | .lineHeight(25) | 113 | .lineHeight(25) |
| 66 | .fontWeight(600) | 114 | .fontWeight(600) |
| 67 | - .fontFamily('PingFang SC-Regular') | 115 | + .fontFamily('PingFang SC-Semibold') |
| 68 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 116 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 69 | 117 | ||
| 70 | if (this.getIcon()) { | 118 | if (this.getIcon()) { |
| @@ -87,26 +135,70 @@ export struct PlayerTitleView { | @@ -87,26 +135,70 @@ export struct PlayerTitleView { | ||
| 87 | /** | 135 | /** |
| 88 | * 标题大于三行或存在简介显示查看详情按钮 | 136 | * 标题大于三行或存在简介显示查看详情按钮 |
| 89 | */ | 137 | */ |
| 90 | - if (this.titleHeight > 200 || this.getSummary()) { | ||
| 91 | - Text('查看详情 > ') | ||
| 92 | - .padding({ | ||
| 93 | - left: 6, | ||
| 94 | - right: 6, | ||
| 95 | - top: 4, | ||
| 96 | - bottom: 4 | ||
| 97 | - }) | ||
| 98 | - .borderRadius(2) | ||
| 99 | - .backgroundColor('#99636363') | ||
| 100 | - .fontFamily('PingFang SC-Regular') | ||
| 101 | - .fontColor(Color.White) | ||
| 102 | - .fontSize(12) | ||
| 103 | - .lineHeight(14) | ||
| 104 | - .fontWeight(400) | ||
| 105 | - .margin({ bottom: 8 }) | ||
| 106 | - .onClick(() => { | ||
| 107 | - this.isOpenDetail = true | ||
| 108 | - this.dialogController?.open() | ||
| 109 | - }) | 138 | + if (this.rmhPlatform == 1) { |
| 139 | + if (this.titleHeight > 200 || this.summary) { | ||
| 140 | + Text('查看详情 > ') | ||
| 141 | + .padding({ | ||
| 142 | + left: 6, | ||
| 143 | + right: 6, | ||
| 144 | + top: 4, | ||
| 145 | + bottom: 4 | ||
| 146 | + }) | ||
| 147 | + .borderRadius(2) | ||
| 148 | + .backgroundColor('#99636363') | ||
| 149 | + .fontFamily('PingFang SC-Regular') | ||
| 150 | + .fontColor(Color.White) | ||
| 151 | + .fontSize(12) | ||
| 152 | + .lineHeight(14) | ||
| 153 | + .fontWeight(400) | ||
| 154 | + .margin({ bottom: 8 }) | ||
| 155 | + .onClick(() => { | ||
| 156 | + this.isOpenDetail = true | ||
| 157 | + this.dialogController?.open() | ||
| 158 | + }) | ||
| 159 | + } | ||
| 160 | + } else { | ||
| 161 | + if(this.summary) { | ||
| 162 | + Text() { | ||
| 163 | + Span(this.clipText(this.summary, 14, 2, this.windowWidth - 150 - vp2px(50))) | ||
| 164 | + .fontSize(14) | ||
| 165 | + .fontColor(Color.White) | ||
| 166 | + .lineHeight(21) | ||
| 167 | + .fontWeight(400) | ||
| 168 | + .fontFamily('PingFang SC-Regular') | ||
| 169 | + if (this.isOverLines) { | ||
| 170 | + Span('... 全文') | ||
| 171 | + .fontColor('#888888') | ||
| 172 | + .fontWeight(400) | ||
| 173 | + .fontFamily('PingFang SC-Regular') | ||
| 174 | + .fontSize(12) | ||
| 175 | + .onClick(() => { | ||
| 176 | + this.isOpenDetail = true | ||
| 177 | + this.dialogController?.open() | ||
| 178 | + }) | ||
| 179 | + ImageSpan($r('app.media.comment_unfold_svg')) | ||
| 180 | + .width(14) | ||
| 181 | + .height(14) | ||
| 182 | + .objectFit(ImageFit.Fill) | ||
| 183 | + .verticalAlign(ImageSpanAlignment.CENTER) | ||
| 184 | + .padding({ | ||
| 185 | + bottom: 4 | ||
| 186 | + }) | ||
| 187 | + .onClick(() => { | ||
| 188 | + this.isOpenDetail = true | ||
| 189 | + this.dialogController?.open() | ||
| 190 | + }) | ||
| 191 | + | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + .padding({ | ||
| 195 | + left: 6, | ||
| 196 | + right: 6, | ||
| 197 | + top: 4, | ||
| 198 | + bottom: 4 | ||
| 199 | + }) | ||
| 200 | + .margin({ bottom: 8 }) | ||
| 201 | + } | ||
| 110 | } | 202 | } |
| 111 | 203 | ||
| 112 | } | 204 | } |
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/comment_unfold_svg.svg
0 → 100644
| 1 | +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><g transform="matrix(0,-1,1,0,-16,16)"><g><path d="M10.303455641479491,17.960819560243227L4.363755241479492,23.900515460243227Q4.324434578479492,23.939835460243224,4.324704443879492,23.995445460243225Q4.324434578479492,24.051055460243226,4.363755241479492,24.090375460243223L10.303455641479491,30.030075460243225Q10.342505641479491,30.069075460243226,10.397735641479493,30.069075460243226Q10.452965641479492,30.069075460243226,10.492015641479492,30.030075460243225L11.387685641479493,29.134375460243227Q11.406435641479492,29.115675460243224,11.416585641479493,29.091175460243225Q11.426735641479493,29.066675460243225,11.426735641479493,29.040075460243223Q11.426735641479493,29.013575460243224,11.416585641479493,28.989075460243225Q11.406435641479492,28.964575460243225,11.387685641479493,28.945875460243226L6.437285641479493,23.995445460243225L11.387685641479493,19.045045460243227Q11.406435641479492,19.026295460243226,11.416585641479493,19.001795460243226Q11.426735641479493,18.977295460243226,11.426735641479493,18.950765460243225Q11.426735641479493,18.924245460243224,11.416585641479493,18.899744460243227Q11.406435641479492,18.875241460243224,11.387685641479493,18.856488460243224L10.492015641479492,17.960819560243227Q10.452965641479492,17.921767119783226,10.397735641479493,17.921767119783226Q10.342505641479491,17.921767119783226,10.303455641479491,17.960819560243227Z" fill-rule="evenodd" fill="#888888" fill-opacity="1"/></g></g></svg> |
-
Please register or login to post a comment