#放码来战.端云一体化开发#HarmonyOS 5 【农民叔叔】26.【端侧工程】关于我们拉起浏览器打开备案官网

APP必须工信部备案,且在页面明示备案号,点击可打开工信备案官方网站。

1.新建AboutUsPage.ets文件,build()布局如下:

build() {
    Navigation(){
      Column(){
        Image($r('app.media.icon'))
          .width(216)
          .height(216)
          .margin({ top: 8, bottom: 16 });
        Text('农民叔叔')
          .fontSize(24)
          .fontColor($r('sys.color.ohos_id_color_text_primary'))
          .fontWeight(FontWeight.Medium);
        Text('病虫害诊断专家')
          .fontSize(16)
          .fontColor($r('sys.color.ohos_id_color_text_secondary'))
          .margin({ top: 8 })
        Text('V1.0.0.123')
          .fontSize(12)
          .fontColor($r('sys.color.ohos_id_color_text_secondary'))
          .margin({ top: 12, bottom: 12 })
        Blank()
          .layoutWeight(1)
        // 备案号
        Text('粤ICP备2023123032号-4A')
          .fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
          .fontFamily($r('sys.string.ohos_id_text_font_family_regular'))
          .fontSize($r('sys.float.ohos_id_text_size_body3'))
          .fontWeight(FontWeight.Regular)
          .opacity(0.6)
          .margin({ bottom: 12 })
          .onClick(() => {
            // 浏览器打开工信部备案官网
            const context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
            this.openBrowseUrl(context, 'https://beian.miit.gov.cn/#/home');
          })
      }
      .height('100%')
      .width('100%')
      .justifyContent(FlexAlign.Start)
      .backgroundColor($r('sys.color.ohos_id_color_sub_background'))
      .padding({top:12,bottom:12})
    }
    .hideBackButton(false)
    .title('关于')
    .titleMode(NavigationTitleMode.Mini)

  }

2.拉起手机浏览器,跳转到指定链接的页面

/**
   * 打开浏览器
   * @param context
   * @param url
   */
  openBrowseUrl(context: common.UIAbilityContext, url: string):void{
    let want:Want={
      action:'ohos.want.action.viewData',
      entities:['entity.system.browsable'],
      uri:url
    };
    context.startAbility(want)
      .then(()=>{
        // 打开成功
      })
      .catch((err:BusinessError)=>{
        // 打开失败
      })
  }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鸿花粉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值