/// declare namespace EJSNamespace { interface deviceType { /** * 设置屏幕方向 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----: | :----- | :--------- | :----------- | * | 支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.setOrientation({ * orientation: 1, * success: function () {}, * error: function (error) {} * }); * ``` * * @tips 微信小程序基础库版本 2.4.0 开始,支持通过 pageOrientation 字段设置屏幕旋转,具体可看官方文档: [https://developers.weixin.qq.com/miniprogram/dev/framework/view/resizable.html](https://developers.weixin.qq.com/miniprogram/dev/framework/view/resizable.html) */ setOrientation?: APIType< { /** * 必填,屏幕方向,1表示竖屏,0表示横屏,其他表示跟随系统,-1为跟随系统 */ orientation: number; }, void >; /** * 设置页面的缩放控件,仅在Android中生效 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :-----------------------------: | :----: | :----- | :--------- | :----------- | * | 支持 | 支持
(ejs-weex 环境不支持) | 不支持 | 不支持 | 不支持 | 不支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.setZoomControl({ * isShow: 1, * success: function () {}, * error: function (error) {} * }); * ``` */ setZoomControl?: APIType< { /** * 是否显示页面的缩放控件,1为显示,0为隐藏,默认为0,一般配合页面的meta标签使用,需要meta开启缩放后,才会显示控件 */ isShow?: number; }, void >; /** * 设置页面是否回弹,仅在iOS中生效 * * 注意:iOS版本16.0至16.1, 由于系统bug,该API不生效 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----: | :----- | :--------- | :----------- | * | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.setBounce({ * isEnable: 1, * success: function () {}, * error: function (error) {} * }); * ``` */ setBounce?: APIType< { /** * 默认为1代表开启,为0时会关闭回弹 */ isEnable?: number; }, void >; /** * 获取设备 ID * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----------: | :--- | :--------- | :----------- | * | 支持 | 支持 | 跨端框架支持 | 支持 | 支持 | 支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.getDeviceId({ * success: function (result) { * console.log('设备ID', result.deviceId); * }, * error: function (error) {} * }); * ``` * * @tips * ejs-Android 设备 ID 生成原理: * 在设备首次启动时,安卓系统会生成一个 64 位的数字(Android 8.0 及以上由系统根据应用签名密钥、用户、设备信息生成;Android 8.0 以下是由系统随机生成),并把这个数字以十六进制字符串的形式保存下来作为设备 ID,设备恢复出厂设置或重装手机系统或者 APK 签名密钥发生更改导致设备 ID 发生变化。 * * ejs-iOS 设备 ID 生成原理: * App 首次安装会自动生成 UUID,并保存至系统钥匙串中,系统钥匙串和 App 包名绑定,设备恢复出厂设置或重装手机系统后会发生改变。 */ getDeviceId?: APIType< {}, { /** * 对应的设备 ID。在 非 ejs 环境下,由 uni-app 框架生成并存储,清空 Storage 会导致该 id 改变 */ deviceId: string; /** * 在非 ejs 环境下,会额外返回 uniAPI 返回的参数 * * @support 非 ejs 环境支持 */ uniparams?: UniApp.GetSystemInfoResult; } >; /** * 获取设备 Mac 地址,仅 Android 中能用 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----: | :----- | :--------- | :----------- | * | 支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.getMacAddress({ * success: function (result) { * console.log('设备 Mac 地址', result.macAddress); * }, * error: function (error) {} * }); * ``` */ getMacAddress?: APIType< {}, { /** * 对应的 mac 地址 */ macAddress: string; } >; /** * 获取屏幕像素信息 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----: | :----- | :--------- | :----------- | * | 支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.getScreenInfo({ * success: function (result) { * console.log('屏幕像素信息', result.pixel); * }, * error: function (error) {} * }); * ``` */ getScreenInfo?: APIType< {}, { /** * 屏幕的像素信息,宽高以*分隔,示例:1080*1920 */ pixel: string; } >; /** * 获取网络状态 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----------: | :--- | :--------- | :----------- | * | 支持 | 支持 | 跨端框架支持 | 支持 | 支持 | 支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.getNetWorkInfo({ * success: function (result) { * console.log('网络状态', result.netWorkType); * console.log('设备 ip', result.ip); * }, * error: function (error) {} * }); * ``` */ getNetWorkInfo?: APIType< {}, { /** * 网络状态,1代表wifi,0代表移动网络,-1代表无网络 */ netWorkType: number; /** * 当前设备 ip * * @support 仅 ejs 及钉钉平台支持 */ ip?: string; /** * 在 非 ejs 环境下,会额外返回 uniAPI 返回的参数 * * @support 非 ejs 环境支持 */ uniparams?: UniApp.GetNetworkTypeSuccess; } >; /** * 获取设备厂商信息,同时将设备其它信息也一起返回 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----------: | :----------- | :--------- | :----------- | * | 支持 | 支持 | 跨端框架支持 | 跨端框架支持 | 支持 | 支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.getVendorInfo({ * success: function (result) { * console.log('设备厂商信息', result); * }, * error: function (error) {} * }); * ``` */ getVendorInfo?: APIType< {}, { /** * 网络状态,1代表wifi,0代表移动网络,-1代表无网络 */ netWorkType: number; /** * 对应的设备唯一 ID */ deviceId: string; /** * 屏幕的像素信息,宽高以*分隔 * * @support 非 ejs 环境不支持 */ pixel?: string; /** * 厂商信息 * * @support 非 ejs 或 h5 环境不支持 */ uaInfo?: string; /** * 在非 ejs 环境下,会额外返回 uniAPI 返回的参数 * * @support 非 ejs 环境支持 */ uniparams?: UniApp.GetNetworkTypeSuccess & UniApp.GetSystemInfoResult; } >; /** * 判断设备是否是平板 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----: | :----- | :--------- | :----------- | * | 支持 | 支持 | 不支持 | 不支持 | 支持 | 支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.isTablet({ * success: function (result) { * console.log('设备是否是平板', result.isTablet); * }, * error: function (error) {} * }); * ``` */ isTablet?: APIType< {}, { /** * 0代表非平板,1代表平板 */ isTablet: number; } >; /** * 拨打电话 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :--: | :----- | :--------- | :----------- | * | 支持 | 支持 | 支持 | 不支持 | 支持 | 支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.callPhone({ * phoneNum: '182xxxxxxxx', * success: function () {}, * error: function (error) {} * }); * // 兼容快速调用 * ejs.device.callPhone('182xxxxxxxx'); * ``` */ callPhone?: APIStrType< { /** * 需要拨打的电话号码 */ phoneNum: string; }, void, [ /** * 需要拨打的电话号码 */ string ], false >; /** * 发送短信 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :--: | :----- | :--------- | :----------- | * | 支持 | 支持 | 支持 | 不支持 | 不支持 | 不支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.sendMsg({ * phoneNum: '182xxxxxxxx', * message: 'hello', * success: function () {}, * error: function (error) {} * }); * // 兼容快速调用 * ejs.device.sendMsg('182xxxxxxxx', 'hello'); * ``` */ sendMsg?: APIStrType< { /** * 目标的电话号码 */ phoneNum: string; /** * 短信内容 */ message: string; }, void, [ /** * 目标的电话号码 */ string, /** * 短信内容 */ string ], false >; /** * 发送给其他 app、系统分享功能。一般图片三种方式选一种即可。 * * @support * | ejs(H5 应用) | ejs(新点小程序) | H5 | 钉钉 | 微信小程序 | 支付宝小程序 | * | :------------ | :---------------: | :----: | :----- | :--------- | :----------- | * | 支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | * * 文档: [http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device](http://app.epoint.com.cn/ejs4mpdoc/index/index.php#page=api_device) * @example ```typescript * ejs.device.sendTo({ * title: '测试标题', * url: 'http://www.liantu.com/', * imgBase64: '', * imgURL: '', * sdPath: '', * success: function () {}, * error: function (error) {} * }); * ``` * * @tips * * 在不同平台,分享的调用方式和逻辑有较大差异: * * 1. 小程序:不支持 API 调用,只能用户主动点击触发分享。可使用自定义按钮方式