123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- /**
- * 错误码
- */
- export type OpenLocationErrorCode =
- /**
- * 框架内部错误
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- 4;
- export interface OpenLocationSuccess {
- errMsg: string
- }
- type OpenLocationSuccessCallback = (result : OpenLocationSuccess) => void
- export interface OpenLocationFail extends IUniError {
- errCode : OpenLocationErrorCode
- }
- type OpenLocationFailCallback = (result : OpenLocationFail) => void
- export type OpenLocationComplete = any
- type OpenLocationCompleteCallback = (result : OpenLocationComplete) => void
- /**
- * uni.openLocation函数参数定义
- */
- export type OpenLocationOptions = {
- /**
- * 纬度,范围为-90~90,负数表示南纬,使用 gcj02 国测局坐标系
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- latitude : number,
- /**
- * 经度,范围为-180~180,负数表示西经,使用 gcj02 国测局坐标系
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- longitude : number,
- /**
- * 缩放比例,范围5~18,默认为18(微信小程序)
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- scale ?: number | null,
- /**
- * 位置名
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- name ?: string | null,
- /**
- * 地址的详细说明
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- address ?: string | null,
- /**
- * 接口调用成功的回调函数
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- success ?: OpenLocationSuccessCallback | null,
- /**
- * 接口调用失败的回调函数
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- fail ?: OpenLocationFailCallback | null,
- /**
- * 接口调用结束的回调函数(调用成功、失败都会执行)
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- complete ?: OpenLocationCompleteCallback | null
- };
- /**
- * 使用应用内置地图查看位置
- *
- * @param {OpenLocationOptions} options
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/prompt.html#openLocation
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- export type OpenLocation = (options : OpenLocationOptions) => void;
- export interface Uni {
- /**
- * @description 使用应用内置地图查看位置
- * @example
- * ```typescript
- uni.openLocation({
- latitude: 39.908823,
- longitude: 116.39747,
- success: (res) => {
- console.log('res: ', res)
- },
- fail: (err) => {
- console.log('err: ', err)
- },
- complete: (res) => {
- console.log('complete: ', res)
- }
- });
- * ```
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/prompt.html#openLocation
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "4.41"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "4.61"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
- * "mp": {
- * "weixin": {
- * "uniVer": "√",
- * "unixVer": "4.41"
- * }
- * }
- * }
- */
- openLocation(options : OpenLocationOptions) : void;
- }
- export class OpenLocationSuccessImpl implements OpenLocationSuccess {
- errMsg : string
- constructor(errMsg : string = 'chooseLocation:ok') {
- this.errMsg = errMsg
- }
- }
|