yumaochao
Showing 22 changed files with 342 additions and 20 deletions
@@ -68,6 +68,7 @@ export class WDRouterPage { @@ -68,6 +68,7 @@ export class WDRouterPage {
68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); 68 static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
69 static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage"); 69 static oneKeyLoginPage = new WDRouterPage("wdLogin", "ets/pages/login/OneKeyLoginPage");
70 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); 70 static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage");
  71 + static changeBindPhonePage = new WDRouterPage("wdLogin", "ets/pages/login/ChangeBindPhonePage");
71 static modifyPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ModifyPasswordPage"); 72 static modifyPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ModifyPasswordPage");
72 //我的 预约 73 //我的 预约
73 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); 74 static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage");
1 import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; 1 import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
2 import { AppUtils, 2 import { AppUtils,
  3 + DateTimeUtils,
3 DeviceUtil, 4 DeviceUtil,
4 FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; 5 FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index';
5 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 6 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
@@ -9,7 +10,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; @@ -9,7 +10,7 @@ import { BusinessError } from '@kit.BasicServicesKit';
9 import { router } from '@kit.ArkUI'; 10 import { router } from '@kit.ArkUI';
10 import { CommonConstants } from 'wdConstant/Index'; 11 import { CommonConstants } from 'wdConstant/Index';
11 import { ProcessUtils } from 'wdRouter/Index'; 12 import { ProcessUtils } from 'wdRouter/Index';
12 -import { HashMap } from '@kit.ArkTS'; 13 +import { TrackingPageBrowse } from 'wdTracking/Index';
13 14
14 const TAG = 'FeedBackActivity' 15 const TAG = 'FeedBackActivity'
15 16
@@ -20,6 +21,9 @@ const TAG = 'FeedBackActivity' @@ -20,6 +21,9 @@ const TAG = 'FeedBackActivity'
20 @Entry 21 @Entry
21 @Component 22 @Component
22 export struct FeedBackActivity { 23 export struct FeedBackActivity {
  24 + pageShowTime:number = 0;
  25 + pageId:string = 'feedbackPage';
  26 + pageName:string=this.pageId;
23 @State canSubmit: boolean = false; 27 @State canSubmit: boolean = false;
24 @State textNumLabel: string = '0/500'; 28 @State textNumLabel: string = '0/500';
25 contact: string = ""; 29 contact: string = "";
@@ -380,4 +384,12 @@ export struct FeedBackActivity { @@ -380,4 +384,12 @@ export struct FeedBackActivity {
380 } 384 }
381 } 385 }
382 386
  387 + onPageShow() {
  388 + this.pageShowTime = DateTimeUtils.getTimeStamp()
  389 + }
  390 + onPageHide() {
  391 + //页面浏览
  392 + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
  393 +
  394 + }
383 } 395 }
@@ -175,9 +175,7 @@ export struct AccountAndSecurityLayout { @@ -175,9 +175,7 @@ export struct AccountAndSecurityLayout {
175 .onClick(() => { 175 .onClick(() => {
176 console.log(index + "") 176 console.log(index + "")
177 if (index == 0){ 177 if (index == 0){
178 - trackButtonClick("accountManagementPageChangePhoneNumber")  
179 - let pageType = {'pageType': 2} as Record<string, number>;  
180 - WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) 178 + WDRouterRule.jumpWithPage(WDRouterPage.changeBindPhonePage)
181 }else if (index == 1) { 179 }else if (index == 1) {
182 trackButtonClick("accountManagementPageAccountManagementPassword") 180 trackButtonClick("accountManagementPageAccountManagementPassword")
183 if (this.ifSetPassword) { 181 if (this.ifSetPassword) {
  1 +import { SpConstants } from 'wdConstant/Index'
  2 +import { CustomToast, Logger, NetworkUtil, ToastUtils, SPHelper, EmitterEventId,
  3 + DateTimeUtils } from 'wdKit/Index'
  4 +import { LoginViewModel } from './LoginViewModel'
  5 +import { router } from '@kit.ArkUI'
  6 +import { emitter } from '@kit.BasicServicesKit'
  7 +import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'
  8 +
  9 +const TAG = 'ChangeBindPhonePage'
  10 +/*更换手机号页面*/
  11 +@Entry
  12 +@Component
  13 +struct ChangeBindPhonePage {
  14 + @State phoneContent: string = ''
  15 + @State codeContent: string = ''
  16 + @State isSubmit: boolean = false //是否可以提交 默认不可以
  17 + loginViewModel: LoginViewModel = new LoginViewModel()
  18 + @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件
  19 + @State pageTitle:string = '更换手机号';
  20 + @State @Watch('startCount') codeStateSuccess:boolean=false
  21 + @State codeBtnState: boolean = false
  22 + @State timeCount: number = 60
  23 + isFirst:boolean=true//是否第一次获取验证码
  24 + lastTime: number = 0
  25 + pageShowTime:number = 0;
  26 + pageHideTime:number = 0;
  27 +
  28 +
  29 + onPageShow() {
  30 + this.pageShowTime = DateTimeUtils.getTimeStamp()
  31 + }
  32 +
  33 + onPageHide(): void {
  34 + this.pageHideTime = DateTimeUtils.getTimeStamp()
  35 + let duration = 0
  36 + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
  37 + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Change_PhoneNum,TrackConstants.PageName.Change_PhoneNum,duration)
  38 + }
  39 +
  40 + onCodeSend() {
  41 + if (this.isCodeSend) {
  42 + TrackingButton.click("changePhoneNumberPageSendVerificationCode",TrackConstants.PageName.Change_PhoneNum,TrackConstants.PageName.Change_PhoneNum)
  43 + this.sendVerifyCode()
  44 + }
  45 + }
  46 +
  47 + @State toastText:string = ""
  48 + dialogToast: CustomDialogController = new CustomDialogController({
  49 + builder: CustomToast({
  50 + msg: this.toastText,
  51 + }),
  52 + autoCancel: false,
  53 + alignment: DialogAlignment.Center,
  54 + customStyle: true,
  55 + maskColor:"#00000000"
  56 + })
  57 +
  58 +
  59 +
  60 + build() {
  61 + Column() {
  62 + Image($r('app.media.login_back_icon')).width(24).height(24).margin({ left: 15, top: 10 }).onClick(() => {
  63 + router.back()
  64 + })
  65 +
  66 + Text(this.pageTitle).fontSize(22).fontColor('#333333').fontWeight(FontWeight.Bold).margin({ left: 25, top: 112 })
  67 +
  68 + Column(){
  69 + TextInput({text: this.phoneContent, placeholder: "请输入手机号" })
  70 + .fontSize(16)
  71 + .height(48)
  72 + .placeholderColor("#CCCCCC")
  73 + .maxLength(11)
  74 + .margin({ top: 36 })
  75 + .backgroundColor("#F5F5F5")
  76 + .borderRadius(4)
  77 + .type(InputType.Number)
  78 + .onChange((content) => {
  79 + this.phoneContent = content
  80 + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
  81 +
  82 + if (content.length >= 11 ) {
  83 + this.codeBtnState = true
  84 + } else {
  85 + this.codeBtnState = false
  86 + }
  87 + })
  88 +
  89 +
  90 + Row() {
  91 + TextInput({ text: this.codeContent,placeholder: "验证码" })
  92 + .placeholderColor("#CCCCCC")
  93 + .layoutWeight(1)
  94 + .fontSize(16)
  95 + .height(48)
  96 + .type(InputType.Number)
  97 + .fontColor("#222222")
  98 + .backgroundColor("#00000000")
  99 + .borderRadius({ topLeft: 4, bottomLeft: 4 })
  100 + .onChange((value) => {
  101 + this.codeContent = value
  102 + this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
  103 + })
  104 +
  105 + Text(this.codeStateSuccess ? this.timeCount + "s" : this.isFirst?"发送验证码":'重新获取')
  106 + .fontColor(this.codeBtnState?'#ED2800':'#80ED2800')
  107 + .width(110)
  108 + .fontSize(14)
  109 + .fontWeight( FontWeight.Bold)
  110 + .height(48)
  111 + .textAlign(TextAlign.Center)
  112 + .enabled(this.codeStateSuccess?false:true)
  113 + .onClick(() => {
  114 + if (this.phoneContent.length < 11) {
  115 + return
  116 + }
  117 +
  118 + let currentTime = DateTimeUtils.getTimeStamp()
  119 + if (currentTime - this.lastTime < 500) {
  120 + return
  121 + }
  122 + this.lastTime = currentTime;
  123 + this.isCodeSend = true
  124 +
  125 + })
  126 +
  127 +
  128 + }.margin({ top: 12 })
  129 + .height(48)
  130 + .alignItems(VerticalAlign.Center)
  131 + .justifyContent(FlexAlign.Start)
  132 + .backgroundImage($r('app.media.code_login_bg'))
  133 + .backgroundImageSize({width:'100%',height:48})
  134 + }.width('100%')
  135 + .padding({ left: 25, right: 25 })
  136 +
  137 +
  138 + Row() {
  139 + Text("确认")
  140 + .layoutWeight(1)
  141 + .fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF")
  142 + .borderRadius(4)
  143 + .fontSize(18)
  144 + .textAlign(TextAlign.Center)
  145 + .fontWeight(FontWeight.Medium)
  146 + .margin({ top: 26 })
  147 + .height(44)
  148 + .backgroundColor(this.isSubmit ?"#ED2800":"#99ED2800")
  149 + .enabled(this.isSubmit ? true : false)
  150 + .onClick(() => {
  151 + TrackingButton.click("changePhoneNumberPageConfirm",TrackConstants.PageName.Change_PhoneNum,TrackConstants.PageName.Change_PhoneNum)
  152 + this.changeBindPhone()
  153 + })
  154 + }.width('100%')
  155 + .padding({ left: 25, right: 25 })
  156 +
  157 + }.width('100%').height('100%').alignItems(HorizontalAlign.Start)
  158 + }
  159 +
  160 + //发送验证码
  161 + sendVerifyCode() {
  162 + if (this.isEmpty(this.phoneContent)) {
  163 + return
  164 + }
  165 +
  166 + this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
  167 + this.showToastTip("已发送")
  168 + this.codeStateSuccess=true
  169 + this.isCodeSend=false
  170 + Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
  171 + }).catch((message: string)=>{
  172 + let netStatus = NetworkUtil.isNetConnected()
  173 + if (netStatus) {
  174 + this.showToastTip(message)
  175 + } else {
  176 + this.showToastTip("验证码获取失败,请重新尝试")
  177 + }
  178 + this.codeStateSuccess=false
  179 + this.isCodeSend=false
  180 + })
  181 + }
  182 +
  183 + isEmpty(obj: undefined|null|string): boolean {
  184 + return (obj == undefined || obj == null || obj == '');
  185 + }
  186 +
  187 + changeBindPhone(){
  188 + if (!this.isSubmit) {
  189 + return
  190 + }
  191 + if (this.isEmpty(this.phoneContent)) {
  192 + return
  193 + }
  194 + if (this.isEmpty(this.codeContent)) {
  195 + return
  196 + }
  197 + this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{
  198 + ToastUtils.shortToast('绑定成功')
  199 + this.querySecurity()
  200 + }).catch((message: string) => {
  201 + if (message != '') {
  202 + ToastUtils.shortToast(message)
  203 + }
  204 + })
  205 + }
  206 +
  207 + querySecurity(){
  208 + this.loginViewModel.querySecurity().then(()=>{
  209 + SPHelper.default.save(SpConstants.USER_PHONE,this.phoneContent)
  210 + this.sendEmitEvent()
  211 + router.back()
  212 + }).catch(()=>{
  213 +
  214 + })
  215 + }
  216 +
  217 + sendEmitEvent(){
  218 + // 定义一个eventId为1的事件,事件优先级为Low
  219 + let event: emitter.InnerEvent = {
  220 + eventId: EmitterEventId.PHONE_CHANGE_SUCCESS,
  221 + priority: emitter.EventPriority.LOW
  222 + };
  223 +
  224 + let eventData: emitter.EventData = {
  225 + data: {
  226 + content: this.phoneContent,
  227 + }
  228 + };
  229 +
  230 + // 发送eventId为1的事件,事件内容为eventData
  231 + emitter.emit(event, eventData);
  232 + }
  233 +
  234 + showToastTip(msg:string){
  235 + this.toastText = msg
  236 + this.dialogToast.open()
  237 + }
  238 +
  239 + startCount() {
  240 + this.isFirst = false
  241 + let time = setInterval(() => {
  242 + Logger.debug("倒计时:" + this.timeCount)
  243 + this.timeCount--
  244 + if (this.timeCount < 1) {
  245 + this.codeStateSuccess = false
  246 + this.timeCount = 60
  247 + clearInterval(time)
  248 + }
  249 + }, 1000)
  250 + }
  251 +}
@@ -22,7 +22,7 @@ struct ForgetPasswordPage { @@ -22,7 +22,7 @@ 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、设置->重置密码 2、设置->更换手机号页面1 3、设置->更换手机号页面2 25 + pageType:number = (router.getParams() as Record<string, number>)['pageType']; //0、登录->忘记密码 1、设置->重置密码 3、设置->更换手机号页面2(不知道是啥)
26 phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号 26 phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号
27 @State pageTitle:string = '找回密码'; 27 @State pageTitle:string = '找回密码';
28 @State codeStateSuccess:boolean=false 28 @State codeStateSuccess:boolean=false
@@ -51,7 +51,6 @@ struct ForgetPasswordPage { @@ -51,7 +51,6 @@ struct ForgetPasswordPage {
51 router.back() 51 router.back()
52 }) 52 })
53 53
54 -  
55 Text(this.pageTitle).fontSize(22).fontColor('#333333').fontWeight(FontWeight.Bold).margin({ left: 25, top: 112 }) 54 Text(this.pageTitle).fontSize(22).fontColor('#333333').fontWeight(FontWeight.Bold).margin({ left: 25, top: 112 })
56 LoginInputComponent({ 55 LoginInputComponent({
57 phoneContent: $phoneContent, 56 phoneContent: $phoneContent,
@@ -74,11 +73,7 @@ struct ForgetPasswordPage { @@ -74,11 +73,7 @@ struct ForgetPasswordPage {
74 .backgroundColor(this.isSubmit ?"#ED2800":"#99ED2800") 73 .backgroundColor(this.isSubmit ?"#ED2800":"#99ED2800")
75 .enabled(this.isSubmit ? true : false) 74 .enabled(this.isSubmit ? true : false)
76 .onClick(() => { 75 .onClick(() => {
77 - if(this.pageType==2){  
78 - this.changeBindPhone()  
79 - }else {  
80 - this.checkVerifyCode()  
81 - } 76 + this.checkVerifyCode()
82 }) 77 })
83 }.padding({ left: 25, right: 25 }).width('100%') 78 }.padding({ left: 25, right: 25 }).width('100%')
84 79
@@ -98,8 +93,6 @@ struct ForgetPasswordPage { @@ -98,8 +93,6 @@ struct ForgetPasswordPage {
98 } 93 }
99 }else if (this.pageType == 1){ 94 }else if (this.pageType == 1){
100 this.pageTitle = '验证当前手机号' 95 this.pageTitle = '验证当前手机号'
101 - }else if (this.pageType == 2){  
102 - this.pageTitle = '更换手机号'  
103 } 96 }
104 if (this.isCodeSend) { 97 if (this.isCodeSend) {
105 this.sendVerifyCode() 98 this.sendVerifyCode()
@@ -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、登录->忘记密码 1、设置->重置密码 2、设置->更换手机号页面1 3、设置->更换手机号页面2 13 + pageType?:number; //0、登录->忘记密码 1、设置->重置密码 3、设置->更换手机号页面2
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 //协议勾选状态
@@ -4,7 +4,7 @@ import { LoginModel } from './LoginModel'; @@ -4,7 +4,7 @@ import { LoginModel } from './LoginModel';
4 import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem'; 4 import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem';
5 import { router } from '@kit.ArkUI'; 5 import { router } from '@kit.ArkUI';
6 import { encryptMessage } from '../../utils/cryptoUtil'; 6 import { encryptMessage } from '../../utils/cryptoUtil';
7 -import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; 7 +import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index';
8 8
9 /** 9 /**
10 * 修改密码页面 10 * 修改密码页面
@@ -153,6 +153,7 @@ struct ModifyPasswordPage { @@ -153,6 +153,7 @@ struct ModifyPasswordPage {
153 .borderRadius('4vp') 153 .borderRadius('4vp')
154 .onClick(() => { 154 .onClick(() => {
155 if(this.btnStatus){ 155 if(this.btnStatus){
  156 + TrackingButton.click("changePasswordPageConfirm",TrackConstants.PageName.Change_Passwd,TrackConstants.PageName.Change_Passwd)
156 this.submit() 157 this.submit()
157 } 158 }
158 }) 159 })
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "pages/login/SettingPasswordLayout", 8 "pages/login/SettingPasswordLayout",
9 "pages/guide/GuidePages", 9 "pages/guide/GuidePages",
10 "pages/login/OneKeyLoginPage", 10 "pages/login/OneKeyLoginPage",
11 - "pages/login/ModifyPasswordPage" 11 + "pages/login/ModifyPasswordPage",
  12 + "pages/login/ChangeBindPhonePage"
12 ] 13 ]
13 } 14 }
1 import { ENewspaperPageComponent } from 'wdComponent'; 1 import { ENewspaperPageComponent } from 'wdComponent';
2 -import { 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 6
6 const TAG = 'ENewspaper'; 7 const TAG = 'ENewspaper';
7 8
8 @Entry 9 @Entry
9 @Component 10 @Component
10 struct ENewspaper { 11 struct ENewspaper {
  12 + pageShowTime:number = 0;
  13 + pageId:string = 'newsPaperPage';
  14 + pageName:string=this.pageId;
11 // 获取UIAbility上下文 15 // 获取UIAbility上下文
12 context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext 16 context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext
13 17
@@ -46,6 +50,7 @@ struct ENewspaper { @@ -46,6 +50,7 @@ struct ENewspaper {
46 } 50 }
47 51
48 onPageShow() { 52 onPageShow() {
  53 + this.pageShowTime = DateTimeUtils.getTimeStamp()
49 this.setSystemBar('#80000000','#80000000', '#FFFFFFFF') 54 this.setSystemBar('#80000000','#80000000', '#FFFFFFFF')
50 Logger.info(TAG, 'onPageShow'); 55 Logger.info(TAG, 'onPageShow');
51 } 56 }
@@ -53,6 +58,8 @@ struct ENewspaper { @@ -53,6 +58,8 @@ struct ENewspaper {
53 onPageHide() { 58 onPageHide() {
54 this.setSystemBar('#FFFFFFFF','#00000000', '#000000') 59 this.setSystemBar('#FFFFFFFF','#00000000', '#000000')
55 Logger.info(TAG, 'onPageHide'); 60 Logger.info(TAG, 'onPageHide');
  61 + //页面浏览
  62 + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
56 } 63 }
57 64
58 onBackPress() { 65 onBackPress() {
1 -import { Logger } from 'wdKit'; 1 +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';
  6 +
5 const TAG = 'DynamicDetailPage'; 7 const TAG = 'DynamicDetailPage';
6 @Entry 8 @Entry
7 @Component 9 @Component
8 struct DynamicDetailPage { 10 struct DynamicDetailPage {
9 - 11 + pageShowTime:number = 0;
  12 + pageId:string = 'dynamicDetailPage';
  13 + pageName:string=this.pageId;
10 @State relId: string = '' 14 @State relId: string = ''
11 @State contentId: string = '' 15 @State contentId: string = ''
12 @State relType: string = '' 16 @State relType: string = ''
@@ -30,4 +34,12 @@ struct DynamicDetailPage { @@ -30,4 +34,12 @@ struct DynamicDetailPage {
30 this.relType = params?.extra?.relType || ''; 34 this.relType = params?.extra?.relType || '';
31 this.contentId = params?.contentID || ''; 35 this.contentId = params?.contentID || '';
32 } 36 }
  37 + onPageShow() {
  38 + this.pageShowTime = DateTimeUtils.getTimeStamp()
  39 + }
  40 + onPageHide() {
  41 + //页面浏览
  42 + TrackingPageBrowse.trackCommonPageExposureEnd(this.pageId,this.pageName,Math.floor((DateTimeUtils.getTimeStamp() - this.pageShowTime)/1000))
  43 +
  44 + }
33 } 45 }
@@ -131,7 +131,7 @@ export struct BottomNavigationComponent { @@ -131,7 +131,7 @@ export struct BottomNavigationComponent {
131 @Builder 131 @Builder
132 tabBarBuilder(navItem: BottomNavDTO, index: number) { 132 tabBarBuilder(navItem: BottomNavDTO, index: number) {
133 Stack({ alignContent: Alignment.Bottom }) { 133 Stack({ alignContent: Alignment.Bottom }) {
134 - Image(this.currentNavIndex === index ? navItem.iconC : navItem.icon) 134 + Image(this.getBottomIcon(navItem, this.currentNavIndex === index))
135 .height(CommonConstants.FULL_PARENT) 135 .height(CommonConstants.FULL_PARENT)
136 .padding({ 136 .padding({
137 bottom: 15, 137 bottom: 15,
@@ -140,6 +140,7 @@ export struct BottomNavigationComponent { @@ -140,6 +140,7 @@ export struct BottomNavigationComponent {
140 top: 2 140 top: 2
141 }) 141 })
142 .aspectRatio(this.ASPECT_RATIO_1_1) 142 .aspectRatio(this.ASPECT_RATIO_1_1)
  143 + .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index))
143 144
144 Text(navItem.name) 145 Text(navItem.name)
145 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') }) 146 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
@@ -160,6 +161,48 @@ export struct BottomNavigationComponent { @@ -160,6 +161,48 @@ export struct BottomNavigationComponent {
160 161
161 } 162 }
162 163
  164 + private getBottomIcon(navItem: BottomNavDTO, isSelect: boolean): string | Resource {
  165 + if (!navItem) {
  166 + return ''
  167 + }
  168 + let icon: string = ''
  169 + if (this.isImmersive) {
  170 + // 获取沉浸式icon
  171 + icon = isSelect ? navItem.immersiveIconCUrl : navItem.immersiveIconUrl
  172 + } else {
  173 + // 获取常规icon
  174 + icon = isSelect ? navItem.iconC : navItem.icon
  175 + }
  176 + if (StringUtils.isEmpty(icon) || icon.includes('.pag')) {
  177 + // 兜底,获取预置的本地icon
  178 + return this.getBottomLocalIcon(navItem, isSelect)
  179 + }
  180 + return icon
  181 + }
  182 +
  183 + private getBottomLocalIcon(navItem: BottomNavDTO, isSelect: boolean): Resource {
  184 + if (!navItem) {
  185 + return isSelect ? $r('app.media.icon_tab_res1') : $r('app.media.icon_tab_res1_no')
  186 + }
  187 + // type:1普通 2我的
  188 + if (navItem.type == '2') {
  189 + // 我的
  190 + return isSelect ? $r('app.media.icon_tab_res5') : $r('app.media.icon_tab_res5_no')
  191 + } else {
  192 + // 顶部样式:中文的(11-新闻;12-人民号;13-视频;14-服务)
  193 + if (navItem.topStyle == '11') {
  194 + return isSelect ? $r('app.media.icon_tab_res1') : $r('app.media.icon_tab_res1_no')
  195 + } else if (navItem.topStyle == '12') {
  196 + return isSelect ? $r('app.media.icon_tab_res2') : $r('app.media.icon_tab_res2_no')
  197 + } else if (navItem.topStyle == '13') {
  198 + return isSelect ? $r('app.media.icon_tab_res3') : $r('app.media.icon_tab_res3_no')
  199 + } else if (navItem.topStyle == '14') {
  200 + return isSelect ? $r('app.media.icon_tab_res4') : $r('app.media.icon_tab_res4_no')
  201 + }
  202 + }
  203 + return isSelect ? $r('app.media.icon_tab_res1') : $r('app.media.icon_tab_res1_no')
  204 + }
  205 +
163 // 底导切换函数 206 // 底导切换函数
164 async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) { 207 async onBottomNavigationIndexChange(navItem: BottomNavDTO, index: number) {
165 Logger.info(TAG, `onBottomNavigationIndexChange this.currentNavIndex: ${this.currentNavIndex}`); 208 Logger.info(TAG, `onBottomNavigationIndexChange this.currentNavIndex: ${this.currentNavIndex}`);
@@ -21,6 +21,7 @@ export struct VideoChannelPage { @@ -21,6 +21,7 @@ export struct VideoChannelPage {
21 @Prop topNavList: TopNavDTO[] 21 @Prop topNavList: TopNavDTO[]
22 @Link _currentNavIndex?: number; 22 @Link _currentNavIndex?: number;
23 @Consume barBackgroundColor: Color 23 @Consume barBackgroundColor: Color
  24 + @Consume isImmersive: boolean
24 @Consume displayDirection: DisplayDirection 25 @Consume displayDirection: DisplayDirection
25 @Consume @Watch('setBarBackgroundColor') currentBottomNavInfo: BottomNavDTO // 当前底导信息 26 @Consume @Watch('setBarBackgroundColor') currentBottomNavInfo: BottomNavDTO // 当前底导信息
26 @State @Watch('setBarBackgroundColor') currentTopNavSelectedIndex: number = 0; 27 @State @Watch('setBarBackgroundColor') currentTopNavSelectedIndex: number = 0;
@@ -42,8 +43,10 @@ export struct VideoChannelPage { @@ -42,8 +43,10 @@ export struct VideoChannelPage {
42 if (this.currentTopNavSelectedIndex === 0 && this.currentBottomNavInfo?.name === '视频') { 43 if (this.currentTopNavSelectedIndex === 0 && this.currentBottomNavInfo?.name === '视频') {
43 console.error('setBarBackgroundColor', '黑色') 44 console.error('setBarBackgroundColor', '黑色')
44 this.barBackgroundColor = Color.Black 45 this.barBackgroundColor = Color.Black
  46 + this.isImmersive = true
45 } else { 47 } else {
46 this.barBackgroundColor = Color.White 48 this.barBackgroundColor = Color.White
  49 + this.isImmersive = false
47 console.error('setBarBackgroundColor', '白色') 50 console.error('setBarBackgroundColor', '白色')
48 } 51 }
49 } 52 }