Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/mine/home/HomePageBottomFollowComponent.ets # sight_harmony/features/wdComponent/src/main/ets/components/setting/AccountAndSecurityLayout.ets
Showing
90 changed files
with
2141 additions
and
407 deletions
| @@ -888,4 +888,11 @@ export class HttpUrlUtils { | @@ -888,4 +888,11 @@ export class HttpUrlUtils { | ||
| 888 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.VISITOR_COMMENT_LIST_DATA_PATH | 888 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.VISITOR_COMMENT_LIST_DATA_PATH |
| 889 | return url | 889 | return url |
| 890 | } | 890 | } |
| 891 | + | ||
| 892 | + ///获取语音识别授权token | ||
| 893 | + static getVoiceRecognizerSDKAuthToken() { | ||
| 894 | + let url = HttpUrlUtils.getHost() + "/api/rmrb-search-api/zh/c/display/search/token" | ||
| 895 | + return url | ||
| 896 | + } | ||
| 897 | + | ||
| 891 | } | 898 | } |
| @@ -25,6 +25,7 @@ export struct WdWebComponent { | @@ -25,6 +25,7 @@ export struct WdWebComponent { | ||
| 25 | @State subjectData : string = '' | 25 | @State subjectData : string = '' |
| 26 | 26 | ||
| 27 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | 27 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; |
| 28 | + @State userAgent:string = 'Mozilla/5.0 (Phone; OpenHarmony 5.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 ArkWeb/4.1.6.1 Mobile automobile/792 Android' | ||
| 28 | 29 | ||
| 29 | currentChanged(){ | 30 | currentChanged(){ |
| 30 | ///折叠屏转换 | 31 | ///折叠屏转换 |
| @@ -54,6 +55,9 @@ export struct WdWebComponent { | @@ -54,6 +55,9 @@ export struct WdWebComponent { | ||
| 54 | let url: string = event.data.getRequestUrl().toString() | 55 | let url: string = event.data.getRequestUrl().toString() |
| 55 | return this.onLoadIntercept(url); | 56 | return this.onLoadIntercept(url); |
| 56 | }) | 57 | }) |
| 58 | + .onControllerAttached(() => { | ||
| 59 | + this.webviewControl.setCustomUserAgent(this.userAgent); | ||
| 60 | + }) | ||
| 57 | } | 61 | } |
| 58 | } | 62 | } |
| 59 | 63 |
| @@ -181,4 +181,6 @@ export { TopicDetailData,GroupItem } from './src/main/ets/bean/content/TopicDeta | @@ -181,4 +181,6 @@ export { TopicDetailData,GroupItem } from './src/main/ets/bean/content/TopicDeta | ||
| 181 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; | 181 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; |
| 182 | export { FeedBackParams } from './src/main/ets/bean/content/FeedBackParams'; | 182 | export { FeedBackParams } from './src/main/ets/bean/content/FeedBackParams'; |
| 183 | 183 | ||
| 184 | +export { NetLayerVoiceRecoginizerToken } from './src/main/ets/bean/voicerecoginizer/NetLayerVoiceRecoginizerToken'; | ||
| 185 | + | ||
| 184 | 186 |
| @@ -106,3 +106,7 @@ export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPu | @@ -106,3 +106,7 @@ export { CustomPullToRefresh } from './src/main/ets/components/reusable/CustomPu | ||
| 106 | export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel' | 106 | export { MorningEveningViewModel } from './src/main/ets/viewmodel/MorningEveningViewModel' |
| 107 | 107 | ||
| 108 | export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel' | 108 | export { GrayManageModel } from './src/main/ets/viewmodel/GrayManageModel' |
| 109 | + | ||
| 110 | +export { VoiceInputView } from './src/main/ets/components/comment/view/VoiceInputView' | ||
| 111 | + | ||
| 112 | +// export {voicese} |
| @@ -83,8 +83,69 @@ export struct CompParser { | @@ -83,8 +83,69 @@ export struct CompParser { | ||
| 83 | }) | 83 | }) |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | + // @Builder | ||
| 87 | + // beforeDevider() { | ||
| 88 | + // if ( | ||
| 89 | + // this.compDTO.compStyle === CompStyle.Card_09 || | ||
| 90 | + // this.compDTO.compStyle === CompStyle.Zh_Single_Column_09 || | ||
| 91 | + // this.compDTO.compStyle === CompStyle.Zh_Single_Row_04 || | ||
| 92 | + // this.compDTO.compStyle === CompStyle.Zh_Single_Row_06 | ||
| 93 | + // ) { | ||
| 94 | + // if (this.compDTO.compStyle === this.nextCompDTO.compStyle) { | ||
| 95 | + // Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 }) | ||
| 96 | + // } else { | ||
| 97 | + // Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 98 | + // } | ||
| 99 | + // } | ||
| 100 | + // } | ||
| 101 | + | ||
| 102 | + @Builder | ||
| 103 | + behindDevider() { | ||
| 104 | + if ( | ||
| 105 | + this.compDTO.compStyle === CompStyle.Card_09 || | ||
| 106 | + this.compDTO.compStyle === CompStyle.Zh_Single_Column_09 || | ||
| 107 | + this.compDTO.compStyle === CompStyle.Zh_Single_Row_04 || | ||
| 108 | + this.compDTO.compStyle === CompStyle.Zh_Single_Row_06 | ||
| 109 | + ) { | ||
| 110 | + if (this.compDTO.compStyle === this.nextCompDTO.compStyle) { | ||
| 111 | + Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 }) | ||
| 112 | + } else { | ||
| 113 | + Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 114 | + } | ||
| 115 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | ||
| 116 | + if (this.compIndex === 0) { | ||
| 117 | + Divider().strokeWidth(1).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 118 | + } else { | ||
| 119 | + Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 120 | + } | ||
| 121 | + } else if (this.compDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { | ||
| 122 | + // 大专题 | ||
| 123 | + if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { | ||
| 124 | + Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 }) | ||
| 125 | + } else { | ||
| 126 | + Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 127 | + } | ||
| 128 | + } else if (this.compDTO.compType === 'appStyle' || this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 || this.compDTO.compStyle === CompStyle.Zh_Single_Row_03 || this.compDTO.compStyle === CompStyle.Card_Comp_Adv || this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | ||
| 129 | + if ( | ||
| 130 | + this.nextCompDTO.compStyle === CompStyle.Card_09 || | ||
| 131 | + this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10 || | ||
| 132 | + this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_09 || | ||
| 133 | + this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_04 || | ||
| 134 | + this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_06 || | ||
| 135 | + this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_12 | ||
| 136 | + ) { | ||
| 137 | + Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 138 | + } else { | ||
| 139 | + Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 }) | ||
| 140 | + } | ||
| 141 | + } else { | ||
| 142 | + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + | ||
| 86 | @Builder | 146 | @Builder |
| 87 | componentBuilder() { | 147 | componentBuilder() { |
| 148 | + // this.beforeDevider(); | ||
| 88 | 149 | ||
| 89 | if (this.compDTO.operDataList[0]?.objectType !== '3' && | 150 | if (this.compDTO.operDataList[0]?.objectType !== '3' && |
| 90 | this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 | 151 | this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 |
| @@ -208,42 +269,7 @@ export struct CompParser { | @@ -208,42 +269,7 @@ export struct CompParser { | ||
| 208 | // }) | 269 | // }) |
| 209 | } | 270 | } |
| 210 | 271 | ||
| 211 | - if ( | ||
| 212 | - this.compDTO.compStyle === CompStyle.Card_09 || | ||
| 213 | - this.compDTO.compStyle === CompStyle.Zh_Single_Column_09 || | ||
| 214 | - this.compDTO.compStyle === CompStyle.Zh_Single_Row_04 || | ||
| 215 | - this.compDTO.compStyle === CompStyle.Zh_Single_Row_06 | ||
| 216 | - ) { | ||
| 217 | - if (this.compDTO.compStyle === this.nextCompDTO.compStyle) { | ||
| 218 | - Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 }) | ||
| 219 | - } else { | ||
| 220 | - Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 221 | - } | ||
| 222 | - } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | ||
| 223 | - Divider().strokeWidth(1).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 224 | - } else if (this.compDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { | ||
| 225 | - // 大专题 | ||
| 226 | - if (this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10) { | ||
| 227 | - Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 }) | ||
| 228 | - } else { | ||
| 229 | - Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 230 | - } | ||
| 231 | - } else if (this.compDTO.compType === 'appStyle' || this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 || this.compDTO.compStyle === CompStyle.Zh_Single_Row_03 || this.compDTO.compStyle === CompStyle.Card_Comp_Adv || this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | ||
| 232 | - if ( | ||
| 233 | - this.nextCompDTO.compStyle === CompStyle.Card_09 || | ||
| 234 | - this.nextCompDTO?.operDataList?.[0]?.appStyle === CompStyle.Card_10 || | ||
| 235 | - this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_09 || | ||
| 236 | - this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_04 || | ||
| 237 | - this.nextCompDTO.compStyle === CompStyle.Zh_Single_Row_06 || | ||
| 238 | - this.nextCompDTO.compStyle === CompStyle.Zh_Single_Column_12 | ||
| 239 | - ) { | ||
| 240 | - Divider().strokeWidth(5).color('#f5f5f5').width('120%').margin({left: -6}) | ||
| 241 | - } else { | ||
| 242 | - Divider().strokeWidth(1).color('#f5f5f5').width(CommonConstants.FULL_WIDTH).padding({ left: 10, right: 10 }) | ||
| 243 | - } | ||
| 244 | - } else { | ||
| 245 | - // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 246 | - } | 272 | + this.behindDevider() |
| 247 | } | 273 | } |
| 248 | 274 | ||
| 249 | 275 |
| @@ -45,7 +45,8 @@ export struct ENewspaperItemComponent { | @@ -45,7 +45,8 @@ export struct ENewspaperItemComponent { | ||
| 45 | this.contentWidth = event?.contentWidth | 45 | this.contentWidth = event?.contentWidth |
| 46 | this.contentHeight = event?.contentHeight | 46 | this.contentHeight = event?.contentHeight |
| 47 | } | 47 | } |
| 48 | - this.isShowSkeleton = false | 48 | + |
| 49 | + // this.isShowSkeleton = false | ||
| 49 | }) | 50 | }) |
| 50 | .objectFit(ImageFit.Contain) | 51 | .objectFit(ImageFit.Contain) |
| 51 | .zIndex(10) | 52 | .zIndex(10) |
| @@ -9,7 +9,7 @@ import font from '@ohos.font'; | @@ -9,7 +9,7 @@ import font from '@ohos.font'; | ||
| 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; | 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; |
| 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; | 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; |
| 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; | 11 | import { newsSkeleton } from './skeleton/newsSkeleton'; |
| 12 | -import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index'; | 12 | +import { Logger, ToastUtils, NetworkUtil, CustomToast, DisplayUtils } from 'wdKit/Index'; |
| 13 | import { TrackingContent, TrackConstants, TrackingButton } from 'wdTracking/Index'; | 13 | import { TrackingContent, TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 14 | import { WDShare } from 'wdShare/Index'; | 14 | import { WDShare } from 'wdShare/Index'; |
| 15 | import { window } from '@kit.ArkUI'; | 15 | import { window } from '@kit.ArkUI'; |
| @@ -25,6 +25,9 @@ export struct ENewspaperPageComponent { | @@ -25,6 +25,9 @@ export struct ENewspaperPageComponent { | ||
| 25 | @State picHeight: number = 0 | 25 | @State picHeight: number = 0 |
| 26 | @Provide itemPicWidth: number = 0 | 26 | @Provide itemPicWidth: number = 0 |
| 27 | @Provide itemPicHeight: number = 0 | 27 | @Provide itemPicHeight: number = 0 |
| 28 | + | ||
| 29 | + @Provide topMargin: number = DisplayUtils.getDeviceHeight() | ||
| 30 | + | ||
| 28 | @State newspaperListBean: NewspaperListBean = {} as NewspaperListBean | 31 | @State newspaperListBean: NewspaperListBean = {} as NewspaperListBean |
| 29 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 32 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 30 | @State pageDialogShow: boolean = false | 33 | @State pageDialogShow: boolean = false |
| @@ -404,6 +407,14 @@ export struct ENewspaperPageComponent { | @@ -404,6 +407,14 @@ export struct ENewspaperPageComponent { | ||
| 404 | } | 407 | } |
| 405 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 408 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 406 | this.isOpenListDialog = true | 409 | this.isOpenListDialog = true |
| 410 | + animateTo({ | ||
| 411 | + duration: 300, | ||
| 412 | + onFinish: () => { | ||
| 413 | + } | ||
| 414 | + }, () => { | ||
| 415 | + this.topMargin = 0; | ||
| 416 | + }) | ||
| 417 | + | ||
| 407 | //电子报--读报纸点击 | 418 | //电子报--读报纸点击 |
| 408 | TrackingContent.clickWithEvent('read_newspaper_click', TrackConstants.PageName.NewsPaperPage, | 419 | TrackingContent.clickWithEvent('read_newspaper_click', TrackConstants.PageName.NewsPaperPage, |
| 409 | TrackConstants.PageName.NewsPaperPage | 420 | TrackConstants.PageName.NewsPaperPage |
| @@ -429,8 +440,16 @@ export struct ENewspaperPageComponent { | @@ -429,8 +440,16 @@ export struct ENewspaperPageComponent { | ||
| 429 | newspaperListBean: this.newspaperListBean, | 440 | newspaperListBean: this.newspaperListBean, |
| 430 | scrollIndex: this.swiperIndex, | 441 | scrollIndex: this.swiperIndex, |
| 431 | closeDialog: () => { | 442 | closeDialog: () => { |
| 443 | + animateTo({ | ||
| 444 | + duration: 300, | ||
| 445 | + onFinish: () => { | ||
| 432 | this.isOpenListDialog = false | 446 | this.isOpenListDialog = false |
| 433 | } | 447 | } |
| 448 | + }, () => { | ||
| 449 | + this.topMargin = DisplayUtils.getDeviceHeight(); | ||
| 450 | + }) | ||
| 451 | + | ||
| 452 | + } | ||
| 434 | }) | 453 | }) |
| 435 | } | 454 | } |
| 436 | } | 455 | } |
| @@ -451,6 +470,7 @@ export struct ENewspaperPageComponent { | @@ -451,6 +470,7 @@ export struct ENewspaperPageComponent { | ||
| 451 | // 计算图片的内容宽高 | 470 | // 计算图片的内容宽高 |
| 452 | this.itemPicWidth = this.picWidth - vp2px(20) | 471 | this.itemPicWidth = this.picWidth - vp2px(20) |
| 453 | this.itemPicHeight = this.picHeight - vp2px(28) | 472 | this.itemPicHeight = this.picHeight - vp2px(28) |
| 473 | + | ||
| 454 | try { | 474 | try { |
| 455 | if (NetworkUtil.isNetConnected()) { | 475 | if (NetworkUtil.isNetConnected()) { |
| 456 | let listBean = | 476 | let listBean = |
| @@ -248,34 +248,36 @@ export struct ImageAndTextPageComponent { | @@ -248,34 +248,36 @@ export struct ImageAndTextPageComponent { | ||
| 248 | console.log(TAG, "点击滑动页面", JSON.stringify(info)) | 248 | console.log(TAG, "点击滑动页面", JSON.stringify(info)) |
| 249 | 249 | ||
| 250 | //评论区当前位置 | 250 | //评论区当前位置 |
| 251 | - let currentCommonentOffSetY = this.info?.globalPosition.y as number | ||
| 252 | - let offSetY = 0 | ||
| 253 | - if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 254 | - offSetY = currentCommonentOffSetY-200 | ||
| 255 | - this.showMainText = true | ||
| 256 | - }else { | ||
| 257 | - this.showMainText = false | 251 | + // let currentCommonentOffSetY = this.info?.globalPosition.y as number |
| 252 | + // let offSetY = 0 | ||
| 253 | + // if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 254 | + // offSetY = currentCommonentOffSetY-200 | ||
| 255 | + // this.showMainText = true | ||
| 256 | + // }else { | ||
| 257 | + // this.showMainText = false | ||
| 258 | + // } | ||
| 259 | + // this.scroller.scrollTo({ | ||
| 260 | + // yOffset: offSetY, | ||
| 261 | + // xOffset: 0, | ||
| 262 | + // animation: { duration: 1000, curve: Curve.Ease } | ||
| 263 | + // }) | ||
| 264 | + | ||
| 265 | + if (!this.offsetY) { | ||
| 266 | + this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y | ||
| 258 | } | 267 | } |
| 268 | + // 定位到评论区域 | ||
| 269 | + if (this.isScrollTop) { | ||
| 259 | this.scroller.scrollTo({ | 270 | this.scroller.scrollTo({ |
| 260 | - yOffset: offSetY, | ||
| 261 | xOffset: 0, | 271 | xOffset: 0, |
| 272 | + yOffset: this.offsetY, | ||
| 262 | animation: { duration: 1000, curve: Curve.Ease } | 273 | animation: { duration: 1000, curve: Curve.Ease } |
| 263 | }) | 274 | }) |
| 264 | - | ||
| 265 | - // if (!this.offsetY) { | ||
| 266 | - // this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y | ||
| 267 | - // } | ||
| 268 | - // // 定位到评论区域 | ||
| 269 | - // if (this.isScrollTop) { | ||
| 270 | - // this.scroller.scrollTo({ | ||
| 271 | - // xOffset: 0, | ||
| 272 | - // yOffset: this.offsetY, | ||
| 273 | - // animation: true | ||
| 274 | - // }) | ||
| 275 | - // } else { | ||
| 276 | - // this.scroller.scrollEdge(Edge.Top) | ||
| 277 | - // } | ||
| 278 | - // this.isScrollTop = !this.isScrollTop | 275 | + // this.showMainText = true |
| 276 | + } else { | ||
| 277 | + this.scroller.scrollEdge(Edge.Top) | ||
| 278 | + // this.showMainText = false | ||
| 279 | + } | ||
| 280 | + this.isScrollTop = !this.isScrollTop | ||
| 279 | } | 281 | } |
| 280 | }) | 282 | }) |
| 281 | } | 283 | } |
| @@ -357,7 +359,6 @@ export struct ImageAndTextPageComponent { | @@ -357,7 +359,6 @@ export struct ImageAndTextPageComponent { | ||
| 357 | if (this.detailContentEmpty) { | 359 | if (this.detailContentEmpty) { |
| 358 | this.emptyType = 18 | 360 | this.emptyType = 18 |
| 359 | } | 361 | } |
| 360 | - console.log(TAG, "dl1111111111", JSON.stringify(detailBeans[0])) | ||
| 361 | if (detailBeans && detailBeans.length > 0) { | 362 | if (detailBeans && detailBeans.length > 0) { |
| 362 | this.contentDetailData = detailBeans[0]; | 363 | this.contentDetailData = detailBeans[0]; |
| 363 | let dateTime = | 364 | let dateTime = |
| @@ -560,21 +561,22 @@ export struct ImageAndTextPageComponent { | @@ -560,21 +561,22 @@ export struct ImageAndTextPageComponent { | ||
| 560 | // 需要评论区位置,调用前 请确保它有值 | 561 | // 需要评论区位置,调用前 请确保它有值 |
| 561 | return | 562 | return |
| 562 | } | 563 | } |
| 564 | + let offSetY = this.info?.globalPosition.y as number -60 | ||
| 565 | + Logger.debug(TAG, "即将滚动至yOffset: " + offSetY) | ||
| 566 | + if (offSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 567 | + this.showMainText = false | ||
| 568 | + }else { | ||
| 569 | + this.showMainText = true | ||
| 570 | + } | ||
| 571 | + | ||
| 563 | if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") { | 572 | if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") { |
| 564 | if (this.lastTimeoutId) { | 573 | if (this.lastTimeoutId) { |
| 565 | clearTimeout(this.lastTimeoutId) | 574 | clearTimeout(this.lastTimeoutId) |
| 566 | } | 575 | } |
| 567 | this.lastTimeoutId = setTimeout(() => { | 576 | this.lastTimeoutId = setTimeout(() => { |
| 568 | - let offSetY = this.info?.globalPosition.y as number | ||
| 569 | - Logger.debug(TAG, "即将滚动至yOffset: " + (offSetY - 100)) | ||
| 570 | - if (offSetY >= (this.screenHeight-this.bottomHeight) ) { | ||
| 571 | - this.showMainText = true | ||
| 572 | - }else { | ||
| 573 | - this.showMainText = false | ||
| 574 | - } | ||
| 575 | //头部距离48 | 577 | //头部距离48 |
| 576 | this.scroller.scrollTo({ | 578 | this.scroller.scrollTo({ |
| 577 | - yOffset: offSetY - 100, | 579 | + yOffset: offSetY, |
| 578 | xOffset: 0, | 580 | xOffset: 0, |
| 579 | animation: { duration: 1000, curve: Curve.Ease } | 581 | animation: { duration: 1000, curve: Curve.Ease } |
| 580 | }) | 582 | }) |
| @@ -102,6 +102,7 @@ export struct ImageAndTextWebComponent { | @@ -102,6 +102,7 @@ export struct ImageAndTextWebComponent { | ||
| 102 | onWebPrepared: this.onWebPrepared.bind(this), | 102 | onWebPrepared: this.onWebPrepared.bind(this), |
| 103 | isPageEnd: $isPageEnd | 103 | isPageEnd: $isPageEnd |
| 104 | }) | 104 | }) |
| 105 | + .padding({top:10}) | ||
| 105 | } | 106 | } |
| 106 | } | 107 | } |
| 107 | 108 |
| @@ -5,11 +5,11 @@ import { promptAction } from '@kit.ArkUI'; | @@ -5,11 +5,11 @@ 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 { DateTimeUtils, NetworkUtil, PermissionUtil } from 'wdKit'; | 8 | +import { DateTimeUtils, NetworkUtil, PermissionUtil, PermissionUtils } from 'wdKit'; |
| 9 | import { PrivacySettingModel } from '../model/PrivacySettingModel'; | 9 | import { PrivacySettingModel } from '../model/PrivacySettingModel'; |
| 10 | import { TrackConstants, TrackingButton } from 'wdTracking'; | 10 | import { TrackConstants, TrackingButton } from 'wdTracking'; |
| 11 | import { faceDetector } from '@kit.CoreVisionKit'; | 11 | import { faceDetector } from '@kit.CoreVisionKit'; |
| 12 | -import mediaLibrary from '@ohos.multimedia.mediaLibrary'; | 12 | +// import mediaLibrary from '@ohos.multimedia.mediaLibrary'; |
| 13 | import fileIo from '@ohos.file.fs'; | 13 | import fileIo from '@ohos.file.fs'; |
| 14 | import { httpRequest } from '../utils/httpRequest'; | 14 | import { httpRequest } from '../utils/httpRequest'; |
| 15 | import { taskpool } from '@kit.ArkTS'; | 15 | import { taskpool } from '@kit.ArkTS'; |
| @@ -61,6 +61,15 @@ export struct ImageDownloadComponent { | @@ -61,6 +61,15 @@ export struct ImageDownloadComponent { | ||
| 61 | .iconColor(Color.White) | 61 | .iconColor(Color.White) |
| 62 | .onClick(async () => { | 62 | .onClick(async () => { |
| 63 | //console.info(`cj2024 onClick ${this.imageBuffer}`) | 63 | //console.info(`cj2024 onClick ${this.imageBuffer}`) |
| 64 | + // let readGrant = await PermissionUtils.checkPermissions(PERMISSIONS[0]) | ||
| 65 | + // let writeGrant = await PermissionUtils.checkPermissions(PERMISSIONS[1]) | ||
| 66 | + // console.info(`cj2024 onClick readGrant ${readGrant} writeGrant ${writeGrant}`) | ||
| 67 | + // if (!readGrant && !writeGrant) { | ||
| 68 | + // const context = getContext(this) as common.UIAbilityContext; | ||
| 69 | + // let requestGrant = await PermissionUtils.reqPermissionsFromUser(PERMISSIONS, context); | ||
| 70 | + // } else { | ||
| 71 | + // | ||
| 72 | + // } | ||
| 64 | if (this.imageBuffer !== undefined) { | 73 | if (this.imageBuffer !== undefined) { |
| 65 | try { | 74 | try { |
| 66 | await this.saveImage(this.imageBuffer); | 75 | await this.saveImage(this.imageBuffer); |
| @@ -134,7 +143,7 @@ export struct ImageDownloadComponent { | @@ -134,7 +143,7 @@ export struct ImageDownloadComponent { | ||
| 134 | * @returns | 143 | * @returns |
| 135 | */ | 144 | */ |
| 136 | async saveImage(buffer: ArrayBuffer | string): Promise<void> { | 145 | async saveImage(buffer: ArrayBuffer | string): Promise<void> { |
| 137 | - //console.info(`cj2024 saveImage buffer ${buffer} isGranted = ${this.isGranted}`) | 146 | + console.info(`cj2024 saveImage buffer ${buffer} isGranted = ${this.isGranted}`) |
| 138 | if (!this.isGranted) { | 147 | if (!this.isGranted) { |
| 139 | //跳转权限设置 | 148 | //跳转权限设置 |
| 140 | // const permissionUtil = new PermissionUtil(); | 149 | // const permissionUtil = new PermissionUtil(); |
| @@ -154,23 +163,23 @@ export struct ImageDownloadComponent { | @@ -154,23 +163,23 @@ export struct ImageDownloadComponent { | ||
| 154 | // const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); | 163 | // const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); |
| 155 | // await fs.write(file.fd, buffer); | 164 | // await fs.write(file.fd, buffer); |
| 156 | // await fs.close(file.fd); | 165 | // await fs.close(file.fd); |
| 157 | - let media = mediaLibrary.getMediaLibrary(context); | ||
| 158 | - let publicPath = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE); | ||
| 159 | - let picName = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_DEFAULT) + '.jpg' | ||
| 160 | - // //console.info(`cj2024 saveImage time ${picName}`) | ||
| 161 | - let asset = await media.createAsset(mediaLibrary.MediaType.IMAGE, picName, publicPath); | ||
| 162 | - | ||
| 163 | - if (asset) { | ||
| 164 | - let fd = await asset.open('rw'); | ||
| 165 | - await fileIo.write(fd, buffer); | ||
| 166 | - await asset.close(fd); | ||
| 167 | - promptAction.showToast({ message: '已保存至相册!' }); | ||
| 168 | - } else { | ||
| 169 | - if (this.isGranted) { | ||
| 170 | - promptAction.showToast({ message: '保存图片失败!' }); | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - throw new Error('Failed to create asset'); | ||
| 174 | - } | 166 | + // let media = mediaLibrary.getMediaLibrary(context); |
| 167 | + // let publicPath = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE); | ||
| 168 | + // let picName = DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_DEFAULT) + '.jpg' | ||
| 169 | + // // //console.info(`cj2024 saveImage time ${picName}`) | ||
| 170 | + // let asset = await media.createAsset(mediaLibrary.MediaType.IMAGE, picName, publicPath); | ||
| 171 | + // | ||
| 172 | + // if (asset) { | ||
| 173 | + // let fd = await asset.open('rw'); | ||
| 174 | + // await fileIo.write(fd, buffer); | ||
| 175 | + // await asset.close(fd); | ||
| 176 | + // promptAction.showToast({ message: '已保存至相册!' }); | ||
| 177 | + // } else { | ||
| 178 | + // if (this.isGranted) { | ||
| 179 | + // promptAction.showToast({ message: '保存图片失败!' }); | ||
| 180 | + // } | ||
| 181 | + // | ||
| 182 | + // throw new Error('Failed to create asset'); | ||
| 183 | + // } | ||
| 175 | } | 184 | } |
| 176 | } | 185 | } |
| 1 | +import { ImageKnifeComponent } from '@ohos/imageknife'; | ||
| 1 | import { ContentDTO, FrontLinkObject } from 'wdBean'; | 2 | import { ContentDTO, FrontLinkObject } from 'wdBean'; |
| 2 | import { Logger } from 'wdKit/Index'; | 3 | import { Logger } from 'wdKit/Index'; |
| 3 | import { ProcessUtils } from 'wdRouter/Index'; | 4 | import { ProcessUtils } from 'wdRouter/Index'; |
| @@ -28,9 +29,12 @@ export struct topicInfoView { | @@ -28,9 +29,12 @@ export struct topicInfoView { | ||
| 28 | build() { | 29 | build() { |
| 29 | RelativeContainer() { | 30 | RelativeContainer() { |
| 30 | Stack(){ | 31 | Stack(){ |
| 31 | - Image(this.frontLinkObject?.coverUrl) | ||
| 32 | - .width("100%") | ||
| 33 | - .height("100%") | 32 | + ImageKnifeComponent({imageKnifeOption:{loadSrc:this.frontLinkObject?.coverUrl,isCacheable:true}}) |
| 33 | + .width('100%') | ||
| 34 | + .height('100%') | ||
| 35 | + // Image(this.frontLinkObject?.coverUrl) | ||
| 36 | + // .width("100%") | ||
| 37 | + // .height("100%") | ||
| 34 | Stack(){ | 38 | Stack(){ |
| 35 | Image('') | 39 | Image('') |
| 36 | .width("100%") | 40 | .width("100%") |
| @@ -52,8 +52,8 @@ export struct CardAdvBigImageComponent { | @@ -52,8 +52,8 @@ export struct CardAdvBigImageComponent { | ||
| 52 | } | 52 | } |
| 53 | .width(CommonConstants.FULL_WIDTH) | 53 | .width(CommonConstants.FULL_WIDTH) |
| 54 | .padding({ | 54 | .padding({ |
| 55 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 56 | - right: $r('app.float.card_comp_pagePadding_lf'), | 55 | + left: 10, |
| 56 | + right: 10, | ||
| 57 | top: $r('app.float.card_comp_pagePadding_tb'), | 57 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 58 | bottom: $r('app.float.card_comp_pagePadding_tb') | 58 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 59 | }) | 59 | }) |
sight_harmony/features/wdComponent/src/main/ets/components/cardViewAdv/CardAdvLongImageComponent.ets
| @@ -54,8 +54,8 @@ export struct CardAdvLongImageComponent { | @@ -54,8 +54,8 @@ export struct CardAdvLongImageComponent { | ||
| 54 | } | 54 | } |
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | .padding({ | 56 | .padding({ |
| 57 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 58 | - right: $r('app.float.card_comp_pagePadding_lf'), | 57 | + left: 10, |
| 58 | + right: 10, | ||
| 59 | top: $r('app.float.card_comp_pagePadding_tb'), | 59 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 60 | bottom: $r('app.float.card_comp_pagePadding_tb') | 60 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 61 | }) | 61 | }) |
| @@ -87,8 +87,8 @@ export struct CardAdvSmallImageComponent { | @@ -87,8 +87,8 @@ export struct CardAdvSmallImageComponent { | ||
| 87 | .width("100%") | 87 | .width("100%") |
| 88 | .height(this.isBigThreeLine ? 127 : 106) | 88 | .height(this.isBigThreeLine ? 127 : 106) |
| 89 | .padding({ | 89 | .padding({ |
| 90 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 91 | - right: $r('app.float.card_comp_pagePadding_lf'), | 90 | + left: 10, |
| 91 | + right: 10, | ||
| 92 | top: $r('app.float.card_comp_pagePadding_tb'), | 92 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 93 | bottom: $r('app.float.card_comp_pagePadding_tb') | 93 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 94 | }) | 94 | }) |
| @@ -78,8 +78,8 @@ export struct CardAdvThreeImageComponent { | @@ -78,8 +78,8 @@ export struct CardAdvThreeImageComponent { | ||
| 78 | } | 78 | } |
| 79 | .width(CommonConstants.FULL_WIDTH) | 79 | .width(CommonConstants.FULL_WIDTH) |
| 80 | .padding({ | 80 | .padding({ |
| 81 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 82 | - right: $r('app.float.card_comp_pagePadding_lf'), | 81 | + left: 10, |
| 82 | + right: 10, | ||
| 83 | top: $r('app.float.card_comp_pagePadding_tb'), | 83 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 84 | bottom: $r('app.float.card_comp_pagePadding_tb') | 84 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 85 | }) | 85 | }) |
| @@ -62,8 +62,8 @@ export struct CardAdvVideoComponent { | @@ -62,8 +62,8 @@ export struct CardAdvVideoComponent { | ||
| 62 | } | 62 | } |
| 63 | .width(CommonConstants.FULL_WIDTH) | 63 | .width(CommonConstants.FULL_WIDTH) |
| 64 | .padding({ | 64 | .padding({ |
| 65 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 66 | - right: $r('app.float.card_comp_pagePadding_lf'), | 65 | + left: 10, |
| 66 | + right: 10, | ||
| 67 | top: $r('app.float.card_comp_pagePadding_tb'), | 67 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 68 | bottom: $r('app.float.card_comp_pagePadding_tb') | 68 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 69 | }) | 69 | }) |
| @@ -85,8 +85,8 @@ export struct CardAdvVideoExComponent { | @@ -85,8 +85,8 @@ export struct CardAdvVideoExComponent { | ||
| 85 | } | 85 | } |
| 86 | .width(CommonConstants.FULL_WIDTH) | 86 | .width(CommonConstants.FULL_WIDTH) |
| 87 | .padding({ | 87 | .padding({ |
| 88 | - left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 89 | - right: $r('app.float.card_comp_pagePadding_lf'), | 88 | + left: 10, |
| 89 | + right: 10, | ||
| 90 | top: $r('app.float.card_comp_pagePadding_tb'), | 90 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 91 | bottom: $r('app.float.card_comp_pagePadding_tb') | 91 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 92 | }) | 92 | }) |
| @@ -111,7 +111,7 @@ export struct Card10Component { | @@ -111,7 +111,7 @@ export struct Card10Component { | ||
| 111 | } | 111 | } |
| 112 | // 大图 | 112 | // 大图 |
| 113 | Stack() { | 113 | Stack() { |
| 114 | - Image(this.loadImg ? this.contentDTO?.coverUrl : '') | 114 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 115 | .backgroundColor(0xf5f5f5) | 115 | .backgroundColor(0xf5f5f5) |
| 116 | .width('100%') | 116 | .width('100%') |
| 117 | .borderRadius({ | 117 | .borderRadius({ |
| @@ -165,10 +165,9 @@ export struct Card10Component { | @@ -165,10 +165,9 @@ export struct Card10Component { | ||
| 165 | left: $r('app.float.card_comp_pagePadding_lf'), | 165 | left: $r('app.float.card_comp_pagePadding_lf'), |
| 166 | right: $r('app.float.card_comp_pagePadding_lf'), | 166 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 167 | top: $r('app.float.card_comp_pagePadding_tb'), | 167 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 168 | - bottom: 14 | 168 | + bottom: $r('app.float.card_comp_pagePadding_tb') |
| 169 | }) | 169 | }) |
| 170 | .backgroundColor($r("app.color.white")) | 170 | .backgroundColor($r("app.color.white")) |
| 171 | - .margin({ bottom: 8 }) | ||
| 172 | } | 171 | } |
| 173 | 172 | ||
| 174 | @Builder | 173 | @Builder |
| @@ -80,7 +80,7 @@ export struct Card14Component { | @@ -80,7 +80,7 @@ export struct Card14Component { | ||
| 80 | .margin({right: 12}) | 80 | .margin({right: 12}) |
| 81 | .width('64%') | 81 | .width('64%') |
| 82 | 82 | ||
| 83 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 83 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 84 | .backgroundColor(0xf5f5f5) | 84 | .backgroundColor(0xf5f5f5) |
| 85 | .aspectRatio(3 / 2) | 85 | .aspectRatio(3 / 2) |
| 86 | .height(78) | 86 | .height(78) |
| @@ -80,7 +80,7 @@ export struct Card15Component { | @@ -80,7 +80,7 @@ export struct Card15Component { | ||
| 80 | } | 80 | } |
| 81 | //大图 | 81 | //大图 |
| 82 | Stack() { | 82 | Stack() { |
| 83 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 83 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 84 | .backgroundColor(0xf5f5f5) | 84 | .backgroundColor(0xf5f5f5) |
| 85 | .borderRadius($r('app.float.image_border_radius')) | 85 | .borderRadius($r('app.float.image_border_radius')) |
| 86 | //播放状态+时长 | 86 | //播放状态+时长 |
| @@ -173,6 +173,8 @@ struct createImg { | @@ -173,6 +173,8 @@ struct createImg { | ||
| 173 | if (picWidth && picHeight) { | 173 | if (picWidth && picHeight) { |
| 174 | if (picWidth / picHeight > 2/1) { | 174 | if (picWidth / picHeight > 2/1) { |
| 175 | return 1; //横长图 | 175 | return 1; //横长图 |
| 176 | + } else if (picWidth/picHeight > 1/2 && picWidth/picHeight < 3/4) { //截取图片 | ||
| 177 | + return 4; | ||
| 176 | } else if (picWidth/picHeight < 1/2) { | 178 | } else if (picWidth/picHeight < 1/2) { |
| 177 | return 2; //竖长图 | 179 | return 2; //竖长图 |
| 178 | } else { | 180 | } else { |
| @@ -197,14 +199,14 @@ struct createImg { | @@ -197,14 +199,14 @@ struct createImg { | ||
| 197 | alignContent: Alignment.BottomEnd | 199 | alignContent: Alignment.BottomEnd |
| 198 | }) { | 200 | }) { |
| 199 | if (this.getPicType(item.weight, item.height) === 1) { | 201 | if (this.getPicType(item.weight, item.height) === 1) { |
| 200 | - Image(this.loadImg ? item.fullUrl || item.url : '') | 202 | + Image(this.loadImg ? item.url || item.fullUrl : '') |
| 201 | .backgroundColor(0xf5f5f5) | 203 | .backgroundColor(0xf5f5f5) |
| 202 | .width('100%') | 204 | .width('100%') |
| 203 | .height(198) | 205 | .height(198) |
| 204 | .autoResize(true) | 206 | .autoResize(true) |
| 205 | .borderRadius(this.caclImageRadius(index)) | 207 | .borderRadius(this.caclImageRadius(index)) |
| 206 | } else if (this.getPicType(item.weight, item.height) === 2) { | 208 | } else if (this.getPicType(item.weight, item.height) === 2) { |
| 207 | - Image(this.loadImg ? item.fullUrl || item.url : '') | 209 | + Image(this.loadImg ? item.url || item.fullUrl : '') |
| 208 | .width('100%') | 210 | .width('100%') |
| 209 | .height(305) | 211 | .height(305) |
| 210 | .autoResize(true) | 212 | .autoResize(true) |
| @@ -236,11 +238,30 @@ struct createImg { | @@ -236,11 +238,30 @@ struct createImg { | ||
| 236 | 238 | ||
| 237 | } | 239 | } |
| 238 | } | 240 | } |
| 241 | + } else if (this.getPicType(item.weight, item.height) === 4) { | ||
| 242 | + GridCol({ | ||
| 243 | + span: this.onePicW > this.onePicH ? 12 : 8 | ||
| 244 | + }) { | ||
| 245 | + Image(this.loadImg ? item.url || item.fullUrl : '') | ||
| 246 | + .backgroundColor(0xf5f5f5) | ||
| 247 | + // .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305) | ||
| 248 | + .width('100%') | ||
| 249 | + .autoResize(true) | ||
| 250 | + .objectFit(ImageFit.Cover) | ||
| 251 | + .autoResize(true) | ||
| 252 | + .aspectRatio(3/4) | ||
| 253 | + .borderRadius(this.caclImageRadius(index)) | ||
| 254 | + .opacity(!item.weight && !item.height ? 0 : 1) | ||
| 255 | + .onComplete((event?) => { | ||
| 256 | + this.onePicW = event?.width || 0; | ||
| 257 | + this.onePicH = event?.height || 0; | ||
| 258 | + }) | ||
| 259 | + } | ||
| 239 | } else { | 260 | } else { |
| 240 | GridCol({ | 261 | GridCol({ |
| 241 | span: this.onePicW > this.onePicH ? 12 : 8 | 262 | span: this.onePicW > this.onePicH ? 12 : 8 |
| 242 | }) { | 263 | }) { |
| 243 | - Image(this.loadImg ? item.fullUrl : '') | 264 | + Image(this.loadImg ? item.url || item.fullUrl : '') |
| 244 | .backgroundColor(0xf5f5f5) | 265 | .backgroundColor(0xf5f5f5) |
| 245 | // .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305) | 266 | // .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305) |
| 246 | .width('100%') | 267 | .width('100%') |
| @@ -262,7 +283,7 @@ struct createImg { | @@ -262,7 +283,7 @@ struct createImg { | ||
| 262 | span: { xs: 4 } | 283 | span: { xs: 4 } |
| 263 | }) { | 284 | }) { |
| 264 | Stack({alignContent: Alignment.BottomEnd}) { | 285 | Stack({alignContent: Alignment.BottomEnd}) { |
| 265 | - Image(this.loadImg ? item.fullUrl : '') | 286 | + Image(this.loadImg ? item.url || item.fullUrl : '') |
| 266 | .backgroundColor(index === 2 ? 0xffffff : 0xf5f5f5) | 287 | .backgroundColor(index === 2 ? 0xffffff : 0xf5f5f5) |
| 267 | .aspectRatio(1) | 288 | .aspectRatio(1) |
| 268 | .width('226lvp') | 289 | .width('226lvp') |
| @@ -301,7 +322,7 @@ struct createImg { | @@ -301,7 +322,7 @@ struct createImg { | ||
| 301 | span: { sm: 4, lg: 3 } | 322 | span: { sm: 4, lg: 3 } |
| 302 | }) { | 323 | }) { |
| 303 | Stack({ alignContent: Alignment.BottomEnd }) { | 324 | Stack({ alignContent: Alignment.BottomEnd }) { |
| 304 | - Image(this.loadImg ? item.fullUrl : '') | 325 | + Image(this.loadImg ? item.url || item.fullUrl : '') |
| 305 | .backgroundColor(0xf5f5f5) | 326 | .backgroundColor(0xf5f5f5) |
| 306 | .aspectRatio(1) | 327 | .aspectRatio(1) |
| 307 | .borderRadius(this.caclImageRadius(index)) | 328 | .borderRadius(this.caclImageRadius(index)) |
| @@ -339,7 +360,7 @@ struct createImg { | @@ -339,7 +360,7 @@ struct createImg { | ||
| 339 | const photo: PhotoListBean = { | 360 | const photo: PhotoListBean = { |
| 340 | width: item.weight, | 361 | width: item.weight, |
| 341 | height: item.height, | 362 | height: item.height, |
| 342 | - picPath: item.fullUrl||item.url, | 363 | + picPath: item.url || item.fullUrl, |
| 343 | picDesc: '', | 364 | picDesc: '', |
| 344 | itemType:2, | 365 | itemType:2, |
| 345 | id:0 | 366 | id:0 |
| @@ -153,7 +153,7 @@ struct createImg { | @@ -153,7 +153,7 @@ struct createImg { | ||
| 153 | span: { xs: 12 } | 153 | span: { xs: 12 } |
| 154 | }) { | 154 | }) { |
| 155 | Stack() { | 155 | Stack() { |
| 156 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 156 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 157 | .backgroundColor(0xf5f5f5) | 157 | .backgroundColor(0xf5f5f5) |
| 158 | .width(CommonConstants.FULL_WIDTH) | 158 | .width(CommonConstants.FULL_WIDTH) |
| 159 | .aspectRatio(16 / 9) | 159 | .aspectRatio(16 / 9) |
| @@ -176,7 +176,7 @@ struct createImg { | @@ -176,7 +176,7 @@ struct createImg { | ||
| 176 | span: { xs: 6 } | 176 | span: { xs: 6 } |
| 177 | }) { | 177 | }) { |
| 178 | Stack() { | 178 | Stack() { |
| 179 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 179 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 180 | .backgroundColor(0xf5f5f5) | 180 | .backgroundColor(0xf5f5f5) |
| 181 | .width(CommonConstants.FULL_WIDTH) | 181 | .width(CommonConstants.FULL_WIDTH) |
| 182 | .borderRadius($r('app.float.image_border_radius')) | 182 | .borderRadius($r('app.float.image_border_radius')) |
| @@ -79,7 +79,7 @@ export struct Card21Component { | @@ -79,7 +79,7 @@ export struct Card21Component { | ||
| 79 | 79 | ||
| 80 | GridItem() { | 80 | GridItem() { |
| 81 | Stack() { | 81 | Stack() { |
| 82 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 82 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 83 | .backgroundColor(0xf5f5f5) | 83 | .backgroundColor(0xf5f5f5) |
| 84 | .width(CommonConstants.FULL_WIDTH) | 84 | .width(CommonConstants.FULL_WIDTH) |
| 85 | .borderRadius($r('app.float.image_border_radius')) | 85 | .borderRadius($r('app.float.image_border_radius')) |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | import { CompDTO, ContentDTO } from 'wdBean'; | 2 | import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | -import { CommonConstants } from 'wdConstant/Index'; | 3 | +import { CommonConstants, CompStyle } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| @@ -44,6 +44,14 @@ export struct Card2Component { | @@ -44,6 +44,14 @@ export struct Card2Component { | ||
| 44 | this.textArr = titleInitRes.textArr; | 44 | this.textArr = titleInitRes.textArr; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | + getCover() { | ||
| 48 | + if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | ||
| 49 | + return this.contentDTO.coverUrl | ||
| 50 | + } else if (this.contentDTO.appStyle === CompStyle.Card_02) { | ||
| 51 | + return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl | ||
| 52 | + } | ||
| 53 | + return '' | ||
| 54 | + } | ||
| 47 | 55 | ||
| 48 | build() { | 56 | build() { |
| 49 | Column() { | 57 | Column() { |
| @@ -96,7 +104,7 @@ export struct Card2Component { | @@ -96,7 +104,7 @@ export struct Card2Component { | ||
| 96 | 104 | ||
| 97 | //大图 | 105 | //大图 |
| 98 | Stack() { | 106 | Stack() { |
| 99 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 107 | + Image(this.loadImg ? this.getCover() : '') |
| 100 | .width(CommonConstants.FULL_WIDTH) | 108 | .width(CommonConstants.FULL_WIDTH) |
| 101 | .aspectRatio(16 / 9) | 109 | .aspectRatio(16 / 9) |
| 102 | .borderRadius($r('app.float.image_border_radius')) | 110 | .borderRadius($r('app.float.image_border_radius')) |
| 1 | import { ContentDTO, CompDTO } from 'wdBean'; | 1 | import { ContentDTO, CompDTO } from 'wdBean'; |
| 2 | -import { CommonConstants } from 'wdConstant'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 2 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 3 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 4 | import { Notes } from './notes'; |
| @@ -7,7 +6,8 @@ import { getNotesContentWidth } from '../../utils/FuncUtils' | @@ -7,7 +6,8 @@ import { getNotesContentWidth } from '../../utils/FuncUtils' | ||
| 7 | import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | 6 | import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; |
| 8 | import { InfomationCardClick } from '../../utils/infomationCardClick' | 7 | import { InfomationCardClick } from '../../utils/infomationCardClick' |
| 9 | import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; | 8 | import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; |
| 10 | -import router from '@ohos.router' | 9 | +import router from '@ohos.router'; |
| 10 | +import { CommonConstants, CompStyle } from 'wdConstant/Index'; | ||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | const TAG: string = 'Card5Component'; | 13 | const TAG: string = 'Card5Component'; |
| @@ -42,9 +42,18 @@ export struct Card5Component { | @@ -42,9 +42,18 @@ export struct Card5Component { | ||
| 42 | this.textArr = titleInitRes.textArr; | 42 | this.textArr = titleInitRes.textArr; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | + getCover() { | ||
| 46 | + if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | ||
| 47 | + return this.contentDTO.coverUrl | ||
| 48 | + } else if (this.contentDTO.appStyle === CompStyle.Card_05) { | ||
| 49 | + return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl | ||
| 50 | + } | ||
| 51 | + return '' | ||
| 52 | + } | ||
| 53 | + | ||
| 45 | build() { | 54 | build() { |
| 46 | Stack() { | 55 | Stack() { |
| 47 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 56 | + Image(this.loadImg ? this.getCover() : '') |
| 48 | .backgroundColor(0xf5f5f5) | 57 | .backgroundColor(0xf5f5f5) |
| 49 | .width(CommonConstants.FULL_WIDTH) | 58 | .width(CommonConstants.FULL_WIDTH) |
| 50 | .borderRadius( | 59 | .borderRadius( |
| @@ -35,12 +35,22 @@ export struct Card6Component { | @@ -35,12 +35,22 @@ export struct Card6Component { | ||
| 35 | const curRouter = router.getState().name; | 35 | const curRouter = router.getState().name; |
| 36 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) | 36 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) |
| 37 | } | 37 | } |
| 38 | + | ||
| 38 | titleInit() { | 39 | titleInit() { |
| 39 | const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); | 40 | const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); |
| 40 | this.titleMarked = titleInitRes.titleMarked; | 41 | this.titleMarked = titleInitRes.titleMarked; |
| 41 | this.textArr = titleInitRes.textArr; | 42 | this.textArr = titleInitRes.textArr; |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 45 | + getCover() { | ||
| 46 | + if (this.compDTO.compStyle === CompStyle.Card_13) { | ||
| 47 | + return this.contentDTO.coverUrl | ||
| 48 | + } else if (this.contentDTO.appStyle === CompStyle.Card_06) { | ||
| 49 | + return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl | ||
| 50 | + } | ||
| 51 | + return '' | ||
| 52 | + } | ||
| 53 | + | ||
| 44 | build() { | 54 | build() { |
| 45 | Row() { | 55 | Row() { |
| 46 | Column() { | 56 | Column() { |
| @@ -109,7 +119,7 @@ export struct Card6Component { | @@ -109,7 +119,7 @@ export struct Card6Component { | ||
| 109 | 119 | ||
| 110 | 120 | ||
| 111 | Stack({alignContent: Alignment.BottomEnd}) { | 121 | Stack({alignContent: Alignment.BottomEnd}) { |
| 112 | - Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') | 122 | + Image(this.loadImg ? this.getCover() : '') |
| 113 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) | 123 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) |
| 114 | .borderRadius(5) | 124 | .borderRadius(5) |
| 115 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 125 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| @@ -235,7 +235,7 @@ export struct Card9Component { | @@ -235,7 +235,7 @@ export struct Card9Component { | ||
| 235 | .maxLines(2) | 235 | .maxLines(2) |
| 236 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 236 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 237 | .alignSelf(ItemAlign.Start) | 237 | .alignSelf(ItemAlign.Start) |
| 238 | - .padding({ bottom: 20, left: 10 }) | 238 | + .padding({ bottom: 16, left: 10 }) |
| 239 | .border({ width: { left: isLastOne ? 0 : 1 }, color: 0xededed}) | 239 | .border({ width: { left: isLastOne ? 0 : 1 }, color: 0xededed}) |
| 240 | .margin({ left: 4 }) | 240 | .margin({ left: 4 }) |
| 241 | } | 241 | } |
| @@ -35,6 +35,8 @@ export class commentListModel extends PageModel { | @@ -35,6 +35,8 @@ export class commentListModel extends PageModel { | ||
| 35 | totalCommentNum: string = '0' | 35 | totalCommentNum: string = '0' |
| 36 | hasNext: number = 0 | 36 | hasNext: number = 0 |
| 37 | list: commentItemModel[] = [] | 37 | list: commentItemModel[] = [] |
| 38 | + hotList: commentItemModel[] = [] // 仅第一页存在 | ||
| 39 | + hotIds: string[] = [] // 仅第一页存在 | ||
| 38 | // constructor(pageNum:number, pageSize:number, totalCount: number, hasNext: number, list: commentItemModel[]) { | 40 | // constructor(pageNum:number, pageSize:number, totalCount: number, hasNext: number, list: commentItemModel[]) { |
| 39 | // super() | 41 | // super() |
| 40 | // this.pageNum = pageNum | 42 | // this.pageNum = pageNum |
| @@ -45,9 +47,16 @@ export class commentListModel extends PageModel { | @@ -45,9 +47,16 @@ export class commentListModel extends PageModel { | ||
| 45 | // } | 47 | // } |
| 46 | } | 48 | } |
| 47 | 49 | ||
| 50 | +export enum CommentItemCustomType { | ||
| 51 | + comment = 0, | ||
| 52 | + newTitle = 1, // 最新评论标题 | ||
| 53 | + hotTitle = 2, // 热门评论标题 | ||
| 54 | + hotComment = 3, | ||
| 55 | +} | ||
| 48 | 56 | ||
| 49 | @Observed | 57 | @Observed |
| 50 | export class commentItemModel { | 58 | export class commentItemModel { |
| 59 | + api_customType: CommentItemCustomType = CommentItemCustomType.comment | ||
| 51 | authorLike: string = '' | 60 | authorLike: string = '' |
| 52 | avatarFrame: string = '' | 61 | avatarFrame: string = '' |
| 53 | checkStatus: string = '' | 62 | checkStatus: string = '' |
| 1 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, | 1 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource, |
| 2 | PublicDialogManager, | 2 | PublicDialogManager, |
| 3 | StringUtils } from 'wdKit/Index'; | 3 | StringUtils } from 'wdKit/Index'; |
| 4 | -import { commentItemModel, WDPublicUserType } from '../model/CommentModel'; | 4 | +import { CommentItemCustomType, commentItemModel, WDPublicUserType } from '../model/CommentModel'; |
| 5 | import commentViewModel from '../viewmodel/CommentViewModel'; | 5 | import commentViewModel from '../viewmodel/CommentViewModel'; |
| 6 | import { CommentText } from './CommentText'; | 6 | import { CommentText } from './CommentText'; |
| 7 | import { CommentCustomDialog } from './CommentCustomDialog'; | 7 | import { CommentCustomDialog } from './CommentCustomDialog'; |
| @@ -37,6 +37,7 @@ export struct CommentComponent { | @@ -37,6 +37,7 @@ export struct CommentComponent { | ||
| 37 | listScroller: ListScroller = new ListScroller(); // scroller控制器 | 37 | listScroller: ListScroller = new ListScroller(); // scroller控制器 |
| 38 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 38 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 39 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 39 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 40 | + firstPageHotIds: string = '' | ||
| 40 | @State dialogController: CustomDialogController | null = null; | 41 | @State dialogController: CustomDialogController | null = null; |
| 41 | // @State private browSingModel: commentListModel = new commentListModel() | 42 | // @State private browSingModel: commentListModel = new commentListModel() |
| 42 | 43 | ||
| @@ -49,6 +50,7 @@ export struct CommentComponent { | @@ -49,6 +50,7 @@ export struct CommentComponent { | ||
| 49 | // 是否在弹框中 | 50 | // 是否在弹框中 |
| 50 | @Provide inDialog: boolean = false | 51 | @Provide inDialog: boolean = false |
| 51 | private dialogBeforeJumpOtherPageAction: () => void = () => {} | 52 | private dialogBeforeJumpOtherPageAction: () => void = () => {} |
| 53 | + private dialogUpdateTitle: (title: string) => void = () => {} | ||
| 52 | 54 | ||
| 53 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 55 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 54 | aboutToDisappear() { | 56 | aboutToDisappear() { |
| @@ -99,7 +101,16 @@ export struct CommentComponent { | @@ -99,7 +101,16 @@ export struct CommentComponent { | ||
| 99 | /*一级评论*/ | 101 | /*一级评论*/ |
| 100 | // if (this.publishCommentModel.lastCommentModel) | 102 | // if (this.publishCommentModel.lastCommentModel) |
| 101 | if (this.publishCommentModel.lastCommentModel.parentId == '-1') { | 103 | if (this.publishCommentModel.lastCommentModel.parentId == '-1') { |
| 102 | - this.allDatas.addFirstItem(model) | 104 | + |
| 105 | + let newCommentHeaderIndex = this.indexOfNewCommentHeaderTitle() | ||
| 106 | + if (newCommentHeaderIndex === -1) { | ||
| 107 | + let newCommentTitle = new commentItemModel() | ||
| 108 | + newCommentTitle.api_customType = CommentItemCustomType.newTitle | ||
| 109 | + this.allDatas.addItems([newCommentTitle, model]) | ||
| 110 | + } else { | ||
| 111 | + this.allDatas.addItem(model, newCommentHeaderIndex + 1) | ||
| 112 | + } | ||
| 113 | + | ||
| 103 | } else { | 114 | } else { |
| 104 | //二级评论 | 115 | //二级评论 |
| 105 | this.allDatas.getDataArray().forEach(element => { | 116 | this.allDatas.getDataArray().forEach(element => { |
| @@ -116,14 +127,19 @@ export struct CommentComponent { | @@ -116,14 +127,19 @@ export struct CommentComponent { | ||
| 116 | 127 | ||
| 117 | /*标题:全部评论*/ | 128 | /*标题:全部评论*/ |
| 118 | @Builder | 129 | @Builder |
| 119 | - titleHeader() { | 130 | + titleHeader(title: string = "最新评论", showGapLine: boolean = false) { |
| 131 | + | ||
| 132 | + Column() { | ||
| 133 | + if (showGapLine) { | ||
| 134 | + Divider().strokeWidth(6).color('#f5f5f5') | ||
| 135 | + } | ||
| 120 | 136 | ||
| 121 | Row() { | 137 | Row() { |
| 122 | Row() { | 138 | Row() { |
| 123 | Image($r('app.media.redLine')) | 139 | Image($r('app.media.redLine')) |
| 124 | .height(16) | 140 | .height(16) |
| 125 | .width(3) | 141 | .width(3) |
| 126 | - Text('全部评论') | 142 | + Text(title) |
| 127 | .fontSize(16)// .fontColor('#222222') | 143 | .fontSize(16)// .fontColor('#222222') |
| 128 | .fontColor($r('app.color.color_222222')) | 144 | .fontColor($r('app.color.color_222222')) |
| 129 | .fontWeight(FontWeight.Medium) | 145 | .fontWeight(FontWeight.Medium) |
| @@ -145,12 +161,7 @@ export struct CommentComponent { | @@ -145,12 +161,7 @@ export struct CommentComponent { | ||
| 145 | .height(44) | 161 | .height(44) |
| 146 | .width('100%') | 162 | .width('100%') |
| 147 | .justifyContent(FlexAlign.SpaceBetween) | 163 | .justifyContent(FlexAlign.SpaceBetween) |
| 148 | - .onClick(() => { | ||
| 149 | - // this.allDatas.push(new commentItemModel()) | ||
| 150 | - // this.allDatas.addFirstItem(new commentItemModel()) | ||
| 151 | - // this.allDatas.reloadData(); | ||
| 152 | - }) | ||
| 153 | - | 164 | + } |
| 154 | } | 165 | } |
| 155 | 166 | ||
| 156 | /*1级评论作为titleHeader*/ | 167 | /*1级评论作为titleHeader*/ |
| @@ -177,16 +188,29 @@ export struct CommentComponent { | @@ -177,16 +188,29 @@ export struct CommentComponent { | ||
| 177 | build() { | 188 | build() { |
| 178 | Column() { | 189 | Column() { |
| 179 | List({ scroller: this.listScroller }) { | 190 | List({ scroller: this.listScroller }) { |
| 191 | + if (!this.isComments) { | ||
| 180 | if (this.showTitleComponent) { | 192 | if (this.showTitleComponent) { |
| 181 | ListItemGroup({ header: this.titleHeader() }) | 193 | ListItemGroup({ header: this.titleHeader() }) |
| 182 | } | 194 | } |
| 183 | - | ||
| 184 | - if (!this.isComments) { | ||
| 185 | EmptyComponent({ emptyType: 17 }) | 195 | EmptyComponent({ emptyType: 17 }) |
| 186 | .height(300) | 196 | .height(300) |
| 187 | } else { | 197 | } else { |
| 188 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 198 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| 189 | - if (item.hasMore) { | 199 | + if (item.api_customType === CommentItemCustomType.newTitle) { |
| 200 | + if (this.inDialog && index === 0) { | ||
| 201 | + ListItemGroup() | ||
| 202 | + } else { | ||
| 203 | + ListItemGroup({ header: this.titleHeader("最新评论", index !== 0) }) | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | + else if (item.api_customType === CommentItemCustomType.hotTitle) { | ||
| 207 | + if (this.inDialog && index === 0) { | ||
| 208 | + ListItemGroup() | ||
| 209 | + } else { | ||
| 210 | + ListItemGroup({ header: this.titleHeader("热门评论") }) | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + else if (item.hasMore) { | ||
| 190 | ListItemGroup({ | 214 | ListItemGroup({ |
| 191 | header: this.CommentHeaderItem(item, index), | 215 | header: this.CommentHeaderItem(item, index), |
| 192 | footer: this.GroupFooterView(item, index) | 216 | footer: this.GroupFooterView(item, index) |
| @@ -234,6 +258,9 @@ export struct CommentComponent { | @@ -234,6 +258,9 @@ export struct CommentComponent { | ||
| 234 | } | 258 | } |
| 235 | .scrollBar(BarState.Off) | 259 | .scrollBar(BarState.Off) |
| 236 | .margin({ bottom: 10 }) | 260 | .margin({ bottom: 10 }) |
| 261 | + .onScrollIndex((start) => { | ||
| 262 | + this.updateDialogTitleWithStartIndex(start) | ||
| 263 | + }) | ||
| 237 | .onReachEnd(() => { | 264 | .onReachEnd(() => { |
| 238 | if (!this.fixedHeightMode) { | 265 | if (!this.fixedHeightMode) { |
| 239 | return | 266 | return |
| @@ -252,6 +279,30 @@ export struct CommentComponent { | @@ -252,6 +279,30 @@ export struct CommentComponent { | ||
| 252 | 279 | ||
| 253 | } | 280 | } |
| 254 | 281 | ||
| 282 | + updateDialogTitleWithStartIndex(start: number) { | ||
| 283 | + if (!this.inDialog) { | ||
| 284 | + return | ||
| 285 | + } | ||
| 286 | + if (this.allDatas.size() === 0) { | ||
| 287 | + this.dialogUpdateTitle("评论") | ||
| 288 | + return | ||
| 289 | + } | ||
| 290 | + if (this.allDatas.getFirst().api_customType !== CommentItemCustomType.hotTitle) { | ||
| 291 | + this.dialogUpdateTitle("最新评论") | ||
| 292 | + return | ||
| 293 | + } | ||
| 294 | + let newCommentHeaderIndex = this.indexOfNewCommentHeaderTitle() | ||
| 295 | + if (newCommentHeaderIndex == -1) { | ||
| 296 | + this.dialogUpdateTitle("热门评论") | ||
| 297 | + return | ||
| 298 | + } | ||
| 299 | + if (start < newCommentHeaderIndex + 1) { | ||
| 300 | + this.dialogUpdateTitle("热门评论") | ||
| 301 | + } else { | ||
| 302 | + this.dialogUpdateTitle("最新评论") | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + | ||
| 255 | parentOnReachEnd() { | 306 | parentOnReachEnd() { |
| 256 | if (this.fixedHeightMode) { | 307 | if (this.fixedHeightMode) { |
| 257 | return | 308 | return |
| @@ -268,11 +319,41 @@ export struct CommentComponent { | @@ -268,11 +319,41 @@ export struct CommentComponent { | ||
| 268 | //获取数据 | 319 | //获取数据 |
| 269 | async getData() { | 320 | async getData() { |
| 270 | let pageIndex = this.currentPage | 321 | let pageIndex = this.currentPage |
| 271 | - commentViewModel.fetchContentCommentList(pageIndex + '', this.publishCommentModel.targetId, | ||
| 272 | - this.publishCommentModel.targetType) | 322 | + commentViewModel.fetchContentCommentList(pageIndex + '' |
| 323 | + ,this.publishCommentModel.targetId | ||
| 324 | + ,this.publishCommentModel.targetType | ||
| 325 | + ,this.firstPageHotIds) | ||
| 273 | .then(commentListModel => { | 326 | .then(commentListModel => { |
| 274 | console.log('评论:', JSON.stringify(commentListModel.list)) | 327 | console.log('评论:', JSON.stringify(commentListModel.list)) |
| 275 | 328 | ||
| 329 | + if (pageIndex == 1) { | ||
| 330 | + // 保存第一页热门评论ids | ||
| 331 | + if (commentListModel.hotIds.length > 0) { | ||
| 332 | + this.firstPageHotIds = commentListModel.hotIds.join(",") | ||
| 333 | + } | ||
| 334 | + if (commentListModel.list.length > 0) { // 热门评论增加头部 | ||
| 335 | + let newCommentTitle = new commentItemModel() | ||
| 336 | + newCommentTitle.api_customType = CommentItemCustomType.newTitle | ||
| 337 | + let newArray = [newCommentTitle] | ||
| 338 | + commentListModel.list = newArray.concat(commentListModel.list) | ||
| 339 | + } | ||
| 340 | + if (commentListModel.hotList.length > 0) { // 最新评论增加头部 | ||
| 341 | + let hotCommentTitle = new commentItemModel() | ||
| 342 | + hotCommentTitle.api_customType = CommentItemCustomType.hotTitle | ||
| 343 | + let newArray = [hotCommentTitle] | ||
| 344 | + commentListModel.hotList = newArray.concat(commentListModel.hotList) | ||
| 345 | + | ||
| 346 | + commentListModel.list = commentListModel.hotList.concat(commentListModel.list) | ||
| 347 | + } | ||
| 348 | + } else { // 非首页数据 | ||
| 349 | + if (commentListModel.list.length > 0 && !this.hasNewCommentHeaderTitle()) { // 如果之前仅存在热门评论,这里需要补下数据 | ||
| 350 | + let newCommentTitle = new commentItemModel() | ||
| 351 | + newCommentTitle.api_customType = CommentItemCustomType.newTitle | ||
| 352 | + let newArray = [newCommentTitle] | ||
| 353 | + commentListModel.list = newArray.concat(commentListModel.list) | ||
| 354 | + } | ||
| 355 | + } | ||
| 356 | + | ||
| 276 | // 这里需要先赋值,否则下次UI刷新可能重复进入第1页两次 | 357 | // 这里需要先赋值,否则下次UI刷新可能重复进入第1页两次 |
| 277 | this.currentPage = pageIndex + 1 | 358 | this.currentPage = pageIndex + 1 |
| 278 | 359 | ||
| @@ -313,6 +394,29 @@ export struct CommentComponent { | @@ -313,6 +394,29 @@ export struct CommentComponent { | ||
| 313 | } | 394 | } |
| 314 | }) | 395 | }) |
| 315 | } | 396 | } |
| 397 | + | ||
| 398 | + hasNewCommentHeaderTitle() { | ||
| 399 | + let hasNewCommentHeader = false | ||
| 400 | + this.allDatas.getDataArray().forEach((comment) => { | ||
| 401 | + if (comment.api_customType === CommentItemCustomType.newTitle) { | ||
| 402 | + hasNewCommentHeader = true | ||
| 403 | + } | ||
| 404 | + }) | ||
| 405 | + return hasNewCommentHeader | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + indexOfNewCommentHeaderTitle() { | ||
| 409 | + let resultIndex = -1; | ||
| 410 | + const array = this.allDatas.getDataArray() | ||
| 411 | + for (let index = 0; index < array.length; index++) { | ||
| 412 | + if (array[index].api_customType === CommentItemCustomType.newTitle) { | ||
| 413 | + resultIndex = index; | ||
| 414 | + break | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + return resultIndex | ||
| 418 | + } | ||
| 419 | + | ||
| 316 | } | 420 | } |
| 317 | 421 | ||
| 318 | 422 | ||
| @@ -610,7 +714,7 @@ struct commentHeaderView { | @@ -610,7 +714,7 @@ struct commentHeaderView { | ||
| 610 | dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | 714 | dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction |
| 611 | }).margin({ left: 60, right: 16 }) | 715 | }).margin({ left: 60, right: 16 }) |
| 612 | }.alignItems(HorizontalAlign.Start) | 716 | }.alignItems(HorizontalAlign.Start) |
| 613 | - .padding({bottom: 8}) | 717 | + .padding({bottom: 0}) |
| 614 | } | 718 | } |
| 615 | 719 | ||
| 616 | @Builder headerView() { | 720 | @Builder headerView() { |
| @@ -738,6 +842,7 @@ struct commentFooterView { | @@ -738,6 +842,7 @@ struct commentFooterView { | ||
| 738 | }) | 842 | }) |
| 739 | } | 843 | } |
| 740 | } | 844 | } |
| 845 | + // .alignItems(VerticalAlign.Bottom) | ||
| 741 | .justifyContent(FlexAlign.SpaceBetween) | 846 | .justifyContent(FlexAlign.SpaceBetween) |
| 742 | .width('100%') | 847 | .width('100%') |
| 743 | .height(30) | 848 | .height(30) |
| 1 | import { inputMethodEngine } from '@kit.IMEKit' | 1 | import { inputMethodEngine } from '@kit.IMEKit' |
| 2 | import { commentInfo } from 'wdBean/Index' | 2 | import { commentInfo } from 'wdBean/Index' |
| 3 | +import { VoiceRecoginizer } from 'wdHwAbility' | ||
| 3 | import { ToastUtils } from 'wdKit/Index' | 4 | import { ToastUtils } from 'wdKit/Index' |
| 4 | import { HttpUtils } from 'wdNetwork/Index' | 5 | import { HttpUtils } from 'wdNetwork/Index' |
| 5 | import { commentItemModel } from '../model/CommentModel' | 6 | import { commentItemModel } from '../model/CommentModel' |
| 6 | import { publishCommentModel } from '../model/PublishCommentModel' | 7 | import { publishCommentModel } from '../model/PublishCommentModel' |
| 7 | import commentViewModel from '../viewmodel/CommentViewModel' | 8 | import commentViewModel from '../viewmodel/CommentViewModel' |
| 9 | +import { VoiceInputView } from './VoiceInputView' | ||
| 10 | +import { common, UIAbility } from '@kit.AbilityKit' | ||
| 8 | 11 | ||
| 9 | export interface CommentDialogInputContent { | 12 | export interface CommentDialogInputContent { |
| 10 | comment?: string | 13 | comment?: string |
| @@ -27,6 +30,7 @@ export struct CommentCustomDialog { | @@ -27,6 +30,7 @@ export struct CommentCustomDialog { | ||
| 27 | onPublishBtnClickTrack?: () => void // 和confirm配套使用。当设置了onPublishBtnClick 则无效 | 30 | onPublishBtnClickTrack?: () => void // 和confirm配套使用。当设置了onPublishBtnClick 则无效 |
| 28 | 31 | ||
| 29 | @State private emojiSwitch: boolean = false | 32 | @State private emojiSwitch: boolean = false |
| 33 | + @State private voiceSwitch: boolean = false | ||
| 30 | textInputController: TextAreaController = new TextAreaController() | 34 | textInputController: TextAreaController = new TextAreaController() |
| 31 | @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } | 35 | @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } |
| 32 | @State publishButtonOpacity: number = 0.5 | 36 | @State publishButtonOpacity: number = 0.5 |
| @@ -105,6 +109,9 @@ export struct CommentCustomDialog { | @@ -105,6 +109,9 @@ export struct CommentCustomDialog { | ||
| 105 | if (this.emojiSwitch) { | 109 | if (this.emojiSwitch) { |
| 106 | this.emojiSwitch = false | 110 | this.emojiSwitch = false |
| 107 | } | 111 | } |
| 112 | + if (this.voiceSwitch) { | ||
| 113 | + this.voiceSwitch = false | ||
| 114 | + } | ||
| 108 | }) | 115 | }) |
| 109 | } | 116 | } |
| 110 | .backgroundColor('#F9F9F9') | 117 | .backgroundColor('#F9F9F9') |
| @@ -117,8 +124,21 @@ export struct CommentCustomDialog { | @@ -117,8 +124,21 @@ export struct CommentCustomDialog { | ||
| 117 | Row() { | 124 | Row() { |
| 118 | Row({ space: 12 }) { | 125 | Row({ space: 12 }) { |
| 119 | //语音暂时不做,隐藏 | 126 | //语音暂时不做,隐藏 |
| 120 | - // Image($r('app.media.WDInput_voice')).width(30).height(30) | ||
| 121 | - | 127 | + Image($r(this.voiceSwitch ? 'app.media.WDInput_keyboardImage' : 'app.media.WDInput_voice')) |
| 128 | + .width(30) | ||
| 129 | + .height(30) | ||
| 130 | + .onClick(() => { | ||
| 131 | + VoiceRecoginizer.checkPemmission(getContext(this) as common.UIAbilityContext) | ||
| 132 | + this.positionInfo = this.textInputController.getCaretOffset() | ||
| 133 | + this.voiceSwitch = !this.voiceSwitch | ||
| 134 | + this.emojiSwitch = false | ||
| 135 | + if (this.voiceSwitch) { | ||
| 136 | + this.textInputController.stopEditing() | ||
| 137 | + } else { | ||
| 138 | + focusControl.requestFocus("textAreaId") // 弹起键盘 | ||
| 139 | + // this.textInputController.caretPosition(this.textInputController.getTextContentRect().x) | ||
| 140 | + } | ||
| 141 | + }) | ||
| 122 | Image($r(this.emojiSwitch ? 'app.media.WDInput_keyboardImage' : 'app.media.WDInput_emojiImage')) | 142 | Image($r(this.emojiSwitch ? 'app.media.WDInput_keyboardImage' : 'app.media.WDInput_emojiImage')) |
| 123 | .width(30) | 143 | .width(30) |
| 124 | .height(30) | 144 | .height(30) |
| @@ -127,6 +147,7 @@ export struct CommentCustomDialog { | @@ -127,6 +147,7 @@ export struct CommentCustomDialog { | ||
| 127 | this.positionInfo = this.textInputController.getCaretOffset() | 147 | this.positionInfo = this.textInputController.getCaretOffset() |
| 128 | 148 | ||
| 129 | this.emojiSwitch = !this.emojiSwitch | 149 | this.emojiSwitch = !this.emojiSwitch |
| 150 | + this.voiceSwitch = false | ||
| 130 | if (this.emojiSwitch) { | 151 | if (this.emojiSwitch) { |
| 131 | this.textInputController.stopEditing() | 152 | this.textInputController.stopEditing() |
| 132 | } else { | 153 | } else { |
| @@ -137,6 +158,7 @@ export struct CommentCustomDialog { | @@ -137,6 +158,7 @@ export struct CommentCustomDialog { | ||
| 137 | }) | 158 | }) |
| 138 | } | 159 | } |
| 139 | 160 | ||
| 161 | + | ||
| 140 | // Blank() | 162 | // Blank() |
| 141 | 163 | ||
| 142 | Row() { | 164 | Row() { |
| @@ -172,6 +194,12 @@ export struct CommentCustomDialog { | @@ -172,6 +194,12 @@ export struct CommentCustomDialog { | ||
| 172 | if (this.emojiSwitch) { | 194 | if (this.emojiSwitch) { |
| 173 | emojiView({ publishCommentModel: this.publishCommentModel }).height(150) | 195 | emojiView({ publishCommentModel: this.publishCommentModel }).height(150) |
| 174 | } | 196 | } |
| 197 | + if (this.voiceSwitch) { | ||
| 198 | + VoiceInputView({voiceRecoginizerResult:(result: string) => { | ||
| 199 | + this.publishCommentModel.commentContent = result; | ||
| 200 | + }}).height(150) | ||
| 201 | + | ||
| 202 | + } | ||
| 175 | 203 | ||
| 176 | }.backgroundColor(Color.White) | 204 | }.backgroundColor(Color.White) |
| 177 | .width('100%') | 205 | .width('100%') |
| @@ -74,6 +74,7 @@ struct CommentListDialog { | @@ -74,6 +74,7 @@ struct CommentListDialog { | ||
| 74 | /// 内部使用 | 74 | /// 内部使用 |
| 75 | @Link publishCommentModel: publishCommentModel | 75 | @Link publishCommentModel: publishCommentModel |
| 76 | @State private operationButtonList: string[] = [] | 76 | @State private operationButtonList: string[] = [] |
| 77 | + @State title: string = "评论" | ||
| 77 | 78 | ||
| 78 | /// 外部初始化 | 79 | /// 外部初始化 |
| 79 | @Link contentDetailData: ContentDetailDTO // 详情页传 | 80 | @Link contentDetailData: ContentDetailDTO // 详情页传 |
| @@ -122,6 +123,9 @@ struct CommentListDialog { | @@ -122,6 +123,9 @@ struct CommentListDialog { | ||
| 122 | if (this.onClose) { | 123 | if (this.onClose) { |
| 123 | this.onClose() | 124 | this.onClose() |
| 124 | } | 125 | } |
| 126 | + }, | ||
| 127 | + dialogUpdateTitle: (title) => { | ||
| 128 | + this.title = title | ||
| 125 | } | 129 | } |
| 126 | }).layoutWeight(1) | 130 | }).layoutWeight(1) |
| 127 | 131 | ||
| @@ -153,7 +157,7 @@ struct CommentListDialog { | @@ -153,7 +157,7 @@ struct CommentListDialog { | ||
| 153 | Image($r('app.media.redLine')) | 157 | Image($r('app.media.redLine')) |
| 154 | .height(16) | 158 | .height(16) |
| 155 | .width(3) | 159 | .width(3) |
| 156 | - Text('全部评论') | 160 | + Text(this.title) |
| 157 | .fontSize(16)// .fontColor('#222222') | 161 | .fontSize(16)// .fontColor('#222222') |
| 158 | .fontColor($r('app.color.color_222222')) | 162 | .fontColor($r('app.color.color_222222')) |
| 159 | .fontWeight(FontWeight.Medium) | 163 | .fontWeight(FontWeight.Medium) |
| @@ -110,9 +110,12 @@ export struct CommentText { | @@ -110,9 +110,12 @@ export struct CommentText { | ||
| 110 | // this.maxLineMesssage = this.maxLineMesssage.slice(0, this.maxLineMesssage.length - 1) | 110 | // this.maxLineMesssage = this.maxLineMesssage.slice(0, this.maxLineMesssage.length - 1) |
| 111 | // } | 111 | // } |
| 112 | 112 | ||
| 113 | + // console.log(`XXXXXXXXXXGY:${thisTextWidth - maxLineTextWidth}`) | ||
| 113 | ///早晚报三行显示 展开功能显示末尾 | 114 | ///早晚报三行显示 展开功能显示末尾 |
| 114 | if (this.isMorningEveningPaper) { | 115 | if (this.isMorningEveningPaper) { |
| 115 | this.maxLineMesssage = this.maxLineMesssage.substring(0,this.maxLineMesssage.length - 7) | 116 | this.maxLineMesssage = this.maxLineMesssage.substring(0,this.maxLineMesssage.length - 7) |
| 117 | + } else if (thisTextWidth > maxLineTextWidth + 5) { | ||
| 118 | + this.maxLineMesssage = this.maxLineMesssage.substring(0,this.maxLineMesssage.length - 1) | ||
| 116 | } | 119 | } |
| 117 | break | 120 | break |
| 118 | } | 121 | } |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/VoiceInputView.ets
0 → 100644
| 1 | +import Lottie from '@ohos/lottie' | ||
| 2 | +import { LottieView } from '../../lottie/LottieView' | ||
| 3 | +import lottie from '@ohos/lottie'; | ||
| 4 | +import { CommonConstants } from 'wdConstant'; | ||
| 5 | +import { common} from '@kit.AbilityKit'; | ||
| 6 | +import { VoiceRecoginizer } from 'wdHwAbility/src/main/ets/voiceRecognizer/VoiceRecoginizer'; | ||
| 7 | + | ||
| 8 | +@Component | ||
| 9 | +export struct VoiceInputView { | ||
| 10 | + | ||
| 11 | + @State private playAnimationOne: boolean = false | ||
| 12 | + | ||
| 13 | + // @State private playAnimationTwo: boolean = false | ||
| 14 | + | ||
| 15 | + @State private tips:string = "长按开始语音输入" | ||
| 16 | + | ||
| 17 | + voiceRe: VoiceRecoginizer = VoiceRecoginizer.sharedManager() | ||
| 18 | + | ||
| 19 | + voiceRecoginizerResult?:(result: string) => void | ||
| 20 | + | ||
| 21 | + aboutToAppear(): void { | ||
| 22 | + this.initVoiceRecoigzer() | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + aboutToDisappear(): void { | ||
| 26 | + this.voiceRe.stop() | ||
| 27 | + this.voiceRe.voiceRecoginizerResult = undefined | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + build() { | ||
| 31 | + Column() { | ||
| 32 | + Stack() { | ||
| 33 | + Row() { | ||
| 34 | + if (this.playAnimationOne) { | ||
| 35 | + LottieView({ | ||
| 36 | + name: 'voice_input_one', | ||
| 37 | + path: "lottie/search_animation_two.json", | ||
| 38 | + lottieWidth: 100, | ||
| 39 | + lottieHeight: 100, | ||
| 40 | + autoplay: true, | ||
| 41 | + loop: true, | ||
| 42 | + // onComplete:() => { | ||
| 43 | + // this.playAnimationOne = false | ||
| 44 | + // } | ||
| 45 | + }) | ||
| 46 | + } | ||
| 47 | + }.height(100) | ||
| 48 | + Button() | ||
| 49 | + .type(ButtonType.Circle) | ||
| 50 | + .backgroundImage($r('app.media.WDInput_voice_longPress_icon')) | ||
| 51 | + .backgroundColor(Color.White) | ||
| 52 | + .width(60) | ||
| 53 | + .height(60) | ||
| 54 | + .gesture( | ||
| 55 | + LongPressGesture() | ||
| 56 | + .onAction((event: GestureEvent) => { | ||
| 57 | + // this | ||
| 58 | + this.playAnimationOne = true | ||
| 59 | + this.tips = "" | ||
| 60 | + this.voiceRe.startDialog() | ||
| 61 | + }) | ||
| 62 | + | ||
| 63 | + .onActionEnd((event: GestureEvent) => { | ||
| 64 | + this.tips = "长按开始语音输入" | ||
| 65 | + this.playAnimationOne = false | ||
| 66 | + this.voiceRe.stop() | ||
| 67 | + // this.voiceRe.voiceRecoginizerResult = undefined | ||
| 68 | + | ||
| 69 | + }) | ||
| 70 | + ) | ||
| 71 | + } | ||
| 72 | + Blank() | ||
| 73 | + Text(this.tips) | ||
| 74 | + .fontSize(13) | ||
| 75 | + .fontColor("#222222") | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + initVoiceRecoigzer() { | ||
| 80 | + let context = getContext(this) as common.UIAbilityContext | ||
| 81 | + let resoureDir = context.resourceDir | ||
| 82 | + | ||
| 83 | + this.voiceRe.AsrInit(context.resourceDir, context.filesDir) | ||
| 84 | + | ||
| 85 | + this.voiceRe.voiceRecoginizerResult = (result: string) => { | ||
| 86 | + if (this.voiceRecoginizerResult) { | ||
| 87 | + this.voiceRecoginizerResult(result) | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + } | ||
| 92 | +} |
| @@ -8,6 +8,7 @@ import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | @@ -8,6 +8,7 @@ import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | ||
| 8 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 8 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 9 | import { TrackConstants, TrackingContent } from 'wdTracking/Index'; | 9 | import { TrackConstants, TrackingContent } from 'wdTracking/Index'; |
| 10 | import { | 10 | import { |
| 11 | + CommentItemCustomType, | ||
| 11 | commentItemModel, | 12 | commentItemModel, |
| 12 | commentListModel, | 13 | commentListModel, |
| 13 | commentStatusListModel, | 14 | commentStatusListModel, |
| @@ -33,9 +34,13 @@ class CommentViewModel { | @@ -33,9 +34,13 @@ class CommentViewModel { | ||
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | /*获取所有评论*/ | 36 | /*获取所有评论*/ |
| 36 | - fetchContentCommentList(pageNum: string, contentId: string, contentType: string): Promise<commentListModel> { | 37 | + fetchContentCommentList(pageNum: string, contentId: string, contentType: string, firstPageHotIds: string = ''): Promise<commentListModel> { |
| 37 | 38 | ||
| 38 | let url = HttpUrlUtils.getContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUtils.getDeviceId()}&userId=${HttpUtils.getUserId()}&userType=${HttpUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}` | 39 | let url = HttpUrlUtils.getContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUtils.getDeviceId()}&userId=${HttpUtils.getUserId()}&userType=${HttpUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}` |
| 40 | + url = url + "&hotComment=1" | ||
| 41 | + if (pageNum !== "1" && firstPageHotIds.length > 0) { | ||
| 42 | + url = url + `&hotIds=` + firstPageHotIds | ||
| 43 | + } | ||
| 39 | url = url.replace(' ', '%20') | 44 | url = url.replace(' ', '%20') |
| 40 | 45 | ||
| 41 | return new Promise<commentListModel>((success, fail) => { | 46 | return new Promise<commentListModel>((success, fail) => { |
| @@ -49,10 +54,24 @@ class CommentViewModel { | @@ -49,10 +54,24 @@ class CommentViewModel { | ||
| 49 | return | 54 | return |
| 50 | } | 55 | } |
| 51 | let listData = data.data as commentListModel | 56 | let listData = data.data as commentListModel |
| 52 | - this.fetchCommentStatusAndConfigAuthIcon(listData).then((commentListModel) => { | 57 | + this.fetchCommentStatusAndConfigAuthIcon(listData, false).then((commentListModel) => { |
| 53 | console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成') | 58 | console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成') |
| 59 | + | ||
| 60 | + if (pageNum !== "1") { | ||
| 61 | + success(commentListModel) | ||
| 62 | + return | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + // 热门评论批查 | ||
| 66 | + this.fetchCommentStatusAndConfigAuthIcon(listData, true).then((commentListModel) => { | ||
| 67 | + console.log(TAG, 'hot comment fetchCommentStatusAndConfigAuthIcon完成') | ||
| 68 | + | ||
| 69 | + listData.hotList.forEach((item) => { | ||
| 70 | + item.api_customType = CommentItemCustomType.hotComment | ||
| 71 | + }) | ||
| 54 | success(commentListModel) | 72 | success(commentListModel) |
| 55 | }) | 73 | }) |
| 74 | + }) | ||
| 56 | 75 | ||
| 57 | }, (error: Error) => { | 76 | }, (error: Error) => { |
| 58 | fail(error.message) | 77 | fail(error.message) |
| @@ -213,7 +232,7 @@ class CommentViewModel { | @@ -213,7 +232,7 @@ class CommentViewModel { | ||
| 213 | } | 232 | } |
| 214 | 233 | ||
| 215 | /*多接口批查*/ | 234 | /*多接口批查*/ |
| 216 | - fetchCommentStatusAndConfigAuthIcon(model: commentListModel): Promise<commentListModel> { | 235 | + fetchCommentStatusAndConfigAuthIcon(model: commentListModel, hot: boolean = false): Promise<commentListModel> { |
| 217 | 236 | ||
| 218 | let commentIDs: string[] = []; | 237 | let commentIDs: string[] = []; |
| 219 | 238 | ||
| @@ -222,7 +241,7 @@ class CommentViewModel { | @@ -222,7 +241,7 @@ class CommentViewModel { | ||
| 222 | let creatorIDs: string[] = []; | 241 | let creatorIDs: string[] = []; |
| 223 | 242 | ||
| 224 | //主评论 | 243 | //主评论 |
| 225 | - for (const element of model.list) { | 244 | + for (const element of (hot ? model.hotList : model.list)) { |
| 226 | if ((element.id + '').length > 0) { | 245 | if ((element.id + '').length > 0) { |
| 227 | commentIDs.push(element.id + '') | 246 | commentIDs.push(element.id + '') |
| 228 | } | 247 | } |
| @@ -277,7 +296,7 @@ class CommentViewModel { | @@ -277,7 +296,7 @@ class CommentViewModel { | ||
| 277 | let listData = data.data as commentStatusModel[] | 296 | let listData = data.data as commentStatusModel[] |
| 278 | //点赞 | 297 | //点赞 |
| 279 | for (const element of listData) { | 298 | for (const element of listData) { |
| 280 | - for (const commentModel of model.list) { | 299 | + for (const commentModel of (hot ? model.hotList : model.list)) { |
| 281 | if (element.commentId == commentModel.id) { | 300 | if (element.commentId == commentModel.id) { |
| 282 | commentModel.api_status = element.status | 301 | commentModel.api_status = element.status |
| 283 | } | 302 | } |
| @@ -319,7 +338,7 @@ class CommentViewModel { | @@ -319,7 +338,7 @@ class CommentViewModel { | ||
| 319 | let listData = data.data as commentStatusModel[] | 338 | let listData = data.data as commentStatusModel[] |
| 320 | 339 | ||
| 321 | for (const element of listData) { | 340 | for (const element of listData) { |
| 322 | - for (const commentModel of model.list) { | 341 | + for (const commentModel of (hot ? model.hotList : model.list)) { |
| 323 | if (element.userId == commentModel.fromUserId) { | 342 | if (element.userId == commentModel.fromUserId) { |
| 324 | commentModel.api_levelHead = element.levelHead | 343 | commentModel.api_levelHead = element.levelHead |
| 325 | } | 344 | } |
| @@ -364,7 +383,7 @@ class CommentViewModel { | @@ -364,7 +383,7 @@ class CommentViewModel { | ||
| 364 | let listData = data.data as commentStatusModel[] | 383 | let listData = data.data as commentStatusModel[] |
| 365 | 384 | ||
| 366 | for (const element of listData) { | 385 | for (const element of listData) { |
| 367 | - for (const commentModel of model.list) { | 386 | + for (const commentModel of (hot ? model.hotList : model.list)) { |
| 368 | if (element.creatorId == commentModel.fromCreatorId) { | 387 | if (element.creatorId == commentModel.fromCreatorId) { |
| 369 | commentModel.api_authIcon = element.authIcon | 388 | commentModel.api_authIcon = element.authIcon |
| 370 | } | 389 | } |
| @@ -400,6 +419,7 @@ class CommentViewModel { | @@ -400,6 +419,7 @@ class CommentViewModel { | ||
| 400 | deepCopyCommentItemModel(model: commentItemModel) { | 419 | deepCopyCommentItemModel(model: commentItemModel) { |
| 401 | let newModel = new commentItemModel() | 420 | let newModel = new commentItemModel() |
| 402 | 421 | ||
| 422 | + newModel.api_customType = model.api_customType | ||
| 403 | newModel.authorLike = model.authorLike | 423 | newModel.authorLike = model.authorLike |
| 404 | newModel.avatarFrame = model.avatarFrame | 424 | newModel.avatarFrame = model.avatarFrame |
| 405 | newModel.checkStatus = model.checkStatus | 425 | newModel.checkStatus = model.checkStatus |
| @@ -60,17 +60,19 @@ export struct ZhSingleRow02 { | @@ -60,17 +60,19 @@ export struct ZhSingleRow02 { | ||
| 60 | 60 | ||
| 61 | toMore() { | 61 | toMore() { |
| 62 | if (this.moreWidth > this.initMoreWidth * 2) { | 62 | if (this.moreWidth > this.initMoreWidth * 2) { |
| 63 | - if (this.compDTO?.objectType === '11') { | ||
| 64 | - ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | ||
| 65 | - } else { | ||
| 66 | - const contentDTO: ContentDTO = { | ||
| 67 | - objectId: this.compDTO.objectId, | ||
| 68 | - objectType: this.compDTO.objectType, | ||
| 69 | - linkUrl: this.compDTO.linkUrl, | ||
| 70 | - pageId: this.compDTO.pageId | ||
| 71 | - } as ContentDTO | ||
| 72 | - ProcessUtils.processPage(contentDTO) | ||
| 73 | - } | 63 | + |
| 64 | + ProcessUtils.compJumpPage(this.compDTO) | ||
| 65 | + // if (this.compDTO?.objectType === '11') { | ||
| 66 | + // ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | ||
| 67 | + // } else { | ||
| 68 | + // const contentDTO: ContentDTO = { | ||
| 69 | + // objectId: this.compDTO.objectId, | ||
| 70 | + // objectType: this.compDTO.objectType, | ||
| 71 | + // linkUrl: this.compDTO.linkUrl, | ||
| 72 | + // pageId: this.compDTO.pageId | ||
| 73 | + // } as ContentDTO | ||
| 74 | + // ProcessUtils.processPage(contentDTO) | ||
| 75 | + // } | ||
| 74 | } | 76 | } |
| 75 | } | 77 | } |
| 76 | 78 | ||
| @@ -94,7 +96,7 @@ export struct ZhSingleRow02 { | @@ -94,7 +96,7 @@ export struct ZhSingleRow02 { | ||
| 94 | pageId: this.pageId, | 96 | pageId: this.pageId, |
| 95 | pageName: this.pageName | 97 | pageName: this.pageName |
| 96 | }) | 98 | }) |
| 97 | - .margin({ right: 8 }) | 99 | + .margin({ right: 8, left: index === 0 ? 16 : 0 }) |
| 98 | }) | 100 | }) |
| 99 | } | 101 | } |
| 100 | if (this.compDTO.operDataList.length > 2 && this.showMore()) { | 102 | if (this.compDTO.operDataList.length > 2 && this.showMore()) { |
| @@ -123,6 +125,7 @@ export struct ZhSingleRow02 { | @@ -123,6 +125,7 @@ export struct ZhSingleRow02 { | ||
| 123 | .margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)}) | 125 | .margin({left: 1.5 * (this.moreWidth - this.initMoreWidth)}) |
| 124 | } | 126 | } |
| 125 | } | 127 | } |
| 128 | + .padding({right: 10}) | ||
| 126 | } | 129 | } |
| 127 | .width(CommonConstants.FULL_WIDTH) | 130 | .width(CommonConstants.FULL_WIDTH) |
| 128 | .height(208) | 131 | .height(208) |
| @@ -151,14 +154,14 @@ export struct ZhSingleRow02 { | @@ -151,14 +154,14 @@ export struct ZhSingleRow02 { | ||
| 151 | }) | 154 | }) |
| 152 | } | 155 | } |
| 153 | .padding({ | 156 | .padding({ |
| 154 | - left: 10, | 157 | + // left: 10, |
| 155 | // right: 10, | 158 | // right: 10, |
| 156 | - top: 14, | 159 | + top: $r('app.float.card_comp_pagePadding_tb'), |
| 157 | bottom: $r('app.float.card_comp_pagePadding_tb') | 160 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 158 | }) | 161 | }) |
| 159 | .backgroundColor(0xffffff) | 162 | .backgroundColor(0xffffff) |
| 160 | - .width('100%') | ||
| 161 | - .margin({ bottom: 8 }) | 163 | + .width('102%') |
| 164 | + .margin({ bottom: 8, left: -6 }) | ||
| 162 | } | 165 | } |
| 163 | 166 | ||
| 164 | @Builder | 167 | @Builder |
| @@ -204,6 +207,7 @@ export struct ZhSingleRow02 { | @@ -204,6 +207,7 @@ export struct ZhSingleRow02 { | ||
| 204 | } | 207 | } |
| 205 | .justifyContent(FlexAlign.SpaceBetween) | 208 | .justifyContent(FlexAlign.SpaceBetween) |
| 206 | .margin({ bottom: 10 }) | 209 | .margin({ bottom: 10 }) |
| 210 | + .padding({left: 16}) | ||
| 207 | .width('100%') | 211 | .width('100%') |
| 208 | } | 212 | } |
| 209 | } | 213 | } |
| @@ -475,17 +475,19 @@ export struct ZhSingleRow03 { | @@ -475,17 +475,19 @@ export struct ZhSingleRow03 { | ||
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | private jumpToMore() { | 477 | private jumpToMore() { |
| 478 | - if (this.compDTO.linkUrl) { | ||
| 479 | - let taskAction: Action = { | ||
| 480 | - type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 481 | - params: { | ||
| 482 | - url: this.compDTO.linkUrl | ||
| 483 | - } as Params, | ||
| 484 | - }; | ||
| 485 | - WDRouterRule.jumpWithAction(taskAction) | ||
| 486 | - } else { | ||
| 487 | - this.jumpToLiveMorePage() | ||
| 488 | - } | 478 | + ProcessUtils.compJumpPage(this.compDTO) |
| 479 | + return; | ||
| 480 | + // if (this.compDTO.linkUrl) { | ||
| 481 | + // let taskAction: Action = { | ||
| 482 | + // type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 483 | + // params: { | ||
| 484 | + // url: this.compDTO.linkUrl | ||
| 485 | + // } as Params, | ||
| 486 | + // }; | ||
| 487 | + // WDRouterRule.jumpWithAction(taskAction) | ||
| 488 | + // } else { | ||
| 489 | + // this.jumpToLiveMorePage() | ||
| 490 | + // } | ||
| 489 | } | 491 | } |
| 490 | 492 | ||
| 491 | } | 493 | } |
| @@ -130,7 +130,6 @@ export struct HomePageBottomCommentComponent { | @@ -130,7 +130,6 @@ export struct HomePageBottomCommentComponent { | ||
| 130 | let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum) | 130 | let object = new FollowListDetailRequestItem(-1, 20, this.curPageNum) |
| 131 | 131 | ||
| 132 | MinePageDatasModel.getMineCommentListData(time, object, getContext(this)).then((value) => { | 132 | MinePageDatasModel.getMineCommentListData(time, object, getContext(this)).then((value) => { |
| 133 | - if (this.curPageNum === 1) this.data_comment.clear() | ||
| 134 | if (!this.data_comment || value.list.length == 0) { | 133 | if (!this.data_comment || value.list.length == 0) { |
| 135 | this.hasMore = false | 134 | this.hasMore = false |
| 136 | this.isLoading = false | 135 | this.isLoading = false |
| @@ -176,6 +175,9 @@ export struct HomePageBottomCommentComponent { | @@ -176,6 +175,9 @@ export struct HomePageBottomCommentComponent { | ||
| 176 | }) | 175 | }) |
| 177 | 176 | ||
| 178 | if (status.commentIdList.length === 0) { | 177 | if (status.commentIdList.length === 0) { |
| 178 | + | ||
| 179 | + if (this.curPageNum === 1) this.data_comment.clear() | ||
| 180 | + | ||
| 179 | data.forEach((item) => { | 181 | data.forEach((item) => { |
| 180 | let publishTime = | 182 | let publishTime = |
| 181 | DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) | 183 | DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| @@ -201,6 +203,9 @@ export struct HomePageBottomCommentComponent { | @@ -201,6 +203,9 @@ export struct HomePageBottomCommentComponent { | ||
| 201 | } | 203 | } |
| 202 | 204 | ||
| 203 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { | 205 | MinePageDatasModel.getOtherUserCommentLikeStatusData(status, getContext(this)).then((newValue) => { |
| 206 | + | ||
| 207 | + if (this.curPageNum === 1) this.data_comment.clear() | ||
| 208 | + | ||
| 204 | newValue.forEach((item) => { | 209 | newValue.forEach((item) => { |
| 205 | data.forEach((list) => { | 210 | data.forEach((list) => { |
| 206 | if (item.commentId == list.id) { | 211 | if (item.commentId == list.id) { |
| @@ -256,6 +256,8 @@ export struct HomePageBottomFollowComponent { | @@ -256,6 +256,8 @@ export struct HomePageBottomFollowComponent { | ||
| 256 | } | 256 | } |
| 257 | this.bottomCompH = DisplayUtils.getDeviceHeight() - this.data_follow.totalCount()*100 | 257 | this.bottomCompH = DisplayUtils.getDeviceHeight() - this.data_follow.totalCount()*100 |
| 258 | // console.log(TAG, `${this.bottomCompH}`); | 258 | // console.log(TAG, `${this.bottomCompH}`); |
| 259 | + this.bottomCompH = DisplayUtils.getDeviceHeight() - this.data_follow.totalCount()*101 | ||
| 260 | + console.log(TAG, `${this.bottomCompH}`); | ||
| 259 | this.isLoading = false | 261 | this.isLoading = false |
| 260 | this.isGetRequest = true | 262 | this.isGetRequest = true |
| 261 | }).catch((err: Error) => { | 263 | }).catch((err: Error) => { |
| @@ -9,7 +9,7 @@ import NoMoreLayout from './NoMoreLayout' | @@ -9,7 +9,7 @@ import NoMoreLayout from './NoMoreLayout' | ||
| 9 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 9 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 10 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 10 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| 11 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; | 11 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; |
| 12 | -import { contentListItemParams } from '../../model/MyCollectionModel'; | 12 | +import { contentListItemParams, MyCollectionItem } from '../../model/MyCollectionModel'; |
| 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; |
| 14 | import { MyCustomDialog } from '../reusable/MyCustomDialog' | 14 | import { MyCustomDialog } from '../reusable/MyCustomDialog' |
| 15 | import { NetworkUtil } from 'wdKit/Index'; | 15 | import { NetworkUtil } from 'wdKit/Index'; |
| @@ -180,18 +180,9 @@ struct MyCollectionListPage { | @@ -180,18 +180,9 @@ struct MyCollectionListPage { | ||
| 180 | MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | 180 | MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { |
| 181 | if(resolve) resolve('刷新成功') | 181 | if(resolve) resolve('刷新成功') |
| 182 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 182 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { |
| 183 | - if (this.currentPage === 1) { | ||
| 184 | - this.allDatas = [] | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - for (let index = 0; index < collectionItem.list.length; index++) { | ||
| 188 | - const compDTO = collectionItem.list[index]; | ||
| 189 | - compDTO.isCollection = true ///用于时间展示 | ||
| 190 | - this.allDatas.push(compDTO) | ||
| 191 | - } | ||
| 192 | 183 | ||
| 193 | - if (this.allDatas.length > 0){ | ||
| 194 | - this.getContentData() | 184 | + if (collectionItem.list.length > 0){ |
| 185 | + this.getContentData(collectionItem) | ||
| 195 | } | 186 | } |
| 196 | 187 | ||
| 197 | if (collectionItem.hasNext === 0) { | 188 | if (collectionItem.hasNext === 0) { |
| @@ -279,13 +270,13 @@ struct MyCollectionListPage { | @@ -279,13 +270,13 @@ struct MyCollectionListPage { | ||
| 279 | } | 270 | } |
| 280 | } | 271 | } |
| 281 | 272 | ||
| 282 | - async getContentData(){ | 273 | + async getContentData(item:MyCollectionItem){ |
| 283 | try { | 274 | try { |
| 284 | // 获取列表数据 | 275 | // 获取列表数据 |
| 285 | const params: contentListParams = { | 276 | const params: contentListParams = { |
| 286 | contentList: [] | 277 | contentList: [] |
| 287 | } | 278 | } |
| 288 | - this.allDatas.forEach((item: ContentDTO) => { | 279 | + item.list.forEach((item: ContentDTO) => { |
| 289 | params.contentList.push({ | 280 | params.contentList.push({ |
| 290 | contentId: item.objectId, | 281 | contentId: item.objectId, |
| 291 | contentType: Number(item.objectType ?? '1') | 282 | contentType: Number(item.objectType ?? '1') |
| @@ -293,15 +284,26 @@ struct MyCollectionListPage { | @@ -293,15 +284,26 @@ struct MyCollectionListPage { | ||
| 293 | }) | 284 | }) |
| 294 | this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params) | 285 | this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params) |
| 295 | 286 | ||
| 296 | - let datas: ContentDTO[] = []; | ||
| 297 | - for (let index = 0; index < this.allDatas.length; index++) { | ||
| 298 | - const compDTO = this.allDatas[index]; | 287 | + if (this.currentPage === 1) { |
| 288 | + this.allDatas = [] | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + for (let index = 0; index < item.list.length; index++) { | ||
| 292 | + const compDTO = item.list[index]; | ||
| 293 | + compDTO.isCollection = true ///用于时间展示 | ||
| 299 | compDTO.interactData = this.commentList[index] | 294 | compDTO.interactData = this.commentList[index] |
| 300 | - datas.push(compDTO) | 295 | + this.allDatas.push(compDTO) |
| 301 | } | 296 | } |
| 302 | - this.allDatas = [] | ||
| 303 | - this.allDatas.push(...datas) | 297 | + |
| 304 | } catch (exception) { | 298 | } catch (exception) { |
| 299 | + if (this.currentPage === 1) { | ||
| 300 | + this.allDatas = [] | ||
| 301 | + } | ||
| 302 | + for (let index = 0; index < item.list.length; index++) { | ||
| 303 | + const compDTO = item.list[index]; | ||
| 304 | + compDTO.isCollection = true ///用于时间展示 | ||
| 305 | + this.allDatas.push(compDTO) | ||
| 306 | + } | ||
| 305 | } | 307 | } |
| 306 | } | 308 | } |
| 307 | } | 309 | } |
| @@ -34,7 +34,7 @@ export struct PeopleShipAttentionContentListTopComponent { | @@ -34,7 +34,7 @@ export struct PeopleShipAttentionContentListTopComponent { | ||
| 34 | .width('100%') | 34 | .width('100%') |
| 35 | .height('102vp') | 35 | .height('102vp') |
| 36 | 36 | ||
| 37 | - Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')) | 37 | + Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')).padding({ left: 10, right: 10 }) |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | +import { VoiceRecoginizer } from 'wdHwAbility' | ||
| 2 | import { BreakpointSystem, DateTimeUtils, NetworkUtil, StringUtils, ToastUtils } from 'wdKit' | 3 | import { BreakpointSystem, DateTimeUtils, NetworkUtil, StringUtils, ToastUtils } from 'wdKit' |
| 3 | import { ParamType, TrackConstants, Tracking } from 'wdTracking/Index' | 4 | import { ParamType, TrackConstants, Tracking } from 'wdTracking/Index' |
| 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 5 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| @@ -8,6 +9,8 @@ import { SearchHistoryComponent } from './SearchHistoryComponent' | @@ -8,6 +9,8 @@ import { SearchHistoryComponent } from './SearchHistoryComponent' | ||
| 8 | import { SearchHotsComponent } from './SearchHotsComponent' | 9 | import { SearchHotsComponent } from './SearchHotsComponent' |
| 9 | import { SearchRelatedComponent } from './SearchRelatedComponent' | 10 | import { SearchRelatedComponent } from './SearchRelatedComponent' |
| 10 | import { SearchResultComponent } from './SearchResultComponent' | 11 | import { SearchResultComponent } from './SearchResultComponent' |
| 12 | +import { VoiceSearchCustomDialog } from './VoiceSearchCustomDialog' | ||
| 13 | +import { common } from '@kit.AbilityKit' | ||
| 11 | 14 | ||
| 12 | const TAG = "SearchComponent" | 15 | const TAG = "SearchComponent" |
| 13 | 16 | ||
| @@ -37,6 +40,7 @@ export struct SearchComponent { | @@ -37,6 +40,7 @@ export struct SearchComponent { | ||
| 37 | @StorageProp('currentBreakpoint') @Watch("currentChanged") currentBreakpoint: string = 'sm'; | 40 | @StorageProp('currentBreakpoint') @Watch("currentChanged") currentBreakpoint: string = 'sm'; |
| 38 | private breakpointSystem = new BreakpointSystem(); | 41 | private breakpointSystem = new BreakpointSystem(); |
| 39 | @State percent: number = 1 | 42 | @State percent: number = 1 |
| 43 | + private voiceInputDialogController?: CustomDialogController | ||
| 40 | 44 | ||
| 41 | currentChanged() { | 45 | currentChanged() { |
| 42 | if (this.currentBreakpoint == "md" || this.currentBreakpoint == "lg") { | 46 | if (this.currentBreakpoint == "md" || this.currentBreakpoint == "lg") { |
| @@ -366,17 +370,22 @@ export struct SearchComponent { | @@ -366,17 +370,22 @@ export struct SearchComponent { | ||
| 366 | } | 370 | } |
| 367 | }) | 371 | }) |
| 368 | 372 | ||
| 369 | - Image($r('app.media.search_input_del_icon')) | 373 | + Image($r(StringUtils.isEmpty(this.searchText) ? 'app.media.search_voice_icon' : 'app.media.search_input_del_icon')) |
| 370 | .width(`${this.calcHeight(31)}lpx`) | 374 | .width(`${this.calcHeight(31)}lpx`) |
| 371 | .height(`${this.calcHeight(31)}lpx`) | 375 | .height(`${this.calcHeight(31)}lpx`) |
| 372 | .objectFit(ImageFit.Auto) | 376 | .objectFit(ImageFit.Auto) |
| 373 | .interpolation(ImageInterpolation.Medium) | 377 | .interpolation(ImageInterpolation.Medium) |
| 374 | .onClick(() => { | 378 | .onClick(() => { |
| 379 | + if (StringUtils.isEmpty(this.searchText)) { ///唤起语音搜索 | ||
| 380 | + this.stopInput() | ||
| 381 | + this.voiceSearchDialog() | ||
| 382 | + }else { ///清除输入内容 | ||
| 375 | this.searchText = "" | 383 | this.searchText = "" |
| 384 | + } | ||
| 376 | }) | 385 | }) |
| 377 | .offset({ x: 10 }) | 386 | .offset({ x: 10 }) |
| 378 | .enabled(true) | 387 | .enabled(true) |
| 379 | - .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible) | 388 | + // .visibility(StringUtils.isEmpty(this.searchText) ? Visibility.Hidden : Visibility.Visible) |
| 380 | 389 | ||
| 381 | }.padding({ right: `${this.calcHeight(70)}lpx` }) | 390 | }.padding({ right: `${this.calcHeight(70)}lpx` }) |
| 382 | .layoutWeight(1) | 391 | .layoutWeight(1) |
| @@ -406,6 +415,31 @@ export struct SearchComponent { | @@ -406,6 +415,31 @@ export struct SearchComponent { | ||
| 406 | .alignItems(VerticalAlign.Center) | 415 | .alignItems(VerticalAlign.Center) |
| 407 | } | 416 | } |
| 408 | 417 | ||
| 418 | + private voiceSearchDialog() { | ||
| 419 | + | ||
| 420 | + VoiceRecoginizer.checkPemmission(getContext(this) as common.UIAbilityContext) | ||
| 421 | + | ||
| 422 | + this.voiceInputDialogController = new CustomDialogController({ | ||
| 423 | + builder: VoiceSearchCustomDialog ( | ||
| 424 | + { onSearchBtnClick:((content:string) => { | ||
| 425 | + this.searchText = content | ||
| 426 | + if (StringUtils.isNotEmpty(this.searchText)) { | ||
| 427 | + SearcherAboutDataModel.putSearchHistoryData(this.searchText) | ||
| 428 | + this.getSearchHistoryData() | ||
| 429 | + this.getSearchInputResData(this.searchText) | ||
| 430 | + } | ||
| 431 | + this.voiceInputDialogController?.close() | ||
| 432 | + }) | ||
| 433 | + } | ||
| 434 | + ), | ||
| 435 | + autoCancel: true, | ||
| 436 | + alignment: DialogAlignment.Bottom, | ||
| 437 | + customStyle: true, | ||
| 438 | + backgroundColor: "#50000000", | ||
| 439 | + }) | ||
| 440 | + this.voiceInputDialogController.open() | ||
| 441 | + } | ||
| 442 | + | ||
| 409 | getSearchResultCountData() { | 443 | getSearchResultCountData() { |
| 410 | SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText), getContext(this)).then((value) => { | 444 | SearcherAboutDataModel.getSearchResultCountData(encodeURI(this.searchText), getContext(this)).then((value) => { |
| 411 | if (value != null) { | 445 | if (value != null) { |
sight_harmony/features/wdComponent/src/main/ets/components/search/VoiceSearchCustomDialog.ets
0 → 100644
| 1 | + | ||
| 2 | +import { VoiceRecoginizer } from 'wdHwAbility' | ||
| 3 | +import { common, UIAbility } from '@kit.AbilityKit' | ||
| 4 | +import { VoiceInputView } from '../comment/view/VoiceInputView' | ||
| 5 | + | ||
| 6 | +@Preview | ||
| 7 | +@CustomDialog | ||
| 8 | +export struct VoiceSearchCustomDialog { | ||
| 9 | + controller?: CustomDialogController | ||
| 10 | + onSearchBtnClick?: (content: string) => void | ||
| 11 | + @State voiceContent: string = "" | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + Column() { | ||
| 15 | + Row() { | ||
| 16 | + TextArea({ | ||
| 17 | + placeholder: '我来说两句', | ||
| 18 | + text: this.voiceContent | ||
| 19 | + }) | ||
| 20 | + .placeholderColor("#999999") | ||
| 21 | + .id("textAreaId") | ||
| 22 | + .defaultFocus(false) // 获取默认焦点 | ||
| 23 | + .enableKeyboardOnFocus(true) | ||
| 24 | + .height('100%') | ||
| 25 | + .width('100%') | ||
| 26 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 27 | + .caretColor("#ED2800") | ||
| 28 | + .onFocus(() => { | ||
| 29 | + this.controller?.close() | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + .backgroundColor('#F9F9F9') | ||
| 33 | + .margin({ top: 12, right: 12, left: 12, bottom:10}) | ||
| 34 | + .height(80) | ||
| 35 | + .borderRadius(4) | ||
| 36 | + Row() { | ||
| 37 | + Image($r('app.media.WDInput_keyboardImage')) | ||
| 38 | + .width(30) | ||
| 39 | + .height(30) | ||
| 40 | + .onClick(() => { | ||
| 41 | + this.controller?.close() | ||
| 42 | + }) | ||
| 43 | + Text('搜索') | ||
| 44 | + .backgroundColor("#ED2800") | ||
| 45 | + .width(80) | ||
| 46 | + .height(30) | ||
| 47 | + .fontSize(15) | ||
| 48 | + .fontColor(Color.White) | ||
| 49 | + .textAlign(TextAlign.Center) | ||
| 50 | + .borderRadius(4) | ||
| 51 | + .opacity(this.voiceContent.length > 0 ? 1.0 : 0.5) | ||
| 52 | + .enabled(this.voiceContent.length > 0) | ||
| 53 | + .onClick(() => { | ||
| 54 | + if (this.onSearchBtnClick) { | ||
| 55 | + this.onSearchBtnClick(this.voiceContent) | ||
| 56 | + } | ||
| 57 | + }) | ||
| 58 | + } | ||
| 59 | + .padding({ left: 12, right: 12 }) | ||
| 60 | + .width('100%') | ||
| 61 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 62 | + VoiceInputView({voiceRecoginizerResult:(result: string) => { | ||
| 63 | + this.voiceContent = result | ||
| 64 | + }}).height(150) | ||
| 65 | + }.backgroundColor(Color.White) | ||
| 66 | + .width('100%') | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +} |
| @@ -14,6 +14,9 @@ import { ConfirmLogoutDialog } from './ConfirmLogoutDialog'; | @@ -14,6 +14,9 @@ import { ConfirmLogoutDialog } from './ConfirmLogoutDialog'; | ||
| 14 | import { TrackingButton, TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; | 14 | import { TrackingButton, TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; |
| 15 | import { TitleBackComponent } from './TitleBackComponent'; | 15 | import { TitleBackComponent } from './TitleBackComponent'; |
| 16 | 16 | ||
| 17 | +import { AccountCenterItem } from '../../viewmodel/AccountCenterItem' | ||
| 18 | +import { it } from '@ohos/hypium'; | ||
| 19 | + | ||
| 17 | export { SettingPasswordParams } from "wdLogin" | 20 | export { SettingPasswordParams } from "wdLogin" |
| 18 | 21 | ||
| 19 | @Component | 22 | @Component |
| @@ -44,6 +47,11 @@ export struct AccountAndSecurityLayout { | @@ -44,6 +47,11 @@ export struct AccountAndSecurityLayout { | ||
| 44 | maskColor:"#00000000" | 47 | maskColor:"#00000000" |
| 45 | }) | 48 | }) |
| 46 | 49 | ||
| 50 | + accountCenterItem?: AccountCenterItem | ||
| 51 | + @State logOffWaitTime: string = "7" | ||
| 52 | + @State logOffMsg: string = "" | ||
| 53 | + @State userType: number = 0 | ||
| 54 | + | ||
| 47 | //注销账户 浏览埋点 | 55 | //注销账户 浏览埋点 |
| 48 | logoutLayoutHide(){ | 56 | logoutLayoutHide(){ |
| 49 | this.logoutLayoutHideTime = DateTimeUtils.getTimeStamp() | 57 | this.logoutLayoutHideTime = DateTimeUtils.getTimeStamp() |
| @@ -70,6 +78,9 @@ export struct AccountAndSecurityLayout { | @@ -70,6 +78,9 @@ export struct AccountAndSecurityLayout { | ||
| 70 | logoutViewModel = new LogoutViewModel() | 78 | logoutViewModel = new LogoutViewModel() |
| 71 | dialogController: CustomDialogController = new CustomDialogController({ | 79 | dialogController: CustomDialogController = new CustomDialogController({ |
| 72 | builder: CustomLogoutDialog({ | 80 | builder: CustomLogoutDialog({ |
| 81 | + logOffWaitTime: this.logOffWaitTime, | ||
| 82 | + logOffMsg: this.logOffMsg, | ||
| 83 | + userType: this.userType, | ||
| 73 | cancel: () => { | 84 | cancel: () => { |
| 74 | 85 | ||
| 75 | }, | 86 | }, |
| @@ -100,6 +111,7 @@ export struct AccountAndSecurityLayout { | @@ -100,6 +111,7 @@ export struct AccountAndSecurityLayout { | ||
| 100 | 111 | ||
| 101 | aboutToAppear() { | 112 | aboutToAppear() { |
| 102 | this.pageShowAccountTime = DateTimeUtils.getTimeStamp() | 113 | this.pageShowAccountTime = DateTimeUtils.getTimeStamp() |
| 114 | + this.userType = Number(SPHelper.default.getSync(SpConstants.USER_Type, '')) | ||
| 103 | // 获取设置页面数据 | 115 | // 获取设置页面数据 |
| 104 | this.getAccountAndSecurityData() | 116 | this.getAccountAndSecurityData() |
| 105 | this.addEmitEvent() | 117 | this.addEmitEvent() |
| @@ -129,6 +141,11 @@ export struct AccountAndSecurityLayout { | @@ -129,6 +141,11 @@ export struct AccountAndSecurityLayout { | ||
| 129 | } | 141 | } |
| 130 | this.listData = oldList | 142 | this.listData = oldList |
| 131 | 143 | ||
| 144 | + MineSettingDatasModel.fetchSecurityBindInfo().then((item) => { | ||
| 145 | + this.accountCenterItem = item | ||
| 146 | + this.logOffWaitTime = item.logOffWaitTime > 0 ? item.logOffWaitTime + "" : "7" | ||
| 147 | + this.logOffMsg = item.logOffMsg | ||
| 148 | + }) | ||
| 132 | } | 149 | } |
| 133 | 150 | ||
| 134 | addEmitEvent(){ | 151 | addEmitEvent(){ |
| @@ -338,6 +355,14 @@ export struct AccountAndSecurityLayout { | @@ -338,6 +355,14 @@ export struct AccountAndSecurityLayout { | ||
| 338 | .padding({ top: 24, left: 16 }) | 355 | .padding({ top: 24, left: 16 }) |
| 339 | .width('100%') | 356 | .width('100%') |
| 340 | 357 | ||
| 358 | + if (this.userType === 1 && this.logOffWaitTime.length > 0) { | ||
| 359 | + Text(`请注意:注销后${this.logOffWaitTime}天内不能再次注册人民日报客户端,需要等到账号冷静期结束才能再次登录注册`) | ||
| 360 | + .fontColor('#FFED2800') | ||
| 361 | + .fontSize(14) | ||
| 362 | + .fontWeight(400) | ||
| 363 | + .padding({ top: 32, left: "31lpx", right: "31lpx" }) | ||
| 364 | + .width('100%') | ||
| 365 | + } | ||
| 341 | Text('请注意:注销后7天内不能再次注册人民日报客户端,需要等到账号冷静期结束才能再次登录注册') | 366 | Text('请注意:注销后7天内不能再次注册人民日报客户端,需要等到账号冷静期结束才能再次登录注册') |
| 342 | .fontColor('#ED2800') | 367 | .fontColor('#ED2800') |
| 343 | .fontSize(14) | 368 | .fontSize(14) |
| 1 | +import { router } from '@kit.ArkUI' | ||
| 2 | + | ||
| 1 | @CustomDialog | 3 | @CustomDialog |
| 2 | export struct CustomLogoutDialog { | 4 | export struct CustomLogoutDialog { |
| 3 | controller: CustomDialogController | 5 | controller: CustomDialogController |
| @@ -5,18 +7,41 @@ export struct CustomLogoutDialog { | @@ -5,18 +7,41 @@ export struct CustomLogoutDialog { | ||
| 5 | } | 7 | } |
| 6 | confirm: () => void = () => { | 8 | confirm: () => void = () => { |
| 7 | } | 9 | } |
| 10 | + @Prop logOffWaitTime: string = "7" | ||
| 11 | + @Prop logOffMsg: string = "" | ||
| 12 | + @Prop userType: number = 0 | ||
| 8 | 13 | ||
| 9 | build() { | 14 | build() { |
| 10 | Column() { | 15 | Column() { |
| 11 | - Text("温馨提示") | 16 | + Text(this.userType !== 1 ? "温馨提醒" : "注销账号") |
| 12 | .fontColor("#222222") | 17 | .fontColor("#222222") |
| 13 | .fontSize(18) | 18 | .fontSize(18) |
| 14 | .width("100%") | 19 | .width("100%") |
| 15 | .fontWeight(FontWeight.Bold) | 20 | .fontWeight(FontWeight.Bold) |
| 16 | .textAlign(TextAlign.Center) | 21 | .textAlign(TextAlign.Center) |
| 17 | .margin({ top: 20 }) | 22 | .margin({ top: 20 }) |
| 18 | - Text('注销后7天内无法重新登录注册人民日报app,是否确认注销?') { | ||
| 19 | 23 | ||
| 24 | + if (this.userType !== 1) { | ||
| 25 | + Text(this.logOffMsg.length > 0 ? this.logOffMsg : "您确认要注销账号吗? 请联系rmh@pdnews.cn邮箱") { | ||
| 26 | + }.margin({ top: 12, left: 16, right: 16 }) | ||
| 27 | + .fontColor("#999999") | ||
| 28 | + Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') | ||
| 29 | + Text('知道了') | ||
| 30 | + .fontSize(16) | ||
| 31 | + .layoutWeight(1) | ||
| 32 | + .fontWeight(FontWeight.Medium) | ||
| 33 | + .textAlign(TextAlign.Center) | ||
| 34 | + .onClick(() => { | ||
| 35 | + this.controller.close() | ||
| 36 | + if (this.cancel) { | ||
| 37 | + this.cancel() | ||
| 38 | + } | ||
| 39 | + router.back() | ||
| 40 | + }) | ||
| 41 | + .height('100%') | ||
| 42 | + | ||
| 43 | + } else { | ||
| 44 | + Text(`注销后${this.logOffWaitTime}天内无法重新登录注册人民日报app,是否确认注销?`) { | ||
| 20 | }.margin({ top: 12, left: 16, right: 16 }) | 45 | }.margin({ top: 12, left: 16, right: 16 }) |
| 21 | 46 | ||
| 22 | Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') | 47 | Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp') |
| @@ -56,6 +81,7 @@ export struct CustomLogoutDialog { | @@ -56,6 +81,7 @@ export struct CustomLogoutDialog { | ||
| 56 | }) | 81 | }) |
| 57 | .height('100%') | 82 | .height('100%') |
| 58 | }.layoutWeight(1).justifyContent(FlexAlign.Center) | 83 | }.layoutWeight(1).justifyContent(FlexAlign.Center) |
| 84 | + } | ||
| 59 | }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%') | 85 | }.height(161).backgroundColor(Color.White).borderRadius(6).width('74%') |
| 60 | } | 86 | } |
| 61 | } | 87 | } |
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | export struct newsSkeleton { | 7 | export struct newsSkeleton { |
| 8 | @State quantity: Array<number> = [1, 2, 3,] | 8 | @State quantity: Array<number> = [1, 2, 3,] |
| 9 | @State showBottom: boolean = true | 9 | @State showBottom: boolean = true |
| 10 | - | 10 | + @Consume itemPicHeight: number |
| 11 | build() { | 11 | build() { |
| 12 | Row() { | 12 | Row() { |
| 13 | Column() { | 13 | Column() { |
| @@ -17,12 +17,12 @@ export struct newsSkeleton { | @@ -17,12 +17,12 @@ export struct newsSkeleton { | ||
| 17 | Column() { | 17 | Column() { |
| 18 | Image($r('app.media.peopleSeleton')) | 18 | Image($r('app.media.peopleSeleton')) |
| 19 | .width('100%') | 19 | .width('100%') |
| 20 | - .height(47)// 后缀名不能省略 | 20 | + .height(this.getCompHeight(47))// 后缀名不能省略 |
| 21 | .interpolation(ImageInterpolation.High) | 21 | .interpolation(ImageInterpolation.High) |
| 22 | .margin({ | 22 | .margin({ |
| 23 | bottom: 6 | 23 | bottom: 6 |
| 24 | }) | 24 | }) |
| 25 | - textArea('100%', 8) | 25 | + textArea('100%', this.getCompHeight(8),this.getCompHeight(5)) |
| 26 | } | 26 | } |
| 27 | .margin({ | 27 | .margin({ |
| 28 | right: '2%' | 28 | right: '2%' |
| @@ -33,20 +33,17 @@ export struct newsSkeleton { | @@ -33,20 +33,17 @@ export struct newsSkeleton { | ||
| 33 | Column() { | 33 | Column() { |
| 34 | Row() | 34 | Row() |
| 35 | .width(`100%`) | 35 | .width(`100%`) |
| 36 | - .height(25) | 36 | + .height(this.getCompHeight(25)) |
| 37 | .backgroundColor('#FFF5F5F5') | 37 | .backgroundColor('#FFF5F5F5') |
| 38 | Row() | 38 | Row() |
| 39 | .width(`100%`) | 39 | .width(`100%`) |
| 40 | - .height(4) | 40 | + .height(this.getCompHeight(4)) |
| 41 | .backgroundColor('#FFF5F5F5') | 41 | .backgroundColor('#FFF5F5F5') |
| 42 | - .margin({ top: 3, bottom: 3 }) | 42 | + .margin({ top: this.getCompHeight(3), bottom: this.getCompHeight(3) }) |
| 43 | Row() | 43 | Row() |
| 44 | .width(`100%`) | 44 | .width(`100%`) |
| 45 | - .height(20) | 45 | + .height(this.getCompHeight(20)) |
| 46 | .backgroundColor('#FFF5F5F5') | 46 | .backgroundColor('#FFF5F5F5') |
| 47 | - // textArea(27, 25) | ||
| 48 | - // textArea(27, 4) | ||
| 49 | - // textArea(27, 20) | ||
| 50 | } | 47 | } |
| 51 | .width(`22%`) | 48 | .width(`22%`) |
| 52 | .border({ width: 1 }) | 49 | .border({ width: 1 }) |
| @@ -63,59 +60,59 @@ export struct newsSkeleton { | @@ -63,59 +60,59 @@ export struct newsSkeleton { | ||
| 63 | .width('100%') | 60 | .width('100%') |
| 64 | 61 | ||
| 65 | BoxAndLine().width('100%') | 62 | BoxAndLine().width('100%') |
| 66 | - BoxAndBox({ firstBoxNumber: '65%', boxHeight: 100 }) | 63 | + BoxAndBox({ firstBoxNumber: '65%', boxHeight: this.getCompHeight(100) }) |
| 67 | Column() { | 64 | Column() { |
| 68 | - textArea('100%', 79) | 65 | + textArea('100%', this.getCompHeight(79),this.getCompHeight(5)) |
| 69 | } | 66 | } |
| 70 | 67 | ||
| 71 | - BoxAndBox({ firstBoxNumber: '30%', boxHeight: 51 }) | 68 | + BoxAndBox({ firstBoxNumber: '30%', boxHeight: this.getCompHeight(48) }) |
| 72 | 69 | ||
| 73 | } | 70 | } |
| 74 | - .width('50%') | 71 | + .width('49%') |
| 75 | .margin({ right: 5 }) | 72 | .margin({ right: 5 }) |
| 76 | 73 | ||
| 77 | Column() { | 74 | Column() { |
| 78 | Column() { | 75 | Column() { |
| 79 | - textArea('100%', 13) | 76 | + textArea('100%', this.getCompHeight(13),this.getCompHeight(0)) |
| 80 | }.width('100%') | 77 | }.width('100%') |
| 81 | 78 | ||
| 82 | Column() { | 79 | Column() { |
| 83 | - textArea('100%', 136) | ||
| 84 | - textArea('100%', 13) | ||
| 85 | - textArea('80%', 13) | 80 | + textArea('100%', this.getCompHeight(136),this.getCompHeight(5)) |
| 81 | + textArea('100%', this.getCompHeight(13),this.getCompHeight(5)) | ||
| 82 | + textArea('80%', this.getCompHeight(13),this.getCompHeight(5)) | ||
| 86 | }.width('100%').alignItems(HorizontalAlign.Start) | 83 | }.width('100%').alignItems(HorizontalAlign.Start) |
| 87 | 84 | ||
| 88 | Column() { | 85 | Column() { |
| 89 | - textArea('100%', 126) | 86 | + textArea('100%', this.getCompHeight(126),this.getCompHeight(5)) |
| 90 | } | 87 | } |
| 91 | 88 | ||
| 92 | Column() { | 89 | Column() { |
| 93 | - textArea('100%', 13) | 90 | + textArea('100%', this.getCompHeight(13),this.getCompHeight(5)) |
| 94 | } | 91 | } |
| 95 | 92 | ||
| 96 | Row() { | 93 | Row() { |
| 97 | Column() { | 94 | Column() { |
| 98 | - textArea('100%', 30) | 95 | + textArea('100%', this.getCompHeight(30),this.getCompHeight(5)) |
| 99 | }.width('50%').margin({ right: 5 }) | 96 | }.width('50%').margin({ right: 5 }) |
| 100 | 97 | ||
| 101 | Column() { | 98 | Column() { |
| 102 | - textArea('100%', 30) | 99 | + textArea('100%', this.getCompHeight(30),this.getCompHeight(5)) |
| 103 | }.layoutWeight(1) | 100 | }.layoutWeight(1) |
| 104 | }.width('100%').justifyContent(FlexAlign.SpaceBetween) | 101 | }.width('100%').justifyContent(FlexAlign.SpaceBetween) |
| 105 | 102 | ||
| 106 | Column() { | 103 | Column() { |
| 107 | - textArea('100%', 100) | 104 | + textArea('100%', this.getCompHeight(100),this.getCompHeight(5)) |
| 108 | } | 105 | } |
| 109 | } | 106 | } |
| 110 | - .width('50%') | 107 | + .width('49%') |
| 111 | } | 108 | } |
| 112 | .justifyContent(FlexAlign.SpaceBetween) | 109 | .justifyContent(FlexAlign.SpaceBetween) |
| 113 | .backgroundColor(Color.White) | 110 | .backgroundColor(Color.White) |
| 114 | .padding({ | 111 | .padding({ |
| 115 | - top: 15, | ||
| 116 | - bottom: 15, | ||
| 117 | - right: 15, | ||
| 118 | - left: 15 | 112 | + top: 14, |
| 113 | + right: 10, | ||
| 114 | + bottom: 14, | ||
| 115 | + left: 10 | ||
| 119 | }) | 116 | }) |
| 120 | if (this.showBottom) { | 117 | if (this.showBottom) { |
| 121 | // Column().backgroundColor('#CBCBCB').height(5).width(339) | 118 | // Column().backgroundColor('#CBCBCB').height(5).width(339) |
| @@ -133,17 +130,31 @@ export struct newsSkeleton { | @@ -133,17 +130,31 @@ export struct newsSkeleton { | ||
| 133 | .width('100%') | 130 | .width('100%') |
| 134 | 131 | ||
| 135 | } | 132 | } |
| 133 | + | ||
| 134 | + getCompHeight(height: number): number{ | ||
| 135 | + //设计图高度 478 | ||
| 136 | + let compH:number = height*px2vp(this.itemPicHeight)/478 | ||
| 137 | + return compH; | ||
| 138 | +} | ||
| 139 | + | ||
| 136 | } | 140 | } |
| 137 | 141 | ||
| 138 | @Component | 142 | @Component |
| 139 | struct BoxAndLine { | 143 | struct BoxAndLine { |
| 144 | + @Consume itemPicHeight: number | ||
| 140 | build() { | 145 | build() { |
| 141 | Column() { | 146 | Column() { |
| 142 | - textArea('100%', 130) | ||
| 143 | - textArea('100%', 13) | ||
| 144 | - textArea('80%', 13) | 147 | + textArea('100%', this.getCompHeight(130),this.getCompHeight(5)) |
| 148 | + textArea('100%', this.getCompHeight(13),this.getCompHeight(5)) | ||
| 149 | + textArea('80%', this.getCompHeight(13),this.getCompHeight(5)) | ||
| 145 | }.alignItems(HorizontalAlign.Start) | 150 | }.alignItems(HorizontalAlign.Start) |
| 146 | } | 151 | } |
| 152 | + | ||
| 153 | + getCompHeight(height: number): number{ | ||
| 154 | + //设计图高度 478 | ||
| 155 | + let compH:number = height*px2vp(this.itemPicHeight)/478 | ||
| 156 | + return compH; | ||
| 157 | + } | ||
| 147 | } | 158 | } |
| 148 | 159 | ||
| 149 | 160 | ||
| @@ -151,29 +162,37 @@ struct BoxAndLine { | @@ -151,29 +162,37 @@ struct BoxAndLine { | ||
| 151 | struct BoxAndBox { | 162 | struct BoxAndBox { |
| 152 | @Prop firstBoxNumber: number | Resource | string | 163 | @Prop firstBoxNumber: number | Resource | string |
| 153 | @Prop boxHeight: number | Resource | string | 164 | @Prop boxHeight: number | Resource | string |
| 154 | - | 165 | + @Consume itemPicHeight: number |
| 155 | build() { | 166 | build() { |
| 156 | Row() { | 167 | Row() { |
| 157 | Column() { | 168 | Column() { |
| 158 | - textArea('100%', this.boxHeight) | 169 | + textArea('100%', this.boxHeight,this.getCompHeight(5)) |
| 159 | }.width(this.firstBoxNumber).margin({ right: 5 }) | 170 | }.width(this.firstBoxNumber).margin({ right: 5 }) |
| 160 | 171 | ||
| 161 | Column() { | 172 | Column() { |
| 162 | - textArea('100%', this.boxHeight) | 173 | + textArea('100%', this.boxHeight,this.getCompHeight(5)) |
| 163 | }.layoutWeight(1) | 174 | }.layoutWeight(1) |
| 164 | }.width('100%').justifyContent(FlexAlign.SpaceBetween) | 175 | }.width('100%').justifyContent(FlexAlign.SpaceBetween) |
| 165 | } | 176 | } |
| 177 | + | ||
| 178 | + getCompHeight(height: number): number{ | ||
| 179 | + //设计图高度 478 | ||
| 180 | + let compH:number = height*px2vp(this.itemPicHeight)/478 | ||
| 181 | + return compH; | ||
| 182 | + } | ||
| 166 | } | 183 | } |
| 167 | 184 | ||
| 168 | @Builder | 185 | @Builder |
| 169 | -function textArea(width: number | Resource | string = '100%', height: number | Resource | string = '100%') { | 186 | +function textArea(width: number | Resource | string = '100%', height: number | Resource | string = '100%',topM:number) { |
| 170 | Row() | 187 | Row() |
| 171 | .width(width) | 188 | .width(width) |
| 172 | .height(height) | 189 | .height(height) |
| 173 | - .backgroundColor('#FFF5F5F5') | ||
| 174 | - .margin({ top: 5 }) | 190 | + .backgroundColor(height === 13?Color.Red:'#FFF5F5F5') |
| 191 | + .margin({ top: topM }) | ||
| 175 | // .borderRadius(5) | 192 | // .borderRadius(5) |
| 176 | } | 193 | } |
| 177 | 194 | ||
| 178 | 195 | ||
| 179 | 196 | ||
| 197 | + | ||
| 198 | + |
| @@ -65,11 +65,9 @@ export struct LiveHorizontalCardComponent { | @@ -65,11 +65,9 @@ export struct LiveHorizontalCardComponent { | ||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | liveToMore() { | 67 | liveToMore() { |
| 68 | + ProcessUtils.compJumpPage(this.compDTO) | ||
| 69 | + return; | ||
| 68 | if (!!this.compDTO.dataSourceType) { | 70 | if (!!this.compDTO.dataSourceType) { |
| 69 | - // if (this.compDTO.dataSourceType === 'OBJECT_POS') { | ||
| 70 | - // ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) | ||
| 71 | - // return; | ||
| 72 | - // } | ||
| 73 | if (this.compDTO.linkUrl) { | 71 | if (this.compDTO.linkUrl) { |
| 74 | let taskAction: Action = { | 72 | let taskAction: Action = { |
| 75 | type: 'JUMP_INNER_NEW_PAGE', | 73 | type: 'JUMP_INNER_NEW_PAGE', |
| @@ -84,14 +82,8 @@ export struct LiveHorizontalCardComponent { | @@ -84,14 +82,8 @@ export struct LiveHorizontalCardComponent { | ||
| 84 | } | 82 | } |
| 85 | } as Params, | 83 | } as Params, |
| 86 | }; | 84 | }; |
| 87 | - // this.compDTO.operDataList = [] | ||
| 88 | - // console.log('LiveHorizontalCardComponent', JSON.stringify(this.compDTO)) | ||
| 89 | - // console.log('LiveHorizontalCardComponent', this.compDTO.relId) | ||
| 90 | - // console.log('LiveHorizontalCardComponent', this.compDTO.relType) | ||
| 91 | - // console.log('LiveHorizontalCardComponent', JSON.stringify(taskAction)) | ||
| 92 | WDRouterRule.jumpWithAction(taskAction) | 85 | WDRouterRule.jumpWithAction(taskAction) |
| 93 | } else { | 86 | } else { |
| 94 | - // console.log('LiveHorizontalCardComponent', 'jumpToLiveMorePage') | ||
| 95 | this.jumpToLiveMorePage() | 87 | this.jumpToLiveMorePage() |
| 96 | } | 88 | } |
| 97 | } else { | 89 | } else { |
| @@ -103,7 +95,6 @@ export struct LiveHorizontalCardComponent { | @@ -103,7 +95,6 @@ export struct LiveHorizontalCardComponent { | ||
| 103 | linkUrl: this.compDTO.linkUrl, | 95 | linkUrl: this.compDTO.linkUrl, |
| 104 | pageId: this.compDTO.pageId | 96 | pageId: this.compDTO.pageId |
| 105 | } as ContentDTO | 97 | } as ContentDTO |
| 106 | - // console.log('LiveHorizontalCardComponent', 'ProcessUtils.processPage') | ||
| 107 | ProcessUtils.processPage(contentDTO) | 98 | ProcessUtils.processPage(contentDTO) |
| 108 | } | 99 | } |
| 109 | } | 100 | } |
| @@ -146,7 +137,8 @@ export struct LiveHorizontalCardComponent { | @@ -146,7 +137,8 @@ export struct LiveHorizontalCardComponent { | ||
| 146 | this.liveToMore(); | 137 | this.liveToMore(); |
| 147 | }) | 138 | }) |
| 148 | } | 139 | } |
| 149 | - }.justifyContent(FlexAlign.SpaceBetween) | 140 | + } |
| 141 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 150 | // .padding({ left: 16, right: 16 }) | 142 | // .padding({ left: 16, right: 16 }) |
| 151 | .margin({ bottom: 10 }) | 143 | .margin({ bottom: 10 }) |
| 152 | .width(CommonConstants.FULL_WIDTH) | 144 | .width(CommonConstants.FULL_WIDTH) |
| @@ -184,7 +176,7 @@ export struct LiveHorizontalCardComponent { | @@ -184,7 +176,7 @@ export struct LiveHorizontalCardComponent { | ||
| 184 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | 176 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) |
| 185 | .lineHeight(21) | 177 | .lineHeight(21) |
| 186 | } | 178 | } |
| 187 | - .height(this.compDTO.operDataList.length == 2 ? 180 : 148) | 179 | + .height(this.compDTO.operDataList.length == 2 ? 167 : 134) |
| 188 | .padding({ right: 8 }) | 180 | .padding({ right: 8 }) |
| 189 | .onClick(() => { | 181 | .onClick(() => { |
| 190 | InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) | 182 | InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) |
| @@ -246,7 +238,7 @@ export struct LiveHorizontalCardComponent { | @@ -246,7 +238,7 @@ export struct LiveHorizontalCardComponent { | ||
| 246 | } | 238 | } |
| 247 | }) | 239 | }) |
| 248 | .width(CommonConstants.FULL_WIDTH) | 240 | .width(CommonConstants.FULL_WIDTH) |
| 249 | - .height(this.compDTO.operDataList.length == 2 ? 180 : 148) | 241 | + .height(this.compDTO.operDataList.length == 2 ? 167 : 134) |
| 250 | } else if (this.compDTO.operDataList.length) { | 242 | } else if (this.compDTO.operDataList.length) { |
| 251 | // 一个 | 243 | // 一个 |
| 252 | LiveHorizontalCardForOneComponent({ contentDTO: this.compDTO.operDataList[0] }) | 244 | LiveHorizontalCardForOneComponent({ contentDTO: this.compDTO.operDataList[0] }) |
| @@ -19,7 +19,7 @@ export struct FirstLevelComponent { | @@ -19,7 +19,7 @@ export struct FirstLevelComponent { | ||
| 19 | Column(){ | 19 | Column(){ |
| 20 | Column(){ | 20 | Column(){ |
| 21 | if (this.labelList.length === 0){ | 21 | if (this.labelList.length === 0){ |
| 22 | - Text('暂无数据').fontSize(20) | 22 | + Text('').fontSize(20) |
| 23 | }else { | 23 | }else { |
| 24 | TextPicker({range:this.labelList,selected:this.select}) | 24 | TextPicker({range:this.labelList,selected:this.select}) |
| 25 | .canLoop(false) | 25 | .canLoop(false) |
| @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | ||
| 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; | 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; |
| 3 | @Component | 3 | @Component |
| 4 | export struct SecondLevelComponent { | 4 | export struct SecondLevelComponent { |
| 5 | - @State mTip: string = '暂无数据' | 5 | + @State mTip: string = '' |
| 6 | @State labelList: string[] = []; | 6 | @State labelList: string[] = []; |
| 7 | @State select: number = 0; | 7 | @State select: number = 0; |
| 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; | 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; |
| @@ -43,14 +43,19 @@ export struct SecondLevelComponent { | @@ -43,14 +43,19 @@ export struct SecondLevelComponent { | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | if (!this.currentFirst) { | 45 | if (!this.currentFirst) { |
| 46 | - this.mTip = '暂无数据'; | 46 | + this.mTip = ''; |
| 47 | } else { | 47 | } else { |
| 48 | this.labelList = [] | 48 | this.labelList = [] |
| 49 | for (let index = 0; index < this.currentFirst.children.length; index++) { | 49 | for (let index = 0; index < this.currentFirst.children.length; index++) { |
| 50 | const element = this.currentFirst.children[index]; | 50 | const element = this.currentFirst.children[index]; |
| 51 | this.labelList.push(element.label) | 51 | this.labelList.push(element.label) |
| 52 | } | 52 | } |
| 53 | + if (this.currentFirst.children.length > 0) { | ||
| 53 | this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select]) | 54 | this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select]) |
| 55 | + }else { | ||
| 56 | + this.currentSecondBean = new AreaListManageModel('0','0','0',[]) | ||
| 57 | + } | ||
| 58 | + | ||
| 54 | } | 59 | } |
| 55 | } | 60 | } |
| 56 | } | 61 | } |
| @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | @@ -2,7 +2,7 @@ import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel | ||
| 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; | 2 | import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; |
| 3 | @Component | 3 | @Component |
| 4 | export struct ThirdLevelComponent { | 4 | export struct ThirdLevelComponent { |
| 5 | - @State mTip: string = '暂无数据' | 5 | + @State mTip: string = '' |
| 6 | @State labelList: string[] = []; | 6 | @State labelList: string[] = []; |
| 7 | @State select: number = 0; | 7 | @State select: number = 0; |
| 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; | 8 | @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; |
| @@ -52,14 +52,19 @@ export struct ThirdLevelComponent { | @@ -52,14 +52,19 @@ export struct ThirdLevelComponent { | ||
| 52 | this.select = 0 | 52 | this.select = 0 |
| 53 | } | 53 | } |
| 54 | if (!this.currentSecondBean) { | 54 | if (!this.currentSecondBean) { |
| 55 | - this.mTip = '暂无数据'; | 55 | + this.mTip = ''; |
| 56 | } else { | 56 | } else { |
| 57 | this.labelList = [] | 57 | this.labelList = [] |
| 58 | for (let index = 0; index < this.currentSecondBean.children.length; index++) { | 58 | for (let index = 0; index < this.currentSecondBean.children.length; index++) { |
| 59 | const element = this.currentSecondBean.children[index]; | 59 | const element = this.currentSecondBean.children[index]; |
| 60 | this.labelList.push(element.label) | 60 | this.labelList.push(element.label) |
| 61 | } | 61 | } |
| 62 | + | ||
| 63 | + if (this.currentSecondBean.children.length > 0) { | ||
| 62 | this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select]) | 64 | this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select]) |
| 65 | + }else { | ||
| 66 | + this.currentThirdBean = new AreaListManageModel('0','0','0',[]) | ||
| 67 | + } | ||
| 63 | } | 68 | } |
| 64 | } | 69 | } |
| 65 | } | 70 | } |
| @@ -21,6 +21,7 @@ export struct ENewspaperListDialog { | @@ -21,6 +21,7 @@ export struct ENewspaperListDialog { | ||
| 21 | @State scrollOffset: number = 0 | 21 | @State scrollOffset: number = 0 |
| 22 | @State isCurrentViewOpen: boolean = false | 22 | @State isCurrentViewOpen: boolean = false |
| 23 | @Consume bottomSafeHeight: number | 23 | @Consume bottomSafeHeight: number |
| 24 | + @Consume topMargin:number | ||
| 24 | //文字版选择弹框 | 25 | //文字版选择弹框 |
| 25 | pageListDialogController: CustomDialogController = new CustomDialogController({ | 26 | pageListDialogController: CustomDialogController = new CustomDialogController({ |
| 26 | builder: ENewspaperPageDialog({ | 27 | builder: ENewspaperPageDialog({ |
| @@ -292,7 +293,7 @@ export struct ENewspaperListDialog { | @@ -292,7 +293,7 @@ export struct ENewspaperListDialog { | ||
| 292 | left: 15, | 293 | left: 15, |
| 293 | right: 15, | 294 | right: 15, |
| 294 | // top: 16, | 295 | // top: 16, |
| 295 | - // bottom: 16 | 296 | + bottom: 25 |
| 296 | }) | 297 | }) |
| 297 | .margin({ | 298 | .margin({ |
| 298 | bottom: 85 | 299 | bottom: 85 |
| @@ -317,15 +318,13 @@ export struct ENewspaperListDialog { | @@ -317,15 +318,13 @@ export struct ENewspaperListDialog { | ||
| 317 | 318 | ||
| 318 | }) | 319 | }) |
| 319 | } | 320 | } |
| 320 | - .margin({ top: this.topHeight }) | 321 | + .margin({ top: this.topHeight + this.topMargin}) |
| 321 | .width('100%') | 322 | .width('100%') |
| 322 | .backgroundColor(Color.White) | 323 | .backgroundColor(Color.White) |
| 323 | - | ||
| 324 | } | 324 | } |
| 325 | .width('100%') | 325 | .width('100%') |
| 326 | .height('100%') | 326 | .height('100%') |
| 327 | .backgroundColor('#80000000') | 327 | .backgroundColor('#80000000') |
| 328 | - .margin({ bottom: 50 }) | ||
| 329 | .onClick(() => { | 328 | .onClick(() => { |
| 330 | if (this.closeDialog) { | 329 | if (this.closeDialog) { |
| 331 | this.closeDialog() | 330 | this.closeDialog() |
| @@ -5,7 +5,7 @@ import { Logger, SPHelper } from 'wdKit'; | @@ -5,7 +5,7 @@ import { Logger, SPHelper } from 'wdKit'; | ||
| 5 | import { MineMainSettingFunctionItem } from '../viewmodel/MineMainSettingFunctionItem'; | 5 | import { MineMainSettingFunctionItem } from '../viewmodel/MineMainSettingFunctionItem'; |
| 6 | import { SpConstants } from 'wdConstant/Index'; | 6 | import { SpConstants } from 'wdConstant/Index'; |
| 7 | import { CheckSetPasswordItem } from '../viewmodel/CheckSetPasswordItem'; | 7 | import { CheckSetPasswordItem } from '../viewmodel/CheckSetPasswordItem'; |
| 8 | - | 8 | +import { AccountCenterItem } from '../viewmodel/AccountCenterItem'; |
| 9 | 9 | ||
| 10 | const TAG = "MineSettingDatasModel" | 10 | const TAG = "MineSettingDatasModel" |
| 11 | 11 | ||
| @@ -111,4 +111,22 @@ export class MineSettingDatasModel { | @@ -111,4 +111,22 @@ export class MineSettingDatasModel { | ||
| 111 | return WDHttp.get<ResponseDTO<CheckSetPasswordItem>>(url) | 111 | return WDHttp.get<ResponseDTO<CheckSetPasswordItem>>(url) |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | + static fetchSecurityBindInfo() { | ||
| 115 | + return new Promise<AccountCenterItem>((success, error) => { | ||
| 116 | + Logger.info(TAG, `AccountCenterItem start`); | ||
| 117 | + WDHttp.get<ResponseDTO<AccountCenterItem>>(HttpUrlUtils.querySecurity()).then((navResDTO: ResponseDTO<AccountCenterItem>) => { | ||
| 118 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 119 | + error(navResDTO.message) | ||
| 120 | + return | ||
| 121 | + } | ||
| 122 | + Logger.info(TAG, "AccountCenterItem then,checkSetPasswordResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 123 | + let navigationBean = navResDTO.data as AccountCenterItem | ||
| 124 | + success(navigationBean); | ||
| 125 | + }).catch((err: Error) => { | ||
| 126 | + Logger.error(TAG, `AccountCenterItem catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 127 | + error(err) | ||
| 128 | + }) | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + | ||
| 114 | } | 132 | } |
| 1 | +export class AccountCenterItem { | ||
| 2 | + id: string = "" // 用户id | ||
| 3 | + phone: string = "" //手机号,脱敏处理中间用****代替 | ||
| 4 | + qqBinding: string = "" | ||
| 5 | + wechatBinding: string = "" | ||
| 6 | + weiboBinding: string = "" | ||
| 7 | + appIdBinding: string = "" | ||
| 8 | + ///注销冷静期 | ||
| 9 | + logOffWaitTime: number = 0 | ||
| 10 | + logOffMsg: string = "" | ||
| 11 | +} |
| 1 | +import { AuthorListDTO, FullColumnImgUrlDTO, ReLInfoDTO, RmhInfoDTO, ShareInfoDTO, | ||
| 2 | + UserInfoDTO, | ||
| 3 | + VideoInfoDTO } from 'wdBean'; | ||
| 4 | + | ||
| 5 | +@Observed | ||
| 6 | +export class ContentDetailModel{ | ||
| 7 | + newsId: number = 0; | ||
| 8 | + newsTitle: string = ""; | ||
| 9 | + newsShortTitle: string= ""; | ||
| 10 | + newsDownTitle: string= ""; | ||
| 11 | + newsBodyTitle: string= ""; | ||
| 12 | + publishTime: string= ""; | ||
| 13 | + appstyle: number= 0; | ||
| 14 | + newsType: number= 0; | ||
| 15 | + newsSummary: string= ""; | ||
| 16 | + newsSource: string= ""; | ||
| 17 | + newsSourceName: string= ""; | ||
| 18 | + newsContent: string= ""; | ||
| 19 | + newsContentBak: string= ""; | ||
| 20 | + newsLinkUrl: string=""; | ||
| 21 | + bestNoticer: number= 0; | ||
| 22 | + // newLinkObject?: any = null; | ||
| 23 | + newIntroduction: string= ""; | ||
| 24 | + authorList: AuthorListDTO[]=[]; | ||
| 25 | + editorName: string=""; | ||
| 26 | + openAudio: number= 0; | ||
| 27 | + // audioList: any[]; | ||
| 28 | + // hasPopUp?: any; | ||
| 29 | + // popUps?: any[]; | ||
| 30 | + firstFrameImageUri: string= ""; | ||
| 31 | + reLInfo?: ReLInfoDTO | null = null; | ||
| 32 | + fullColumnImgUrls: FullColumnImgUrlDTO[]=[]; | ||
| 33 | + shareInfo?: ShareInfoDTO | null = null; | ||
| 34 | + // photoList: any[]; | ||
| 35 | + videoInfo: VideoInfoDTO[]=[]; | ||
| 36 | + // liveInfo?: any ; | ||
| 37 | + // voteInfo?: any; | ||
| 38 | + rmhInfo?: RmhInfoDTO | null = null; | ||
| 39 | + userInfo?: UserInfoDTO | null = null; | ||
| 40 | + openLikes: number= 0; | ||
| 41 | + openComment: number= 0; | ||
| 42 | + likesStyle: number= 0; | ||
| 43 | + preCommentFlag: number= 0; | ||
| 44 | + commentDisplay: number= 0; | ||
| 45 | + keyArticle: number= 0; | ||
| 46 | + rmhPlatform: number= 0; | ||
| 47 | + readFlag?: number= 0; | ||
| 48 | + // topicInfo?: any; | ||
| 49 | + traceId: string= ""; | ||
| 50 | + itemId: string= ""; | ||
| 51 | + sceneId: string= ""; | ||
| 52 | + subSceneId: string= ""; | ||
| 53 | + // activityInfos: any[]=[]; | ||
| 54 | + recommendShow: number= 0; | ||
| 55 | + visitorComment: number= 0; | ||
| 56 | + itemTypeCode: string= ""; | ||
| 57 | + menuShow: number= 0; | ||
| 58 | + newsTags: string= ""; | ||
| 59 | + // specialColumnId?: any; | ||
| 60 | + specialColumnName: string= ""; | ||
| 61 | + // timeline?: any; | ||
| 62 | + | ||
| 63 | + constructor(newsId: number, newsTitle: string, newsShortTitle: string, newsDownTitle: string, newsBodyTitle: string, | ||
| 64 | + publishTime: string, appstyle: number, newsType: number, newsSummary: string, newsSource: string, | ||
| 65 | + newsSourceName: string, newsContent: string, newsContentBak: string, newsLinkUrl: string, bestNoticer: number, | ||
| 66 | + newIntroduction: string, authorList: AuthorListDTO[], editorName: string, openAudio: number, | ||
| 67 | + firstFrameImageUri: string,fullColumnImgUrls: FullColumnImgUrlDTO[], videoInfo: VideoInfoDTO[], | ||
| 68 | + openLikes: number, openComment: number, likesStyle: number, preCommentFlag: number, | ||
| 69 | + commentDisplay: number, keyArticle: number, rmhPlatform: number, readFlag: number, traceId: string, | ||
| 70 | + itemId: string, sceneId: string, subSceneId: string, recommendShow: number, | ||
| 71 | + visitorComment: number, itemTypeCode: string, menuShow: number, newsTags: string, | ||
| 72 | + specialColumnName: string, traceInfo: string, viewCount: number, isNewspaper: boolean, oldNewsId: string, | ||
| 73 | + showTime: boolean, isLogin: string) { | ||
| 74 | + this.newsId = newsId; | ||
| 75 | + this.newsTitle = newsTitle; | ||
| 76 | + this.newsShortTitle = newsShortTitle; | ||
| 77 | + this.newsDownTitle = newsDownTitle; | ||
| 78 | + this.newsBodyTitle = newsBodyTitle; | ||
| 79 | + this.publishTime = publishTime; | ||
| 80 | + this.appstyle = appstyle; | ||
| 81 | + this.newsType = newsType; | ||
| 82 | + this.newsSummary = newsSummary; | ||
| 83 | + this.newsSource = newsSource; | ||
| 84 | + this.newsSourceName = newsSourceName; | ||
| 85 | + this.newsContent = newsContent; | ||
| 86 | + this.newsContentBak = newsContentBak; | ||
| 87 | + this.newsLinkUrl = newsLinkUrl; | ||
| 88 | + this.bestNoticer = bestNoticer; | ||
| 89 | + this.newIntroduction = newIntroduction; | ||
| 90 | + this.authorList = authorList; | ||
| 91 | + this.editorName = editorName; | ||
| 92 | + this.openAudio = openAudio; | ||
| 93 | + this.firstFrameImageUri = firstFrameImageUri; | ||
| 94 | + this.fullColumnImgUrls = fullColumnImgUrls; | ||
| 95 | + this.videoInfo = videoInfo; | ||
| 96 | + this.openLikes = openLikes; | ||
| 97 | + this.openComment = openComment; | ||
| 98 | + this.likesStyle = likesStyle; | ||
| 99 | + this.preCommentFlag = preCommentFlag; | ||
| 100 | + this.commentDisplay = commentDisplay; | ||
| 101 | + this.keyArticle = keyArticle; | ||
| 102 | + this.rmhPlatform = rmhPlatform; | ||
| 103 | + this.readFlag = readFlag; | ||
| 104 | + this.traceId = traceId; | ||
| 105 | + this.itemId = itemId; | ||
| 106 | + this.sceneId = sceneId; | ||
| 107 | + this.subSceneId = subSceneId; | ||
| 108 | + this.recommendShow = recommendShow; | ||
| 109 | + this.visitorComment = visitorComment; | ||
| 110 | + this.itemTypeCode = itemTypeCode; | ||
| 111 | + this.menuShow = menuShow; | ||
| 112 | + this.newsTags = newsTags; | ||
| 113 | + this.specialColumnName = specialColumnName; | ||
| 114 | + this.traceInfo = traceInfo; | ||
| 115 | + this.viewCount = viewCount; | ||
| 116 | + this.isNewspaper = isNewspaper; | ||
| 117 | + this.oldNewsId = oldNewsId; | ||
| 118 | + this.showTime = showTime; | ||
| 119 | + this.isLogin = isLogin; | ||
| 120 | + } | ||
| 121 | + traceInfo: string= ""; | ||
| 122 | + viewCount: number= 0; | ||
| 123 | + isNewspaper: boolean = false; | ||
| 124 | + oldNewsId: string= ""; | ||
| 125 | + | ||
| 126 | + | ||
| 127 | + // 本地字段 | ||
| 128 | + showTime:boolean = false; | ||
| 129 | + isLogin?:string = "" | ||
| 130 | +} |
sight_harmony/features/wdComponent/src/main/resources/base/media/WDInput_voice_longPress_icon.png
0 → 100644
7.3 KB
1.41 KB
| @@ -17,6 +17,6 @@ | @@ -17,6 +17,6 @@ | ||
| 17 | "wdRouter": "file:../../commons/wdRouter", | 17 | "wdRouter": "file:../../commons/wdRouter", |
| 18 | "wdTracking": "file:../../features/wdTracking", | 18 | "wdTracking": "file:../../features/wdTracking", |
| 19 | "wdShare": "file:../../features/wdShare", | 19 | "wdShare": "file:../../features/wdShare", |
| 20 | - "@rongcloud/imlib": "file:./src/main/libs/RongIMLib.har" | 20 | + "@rongcloud/imlib": "file:./src/main/libs/RongIMLib-HarmonyOS-signed-V1.1.0.har" |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
| @@ -14,7 +14,7 @@ import { LiveMessageIsHistoryMessage, LiveMessageOptType } from 'wdBean/src/main | @@ -14,7 +14,7 @@ import { LiveMessageIsHistoryMessage, LiveMessageOptType } from 'wdBean/src/main | ||
| 14 | 14 | ||
| 15 | const TAG = "LiveRoomManager" | 15 | const TAG = "LiveRoomManager" |
| 16 | 16 | ||
| 17 | -export class LiveRoom extends ChatroomStatusListener { | 17 | +export class LiveRoom implements ChatroomStatusListener { |
| 18 | 18 | ||
| 19 | connectRoomBaseInfo?: LiveRoomBaseInfo | 19 | connectRoomBaseInfo?: LiveRoomBaseInfo |
| 20 | 20 | ||
| @@ -28,7 +28,6 @@ export class LiveRoom extends ChatroomStatusListener { | @@ -28,7 +28,6 @@ export class LiveRoom extends ChatroomStatusListener { | ||
| 28 | onLiveMessage?: (liveRoomItemBean: LiveRoomItemBean) => void | 28 | onLiveMessage?: (liveRoomItemBean: LiveRoomItemBean) => void |
| 29 | 29 | ||
| 30 | constructor(baseInfo?: LiveRoomBaseInfo) { | 30 | constructor(baseInfo?: LiveRoomBaseInfo) { |
| 31 | - super() | ||
| 32 | this.connectRoomBaseInfo = baseInfo | 31 | this.connectRoomBaseInfo = baseInfo |
| 33 | } | 32 | } |
| 34 | 33 |
| @@ -184,9 +184,11 @@ export class LiveRoomManager { | @@ -184,9 +184,11 @@ export class LiveRoomManager { | ||
| 184 | if (data.data) { | 184 | if (data.data) { |
| 185 | success(data.data) | 185 | success(data.data) |
| 186 | } else { | 186 | } else { |
| 187 | + Logger.error(TAG, "接口没返回im token") | ||
| 187 | fail(data.message) | 188 | fail(data.message) |
| 188 | } | 189 | } |
| 189 | }).catch((error: Error) => { | 190 | }).catch((error: Error) => { |
| 191 | + Logger.error(TAG, "error " + JSON.stringify(error)) | ||
| 190 | fail(error.message) | 192 | fail(error.message) |
| 191 | }) | 193 | }) |
| 192 | }) | 194 | }) |
sight_harmony/features/wdDetailPlayLive/src/main/libs/RongIMLib-HarmonyOS-signed-V1.1.0.har
0 → 100644
This file is too large to display.
This file is too large to display.
| @@ -9,13 +9,14 @@ import { | @@ -9,13 +9,14 @@ import { | ||
| 9 | contentListParams, | 9 | contentListParams, |
| 10 | getRecCompInfoParams | 10 | getRecCompInfoParams |
| 11 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 11 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 12 | -import { NetworkUtil, Logger, WindowModel, DateTimeUtils } from 'wdKit/Index'; | 12 | +import { NetworkUtil, Logger, WindowModel, DateTimeUtils, LazyDataSource } from 'wdKit/Index'; |
| 13 | import { PictureLoading } from './PictureLoading'; | 13 | import { PictureLoading } from './PictureLoading'; |
| 14 | import { DisplayDirection } from 'wdConstant/Index'; | 14 | import { DisplayDirection } from 'wdConstant/Index'; |
| 15 | import { window } from '@kit.ArkUI'; | 15 | import { window } from '@kit.ArkUI'; |
| 16 | import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; | 16 | import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; |
| 17 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; | 17 | import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; |
| 18 | import { LottieView } from 'wdComponent/Index' | 18 | import { LottieView } from 'wdComponent/Index' |
| 19 | +import lottie from '@ohos/lottie'; | ||
| 19 | 20 | ||
| 20 | interface loadMoreData { | 21 | interface loadMoreData { |
| 21 | pageNum: number; | 22 | pageNum: number; |
| @@ -57,6 +58,7 @@ export struct VideoChannelDetail { | @@ -57,6 +58,7 @@ export struct VideoChannelDetail { | ||
| 57 | @Consume displayDirection: DisplayDirection | 58 | @Consume displayDirection: DisplayDirection |
| 58 | @Provide showCommentList: boolean = false | 59 | @Provide showCommentList: boolean = false |
| 59 | @State data: ContentDetailDTO[] = [] | 60 | @State data: ContentDetailDTO[] = [] |
| 61 | + @State dataContentDetail: LazyDataSource<ContentDetailDTO> = new LazyDataSource(); | ||
| 60 | @State currentIndex: number = 0 | 62 | @State currentIndex: number = 0 |
| 61 | @State interactDataList: InteractDataDTO[] = [] | 63 | @State interactDataList: InteractDataDTO[] = [] |
| 62 | @State totalCount: number = 0 | 64 | @State totalCount: number = 0 |
| @@ -256,6 +258,7 @@ export struct VideoChannelDetail { | @@ -256,6 +258,7 @@ export struct VideoChannelDetail { | ||
| 256 | if (res.data) { | 258 | if (res.data) { |
| 257 | await this.getContentInteract(list2) | 259 | await this.getContentInteract(list2) |
| 258 | this.data = this.data.concat(res.data) | 260 | this.data = this.data.concat(res.data) |
| 261 | + this.dataContentDetail.addItems(res.data) | ||
| 259 | } | 262 | } |
| 260 | console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data)) | 263 | console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data)) |
| 261 | }).finally(() => { | 264 | }).finally(() => { |
| @@ -304,7 +307,8 @@ export struct VideoChannelDetail { | @@ -304,7 +307,8 @@ export struct VideoChannelDetail { | ||
| 304 | .visibility(this.isMouted ? Visibility.None : Visibility.Visible) | 307 | .visibility(this.isMouted ? Visibility.None : Visibility.Visible) |
| 305 | 308 | ||
| 306 | Swiper(this.swiperController) { | 309 | Swiper(this.swiperController) { |
| 307 | - ForEach(this.data, (item: ContentDetailDTO, index: number) => { | 310 | + // LazyForEach(this.data, (item: ContentDetailDTO, index: number) => { |
| 311 | + LazyForEach(this.dataContentDetail, (item: ContentDetailDTO, index: number) => { | ||
| 308 | DetailPlayShortVideoPage({ | 312 | DetailPlayShortVideoPage({ |
| 309 | contentDetailData: item, | 313 | contentDetailData: item, |
| 310 | currentIndex: this.currentIndex, | 314 | currentIndex: this.currentIndex, |
| @@ -314,6 +318,7 @@ export struct VideoChannelDetail { | @@ -314,6 +318,7 @@ export struct VideoChannelDetail { | ||
| 314 | }, (item: ContentDetailDTO) => item.newsId + '') | 318 | }, (item: ContentDetailDTO) => item.newsId + '') |
| 315 | } | 319 | } |
| 316 | .displayCount(1, true) | 320 | .displayCount(1, true) |
| 321 | + .cachedCount(3) | ||
| 317 | .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || this.showCommentList ? false : true) | 322 | .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || this.showCommentList ? false : true) |
| 318 | .visibility(this.isMouted ? Visibility.Visible : Visibility.Hidden) | 323 | .visibility(this.isMouted ? Visibility.Visible : Visibility.Hidden) |
| 319 | .indicator(false) | 324 | .indicator(false) |
| @@ -352,9 +357,10 @@ export struct VideoChannelDetail { | @@ -352,9 +357,10 @@ export struct VideoChannelDetail { | ||
| 352 | autoplay: true, | 357 | autoplay: true, |
| 353 | loop: true | 358 | loop: true |
| 354 | }) | 359 | }) |
| 355 | - .visibility(this.isMouted && this.GestureLoadStrategy == 0 ? Visibility.Visible : Visibility.Hidden) | 360 | + .visibility(this.isMouted && this.GestureLoadStrategy == 0 ? Visibility.Visible : Visibility.None) |
| 356 | .onTouch(() => { | 361 | .onTouch(() => { |
| 357 | this.GestureLoadStrategy = 1 | 362 | this.GestureLoadStrategy = 1 |
| 363 | + lottie.destroy('slider_up_view_more') | ||
| 358 | }) | 364 | }) |
| 359 | 365 | ||
| 360 | } | 366 | } |
| @@ -51,6 +51,7 @@ export struct DetailDialog { | @@ -51,6 +51,7 @@ export struct DetailDialog { | ||
| 51 | .margin({ top: 8, bottom: 8 }) | 51 | .margin({ top: 8, bottom: 8 }) |
| 52 | } | 52 | } |
| 53 | .alignItems(HorizontalAlign.Start) | 53 | .alignItems(HorizontalAlign.Start) |
| 54 | + .margin({right:4}) | ||
| 54 | 55 | ||
| 55 | } | 56 | } |
| 56 | .height(200) | 57 | .height(200) |
| @@ -79,7 +80,7 @@ export struct DetailDialog { | @@ -79,7 +80,7 @@ export struct DetailDialog { | ||
| 79 | top: 20, | 80 | top: 20, |
| 80 | bottom: 30, | 81 | bottom: 30, |
| 81 | left: 16, | 82 | left: 16, |
| 82 | - right: 16 | 83 | + right: 12 //给滚动条预留4像素 |
| 83 | }) | 84 | }) |
| 84 | 85 | ||
| 85 | } | 86 | } |
| @@ -29,7 +29,7 @@ export struct PlayerBottomView { | @@ -29,7 +29,7 @@ export struct PlayerBottomView { | ||
| 29 | .markAnchor({ y: '100%' }) | 29 | .markAnchor({ y: '100%' }) |
| 30 | .linearGradient({ | 30 | .linearGradient({ |
| 31 | colors: [ | 31 | colors: [ |
| 32 | - ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.4)', 1.0] | 32 | + ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.5)', 1.0] |
| 33 | ] | 33 | ] |
| 34 | }) | 34 | }) |
| 35 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? | 35 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? |
| @@ -94,8 +94,7 @@ export struct PlayerTitleView { | @@ -94,8 +94,7 @@ export struct PlayerTitleView { | ||
| 94 | } | 94 | } |
| 95 | clipStr += strArr[i] | 95 | clipStr += strArr[i] |
| 96 | } | 96 | } |
| 97 | - clipStr += this.isOverLines ? '...' : ''; | ||
| 98 | - console.log(TAG, 'clipStr2:', clipStr) | 97 | + console.log(TAG, 'clipStr:', clipStr) |
| 99 | return clipStr | 98 | return clipStr |
| 100 | } | 99 | } |
| 101 | 100 | ||
| @@ -131,8 +130,7 @@ export struct PlayerTitleView { | @@ -131,8 +130,7 @@ export struct PlayerTitleView { | ||
| 131 | } | 130 | } |
| 132 | clipStr += strArr[i] | 131 | clipStr += strArr[i] |
| 133 | } | 132 | } |
| 134 | - console.log(TAG, 'clipTitleText clipStr1:', clipStr) | ||
| 135 | - clipStr += this.isTitleOverLines ? '...' : ''; | 133 | + console.log(TAG, 'clipTitleText clipStr:', clipStr) |
| 136 | return clipStr | 134 | return clipStr |
| 137 | } | 135 | } |
| 138 | 136 | ||
| @@ -219,54 +217,7 @@ export struct PlayerTitleView { | @@ -219,54 +217,7 @@ export struct PlayerTitleView { | ||
| 219 | // }) | 217 | // }) |
| 220 | // } | 218 | // } |
| 221 | // } else { | 219 | // } else { |
| 222 | - this.detailDesc() | ||
| 223 | - // } | ||
| 224 | - Text(DateTimeUtils.formatDate(new Date(this.contentDetailData?.publishTime).getTime(), | ||
| 225 | - DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM)) | ||
| 226 | - .fontSize(12) | ||
| 227 | - .fontColor(Color.White) | ||
| 228 | - .opacity(0.7) | ||
| 229 | - .lineHeight(16) | ||
| 230 | - .fontWeight(400) | ||
| 231 | - .fontFamily('PingFang SC-Regular') | ||
| 232 | - .margin({ top: 8, bottom: 8 }) | ||
| 233 | - | ||
| 234 | - } | ||
| 235 | - .width(this.windowWidth - 150 + 'px') | ||
| 236 | - .padding({ left: 16, right: 22 }) | ||
| 237 | - .alignItems(HorizontalAlign.Start) | ||
| 238 | - .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - @Builder | ||
| 242 | - detailDesc() { | ||
| 243 | - /** | ||
| 244 | - * 标题大于三行或存在简介显示查看详情按钮 | ||
| 245 | - */ | ||
| 246 | - // if (this.rmhPlatform == 1) { | ||
| 247 | - // if (this.titleHeight > 200 || this.summary) { | ||
| 248 | - // Text('查看详情 > ') | ||
| 249 | - // .padding({ | ||
| 250 | - // left: 6, | ||
| 251 | - // right: 6, | ||
| 252 | - // top: 4, | ||
| 253 | - // bottom: 4 | ||
| 254 | - // }) | ||
| 255 | - // .borderRadius(2) | ||
| 256 | - // .backgroundColor('#99636363') | ||
| 257 | - // .fontFamily('PingFang SC-Regular') | ||
| 258 | - // .fontColor(Color.White) | ||
| 259 | - // .fontSize(12) | ||
| 260 | - // .lineHeight(14) | ||
| 261 | - // .fontWeight(400) | ||
| 262 | - // .onClick(() => { | ||
| 263 | - // this.isOpenDetail = true | ||
| 264 | - // this.dialogController?.open() | ||
| 265 | - // }) | ||
| 266 | - // } | ||
| 267 | - // } else { | ||
| 268 | if (this.summary && this.titleLines < 4) { | 220 | if (this.summary && this.titleLines < 4) { |
| 269 | - Stack({ alignContent: Alignment.TopStart }) { | ||
| 270 | Text() { | 221 | Text() { |
| 271 | Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50))) | 222 | Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50))) |
| 272 | .fontSize(14) | 223 | .fontSize(14) |
| @@ -278,17 +229,8 @@ export struct PlayerTitleView { | @@ -278,17 +229,8 @@ export struct PlayerTitleView { | ||
| 278 | this.isOpenDetail = true | 229 | this.isOpenDetail = true |
| 279 | this.dialogController?.open() | 230 | this.dialogController?.open() |
| 280 | }) | 231 | }) |
| 281 | - } | ||
| 282 | - // .position({ x: 0, y: 0 }) | ||
| 283 | - .padding({ | ||
| 284 | - left: 0, | ||
| 285 | - right: 6, | ||
| 286 | - top: 0, | ||
| 287 | - bottom: 8 | ||
| 288 | - }) | ||
| 289 | if (this.isOverLines) { | 232 | if (this.isOverLines) { |
| 290 | - Text() { | ||
| 291 | - Span('全文') | 233 | + Span('... 全文') |
| 292 | .fontColor('#99FFFFFF') | 234 | .fontColor('#99FFFFFF') |
| 293 | .fontWeight(400) | 235 | .fontWeight(400) |
| 294 | .fontFamily('PingFang SC-Regular') | 236 | .fontFamily('PingFang SC-Regular') |
| @@ -309,31 +251,37 @@ export struct PlayerTitleView { | @@ -309,31 +251,37 @@ export struct PlayerTitleView { | ||
| 309 | this.isOpenDetail = true | 251 | this.isOpenDetail = true |
| 310 | this.dialogController?.open() | 252 | this.dialogController?.open() |
| 311 | }) | 253 | }) |
| 254 | + | ||
| 255 | + } | ||
| 312 | } | 256 | } |
| 313 | - .textAlign(TextAlign.Center) | ||
| 314 | - // .width('100%') | ||
| 315 | - .position({ x: '100%', y: this.summaryLines*23 }) //行高+margin | ||
| 316 | - .translate({ x: '-100%', y: '-100%' }) | ||
| 317 | - // .markAnchor({ x: '100%', y: '100%' }) | ||
| 318 | .padding({ | 257 | .padding({ |
| 319 | - left: 0, | 258 | + left: 0, //6 |
| 320 | right: 6, | 259 | right: 6, |
| 321 | - top: 0, | ||
| 322 | - bottom: 6 | 260 | + top: 0, //4 |
| 261 | + bottom: 8 | ||
| 323 | }) | 262 | }) |
| 263 | + | ||
| 324 | } | 264 | } |
| 265 | + // } | ||
| 266 | + Text(DateTimeUtils.formatDate(new Date(this.contentDetailData?.publishTime).getTime(), | ||
| 267 | + DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM)) | ||
| 268 | + .fontSize(12) | ||
| 269 | + .fontColor(Color.White) | ||
| 270 | + .opacity(0.7) | ||
| 271 | + .lineHeight(16) | ||
| 272 | + .fontWeight(400) | ||
| 273 | + .fontFamily('PingFang SC-Regular') | ||
| 274 | + .margin({ top: 8, bottom: 8 }) | ||
| 275 | + | ||
| 325 | } | 276 | } |
| 326 | - .width('100%') | ||
| 327 | - } | 277 | + .width(this.windowWidth - 150 + 'px') |
| 278 | + .padding({ left: 16, right: 22 }) | ||
| 279 | + .alignItems(HorizontalAlign.Start) | ||
| 280 | + .visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible) | ||
| 328 | } | 281 | } |
| 329 | 282 | ||
| 330 | - /** | ||
| 331 | - * 标题 | ||
| 332 | - * */ | ||
| 333 | @Builder | 283 | @Builder |
| 334 | titleBuilder() { | 284 | titleBuilder() { |
| 335 | - // Stack({ alignContent: this.isTitleOverLines ? Alignment.BottomEnd : Alignment.Start }) { | ||
| 336 | - Stack({ alignContent: Alignment.TopStart }) { | ||
| 337 | Text() { | 285 | Text() { |
| 338 | Span(this.clipTitleText(this.getTitle(), 16, 4, this.windowWidth - 234 - vp2px(50))) | 286 | Span(this.clipTitleText(this.getTitle(), 16, 4, this.windowWidth - 234 - vp2px(50))) |
| 339 | .fontSize(16) | 287 | .fontSize(16) |
| @@ -341,27 +289,8 @@ export struct PlayerTitleView { | @@ -341,27 +289,8 @@ export struct PlayerTitleView { | ||
| 341 | .lineHeight(22) | 289 | .lineHeight(22) |
| 342 | .fontWeight(600) | 290 | .fontWeight(600) |
| 343 | .fontFamily('PingFang SC-Regular') | 291 | .fontFamily('PingFang SC-Regular') |
| 344 | - | ||
| 345 | - } | ||
| 346 | - // .position({ x: 0, y: 0 }) | ||
| 347 | - .onAreaChange((oldArea: Area, newArea: Area) => { | ||
| 348 | - //console.info(`cj2024 titleLines = ${newArea.height as number} line = ${(newArea.height as number) / 20}`) | ||
| 349 | - this.titleLines = Math.floor((newArea.height as number) / 22) // 22是行高 | ||
| 350 | - //console.info(`cj2024 titleLines = ${this.titleLines}`) | ||
| 351 | - this.updateSummaryLines() | ||
| 352 | - }) | ||
| 353 | - .maxLines(4) | ||
| 354 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 355 | - .padding({ | ||
| 356 | - left: 0, //6 | ||
| 357 | - right: 6, | ||
| 358 | - top: 0, //4 | ||
| 359 | - bottom: 8 | ||
| 360 | - }) | ||
| 361 | - | ||
| 362 | - Text() { | ||
| 363 | if (this.isTitleOverLines) { | 292 | if (this.isTitleOverLines) { |
| 364 | - Span('全文') | 293 | + Span('... 全文') |
| 365 | .fontColor('#99FFFFFF') | 294 | .fontColor('#99FFFFFF') |
| 366 | .fontWeight(600) | 295 | .fontWeight(600) |
| 367 | .fontFamily('PingFang SC-Regular') | 296 | .fontFamily('PingFang SC-Regular') |
| @@ -382,14 +311,15 @@ export struct PlayerTitleView { | @@ -382,14 +311,15 @@ export struct PlayerTitleView { | ||
| 382 | this.isOpenDetail = true | 311 | this.isOpenDetail = true |
| 383 | this.dialogController?.open() | 312 | this.dialogController?.open() |
| 384 | }) | 313 | }) |
| 314 | + | ||
| 385 | } | 315 | } |
| 386 | } | 316 | } |
| 387 | - .textAlign(TextAlign.Center) | ||
| 388 | - // .width('100%') | ||
| 389 | - .position({ x: '100%', y: this.titleLines*23 }) //行高+margin | ||
| 390 | - .translate({ x: '-100%', y: '-100%' }) | ||
| 391 | - // .position({ x: '100%', y: '100%' }) | ||
| 392 | - // .markAnchor({ x: '100%', y: '100%' }) | 317 | + .onAreaChange((oldArea: Area, newArea: Area) => { |
| 318 | + //console.info(`cj2024 titleLines = ${newArea.height as number} line = ${(newArea.height as number) / 20}`) | ||
| 319 | + this.titleLines = Math.floor((newArea.height as number) / 22) // 22是行高 | ||
| 320 | + //console.info(`cj2024 titleLines = ${this.titleLines}`) | ||
| 321 | + this.updateSummaryLines() | ||
| 322 | + }) | ||
| 393 | .padding({ | 323 | .padding({ |
| 394 | left: 0, //6 | 324 | left: 0, //6 |
| 395 | right: 6, | 325 | right: 6, |
| @@ -397,6 +327,4 @@ export struct PlayerTitleView { | @@ -397,6 +327,4 @@ export struct PlayerTitleView { | ||
| 397 | bottom: 8 | 327 | bottom: 8 |
| 398 | }) | 328 | }) |
| 399 | } | 329 | } |
| 400 | - .width('100%') | ||
| 401 | - } | ||
| 402 | } | 330 | } |
| @@ -4,3 +4,5 @@ export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils' | @@ -4,3 +4,5 @@ export { HWLocationUtils } from './src/main/ets/location/HWLocationUtils' | ||
| 4 | 4 | ||
| 5 | // export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager" | 5 | // export { WDPushNotificationManager } from "./src/main/ets/notification/WDPushNotificationManager" |
| 6 | export { GetuiPush } from "./src/main/ets/getuiPush/GetuiPush" | 6 | export { GetuiPush } from "./src/main/ets/getuiPush/GetuiPush" |
| 7 | + | ||
| 8 | +export {VoiceRecoginizer} from './src/main/ets/voiceRecognizer/VoiceRecoginizer' |
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | "packageType": "InterfaceHar", | 8 | "packageType": "InterfaceHar", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | "library": "file:./src/main/ets/getuiPush/GT-HM-1.0.4.har", | 10 | "library": "file:./src/main/ets/getuiPush/GT-HM-1.0.4.har", |
| 11 | + "neonui":"file:./src/main/ets/voiceRecognizer/neonui.har", | ||
| 11 | "wdConstant": "file:../../commons/wdConstant", | 12 | "wdConstant": "file:../../commons/wdConstant", |
| 12 | "wdLogin": "file:../../features/wdLogin", | 13 | "wdLogin": "file:../../features/wdLogin", |
| 13 | "wdKit": "file:../../commons/wdKit", | 14 | "wdKit": "file:../../commons/wdKit", |
| 1 | +import { audio } from '@kit.AudioKit' | ||
| 2 | +import { ArkTSUtils } from '@kit.ArkTS' | ||
| 3 | +import {getVoicebufferDataLengthByte} from 'neonui' | ||
| 4 | +import process from '@ohos.process' | ||
| 5 | +import { NativeNui } from 'neonui' | ||
| 6 | + | ||
| 7 | +let TAG:string = "AudioCapturer" | ||
| 8 | +//音频采集器类,主要用于采集音频,写入文件 | ||
| 9 | +export default class AudioCapturer{ | ||
| 10 | + static lock_:ArkTSUtils.locks.AsyncLock = new ArkTSUtils.locks.AsyncLock() | ||
| 11 | + //static voiceBuffer2:Int16Array=new Int16Array(0); | ||
| 12 | + static voiceBuffer1:ArrayBuffer[] = []; | ||
| 13 | + //static voiceBuffer:ArrayBuffer[] =[]; | ||
| 14 | + static async clearVoiceArrayBuffer(){ | ||
| 15 | + await AudioCapturer.lock_.lockAsync( ()=>{ | ||
| 16 | + if (AudioCapturer.voiceBuffer1!==undefined){ | ||
| 17 | + AudioCapturer.voiceBuffer1= [] | ||
| 18 | + } | ||
| 19 | + console.info(`AudioCapturer clearVoiceArrayBuffer, then voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`); | ||
| 20 | + }) | ||
| 21 | + } | ||
| 22 | + static async setVoiceArrayBuffer(voice:ArrayBuffer){ | ||
| 23 | + console.info(`AudioCapturer setVoiceArrayBuffer, 1 voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`); | ||
| 24 | + AudioCapturer.lock_.lockAsync( ()=>{ | ||
| 25 | + if (AudioCapturer.voiceBuffer1==undefined){ | ||
| 26 | + AudioCapturer.voiceBuffer1= [] | ||
| 27 | + } | ||
| 28 | + AudioCapturer.voiceBuffer1.push(voice) | ||
| 29 | + console.info(`AudioCapturer setVoiceArrayBuffer, 3 voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`); | ||
| 30 | + }) | ||
| 31 | + console.info(`AudioCapturer setVoiceArrayBuffer, 2 voiceBuffer1 size ${AudioCapturer.voiceBuffer1.length}`); | ||
| 32 | + } | ||
| 33 | + static async getVoiceArrayBuffer(buffer:ArrayBuffer):Promise<number>{ | ||
| 34 | + let ret:number; | ||
| 35 | + let outbuferleng=buffer.byteLength; | ||
| 36 | + let buffer_out_typedarray = new Int8Array(buffer) | ||
| 37 | + let offset = 0 | ||
| 38 | + console.log("AudioCapturer enter getVoiceArrayBuffer"); | ||
| 39 | + | ||
| 40 | + return await AudioCapturer.lock_.lockAsync( ()=>{ | ||
| 41 | + console.info(`AudioCapturer womx getVoiceArrayBuffer, outbuferleng ${buffer.byteLength}.with length ${AudioCapturer.voiceBuffer1.length}`); | ||
| 42 | + // while(AudioRenderer.voiceBuffer1.length <= 0){ | ||
| 43 | + // if(AudioRenderer.flagVoiceEnd==true) { | ||
| 44 | + // } | ||
| 45 | + // } | ||
| 46 | + if (AudioCapturer.voiceBuffer1.length > 0) { | ||
| 47 | + let voice_length = getVoicebufferDataLengthByte(AudioCapturer.voiceBuffer1) | ||
| 48 | + if (voice_length>=outbuferleng) { | ||
| 49 | + let bytes_need = outbuferleng | ||
| 50 | + while(bytes_need>0){ | ||
| 51 | + let voice1st = AudioCapturer.voiceBuffer1.shift() | ||
| 52 | + if (voice1st==undefined ){ | ||
| 53 | + } else { | ||
| 54 | + let out_typedbuffer:Int8Array; | ||
| 55 | + console.info(`AudioCapturer womx voice1st.byteLength=${voice1st.byteLength} vs bytes_need=${bytes_need}`); | ||
| 56 | + | ||
| 57 | + if (voice1st.byteLength > bytes_need) { | ||
| 58 | + let out_buffer = voice1st.slice(0,bytes_need) | ||
| 59 | + out_typedbuffer = new Int8Array(out_buffer) | ||
| 60 | + | ||
| 61 | + let save_buffer = voice1st.slice(bytes_need) | ||
| 62 | + AudioCapturer.voiceBuffer1.unshift(save_buffer) | ||
| 63 | + } else { | ||
| 64 | + out_typedbuffer = new Int8Array(voice1st) | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + for (let i = 0; i < out_typedbuffer.byteLength; i++) { | ||
| 68 | + buffer_out_typedarray[offset + i] = out_typedbuffer[i] | ||
| 69 | + } | ||
| 70 | + bytes_need -= out_typedbuffer.byteLength | ||
| 71 | + offset += out_typedbuffer.byteLength | ||
| 72 | + | ||
| 73 | + console.info(`AudioCapturer womx bytes_need=${bytes_need}`); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + } else { | ||
| 77 | + ret = 0 | ||
| 78 | + console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer voicebytes length ${voice_length}`); | ||
| 79 | + } | ||
| 80 | + } else { | ||
| 81 | + ret = 0; | ||
| 82 | + console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer.length ${AudioCapturer.voiceBuffer1.length}<=0`); | ||
| 83 | + } | ||
| 84 | + return ret | ||
| 85 | + }) | ||
| 86 | + } | ||
| 87 | + static getVoiceArrayBuffer1(buffer:ArrayBuffer):number{ | ||
| 88 | + let ret:number=0; | ||
| 89 | + let outbuferleng=buffer.byteLength; | ||
| 90 | + let buffer_out_typedarray = new Int8Array(buffer) | ||
| 91 | + let offset = 0 | ||
| 92 | + console.log("AudioCapturer enter getVoiceArrayBuffer"); | ||
| 93 | + | ||
| 94 | + console.info(`AudioCapturer womx getVoiceArrayBuffer, outbuferleng ${buffer.byteLength}.with length ${AudioCapturer.voiceBuffer1.length}`); | ||
| 95 | + // while(AudioRenderer.voiceBuffer1.length <= 0){ | ||
| 96 | + // if(AudioRenderer.flagVoiceEnd==true) { | ||
| 97 | + // } | ||
| 98 | + // } | ||
| 99 | + if (AudioCapturer.voiceBuffer1.length > 0) { | ||
| 100 | + let voice_length = getVoicebufferDataLengthByte(AudioCapturer.voiceBuffer1) | ||
| 101 | + if (voice_length>=outbuferleng) { | ||
| 102 | + let bytes_need = outbuferleng | ||
| 103 | + while(bytes_need>0){ | ||
| 104 | + let voice1st = AudioCapturer.voiceBuffer1.shift() | ||
| 105 | + if (voice1st==undefined ){ | ||
| 106 | + break | ||
| 107 | + } else { | ||
| 108 | + let out_typedbuffer:Int8Array; | ||
| 109 | + console.info(`AudioCapturer womx voice1st.byteLength=${voice1st.byteLength} vs bytes_need=${bytes_need}`); | ||
| 110 | + | ||
| 111 | + if (voice1st.byteLength > bytes_need) { | ||
| 112 | + let out_buffer = voice1st.slice(0,bytes_need) | ||
| 113 | + out_typedbuffer = new Int8Array(out_buffer) | ||
| 114 | + | ||
| 115 | + let save_buffer = voice1st.slice(bytes_need) | ||
| 116 | + AudioCapturer.voiceBuffer1.unshift(save_buffer) | ||
| 117 | + } else { | ||
| 118 | + out_typedbuffer = new Int8Array(voice1st) | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + for (let i = 0; i < out_typedbuffer.byteLength; i++) { | ||
| 122 | + buffer_out_typedarray[offset + i] = out_typedbuffer[i] | ||
| 123 | + } | ||
| 124 | + bytes_need -= out_typedbuffer.byteLength | ||
| 125 | + offset += out_typedbuffer.byteLength | ||
| 126 | + | ||
| 127 | + console.info(`AudioCapturer womx bytes_need=${bytes_need}`); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + ret = outbuferleng - bytes_need | ||
| 132 | + } else { | ||
| 133 | + ret = 0 | ||
| 134 | + console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer voicebytes length ${voice_length}`); | ||
| 135 | + } | ||
| 136 | + } else { | ||
| 137 | + ret = 0; | ||
| 138 | + console.error(`AudioCapturer error getVoiceArrayBuffer, outbuferleng 0.with ringbuffer.length ${AudioCapturer.voiceBuffer1.length}<=0`); | ||
| 139 | + } | ||
| 140 | + return ret; | ||
| 141 | + } | ||
| 142 | + //定义音频流信息 | ||
| 143 | + static audioStreamInfo:audio.AudioStreamInfo = { | ||
| 144 | + //彩样率 | ||
| 145 | + samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_16000, | ||
| 146 | + //通道数 | ||
| 147 | + channels:audio.AudioChannel.CHANNEL_1, | ||
| 148 | + //采样格式 | ||
| 149 | + sampleFormat:audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, | ||
| 150 | + //编码格式 | ||
| 151 | + encodingType:audio.AudioEncodingType.ENCODING_TYPE_RAW | ||
| 152 | + } | ||
| 153 | + //定义音频采集器信息 | ||
| 154 | + static audioCapturerInfo:audio.AudioCapturerInfo={ | ||
| 155 | + //音源类型 | ||
| 156 | + source:audio.SourceType.SOURCE_TYPE_MIC, | ||
| 157 | + //音频采集器标志 | ||
| 158 | + capturerFlags:0 | ||
| 159 | + } | ||
| 160 | + //定义音频采集器 | ||
| 161 | + static audioCapturer:audio.AudioCapturer | ||
| 162 | + static g_asrinstance:NativeNui | ||
| 163 | + //初始化音频采集器 | ||
| 164 | + static async init(asrinstance:NativeNui){ | ||
| 165 | + AudioCapturer.g_asrinstance = asrinstance | ||
| 166 | + AudioCapturer.audioCapturer = await audio.createAudioCapturer({ | ||
| 167 | + //需要音频流信息和音频采集器信息 | ||
| 168 | + streamInfo:AudioCapturer.audioStreamInfo, | ||
| 169 | + capturerInfo:AudioCapturer.audioCapturerInfo | ||
| 170 | + }) | ||
| 171 | + if (AudioCapturer.audioCapturer !== undefined) { | ||
| 172 | + await AudioCapturer.audioCapturer.on('readData', AudioCapturer.readDataCallback); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + static readDataCallback = (buffer: ArrayBuffer) => { | ||
| 178 | + console.log(`${TAG} read data bytelength is ${buffer.byteLength}. uid[${process.uid}] pid[${process.pid}] tid[${process.tid}]`); | ||
| 179 | + //AudioCapturer.setVoiceArrayBuffer(buffer) | ||
| 180 | + AudioCapturer.g_asrinstance.updateAudio(buffer,false) | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + //开始采集音频 | ||
| 184 | + static async start(){ | ||
| 185 | + await AudioCapturer.clearVoiceArrayBuffer() | ||
| 186 | + if (AudioCapturer.audioCapturer) { | ||
| 187 | + let stateGroup = [audio.AudioState.STATE_PREPARED, | ||
| 188 | + audio.AudioState.STATE_PAUSED, | ||
| 189 | + audio.AudioState.STATE_STOPPED]; | ||
| 190 | + if (stateGroup.indexOf(AudioCapturer.audioCapturer.state.valueOf()) === -1) { | ||
| 191 | + // 当且仅当状态为STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一时才能启动采集 | ||
| 192 | + console.error(`${TAG}: start failed`); | ||
| 193 | + console.error('Capturer is not STATE_PREPARED or STATE_PAUSED or STATE_STOPPED'); | ||
| 194 | + return; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + //开始录音 | ||
| 198 | + await AudioCapturer.audioCapturer.start() | ||
| 199 | + console.log(`${TAG} start done`); | ||
| 200 | + } else { | ||
| 201 | + console.log(`${TAG} start with AudioCapturer.audioCapturer is null`); | ||
| 202 | + return | ||
| 203 | + } | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + //停止采集音频 | ||
| 207 | + static async stop(){ | ||
| 208 | + if (AudioCapturer.audioCapturer) { | ||
| 209 | + // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 | ||
| 210 | + if (AudioCapturer.audioCapturer.state === audio.AudioState.STATE_RUNNING || | ||
| 211 | + AudioCapturer.audioCapturer.state === audio.AudioState.STATE_PAUSED | ||
| 212 | + ) { | ||
| 213 | + console.error(`Capturer state is ${AudioCapturer.audioCapturer.state}`); | ||
| 214 | + await AudioCapturer.audioCapturer.stop()/*.then( (value)=>{ | ||
| 215 | + console.log("result of Capturer stop is " + value); | ||
| 216 | + }); // 停止采集*/ | ||
| 217 | + console.error('Capturer stop done'); | ||
| 218 | + } else { | ||
| 219 | + console.error('Capturer is not running or paused'); | ||
| 220 | + return; | ||
| 221 | + } | ||
| 222 | + } else { | ||
| 223 | + console.log(`${TAG} stop with AudioCapturer.audioCapturer is null`); | ||
| 224 | + return | ||
| 225 | + } | ||
| 226 | + await AudioCapturer.clearVoiceArrayBuffer() | ||
| 227 | + } | ||
| 228 | + // 释放资源 | ||
| 229 | + static async release() { | ||
| 230 | + if (AudioCapturer.audioCapturer) { | ||
| 231 | + | ||
| 232 | + // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release | ||
| 233 | + if (AudioCapturer.audioCapturer.state === audio.AudioState.STATE_RELEASED || | ||
| 234 | + AudioCapturer.audioCapturer.state === audio.AudioState.STATE_NEW) { | ||
| 235 | + console.info('Capturer already released'); | ||
| 236 | + return; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + await AudioCapturer.audioCapturer.release() | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | +} |
| 1 | + | ||
| 2 | +import {NativeNui,Constants,MapToJson,INativeNuiCallback, AsrResult, KwsResult} from 'neonui' | ||
| 3 | +import { PermissionUtils,DeviceUtil, Logger, DateTimeUtils } from 'wdKit'; | ||
| 4 | +import AudioCapturer from './AudioCapture'; | ||
| 5 | +import { common, Permissions } from '@kit.AbilityKit'; | ||
| 6 | +import { NetLayerVoiceRecoginizerToken } from 'wdBean'; | ||
| 7 | +import { HttpUrlUtils,ResponseDTO } from 'wdNetwork' | ||
| 8 | +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest' | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +class NativeNuiCallbackHandle implements INativeNuiCallback { | ||
| 12 | + asrspeechrealtimeResultOld:string="" | ||
| 13 | + asrmessage:string; | ||
| 14 | + message:string; | ||
| 15 | + nuiCallback?:(result: string) => void | ||
| 16 | + constructor() { | ||
| 17 | + this.asrmessage="" | ||
| 18 | + this.message="" | ||
| 19 | + } | ||
| 20 | + onNuiEventCallback(event:Constants.NuiEvent, resultCode:number, arg2:number, kwsResult:KwsResult, | ||
| 21 | + asrResult:AsrResult):void { | ||
| 22 | + let asrinfo:string = "" | ||
| 23 | + // console.log("onUsrNuiEventCallback last this.asrmessage is " + this.asrmessage) | ||
| 24 | + // console.log("onUsrNuiEventCallback this is " + JSON.stringify(this)) | ||
| 25 | + // console.log("onUsrNuiEventCallback event is " + event) | ||
| 26 | + | ||
| 27 | + if (event === Constants.NuiEvent.EVENT_ASR_RESULT){ | ||
| 28 | + this.message = "EVENT_ASR_RESULT" | ||
| 29 | + this.asrspeechrealtimeResultOld="" | ||
| 30 | + } else if (event === Constants.NuiEvent.EVENT_ASR_PARTIAL_RESULT || event === Constants.NuiEvent.EVENT_SENTENCE_END){ | ||
| 31 | + if (event === Constants.NuiEvent.EVENT_ASR_PARTIAL_RESULT ) { | ||
| 32 | + this.message = "EVENT_ASR_PARTIAL_RESULT" | ||
| 33 | + } else if(event === Constants.NuiEvent.EVENT_SENTENCE_END){ | ||
| 34 | + this.message = "EVENT_SENTENCE_END" | ||
| 35 | + } | ||
| 36 | + } else if (event === Constants.NuiEvent.EVENT_ASR_ERROR){ | ||
| 37 | + this.message = "EVENT_ASR_ERROR" | ||
| 38 | + } else if (event === Constants.NuiEvent.EVENT_MIC_ERROR){ | ||
| 39 | + this.message = "EVENT_MIC_ERROR" | ||
| 40 | + } else if (event === Constants.NuiEvent.EVENT_DIALOG_EX){ | ||
| 41 | + this.message = "EVENT_DIALOG_EX" | ||
| 42 | + } | ||
| 43 | + if (asrResult) { | ||
| 44 | + asrinfo = asrResult.asrResult | ||
| 45 | + //console.log(`asrinfo string is ${asrinfo}`) | ||
| 46 | + if (asrinfo) { | ||
| 47 | + try { | ||
| 48 | + let asrresult_json:object|null = JSON.parse(asrResult.asrResult) | ||
| 49 | + //console.log(JSON.stringify(asrresult_json)) | ||
| 50 | + if (asrresult_json) { | ||
| 51 | + let payload:object|null = asrresult_json["payload"]; | ||
| 52 | + if (payload) { | ||
| 53 | + //console.log(JSON.stringify(payload)) | ||
| 54 | + this.asrmessage = this.asrspeechrealtimeResultOld + payload["result"]; | ||
| 55 | + | ||
| 56 | + if(event === Constants.NuiEvent.EVENT_SENTENCE_END){ | ||
| 57 | + // console.info("onUsrNuiEventCallback EVENT_SENTENCE_END") | ||
| 58 | + this.asrspeechrealtimeResultOld = this.asrmessage | ||
| 59 | + } | ||
| 60 | + if (this.nuiCallback) { | ||
| 61 | + this.nuiCallback(this.asrmessage) | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + } catch (e){ | ||
| 66 | + // console.error("got asrinfo not json, so donot fresh asrinfo." + JSON.stringify(e)) | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + // console.info(`womx onUsrNuiEventCallback(${event}, ${resultCode},${arg2}, kwsResult:${kwsResult},asrResult:"${this.asrmessage}") done`) | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + onNuiNeedAudioData(buffer:ArrayBuffer):number { | ||
| 74 | + // console.info(`womx onUsrNuiNeedAudioData(buffer length = ${buffer.byteLength})`) | ||
| 75 | + // console.log(`womx onUsrNuiNeedAudioData uid[${process.uid}] pid[${process.pid}] tid[${process.tid}]`); | ||
| 76 | + let num:number = 0; | ||
| 77 | + | ||
| 78 | + if (true){ | ||
| 79 | + if (true){ | ||
| 80 | + //由于录音回调是异步的,所以此处获取共享数据需要加锁/并保持同步 是较难的,需要修改asr回调为用户主动推送方式 | ||
| 81 | + num = AudioCapturer.getVoiceArrayBuffer1(buffer) | ||
| 82 | + } else { | ||
| 83 | + | ||
| 84 | + let flag_returned:boolean = false | ||
| 85 | + try { | ||
| 86 | + AudioCapturer.getVoiceArrayBuffer(buffer).then( (result:number)=>{ | ||
| 87 | + console.log("womx onUsrNuiNeedAudioData getVoiceArrayBuffer done, result="+result) | ||
| 88 | + num = result | ||
| 89 | + flag_returned=true | ||
| 90 | + }) | ||
| 91 | + } catch(e ){ | ||
| 92 | + flag_returned=true | ||
| 93 | + | ||
| 94 | + } | ||
| 95 | + while(flag_returned==false){ | ||
| 96 | + console.log("womx onUsrNuiNeedAudioData waiting ... num="+num) | ||
| 97 | + | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + | ||
| 103 | + // console.info(`womx onUsrNuiNeedAudioData(buffer length = ${buffer.byteLength}) return ${num}}`) | ||
| 104 | + return num;//buffer.byteLength; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + onNuiAudioStateChanged(state:Constants.AudioState):void { | ||
| 108 | + // console.info(`womx onUsrNuiAudioStateChanged(${state})`) | ||
| 109 | + if (state === Constants.AudioState.STATE_OPEN){ | ||
| 110 | + // console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder start`) | ||
| 111 | + //AudioCapturer.init(g_asrinstance) | ||
| 112 | + AudioCapturer.start() | ||
| 113 | + // console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder start done`) | ||
| 114 | + } else if (state === Constants.AudioState.STATE_CLOSE){ | ||
| 115 | + // console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder close`) | ||
| 116 | + AudioCapturer.stop() | ||
| 117 | + //AudioCapturer.release() | ||
| 118 | + // console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder close done`) | ||
| 119 | + } else if (state === Constants.AudioState.STATE_PAUSE){ | ||
| 120 | + // console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder pause`) | ||
| 121 | + AudioCapturer.stop() | ||
| 122 | + //AudioCapturer.release() | ||
| 123 | + // console.info(`womx onUsrNuiAudioStateChanged(${state}) audio recorder pause done`) | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + onNuiAudioRMSChanged(val:number):number{ | ||
| 127 | + // console.info(`womx onNuiAudioRMSChanged(${val})`) | ||
| 128 | + return 0; | ||
| 129 | + } | ||
| 130 | + clearAsrInfo(){ | ||
| 131 | + this.asrmessage = "" | ||
| 132 | + } | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +const TAG = 'VoiceRecoginizer' | ||
| 136 | + | ||
| 137 | +export class VoiceRecoginizer { | ||
| 138 | + private static MICROPHONEMISSION: Permissions = 'ohos.permission.MICROPHONE' | ||
| 139 | + private static READMEDIA: Permissions = 'ohos.permission.READ_IMAGEVIDEO' | ||
| 140 | + private static INTENT: Permissions = "ohos.permission.INTERNET" | ||
| 141 | + private static WRITE_MEDIA: Permissions = "ohos.permission.WRITE_IMAGEVIDEO" | ||
| 142 | + | ||
| 143 | + private static appKey = "EospGmM6mdPljjjm" | ||
| 144 | + private static url = "wss://nls-gateway.cn-shanghai.aliyuncs.com:443/ws/v1" | ||
| 145 | + private authToken?: NetLayerVoiceRecoginizerToken | ||
| 146 | + | ||
| 147 | + private vadMode: boolean = false | ||
| 148 | + | ||
| 149 | + private cbhandle: NativeNuiCallbackHandle = new NativeNuiCallbackHandle() | ||
| 150 | + | ||
| 151 | + private g_asrinstance: NativeNui = new NativeNui(Constants.ModeType.MODE_DIALOG, "asr1") | ||
| 152 | + | ||
| 153 | + private static manager: VoiceRecoginizer | ||
| 154 | + | ||
| 155 | + public static sharedManager(): VoiceRecoginizer { | ||
| 156 | + if (!VoiceRecoginizer.manager) { | ||
| 157 | + VoiceRecoginizer.manager = new VoiceRecoginizer() | ||
| 158 | + } | ||
| 159 | + return VoiceRecoginizer.manager | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + voiceRecoginizerResult?:(result: string) => void | ||
| 163 | + // public voiceRecoginzerResult:(result: string) => void | ||
| 164 | + genParams():string { | ||
| 165 | + let params:string = ""; | ||
| 166 | + let nls_config:Map<string, string|number|boolean|object> = new Map(); | ||
| 167 | + nls_config.set("enable_intermediate_result", true); | ||
| 168 | + | ||
| 169 | + //参数可根据实际业务进行配置 | ||
| 170 | + //接口说明可见: https://help.aliyun.com/document_detail/173298.html | ||
| 171 | + //查看 2.开始识别 | ||
| 172 | + | ||
| 173 | + //由于对外的SDK不带有本地VAD模块(仅带有唤醒功能的SDK具有VAD模块), | ||
| 174 | + //若要使用VAD模式,则需要设置nls_config参数启动在线VAD模式(见genParams()) | ||
| 175 | + if (this.vadMode) { | ||
| 176 | + nls_config.set("enable_voice_detection", true); | ||
| 177 | + nls_config.set("max_start_silence", 10000); | ||
| 178 | + nls_config.set("max_end_silence", 800); | ||
| 179 | + } else { | ||
| 180 | + nls_config.set("enable_voice_detection", false); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + nls_config.set("enable_punctuation_prediction", true); | ||
| 184 | + nls_config.set("enable_inverse_text_normalization", true); | ||
| 185 | + // nls_config.set("customization_id", "test_id"); | ||
| 186 | + // nls_config.set("vocabulary_id", "test_id"); | ||
| 187 | + // nls_config.set("sample_rate", 16000); | ||
| 188 | + // nls_config.set("sr_format", "opus"); | ||
| 189 | + | ||
| 190 | + let parameters:Map<string, string|number|boolean|object> = new Map(); | ||
| 191 | + parameters.set("nls_config", Object( JSON.parse(MapToJson(nls_config)) ) ); | ||
| 192 | + | ||
| 193 | + //一句话识别 | ||
| 194 | + // console.log("start asr for 一句话识别") | ||
| 195 | + parameters.set("service_type", Constants.kServiceTypeASR); // 必填 | ||
| 196 | + //如果有HttpDns则可进行设置 | ||
| 197 | + //parameters.put("direct_ip", Utils.getDirectIp()); | ||
| 198 | + | ||
| 199 | + params = MapToJson(parameters);//parameters.toString(); | ||
| 200 | + console.log("configinfo genParams" + params) | ||
| 201 | + return params; | ||
| 202 | + } | ||
| 203 | + genInitParams(workpath:string, debugpath:string):string { | ||
| 204 | + let str:string = ""; | ||
| 205 | + //获取token方式: | ||
| 206 | + | ||
| 207 | + let object:Map<string, string|number|boolean|object> = new Map(); | ||
| 208 | + | ||
| 209 | + //账号和项目创建 | ||
| 210 | + // ak_id ak_secret app_key如何获得,请查看https://help.aliyun.com/document_detail/72138.html | ||
| 211 | + object.set("app_key",VoiceRecoginizer.appKey); // 必填 | ||
| 212 | + | ||
| 213 | + //方法1: | ||
| 214 | + // 首先ak_id ak_secret app_key如何获得,请查看https://help.aliyun.com/document_detail/72138.html | ||
| 215 | + // 然后请看 https://help.aliyun.com/document_detail/466615.html 使用其中方案一获取临时凭证 | ||
| 216 | + // 此方案简介: 远端服务器生成具有有效时限的临时凭证, 下发给移动端进行使用, 保证账号信息ak_id和ak_secret不被泄露 | ||
| 217 | + // 获得Token方法(运行在APP服务端): https://help.aliyun.com/document_detail/450255.html?spm=a2c4g.72153.0.0.79176297EyBj4k | ||
| 218 | + | ||
| 219 | + if (this.authToken) { | ||
| 220 | + object.set("token", this.authToken.accessToken) | ||
| 221 | + } | ||
| 222 | + //方法2: | ||
| 223 | + // STS获取临时凭证方法暂不支持 | ||
| 224 | + | ||
| 225 | + //方法3:(强烈不推荐,存在阿里云账号泄露风险) | ||
| 226 | + // 参考Auth类的实现在端上访问阿里云Token服务获取SDK进行获取。请勿将ak/sk存在本地或端侧环境。 | ||
| 227 | + // 此方法优点: 端侧获得Token, 无需搭建APP服务器。 | ||
| 228 | + // 此方法缺点: 端侧获得ak/sk账号信息, 极易泄露。 | ||
| 229 | + // JSONObject object = Auth.getAliYunTicket(); | ||
| 230 | + | ||
| 231 | + object.set("device_id", DeviceUtil.clientId()/*Utils.getDeviceId()*/); // 必填, 推荐填入具有唯一性的id, 方便定位问题 | ||
| 232 | + object.set("url", VoiceRecoginizer.url); // 默认 | ||
| 233 | + object.set("workspace", workpath); // 必填, 且需要有读写权限 | ||
| 234 | + // object.set("sample_rate", "16000"); | ||
| 235 | + // object.set("format", "pcm"); | ||
| 236 | + | ||
| 237 | + //当初始化SDK时的save_log参数取值为true时,该参数生效。表示是否保存音频debug,该数据保存在debug目录中,需要确保debug_path有效可写。 | ||
| 238 | + // object.put("save_wav", "true"); | ||
| 239 | + //debug目录,当初始化SDK时的save_log参数取值为true时,该目录用于保存中间音频文件。 | ||
| 240 | + object.set("debug_path", debugpath); | ||
| 241 | + | ||
| 242 | + // FullMix = 0 // 选用此模式开启本地功能并需要进行鉴权注册 | ||
| 243 | + // FullCloud = 1 | ||
| 244 | + // FullLocal = 2 // 选用此模式开启本地功能并需要进行鉴权注册 | ||
| 245 | + // AsrMix = 3 // 选用此模式开启本地功能并需要进行鉴权注册 | ||
| 246 | + // AsrCloud = 4 | ||
| 247 | + // AsrLocal = 5 // 选用此模式开启本地功能并需要进行鉴权注册 | ||
| 248 | + //一句话识别 | ||
| 249 | + // console.log("init asr for 一句话识别") | ||
| 250 | + object.set("service_mode", Constants.ModeAsrCloud); // 必填 | ||
| 251 | + | ||
| 252 | + str = MapToJson(object) | ||
| 253 | + | ||
| 254 | + // console.info("configinfo genInitParams:" + str); | ||
| 255 | + return str; | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + async AsrInit(path:string, filePath:string): Promise<number> { | ||
| 259 | + //console.log("AsrInit this is " + JSON.stringify(this)) | ||
| 260 | + // console.info("AsrInit path: " + path); | ||
| 261 | + //获取工作路径, 这里获得当前nuisdk.aar中assets路径 | ||
| 262 | + | ||
| 263 | + let asset_path:string = path+"/resources_cloud" | ||
| 264 | + // fs.stat(asset_path).catch((error: BusinessError) => { | ||
| 265 | + // if (error.code = 13900002) { | ||
| 266 | + // fs.mkdirSync(asset_path) | ||
| 267 | + // } | ||
| 268 | + // }) | ||
| 269 | + // fs.mkdirSync(asset_path) | ||
| 270 | + // try { | ||
| 271 | + // await this.checkPath(asset_path) | ||
| 272 | + this.cbhandle.nuiCallback = (result: string) => { | ||
| 273 | + if (this.voiceRecoginizerResult) { | ||
| 274 | + this.voiceRecoginizerResult(result) | ||
| 275 | + } | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + let parameters: string = "" | ||
| 279 | + // this.genInitParams(asset_path,filePath) | ||
| 280 | + // .then(parameters) { | ||
| 281 | + // | ||
| 282 | + // } | ||
| 283 | + await this.getToken() | ||
| 284 | + | ||
| 285 | + let ret:number = this.g_asrinstance.initialize(this.cbhandle, this.genInitParams(asset_path,filePath), Constants.LogLevel.LOG_LEVEL_NONE, false); | ||
| 286 | + // console.info("result = " + ret); | ||
| 287 | + if (ret == Constants.NuiResultCode.SUCCESS) { | ||
| 288 | + | ||
| 289 | + } else { | ||
| 290 | + // Logger.debug(TAG,"语音识别初始化失败") | ||
| 291 | + //final String msg_text = Utils.getMsgWithErrorCode(ret, "init"); | ||
| 292 | + //抛出错误异常信息。 | ||
| 293 | + /* | ||
| 294 | + runOnUiThread(new Runnable() { | ||
| 295 | + @Override | ||
| 296 | + public void run() { | ||
| 297 | + Toast.makeText(SpeechRecognizerActivity.this, msg_text, Toast.LENGTH_LONG).show(); | ||
| 298 | + } | ||
| 299 | + }); | ||
| 300 | + */ | ||
| 301 | + } | ||
| 302 | + // return ret | ||
| 303 | + // } | ||
| 304 | + // catch { | ||
| 305 | + // return -1; | ||
| 306 | + // } | ||
| 307 | + //初始化SDK,注意用户需要在Auth.getAliYunTicket中填入相关ID信息才可以使用。 | ||
| 308 | + return ret | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + // checkPath(asset_path:string):Promise<void> { | ||
| 312 | + // return new Promise<void> ((success,fail) => { | ||
| 313 | + // fs.stat(asset_path).catch((error: BusinessError) => { | ||
| 314 | + // if (error.code = 13900002) { | ||
| 315 | + // fs.mkdirSync(asset_path) | ||
| 316 | + // success() | ||
| 317 | + // return | ||
| 318 | + // } | ||
| 319 | + // success() | ||
| 320 | + // }) | ||
| 321 | + // }) | ||
| 322 | + // } | ||
| 323 | + startDialog():number { | ||
| 324 | + // console.log(`womx startDialog uid[${process.uid}] pid[${process.pid}] tid[${process.tid}]`); | ||
| 325 | + this.cbhandle.clearAsrInfo() | ||
| 326 | + //由于对外的SDK不带有本地VAD模块(仅带有唤醒功能的SDK具有VAD模块), | ||
| 327 | + //若要使用VAD模式,则需要设置nls_config参数启动在线VAD模式(见genParams()) | ||
| 328 | + let vad_mode:Constants.VadMode = Constants.VadMode.TYPE_P2T; | ||
| 329 | + if (this.vadMode) { | ||
| 330 | + //TYPE_VAD: SDK自动判断句尾结束识别。(此功能仅存在于<029>带唤醒功能的SDK) | ||
| 331 | + //vad_mode = Constants.VadMode.TYPE_VAD; | ||
| 332 | + // console.info("使用Voice Active Detection模式"); | ||
| 333 | + } else { | ||
| 334 | + //TYPE_P2T: 有用户主动stop()以告知识别完成 | ||
| 335 | + //vad_mode = Constants.VadMode.TYPE_P2T; | ||
| 336 | + // console.info("使用Push To Talk模式"); | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + //设置相关识别参数,具体参考API文档 | ||
| 340 | + // initialize()之后startDialog之前调用 | ||
| 341 | + this.g_asrinstance.setParams(this.genParams()); | ||
| 342 | + AudioCapturer.init(this.g_asrinstance) | ||
| 343 | + let ret:number = this.g_asrinstance.startDialog(vad_mode, ""); | ||
| 344 | + // console.info("start done . ret = ", ret); | ||
| 345 | + if (ret != 0) { | ||
| 346 | + // console.info("call startDialog return error. ", ret); | ||
| 347 | + } | ||
| 348 | + return ret | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + stop() { | ||
| 352 | + this.cbhandle.clearAsrInfo() | ||
| 353 | + AudioCapturer.stop() | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + static async checkPemmission (context: common.UIAbilityContext) { | ||
| 357 | + | ||
| 358 | + let grant = await PermissionUtils.checkPermissions(VoiceRecoginizer.WRITE_MEDIA) | ||
| 359 | + | ||
| 360 | + if (grant) { | ||
| 361 | + ///初始化SDK | ||
| 362 | + // Logger.debug("已申请过权限") | ||
| 363 | + return | ||
| 364 | + } | ||
| 365 | + // let context = getContext() | ||
| 366 | + let requestGrant = await PermissionUtils.reqPermissionsFromUser([VoiceRecoginizer.MICROPHONEMISSION | ||
| 367 | + ,VoiceRecoginizer.READMEDIA | ||
| 368 | + ,VoiceRecoginizer.WRITE_MEDIA | ||
| 369 | + ,VoiceRecoginizer.INTENT],context) | ||
| 370 | + if (requestGrant) { | ||
| 371 | + ///初始化SDK | ||
| 372 | + } | ||
| 373 | + // return false | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + | ||
| 377 | + private async getToken():Promise<NetLayerVoiceRecoginizerToken | undefined> { | ||
| 378 | + return new Promise<NetLayerVoiceRecoginizerToken|undefined>((success,fail) => { | ||
| 379 | + if (this.authToken && this.authToken.accessToken.length > 0) { | ||
| 380 | + if (Date.now() < this.authToken.expireTime - 60 * 1000) { | ||
| 381 | + success(this.authToken) | ||
| 382 | + return | ||
| 383 | + } | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + HttpRequest.get<ResponseDTO<NetLayerVoiceRecoginizerToken>>( | ||
| 387 | + HttpUrlUtils.getVoiceRecognizerSDKAuthToken() | ||
| 388 | + ).then((res: ResponseDTO<NetLayerVoiceRecoginizerToken>) => { | ||
| 389 | + if (res.code != 0) { | ||
| 390 | + fail(res.message) | ||
| 391 | + return | ||
| 392 | + } | ||
| 393 | + this.authToken = res.data | ||
| 394 | + success(res.data) | ||
| 395 | + }) | ||
| 396 | + }) | ||
| 397 | + | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + | ||
| 401 | +} |
No preview for this file type
| 1 | +{ | ||
| 2 | + "cei":{ | ||
| 3 | + "cei_param_version":"2.2.0", | ||
| 4 | + "cei_param_device_type":"car", | ||
| 5 | + "cei_param_reco_mode":0, | ||
| 6 | + "cei_param_log_level":2, | ||
| 7 | + "cei_param_debug_path":"asr_debug", | ||
| 8 | + "cei_param_is_debug_enable":false, | ||
| 9 | + "cei_param_resource_path":"", | ||
| 10 | + "cei_param_resource_is_multi_language":false, | ||
| 11 | + "cei_param_audio_format_str":"16k16bitmono", | ||
| 12 | + "cei_param_mcs_mode":0, | ||
| 13 | + "cei_param_work_mode":0, | ||
| 14 | + "cei_param_max_cache_frames":1000, | ||
| 15 | + "cei_param_is_aec_bf_active":false, | ||
| 16 | + "cei_param_is_agc_active":false, | ||
| 17 | + "cei_param_is_vad_active":true, | ||
| 18 | + "cei_param_is_kws_active":true, | ||
| 19 | + "cei_param_is_sr_active":true | ||
| 20 | + }, | ||
| 21 | + "asp":{ | ||
| 22 | + "asp_param_is_process_parallel":false, | ||
| 23 | + "asp_param_is_input_debug_enable":false, | ||
| 24 | + "asp_param_is_output_debug_enable":false, | ||
| 25 | + "asp_param_debug_path":"asr_debug", | ||
| 26 | + "asp_param_is_callback_enable":false, | ||
| 27 | + "asp_param_callback_period_frames":5 | ||
| 28 | + }, | ||
| 29 | + "vad":{ | ||
| 30 | + "vad_param_is_input_debug_enable":false, | ||
| 31 | + "vad_param_is_output_debug_enable":false, | ||
| 32 | + "vad_param_debug_path":"asr_debug", | ||
| 33 | + "vad_param_asleep_speech_noise_thres":-0.8, | ||
| 34 | + "vad_param_awake_speech_noise_thres":-0.5, | ||
| 35 | + "vad_param_asleep_max_speech_segment_time":300000, | ||
| 36 | + "vad_param_awake_max_speech_segment_time":60000, | ||
| 37 | + "vad_param_asleep_block_size":3, | ||
| 38 | + "vad_param_awake_block_size":3, | ||
| 39 | + "vad_param_front_timeout_interval":8000, | ||
| 40 | + "vad_param_tail_timeout_interval":800, | ||
| 41 | + "vad_param_is_detect_start":true, | ||
| 42 | + "vad_param_is_detect_end":true | ||
| 43 | + }, | ||
| 44 | + "kws":{ | ||
| 45 | + "kws_param_is_input_debug_enable":false, | ||
| 46 | + "kws_param_is_output_debug_enable":false, | ||
| 47 | + "kws_param_debug_path":"asr_debug", | ||
| 48 | + "kws_param_is_process_parallel":false, | ||
| 49 | + "kws_param_front_extend_frames":10, | ||
| 50 | + "kws_param_tail_extend_frames":5, | ||
| 51 | + "kws_param_encoder_type_str":"opu", | ||
| 52 | + "kws_param_encoder_bitrate":16000, | ||
| 53 | + "kws_param_encoder_complexity":2, | ||
| 54 | + "kws_param_callback_period_ms":100, | ||
| 55 | + "kws_param_max_frames_per_callback":25, | ||
| 56 | + "kws_param_max_bytes_per_callback":16000 | ||
| 57 | + }, | ||
| 58 | + "sr":{ | ||
| 59 | + "sr_param_is_input_debug_enable":false, | ||
| 60 | + "sr_param_is_output_debug_enable":false, | ||
| 61 | + "sr_param_debug_path":"asr_debug", | ||
| 62 | + "sr_param_is_itn_enable":true, | ||
| 63 | + "sr_param_is_do_conf_filter":false, | ||
| 64 | + "sr_param_is_process_parallel":true, | ||
| 65 | + "sr_param_is_need_result":false, | ||
| 66 | + "sr_param_is_need_voice":true, | ||
| 67 | + "sr_param_ngram_conf_thres":65.0, | ||
| 68 | + "sr_param_jsgf_conf_thres":65.0, | ||
| 69 | + "sr_param_encoder_type_str":"opu", | ||
| 70 | + "sr_param_encoder_bitrate":16000, | ||
| 71 | + "sr_param_encoder_complexity":2, | ||
| 72 | + "sr_param_callback_period_ms":100, | ||
| 73 | + "sr_param_max_frames_per_callback":25, | ||
| 74 | + "sr_param_max_bytes_per_callback":16000 | ||
| 75 | + }, | ||
| 76 | + "ou":{ | ||
| 77 | + "oss_upload_param_is_enable":false, | ||
| 78 | + "oss_upload_param_asp_in":false, | ||
| 79 | + "oss_upload_param_asp_out":false, | ||
| 80 | + "oss_upload_param_vad_in":false, | ||
| 81 | + "oss_upload_param_vad_out":false, | ||
| 82 | + "oss_upload_param_kws_in":false, | ||
| 83 | + "oss_upload_param_kws_susp_in":false, | ||
| 84 | + "oss_upload_param_kws_out":false, | ||
| 85 | + "oss_upload_param_kws_susp_out":false, | ||
| 86 | + "oss_upload_param_sr_in":false | ||
| 87 | + } | ||
| 88 | +} |
| 1 | +{ | ||
| 2 | + "device_type":"phone", | ||
| 3 | + "assets_version":"1.1.20190902", | ||
| 4 | + "nui_config":{ | ||
| 5 | + "service_mode":"kModeFullCloud", | ||
| 6 | + "log_level":"kLogLevelVerbose", | ||
| 7 | + "enable_recorder_by_user":true, | ||
| 8 | + "enable_callback_recording":false, | ||
| 9 | + "enable_dialog":false | ||
| 10 | + }, | ||
| 11 | + "nls_config":{ | ||
| 12 | + "debug_level":4, | ||
| 13 | + "sr_format":"opus", | ||
| 14 | + "sample_rate":16000, | ||
| 15 | + "dns_timeout":5000, | ||
| 16 | + "vocab_default_weight":2 | ||
| 17 | + }, | ||
| 18 | + "audio_config":{ | ||
| 19 | + "debug":"none", | ||
| 20 | + "16k_audio":{ | ||
| 21 | + "name":"16kmono16bit", | ||
| 22 | + "id":0, | ||
| 23 | + "mic":{ | ||
| 24 | + "name":"16kmono16bit", | ||
| 25 | + "debug_heap_pollution":false, | ||
| 26 | + "read_cnt":0, | ||
| 27 | + "sample_rate":16000, | ||
| 28 | + "bits_per_sample":16, | ||
| 29 | + "channels":1, | ||
| 30 | + "recording_interval":10, | ||
| 31 | + "cei_frame_time_len":20, | ||
| 32 | + "channel_mask":"kAMChannalMaskNone", | ||
| 33 | + "format_type":"kAMDataFormatPcmInterleaved", | ||
| 34 | + "endianness":"kAMByteOrderLittleEndian" | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + "8k_audio":{ | ||
| 38 | + "name":"8kmono16bit", | ||
| 39 | + "id":0, | ||
| 40 | + "mic":{ | ||
| 41 | + "name":"8kmono16bit", | ||
| 42 | + "debug_heap_pollution":false, | ||
| 43 | + "read_cnt":0, | ||
| 44 | + "sample_rate":8000, | ||
| 45 | + "bits_per_sample":16, | ||
| 46 | + "channels":1, | ||
| 47 | + "recording_interval":10, | ||
| 48 | + "cei_frame_time_len":20, | ||
| 49 | + "channel_mask":"kAMChannalMaskNone", | ||
| 50 | + "format_type":"kAMDataFormatPcmInterleaved", | ||
| 51 | + "endianness":"kAMByteOrderLittleEndian" | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | +} |
sight_harmony/features/wdHwAbility/src/main/resources/resfile/resources_cloud/tts/parameter.cfg
0 → 100755
| 1 | +{ | ||
| 2 | + "device_type":"car", | ||
| 3 | + "mode_type":2, | ||
| 4 | + "smart_engine":3, | ||
| 5 | + "encode_type":"pcm", | ||
| 6 | + "debug_info":{ | ||
| 7 | + "debug_level":0, | ||
| 8 | + "debug_path":"/sdcard/tmp" | ||
| 9 | + }, | ||
| 10 | + "common_info":{ | ||
| 11 | + "pitch_level":0, | ||
| 12 | + "speed_level":1.0, | ||
| 13 | + "volume":1.0, | ||
| 14 | + "play_audio":0, | ||
| 15 | + "callback_raw_data":1, | ||
| 16 | + "sample_rate":16000, | ||
| 17 | + "font_name":"xiaoyun", | ||
| 18 | + "wait_time":2000 | ||
| 19 | + }, | ||
| 20 | + "cache":{ | ||
| 21 | + "on":true, | ||
| 22 | + "max_cache_size":2000000, | ||
| 23 | + "save_path":"/sdcard/mit/" | ||
| 24 | + }, | ||
| 25 | + "font":{ | ||
| 26 | + "on":false, | ||
| 27 | + "mode":"cmd", | ||
| 28 | + "save_path":"/sdcard/mit" | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + |
| @@ -35,5 +35,6 @@ export enum Events { | @@ -35,5 +35,6 @@ export enum Events { | ||
| 35 | STATE_CHANGE = 'stateChange', | 35 | STATE_CHANGE = 'stateChange', |
| 36 | VIDEO_SIZE_CHANGE = "videoSizeChange", | 36 | VIDEO_SIZE_CHANGE = "videoSizeChange", |
| 37 | TIME_UPDATE = 'timeUpdate', | 37 | TIME_UPDATE = 'timeUpdate', |
| 38 | - ERROR = 'error' | 38 | + ERROR = 'error', |
| 39 | + AUDIOINTERRUPT = 'audioInterrupt' | ||
| 39 | } | 40 | } |
| @@ -85,6 +85,7 @@ export class WDPlayerController { | @@ -85,6 +85,7 @@ export class WDPlayerController { | ||
| 85 | */ | 85 | */ |
| 86 | private bindState() { | 86 | private bindState() { |
| 87 | this.avPlayer?.on(Events.STATE_CHANGE, async (state) => { | 87 | this.avPlayer?.on(Events.STATE_CHANGE, async (state) => { |
| 88 | + //console.info(TAG,`cj2024 state = ${state}`) | ||
| 88 | if (this.avPlayer == null) { | 89 | if (this.avPlayer == null) { |
| 89 | return | 90 | return |
| 90 | } | 91 | } |
| @@ -179,6 +180,49 @@ export class WDPlayerController { | @@ -179,6 +180,49 @@ export class WDPlayerController { | ||
| 179 | this.videoWidth = width | 180 | this.videoWidth = width |
| 180 | this.videoHeight = height | 181 | this.videoHeight = height |
| 181 | }) | 182 | }) |
| 183 | + this.avPlayer?.on(Events.AUDIOINTERRUPT, async(interruptEvent: audio.InterruptEvent) => { | ||
| 184 | + //https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/media/audio/audio-playback-concurrency.md#%E5%A4%84%E7%90%86%E9%9F%B3%E9%A2%91%E7%84%A6%E7%82%B9%E4%BA%8B%E4%BB%B6 | ||
| 185 | + if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) { | ||
| 186 | + switch (interruptEvent.hintType) { | ||
| 187 | + case audio.InterruptHint.INTERRUPT_HINT_RESUME: | ||
| 188 | + await this.play() | ||
| 189 | + break; | ||
| 190 | + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: | ||
| 191 | + // 此分支表示系统已将音频流暂停(临时失去焦点),为保持状态一致,应用需切换至音频暂停状态 | ||
| 192 | + // 临时失去焦点:待其他音频流释放音频焦点后,本音频流会收到resume对应的音频打断事件,到时可自行继续播放 | ||
| 193 | + case audio.InterruptHint.INTERRUPT_HINT_STOP: | ||
| 194 | + // 此分支表示系统已将音频流停止(永久失去焦点),为保持状态一致,应用需切换至音频暂停状态 | ||
| 195 | + // 永久失去焦点:后续不会再收到任何音频打断事件,若想恢复播放,需要用户主动触发。 | ||
| 196 | + // this.avPlayer?.play() | ||
| 197 | + await this.pause() | ||
| 198 | + break; | ||
| 199 | + } | ||
| 200 | + }else if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_SHARE) { | ||
| 201 | + // 共享打断类型(INTERRUPT_SHARE):应用可自主选择执行相关操作或忽略音频打断事件 | ||
| 202 | + switch (interruptEvent.hintType) { | ||
| 203 | + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: | ||
| 204 | + case audio.InterruptHint.INTERRUPT_HINT_RESUME: | ||
| 205 | + // 此分支表示临时失去焦点后被暂停的音频流此时可以继续播放,建议应用继续播放,切换至音频播放状态 | ||
| 206 | + // 若应用此时不想继续播放,可以忽略此音频打断事件,不进行处理即可 | ||
| 207 | + // 继续播放,此处主动执行start(),以标识符变量started记录start()的执行结果 | ||
| 208 | + // await audioRenderer.start().then(() => { | ||
| 209 | + // started = true; // start()执行成功 | ||
| 210 | + // }).catch((err: BusinessError) => { | ||
| 211 | + // started = false; // start()执行失败 | ||
| 212 | + // }); | ||
| 213 | + // // 若start()执行成功,则切换至音频播放状态 | ||
| 214 | + // if (started) { | ||
| 215 | + // isPlay = true; // 此句为简化处理,代表应用切换至音频播放状态的若干操作 | ||
| 216 | + // } else { | ||
| 217 | + // // 音频继续播放执行失败 | ||
| 218 | + // } | ||
| 219 | + this.avPlayer?.play() | ||
| 220 | + break; | ||
| 221 | + default: | ||
| 222 | + break; | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + }) | ||
| 182 | } | 226 | } |
| 183 | 227 | ||
| 184 | public setXComponentController(controller: XComponentController) { | 228 | public setXComponentController(controller: XComponentController) { |
| @@ -271,10 +315,12 @@ export class WDPlayerController { | @@ -271,10 +315,12 @@ export class WDPlayerController { | ||
| 271 | // if (this.avPlayer == null) { | 315 | // if (this.avPlayer == null) { |
| 272 | // return | 316 | // return |
| 273 | // } | 317 | // } |
| 318 | + //Logger.debug(TAG, "start play") | ||
| 274 | this.avPlayer?.prepare().then(() => { | 319 | this.avPlayer?.prepare().then(() => { |
| 275 | this.avPlayer?.play() | 320 | this.avPlayer?.play() |
| 276 | }, (err: BusinessError) => { | 321 | }, (err: BusinessError) => { |
| 277 | - console.error('Failed to prepare,error message is :' + err.message) | 322 | + console.error(TAG,'Failed to prepare,error message is :' + err.message) |
| 323 | + //this.avPlayer?.stop() | ||
| 278 | }) | 324 | }) |
| 279 | } | 325 | } |
| 280 | 326 |
| 1 | +{"v":"5.6.10","fr":60,"ip":0,"op":90,"w":560,"h":560,"nm":"波纹","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"语音","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[12.98,14.416,0],"ix":1},"s":{"a":0,"k":[300,300,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.122,-0.519],[0,0],[-4.764,-0.045],[0,0],[-1.197,4.408],[0,0],[0,0],[-0.519,-0.123],[0,0],[0.123,-0.519],[0,0],[5.457,-0.527],[0,0],[0.008,-0.042],[0.016,-0.039],[0.023,-0.035],[0.03,-0.03],[0.035,-0.023],[0.039,-0.016],[0.041,-0.009],[0.042,0],[0,0],[0.041,0.008],[0.039,0.016],[0.036,0.024],[0.03,0.03],[0.023,0.035],[0.017,0.039],[0.008,0.041],[0,0.042],[0,0],[1.37,5.161],[0,0],[0,0],[-0.52,0.122],[0,0]],"o":[[0,0],[1.08,4.582],[0,0],[4.646,-0.044],[0,0],[0,0],[0.124,-0.519],[0,0],[0.519,0.123],[0,0],[-1.272,5.357],[0,0],[0,0.042],[-0.009,0.041],[-0.016,0.039],[-0.024,0.035],[-0.029,0.03],[-0.035,0.024],[-0.039,0.016],[-0.042,0.008],[0,0],[-0.042,0],[-0.042,-0.009],[-0.039,-0.016],[-0.035,-0.023],[-0.03,-0.03],[-0.024,-0.035],[-0.016,-0.04],[-0.009,-0.042],[0,0],[-5.308,-0.547],[0,0],[0,0],[-0.122,-0.519],[0,0],[0.52,-0.122]],"v":[[-10.101,0.773],[-10.027,1.085],[-0.095,9.016],[0.098,9.016],[9.945,1.421],[10.026,1.102],[10.1,0.79],[11.263,0.072],[11.89,0.221],[12.607,1.385],[12.532,1.697],[1.248,11.531],[1.248,13.523],[1.236,13.648],[1.199,13.768],[1.14,13.88],[1.059,13.977],[0.962,14.057],[0.851,14.118],[0.73,14.154],[0.604,14.167],[-0.684,14.167],[-0.809,14.154],[-0.93,14.118],[-1.042,14.057],[-1.139,13.977],[-1.219,13.88],[-1.279,13.77],[-1.315,13.648],[-1.328,13.523],[-1.328,11.523],[-12.446,2.027],[-12.534,1.676],[-12.608,1.363],[-11.889,0.202],[-11.263,0.053]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[2.845,0],[0,-2.845],[0,0],[-2.846,0],[0,2.845]],"o":[[0,-2.845],[-2.846,0],[0,0],[0,2.845],[2.845,0],[0,0]],"v":[[5.112,-6.439],[-0.039,-11.59],[-5.191,-6.439],[-5.191,-1.288],[-0.039,3.865],[5.112,-1.288]],"c":true},"ix":2},"nm":"路径 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,0],[-4.268,0],[0,-4.268],[0,0],[4.268,0],[0,4.267]],"o":[[0,-4.268],[4.268,0],[0,0],[0,4.267],[-4.268,0],[0,0]],"v":[[-7.767,-6.439],[-0.04,-14.167],[7.687,-6.439],[7.687,-1.288],[-0.04,6.439],[-7.767,-1.288]],"c":true},"ix":2},"nm":"路径 3","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"合并路径 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[12.98,14.416],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"组 1","np":5,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"按钮","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":0,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":10,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":20,"s":[210,210]},{"t":30,"s":[210,210]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.929411764706,0.156862745098,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"按钮 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":0,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":10,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":20,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":30,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":90,"s":[210,210]},{"t":130,"s":[300,300]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0.929411764706,0.156862745098,0,1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":90,"s":[1,0.683882236481,0.597104787827,1]},{"t":130,"s":[1,0.800000011921,0.745098054409,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"扩散圈","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":234,"s":[100]},{"t":240,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.59,0.59],"y":[1.003,1.003]},"o":{"x":[0.543,0.543],"y":[0,0]},"t":15,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":90,"s":[300,300]},{"t":130,"s":[390,390]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":90,"s":[1,0.798773705959,0.745113372803,1]},{"t":130,"s":[0.992156863213,0.882352948189,0.858823537827,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"扩散圈 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":234,"s":[100]},{"t":240,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.566,0.566],"y":[0.957,0.957]},"o":{"x":[0.511,0.511],"y":[0.032,0.032]},"t":30,"s":[214.752,214.752]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":90,"s":[390,390]},{"t":130,"s":[480,480]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":90,"s":[0.992432598039,0.884142348346,0.860077861711,1]},{"t":130,"s":[1,0.945098042488,0.933333337307,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":30,"op":90,"st":-30,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"扩散圈 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.566],"y":[1]},"o":{"x":[0.198],"y":[0]},"t":90,"s":[100]},{"i":{"x":[0.847],"y":[1]},"o":{"x":[0.362],"y":[0]},"t":130,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":235,"s":[100]},{"t":241,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.587,0.587],"y":[0.981,0.981]},"o":{"x":[0.526,0.526],"y":[0.103,0.103]},"t":46,"s":[233.126,233.126]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":90,"s":[480,480]},{"t":130,"s":[570,570]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.946208160999,0.934681372549,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":46,"op":90,"st":-14,"bm":0}],"markers":[]} |
| 1 | +{"v":"5.6.10","fr":60,"ip":0,"op":42,"w":560,"h":560,"nm":"波纹","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"语音","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[12.98,14.416,0],"ix":1},"s":{"a":0,"k":[300,300,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.122,-0.519],[0,0],[-4.764,-0.045],[0,0],[-1.197,4.408],[0,0],[0,0],[-0.519,-0.123],[0,0],[0.123,-0.519],[0,0],[5.457,-0.527],[0,0],[0.008,-0.042],[0.016,-0.039],[0.023,-0.035],[0.03,-0.03],[0.035,-0.023],[0.039,-0.016],[0.041,-0.009],[0.042,0],[0,0],[0.041,0.008],[0.039,0.016],[0.036,0.024],[0.03,0.03],[0.023,0.035],[0.017,0.039],[0.008,0.041],[0,0.042],[0,0],[1.37,5.161],[0,0],[0,0],[-0.52,0.122],[0,0]],"o":[[0,0],[1.08,4.582],[0,0],[4.646,-0.044],[0,0],[0,0],[0.124,-0.519],[0,0],[0.519,0.123],[0,0],[-1.272,5.357],[0,0],[0,0.042],[-0.009,0.041],[-0.016,0.039],[-0.024,0.035],[-0.029,0.03],[-0.035,0.024],[-0.039,0.016],[-0.042,0.008],[0,0],[-0.042,0],[-0.042,-0.009],[-0.039,-0.016],[-0.035,-0.023],[-0.03,-0.03],[-0.024,-0.035],[-0.016,-0.04],[-0.009,-0.042],[0,0],[-5.308,-0.547],[0,0],[0,0],[-0.122,-0.519],[0,0],[0.52,-0.122]],"v":[[-10.101,0.773],[-10.027,1.085],[-0.095,9.016],[0.098,9.016],[9.945,1.421],[10.026,1.102],[10.1,0.79],[11.263,0.072],[11.89,0.221],[12.607,1.385],[12.532,1.697],[1.248,11.531],[1.248,13.523],[1.236,13.648],[1.199,13.768],[1.14,13.88],[1.059,13.977],[0.962,14.057],[0.851,14.118],[0.73,14.154],[0.604,14.167],[-0.684,14.167],[-0.809,14.154],[-0.93,14.118],[-1.042,14.057],[-1.139,13.977],[-1.219,13.88],[-1.279,13.77],[-1.315,13.648],[-1.328,13.523],[-1.328,11.523],[-12.446,2.027],[-12.534,1.676],[-12.608,1.363],[-11.889,0.202],[-11.263,0.053]],"c":true},"ix":2},"nm":"路径 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0,0],[2.845,0],[0,-2.845],[0,0],[-2.846,0],[0,2.845]],"o":[[0,-2.845],[-2.846,0],[0,0],[0,2.845],[2.845,0],[0,0]],"v":[[5.112,-6.439],[-0.039,-11.59],[-5.191,-6.439],[-5.191,-1.288],[-0.039,3.865],[5.112,-1.288]],"c":true},"ix":2},"nm":"路径 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[0,0],[-4.268,0],[0,-4.268],[0,0],[4.268,0],[0,4.267]],"o":[[0,-4.268],[4.268,0],[0,0],[0,4.267],[-4.268,0],[0,0]],"v":[[-7.767,-6.439],[-0.04,-14.167],[7.687,-6.439],[7.687,-1.288],[-0.04,6.439],[-7.767,-1.288]],"c":true},"ix":2},"nm":"路径 3","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"合并路径 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[12.98,14.416],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"组 1","np":5,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"按钮","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-90,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-80,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-70,"s":[210,210]},{"t":-60,"s":[210,210]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.929411764706,0.156862745098,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"按钮 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-90,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-80,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":-70,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":-60,"s":[210,210]},{"i":{"x":[0.667,0.667],"y":[1,1]},"o":{"x":[0.333,0.333],"y":[0,0]},"t":0,"s":[210,210]},{"t":40,"s":[300,300]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":-90,"s":[0.929411764706,0.156862745098,0,1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[1,0.683882236481,0.597104787827,1]},{"t":40,"s":[1,0.800000011921,0.745098054409,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"扩散圈","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":144,"s":[100]},{"t":150,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.59,0.59],"y":[1.003,1.003]},"o":{"x":[0.543,0.543],"y":[0,0]},"t":-75,"s":[210,210]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":0,"s":[300,300]},{"t":40,"s":[390,390]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[1,0.798773705959,0.745113372803,1]},{"t":40,"s":[0.992156863213,0.882352948189,0.858823537827,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-90,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"扩散圈 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":144,"s":[100]},{"t":150,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.566,0.566],"y":[0.957,0.957]},"o":{"x":[0.511,0.511],"y":[0.032,0.032]},"t":-60,"s":[214.752,214.752]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":0,"s":[390,390]},{"t":40,"s":[480,480]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0.992432598039,0.884142348346,0.860077861711,1]},{"t":40,"s":[1,0.945098042488,0.933333337307,1]}],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-120,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"扩散圈 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.566],"y":[1]},"o":{"x":[0.198],"y":[0]},"t":0,"s":[100]},{"i":{"x":[0.847],"y":[1]},"o":{"x":[0.362],"y":[0]},"t":40,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.908],"y":[0]},"t":145,"s":[100]},{"t":151,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[280,280,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":1,"k":[{"i":{"x":[0.587,0.587],"y":[0.981,0.981]},"o":{"x":[0.526,0.526],"y":[0.103,0.103]},"t":-44,"s":[233.126,233.126]},{"i":{"x":[0.833,0.833],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0,0]},"t":0,"s":[480,480]},{"t":40,"s":[570,570]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.946208160999,0.934681372549,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false}],"ip":0,"op":42,"st":-104,"bm":0}],"markers":[]} |
| @@ -3,6 +3,7 @@ import { DateTimeUtils, Logger } from 'wdKit'; | @@ -3,6 +3,7 @@ import { DateTimeUtils, Logger } from 'wdKit'; | ||
| 3 | import common from '@ohos.app.ability.common'; | 3 | import common from '@ohos.app.ability.common'; |
| 4 | import window from '@ohos.window'; | 4 | import window from '@ohos.window'; |
| 5 | import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | 5 | import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; |
| 6 | +import { router } from '@kit.ArkUI'; | ||
| 6 | 7 | ||
| 7 | const TAG = 'ENewspaper'; | 8 | const TAG = 'ENewspaper'; |
| 8 | 9 | ||
| @@ -64,6 +65,7 @@ struct ENewspaper { | @@ -64,6 +65,7 @@ struct ENewspaper { | ||
| 64 | 65 | ||
| 65 | onBackPress() { | 66 | onBackPress() { |
| 66 | Logger.info(TAG, 'onBackPress'); | 67 | Logger.info(TAG, 'onBackPress'); |
| 68 | + router.back() | ||
| 67 | return true | 69 | return true |
| 68 | } | 70 | } |
| 69 | } | 71 | } |
| @@ -13,6 +13,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; | @@ -13,6 +13,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 13 | import { BottomNavigationComponent } from './view/BottomNavigationComponent'; | 13 | import { BottomNavigationComponent } from './view/BottomNavigationComponent'; |
| 14 | import LaunchDataModel from './viewModel/LaunchDataModel'; | 14 | import LaunchDataModel from './viewModel/LaunchDataModel'; |
| 15 | import { LaunchPageModel } from './viewModel/LaunchPageModel'; | 15 | import { LaunchPageModel } from './viewModel/LaunchPageModel'; |
| 16 | +import { JSON } from '@kit.ArkTS'; | ||
| 16 | 17 | ||
| 17 | const TAG = 'MainPage'; | 18 | const TAG = 'MainPage'; |
| 18 | 19 | ||
| @@ -46,14 +47,19 @@ struct MainPage { | @@ -46,14 +47,19 @@ struct MainPage { | ||
| 46 | LogoutViewModel.clearLoginInfo() | 47 | LogoutViewModel.clearLoginInfo() |
| 47 | }) | 48 | }) |
| 48 | 49 | ||
| 50 | + let GrayManage = new GrayManageModel() | ||
| 49 | let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_MOURNS_INFO_DATA_MODEL,'') as string | 51 | let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_MOURNS_INFO_DATA_MODEL,'') as string |
| 50 | - let dataModel : LaunchDataModel = JSON.parse(dataModelStr) | ||
| 51 | - // console.log(dataModelStr) | 52 | + try { |
| 53 | + if (dataModelStr && dataModelStr.length > 0) { | ||
| 54 | + let dataModel : LaunchDataModel = JSON.parse(dataModelStr) as LaunchDataModel | ||
| 52 | // 处理国殇模式数据 | 55 | // 处理国殇模式数据 |
| 53 | let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel | 56 | let mourns: mournsInfoModel = dataModel.mourns as mournsInfoModel |
| 54 | - let GrayManage = new GrayManageModel() | ||
| 55 | GrayManage.setMourning(mourns) | 57 | GrayManage.setMourning(mourns) |
| 58 | + } | ||
| 56 | AppStorage.setOrCreate('GrayManage', GrayManage) | 59 | AppStorage.setOrCreate('GrayManage', GrayManage) |
| 60 | + } catch (e) { | ||
| 61 | + Logger.error(TAG, `Unexpected Text in JSON ??` + JSON.stringify(e) +" " + dataModelStr); | ||
| 62 | + } | ||
| 57 | } | 63 | } |
| 58 | 64 | ||
| 59 | pageTransition() { | 65 | pageTransition() { |
| @@ -20,7 +20,7 @@ struct MorningEveningPaperPage { | @@ -20,7 +20,7 @@ struct MorningEveningPaperPage { | ||
| 20 | 20 | ||
| 21 | pageTransition() { | 21 | pageTransition() { |
| 22 | // 定义页面进入时的效果,从底侧滑入 | 22 | // 定义页面进入时的效果,从底侧滑入 |
| 23 | - PageTransitionEnter({ type: RouteType.Push, duration: 200 }) | 23 | + PageTransitionEnter({ type: RouteType.Push, duration: 300 }) |
| 24 | .slide(SlideEffect.Bottom).onEnter((type: RouteType, progress: number) => { | 24 | .slide(SlideEffect.Bottom).onEnter((type: RouteType, progress: number) => { |
| 25 | if (progress >= 0.99) { | 25 | if (progress >= 0.99) { |
| 26 | // WindowModel.shared.setWindowLayoutFullScreen(true) | 26 | // WindowModel.shared.setWindowLayoutFullScreen(true) |
| @@ -207,7 +207,11 @@ export struct VideoChannelPage { | @@ -207,7 +207,11 @@ export struct VideoChannelPage { | ||
| 207 | top: px2vp(this.topSafeHeight) | 207 | top: px2vp(this.topSafeHeight) |
| 208 | }) | 208 | }) |
| 209 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 209 | .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 210 | - | 210 | + .linearGradient({ |
| 211 | + colors: [ | ||
| 212 | + ['rgba(18, 18, 18, 0.5)', 0.0], ['rgba(18, 18, 18, 0.0)', 1.0] | ||
| 213 | + ] | ||
| 214 | + }) | ||
| 211 | } | 215 | } |
| 212 | 216 | ||
| 213 | /** | 217 | /** |
| @@ -19,15 +19,6 @@ struct DefaultWebPage { | @@ -19,15 +19,6 @@ struct DefaultWebPage { | ||
| 19 | 19 | ||
| 20 | build() { | 20 | build() { |
| 21 | Column() { | 21 | Column() { |
| 22 | - Column() { | ||
| 23 | - WdWebComponent({ | ||
| 24 | - webviewControl: this.webviewControl, | ||
| 25 | - webUrl: this.webUrl, | ||
| 26 | - isPageEnd: $isPageEnd | ||
| 27 | - }) | ||
| 28 | - }.layoutWeight(1) | ||
| 29 | - | ||
| 30 | - | ||
| 31 | Row() { | 22 | Row() { |
| 32 | Button({ type: ButtonType.Normal }) { | 23 | Button({ type: ButtonType.Normal }) { |
| 33 | Image($r("app.media.back_icon_black")) | 24 | Image($r("app.media.back_icon_black")) |
| @@ -42,6 +33,14 @@ struct DefaultWebPage { | @@ -42,6 +33,14 @@ struct DefaultWebPage { | ||
| 42 | }.width("100%").height(44) | 33 | }.width("100%").height(44) |
| 43 | .alignItems(VerticalAlign.Center) | 34 | .alignItems(VerticalAlign.Center) |
| 44 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) | 35 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) |
| 36 | + | ||
| 37 | + Column() { | ||
| 38 | + WdWebComponent({ | ||
| 39 | + webviewControl: this.webviewControl, | ||
| 40 | + webUrl: this.webUrl, | ||
| 41 | + isPageEnd: $isPageEnd | ||
| 42 | + }) | ||
| 43 | + }.layoutWeight(1) | ||
| 45 | } | 44 | } |
| 46 | .width(CommonConstants.FULL_WIDTH) | 45 | .width(CommonConstants.FULL_WIDTH) |
| 47 | .height(CommonConstants.FULL_HEIGHT).padding({ | 46 | .height(CommonConstants.FULL_HEIGHT).padding({ |
| @@ -184,17 +184,7 @@ | @@ -184,17 +184,7 @@ | ||
| 184 | ], | 184 | ], |
| 185 | "requestPermissions": [ | 185 | "requestPermissions": [ |
| 186 | { | 186 | { |
| 187 | - "name": "ohos.permission.CAMERA", | ||
| 188 | - "reason": "$string:permission_camera_tip", | ||
| 189 | - "usedScene": { | ||
| 190 | - "abilities": [ | ||
| 191 | - "FormAbility" | ||
| 192 | - ], | ||
| 193 | - "when": "inuse" | ||
| 194 | - } | ||
| 195 | - }, | ||
| 196 | - { | ||
| 197 | - "name": "ohos.permission.READ_MEDIA", | 187 | + "name": "ohos.permission.READ_IMAGEVIDEO", |
| 198 | "reason": "$string:permission_photo_tip", | 188 | "reason": "$string:permission_photo_tip", |
| 199 | "usedScene": { | 189 | "usedScene": { |
| 200 | "abilities": [ | 190 | "abilities": [ |
| @@ -204,7 +194,7 @@ | @@ -204,7 +194,7 @@ | ||
| 204 | } | 194 | } |
| 205 | }, | 195 | }, |
| 206 | { | 196 | { |
| 207 | - "name": "ohos.permission.WRITE_MEDIA", | 197 | + "name": "ohos.permission.WRITE_IMAGEVIDEO", |
| 208 | "reason": "$string:permission_photo_tip", | 198 | "reason": "$string:permission_photo_tip", |
| 209 | "usedScene": { | 199 | "usedScene": { |
| 210 | "abilities": [ | 200 | "abilities": [ |
| 1 | +{ | ||
| 2 | + "cei":{ | ||
| 3 | + "cei_param_version":"2.2.0", | ||
| 4 | + "cei_param_device_type":"car", | ||
| 5 | + "cei_param_reco_mode":0, | ||
| 6 | + "cei_param_log_level":2, | ||
| 7 | + "cei_param_debug_path":"asr_debug", | ||
| 8 | + "cei_param_is_debug_enable":false, | ||
| 9 | + "cei_param_resource_path":"", | ||
| 10 | + "cei_param_resource_is_multi_language":false, | ||
| 11 | + "cei_param_audio_format_str":"16k16bitmono", | ||
| 12 | + "cei_param_mcs_mode":0, | ||
| 13 | + "cei_param_work_mode":0, | ||
| 14 | + "cei_param_max_cache_frames":1000, | ||
| 15 | + "cei_param_is_aec_bf_active":false, | ||
| 16 | + "cei_param_is_agc_active":false, | ||
| 17 | + "cei_param_is_vad_active":true, | ||
| 18 | + "cei_param_is_kws_active":true, | ||
| 19 | + "cei_param_is_sr_active":true | ||
| 20 | + }, | ||
| 21 | + "asp":{ | ||
| 22 | + "asp_param_is_process_parallel":false, | ||
| 23 | + "asp_param_is_input_debug_enable":false, | ||
| 24 | + "asp_param_is_output_debug_enable":false, | ||
| 25 | + "asp_param_debug_path":"asr_debug", | ||
| 26 | + "asp_param_is_callback_enable":false, | ||
| 27 | + "asp_param_callback_period_frames":5 | ||
| 28 | + }, | ||
| 29 | + "vad":{ | ||
| 30 | + "vad_param_is_input_debug_enable":false, | ||
| 31 | + "vad_param_is_output_debug_enable":false, | ||
| 32 | + "vad_param_debug_path":"asr_debug", | ||
| 33 | + "vad_param_asleep_speech_noise_thres":-0.8, | ||
| 34 | + "vad_param_awake_speech_noise_thres":-0.5, | ||
| 35 | + "vad_param_asleep_max_speech_segment_time":300000, | ||
| 36 | + "vad_param_awake_max_speech_segment_time":60000, | ||
| 37 | + "vad_param_asleep_block_size":3, | ||
| 38 | + "vad_param_awake_block_size":3, | ||
| 39 | + "vad_param_front_timeout_interval":8000, | ||
| 40 | + "vad_param_tail_timeout_interval":800, | ||
| 41 | + "vad_param_is_detect_start":true, | ||
| 42 | + "vad_param_is_detect_end":true | ||
| 43 | + }, | ||
| 44 | + "kws":{ | ||
| 45 | + "kws_param_is_input_debug_enable":false, | ||
| 46 | + "kws_param_is_output_debug_enable":false, | ||
| 47 | + "kws_param_debug_path":"asr_debug", | ||
| 48 | + "kws_param_is_process_parallel":false, | ||
| 49 | + "kws_param_front_extend_frames":10, | ||
| 50 | + "kws_param_tail_extend_frames":5, | ||
| 51 | + "kws_param_encoder_type_str":"opu", | ||
| 52 | + "kws_param_encoder_bitrate":16000, | ||
| 53 | + "kws_param_encoder_complexity":2, | ||
| 54 | + "kws_param_callback_period_ms":100, | ||
| 55 | + "kws_param_max_frames_per_callback":25, | ||
| 56 | + "kws_param_max_bytes_per_callback":16000 | ||
| 57 | + }, | ||
| 58 | + "sr":{ | ||
| 59 | + "sr_param_is_input_debug_enable":false, | ||
| 60 | + "sr_param_is_output_debug_enable":false, | ||
| 61 | + "sr_param_debug_path":"asr_debug", | ||
| 62 | + "sr_param_is_itn_enable":true, | ||
| 63 | + "sr_param_is_do_conf_filter":false, | ||
| 64 | + "sr_param_is_process_parallel":true, | ||
| 65 | + "sr_param_is_need_result":false, | ||
| 66 | + "sr_param_is_need_voice":true, | ||
| 67 | + "sr_param_ngram_conf_thres":65.0, | ||
| 68 | + "sr_param_jsgf_conf_thres":65.0, | ||
| 69 | + "sr_param_encoder_type_str":"opu", | ||
| 70 | + "sr_param_encoder_bitrate":16000, | ||
| 71 | + "sr_param_encoder_complexity":2, | ||
| 72 | + "sr_param_callback_period_ms":100, | ||
| 73 | + "sr_param_max_frames_per_callback":25, | ||
| 74 | + "sr_param_max_bytes_per_callback":16000 | ||
| 75 | + }, | ||
| 76 | + "ou":{ | ||
| 77 | + "oss_upload_param_is_enable":false, | ||
| 78 | + "oss_upload_param_asp_in":false, | ||
| 79 | + "oss_upload_param_asp_out":false, | ||
| 80 | + "oss_upload_param_vad_in":false, | ||
| 81 | + "oss_upload_param_vad_out":false, | ||
| 82 | + "oss_upload_param_kws_in":false, | ||
| 83 | + "oss_upload_param_kws_susp_in":false, | ||
| 84 | + "oss_upload_param_kws_out":false, | ||
| 85 | + "oss_upload_param_kws_susp_out":false, | ||
| 86 | + "oss_upload_param_sr_in":false | ||
| 87 | + } | ||
| 88 | +} |
| 1 | +{ | ||
| 2 | + "device_type":"phone", | ||
| 3 | + "assets_version":"1.1.20190902", | ||
| 4 | + "nui_config":{ | ||
| 5 | + "service_mode":"kModeFullCloud", | ||
| 6 | + "log_level":"kLogLevelVerbose", | ||
| 7 | + "enable_recorder_by_user":true, | ||
| 8 | + "enable_callback_recording":false, | ||
| 9 | + "enable_dialog":false | ||
| 10 | + }, | ||
| 11 | + "nls_config":{ | ||
| 12 | + "debug_level":4, | ||
| 13 | + "sr_format":"opus", | ||
| 14 | + "sample_rate":16000, | ||
| 15 | + "dns_timeout":5000, | ||
| 16 | + "vocab_default_weight":2 | ||
| 17 | + }, | ||
| 18 | + "audio_config":{ | ||
| 19 | + "debug":"none", | ||
| 20 | + "16k_audio":{ | ||
| 21 | + "name":"16kmono16bit", | ||
| 22 | + "id":0, | ||
| 23 | + "mic":{ | ||
| 24 | + "name":"16kmono16bit", | ||
| 25 | + "debug_heap_pollution":false, | ||
| 26 | + "read_cnt":0, | ||
| 27 | + "sample_rate":16000, | ||
| 28 | + "bits_per_sample":16, | ||
| 29 | + "channels":1, | ||
| 30 | + "recording_interval":10, | ||
| 31 | + "cei_frame_time_len":20, | ||
| 32 | + "channel_mask":"kAMChannalMaskNone", | ||
| 33 | + "format_type":"kAMDataFormatPcmInterleaved", | ||
| 34 | + "endianness":"kAMByteOrderLittleEndian" | ||
| 35 | + } | ||
| 36 | + }, | ||
| 37 | + "8k_audio":{ | ||
| 38 | + "name":"8kmono16bit", | ||
| 39 | + "id":0, | ||
| 40 | + "mic":{ | ||
| 41 | + "name":"8kmono16bit", | ||
| 42 | + "debug_heap_pollution":false, | ||
| 43 | + "read_cnt":0, | ||
| 44 | + "sample_rate":8000, | ||
| 45 | + "bits_per_sample":16, | ||
| 46 | + "channels":1, | ||
| 47 | + "recording_interval":10, | ||
| 48 | + "cei_frame_time_len":20, | ||
| 49 | + "channel_mask":"kAMChannalMaskNone", | ||
| 50 | + "format_type":"kAMDataFormatPcmInterleaved", | ||
| 51 | + "endianness":"kAMByteOrderLittleEndian" | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | +} |
sight_harmony/products/phone/src/main/resources/resfile/resources_cloud/tts/parameter.cfg
0 → 100755
| 1 | +{ | ||
| 2 | + "device_type":"car", | ||
| 3 | + "mode_type":2, | ||
| 4 | + "smart_engine":3, | ||
| 5 | + "encode_type":"pcm", | ||
| 6 | + "debug_info":{ | ||
| 7 | + "debug_level":0, | ||
| 8 | + "debug_path":"/sdcard/tmp" | ||
| 9 | + }, | ||
| 10 | + "common_info":{ | ||
| 11 | + "pitch_level":0, | ||
| 12 | + "speed_level":1.0, | ||
| 13 | + "volume":1.0, | ||
| 14 | + "play_audio":0, | ||
| 15 | + "callback_raw_data":1, | ||
| 16 | + "sample_rate":16000, | ||
| 17 | + "font_name":"xiaoyun", | ||
| 18 | + "wait_time":2000 | ||
| 19 | + }, | ||
| 20 | + "cache":{ | ||
| 21 | + "on":true, | ||
| 22 | + "max_cache_size":2000000, | ||
| 23 | + "save_path":"/sdcard/mit/" | ||
| 24 | + }, | ||
| 25 | + "font":{ | ||
| 26 | + "on":false, | ||
| 27 | + "mode":"cmd", | ||
| 28 | + "save_path":"/sdcard/mit" | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + |
-
Please register or login to post a comment