update scheme open alipay

This commit is contained in:
DevWiki 2024-09-11 15:09:21 +08:00
parent 7bd741a8a0
commit ed6cbec7c9
2 changed files with 14 additions and 12 deletions

View File

@ -24,8 +24,9 @@ struct MapPage {
.width(60) .width(60)
.backgroundColor(Color.Red) .backgroundColor(Color.Red)
.onClick(() => { .onClick(() => {
if (this.isLocationPermission) { this.locationHelper.getLocationAddress( 31.12, 121.11, 1, (error: BusinessError, data: geoLocationManager.GeoAddress[]) => {
}
})
}) })
SymbolGlyph($r('sys.symbol.xmark')).width(24).height(24).borderRadius(12).onClick(() => { SymbolGlyph($r('sys.symbol.xmark')).width(24).height(24).borderRadius(12).onClick(() => {
@ -45,16 +46,13 @@ struct MapPage {
build() { build() {
Column(){ Column(){
if (this.isShowLocationPopup) { this.locationViewBuilder();
this.locationViewBuilder();
}
Text(this.locText); Text(this.locText);
}.width('100%').height('100%') }.width('100%').height('100%')
} }
aboutToAppear(): void { aboutToAppear(): void {
this.locationHelper.requestPermissionsFromUser((allowScope: boolean, allowPrecision: boolean) => { this.locationHelper.requestPermissionsFromUser((allowScope: boolean, allowPrecision: boolean) => {
}) })
} }
} }

View File

@ -13,18 +13,22 @@ struct SchemePage {
} }
}) })
Button("Open").width(120).height(36).onClick(() => { Button("OpenApp").width(120).height(36).onClick(() => {
this.openScheme() this.openScheme('alipays://platformapi/startapp?appId=20000001')
}).margin({ top: 48 })
Button("OpenStore").width(120).height(36).onClick(() => {
this.openScheme('store://appgallery.huawei.com/app/detail?id=com.alipay.mobile.client')
}).margin({ top: 48 }) }).margin({ top: 48 })
} }
} }
openScheme() { openScheme(uri: string) {
let context = getContext(this) as common.UIAbilityContext; let context = getContext(this) as common.UIAbilityContext;
let wantInfo: Want = { let wantInfo: Want = {
action: 'ohos.want.action.viewData', // action: 'ohos.want.action.viewData',
entities: ['entity.system.browsable'], // entities: ['entity.system.browsable'],
uri: 'https://devwiki.net' uri: uri
} }
context.startAbility(wantInfo); context.startAbility(wantInfo);
} }