Showing
26 changed files
with
422 additions
and
125 deletions
| @@ -59,3 +59,5 @@ export { UmengStats } from "./src/main/ets/umeng/UmengStats" | @@ -59,3 +59,5 @@ export { UmengStats } from "./src/main/ets/umeng/UmengStats" | ||
| 59 | export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils' | 59 | export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils' |
| 60 | 60 | ||
| 61 | export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck' | 61 | export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck' |
| 62 | + | ||
| 63 | +export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM' |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | "main": "Index.ets", | 7 | "main": "Index.ets", |
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | + "@tingyun/harmonyos": "file:./src/main/ets/tingyunAPM/tingyun_0.0.6.har", | ||
| 10 | "@umeng/common": "^1.0.21", | 11 | "@umeng/common": "^1.0.21", |
| 11 | "@umeng/analytics": "^1.0.19" | 12 | "@umeng/analytics": "^1.0.19" |
| 12 | } | 13 | } |
| 1 | +import { common } from '@kit.AbilityKit'; | ||
| 2 | +import tingyun, { LogLevel } from '@tingyun/harmonyos'; | ||
| 3 | + | ||
| 4 | + | ||
| 5 | +export class TingyunAPM { | ||
| 6 | + | ||
| 7 | + private static TINGYUN_APP_KEY = "" //TODO: | ||
| 8 | + private static TINGYUN_REDIRECT_HOST = "wkrt.tingyun.com" | ||
| 9 | + | ||
| 10 | + private static logEnable() { | ||
| 11 | + return true | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + // | ||
| 15 | + static initApp(context: common.UIAbilityContext, deviceId?: string) { | ||
| 16 | + tingyun.init({ | ||
| 17 | + redirectHost: TingyunAPM.TINGYUN_REDIRECT_HOST, | ||
| 18 | + appKey: TingyunAPM.TINGYUN_APP_KEY, | ||
| 19 | + context: context, | ||
| 20 | + | ||
| 21 | + httpEnabled: true, | ||
| 22 | + logLevel: TingyunAPM.logEnable() ? LogLevel.DEBUG : LogLevel.NONE, | ||
| 23 | + | ||
| 24 | + // TODO: axios实例对象 | ||
| 25 | + // axios:axiosInstance, | ||
| 26 | + network: { | ||
| 27 | + enabled: true, | ||
| 28 | + }, | ||
| 29 | + | ||
| 30 | + crash: { | ||
| 31 | + enabled: true, | ||
| 32 | + jsCrashEnabled: true, | ||
| 33 | + cppCrashEnabled: true, | ||
| 34 | + }, | ||
| 35 | + | ||
| 36 | + freeze: { | ||
| 37 | + enabled: true | ||
| 38 | + } | ||
| 39 | + }); | ||
| 40 | + if (deviceId) { | ||
| 41 | + tingyun.setUserId(deviceId) | ||
| 42 | + } | ||
| 43 | + tingyun.startNextSession() | ||
| 44 | + } | ||
| 45 | +} |
No preview for this file type
| 1 | -import { ToastUtils } from 'wdKit'; | ||
| 2 | - | 1 | +import { SPHelper,Logger,ToastUtils } from 'wdKit'; |
| 2 | +import { ContentDetailDTO, Action, ContentDTO,batchLikeAndCollectResult } from 'wdBean'; | ||
| 3 | +import { ProcessUtils } from 'wdRouter'; | ||
| 4 | +import router from '@ohos.router'; | ||
| 5 | +import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | ||
| 6 | +import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | ||
| 7 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 8 | +import { WDShare } from 'wdShare/Index'; | ||
| 9 | +const TAG = 'CarderInteraction' | ||
| 3 | /** | 10 | /** |
| 4 | * 卡片 分享、评论、点赞公用组件 | 11 | * 卡片 分享、评论、点赞公用组件 |
| 5 | */ | 12 | */ |
| 6 | @Component | 13 | @Component |
| 7 | export struct CarderInteraction { | 14 | export struct CarderInteraction { |
| 15 | + @Prop contentDTO: ContentDTO | ||
| 16 | + @State contentId: string = '' | ||
| 17 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 18 | + @State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态 | ||
| 8 | build() { | 19 | build() { |
| 9 | Row(){ | 20 | Row(){ |
| 10 | Row(){ | 21 | Row(){ |
| @@ -18,7 +29,7 @@ export struct CarderInteraction { | @@ -18,7 +29,7 @@ export struct CarderInteraction { | ||
| 18 | } | 29 | } |
| 19 | .justifyContent(FlexAlign.Center) | 30 | .justifyContent(FlexAlign.Center) |
| 20 | .onClick(()=>{ | 31 | .onClick(()=>{ |
| 21 | - ToastUtils.showToast('分享为公共方法,待开发', 1000) | 32 | + this.getContentDetailData() |
| 22 | }) | 33 | }) |
| 23 | Row(){ | 34 | Row(){ |
| 24 | Image($r('app.media.CarderInteraction_comment')) | 35 | Image($r('app.media.CarderInteraction_comment')) |
| @@ -31,7 +42,7 @@ export struct CarderInteraction { | @@ -31,7 +42,7 @@ export struct CarderInteraction { | ||
| 31 | } | 42 | } |
| 32 | .justifyContent(FlexAlign.Center) | 43 | .justifyContent(FlexAlign.Center) |
| 33 | .onClick(()=>{ | 44 | .onClick(()=>{ |
| 34 | - ToastUtils.showToast('分享为公共方法,待开发', 1000) | 45 | + ProcessUtils.processPage(this.contentDTO) |
| 35 | }) | 46 | }) |
| 36 | Row(){ | 47 | Row(){ |
| 37 | Image($r('app.media.CarderInteraction_like')) | 48 | Image($r('app.media.CarderInteraction_like')) |
| @@ -44,7 +55,8 @@ export struct CarderInteraction { | @@ -44,7 +55,8 @@ export struct CarderInteraction { | ||
| 44 | } | 55 | } |
| 45 | .justifyContent(FlexAlign.Center) | 56 | .justifyContent(FlexAlign.Center) |
| 46 | .onClick(()=>{ | 57 | .onClick(()=>{ |
| 47 | - ToastUtils.showToast('分享为公共方法,待开发', 1000) | 58 | + ProcessUtils.processPage(this.contentDTO) |
| 59 | + // ToastUtils.showToast('点赞为公共方法,待开发', 1000) | ||
| 48 | }) | 60 | }) |
| 49 | } | 61 | } |
| 50 | .width('100%') | 62 | .width('100%') |
| @@ -56,4 +68,45 @@ export struct CarderInteraction { | @@ -56,4 +68,45 @@ export struct CarderInteraction { | ||
| 56 | .justifyContent(FlexAlign.SpaceBetween) | 68 | .justifyContent(FlexAlign.SpaceBetween) |
| 57 | .alignItems(VerticalAlign.Center) | 69 | .alignItems(VerticalAlign.Center) |
| 58 | } | 70 | } |
| 71 | + /** | ||
| 72 | + * 请求(动态)详情页数据 | ||
| 73 | + * */ | ||
| 74 | + private async getContentDetailData() { | ||
| 75 | + try { | ||
| 76 | + let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType) | ||
| 77 | + this.contentDetailData = data[0]; | ||
| 78 | + console.log('动态详情',JSON.stringify(this.contentDetailData)) | ||
| 79 | + WDShare.shareContent(this.contentDetailData) | ||
| 80 | + } catch (exception) { | ||
| 81 | + console.log('请求失败',JSON.stringify(exception)) | ||
| 82 | + } | ||
| 83 | + this.getInteractDataStatus() | ||
| 84 | + } | ||
| 85 | + // 已登录->查询用户对作品点赞、收藏状态 | ||
| 86 | + private async getInteractDataStatus() { | ||
| 87 | + // 未登录,跳转登录 | ||
| 88 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 89 | + if (!user_id) { | ||
| 90 | + return | ||
| 91 | + } | ||
| 92 | + try { | ||
| 93 | + const params: batchLikeAndCollectParams = { | ||
| 94 | + contentList: [ | ||
| 95 | + { | ||
| 96 | + contentId: this.contentDetailData?.newsId + '', | ||
| 97 | + contentType: this.contentDetailData?.newsType + '', | ||
| 98 | + } | ||
| 99 | + ] | ||
| 100 | + } | ||
| 101 | + console.error(TAG, JSON.stringify(this.contentDetailData)) | ||
| 102 | + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | ||
| 103 | + console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | ||
| 104 | + this.newsStatusOfUser = data[0]; | ||
| 105 | + Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | ||
| 106 | + } catch (exception) { | ||
| 107 | + console.error(TAG, JSON.stringify(exception)) | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + | ||
| 59 | } | 111 | } |
| 112 | + |
| @@ -12,12 +12,13 @@ const TAG = 'Card11Component'; | @@ -12,12 +12,13 @@ const TAG = 'Card11Component'; | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct Card11Component { | 13 | export struct Card11Component { |
| 14 | @State contentDTO: ContentDTO = {} as ContentDTO; | 14 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 15 | + @State clicked: boolean = false; | ||
| 15 | 16 | ||
| 16 | build() { | 17 | build() { |
| 17 | Column() { | 18 | Column() { |
| 18 | Text(this.contentDTO.newsTitle) | 19 | Text(this.contentDTO.newsTitle) |
| 19 | .fontSize($r("app.float.font_size_16")) | 20 | .fontSize($r("app.float.font_size_16")) |
| 20 | - .fontColor($r("app.color.color_222222")) | 21 | + .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 21 | .maxLines(3) | 22 | .maxLines(3) |
| 22 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 23 | .width(CommonConstants.FULL_WIDTH) | 24 | .width(CommonConstants.FULL_WIDTH) |
| @@ -32,6 +33,8 @@ export struct Card11Component { | @@ -32,6 +33,8 @@ export struct Card11Component { | ||
| 32 | }) | 33 | }) |
| 33 | .backgroundColor($r("app.color.white")) | 34 | .backgroundColor($r("app.color.white")) |
| 34 | .onClick((event: ClickEvent) => { | 35 | .onClick((event: ClickEvent) => { |
| 36 | + | ||
| 37 | + this.clicked = true; | ||
| 35 | ProcessUtils.processPage(this.contentDTO) | 38 | ProcessUtils.processPage(this.contentDTO) |
| 36 | }) | 39 | }) |
| 37 | } | 40 | } |
| @@ -13,6 +13,7 @@ const TAG = 'Card12Component'; | @@ -13,6 +13,7 @@ const TAG = 'Card12Component'; | ||
| 13 | @Component | 13 | @Component |
| 14 | export struct Card12Component { | 14 | export struct Card12Component { |
| 15 | @State contentDTO: ContentDTO = {} as ContentDTO; | 15 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 16 | + @State clicked: boolean = false; | ||
| 16 | 17 | ||
| 17 | aboutToAppear(): void { | 18 | aboutToAppear(): void { |
| 18 | } | 19 | } |
| @@ -27,7 +28,7 @@ export struct Card12Component { | @@ -27,7 +28,7 @@ export struct Card12Component { | ||
| 27 | if (this.contentDTO.newsTitle) { | 28 | if (this.contentDTO.newsTitle) { |
| 28 | Text(this.contentDTO.newsTitle) | 29 | Text(this.contentDTO.newsTitle) |
| 29 | .fontSize($r('app.float.font_size_17')) | 30 | .fontSize($r('app.float.font_size_17')) |
| 30 | - .fontColor($r('app.color.color_222222')) | 31 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 31 | .width(CommonConstants.FULL_WIDTH) | 32 | .width(CommonConstants.FULL_WIDTH) |
| 32 | .textOverflowStyle(3) | 33 | .textOverflowStyle(3) |
| 33 | .margin({ bottom: 8 }) | 34 | .margin({ bottom: 8 }) |
| @@ -35,7 +36,7 @@ export struct Card12Component { | @@ -35,7 +36,7 @@ export struct Card12Component { | ||
| 35 | .lineHeight(25) | 36 | .lineHeight(25) |
| 36 | .fontFamily('PingFang SC-Regular') | 37 | .fontFamily('PingFang SC-Regular') |
| 37 | } | 38 | } |
| 38 | - CarderInteraction() | 39 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 39 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 40 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 40 | } | 41 | } |
| 41 | .padding({ | 42 | .padding({ |
| @@ -45,6 +46,7 @@ export struct Card12Component { | @@ -45,6 +46,7 @@ export struct Card12Component { | ||
| 45 | bottom: $r('app.float.card_comp_pagePadding_tb') | 46 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 46 | }) | 47 | }) |
| 47 | .onClick((event: ClickEvent) => { | 48 | .onClick((event: ClickEvent) => { |
| 49 | + this.clicked = true; | ||
| 48 | ProcessUtils.processPage(this.contentDTO) | 50 | ProcessUtils.processPage(this.contentDTO) |
| 49 | }) | 51 | }) |
| 50 | } | 52 | } |
| @@ -15,6 +15,7 @@ const TAG = 'Card14Component'; | @@ -15,6 +15,7 @@ const TAG = 'Card14Component'; | ||
| 15 | export struct Card14Component { | 15 | export struct Card14Component { |
| 16 | @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 17 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 18 | + @State clicked: boolean = false; | ||
| 18 | 19 | ||
| 19 | async aboutToAppear(): Promise<void> { | 20 | async aboutToAppear(): Promise<void> { |
| 20 | this.loadImg = await onlyWifiLoadImg(); | 21 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -31,7 +32,7 @@ export struct Card14Component { | @@ -31,7 +32,7 @@ export struct Card14Component { | ||
| 31 | 32 | ||
| 32 | Text(this.contentDTO.newsTitle) | 33 | Text(this.contentDTO.newsTitle) |
| 33 | .fontSize($r('app.float.font_size_17')) | 34 | .fontSize($r('app.float.font_size_17')) |
| 34 | - .fontColor($r('app.color.color_222222')) | 35 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 35 | .textOverflowStyle(3) | 36 | .textOverflowStyle(3) |
| 36 | .lineHeight(25) | 37 | .lineHeight(25) |
| 37 | .fontFamily('PingFang SC-Regular') | 38 | .fontFamily('PingFang SC-Regular') |
| @@ -52,7 +53,7 @@ export struct Card14Component { | @@ -52,7 +53,7 @@ export struct Card14Component { | ||
| 52 | .width(CommonConstants.FULL_WIDTH) | 53 | .width(CommonConstants.FULL_WIDTH) |
| 53 | .margin({ bottom: 8 }) | 54 | .margin({ bottom: 8 }) |
| 54 | .height(75) | 55 | .height(75) |
| 55 | - CarderInteraction() | 56 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 56 | 57 | ||
| 57 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 58 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 58 | } | 59 | } |
| @@ -63,6 +64,7 @@ export struct Card14Component { | @@ -63,6 +64,7 @@ export struct Card14Component { | ||
| 63 | bottom: $r('app.float.card_comp_pagePadding_tb') | 64 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 64 | }) | 65 | }) |
| 65 | .onClick((event: ClickEvent) => { | 66 | .onClick((event: ClickEvent) => { |
| 67 | + this.clicked = true; | ||
| 66 | ProcessUtils.processPage(this.contentDTO) | 68 | ProcessUtils.processPage(this.contentDTO) |
| 67 | }) | 69 | }) |
| 68 | } | 70 | } |
| @@ -19,6 +19,7 @@ const TAG: string = 'Card15Component'; | @@ -19,6 +19,7 @@ const TAG: string = 'Card15Component'; | ||
| 19 | export struct Card15Component { | 19 | export struct Card15Component { |
| 20 | @State contentDTO: ContentDTO = {} as ContentDTO; | 20 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 21 | @State loadImg: boolean = false; | 21 | @State loadImg: boolean = false; |
| 22 | + @State clicked: boolean = false; | ||
| 22 | 23 | ||
| 23 | async aboutToAppear(): Promise<void> { | 24 | async aboutToAppear(): Promise<void> { |
| 24 | this.loadImg = await onlyWifiLoadImg(); | 25 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -33,7 +34,7 @@ export struct Card15Component { | @@ -33,7 +34,7 @@ export struct Card15Component { | ||
| 33 | if (this.contentDTO.newsTitle) { | 34 | if (this.contentDTO.newsTitle) { |
| 34 | Text(this.contentDTO.newsTitle) | 35 | Text(this.contentDTO.newsTitle) |
| 35 | .fontSize($r('app.float.font_size_17')) | 36 | .fontSize($r('app.float.font_size_17')) |
| 36 | - .fontColor($r('app.color.color_222222')) | 37 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 37 | .width(CommonConstants.FULL_WIDTH) | 38 | .width(CommonConstants.FULL_WIDTH) |
| 38 | .textOverflowStyle(2) | 39 | .textOverflowStyle(2) |
| 39 | .margin({ bottom: 8 }) | 40 | .margin({ bottom: 8 }) |
| @@ -51,7 +52,7 @@ export struct Card15Component { | @@ -51,7 +52,7 @@ export struct Card15Component { | ||
| 51 | .width(CommonConstants.FULL_WIDTH) | 52 | .width(CommonConstants.FULL_WIDTH) |
| 52 | .aspectRatio(16 / 9) | 53 | .aspectRatio(16 / 9) |
| 53 | .alignContent(Alignment.BottomEnd) | 54 | .alignContent(Alignment.BottomEnd) |
| 54 | - CarderInteraction() | 55 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 55 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 56 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 56 | } | 57 | } |
| 57 | .padding({ | 58 | .padding({ |
| @@ -61,6 +62,7 @@ export struct Card15Component { | @@ -61,6 +62,7 @@ export struct Card15Component { | ||
| 61 | bottom: $r('app.float.card_comp_pagePadding_tb') | 62 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 62 | }) | 63 | }) |
| 63 | .onClick((event: ClickEvent) => { | 64 | .onClick((event: ClickEvent) => { |
| 65 | + this.clicked = true; | ||
| 64 | ProcessUtils.processPage(this.contentDTO) | 66 | ProcessUtils.processPage(this.contentDTO) |
| 65 | }) | 67 | }) |
| 66 | } | 68 | } |
| @@ -20,6 +20,7 @@ interface fullColumnImgUrlItem { | @@ -20,6 +20,7 @@ interface fullColumnImgUrlItem { | ||
| 20 | export struct Card16Component { | 20 | export struct Card16Component { |
| 21 | @State contentDTO: ContentDTO = {} as ContentDTO; | 21 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 22 | @State loadImg: boolean = false; | 22 | @State loadImg: boolean = false; |
| 23 | + @State clicked: boolean = false; | ||
| 23 | 24 | ||
| 24 | async aboutToAppear(): Promise<void> { | 25 | async aboutToAppear(): Promise<void> { |
| 25 | this.loadImg = await onlyWifiLoadImg(); | 26 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -35,7 +36,7 @@ export struct Card16Component { | @@ -35,7 +36,7 @@ export struct Card16Component { | ||
| 35 | if (this.contentDTO.newsTitle) { | 36 | if (this.contentDTO.newsTitle) { |
| 36 | Text(this.contentDTO.newsTitle) | 37 | Text(this.contentDTO.newsTitle) |
| 37 | .fontSize($r('app.float.font_size_17')) | 38 | .fontSize($r('app.float.font_size_17')) |
| 38 | - .fontColor($r('app.color.color_222222')) | 39 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 39 | .width(CommonConstants.FULL_WIDTH) | 40 | .width(CommonConstants.FULL_WIDTH) |
| 40 | .textOverflowStyle(2) | 41 | .textOverflowStyle(2) |
| 41 | .margin({ bottom: 8 }) | 42 | .margin({ bottom: 8 }) |
| @@ -52,7 +53,7 @@ export struct Card16Component { | @@ -52,7 +53,7 @@ export struct Card16Component { | ||
| 52 | }) | 53 | }) |
| 53 | } | 54 | } |
| 54 | } | 55 | } |
| 55 | - CarderInteraction() | 56 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 56 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 57 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 57 | } | 58 | } |
| 58 | .padding({ | 59 | .padding({ |
| @@ -62,6 +63,7 @@ export struct Card16Component { | @@ -62,6 +63,7 @@ export struct Card16Component { | ||
| 62 | bottom: $r('app.float.card_comp_pagePadding_tb') | 63 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 63 | }) | 64 | }) |
| 64 | .onClick((event: ClickEvent) => { | 65 | .onClick((event: ClickEvent) => { |
| 66 | + this.clicked = true; | ||
| 65 | ProcessUtils.processPage(this.contentDTO) | 67 | ProcessUtils.processPage(this.contentDTO) |
| 66 | }) | 68 | }) |
| 67 | } | 69 | } |
| @@ -17,6 +17,7 @@ export struct Card17Component { | @@ -17,6 +17,7 @@ export struct Card17Component { | ||
| 17 | @State compDTO: CompDTO = {} as CompDTO | 17 | @State compDTO: CompDTO = {} as CompDTO |
| 18 | @State contentDTO: ContentDTO = {} as ContentDTO; | 18 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 19 | @State loadImg: boolean = false; | 19 | @State loadImg: boolean = false; |
| 20 | + @State clicked: boolean = false; | ||
| 20 | 21 | ||
| 21 | async aboutToAppear(): Promise<void> { | 22 | async aboutToAppear(): Promise<void> { |
| 22 | this.loadImg = await onlyWifiLoadImg(); | 23 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -28,7 +29,7 @@ export struct Card17Component { | @@ -28,7 +29,7 @@ export struct Card17Component { | ||
| 28 | Text(this.contentDTO.newsTitle) | 29 | Text(this.contentDTO.newsTitle) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 30 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 30 | .fontSize($r('app.float.font_size_17')) | 31 | .fontSize($r('app.float.font_size_17')) |
| 31 | - .fontColor($r('app.color.color_222222')) | 32 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 32 | .lineHeight(25) | 33 | .lineHeight(25) |
| 33 | .maxLines(3) | 34 | .maxLines(3) |
| 34 | .width(CommonConstants.FULL_WIDTH) | 35 | .width(CommonConstants.FULL_WIDTH) |
| @@ -79,6 +80,7 @@ export struct Card17Component { | @@ -79,6 +80,7 @@ export struct Card17Component { | ||
| 79 | } | 80 | } |
| 80 | .width(CommonConstants.FULL_WIDTH) | 81 | .width(CommonConstants.FULL_WIDTH) |
| 81 | .onClick((event: ClickEvent) => { | 82 | .onClick((event: ClickEvent) => { |
| 83 | + this.clicked = true; | ||
| 82 | let taskAction: Action = { | 84 | let taskAction: Action = { |
| 83 | type: 'JUMP_DETAIL_PAGE', | 85 | type: 'JUMP_DETAIL_PAGE', |
| 84 | params: { | 86 | params: { |
| @@ -14,6 +14,7 @@ const TAG = 'Card19Component'; | @@ -14,6 +14,7 @@ const TAG = 'Card19Component'; | ||
| 14 | export struct Card19Component { | 14 | export struct Card19Component { |
| 15 | @State contentDTO: ContentDTO = { | 15 | @State contentDTO: ContentDTO = { |
| 16 | } as ContentDTO | 16 | } as ContentDTO |
| 17 | + @State clicked: boolean = false; | ||
| 17 | 18 | ||
| 18 | build() { | 19 | build() { |
| 19 | Column() { | 20 | Column() { |
| @@ -23,11 +24,12 @@ export struct Card19Component { | @@ -23,11 +24,12 @@ export struct Card19Component { | ||
| 23 | if (this.contentDTO.newsTitle) { | 24 | if (this.contentDTO.newsTitle) { |
| 24 | Text(this.contentDTO.newsTitle) | 25 | Text(this.contentDTO.newsTitle) |
| 25 | .fontSize($r('app.float.font_size_17')) | 26 | .fontSize($r('app.float.font_size_17')) |
| 26 | - .fontColor($r('app.color.color_222222')) | 27 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 27 | .textOverflowStyle(3) | 28 | .textOverflowStyle(3) |
| 28 | .margin({ bottom: 8 }) | 29 | .margin({ bottom: 8 }) |
| 29 | .width(CommonConstants.FULL_WIDTH) | 30 | .width(CommonConstants.FULL_WIDTH) |
| 30 | .onClick((event: ClickEvent) => { | 31 | .onClick((event: ClickEvent) => { |
| 32 | + this.clicked = true; | ||
| 31 | ProcessUtils.processPage(this.contentDTO) | 33 | ProcessUtils.processPage(this.contentDTO) |
| 32 | }) | 34 | }) |
| 33 | } | 35 | } |
| @@ -45,7 +47,7 @@ export struct Card19Component { | @@ -45,7 +47,7 @@ export struct Card19Component { | ||
| 45 | }) | 47 | }) |
| 46 | ProcessUtils.gotoMultiPictureListPage(photoList,0) | 48 | ProcessUtils.gotoMultiPictureListPage(photoList,0) |
| 47 | }) | 49 | }) |
| 48 | - CarderInteraction() | 50 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 49 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 51 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 50 | } | 52 | } |
| 51 | .padding({ | 53 | .padding({ |
| @@ -55,6 +57,7 @@ export struct Card19Component { | @@ -55,6 +57,7 @@ export struct Card19Component { | ||
| 55 | bottom: $r('app.float.card_comp_pagePadding_tb') | 57 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 56 | }) | 58 | }) |
| 57 | .onClick((event: ClickEvent) => { | 59 | .onClick((event: ClickEvent) => { |
| 60 | + this.clicked = true; | ||
| 58 | ProcessUtils.processPage(this.contentDTO) | 61 | ProcessUtils.processPage(this.contentDTO) |
| 59 | }) | 62 | }) |
| 60 | } | 63 | } |
| @@ -138,12 +141,12 @@ struct createImg { | @@ -138,12 +141,12 @@ struct createImg { | ||
| 138 | Image(this.loadImg ? item.fullUrl : '') | 141 | Image(this.loadImg ? item.fullUrl : '') |
| 139 | .backgroundColor(0xf5f5f5) | 142 | .backgroundColor(0xf5f5f5) |
| 140 | .width('100%') | 143 | .width('100%') |
| 141 | - // .height(172) | 144 | + .height(172) |
| 142 | .autoResize(true) | 145 | .autoResize(true) |
| 143 | .borderRadius(this.caclImageRadius(index)) | 146 | .borderRadius(this.caclImageRadius(index)) |
| 144 | } else if (this.getPicType() === 2) { | 147 | } else if (this.getPicType() === 2) { |
| 145 | Image(this.loadImg ? item.fullUrl : '') | 148 | Image(this.loadImg ? item.fullUrl : '') |
| 146 | - // .width('100%') | 149 | + .width('100%') |
| 147 | .height(305) | 150 | .height(305) |
| 148 | .autoResize(true) | 151 | .autoResize(true) |
| 149 | .borderRadius(this.caclImageRadius(index)) | 152 | .borderRadius(this.caclImageRadius(index)) |
| @@ -158,6 +161,7 @@ struct createImg { | @@ -158,6 +161,7 @@ struct createImg { | ||
| 158 | .fontWeight(400) | 161 | .fontWeight(400) |
| 159 | .fontColor(0xffffff) | 162 | .fontColor(0xffffff) |
| 160 | .fontFamily('PingFang SC') | 163 | .fontFamily('PingFang SC') |
| 164 | + .shadow({radius: 4, color: 0xc3cbd5, offsetX: 4, offsetY: 4}) | ||
| 161 | } | 165 | } |
| 162 | .width(48) | 166 | .width(48) |
| 163 | .padding({bottom: 9}) | 167 | .padding({bottom: 9}) |
| @@ -15,6 +15,7 @@ const TAG = 'Card20Component'; | @@ -15,6 +15,7 @@ const TAG = 'Card20Component'; | ||
| 15 | export struct Card20Component { | 15 | export struct Card20Component { |
| 16 | @State contentDTO: ContentDTO = { | 16 | @State contentDTO: ContentDTO = { |
| 17 | } as ContentDTO; | 17 | } as ContentDTO; |
| 18 | + @State clicked: boolean = false; | ||
| 18 | 19 | ||
| 19 | aboutToAppear(): void { | 20 | aboutToAppear(): void { |
| 20 | } | 21 | } |
| @@ -27,7 +28,7 @@ export struct Card20Component { | @@ -27,7 +28,7 @@ export struct Card20Component { | ||
| 27 | if (this.contentDTO.newsTitle) { | 28 | if (this.contentDTO.newsTitle) { |
| 28 | Text(this.contentDTO.newsTitle) | 29 | Text(this.contentDTO.newsTitle) |
| 29 | .fontSize($r('app.float.font_size_17')) | 30 | .fontSize($r('app.float.font_size_17')) |
| 30 | - .fontColor($r('app.color.color_222222')) | 31 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 31 | .width(CommonConstants.FULL_WIDTH) | 32 | .width(CommonConstants.FULL_WIDTH) |
| 32 | .textOverflowStyle(3) | 33 | .textOverflowStyle(3) |
| 33 | .margin({ bottom: 8 }) | 34 | .margin({ bottom: 8 }) |
| @@ -36,7 +37,7 @@ export struct Card20Component { | @@ -36,7 +37,7 @@ export struct Card20Component { | ||
| 36 | if (this.contentDTO.fullColumnImgUrls[0]) { | 37 | if (this.contentDTO.fullColumnImgUrls[0]) { |
| 37 | createImg({ contentDTO: this.contentDTO }) | 38 | createImg({ contentDTO: this.contentDTO }) |
| 38 | } | 39 | } |
| 39 | - CarderInteraction() | 40 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 40 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 41 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 41 | } | 42 | } |
| 42 | .padding({ | 43 | .padding({ |
| @@ -46,6 +47,7 @@ export struct Card20Component { | @@ -46,6 +47,7 @@ export struct Card20Component { | ||
| 46 | bottom: $r('app.float.card_comp_pagePadding_tb') | 47 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 47 | }) | 48 | }) |
| 48 | .onClick((event: ClickEvent) => { | 49 | .onClick((event: ClickEvent) => { |
| 50 | + this.clicked = true; | ||
| 49 | ProcessUtils.processPage(this.contentDTO) | 51 | ProcessUtils.processPage(this.contentDTO) |
| 50 | }) | 52 | }) |
| 51 | } | 53 | } |
| @@ -15,6 +15,7 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -15,6 +15,7 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 15 | export struct Card21Component { | 15 | export struct Card21Component { |
| 16 | @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 17 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 18 | + @State clicked: boolean = false; | ||
| 18 | 19 | ||
| 19 | async aboutToAppear(): Promise<void> { | 20 | async aboutToAppear(): Promise<void> { |
| 20 | this.loadImg = await onlyWifiLoadImg(); | 21 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -29,7 +30,7 @@ export struct Card21Component { | @@ -29,7 +30,7 @@ export struct Card21Component { | ||
| 29 | GridItem() { | 30 | GridItem() { |
| 30 | Text(`${this.contentDTO.newsTitle}`) | 31 | Text(`${this.contentDTO.newsTitle}`) |
| 31 | .fontSize($r('app.float.selected_text_size')) | 32 | .fontSize($r('app.float.selected_text_size')) |
| 32 | - .fontColor($r('app.color.color_222222')) | 33 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 33 | .width(CommonConstants.FULL_WIDTH) | 34 | .width(CommonConstants.FULL_WIDTH) |
| 34 | .maxLines(4) | 35 | .maxLines(4) |
| 35 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 36 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -50,10 +51,11 @@ export struct Card21Component { | @@ -50,10 +51,11 @@ export struct Card21Component { | ||
| 50 | } | 51 | } |
| 51 | .columnsTemplate('2fr 1fr') | 52 | .columnsTemplate('2fr 1fr') |
| 52 | .maxCount(1) | 53 | .maxCount(1) |
| 53 | - CarderInteraction() | 54 | + CarderInteraction({contentDTO: this.contentDTO}) |
| 54 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 55 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 55 | } | 56 | } |
| 56 | .onClick((event: ClickEvent) => { | 57 | .onClick((event: ClickEvent) => { |
| 58 | + this.clicked = true; | ||
| 57 | ProcessUtils.processPage(this.contentDTO) | 59 | ProcessUtils.processPage(this.contentDTO) |
| 58 | }) | 60 | }) |
| 59 | .padding({ | 61 | .padding({ |
| @@ -20,6 +20,7 @@ const TAG: string = 'Card2Component'; | @@ -20,6 +20,7 @@ const TAG: string = 'Card2Component'; | ||
| 20 | export struct Card2Component { | 20 | export struct Card2Component { |
| 21 | @State contentDTO: ContentDTO = {} as ContentDTO; | 21 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 22 | @State loadImg: boolean = false; | 22 | @State loadImg: boolean = false; |
| 23 | + @State clicked: boolean = false; | ||
| 23 | 24 | ||
| 24 | async aboutToAppear(): Promise<void> { | 25 | async aboutToAppear(): Promise<void> { |
| 25 | this.loadImg = await onlyWifiLoadImg(); | 26 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -35,7 +36,7 @@ export struct Card2Component { | @@ -35,7 +36,7 @@ export struct Card2Component { | ||
| 35 | } | 36 | } |
| 36 | Text(this.contentDTO.newsTitle) | 37 | Text(this.contentDTO.newsTitle) |
| 37 | .fontSize($r('app.float.font_size_17')) | 38 | .fontSize($r('app.float.font_size_17')) |
| 38 | - .fontColor($r('app.color.color_222222')) | 39 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 39 | .maxLines(2) | 40 | .maxLines(2) |
| 40 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 41 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 41 | .align(Alignment.Start) | 42 | .align(Alignment.Start) |
| @@ -73,6 +74,7 @@ export struct Card2Component { | @@ -73,6 +74,7 @@ export struct Card2Component { | ||
| 73 | bottom: $r('app.float.card_comp_pagePadding_tb') | 74 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 74 | }) | 75 | }) |
| 75 | .onClick((event: ClickEvent) => { | 76 | .onClick((event: ClickEvent) => { |
| 77 | + this.clicked = true; | ||
| 76 | ProcessUtils.processPage(this.contentDTO) | 78 | ProcessUtils.processPage(this.contentDTO) |
| 77 | }) | 79 | }) |
| 78 | } | 80 | } |
| @@ -10,22 +10,14 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | @@ -10,22 +10,14 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 10 | @Component | 10 | @Component |
| 11 | export struct Card3Component { | 11 | export struct Card3Component { |
| 12 | @State contentDTO: ContentDTO = { | 12 | @State contentDTO: ContentDTO = { |
| 13 | - // appStyle: '3', | ||
| 14 | - // channelId: '2002', | ||
| 15 | - // newsTitle: '习近平向斯洛伐克当选总统佩', | ||
| 16 | - // objectId: '30044351686', | ||
| 17 | - // objectType: '8', | ||
| 18 | - // publishTime: '1712967589000', | ||
| 19 | - // relId: '500005307414', | ||
| 20 | - // relType: '1', | ||
| 21 | - // source: '新华社', | ||
| 22 | } as ContentDTO; | 13 | } as ContentDTO; |
| 14 | + @State clicked: boolean = false; | ||
| 23 | 15 | ||
| 24 | build() { | 16 | build() { |
| 25 | Column() { | 17 | Column() { |
| 26 | Text(this.contentDTO.newsTitle) | 18 | Text(this.contentDTO.newsTitle) |
| 27 | .fontSize($r("app.float.font_size_16")) | 19 | .fontSize($r("app.float.font_size_16")) |
| 28 | - .fontColor($r("app.color.color_222222")) | 20 | + .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 29 | .width(CommonConstants.FULL_WIDTH) | 21 | .width(CommonConstants.FULL_WIDTH) |
| 30 | // 评论等信息 | 22 | // 评论等信息 |
| 31 | CardSourceInfo({ contentDTO: this.contentDTO }) | 23 | CardSourceInfo({ contentDTO: this.contentDTO }) |
| @@ -38,6 +30,7 @@ export struct Card3Component { | @@ -38,6 +30,7 @@ export struct Card3Component { | ||
| 38 | bottom: $r('app.float.card_comp_pagePadding_tb') | 30 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 39 | }) | 31 | }) |
| 40 | .onClick((event: ClickEvent) => { | 32 | .onClick((event: ClickEvent) => { |
| 33 | + this.clicked = true; | ||
| 41 | ProcessUtils.processPage(this.contentDTO) | 34 | ProcessUtils.processPage(this.contentDTO) |
| 42 | }) | 35 | }) |
| 43 | } | 36 | } |
| @@ -17,6 +17,8 @@ const TAG: string = 'Card4Component'; | @@ -17,6 +17,8 @@ const TAG: string = 'Card4Component'; | ||
| 17 | export struct Card4Component { | 17 | export struct Card4Component { |
| 18 | @State contentDTO: ContentDTO = {} as ContentDTO; | 18 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 19 | @State loadImg: boolean = false; | 19 | @State loadImg: boolean = false; |
| 20 | + @State clicked: boolean = false; | ||
| 21 | + | ||
| 20 | 22 | ||
| 21 | async aboutToAppear(): Promise<void> { | 23 | async aboutToAppear(): Promise<void> { |
| 22 | this.loadImg = await onlyWifiLoadImg(); | 24 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -29,7 +31,7 @@ export struct Card4Component { | @@ -29,7 +31,7 @@ export struct Card4Component { | ||
| 29 | //新闻标题 | 31 | //新闻标题 |
| 30 | Text(this.contentDTO.newsTitle) | 32 | Text(this.contentDTO.newsTitle) |
| 31 | .fontSize($r('app.float.font_size_17')) | 33 | .fontSize($r('app.float.font_size_17')) |
| 32 | - .fontColor($r('app.color.color_222222')) | 34 | + .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 33 | .maxLines(3) | 35 | .maxLines(3) |
| 34 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 36 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 35 | //三图 | 37 | //三图 |
| @@ -67,6 +69,7 @@ export struct Card4Component { | @@ -67,6 +69,7 @@ export struct Card4Component { | ||
| 67 | .justifyContent(FlexAlign.Start) | 69 | .justifyContent(FlexAlign.Start) |
| 68 | .alignItems(HorizontalAlign.Start) | 70 | .alignItems(HorizontalAlign.Start) |
| 69 | .onClick((event: ClickEvent) => { | 71 | .onClick((event: ClickEvent) => { |
| 72 | + this.clicked = true; | ||
| 70 | ProcessUtils.processPage(this.contentDTO) | 73 | ProcessUtils.processPage(this.contentDTO) |
| 71 | }) | 74 | }) |
| 72 | //bottom 评论等信息 | 75 | //bottom 评论等信息 |
| @@ -14,6 +14,7 @@ export struct Card5Component { | @@ -14,6 +14,7 @@ export struct Card5Component { | ||
| 14 | @State contentDTO: ContentDTO = {} as ContentDTO; | 14 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 15 | @State titleShowPolicy: number | string = 1 | 15 | @State titleShowPolicy: number | string = 1 |
| 16 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 17 | + @State clicked: boolean = false; | ||
| 17 | 18 | ||
| 18 | async aboutToAppear(): Promise<void> { | 19 | async aboutToAppear(): Promise<void> { |
| 19 | this.loadImg = await onlyWifiLoadImg(); | 20 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -64,6 +65,7 @@ export struct Card5Component { | @@ -64,6 +65,7 @@ export struct Card5Component { | ||
| 64 | bottom: $r('app.float.card_comp_pagePadding_tb') | 65 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 65 | }) | 66 | }) |
| 66 | .onClick((event: ClickEvent) => { | 67 | .onClick((event: ClickEvent) => { |
| 68 | + this.clicked = true; | ||
| 67 | ProcessUtils.processPage(this.contentDTO) | 69 | ProcessUtils.processPage(this.contentDTO) |
| 68 | }) | 70 | }) |
| 69 | 71 |
| @@ -15,6 +15,7 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -15,6 +15,7 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 15 | export struct Card6Component { | 15 | export struct Card6Component { |
| 16 | @State contentDTO: ContentDTO = {} as ContentDTO; | 16 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 17 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 18 | + @State clicked: boolean = false; | ||
| 18 | 19 | ||
| 19 | async aboutToAppear(): Promise<void> { | 20 | async aboutToAppear(): Promise<void> { |
| 20 | this.loadImg = await onlyWifiLoadImg(); | 21 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -40,15 +41,14 @@ export struct Card6Component { | @@ -40,15 +41,14 @@ export struct Card6Component { | ||
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | Text(`${this.contentDTO.newsTitle}`) | 43 | Text(`${this.contentDTO.newsTitle}`) |
| 44 | + .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 43 | .fontSize(16) | 45 | .fontSize(16) |
| 44 | .fontWeight(FontWeight.Normal) | 46 | .fontWeight(FontWeight.Normal) |
| 45 | .maxLines(3) | 47 | .maxLines(3) |
| 46 | .alignSelf(ItemAlign.Start) | 48 | .alignSelf(ItemAlign.Start) |
| 47 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 49 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 48 | - .textIndent( | ||
| 49 | - this.contentDTO.newTags.length < 5 && this.contentDTO.newTags.length > 2 ? | ||
| 50 | - 60 : this.contentDTO.newTags.length != 0 && this.contentDTO.newTags.length < 3 ? | ||
| 51 | - 30 : 0) | 50 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 : |
| 51 | + this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length < 3 ? 30 : 0) | ||
| 52 | }.alignContent(Alignment.TopStart) | 52 | }.alignContent(Alignment.TopStart) |
| 53 | 53 | ||
| 54 | }.height("80%") | 54 | }.height("80%") |
| @@ -73,6 +73,7 @@ export struct Card6Component { | @@ -73,6 +73,7 @@ export struct Card6Component { | ||
| 73 | .alignContent(Alignment.BottomEnd) | 73 | .alignContent(Alignment.BottomEnd) |
| 74 | } | 74 | } |
| 75 | .onClick((event: ClickEvent) => { | 75 | .onClick((event: ClickEvent) => { |
| 76 | + this.clicked = true; | ||
| 76 | ProcessUtils.processPage(this.contentDTO) | 77 | ProcessUtils.processPage(this.contentDTO) |
| 77 | }) | 78 | }) |
| 78 | .padding({ | 79 | .padding({ |
| @@ -14,6 +14,7 @@ const TAG: string = 'Card9Component'; | @@ -14,6 +14,7 @@ const TAG: string = 'Card9Component'; | ||
| 14 | export struct Card9Component { | 14 | export struct Card9Component { |
| 15 | @State contentDTO: ContentDTO = {} as ContentDTO; | 15 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 16 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 17 | + @State clicked: boolean = false; | ||
| 17 | 18 | ||
| 18 | async aboutToAppear(): Promise<void> { | 19 | async aboutToAppear(): Promise<void> { |
| 19 | this.loadImg = await onlyWifiLoadImg(); | 20 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -24,6 +25,7 @@ export struct Card9Component { | @@ -24,6 +25,7 @@ export struct Card9Component { | ||
| 24 | // 顶部标题,最多两行 | 25 | // 顶部标题,最多两行 |
| 25 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 26 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 26 | Text(this.contentDTO.newsTitle) | 27 | Text(this.contentDTO.newsTitle) |
| 28 | + .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 27 | .width(CommonConstants.FULL_WIDTH) | 29 | .width(CommonConstants.FULL_WIDTH) |
| 28 | .fontSize($r('app.float.font_size_17')) | 30 | .fontSize($r('app.float.font_size_17')) |
| 29 | .fontWeight(600) | 31 | .fontWeight(600) |
| @@ -81,6 +83,7 @@ export struct Card9Component { | @@ -81,6 +83,7 @@ export struct Card9Component { | ||
| 81 | .backgroundColor($r("app.color.white")) | 83 | .backgroundColor($r("app.color.white")) |
| 82 | .margin({ bottom: 8 }) | 84 | .margin({ bottom: 8 }) |
| 83 | .onClick((event: ClickEvent) => { | 85 | .onClick((event: ClickEvent) => { |
| 86 | + this.clicked = true; | ||
| 84 | ProcessUtils.processPage(this.contentDTO) | 87 | ProcessUtils.processPage(this.contentDTO) |
| 85 | }) | 88 | }) |
| 86 | } | 89 | } |
| @@ -49,9 +49,12 @@ export struct AccountAndSecurityLayout { | @@ -49,9 +49,12 @@ export struct AccountAndSecurityLayout { | ||
| 49 | 49 | ||
| 50 | confirmDialogController: CustomDialogController = new CustomDialogController({ | 50 | confirmDialogController: CustomDialogController = new CustomDialogController({ |
| 51 | builder: ConfirmLogoutDialog({ | 51 | builder: ConfirmLogoutDialog({ |
| 52 | - cancel: () => { | ||
| 53 | - | ||
| 54 | - }, | 52 | + tipShow:false, |
| 53 | + title:"确认退出登录吗?", | ||
| 54 | + leftText:"确认", | ||
| 55 | + leftTextColor:$r('app.color.color_648DF2'), | ||
| 56 | + rightText:"取消", | ||
| 57 | + cancelIsLeft:false, | ||
| 55 | confirm: () => { | 58 | confirm: () => { |
| 56 | this.logout() | 59 | this.logout() |
| 57 | } | 60 | } |
| @@ -213,17 +216,6 @@ export struct AccountAndSecurityLayout { | @@ -213,17 +216,6 @@ export struct AccountAndSecurityLayout { | ||
| 213 | Column() { | 216 | Column() { |
| 214 | Button('退出登录',{ stateEffect: true ,type: ButtonType.Normal}).width('90%').height('80lpx').backgroundColor('#da3e22').fontColor('#fff').margin('20lpx').borderRadius('8lpx').onClick(()=>{ | 217 | Button('退出登录',{ stateEffect: true ,type: ButtonType.Normal}).width('90%').height('80lpx').backgroundColor('#da3e22').fontColor('#fff').margin('20lpx').borderRadius('8lpx').onClick(()=>{ |
| 215 | this.confirmDialogController.open() | 218 | this.confirmDialogController.open() |
| 216 | - | ||
| 217 | - // AlertDialog.show({ | ||
| 218 | - // title: '🥟id : ' + "button", | ||
| 219 | - // message: '标题:' + '退出登录', | ||
| 220 | - // confirm: { | ||
| 221 | - // value: "OK", | ||
| 222 | - // action: () => { | ||
| 223 | - // | ||
| 224 | - // }, | ||
| 225 | - // } | ||
| 226 | - // }) | ||
| 227 | }) | 219 | }) |
| 228 | } | 220 | } |
| 229 | } | 221 | } |
| @@ -2,6 +2,17 @@ | @@ -2,6 +2,17 @@ | ||
| 2 | 2 | ||
| 3 | @CustomDialog | 3 | @CustomDialog |
| 4 | export struct ConfirmLogoutDialog { | 4 | export struct ConfirmLogoutDialog { |
| 5 | + @State title: string = "标题" | ||
| 6 | + @State titleShow: boolean = true | ||
| 7 | + @State tipValue: string ="提示文字" | ||
| 8 | + @State tipShow: boolean = true | ||
| 9 | + @State cancelIsLeft :boolean = true//取消是否在左边 | ||
| 10 | + @State leftText: string = "取消" | ||
| 11 | + @State rightText: string = "确认" | ||
| 12 | + @State leftTextColor: Resource = $r('app.color.color_333333') | ||
| 13 | + @State rightTextColor: Resource = $r('app.color.color_648DF2') | ||
| 14 | + | ||
| 15 | + | ||
| 5 | controller: CustomDialogController | 16 | controller: CustomDialogController |
| 6 | cancel: () => void = () => { | 17 | cancel: () => void = () => { |
| 7 | } | 18 | } |
| @@ -10,51 +21,78 @@ export struct ConfirmLogoutDialog { | @@ -10,51 +21,78 @@ export struct ConfirmLogoutDialog { | ||
| 10 | 21 | ||
| 11 | build() { | 22 | build() { |
| 12 | Column() { | 23 | Column() { |
| 13 | - Text("确认退出登录吗?") | ||
| 14 | - .fontColor("#222222") | ||
| 15 | - .fontSize(18) | 24 | + Column(){ |
| 25 | + if(this.titleShow){ | ||
| 26 | + Text(this.title) | ||
| 27 | + .fontSize("32lpx") | ||
| 28 | + .fontColor($r('app.color.color_333333')) | ||
| 29 | + .lineHeight('50lpx') | ||
| 30 | + .fontWeight(600) | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + if(this.tipShow){ | ||
| 34 | + Text(this.tipValue) | ||
| 35 | + .margin({ top:this.titleShow?"10lpx":"0lpx" }) | ||
| 36 | + .fontSize("27lpx") | ||
| 37 | + .fontWeight(400) | ||
| 38 | + .lineHeight('38lpx') | ||
| 39 | + .fontColor($r('app.color.color_999999')) | ||
| 40 | + } | ||
| 41 | + }.padding({top:"48lpx",bottom:"48lpx"}) | ||
| 42 | + .alignItems(HorizontalAlign.Center) | ||
| 43 | + | ||
| 44 | + Divider() | ||
| 16 | .width("100%") | 45 | .width("100%") |
| 17 | - .fontWeight(FontWeight.Bold) | ||
| 18 | - .textAlign(TextAlign.Center) | ||
| 19 | - .margin({ top: 20 }) | ||
| 20 | - | ||
| 21 | - Divider().color("#999999").width("100%").margin({ top: 20 }).height('1vp') | ||
| 22 | - Row() { | ||
| 23 | - Text('确认') | ||
| 24 | - .fontSize(16) | ||
| 25 | - .fontColor("#648DF2") | ||
| 26 | - .layoutWeight(1) | ||
| 27 | - .fontWeight(FontWeight.Medium) | ||
| 28 | - .textAlign(TextAlign.Center) | 46 | + .strokeWidth('1lpx') |
| 47 | + .height('1lpx') | ||
| 48 | + .color($r('app.color.color_EEEEEE')) | ||
| 49 | + | ||
| 50 | + Row(){ | ||
| 51 | + Text(this.leftText) | ||
| 52 | + .fontSize('35lpx') | ||
| 53 | + .fontWeight(400) | ||
| 54 | + .fontColor(this.leftTextColor) | ||
| 29 | .onClick(() => { | 55 | .onClick(() => { |
| 30 | - this.controller.close() | ||
| 31 | - if (this.confirm) { | ||
| 32 | - this.confirm() | 56 | + if (this.controller != undefined){ |
| 57 | + if(this.cancelIsLeft){ | ||
| 58 | + this.controller.close() | ||
| 59 | + this.cancel() | ||
| 60 | + }else{ | ||
| 61 | + this.controller.close() | ||
| 62 | + this.confirm() | ||
| 63 | + } | ||
| 33 | } | 64 | } |
| 34 | - | ||
| 35 | - }) | ||
| 36 | - .height('100%') | ||
| 37 | - // Divider().color("#999999").height('100%').width('0.5vp') | ||
| 38 | - Text('取消') | ||
| 39 | - .fontSize(16) | ||
| 40 | - .fontColor("#648DF2") | ||
| 41 | - .layoutWeight(1) | ||
| 42 | - .fontWeight(FontWeight.Medium) | 65 | + }).layoutWeight(1) |
| 43 | .textAlign(TextAlign.Center) | 66 | .textAlign(TextAlign.Center) |
| 44 | - .border({ | ||
| 45 | - width: { left: 1 }, | ||
| 46 | - color: "#999999", | ||
| 47 | - style: { left: BorderStyle.Solid } | ||
| 48 | 67 | ||
| 49 | - }) | 68 | + Divider() |
| 69 | + .width("1lpx") | ||
| 70 | + .strokeWidth('1lpx') | ||
| 71 | + .vertical(true) | ||
| 72 | + .height('92lpx') | ||
| 73 | + .color($r('app.color.color_EEEEEE')) | ||
| 74 | + | ||
| 75 | + Text(this.rightText) | ||
| 76 | + .fontSize('35lpx') | ||
| 77 | + .textAlign(TextAlign.Center) | ||
| 78 | + .fontWeight(400) | ||
| 79 | + .fontColor(this.rightTextColor) | ||
| 50 | .onClick(() => { | 80 | .onClick(() => { |
| 51 | - this.controller.close() | ||
| 52 | - if (this.cancel) { | ||
| 53 | - this.cancel() | 81 | + if (this.controller != undefined) { |
| 82 | + if(this.cancelIsLeft){ | ||
| 83 | + this.controller.close() | ||
| 84 | + this.confirm() | ||
| 85 | + }else{ | ||
| 86 | + this.controller.close() | ||
| 87 | + this.cancel() | ||
| 88 | + } | ||
| 54 | } | 89 | } |
| 55 | - }) | ||
| 56 | - .height('100%') | ||
| 57 | - }.layoutWeight(1).justifyContent(FlexAlign.Center) | ||
| 58 | - }.height(110).backgroundColor(Color.White).borderRadius(6).width('74%') | 90 | + }).layoutWeight(1) |
| 91 | + } | ||
| 92 | + .alignItems(VerticalAlign.Center) | ||
| 93 | + .height('96lpx') | ||
| 94 | + }.borderRadius(10) | ||
| 95 | + .width("518lpx") | ||
| 96 | + .backgroundColor("#FFF") | ||
| 59 | } | 97 | } |
| 60 | } | 98 | } |
| @@ -7,6 +7,7 @@ import { LiveModel } from '../../viewmodel/LiveModel' | @@ -7,6 +7,7 @@ import { LiveModel } from '../../viewmodel/LiveModel' | ||
| 7 | @Component | 7 | @Component |
| 8 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | 8 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { |
| 9 | @State compDTO: CompDTO = {} as CompDTO | 9 | @State compDTO: CompDTO = {} as CompDTO |
| 10 | + @State clicked: boolean = false; | ||
| 10 | 11 | ||
| 11 | build() { | 12 | build() { |
| 12 | Column() { | 13 | Column() { |
| @@ -18,7 +19,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -18,7 +19,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 18 | .margin({ right: 4 }) | 19 | .margin({ right: 4 }) |
| 19 | Text(this.compDTO.objectTitle) | 20 | Text(this.compDTO.objectTitle) |
| 20 | .fontSize($r("app.float.font_size_17")) | 21 | .fontSize($r("app.float.font_size_17")) |
| 21 | - .fontColor($r("app.color.color_222222")) | 22 | + .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 22 | .fontWeight(600) | 23 | .fontWeight(600) |
| 23 | } | 24 | } |
| 24 | 25 | ||
| @@ -63,6 +64,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -63,6 +64,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 63 | .backgroundColor($r("app.color.white")) | 64 | .backgroundColor($r("app.color.white")) |
| 64 | .margin({ bottom: 8 }) | 65 | .margin({ bottom: 8 }) |
| 65 | .onClick(() => { | 66 | .onClick(() => { |
| 67 | + this.clicked = true; | ||
| 66 | this.gotoLive(this.compDTO?.operDataList[0]) | 68 | this.gotoLive(this.compDTO?.operDataList[0]) |
| 67 | }) | 69 | }) |
| 68 | } | 70 | } |
| @@ -20,40 +20,15 @@ import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; | @@ -20,40 +20,15 @@ import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; | ||
| 20 | import { LoginModule } from 'wdLogin/src/main/ets/LoginModule'; | 20 | import { LoginModule } from 'wdLogin/src/main/ets/LoginModule'; |
| 21 | import { ConfigurationConstant } from '@kit.AbilityKit'; | 21 | import { ConfigurationConstant } from '@kit.AbilityKit'; |
| 22 | import { WDPushNotificationManager } from 'wdHwAbility/Index'; | 22 | import { WDPushNotificationManager } from 'wdHwAbility/Index'; |
| 23 | +import { StartupManager } from '../startupmanager/StartupManager'; | ||
| 23 | 24 | ||
| 24 | export default class EntryAbility extends UIAbility { | 25 | export default class EntryAbility extends UIAbility { |
| 25 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 26 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| 26 | - UmengStats.preInit(this.context) | ||
| 27 | - SPHelper.init(this.context); | 27 | + StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context) |
| 28 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | 28 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); |
| 29 | 29 | ||
| 30 | - // mPaaS 初始化 | ||
| 31 | - MpaasUtils.initApp(this.context) | ||
| 32 | - | ||
| 33 | - registerRouter(); | ||
| 34 | - LoginModule.startup() | ||
| 35 | - NetworkManager.getInstance().init() | ||
| 36 | - WDHttp.initHttpHeader() | ||
| 37 | - const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string | ||
| 38 | - if (StringUtils.isNotEmpty(spHostUrl)) { | ||
| 39 | - HostManager.changeHost(spHostUrl as HostEnum) | ||
| 40 | - } | ||
| 41 | // 还没深色模式需求,暂直接不跟随系统。 | 30 | // 还没深色模式需求,暂直接不跟随系统。 |
| 42 | this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); | 31 | this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); |
| 43 | - // 注册监听网络连接 | ||
| 44 | - EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => { | ||
| 45 | - let type: NetworkType | null = null | ||
| 46 | - if (str) { | ||
| 47 | - type = JSON.parse(str) as NetworkType | ||
| 48 | - } | ||
| 49 | - Logger.info('network connected: ' + type?.toString()) | ||
| 50 | - })) | ||
| 51 | - // 注册监听网络断开 | ||
| 52 | - EmitterUtils.receiveEvent(EmitterEventId.NETWORK_DISCONNECTED, (() => { | ||
| 53 | - Logger.info('network disconnected') | ||
| 54 | - })) | ||
| 55 | - | ||
| 56 | - WDPushNotificationManager.getInstance().onWant(want) | ||
| 57 | } | 32 | } |
| 58 | 33 | ||
| 59 | // App活着情况下,点击推送通知进入 | 34 | // App活着情况下,点击推送通知进入 |
| @@ -63,7 +38,7 @@ export default class EntryAbility extends UIAbility { | @@ -63,7 +38,7 @@ export default class EntryAbility extends UIAbility { | ||
| 63 | 38 | ||
| 64 | onDestroy(): void { | 39 | onDestroy(): void { |
| 65 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); | 40 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); |
| 66 | - NetworkManager.getInstance().release() | 41 | + StartupManager.sharedInstance().appOnDestory() |
| 67 | } | 42 | } |
| 68 | 43 | ||
| 69 | onWindowStageCreate(windowStage: window.WindowStage): void { | 44 | onWindowStageCreate(windowStage: window.WindowStage): void { |
| @@ -14,6 +14,7 @@ import LaunchDataModel from '../viewModel/LaunchDataModel' | @@ -14,6 +14,7 @@ import LaunchDataModel from '../viewModel/LaunchDataModel' | ||
| 14 | import { Logger, SPHelper, UmengStats } from 'wdKit/Index'; | 14 | import { Logger, SPHelper, UmengStats } from 'wdKit/Index'; |
| 15 | import { SpConstants } from 'wdConstant/Index'; | 15 | import { SpConstants } from 'wdConstant/Index'; |
| 16 | import { TrackingModule } from 'wdTracking/Index' | 16 | import { TrackingModule } from 'wdTracking/Index' |
| 17 | +import { StartupManager } from '../../startupmanager/StartupManager' | ||
| 17 | 18 | ||
| 18 | @Entry | 19 | @Entry |
| 19 | @Component | 20 | @Component |
| @@ -45,10 +46,9 @@ struct LaunchPage { | @@ -45,10 +46,9 @@ struct LaunchPage { | ||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | onConfirm() { | 48 | onConfirm() { |
| 48 | - UmengStats.initAfterAgreeProtocol() | ||
| 49 | - TrackingModule.startup(getContext(this) as common.UIAbilityContext) | ||
| 50 | // Save privacy agreement status. | 49 | // Save privacy agreement status. |
| 51 | this.saveIsPrivacy(); | 50 | this.saveIsPrivacy(); |
| 51 | + StartupManager.sharedInstance().appAgreedProtocol() | ||
| 52 | //跳转引导页 | 52 | //跳转引导页 |
| 53 | this.jumpToGuidePage(); | 53 | this.jumpToGuidePage(); |
| 54 | //同意隐私协议后请求启动页相关数据 | 54 | //同意隐私协议后请求启动页相关数据 |
| @@ -98,8 +98,7 @@ struct LaunchPage { | @@ -98,8 +98,7 @@ struct LaunchPage { | ||
| 98 | // } | 98 | // } |
| 99 | } else { | 99 | } else { |
| 100 | 100 | ||
| 101 | - UmengStats.initAfterAgreeProtocol() | ||
| 102 | - TrackingModule.startup(getContext(this) as common.UIAbilityContext) | 101 | + StartupManager.sharedInstance().appAgreedProtocol() |
| 103 | 102 | ||
| 104 | //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页 | 103 | //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页 |
| 105 | //获取本地存储的启动页数据 | 104 | //获取本地存储的启动页数据 |
| 1 | +import { AbilityConstant, common, Want } from '@kit.AbilityKit' | ||
| 2 | +import { WDPushNotificationManager } from 'wdHwAbility/Index' | ||
| 3 | +import { DeviceUtil, | ||
| 4 | + EmitterEventId, | ||
| 5 | + EmitterUtils, | ||
| 6 | + Logger, | ||
| 7 | + MpaasUtils, NetworkManager, | ||
| 8 | + NetworkType, | ||
| 9 | + SPHelper, | ||
| 10 | + StringUtils, | ||
| 11 | + TingyunAPM, | ||
| 12 | + UmengStats } from 'wdKit/Index' | ||
| 13 | +import { LoginModule } from 'wdLogin/Index' | ||
| 14 | +import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index' | ||
| 15 | +import { registerRouter } from 'wdRouter/Index' | ||
| 16 | +import { TrackingModule } from 'wdTracking/Index' | ||
| 17 | +import { JSON } from '@kit.ArkTS' | ||
| 18 | + | ||
| 19 | +const TAG = "[StartupManager]" | ||
| 20 | + | ||
| 21 | +/// 启动任务管理类 | ||
| 22 | +export class StartupManager { | ||
| 23 | + | ||
| 24 | + private context?: common.UIAbilityContext | ||
| 25 | + | ||
| 26 | + private static _manger?: StartupManager | ||
| 27 | + static sharedInstance(): StartupManager { | ||
| 28 | + if (!StartupManager._manger) { | ||
| 29 | + StartupManager._manger = new StartupManager() | ||
| 30 | + } | ||
| 31 | + return StartupManager._manger | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + // App启动 | ||
| 35 | + appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) { | ||
| 36 | + Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`) | ||
| 37 | + this.context = context | ||
| 38 | + | ||
| 39 | + // KV存储 | ||
| 40 | + SPHelper.init(context); | ||
| 41 | + | ||
| 42 | + // 路由注册 | ||
| 43 | + registerRouter(); | ||
| 44 | + | ||
| 45 | + // 网络模块 | ||
| 46 | + NetworkManager.getInstance().init() | ||
| 47 | + | ||
| 48 | + // App环境 | ||
| 49 | + const spHostUrl = SPHelper.default.getSync('hostUrl', '') as string | ||
| 50 | + if (StringUtils.isNotEmpty(spHostUrl)) { | ||
| 51 | + HostManager.changeHost(spHostUrl as HostEnum) | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + // 友盟预初始化 | ||
| 55 | + this.preInitUmentStat() | ||
| 56 | + | ||
| 57 | + // 通知栏点击后启动 | ||
| 58 | + WDPushNotificationManager.getInstance().onWant(want) | ||
| 59 | + Logger.debug(TAG, "App onCreate: finised") | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + appOnDestory() { | ||
| 63 | + Logger.debug(TAG, "App onDestory") | ||
| 64 | + NetworkManager.getInstance().release() | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + // 同意隐私协议之后,立即执行必要初始化 | ||
| 68 | + appAgreedProtocol() { | ||
| 69 | + Logger.debug(TAG, "App 已同意隐私等协议,开始必要初始化") | ||
| 70 | + this.initCheckDeviceId() | ||
| 71 | + | ||
| 72 | + this.initMpaas() | ||
| 73 | + this.initSensorData() | ||
| 74 | + | ||
| 75 | + this.initTingyun() | ||
| 76 | + | ||
| 77 | + this.initNetwork() | ||
| 78 | + | ||
| 79 | + this.initGeTuiPush() | ||
| 80 | + | ||
| 81 | + this.initUmengStat() | ||
| 82 | + | ||
| 83 | + this.initLocation() | ||
| 84 | + | ||
| 85 | + this.initAuthLogin() | ||
| 86 | + Logger.debug(TAG, "App 必要初始化完成") | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + // 到达主页后,初始化非必须部分 | ||
| 90 | + appReachMainPage() : Promise<void> { | ||
| 91 | + return new Promise((resolve) => { | ||
| 92 | + Logger.debug(TAG, "App 进入首页,开始其他任务初始化") | ||
| 93 | + //TODO: | ||
| 94 | + | ||
| 95 | + resolve() | ||
| 96 | + }) | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + // mPaaS 初始化,检测升级用 | ||
| 100 | + private initMpaas() { | ||
| 101 | + Logger.debug(TAG, "App mPaaS初始化") | ||
| 102 | + MpaasUtils.initApp(this.context!) | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + private initTingyun() { | ||
| 106 | + // 暂时不能用,不初始化 | ||
| 107 | + // Logger.debug(TAG, "App tingyunAPM 初始化") | ||
| 108 | + // TingyunAPM.initApp(this.context!, DeviceUtil.clientId()) | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + private initSensorData() { | ||
| 112 | + Logger.debug(TAG, "App 神策埋点 初始化") | ||
| 113 | + TrackingModule.startup(this.context!) | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + private preInitUmentStat() { | ||
| 117 | + UmengStats.preInit(this.context!) | ||
| 118 | + } | ||
| 119 | + private initUmengStat() { | ||
| 120 | + Logger.debug(TAG, "App 友盟统计 初始化") | ||
| 121 | + UmengStats.initAfterAgreeProtocol() | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + private initGeTuiPush() { | ||
| 125 | + // Logger.debug(TAG, "App 初始化") | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + private initLocation() { | ||
| 129 | + // Logger.debug(TAG, "App 初始化") | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + private initNetwork() { | ||
| 133 | + Logger.debug(TAG, "App 网络 初始化") | ||
| 134 | + WDHttp.initHttpHeader() | ||
| 135 | + // 注册监听网络连接 | ||
| 136 | + EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => { | ||
| 137 | + let type: NetworkType | null = null | ||
| 138 | + if (str) { | ||
| 139 | + type = JSON.parse(str) as NetworkType | ||
| 140 | + } | ||
| 141 | + Logger.info('network connected: ' + type?.toString()) | ||
| 142 | + })) | ||
| 143 | + // 注册监听网络断开 | ||
| 144 | + EmitterUtils.receiveEvent(EmitterEventId.NETWORK_DISCONNECTED, (() => { | ||
| 145 | + Logger.info('network disconnected') | ||
| 146 | + })) | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + private initCheckDeviceId() { | ||
| 150 | + DeviceUtil.clientId() | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + private initAuthLogin() { | ||
| 154 | + Logger.debug(TAG, "App 登录模块 初始化") | ||
| 155 | + LoginModule.startup() | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + private initThirdPlatformSDK() { | ||
| 159 | + | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + private initOthers() { | ||
| 163 | + | ||
| 164 | + } | ||
| 165 | +} |
-
Please register or login to post a comment