张善主

Merge remote-tracking branch 'origin/main'

Showing 22 changed files with 324 additions and 17 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");
@@ -12,6 +12,7 @@ import { LiveRoomDataBean } from '../live/LiveRoomDataBean'; @@ -12,6 +12,7 @@ import { LiveRoomDataBean } from '../live/LiveRoomDataBean';
12 @Observed 12 @Observed
13 export class ContentDTO implements BaseDTO { 13 export class ContentDTO implements BaseDTO {
14 seoTags: string = ''; 14 seoTags: string = '';
  15 + cornerMark:string = '';
15 liveType?: string; // 直播新闻-直播状态 16 liveType?: string; // 直播新闻-直播状态
16 expIds: string = ''; 17 expIds: string = '';
17 itemId: string = ''; 18 itemId: string = '';
@@ -158,6 +159,7 @@ export class ContentDTO implements BaseDTO { @@ -158,6 +159,7 @@ export class ContentDTO implements BaseDTO {
158 content.rmhInfo = old.rmhInfo; 159 content.rmhInfo = old.rmhInfo;
159 content.photoNum = old.photoNum; 160 content.photoNum = old.photoNum;
160 content.corner = old.corner; 161 content.corner = old.corner;
  162 + content.cornerMark = old.cornerMark;
161 content.rmhPlatform = old.rmhPlatform; 163 content.rmhPlatform = old.rmhPlatform;
162 content.newTags = old.newTags; 164 content.newTags = old.newTags;
163 content.titleShow = old.titleShow; 165 content.titleShow = old.titleShow;
@@ -54,6 +54,12 @@ export struct CardSourceInfo { @@ -54,6 +54,12 @@ export struct CardSourceInfo {
54 .fontColor($r("app.color.color_ED2800")) 54 .fontColor($r("app.color.color_ED2800"))
55 .margin({ right: 2 }) 55 .margin({ right: 2 })
56 } 56 }
  57 + if(this.contentDTO.cornerMark){
  58 + Text(this.contentDTO.cornerMark)
  59 + .fontSize($r("app.float.font_size_11"))
  60 + .fontColor($r("app.color.color_ED2800"))
  61 + .margin({ right: 2 })
  62 + }
57 if (this.contentDTO.rmhPlatform === 1) { 63 if (this.contentDTO.rmhPlatform === 1) {
58 Text(this.contentDTO.rmhInfo?.rmhName) 64 Text(this.contentDTO.rmhInfo?.rmhName)
59 .fontSize($r("app.float.font_size_11")) 65 .fontSize($r("app.float.font_size_11"))
@@ -91,7 +97,14 @@ export struct CardSourceInfo { @@ -91,7 +97,14 @@ export struct CardSourceInfo {
91 // .fontColor($r("app.color.color_B0B0B0")) 97 // .fontColor($r("app.color.color_B0B0B0"))
92 // .flexShrink(0); 98 // .flexShrink(0);
93 // } 99 // }
94 - if (this.contentDTO.source && this.showTime()) { 100 + // if (this.contentDTO.source && this.showTime()) {
  101 + // Text(this.handleTimeStr())
  102 + // .fontSize($r("app.float.font_size_11"))
  103 + // .fontColor($r("app.color.color_B0B0B0"))
  104 + // .flexShrink(0)
  105 + // .margin({right: 4})
  106 + // }
  107 + if (this.showTime()) {
95 Text(this.handleTimeStr()) 108 Text(this.handleTimeStr())
96 .fontSize($r("app.float.font_size_11")) 109 .fontSize($r("app.float.font_size_11"))
97 .fontColor($r("app.color.color_B0B0B0")) 110 .fontColor($r("app.color.color_B0B0B0"))
@@ -460,10 +460,11 @@ export struct SearchResultContentComponent { @@ -460,10 +460,11 @@ export struct SearchResultContentComponent {
460 console.log('获取value2',JSON.stringify(value)) 460 console.log('获取value2',JSON.stringify(value))
461 let liveType = value.data?.liveType; 461 let liveType = value.data?.liveType;
462 let seoTags = value.data?.seoTags 462 let seoTags = value.data?.seoTags
  463 + let cornerMark = value.data?.cornerMark
463 let contentDTO = new ContentDTO(); 464 let contentDTO = new ContentDTO();
464 contentDTO.liveType = liveType?liveType: "" 465 contentDTO.liveType = liveType?liveType: ""
465 contentDTO.seoTags = seoTags?seoTags: "" 466 contentDTO.seoTags = seoTags?seoTags: ""
466 - // console.log('获取value333333333',JSON.stringify(contentDTO.liveType)) 467 + contentDTO.cornerMark = cornerMark?cornerMark: ""
467 contentDTO.appStyle = value.data.appStyle + "" 468 contentDTO.appStyle = value.data.appStyle + ""
468 contentDTO.cityCode = value.data.cityCode 469 contentDTO.cityCode = value.data.cityCode
469 contentDTO.coverSize = "" 470 contentDTO.coverSize = ""
@@ -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() 76 this.checkVerifyCode()
81 - }  
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 }
@@ -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 }