Showing
26 changed files
with
622 additions
and
537 deletions
| @@ -49,6 +49,7 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | @@ -49,6 +49,7 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | ||
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | /** | 51 | /** |
| 52 | + * 动态详情页UI | ||
| 52 | * @author wd-zsz | 53 | * @author wd-zsz |
| 53 | * */ | 54 | * */ |
| 54 | // @Preview | 55 | // @Preview |
| @@ -533,6 +534,8 @@ export struct DynamicDetailComponent { | @@ -533,6 +534,8 @@ export struct DynamicDetailComponent { | ||
| 533 | } | 534 | } |
| 534 | //点赞操作 | 535 | //点赞操作 |
| 535 | this.toggleLikeStatus() | 536 | this.toggleLikeStatus() |
| 537 | + //内容点赞/取消点赞埋点 | ||
| 538 | + | ||
| 536 | }) | 539 | }) |
| 537 | 540 | ||
| 538 | // 评论 | 541 | // 评论 |
| 1 | import { ContentDTO, NewspaperListItemBean, NewspaperPositionItemBean, Params } from 'wdBean'; | 1 | import { ContentDTO, NewspaperListItemBean, NewspaperPositionItemBean, Params } from 'wdBean'; |
| 2 | import { StringUtils } from 'wdKit'; | 2 | import { StringUtils } from 'wdKit'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | +import { TrackingContent,TrackConstants } from 'wdTracking/Index'; | ||
| 4 | import { newsSkeleton } from './skeleton/newsSkeleton'; | 5 | import { newsSkeleton } from './skeleton/newsSkeleton'; |
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| @@ -13,6 +14,20 @@ export struct ENewspaperItemComponent { | @@ -13,6 +14,20 @@ export struct ENewspaperItemComponent { | ||
| 13 | private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean | 14 | private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean |
| 14 | @State isShowSkeleton: boolean = true | 15 | @State isShowSkeleton: boolean = true |
| 15 | 16 | ||
| 17 | + aboutToAppear(): void { | ||
| 18 | + for (let index = 0; index < this.newspaperListItemBean.items.length; index++) { | ||
| 19 | + const element = this.newspaperListItemBean.items[index]; | ||
| 20 | + TrackingContent.common(TrackConstants.EventType.Show,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage | ||
| 21 | + ,{ | ||
| 22 | + 'contentName':element.title, | ||
| 23 | + 'contentType':element.newsType, | ||
| 24 | + 'contentId':element.newsId, | ||
| 25 | + 'panelNumber':this.newspaperListItemBean.pageNum, | ||
| 26 | + 'panelName':this.newspaperListItemBean.pageName, | ||
| 27 | + 'readMode':'1', | ||
| 28 | + }) | ||
| 29 | + } | ||
| 30 | + } | ||
| 16 | build() { | 31 | build() { |
| 17 | Stack() { | 32 | Stack() { |
| 18 | newsSkeleton() | 33 | newsSkeleton() |
| @@ -70,6 +85,16 @@ export struct ENewspaperItemComponent { | @@ -70,6 +85,16 @@ export struct ENewspaperItemComponent { | ||
| 70 | relType:this.itemBeanClicked.relType ?? '0' | 85 | relType:this.itemBeanClicked.relType ?? '0' |
| 71 | } as ContentDTO | 86 | } as ContentDTO |
| 72 | ProcessUtils.processPage(content) | 87 | ProcessUtils.processPage(content) |
| 88 | + //内容点击 | ||
| 89 | + TrackingContent.commentClickWithEvent('current_Number_Panel_content_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage | ||
| 90 | + ,{ | ||
| 91 | + 'contentName':this.itemBeanClicked.title, | ||
| 92 | + 'contentType':this.itemBeanClicked.newsType, | ||
| 93 | + 'contentId':this.itemBeanClicked.newsId, | ||
| 94 | + 'panelNumber':this.newspaperListItemBean.pageNum, | ||
| 95 | + 'panelName':this.newspaperListItemBean.pageName, | ||
| 96 | + 'readMode':'1', | ||
| 97 | + }) | ||
| 73 | this.itemBeanClicked = {} as NewspaperPositionItemBean | 98 | this.itemBeanClicked = {} as NewspaperPositionItemBean |
| 74 | } | 99 | } |
| 75 | } | 100 | } |
| @@ -10,7 +10,7 @@ import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; | @@ -10,7 +10,7 @@ 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 } from 'wdKit/Index'; | 12 | import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index'; |
| 13 | -import { promptAction } from '@kit.ArkUI'; | 13 | +import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 14 | 14 | ||
| 15 | @Component | 15 | @Component |
| 16 | export struct ENewspaperPageComponent { | 16 | export struct ENewspaperPageComponent { |
| @@ -34,6 +34,15 @@ export struct ENewspaperPageComponent { | @@ -34,6 +34,15 @@ export struct ENewspaperPageComponent { | ||
| 34 | let _swiperIndex = Number.parseInt(this.currentPageNum) | 34 | let _swiperIndex = Number.parseInt(this.currentPageNum) |
| 35 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex) | 35 | console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex) |
| 36 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | 36 | this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex |
| 37 | + | ||
| 38 | + //电子报--版面序号选择点击 | ||
| 39 | + TrackingContent.commentClickWithEvent('panel_number_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage | ||
| 40 | + ,{ | ||
| 41 | + 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum, | ||
| 42 | + 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, | ||
| 43 | + 'currentPanelDate':this.selectDate.toDateString(), | ||
| 44 | + 'currentNumber':this.swiperIndex, | ||
| 45 | + }) | ||
| 37 | } | 46 | } |
| 38 | 47 | ||
| 39 | //日历选择弹框 | 48 | //日历选择弹框 |
| @@ -51,6 +60,14 @@ export struct ENewspaperPageComponent { | @@ -51,6 +60,14 @@ export struct ENewspaperPageComponent { | ||
| 51 | this.selectDate = | 60 | this.selectDate = |
| 52 | new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) | 61 | new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) |
| 53 | } | 62 | } |
| 63 | + //日历选择点击 | ||
| 64 | + TrackingContent.commentClickWithEvent('date_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage | ||
| 65 | + ,{ | ||
| 66 | + 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum, | ||
| 67 | + 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, | ||
| 68 | + 'currentPanelDate':this.selectDate.toDateString(), | ||
| 69 | + 'currentNumber':this.swiperIndex, | ||
| 70 | + }) | ||
| 54 | } | 71 | } |
| 55 | }), | 72 | }), |
| 56 | alignment: DialogAlignment.Top, | 73 | alignment: DialogAlignment.Top, |
| @@ -190,7 +207,7 @@ export struct ENewspaperPageComponent { | @@ -190,7 +207,7 @@ export struct ENewspaperPageComponent { | ||
| 190 | if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 207 | if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 191 | Swiper(this.swiperController) { | 208 | Swiper(this.swiperController) { |
| 192 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { | 209 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { |
| 193 | - ENewspaperItemComponent({ newspaperListItemBean: item }) | 210 | + ENewspaperItemComponent({ newspaperListItemBean: item}) |
| 194 | }) | 211 | }) |
| 195 | } | 212 | } |
| 196 | .index(this.swiperIndex) | 213 | .index(this.swiperIndex) |
| @@ -245,6 +262,12 @@ export struct ENewspaperPageComponent { | @@ -245,6 +262,12 @@ export struct ENewspaperPageComponent { | ||
| 245 | .id('e_newspaper_next') | 262 | .id('e_newspaper_next') |
| 246 | .onClick((event: ClickEvent) => { | 263 | .onClick((event: ClickEvent) => { |
| 247 | this.swiperController.showNext() | 264 | this.swiperController.showNext() |
| 265 | + // 电子报--滑动查看下一版 | ||
| 266 | + TrackingButton.click('panelPageViewNextPanel',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage | ||
| 267 | + ,{ | ||
| 268 | + 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum, | ||
| 269 | + 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, | ||
| 270 | + }) | ||
| 248 | }) | 271 | }) |
| 249 | } | 272 | } |
| 250 | 273 | ||
| @@ -316,6 +339,14 @@ export struct ENewspaperPageComponent { | @@ -316,6 +339,14 @@ export struct ENewspaperPageComponent { | ||
| 316 | } | 339 | } |
| 317 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 340 | if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 318 | this.isOpenListDialog = true | 341 | this.isOpenListDialog = true |
| 342 | + //电子报--读报纸点击 | ||
| 343 | + TrackingContent.commentClickWithEvent('read_newspaper_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage | ||
| 344 | + ,{ | ||
| 345 | + 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum, | ||
| 346 | + 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, | ||
| 347 | + 'currentPanelDate':this.selectDate.toDateString(), | ||
| 348 | + 'currentNumber':this.swiperIndex, | ||
| 349 | + }) | ||
| 319 | }else { | 350 | }else { |
| 320 | ToastUtils.showToast('暂无数据', 1000) | 351 | ToastUtils.showToast('暂无数据', 1000) |
| 321 | } | 352 | } |
| @@ -10,7 +10,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; | @@ -10,7 +10,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 10 | import { router } from '@kit.ArkUI'; | 10 | import { router } from '@kit.ArkUI'; |
| 11 | import { CommonConstants } from 'wdConstant/Index'; | 11 | import { CommonConstants } from 'wdConstant/Index'; |
| 12 | import { ProcessUtils } from 'wdRouter/Index'; | 12 | import { ProcessUtils } from 'wdRouter/Index'; |
| 13 | -import { TrackingPageBrowse } from 'wdTracking/Index'; | 13 | +import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'; |
| 14 | 14 | ||
| 15 | const TAG = 'FeedBackActivity' | 15 | const TAG = 'FeedBackActivity' |
| 16 | 16 | ||
| @@ -22,8 +22,6 @@ const TAG = 'FeedBackActivity' | @@ -22,8 +22,6 @@ const TAG = 'FeedBackActivity' | ||
| 22 | @Component | 22 | @Component |
| 23 | export struct FeedBackActivity { | 23 | export struct FeedBackActivity { |
| 24 | pageShowTime:number = 0; | 24 | pageShowTime:number = 0; |
| 25 | - pageId:string = 'feedbackPage'; | ||
| 26 | - pageName:string=this.pageId; | ||
| 27 | @State canSubmit: boolean = false; | 25 | @State canSubmit: boolean = false; |
| 28 | @State textNumLabel: string = '0/500'; | 26 | @State textNumLabel: string = '0/500'; |
| 29 | contact: string = ""; | 27 | contact: string = ""; |
| @@ -66,6 +64,11 @@ export struct FeedBackActivity { | @@ -66,6 +64,11 @@ export struct FeedBackActivity { | ||
| 66 | .onChange((select) => { | 64 | .onChange((select) => { |
| 67 | feedbackTypeBean.isSelect = select | 65 | feedbackTypeBean.isSelect = select |
| 68 | this.canSubmit = this.checkSubmit() | 66 | this.canSubmit = this.checkSubmit() |
| 67 | + | ||
| 68 | + TrackingButton.click('submit_feedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,{ | ||
| 69 | + 'feedback_type':feedbackTypeBean.id+'' | ||
| 70 | + }) | ||
| 71 | + | ||
| 69 | }) | 72 | }) |
| 70 | Text(feedbackTypeBean.classifyName) | 73 | Text(feedbackTypeBean.classifyName) |
| 71 | .fontColor($r('app.color.color_222222')) | 74 | .fontColor($r('app.color.color_222222')) |
| @@ -342,9 +345,13 @@ export struct FeedBackActivity { | @@ -342,9 +345,13 @@ export struct FeedBackActivity { | ||
| 342 | }) | 345 | }) |
| 343 | if(!StringUtils.isEmpty(selectType)){ | 346 | if(!StringUtils.isEmpty(selectType)){ |
| 344 | selectType = selectType.substring(0,selectType.length-1) | 347 | selectType = selectType.substring(0,selectType.length-1) |
| 348 | + TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,{ | ||
| 349 | + 'feedbackTypeId':selectType | ||
| 350 | + }) | ||
| 345 | }else{ | 351 | }else{ |
| 346 | // | 352 | // |
| 347 | ToastUtils.shortToast($r('app.string.feedback_opinion_type')) | 353 | ToastUtils.shortToast($r('app.string.feedback_opinion_type')) |
| 354 | + TrackingButton.click('feedbackPageSubmitFeedback',TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage) | ||
| 348 | return | 355 | return |
| 349 | } | 356 | } |
| 350 | //内容必填 | 357 | //内容必填 |
| @@ -389,7 +396,7 @@ export struct FeedBackActivity { | @@ -389,7 +396,7 @@ export struct FeedBackActivity { | ||
| 389 | } | 396 | } |
| 390 | onPageHide() { | 397 | onPageHide() { |
| 391 | //页面浏览 | 398 | //页面浏览 |
| 392 | - TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) | 399 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.FeedbackPage,TrackConstants.PageName.FeedbackPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) |
| 393 | 400 | ||
| 394 | } | 401 | } |
| 395 | } | 402 | } |
| @@ -67,6 +67,7 @@ export struct MorningEveningPaperComponent { | @@ -67,6 +67,7 @@ export struct MorningEveningPaperComponent { | ||
| 67 | // 顶部安全高度赋值 | 67 | // 顶部安全高度赋值 |
| 68 | @State topSafeHeight: number = 0; | 68 | @State topSafeHeight: number = 0; |
| 69 | @State bottomSafeHeight: number = 0; | 69 | @State bottomSafeHeight: number = 0; |
| 70 | + @State isHasTopView: boolean = false; | ||
| 70 | 71 | ||
| 71 | private audioDataList: AudioDataList[] = [] | 72 | private audioDataList: AudioDataList[] = [] |
| 72 | private playerController: WDPlayerController = new WDPlayerController(); | 73 | private playerController: WDPlayerController = new WDPlayerController(); |
| @@ -145,7 +146,9 @@ export struct MorningEveningPaperComponent { | @@ -145,7 +146,9 @@ export struct MorningEveningPaperComponent { | ||
| 145 | Logger.info(TAG, "pageInfoBean dateTime = " + dateTime) | 146 | Logger.info(TAG, "pageInfoBean dateTime = " + dateTime) |
| 146 | Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle) | 147 | Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle) |
| 147 | 148 | ||
| 148 | - this.setComponentBgColor(this.pageInfoBean?.topicInfo?.frontLinkObject?.coverUrl as string) | 149 | + this.isHasTopView = this.pageInfoBean?.topicInfo?.frontLinkObject?true:false |
| 150 | + let coverUrl = this.isHasTopView?this.pageInfoBean?.topicInfo?.frontLinkObject?.coverUrl as string :'' | ||
| 151 | + this.setComponentBgColor(coverUrl) | ||
| 149 | 152 | ||
| 150 | let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId) | 153 | let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId) |
| 151 | // this.compInfoBean = compInfoBean | 154 | // this.compInfoBean = compInfoBean |
| @@ -202,11 +205,9 @@ export struct MorningEveningPaperComponent { | @@ -202,11 +205,9 @@ export struct MorningEveningPaperComponent { | ||
| 202 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); | 205 | // const pixelMap: image.PixelMap = await image2PixelMap(item.icon); |
| 203 | Logger.debug(TAG, "compInfoBean compStyle = " + imageUrl) | 206 | Logger.debug(TAG, "compInfoBean compStyle = " + imageUrl) |
| 204 | 207 | ||
| 205 | - const imageSource: image.ImageSource | undefined = await getPicture(imageUrl) | ||
| 206 | - | ||
| 207 | - if (imageSource && this.pageInfoBean.topicInfo.frontFlag === 1) { | 208 | + if (imageUrl.length > 0 && this.pageInfoBean.topicInfo.frontFlag === 1) { |
| 209 | + const imageSource: image.ImageSource | undefined = await getPicture(imageUrl) | ||
| 208 | this.pickColor(imageSource) | 210 | this.pickColor(imageSource) |
| 209 | - | ||
| 210 | } else { | 211 | } else { |
| 211 | if (this.pageInfoBean.topicInfo.topicPattern === 1) { | 212 | if (this.pageInfoBean.topicInfo.topicPattern === 1) { |
| 212 | this.mixedBgColor = '#66BDBD' | 213 | this.mixedBgColor = '#66BDBD' |
| @@ -271,15 +272,21 @@ export struct MorningEveningPaperComponent { | @@ -271,15 +272,21 @@ export struct MorningEveningPaperComponent { | ||
| 271 | } | 272 | } |
| 272 | } | 273 | } |
| 273 | .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`).scrollBar(BarState.Off) | 274 | .height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`).scrollBar(BarState.Off) |
| 275 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 276 | + let persent = Math.abs(Number(newValue.globalPosition.y)) / 150 | ||
| 277 | + if (persent > 1) { | ||
| 278 | + persent = 1 | ||
| 279 | + } | ||
| 280 | + }) | ||
| 274 | 281 | ||
| 275 | - PaperTitleComponent().margin({top:this.topSafeHeight}) | 282 | + PaperTitleComponent().margin({top:this.isHasTopView?this.topSafeHeight:0}).backgroundColor(this.mixedBgColor).opacity(this.isHasTopView?0:1) |
| 276 | } | 283 | } |
| 277 | .width('100%') | 284 | .width('100%') |
| 278 | .height('100%') | 285 | .height('100%') |
| 279 | - // .padding({ | ||
| 280 | - // top: this.topSafeHeight, | ||
| 281 | - // bottom: this.bottomSafeHeight | ||
| 282 | - // }) | 286 | + .padding({ |
| 287 | + top: this.isHasTopView?0:this.topSafeHeight, | ||
| 288 | + // bottom: this.bottomSafeHeight | ||
| 289 | + }) | ||
| 283 | // .backgroundColor(Color.Black) | 290 | // .backgroundColor(Color.Black) |
| 284 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) | 291 | // .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black) |
| 285 | .backgroundColor(this.mixedBgColor ?? Color.Black) | 292 | .backgroundColor(this.mixedBgColor ?? Color.Black) |
| @@ -97,13 +97,14 @@ struct createImg { | @@ -97,13 +97,14 @@ struct createImg { | ||
| 97 | @State loadImg: boolean = false; | 97 | @State loadImg: boolean = false; |
| 98 | 98 | ||
| 99 | async aboutToAppear(): Promise<void> { | 99 | async aboutToAppear(): Promise<void> { |
| 100 | + console.log("createImg", JSON.stringify(this.contentDTO.fullColumnImgUrls)) | ||
| 100 | this.loadImg = await onlyWifiLoadImg(); | 101 | this.loadImg = await onlyWifiLoadImg(); |
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | 104 | ||
| 104 | build() { | 105 | build() { |
| 105 | GridRow() { | 106 | GridRow() { |
| 106 | - if (this.contentDTO.fullColumnImgUrls[0].landscape === 1 || this.contentDTO.fullColumnImgUrls[0].weight > this.contentDTO.fullColumnImgUrls[0].height) { | 107 | + if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) { |
| 107 | // 横屏 | 108 | // 横屏 |
| 108 | GridCol({ | 109 | GridCol({ |
| 109 | span: { xs: 12 } | 110 | span: { xs: 12 } |
| @@ -131,6 +132,7 @@ struct createImg { | @@ -131,6 +132,7 @@ struct createImg { | ||
| 131 | .backgroundColor(0xf5f5f5) | 132 | .backgroundColor(0xf5f5f5) |
| 132 | .width(CommonConstants.FULL_WIDTH) | 133 | .width(CommonConstants.FULL_WIDTH) |
| 133 | .borderRadius($r('app.float.image_border_radius')) | 134 | .borderRadius($r('app.float.image_border_radius')) |
| 135 | + .aspectRatio(172 / 230) | ||
| 134 | CardMediaInfo({ contentDTO: this.contentDTO }) | 136 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 135 | } | 137 | } |
| 136 | .align(Alignment.BottomEnd) | 138 | .align(Alignment.BottomEnd) |
| 1 | -import { CompDTO, ContentDTO, } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 2 | import { BreakpointConstants, CommonConstants } from 'wdConstant'; | 2 | import { BreakpointConstants, CommonConstants } from 'wdConstant'; |
| 3 | import { BreakPointType, Logger } from 'wdKit'; | 3 | import { BreakPointType, Logger } from 'wdKit'; |
| 4 | import { CompUtils } from '../../utils/CompUtils'; | 4 | import { CompUtils } from '../../utils/CompUtils'; |
| @@ -11,6 +11,7 @@ import { InfomationCardClick } from '../../utils/infomationCardClick' | @@ -11,6 +11,7 @@ import { InfomationCardClick } from '../../utils/infomationCardClick' | ||
| 11 | 11 | ||
| 12 | const TAG = 'Zh_Carousel_Layout-01'; | 12 | const TAG = 'Zh_Carousel_Layout-01'; |
| 13 | 13 | ||
| 14 | + | ||
| 14 | /** | 15 | /** |
| 15 | * 轮播组件,即Banner/轮播大图/焦点图/自动滑动 | 16 | * 轮播组件,即Banner/轮播大图/焦点图/自动滑动 |
| 16 | * 样式: | 17 | * 样式: |
| @@ -47,9 +48,11 @@ export struct ZhCarouselLayout01 { | @@ -47,9 +48,11 @@ export struct ZhCarouselLayout01 { | ||
| 47 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = | 48 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = |
| 48 | BreakpointConstants.BREAKPOINT_XS; | 49 | BreakpointConstants.BREAKPOINT_XS; |
| 49 | @State compDTO: CompDTO = {} as CompDTO | 50 | @State compDTO: CompDTO = {} as CompDTO |
| 51 | + | ||
| 50 | @State firstWd: number = 0 | 52 | @State firstWd: number = 0 |
| 51 | @State SecondWd: number = 0 | 53 | @State SecondWd: number = 0 |
| 52 | @State swiperIndex: number = 0 | 54 | @State swiperIndex: number = 0 |
| 55 | + | ||
| 53 | private data: MyDataSource = new MyDataSource([]) | 56 | private data: MyDataSource = new MyDataSource([]) |
| 54 | 57 | ||
| 55 | watchCurrentBreakpoint() { | 58 | watchCurrentBreakpoint() { |
| @@ -75,6 +78,7 @@ export struct ZhCarouselLayout01 { | @@ -75,6 +78,7 @@ export struct ZhCarouselLayout01 { | ||
| 75 | } | 78 | } |
| 76 | 79 | ||
| 77 | build() { | 80 | build() { |
| 81 | + | ||
| 78 | if (this.compDTO?.operDataList?.length) { | 82 | if (this.compDTO?.operDataList?.length) { |
| 79 | Stack() { | 83 | Stack() { |
| 80 | Swiper() { | 84 | Swiper() { |
| @@ -206,9 +210,19 @@ struct CarouselLayout01CardView { | @@ -206,9 +210,19 @@ struct CarouselLayout01CardView { | ||
| 206 | Blank() | 210 | Blank() |
| 207 | // 文本信息 | 211 | // 文本信息 |
| 208 | Stack() { | 212 | Stack() { |
| 209 | - if (this.item.objectType == '5' || this.item.objectType == '6') { | 213 | + if(this.item.objectType == '5'){ |
| 210 | Notes({ objectType: this.item.objectType }) | 214 | Notes({ objectType: this.item.objectType }) |
| 215 | + } else { | ||
| 216 | + if (this.item.seoTags) { | ||
| 217 | + Notes({ newTags: this.item.seoTags }) | ||
| 218 | + } | ||
| 219 | + if (this.item.newTags) { | ||
| 220 | + Notes({ newTags: this.item.newTags }) | ||
| 221 | + } | ||
| 211 | } | 222 | } |
| 223 | + // if (this.item.objectType == '5' || this.item.objectType == '6') { | ||
| 224 | + // Notes({ objectType: this.item.objectType }) | ||
| 225 | + // } | ||
| 212 | Text(`${this.item.corner}${this.item.newsTitle}`) | 226 | Text(`${this.item.corner}${this.item.newsTitle}`) |
| 213 | .width(CommonConstants.FULL_PARENT) | 227 | .width(CommonConstants.FULL_PARENT) |
| 214 | .fontColor(Color.White) | 228 | .fontColor(Color.White) |
| @@ -218,7 +232,10 @@ struct CarouselLayout01CardView { | @@ -218,7 +232,10 @@ struct CarouselLayout01CardView { | ||
| 218 | .align(Alignment.Bottom) | 232 | .align(Alignment.Bottom) |
| 219 | .maxLines(CompUtils.MAX_LINES_2) | 233 | .maxLines(CompUtils.MAX_LINES_2) |
| 220 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 234 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 221 | - .textIndent(this.item.objectType == '5' ? 35 : 0) | 235 | + .textIndent((this.item.newTags?.length || this.item.seoTags?.length) > 2 && |
| 236 | + (this.item.newTags?.length ||this.item.seoTags?.length) < 5 ? 58 : | ||
| 237 | + ((this.item.newTags?.length > 0 || this.item.seoTags?.length > 0) ||this.item.objectType == '5') ? 35 : | ||
| 238 | + 0 ) | ||
| 222 | } | 239 | } |
| 223 | // .height(39) | 240 | // .height(39) |
| 224 | .padding({ | 241 | .padding({ |
| @@ -190,12 +190,20 @@ export struct SearchResultContentComponent { | @@ -190,12 +190,20 @@ export struct SearchResultContentComponent { | ||
| 190 | }) | 190 | }) |
| 191 | let isRemain : boolean = false | 191 | let isRemain : boolean = false |
| 192 | SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => { | 192 | SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => { |
| 193 | - resultData.list.forEach((value) => { | 193 | + resultData.list.forEach((value: SearchResultContentItem) => { |
| 194 | + const landscape = value.data.landscape | ||
| 194 | let photos: FullColumnImgUrlDTO[] = [] | 195 | let photos: FullColumnImgUrlDTO[] = [] |
| 195 | // if (value.data.appStyle === 4) { | 196 | // if (value.data.appStyle === 4) { |
| 196 | value.data.appStyleImages.split("&&").forEach((value) => { | 197 | value.data.appStyleImages.split("&&").forEach((value) => { |
| 197 | const resizeParams = this.extractResizeParams(value) | 198 | const resizeParams = this.extractResizeParams(value) |
| 198 | - photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO) | 199 | + photos.push( |
| 200 | + { | ||
| 201 | + fullUrl: value, | ||
| 202 | + weight:resizeParams.width, | ||
| 203 | + height:resizeParams.height, | ||
| 204 | + landscape: Number(landscape), | ||
| 205 | + } as FullColumnImgUrlDTO | ||
| 206 | + ) | ||
| 199 | }) | 207 | }) |
| 200 | // } | 208 | // } |
| 201 | let contentDTO = this.dataTransform(rem,value, photos); | 209 | let contentDTO = this.dataTransform(rem,value, photos); |
| @@ -38,6 +38,7 @@ export struct DetailPlayLivePage { | @@ -38,6 +38,7 @@ export struct DetailPlayLivePage { | ||
| 38 | 38 | ||
| 39 | aboutToAppear(): void { | 39 | aboutToAppear(): void { |
| 40 | Logger.info(TAG, `wyj-aboutToAppear`) | 40 | Logger.info(TAG, `wyj-aboutToAppear`) |
| 41 | + | ||
| 41 | this.listener?.on("change", (mediaQueryResult) => { | 42 | this.listener?.on("change", (mediaQueryResult) => { |
| 42 | Logger.info(TAG, `change;${mediaQueryResult.matches}`) | 43 | Logger.info(TAG, `change;${mediaQueryResult.matches}`) |
| 43 | if (mediaQueryResult?.matches) { | 44 | if (mediaQueryResult?.matches) { |
| @@ -85,6 +86,7 @@ export struct DetailPlayLivePage { | @@ -85,6 +86,7 @@ export struct DetailPlayLivePage { | ||
| 85 | } | 86 | } |
| 86 | .height('100%') | 87 | .height('100%') |
| 87 | .width('100%') | 88 | .width('100%') |
| 89 | + | ||
| 88 | // 设置底部绘制延伸到导航条 | 90 | // 设置底部绘制延伸到导航条 |
| 89 | } | 91 | } |
| 90 | 92 |
| @@ -21,6 +21,8 @@ export struct PlayUIComponent { | @@ -21,6 +21,8 @@ export struct PlayUIComponent { | ||
| 21 | @State isPlayStatus: boolean = true | 21 | @State isPlayStatus: boolean = true |
| 22 | @Consume displayDirection: DisplayDirection | 22 | @Consume displayDirection: DisplayDirection |
| 23 | 23 | ||
| 24 | + @Prop isShowBottom: boolean | ||
| 25 | + | ||
| 24 | onChangeMenuVisible() { | 26 | onChangeMenuVisible() { |
| 25 | if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo || | 27 | if (!this.liveDetailsBean || !this.liveDetailsBean.liveInfo || |
| 26 | this.liveDetailsBean?.liveInfo?.liveState === 'wait') { | 28 | this.liveDetailsBean?.liveInfo?.liveState === 'wait') { |
| @@ -59,7 +61,10 @@ export struct PlayUIComponent { | @@ -59,7 +61,10 @@ export struct PlayUIComponent { | ||
| 59 | if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) { | 61 | if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) { |
| 60 | this.getTopUIComponent() | 62 | this.getTopUIComponent() |
| 61 | this.getMiddleUIComponent() | 63 | this.getMiddleUIComponent() |
| 62 | - this.getBottomUIComponent() | 64 | + if(this.isShowBottom){ |
| 65 | + this.getBottomUIComponent() | ||
| 66 | + } | ||
| 67 | + | ||
| 63 | } | 68 | } |
| 64 | } | 69 | } |
| 65 | .width('100%') | 70 | .width('100%') |
| @@ -92,7 +97,7 @@ export struct PlayUIComponent { | @@ -92,7 +97,7 @@ export struct PlayUIComponent { | ||
| 92 | .maxLines(1) | 97 | .maxLines(1) |
| 93 | .textOverflow({ overflow: TextOverflow.MARQUEE }) | 98 | .textOverflow({ overflow: TextOverflow.MARQUEE }) |
| 94 | .fontSize(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '18vp' : '16vp') | 99 | .fontSize(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '18vp' : '16vp') |
| 95 | - .fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500) | 100 | + .fontWeight(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 600 : 500) |
| 96 | .fontColor(Color.White) | 101 | .fontColor(Color.White) |
| 97 | .textAlign(TextAlign.Start) | 102 | .textAlign(TextAlign.Start) |
| 98 | .layoutWeight(1) | 103 | .layoutWeight(1) |
| 1 | import { LiveDetailsBean } from 'wdBean/Index'; | 1 | import { LiveDetailsBean } from 'wdBean/Index'; |
| 2 | import { StringUtils } from 'wdKit/Index'; | 2 | import { StringUtils } from 'wdKit/Index'; |
| 3 | -import { WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | 3 | +import { PlayerConstants, WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; |
| 4 | import { PlayUIComponent } from './PlayUIComponent'; | 4 | import { PlayUIComponent } from './PlayUIComponent'; |
| 5 | import { Logger } from 'wdKit/Index'; | 5 | import { Logger } from 'wdKit/Index'; |
| 6 | +import { PictureLoading } from '../../vertical/PictureLoading'; | ||
| 6 | 7 | ||
| 7 | const TAG: string = 'TopPlayComponent' | 8 | const TAG: string = 'TopPlayComponent' |
| 8 | 9 | ||
| @@ -16,13 +17,37 @@ export struct TopPlayComponent { | @@ -16,13 +17,37 @@ export struct TopPlayComponent { | ||
| 16 | @State isWait: boolean = false | 17 | @State isWait: boolean = false |
| 17 | //已结束直播 | 18 | //已结束直播 |
| 18 | @State isEnd: boolean = false | 19 | @State isEnd: boolean = false |
| 20 | + //播放错误 | ||
| 21 | + @State isError: boolean = false | ||
| 22 | + // loading 控制字段 | ||
| 23 | + @State isLoading: boolean = false | ||
| 24 | + // 获取播放资源能播放了 | ||
| 25 | + @State isCanPlay: boolean = false | ||
| 19 | private playUrl: string = "" | 26 | private playUrl: string = "" |
| 20 | private xComponentIsLoaded: boolean = false | 27 | private xComponentIsLoaded: boolean = false |
| 21 | 28 | ||
| 22 | aboutToAppear(): void { | 29 | aboutToAppear(): void { |
| 23 | if (this.playerController) { | 30 | if (this.playerController) { |
| 24 | this.playerController.onCanplay = () => { | 31 | this.playerController.onCanplay = () => { |
| 32 | + | ||
| 33 | + this.isCanPlay = true | ||
| 34 | + this.isLoading = true | ||
| 25 | this.playerController?.play() | 35 | this.playerController?.play() |
| 36 | + | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + this.playerController.onStatusChange = (status: number) => { | ||
| 40 | + | ||
| 41 | + if (status === PlayerConstants.STATUS_ERROR) { | ||
| 42 | + this.isError = true | ||
| 43 | + this.isLoading = true | ||
| 44 | + | ||
| 45 | + this.isCanPlay = false | ||
| 46 | + } else { | ||
| 47 | + this.isError = false | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 26 | } | 51 | } |
| 27 | } | 52 | } |
| 28 | this.updateData() | 53 | this.updateData() |
| @@ -39,6 +64,9 @@ export struct TopPlayComponent { | @@ -39,6 +64,9 @@ export struct TopPlayComponent { | ||
| 39 | Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) | 64 | Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) |
| 40 | } | 65 | } |
| 41 | this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait' | 66 | this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait' |
| 67 | + if(this.isWait ){ | ||
| 68 | + this.isLoading = true | ||
| 69 | + } | ||
| 42 | this.isEnd = this.liveDetailsBean?.liveInfo?.liveState === 'end' && | 70 | this.isEnd = this.liveDetailsBean?.liveInfo?.liveState === 'end' && |
| 43 | StringUtils.isEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri) | 71 | StringUtils.isEmpty(this.liveDetailsBean?.liveInfo?.vlive[0]?.replayUri) |
| 44 | if (!this.isWait && this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) { | 72 | if (!this.isWait && this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) { |
| @@ -74,6 +102,8 @@ export struct TopPlayComponent { | @@ -74,6 +102,8 @@ export struct TopPlayComponent { | ||
| 74 | WDPlayerRenderLiveView({ | 102 | WDPlayerRenderLiveView({ |
| 75 | playerController: this.playerController, | 103 | playerController: this.playerController, |
| 76 | onLoad: async () => { | 104 | onLoad: async () => { |
| 105 | + this.isLoading = false | ||
| 106 | + this.isError = false | ||
| 77 | this.xComponentIsLoaded = true | 107 | this.xComponentIsLoaded = true |
| 78 | this.tryToPlay() | 108 | this.tryToPlay() |
| 79 | } | 109 | } |
| @@ -81,18 +111,56 @@ export struct TopPlayComponent { | @@ -81,18 +111,56 @@ export struct TopPlayComponent { | ||
| 81 | .height('100%') | 111 | .height('100%') |
| 82 | .width('100%') | 112 | .width('100%') |
| 83 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) | 113 | .visibility(this.isWait ? Visibility.None : Visibility.Visible) |
| 114 | + | ||
| 84 | Image(this.imgUrl) | 115 | Image(this.imgUrl) |
| 85 | .objectFit(ImageFit.Cover) | 116 | .objectFit(ImageFit.Cover) |
| 86 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | 117 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) |
| 87 | .contrast(this.isEnd ? 0.2 : 1) | 118 | .contrast(this.isEnd ? 0.2 : 1) |
| 88 | .width('100%') | 119 | .width('100%') |
| 89 | - PlayUIComponent({ playerController: this.playerController }) | 120 | + |
| 121 | + PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) | ||
| 122 | + | ||
| 123 | + // 视频播放器上的控制面板和信息 | ||
| 124 | + PlayUIComponent({ playerController: this.playerController, isShowBottom: this.isCanPlay }) | ||
| 125 | + | ||
| 90 | Text('直播已结束') | 126 | Text('直播已结束') |
| 91 | .fontSize('20fp') | 127 | .fontSize('20fp') |
| 92 | .fontWeight(500) | 128 | .fontWeight(500) |
| 93 | .fontColor(Color.White) | 129 | .fontColor(Color.White) |
| 94 | .visibility(this.isEnd ? Visibility.Visible : | 130 | .visibility(this.isEnd ? Visibility.Visible : |
| 95 | Visibility.None) | 131 | Visibility.None) |
| 132 | + | ||
| 133 | + | ||
| 134 | + Column() { | ||
| 135 | + | ||
| 136 | + Text('直播加载中,请稍候重试') | ||
| 137 | + .fontSize('20fp') | ||
| 138 | + .fontWeight(500) | ||
| 139 | + .margin({ top: 16 }) | ||
| 140 | + .fontColor(Color.White) | ||
| 141 | + | ||
| 142 | + Button('点击重试') | ||
| 143 | + .type(ButtonType.Normal) | ||
| 144 | + .width(80) | ||
| 145 | + .height(28) | ||
| 146 | + .backgroundColor(Color.Transparent) | ||
| 147 | + .fontColor('#ffcccccc') | ||
| 148 | + .border({ width: 1 }) | ||
| 149 | + .borderColor('#4dffffff') | ||
| 150 | + .borderRadius(4) | ||
| 151 | + .fontSize($r('app.float.font_size_12')) | ||
| 152 | + .margin({ top: 16 }) | ||
| 153 | + .padding(0) | ||
| 154 | + .onClick(() => { | ||
| 155 | + this.isLoading = false | ||
| 156 | + this.isError = false | ||
| 157 | + this.xComponentIsLoaded = true | ||
| 158 | + this.tryToPlay() | ||
| 159 | + | ||
| 160 | + }) | ||
| 161 | + }.width('100%').visibility(this.isError ? Visibility.Visible : | ||
| 162 | + Visibility.None) | ||
| 163 | + | ||
| 96 | } | 164 | } |
| 97 | .width('100%') | 165 | .width('100%') |
| 98 | .alignSelf(ItemAlign.Center) | 166 | .alignSelf(ItemAlign.Center) |
| @@ -13,6 +13,11 @@ export struct PictureLoading { | @@ -13,6 +13,11 @@ export struct PictureLoading { | ||
| 13 | Logger.info(TAG, 'pictures preview') | 13 | Logger.info(TAG, 'pictures preview') |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | + aboutToDisappear(): void { | ||
| 17 | + Logger.info(TAG, 'aboutToDisappear') | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + | ||
| 16 | build() { | 21 | build() { |
| 17 | Row() { | 22 | Row() { |
| 18 | Image(this.imagePath) | 23 | Image(this.imagePath) |
| @@ -79,6 +79,7 @@ export struct PlayerComponent { | @@ -79,6 +79,7 @@ export struct PlayerComponent { | ||
| 79 | playerController: this.playerController, | 79 | playerController: this.playerController, |
| 80 | onLoad: () => { | 80 | onLoad: () => { |
| 81 | this.isCanplay = true | 81 | this.isCanplay = true |
| 82 | + console.error('WDAliPlayerController','------1------------') | ||
| 82 | this.playerController?.firstPlay(this.playUrl); | 83 | this.playerController?.firstPlay(this.playUrl); |
| 83 | } | 84 | } |
| 84 | }).margin({ top: 195 }).height(211) | 85 | }).margin({ top: 195 }).height(211) |
| 1 | export { add } from "./src/main/ets/utils/Calc" | 1 | export { add } from "./src/main/ets/utils/Calc" |
| 2 | -export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordLayout" | 2 | +export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordPage" |
| 3 | 3 | ||
| 4 | export { LoginModule } from './src/main/ets/LoginModule' | 4 | export { LoginModule } from './src/main/ets/LoginModule' |
| @@ -3,7 +3,7 @@ import { LoginInputComponent } from './LoginInputComponent' | @@ -3,7 +3,7 @@ import { LoginInputComponent } from './LoginInputComponent' | ||
| 3 | import { LoginViewModel } from './LoginViewModel' | 3 | import { LoginViewModel } from './LoginViewModel' |
| 4 | import router from '@ohos.router' | 4 | import router from '@ohos.router' |
| 5 | import { WDRouterRule, WDRouterPage } from 'wdRouter'; | 5 | import { WDRouterRule, WDRouterPage } from 'wdRouter'; |
| 6 | -import { SettingPasswordParams } from './SettingPasswordLayout' | 6 | +import { SettingPasswordParams } from './SettingPasswordPage' |
| 7 | import { Router } from '@ohos.arkui.UIContext' | 7 | import { Router } from '@ohos.arkui.UIContext' |
| 8 | import { CustomToast, EmitterEventId, EmitterUtils, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit/Index' | 8 | import { CustomToast, EmitterEventId, EmitterUtils, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit/Index' |
| 9 | import { SpConstants } from 'wdConstant/Index' | 9 | import { SpConstants } from 'wdConstant/Index' |
| @@ -22,7 +22,6 @@ struct ForgetPasswordPage { | @@ -22,7 +22,6 @@ struct ForgetPasswordPage { | ||
| 22 | @State isSubmit: boolean = false //是否可以提交 默认不可以 | 22 | @State isSubmit: boolean = false //是否可以提交 默认不可以 |
| 23 | loginViewModel: LoginViewModel = new LoginViewModel() | 23 | loginViewModel: LoginViewModel = new LoginViewModel() |
| 24 | @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件 | 24 | @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件 |
| 25 | - pageType:number = (router.getParams() as Record<string, number>)['pageType']; //0、登录->忘记密码 1、设置->重置密码 3、设置->更换手机号页面2(不知道是啥) | ||
| 26 | phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号 | 25 | phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号 |
| 27 | @State pageTitle:string = '找回密码'; | 26 | @State pageTitle:string = '找回密码'; |
| 28 | @State codeStateSuccess:boolean=false | 27 | @State codeStateSuccess:boolean=false |
| @@ -57,7 +56,7 @@ struct ForgetPasswordPage { | @@ -57,7 +56,7 @@ struct ForgetPasswordPage { | ||
| 57 | codeContent: $codeContent, | 56 | codeContent: $codeContent, |
| 58 | isSubmit: $isSubmit, | 57 | isSubmit: $isSubmit, |
| 59 | isCodeSend: $isCodeSend, | 58 | isCodeSend: $isCodeSend, |
| 60 | - pageType:this.pageType, | 59 | + pageType:0, |
| 61 | codeStateSuccess:$codeStateSuccess | 60 | codeStateSuccess:$codeStateSuccess |
| 62 | }) | 61 | }) |
| 63 | Row() { | 62 | Row() { |
| @@ -81,21 +80,8 @@ struct ForgetPasswordPage { | @@ -81,21 +80,8 @@ struct ForgetPasswordPage { | ||
| 81 | } | 80 | } |
| 82 | 81 | ||
| 83 | aboutToAppear() { | 82 | aboutToAppear() { |
| 84 | - if (router.getParams()) { | ||
| 85 | - let params = router.getParams() as Record<string, number> | ||
| 86 | - this.pageType = params['pageType'] | ||
| 87 | - Logger.info(TAG, 'params.contentID:' + params.contentID); | ||
| 88 | - } | ||
| 89 | - if (this.pageType == 0){ | ||
| 90 | - this.pageTitle = '找回密码' | ||
| 91 | - if(StringUtils.isNotEmpty(this.phone) && this.phone.indexOf("****") === -1){ | ||
| 92 | - this.phoneContent = this.phone | ||
| 93 | - } | ||
| 94 | - }else if (this.pageType == 1){ | ||
| 95 | - this.pageTitle = '验证当前手机号' | ||
| 96 | - } | ||
| 97 | - if (this.isCodeSend) { | ||
| 98 | - this.sendVerifyCode() | 83 | + if(StringUtils.isNotEmpty(this.phone) && this.phone.indexOf("****") === -1){ |
| 84 | + this.phoneContent = this.phone | ||
| 99 | } | 85 | } |
| 100 | } | 86 | } |
| 101 | 87 | ||
| @@ -105,20 +91,7 @@ struct ForgetPasswordPage { | @@ -105,20 +91,7 @@ struct ForgetPasswordPage { | ||
| 105 | return | 91 | return |
| 106 | } | 92 | } |
| 107 | 93 | ||
| 108 | - if(this.pageType == 1){ | ||
| 109 | - this.loginViewModel.sendVerifyCodeByToken().then(()=>{ | ||
| 110 | - this.showToastTip("已发送") | ||
| 111 | - this.codeStateSuccess=true | ||
| 112 | - this.isCodeSend=false | ||
| 113 | - }).catch((message: string)=>{ | ||
| 114 | - this.showToastTip(message) | ||
| 115 | - this.codeStateSuccess=false | ||
| 116 | - this.isCodeSend=false | ||
| 117 | - }) | ||
| 118 | - return | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){ | 94 | + if(this.phoneContent.indexOf("****")!=-1){ |
| 122 | //设置密码 忘记密码跳转过来的 需要使用上面方法 | 95 | //设置密码 忘记密码跳转过来的 需要使用上面方法 |
| 123 | this.loginViewModel.sendVerifyCodeByToken().then(()=>{ | 96 | this.loginViewModel.sendVerifyCodeByToken().then(()=>{ |
| 124 | this.showToastTip("已发送") | 97 | this.showToastTip("已发送") |
| @@ -168,22 +141,8 @@ struct ForgetPasswordPage { | @@ -168,22 +141,8 @@ struct ForgetPasswordPage { | ||
| 168 | if (this.isEmpty(this.codeContent)) { | 141 | if (this.isEmpty(this.codeContent)) { |
| 169 | return | 142 | return |
| 170 | } | 143 | } |
| 171 | - if(this.pageType == 1){ | ||
| 172 | - this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{ | ||
| 173 | - let params: SettingPasswordParams = { | ||
| 174 | - pageID:'1', | ||
| 175 | - phoneContent:this.phoneContent, | ||
| 176 | - codeContent:this.codeContent, | ||
| 177 | - pageType:this.pageType | ||
| 178 | - } | ||
| 179 | - WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params) | ||
| 180 | - }).catch((message: string)=>{ | ||
| 181 | - this.showToastTip(message) | ||
| 182 | - }) | ||
| 183 | - return | ||
| 184 | - } | ||
| 185 | 144 | ||
| 186 | - if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){ | 145 | + if(this.phoneContent.indexOf("****")!=-1){ |
| 187 | this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{ | 146 | this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{ |
| 188 | let params: SettingPasswordParams = { | 147 | let params: SettingPasswordParams = { |
| 189 | pageID:'1', | 148 | pageID:'1', |
| @@ -203,7 +162,7 @@ struct ForgetPasswordPage { | @@ -203,7 +162,7 @@ struct ForgetPasswordPage { | ||
| 203 | pageID:'1', | 162 | pageID:'1', |
| 204 | phoneContent:this.phoneContent, | 163 | phoneContent:this.phoneContent, |
| 205 | codeContent:this.codeContent, | 164 | codeContent:this.codeContent, |
| 206 | - pageType:this.pageType | 165 | + pageType:0 |
| 207 | } | 166 | } |
| 208 | WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params) | 167 | WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params) |
| 209 | 168 | ||
| @@ -218,53 +177,6 @@ struct ForgetPasswordPage { | @@ -218,53 +177,6 @@ struct ForgetPasswordPage { | ||
| 218 | return (obj == undefined || obj == null || obj == ''); | 177 | return (obj == undefined || obj == null || obj == ''); |
| 219 | } | 178 | } |
| 220 | 179 | ||
| 221 | - changeBindPhone(){ | ||
| 222 | - if (!this.isSubmit) { | ||
| 223 | - return | ||
| 224 | - } | ||
| 225 | - if (this.isEmpty(this.phoneContent)) { | ||
| 226 | - return | ||
| 227 | - } | ||
| 228 | - if (this.isEmpty(this.codeContent)) { | ||
| 229 | - return | ||
| 230 | - } | ||
| 231 | - this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{ | ||
| 232 | - ToastUtils.shortToast('绑定成功') | ||
| 233 | - this.querySecurity() | ||
| 234 | - }).catch((message: string) => { | ||
| 235 | - if (message != '') { | ||
| 236 | - ToastUtils.shortToast(message) | ||
| 237 | - } | ||
| 238 | - }) | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - querySecurity(){ | ||
| 242 | - this.loginViewModel.querySecurity().then(()=>{ | ||
| 243 | - SPHelper.default.save(SpConstants.USER_PHONE,this.phoneContent) | ||
| 244 | - this.sendEmitEvent() | ||
| 245 | - router.back() | ||
| 246 | - }).catch(()=>{ | ||
| 247 | - | ||
| 248 | - }) | ||
| 249 | - } | ||
| 250 | - | ||
| 251 | - sendEmitEvent(){ | ||
| 252 | - // 定义一个eventId为1的事件,事件优先级为Low | ||
| 253 | - let event: emitter.InnerEvent = { | ||
| 254 | - eventId: EmitterEventId.PHONE_CHANGE_SUCCESS, | ||
| 255 | - priority: emitter.EventPriority.LOW | ||
| 256 | - }; | ||
| 257 | - | ||
| 258 | - let eventData: emitter.EventData = { | ||
| 259 | - data: { | ||
| 260 | - content: this.phoneContent, | ||
| 261 | - } | ||
| 262 | - }; | ||
| 263 | - | ||
| 264 | - // 发送eventId为1的事件,事件内容为eventData | ||
| 265 | - emitter.emit(event, eventData); | ||
| 266 | - } | ||
| 267 | - | ||
| 268 | showToastTip(msg:string){ | 180 | showToastTip(msg:string){ |
| 269 | this.toastText = msg | 181 | this.toastText = msg |
| 270 | this.dialogToast.open() | 182 | this.dialogToast.open() |
| @@ -10,7 +10,7 @@ export struct LoginInputComponent { | @@ -10,7 +10,7 @@ export struct LoginInputComponent { | ||
| 10 | @Link isCodeSend: boolean //验证码控件是否点击 默认没有 发送接口 | 10 | @Link isCodeSend: boolean //验证码控件是否点击 默认没有 发送接口 |
| 11 | @Link isSubmit: boolean //是否可以提交 | 11 | @Link isSubmit: boolean //是否可以提交 |
| 12 | isFirst:boolean=true//是否第一次获取验证码 | 12 | isFirst:boolean=true//是否第一次获取验证码 |
| 13 | - pageType?:number; //0、登录->忘记密码 3、设置->更换手机号页面2 | 13 | + pageType?:number; //0、登录->忘记密码 |
| 14 | lastTime: number = 0 | 14 | lastTime: number = 0 |
| 15 | @Link @Watch('startCount') codeStateSuccess: boolean //验证码获取成功与否回调 成功显示倒计时 | 15 | @Link @Watch('startCount') codeStateSuccess: boolean //验证码获取成功与否回调 成功显示倒计时 |
| 16 | @Watch('onCheckChange') @Prop protocolState: boolean = false //协议勾选状态 | 16 | @Watch('onCheckChange') @Prop protocolState: boolean = false //协议勾选状态 |
| @@ -177,11 +177,10 @@ struct LoginPage { | @@ -177,11 +177,10 @@ struct LoginPage { | ||
| 177 | .onClick(() => { | 177 | .onClick(() => { |
| 178 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) | 178 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) |
| 179 | if(StringUtils.isNotEmpty(this.accountContent) && StringUtils.photoMatch(this.accountContent)){ | 179 | if(StringUtils.isNotEmpty(this.accountContent) && StringUtils.photoMatch(this.accountContent)){ |
| 180 | - let pageType = { 'pageType': 0, 'phone': Number(this.accountContent) } as Record<string, number>; | 180 | + let pageType = { 'phone': Number(this.accountContent) } as Record<string, number>; |
| 181 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 181 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) |
| 182 | }else{ | 182 | }else{ |
| 183 | - let pageType = { 'pageType': 0 } as Record<string, number>; | ||
| 184 | - WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 183 | + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) |
| 185 | } | 184 | } |
| 186 | }) | 185 | }) |
| 187 | } | 186 | } |
| @@ -166,8 +166,7 @@ struct ModifyPasswordPage { | @@ -166,8 +166,7 @@ struct ModifyPasswordPage { | ||
| 166 | Column() { | 166 | Column() { |
| 167 | Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | 167 | Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) |
| 168 | .onClick(()=>{ | 168 | .onClick(()=>{ |
| 169 | - let pageType = { 'pageType': 0 } as Record<string, number>; | ||
| 170 | - WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 169 | + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) |
| 171 | }) | 170 | }) |
| 172 | } | 171 | } |
| 173 | .width('100%') | 172 | .width('100%') |
sight_harmony/features/wdLogin/src/main/ets/pages/login/SettingPasswordLayout.ets
deleted
100644 → 0
| 1 | -import ArrayList from '@ohos.util.ArrayList'; | ||
| 2 | -import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; | ||
| 3 | -import router from '@ohos.router'; | ||
| 4 | -import { LoginViewModel } from './LoginViewModel'; | ||
| 5 | -import { CustomToast, Logger, SPHelper, ToastUtils } from 'wdKit'; | ||
| 6 | -import { | ||
| 7 | - SpConstants | ||
| 8 | -} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' | ||
| 9 | -import data_preferences from '@ohos.data.preferences'; | ||
| 10 | -import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 11 | - | ||
| 12 | -const TAG = "SettingPasswordLayout" | ||
| 13 | - | ||
| 14 | -export interface SettingPasswordParams { | ||
| 15 | - pageID: string; | ||
| 16 | - phoneContent?: string; | ||
| 17 | - codeContent?: string; | ||
| 18 | - tempToken?:string; | ||
| 19 | - pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机号页面1 3、设置->更换手机号页面2 | ||
| 20 | -} | ||
| 21 | - | ||
| 22 | -export default class AccoutPageDataModel { | ||
| 23 | - // 页面数据 | ||
| 24 | - compType: number // 0:标题 / 1:密码输入框 / 2:验证码输入框 / 3:desc描述 / 4:按钮 / 5:logo / 6:子标题 7:手机号输入框 7:空白 | ||
| 25 | - compLogo: string | ||
| 26 | - compTitle: string | ||
| 27 | - compSubTitle: string = ''; | ||
| 28 | - compDesc: string | ||
| 29 | - compButtonTitle: string | ||
| 30 | - inputPlacholder: string | ||
| 31 | - inputTag: number | ||
| 32 | - | ||
| 33 | - constructor(compType: number, compTitle: string, compLogo: string, compDesc: string, compButtonTitle: string, inputPlacholder: string, inputTag: number) { | ||
| 34 | - this.compType = compType | ||
| 35 | - this.compTitle = compTitle | ||
| 36 | - this.compLogo = compLogo | ||
| 37 | - this.compDesc = compDesc | ||
| 38 | - this.compButtonTitle = compButtonTitle | ||
| 39 | - this.inputPlacholder = inputPlacholder | ||
| 40 | - this.inputTag = inputTag | ||
| 41 | - } | ||
| 42 | -} | ||
| 43 | - | ||
| 44 | -@Entry | ||
| 45 | -@Component | ||
| 46 | -export struct SettingPasswordLayout { | ||
| 47 | - @State listData: Array<AccoutPageDataModel> = new Array(); // 页面配置数据 | ||
| 48 | - @State btnStatus: boolean = false; | ||
| 49 | - pageId:number = 0; | ||
| 50 | - phoneContent:string = ''; | ||
| 51 | - codeContent:string = ''; | ||
| 52 | - tempToken:string = ''; | ||
| 53 | - | ||
| 54 | - password01: string = ''; | ||
| 55 | - password02: string = ''; | ||
| 56 | - passwordOri: string = ''; | ||
| 57 | - loginViewModel = new LoginViewModel() | ||
| 58 | - pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机 | ||
| 59 | - | ||
| 60 | - @State toastText:string = "" | ||
| 61 | - dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 62 | - builder: CustomToast({ | ||
| 63 | - msg: this.toastText, | ||
| 64 | - }), | ||
| 65 | - autoCancel: false, | ||
| 66 | - alignment: DialogAlignment.Center, | ||
| 67 | - customStyle: true, | ||
| 68 | - maskColor:"#00000000" | ||
| 69 | - }) | ||
| 70 | - | ||
| 71 | - aboutToAppear() { | ||
| 72 | - let params:SettingPasswordParams = router.getParams() as SettingPasswordParams; | ||
| 73 | - this.pageId = parseInt(params.pageID); | ||
| 74 | - this.getPageListData(this.pageId) | ||
| 75 | - | ||
| 76 | - this.phoneContent = params.phoneContent!; | ||
| 77 | - this.codeContent = params.codeContent!; | ||
| 78 | - this.pageType = params.pageType; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - getPageListData(pageId:number) { | ||
| 82 | - switch (pageId) { | ||
| 83 | - case 0: | ||
| 84 | - // 验证/更换手机号 | ||
| 85 | - this.listData.push(new AccoutPageDataModel(0, '更换手机号', '', '', '', '', 0)) | ||
| 86 | - this.listData.push(new AccoutPageDataModel(7, '', '', '', '', '请输入手机号', 10010)) | ||
| 87 | - this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088)) | ||
| 88 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 89 | - break; | ||
| 90 | - | ||
| 91 | - case 1: | ||
| 92 | - // 设置密码 | ||
| 93 | - this.listData.push(new AccoutPageDataModel(0, '设置密码', '', '', '', '', 0)) | ||
| 94 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入密码', 10086)) | ||
| 95 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '再次输入密码', 10087)) | ||
| 96 | - this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 97 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 98 | - break; | ||
| 99 | - | ||
| 100 | - case 2: | ||
| 101 | - // 修改密码 | ||
| 102 | - this.listData.push(new AccoutPageDataModel(0, '修改密码', '', '', '', '', 0)) | ||
| 103 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入原密码', 10010)) | ||
| 104 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入新密码', 10086)) | ||
| 105 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请再请输入原密码', 10087)) | ||
| 106 | - this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 107 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 108 | - this.listData.push(new AccoutPageDataModel(3, '', '', '忘记密码', '', '', 0)) | ||
| 109 | - break; | ||
| 110 | - | ||
| 111 | - case 3: | ||
| 112 | - // 绑定手机号 | ||
| 113 | - this.listData.push(new AccoutPageDataModel(0, '绑定手机号', '', '', '', '', 0)) | ||
| 114 | - this.listData.push(new AccoutPageDataModel(7, '', '', '', '', '请输入手机号', 10010)) | ||
| 115 | - this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088)) | ||
| 116 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 117 | - break; | ||
| 118 | - | ||
| 119 | - case 4: | ||
| 120 | - // 有logo的 | ||
| 121 | - this.listData.push(new AccoutPageDataModel(5, '', '', '', '', '' , 0)) | ||
| 122 | - this.listData.push(new AccoutPageDataModel(0, '修改密码', '', '', '', '', 0)) | ||
| 123 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入原密码', 10010)) | ||
| 124 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入新密码', 10086)) | ||
| 125 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请再请输入原密码', 10087)) | ||
| 126 | - this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088)) | ||
| 127 | - this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 128 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 129 | - this.listData.push(new AccoutPageDataModel(3, '', '', '忘记密码', '', '', 0)) | ||
| 130 | - break; | ||
| 131 | - | ||
| 132 | - default: | ||
| 133 | - break; | ||
| 134 | - } | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - build() { | ||
| 138 | - Navigation() { | ||
| 139 | - this.settingList() //滑动区域 | ||
| 140 | - }.titleMode(NavigationTitleMode.Mini) | ||
| 141 | - .title('') | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - // 页面布局 | ||
| 145 | - @Builder settingList() { | ||
| 146 | - Column() { | ||
| 147 | - List() { | ||
| 148 | - ForEach(this.listData, (item: AccoutPageDataModel, index: number) => { | ||
| 149 | - ListItem() { | ||
| 150 | - if (item.compType == 0) { | ||
| 151 | - this.getTitleCell(item, HorizontalAlign.Start) | ||
| 152 | - } else if (item.compType == 1) { | ||
| 153 | - this.getPasswordCell(item) | ||
| 154 | - } else if (item.compType == 2) { | ||
| 155 | - this.getCodeCell(item) | ||
| 156 | - } else if (item.compType == 3) { | ||
| 157 | - if (index == this.listData.length - 1) { | ||
| 158 | - this.getDescCell(item, HorizontalAlign.Center) | ||
| 159 | - } else { | ||
| 160 | - this.getDescCell(item, HorizontalAlign.Start) | ||
| 161 | - } | ||
| 162 | - } else if (item.compType == 4) { | ||
| 163 | - this.getButtonCell(item) | ||
| 164 | - } else if (item.compType == 5) { | ||
| 165 | - this.getLogoCell(item) | ||
| 166 | - } else if (item.compType == 7) { | ||
| 167 | - this.getPhoneCell(item) | ||
| 168 | - } else { | ||
| 169 | - Text('' + item.compType) | ||
| 170 | - } | ||
| 171 | - } | ||
| 172 | - }) | ||
| 173 | - } | ||
| 174 | - // .divider({ | ||
| 175 | - // strokeWidth: 1, | ||
| 176 | - // startMargin: 15, | ||
| 177 | - // endMargin: 10, | ||
| 178 | - // color: '#f0f0f0' | ||
| 179 | - // }) | ||
| 180 | - }.width('100%').padding('30lpx') | ||
| 181 | - } | ||
| 182 | - | ||
| 183 | - /***************************** UI元素 ******************************************/ | ||
| 184 | - | ||
| 185 | - // 标题 | ||
| 186 | - @Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 187 | - Column() { | ||
| 188 | - Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1) | ||
| 189 | - } | ||
| 190 | - .width('100%') | ||
| 191 | - .height('75lpx') | ||
| 192 | - .alignItems(alignTitle) | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - // 密码输入框 | ||
| 196 | - @Builder getPasswordCell(item: AccoutPageDataModel) { | ||
| 197 | - Row() { | ||
| 198 | - Row() { | ||
| 199 | - TextInput({ placeholder: item.inputPlacholder }) | ||
| 200 | - .placeholderColor("#CCCCCC") | ||
| 201 | - .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")}) | ||
| 202 | - .type(InputType.Password) | ||
| 203 | - .showPasswordIcon(true) | ||
| 204 | - .backgroundColor('#00000000') | ||
| 205 | - .onChange((value: string) => { | ||
| 206 | - this.inputTextChange(value, item.inputTag) | ||
| 207 | - }) | ||
| 208 | - .onSubmit((EnterKeyType) => { | ||
| 209 | - this.showToastTip('submit') | ||
| 210 | - }) | ||
| 211 | - } | ||
| 212 | - .alignItems(VerticalAlign.Center) | ||
| 213 | - .height('80lpx') | ||
| 214 | - .backgroundColor('#f5f5f5') | ||
| 215 | - .borderRadius('4vp') | ||
| 216 | - } | ||
| 217 | - .width('100%') | ||
| 218 | - .height('110lpx') | ||
| 219 | - .backgroundColor(0xffffff0) | ||
| 220 | - .alignItems(VerticalAlign.Center) | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - // 手机号输入框 | ||
| 224 | - @Builder getPhoneCell(item: AccoutPageDataModel) { | ||
| 225 | - Row() { | ||
| 226 | - Row() { | ||
| 227 | - TextInput({ placeholder: item.inputPlacholder }) | ||
| 228 | - .placeholderColor("#CCCCCC") | ||
| 229 | - .backgroundColor('#00000000') | ||
| 230 | - .onChange((value: string) => { | ||
| 231 | - this.inputTextChange(value, item.inputTag) | ||
| 232 | - }) | ||
| 233 | - .onSubmit((EnterKeyType) => { | ||
| 234 | - this.showToastTip('submit') | ||
| 235 | - }) | ||
| 236 | - } | ||
| 237 | - .alignItems(VerticalAlign.Center) | ||
| 238 | - .height('80lpx') | ||
| 239 | - .backgroundColor('#f5f5f5') | ||
| 240 | - .borderRadius('4vp') | ||
| 241 | - } | ||
| 242 | - .width('100%') | ||
| 243 | - .height('110lpx') | ||
| 244 | - .backgroundColor(0xffffff0) | ||
| 245 | - .alignItems(VerticalAlign.Center) | ||
| 246 | - } | ||
| 247 | - | ||
| 248 | - // 验证码码输入框 | ||
| 249 | - @Builder getCodeCell(item: AccoutPageDataModel) { | ||
| 250 | - Row() { | ||
| 251 | - Stack() { | ||
| 252 | - Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp') | ||
| 253 | - Row() { | ||
| 254 | - TextInput({ placeholder: item.inputPlacholder }) | ||
| 255 | - .placeholderColor("#CCCCCC") | ||
| 256 | - .backgroundColor('#00000000') | ||
| 257 | - .width('67.28%') | ||
| 258 | - .onChange((value: string) => { | ||
| 259 | - this.inputTextChange(value, item.inputTag) | ||
| 260 | - }) | ||
| 261 | - Button('发送验证码') | ||
| 262 | - .width('32.71%') | ||
| 263 | - .backgroundColor('#00000000') | ||
| 264 | - .fontColor('#da3e22') | ||
| 265 | - } | ||
| 266 | - .width('100%') | ||
| 267 | - }.height('80lpx') | ||
| 268 | - } | ||
| 269 | - .width('100%') | ||
| 270 | - .height('110lpx') | ||
| 271 | - .backgroundColor(0xffffff0) | ||
| 272 | - .alignItems(VerticalAlign.Center) | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - // desc | ||
| 276 | - @Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 277 | - Column() { | ||
| 278 | - Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | ||
| 279 | - .onClick(()=>{ | ||
| 280 | - if (item.compDesc == '忘记密码') { | ||
| 281 | - this.showToastTip('密码不符合密码规范') | ||
| 282 | - } | ||
| 283 | - }) | ||
| 284 | - } | ||
| 285 | - .width('100%') | ||
| 286 | - .height('85lpx') | ||
| 287 | - .alignItems(alignTitle) | ||
| 288 | - } | ||
| 289 | - | ||
| 290 | - // 按钮 | ||
| 291 | - @Builder getButtonCell(item: AccoutPageDataModel) { | ||
| 292 | - Row() { | ||
| 293 | - Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true }) | ||
| 294 | - .width('100%') | ||
| 295 | - .height('80lpx') | ||
| 296 | - .backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d') | ||
| 297 | - .fontColor('#fff') | ||
| 298 | - .borderRadius('4vp') | ||
| 299 | - .onClick(() => { | ||
| 300 | - this.buttonClick() | ||
| 301 | - }) | ||
| 302 | - } | ||
| 303 | - .padding({top:'25lpx'}) | ||
| 304 | - .alignItems(VerticalAlign.Center) | ||
| 305 | - .width('100%') | ||
| 306 | - .height('120lpx') | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - // 标题 | ||
| 310 | - @Builder getLogoCell(item: AccoutPageDataModel) { | ||
| 311 | - Column() { | ||
| 312 | - Image(item.compLogo).height('150lpx').width('150lpx') | ||
| 313 | - } | ||
| 314 | - .width('100%') | ||
| 315 | - .height('200lpx') | ||
| 316 | - } | ||
| 317 | - | ||
| 318 | - /***************************** 事件处理 ******************************************/ | ||
| 319 | - // 提交按钮点击事件 | ||
| 320 | - async buttonClick() { | ||
| 321 | - if (this.btnStatus) { | ||
| 322 | - // 需要+手机号校验 | ||
| 323 | - if (this.password01.length < 6 || this.password01.length > 20) { | ||
| 324 | - this.showToastTip('密码不符合密码规范') | ||
| 325 | - return | ||
| 326 | - } | ||
| 327 | - if (this.password01 != this.password02) { | ||
| 328 | - this.showToastTip('两次输入的密码不一致,请重新输入') | ||
| 329 | - return | ||
| 330 | - } | ||
| 331 | - if(this.pageId == 1){ //设置密码 | ||
| 332 | - SPHelper.default.get(SpConstants.USER_TEMP_TOKEN, '').then((str) => { | ||
| 333 | - this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{ | ||
| 334 | - if (this.pageType == 0) {//登录页 | ||
| 335 | - this.showToastTip("修改成功") | ||
| 336 | - router.back({ | ||
| 337 | - url: `${WDRouterPage.getLoginBundleInfo()}` | ||
| 338 | - }) | ||
| 339 | - }else if(this.pageType == 1){//设置 | ||
| 340 | - let params: Params = { | ||
| 341 | - pageID: 'AccountAndSecurityLayout' | ||
| 342 | - } | ||
| 343 | - this.showToastTip("修改成功") | ||
| 344 | - router.back({ | ||
| 345 | - params:params, | ||
| 346 | - url: `${WDRouterPage.getSettingBundleInfo()}` | ||
| 347 | - }) | ||
| 348 | - // WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) | ||
| 349 | - } | ||
| 350 | - })) | ||
| 351 | - .catch((err: string) => { | ||
| 352 | - this.showToastTip(err) | ||
| 353 | - }); | ||
| 354 | - }).catch((err: string) => { | ||
| 355 | - this.showToastTip(err) | ||
| 356 | - Logger.error(TAG, 'catch err:' + JSON.stringify(err)); | ||
| 357 | - }); | ||
| 358 | - } | ||
| 359 | - } | ||
| 360 | - | ||
| 361 | - | ||
| 362 | - } | ||
| 363 | - | ||
| 364 | - // 输入框数据变动:输入数据处理 | ||
| 365 | - inputTextChange(text: string, tag: number) { | ||
| 366 | - if (tag == 10086) { | ||
| 367 | - this.password01 = text; | ||
| 368 | - } else if (tag == 10087) { | ||
| 369 | - this.password02 = text; | ||
| 370 | - } else { | ||
| 371 | - this.passwordOri = text; | ||
| 372 | - } | ||
| 373 | - | ||
| 374 | - if (this.password01) { | ||
| 375 | - if ((this.password01.length >= 6 && this.password01.length <= 20) && (this.password02.length >= 6 && this.password02.length <= 20)) { | ||
| 376 | - this.btnStatus = true; | ||
| 377 | - } else { | ||
| 378 | - this.btnStatus = false; | ||
| 379 | - } | ||
| 380 | - } | ||
| 381 | - } | ||
| 382 | - | ||
| 383 | - showToastTip(msg:string){ | ||
| 384 | - this.toastText = msg | ||
| 385 | - this.dialogToast.open() | ||
| 386 | - } | ||
| 387 | -} | ||
| 388 | - |
| 1 | -import { SettingPasswordLayout } from './SettingPasswordLayout'; | 1 | +import ArrayList from '@ohos.util.ArrayList'; |
| 2 | +import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; | ||
| 3 | +import router from '@ohos.router'; | ||
| 4 | +import { LoginViewModel } from './LoginViewModel'; | ||
| 5 | +import { CustomToast, DateTimeUtils, Logger, SPHelper, ToastUtils } from 'wdKit'; | ||
| 6 | +import { | ||
| 7 | + SpConstants | ||
| 8 | +} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' | ||
| 9 | +import data_preferences from '@ohos.data.preferences'; | ||
| 10 | +import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 11 | +import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; | ||
| 12 | + | ||
| 13 | +const TAG = "SettingPasswordLayout" | ||
| 14 | + | ||
| 15 | +export interface SettingPasswordParams { | ||
| 16 | + pageID: string; | ||
| 17 | + phoneContent?: string; | ||
| 18 | + codeContent?: string; | ||
| 19 | + tempToken?:string; | ||
| 20 | + pageType?:number; //0、登录->忘记密码 1、设置->重置密码 | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +export default class AccoutPageDataModel { | ||
| 24 | + // 页面数据 | ||
| 25 | + compType: number // 0:标题 / 1:密码输入框 / 2:验证码输入框 / 3:desc描述 / 4:按钮 / 5:logo / 6:子标题 7:手机号输入框 7:空白 | ||
| 26 | + compLogo: string | ||
| 27 | + compTitle: string | ||
| 28 | + compSubTitle: string = ''; | ||
| 29 | + compDesc: string | ||
| 30 | + compButtonTitle: string | ||
| 31 | + inputPlacholder: string | ||
| 32 | + inputTag: number | ||
| 33 | + | ||
| 34 | + constructor(compType: number, compTitle: string, compLogo: string, compDesc: string, compButtonTitle: string, inputPlacholder: string, inputTag: number) { | ||
| 35 | + this.compType = compType | ||
| 36 | + this.compTitle = compTitle | ||
| 37 | + this.compLogo = compLogo | ||
| 38 | + this.compDesc = compDesc | ||
| 39 | + this.compButtonTitle = compButtonTitle | ||
| 40 | + this.inputPlacholder = inputPlacholder | ||
| 41 | + this.inputTag = inputTag | ||
| 42 | + } | ||
| 43 | +} | ||
| 2 | 44 | ||
| 3 | @Entry | 45 | @Entry |
| 4 | @Component | 46 | @Component |
| 5 | -struct SettingPasswordPage { | ||
| 6 | - @State message: string = 'Hello World' | 47 | +export struct SettingPasswordPage { |
| 48 | + @State listData: Array<AccoutPageDataModel> = new Array(); // 页面配置数据 | ||
| 49 | + @State btnStatus: boolean = false; | ||
| 50 | + pageId:number = 0; | ||
| 51 | + phoneContent:string = ''; | ||
| 52 | + codeContent:string = ''; | ||
| 53 | + tempToken:string = ''; | ||
| 54 | + | ||
| 55 | + password01: string = ''; | ||
| 56 | + password02: string = ''; | ||
| 57 | + passwordOri: string = ''; | ||
| 58 | + loginViewModel = new LoginViewModel() | ||
| 59 | + pageType?:number; //0、登录->忘记密码 1、设置->重置密码 | ||
| 60 | + | ||
| 61 | + @State toastText:string = "" | ||
| 62 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 63 | + builder: CustomToast({ | ||
| 64 | + msg: this.toastText, | ||
| 65 | + }), | ||
| 66 | + autoCancel: false, | ||
| 67 | + alignment: DialogAlignment.Center, | ||
| 68 | + customStyle: true, | ||
| 69 | + maskColor:"#00000000" | ||
| 70 | + }) | ||
| 71 | + | ||
| 72 | + pageShowResetTime:number = 0; | ||
| 73 | + pageHideResetTime:number = 0; | ||
| 74 | + pageShowSetTime:number = 0; | ||
| 75 | + pageHideSetTime:number = 0; | ||
| 76 | + | ||
| 77 | + onPageShow(): void { | ||
| 78 | + if (this.pageType === 0){//重置密码 | ||
| 79 | + this.pageShowResetTime = DateTimeUtils.getTimeStamp() | ||
| 80 | + }else{ | ||
| 81 | + this.pageShowSetTime = DateTimeUtils.getTimeStamp() | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + onPageHide(): void { | ||
| 86 | + if (this.pageType === 0){ | ||
| 87 | + this.pageHideResetTime = DateTimeUtils.getTimeStamp() | ||
| 88 | + }else{ | ||
| 89 | + this.pageHideSetTime = DateTimeUtils.getTimeStamp() | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + let duration = 0 | ||
| 93 | + if(this.pageType === 0){ | ||
| 94 | + duration = Math.floor((this.pageHideResetTime - this.pageShowResetTime)/1000) | ||
| 95 | + }else{ | ||
| 96 | + duration = Math.floor((this.pageHideSetTime - this.pageShowSetTime)/1000) | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + if(this.pageType === 0){ | ||
| 100 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Reset_Password,TrackConstants.PageName.Reset_Password,duration) | ||
| 101 | + }else{ | ||
| 102 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Setup_Passwd,TrackConstants.PageName.Setup_Passwd,duration) | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + aboutToAppear() { | ||
| 107 | + let params:SettingPasswordParams = router.getParams() as SettingPasswordParams; | ||
| 108 | + this.pageId = parseInt(params.pageID); | ||
| 109 | + this.getPageListData(this.pageId) | ||
| 110 | + | ||
| 111 | + this.phoneContent = params.phoneContent!; | ||
| 112 | + this.codeContent = params.codeContent!; | ||
| 113 | + this.pageType = params.pageType; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + getPageListData(pageId:number) { | ||
| 117 | + switch (pageId) { | ||
| 118 | + case 0: | ||
| 119 | + break; | ||
| 120 | + case 1: | ||
| 121 | + // 设置密码 | ||
| 122 | + this.listData.push(new AccoutPageDataModel(0, '设置密码', '', '', '', '', 0)) | ||
| 123 | + this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入密码', 10086)) | ||
| 124 | + this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '再次输入密码', 10087)) | ||
| 125 | + this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 126 | + this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 127 | + break; | ||
| 128 | + case 2: | ||
| 129 | + break; | ||
| 130 | + case 3: | ||
| 131 | + break; | ||
| 132 | + case 4: | ||
| 133 | + break; | ||
| 134 | + } | ||
| 135 | + } | ||
| 7 | 136 | ||
| 8 | build() { | 137 | build() { |
| 138 | + Navigation() { | ||
| 139 | + this.settingList() //滑动区域 | ||
| 140 | + }.titleMode(NavigationTitleMode.Mini) | ||
| 141 | + .title('') | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + // 页面布局 | ||
| 145 | + @Builder settingList() { | ||
| 146 | + Column() { | ||
| 147 | + List() { | ||
| 148 | + ForEach(this.listData, (item: AccoutPageDataModel, index: number) => { | ||
| 149 | + ListItem() { | ||
| 150 | + if (item.compType == 0) { | ||
| 151 | + this.getTitleCell(item, HorizontalAlign.Start) | ||
| 152 | + } else if (item.compType == 1) { | ||
| 153 | + this.getPasswordCell(item) | ||
| 154 | + } else if (item.compType == 2) { | ||
| 155 | + this.getCodeCell(item) | ||
| 156 | + } else if (item.compType == 3) { | ||
| 157 | + if (index == this.listData.length - 1) { | ||
| 158 | + this.getDescCell(item, HorizontalAlign.Center) | ||
| 159 | + } else { | ||
| 160 | + this.getDescCell(item, HorizontalAlign.Start) | ||
| 161 | + } | ||
| 162 | + } else if (item.compType == 4) { | ||
| 163 | + this.getButtonCell(item) | ||
| 164 | + } else if (item.compType == 5) { | ||
| 165 | + this.getLogoCell(item) | ||
| 166 | + } else if (item.compType == 7) { | ||
| 167 | + this.getPhoneCell(item) | ||
| 168 | + } else { | ||
| 169 | + Text('' + item.compType) | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + }) | ||
| 173 | + } | ||
| 174 | + }.width('100%') | ||
| 175 | + .padding('30lpx') | ||
| 176 | + .height('100%') | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + /***************************** UI元素 ******************************************/ | ||
| 180 | + | ||
| 181 | + // 标题 | ||
| 182 | + @Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 183 | + Column() { | ||
| 184 | + Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1) | ||
| 185 | + } | ||
| 186 | + .width('100%') | ||
| 187 | + .height('75lpx') | ||
| 188 | + .alignItems(alignTitle) | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + // 密码输入框 | ||
| 192 | + @Builder getPasswordCell(item: AccoutPageDataModel) { | ||
| 9 | Row() { | 193 | Row() { |
| 10 | - Column() { | ||
| 11 | - SettingPasswordLayout() | 194 | + Row() { |
| 195 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 196 | + .placeholderColor("#CCCCCC") | ||
| 197 | + .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")}) | ||
| 198 | + .type(InputType.Password) | ||
| 199 | + .showPasswordIcon(true) | ||
| 200 | + .backgroundColor('#00000000') | ||
| 201 | + .onChange((value: string) => { | ||
| 202 | + this.inputTextChange(value, item.inputTag) | ||
| 203 | + }) | ||
| 204 | + .onSubmit((EnterKeyType) => { | ||
| 205 | + this.showToastTip('submit') | ||
| 206 | + }) | ||
| 12 | } | 207 | } |
| 13 | - .width('100%') | 208 | + .alignItems(VerticalAlign.Center) |
| 209 | + .height('80lpx') | ||
| 210 | + .backgroundColor('#f5f5f5') | ||
| 211 | + .borderRadius('4vp') | ||
| 14 | } | 212 | } |
| 15 | - .height('100%') | 213 | + .width('100%') |
| 214 | + .height('110lpx') | ||
| 215 | + .backgroundColor(0xffffff0) | ||
| 216 | + .alignItems(VerticalAlign.Center) | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + // 手机号输入框 | ||
| 220 | + @Builder getPhoneCell(item: AccoutPageDataModel) { | ||
| 221 | + Row() { | ||
| 222 | + Row() { | ||
| 223 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 224 | + .placeholderColor("#CCCCCC") | ||
| 225 | + .backgroundColor('#00000000') | ||
| 226 | + .onChange((value: string) => { | ||
| 227 | + this.inputTextChange(value, item.inputTag) | ||
| 228 | + }) | ||
| 229 | + .onSubmit((EnterKeyType) => { | ||
| 230 | + this.showToastTip('submit') | ||
| 231 | + }) | ||
| 232 | + } | ||
| 233 | + .alignItems(VerticalAlign.Center) | ||
| 234 | + .height('80lpx') | ||
| 235 | + .backgroundColor('#f5f5f5') | ||
| 236 | + .borderRadius('4vp') | ||
| 237 | + } | ||
| 238 | + .width('100%') | ||
| 239 | + .height('110lpx') | ||
| 240 | + .backgroundColor(0xffffff0) | ||
| 241 | + .alignItems(VerticalAlign.Center) | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + // 验证码码输入框 | ||
| 245 | + @Builder getCodeCell(item: AccoutPageDataModel) { | ||
| 246 | + Row() { | ||
| 247 | + Stack() { | ||
| 248 | + Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp') | ||
| 249 | + Row() { | ||
| 250 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 251 | + .placeholderColor("#CCCCCC") | ||
| 252 | + .backgroundColor('#00000000') | ||
| 253 | + .width('67.28%') | ||
| 254 | + .onChange((value: string) => { | ||
| 255 | + this.inputTextChange(value, item.inputTag) | ||
| 256 | + }) | ||
| 257 | + Button('发送验证码') | ||
| 258 | + .width('32.71%') | ||
| 259 | + .backgroundColor('#00000000') | ||
| 260 | + .fontColor('#da3e22') | ||
| 261 | + } | ||
| 262 | + .width('100%') | ||
| 263 | + }.height('80lpx') | ||
| 264 | + } | ||
| 265 | + .width('100%') | ||
| 266 | + .height('110lpx') | ||
| 267 | + .backgroundColor(0xffffff0) | ||
| 268 | + .alignItems(VerticalAlign.Center) | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + // desc | ||
| 272 | + @Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 273 | + Column() { | ||
| 274 | + Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | ||
| 275 | + .onClick(()=>{ | ||
| 276 | + if (item.compDesc == '忘记密码') { | ||
| 277 | + this.showToastTip('密码不符合密码规范') | ||
| 278 | + } | ||
| 279 | + }) | ||
| 280 | + } | ||
| 281 | + .width('100%') | ||
| 282 | + .height('85lpx') | ||
| 283 | + .alignItems(alignTitle) | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + // 按钮 | ||
| 287 | + @Builder getButtonCell(item: AccoutPageDataModel) { | ||
| 288 | + Row() { | ||
| 289 | + Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true }) | ||
| 290 | + .width('100%') | ||
| 291 | + .height('80lpx') | ||
| 292 | + .backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d') | ||
| 293 | + .fontColor('#fff') | ||
| 294 | + .borderRadius('4vp') | ||
| 295 | + .onClick(() => { | ||
| 296 | + this.buttonClick() | ||
| 297 | + }) | ||
| 298 | + } | ||
| 299 | + .padding({top:'25lpx'}) | ||
| 300 | + .alignItems(VerticalAlign.Center) | ||
| 301 | + .width('100%') | ||
| 302 | + .height('120lpx') | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + // 标题 | ||
| 306 | + @Builder getLogoCell(item: AccoutPageDataModel) { | ||
| 307 | + Column() { | ||
| 308 | + Image(item.compLogo).height('150lpx').width('150lpx') | ||
| 309 | + } | ||
| 310 | + .width('100%') | ||
| 311 | + .height('200lpx') | ||
| 16 | } | 312 | } |
| 17 | -} | ||
| 313 | + | ||
| 314 | + /***************************** 事件处理 ******************************************/ | ||
| 315 | + // 提交按钮点击事件 | ||
| 316 | + async buttonClick() { | ||
| 317 | + if (this.btnStatus) { | ||
| 318 | + if(this.pageType === 0){ | ||
| 319 | + TrackingButton.click("resetPasswordPageConfirmButton",TrackConstants.PageName.Reset_Password,TrackConstants.PageName.Reset_Password) | ||
| 320 | + }else{ | ||
| 321 | + TrackingButton.click("setPasswordPageConfirm",TrackConstants.PageName.Setup_Passwd,TrackConstants.PageName.Setup_Passwd) | ||
| 322 | + } | ||
| 323 | + // 需要+手机号校验 | ||
| 324 | + if (this.password01.length < 6 || this.password01.length > 20) { | ||
| 325 | + this.showToastTip('密码不符合密码规范') | ||
| 326 | + return | ||
| 327 | + } | ||
| 328 | + if (this.password01 != this.password02) { | ||
| 329 | + this.showToastTip('两次输入的密码不一致,请重新输入') | ||
| 330 | + return | ||
| 331 | + } | ||
| 332 | + if(this.pageId == 1){ //设置密码 | ||
| 333 | + SPHelper.default.get(SpConstants.USER_TEMP_TOKEN, '').then((str) => { | ||
| 334 | + this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{ | ||
| 335 | + if (this.pageType == 0) {//登录页 | ||
| 336 | + this.showToastTip("修改成功") | ||
| 337 | + router.back({ | ||
| 338 | + url: `${WDRouterPage.getLoginBundleInfo()}` | ||
| 339 | + }) | ||
| 340 | + }else if(this.pageType == 1){//设置 | ||
| 341 | + let params: Params = { | ||
| 342 | + pageID: 'AccountAndSecurityLayout' | ||
| 343 | + } | ||
| 344 | + this.showToastTip("修改成功") | ||
| 345 | + router.back({ | ||
| 346 | + params:params, | ||
| 347 | + url: `${WDRouterPage.getSettingBundleInfo()}` | ||
| 348 | + }) | ||
| 349 | + } | ||
| 350 | + })) | ||
| 351 | + .catch((err: string) => { | ||
| 352 | + this.showToastTip(err) | ||
| 353 | + }); | ||
| 354 | + }).catch((err: string) => { | ||
| 355 | + this.showToastTip(err) | ||
| 356 | + Logger.error(TAG, 'catch err:' + JSON.stringify(err)); | ||
| 357 | + }); | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + // 输入框数据变动:输入数据处理 | ||
| 365 | + inputTextChange(text: string, tag: number) { | ||
| 366 | + if (tag == 10086) { | ||
| 367 | + this.password01 = text; | ||
| 368 | + } else if (tag == 10087) { | ||
| 369 | + this.password02 = text; | ||
| 370 | + } else { | ||
| 371 | + this.passwordOri = text; | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + if (this.password01) { | ||
| 375 | + if ((this.password01.length >= 6 && this.password01.length <= 20) && (this.password02.length >= 6 && this.password02.length <= 20)) { | ||
| 376 | + this.btnStatus = true; | ||
| 377 | + } else { | ||
| 378 | + this.btnStatus = false; | ||
| 379 | + } | ||
| 380 | + } | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + showToastTip(msg:string){ | ||
| 384 | + this.toastText = msg | ||
| 385 | + this.dialogToast.open() | ||
| 386 | + } | ||
| 387 | +} | ||
| 388 | + |
| 1 | import { CustomToast, DateTimeUtils, Logger, SPHelper } from 'wdKit/Index' | 1 | import { CustomToast, DateTimeUtils, Logger, SPHelper } from 'wdKit/Index' |
| 2 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 2 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 3 | import { LoginViewModel } from './LoginViewModel' | 3 | import { LoginViewModel } from './LoginViewModel' |
| 4 | -import { SettingPasswordParams } from './SettingPasswordLayout' | 4 | +import { SettingPasswordParams } from './SettingPasswordPage' |
| 5 | import { router } from '@kit.ArkUI' | 5 | import { router } from '@kit.ArkUI' |
| 6 | import { SpConstants } from 'wdConstant/Index' | 6 | import { SpConstants } from 'wdConstant/Index' |
| 7 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index' | 7 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index' |
| @@ -5,7 +5,6 @@ | @@ -5,7 +5,6 @@ | ||
| 5 | "pages/login/ForgetPasswordPage", | 5 | "pages/login/ForgetPasswordPage", |
| 6 | "pages/login/LoginProtocolWebview", | 6 | "pages/login/LoginProtocolWebview", |
| 7 | "pages/login/SettingPasswordPage", | 7 | "pages/login/SettingPasswordPage", |
| 8 | - "pages/login/SettingPasswordLayout", | ||
| 9 | "pages/guide/GuidePages", | 8 | "pages/guide/GuidePages", |
| 10 | "pages/login/OneKeyLoginPage", | 9 | "pages/login/OneKeyLoginPage", |
| 11 | "pages/login/ModifyPasswordPage", | 10 | "pages/login/ModifyPasswordPage", |
| @@ -2,7 +2,8 @@ export namespace TrackConstants { | @@ -2,7 +2,8 @@ export namespace TrackConstants { | ||
| 2 | 2 | ||
| 3 | export enum EventType { | 3 | export enum EventType { |
| 4 | Show = 0, | 4 | Show = 0, |
| 5 | - Click = 1 | 5 | + Click = 1, |
| 6 | + CurrentNumberPanelContentExposure = 2, | ||
| 6 | } | 7 | } |
| 7 | 8 | ||
| 8 | // 行为类型 | 9 | // 行为类型 |
| @@ -24,7 +25,8 @@ export namespace TrackConstants { | @@ -24,7 +25,8 @@ export namespace TrackConstants { | ||
| 24 | UnSubscribe = "unSubscribe", | 25 | UnSubscribe = "unSubscribe", |
| 25 | CloseInterestCard = "closeInterestCard", | 26 | CloseInterestCard = "closeInterestCard", |
| 26 | SelectInterestCard = "selectInterestCard", | 27 | SelectInterestCard = "selectInterestCard", |
| 27 | - | 28 | + //电子报当前页曝光 |
| 29 | + CurrentNumberPanelContentExposure = "current_Number_Panel_content_exposure", | ||
| 28 | } | 30 | } |
| 29 | 31 | ||
| 30 | // 分享聚道 | 32 | // 分享聚道 |
| @@ -208,5 +210,11 @@ export namespace TrackConstants { | @@ -208,5 +210,11 @@ export namespace TrackConstants { | ||
| 208 | 210 | ||
| 209 | ///兴趣偏好页 | 211 | ///兴趣偏好页 |
| 210 | Interest = "preferenceSelectionPage", | 212 | Interest = "preferenceSelectionPage", |
| 213 | + //意见反馈 | ||
| 214 | + FeedbackPage = 'feedbackPage', | ||
| 215 | + //动态详情 | ||
| 216 | + DynamicDetailPage = 'dynamicDetailPage', | ||
| 217 | + //早晚报 | ||
| 218 | + NewsPaperPage = 'newsPaperPage', | ||
| 211 | } | 219 | } |
| 212 | } | 220 | } |
| @@ -29,6 +29,10 @@ export class TrackingContent { | @@ -29,6 +29,10 @@ export class TrackingContent { | ||
| 29 | params["action"] = TrackConstants.ActionType.Show | 29 | params["action"] = TrackConstants.ActionType.Show |
| 30 | TrackingUtils.fillPositionWith(params) | 30 | TrackingUtils.fillPositionWith(params) |
| 31 | Tracking.event("content_exposure", params) | 31 | Tracking.event("content_exposure", params) |
| 32 | + }else if(eventType === TrackConstants.EventType.CurrentNumberPanelContentExposure){ | ||
| 33 | + params["action"] = TrackConstants.ActionType.Show | ||
| 34 | + TrackingUtils.fillPositionWith(params) | ||
| 35 | + Tracking.event(TrackConstants.ActionType.CurrentNumberPanelContentExposure, params) | ||
| 32 | } | 36 | } |
| 33 | } | 37 | } |
| 34 | 38 | ||
| @@ -82,6 +86,10 @@ export class TrackingContent { | @@ -82,6 +86,10 @@ export class TrackingContent { | ||
| 82 | } | 86 | } |
| 83 | 87 | ||
| 84 | static commentClick(pageId: string, pageName: string, extParams?: ParamType) { | 88 | static commentClick(pageId: string, pageName: string, extParams?: ParamType) { |
| 89 | + TrackingContent.commentClickWithEvent("content_comment_click",pageId,pageName,extParams); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + static commentClickWithEvent(event: string,pageId: string, pageName: string, extParams?: ParamType) { | ||
| 85 | let params = TrackingUtils.generateParams(extParams) | 93 | let params = TrackingUtils.generateParams(extParams) |
| 86 | if (pageId.length) { | 94 | if (pageId.length) { |
| 87 | params["pageId"] = pageId | 95 | params["pageId"] = pageId |
| @@ -91,7 +99,7 @@ export class TrackingContent { | @@ -91,7 +99,7 @@ export class TrackingContent { | ||
| 91 | } | 99 | } |
| 92 | params["action"] =TrackConstants.ActionType.Comment | 100 | params["action"] =TrackConstants.ActionType.Comment |
| 93 | TrackingUtils.fillPositionWith(params) | 101 | TrackingUtils.fillPositionWith(params) |
| 94 | - Tracking.event("content_comment_click", params) | 102 | + Tracking.event(event, params) |
| 95 | } | 103 | } |
| 96 | 104 | ||
| 97 | static commentShare(pageId: string, pageName: string, extParams?: ParamType) { | 105 | static commentShare(pageId: string, pageName: string, extParams?: ParamType) { |
| @@ -2,7 +2,7 @@ import { ENewspaperPageComponent } from 'wdComponent'; | @@ -2,7 +2,7 @@ import { ENewspaperPageComponent } from 'wdComponent'; | ||
| 2 | import { DateTimeUtils, Logger } from 'wdKit'; | 2 | 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 } from 'wdTracking/Index'; | 5 | +import { TrackingPageBrowse ,TrackConstants} from 'wdTracking/Index'; |
| 6 | 6 | ||
| 7 | const TAG = 'ENewspaper'; | 7 | const TAG = 'ENewspaper'; |
| 8 | 8 | ||
| @@ -10,8 +10,6 @@ const TAG = 'ENewspaper'; | @@ -10,8 +10,6 @@ const TAG = 'ENewspaper'; | ||
| 10 | @Component | 10 | @Component |
| 11 | struct ENewspaper { | 11 | struct ENewspaper { |
| 12 | pageShowTime:number = 0; | 12 | pageShowTime:number = 0; |
| 13 | - pageId:string = 'newsPaperPage'; | ||
| 14 | - pageName:string=this.pageId; | ||
| 15 | // 获取UIAbility上下文 | 13 | // 获取UIAbility上下文 |
| 16 | context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext | 14 | context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext |
| 17 | 15 | ||
| @@ -59,7 +57,7 @@ struct ENewspaper { | @@ -59,7 +57,7 @@ struct ENewspaper { | ||
| 59 | this.setSystemBar('#FFFFFFFF','#00000000', '#000000') | 57 | this.setSystemBar('#FFFFFFFF','#00000000', '#000000') |
| 60 | Logger.info(TAG, 'onPageHide'); | 58 | Logger.info(TAG, 'onPageHide'); |
| 61 | //页面浏览 | 59 | //页面浏览 |
| 62 | - TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) | 60 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) |
| 63 | } | 61 | } |
| 64 | 62 | ||
| 65 | onBackPress() { | 63 | onBackPress() { |
| @@ -2,15 +2,13 @@ import { DateTimeUtils, Logger } from 'wdKit'; | @@ -2,15 +2,13 @@ import { DateTimeUtils, Logger } from 'wdKit'; | ||
| 2 | import { DynamicDetailComponent } from 'wdComponent'; | 2 | import { DynamicDetailComponent } from 'wdComponent'; |
| 3 | import router from '@ohos.router'; | 3 | import router from '@ohos.router'; |
| 4 | import { Params, Action } from 'wdBean'; | 4 | import { Params, Action } from 'wdBean'; |
| 5 | -import { TrackingPageBrowse } from 'wdTracking/Index'; | 5 | +import { TrackingPageBrowse,TrackConstants } from 'wdTracking/Index'; |
| 6 | 6 | ||
| 7 | const TAG = 'DynamicDetailPage'; | 7 | const TAG = 'DynamicDetailPage'; |
| 8 | @Entry | 8 | @Entry |
| 9 | @Component | 9 | @Component |
| 10 | struct DynamicDetailPage { | 10 | struct DynamicDetailPage { |
| 11 | pageShowTime:number = 0; | 11 | pageShowTime:number = 0; |
| 12 | - pageId:string = 'dynamicDetailPage'; | ||
| 13 | - pageName:string=this.pageId; | ||
| 14 | @State relId: string = '' | 12 | @State relId: string = '' |
| 15 | @State contentId: string = '' | 13 | @State contentId: string = '' |
| 16 | @State relType: string = '' | 14 | @State relType: string = '' |
| @@ -39,7 +37,7 @@ struct DynamicDetailPage { | @@ -39,7 +37,7 @@ struct DynamicDetailPage { | ||
| 39 | } | 37 | } |
| 40 | onPageHide() { | 38 | onPageHide() { |
| 41 | //页面浏览 | 39 | //页面浏览 |
| 42 | - TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) | 40 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.DynamicDetailPage,TrackConstants.PageName.DynamicDetailPage,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000)) |
| 43 | 41 | ||
| 44 | } | 42 | } |
| 45 | } | 43 | } |
-
Please register or login to post a comment