更新记录
1.0.6(2025-09-06)
修复bug
1.0.5(2025-08-28)
从acwy-adb中添加获取本机WIFI或热点IP 修复其他bug
1.0.4(2025-07-23)
新增file: unifile:转base64 新增content://转path (uni.chooseFile)
查看更多平台兼容性
uni-app(4.71)
Vue2 | Vue2插件版本 | Vue3 | Vue2插件版本 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|---|---|
√ | 1.0.0 | √ | 1.0.0 | × | × | × | × | × | × | × |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × | × | × |
uni-app x(4.71)
Chrome | Safari | Android | Android插件版本 | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|---|
× | × | 5.0 | 1.0.0 | × | × | × |
acwy-common-api
方法
获取本机IP,WIFI或热点未开启返回''
/**
* @description getWifiIp 获取本机IP,WIFI或热点未开启返回''
* @returns Promise<string> ip
*/
getWifiIp()
请求权限
/**
* @description 请求权限,权限在数组中,例:['android.permission.READ_PHONE_STATE']
*/
requestPermission(['android.permission.READ_PHONE_STATE']).then(res=>{
// true
}).catch{
// false
}
获取IMEI 安卓9以下
// 首先需要获取电话权限
const imei: string = getImei()
获取AndroidId(恢复出厂会变)
/**
* @description 获取AndroidId
* @returns string 返回AndroidId或者 ""
*/
getAndroidId()
使用浏览器打开Url
/**
* @description 使用浏览器打开Url
*/
openUrl(url : string)
检查应用是否存在
/**
* @description 检查应用是否存在
* @param {string} packageName 包名
* @return boolean
*/
isAppInstalled(packageName: String)
根据包名获取AppName
/**
* @description 根据包名获取AppName
* @param packageName string 包名
* @return string APP名称
*/
getAppNameByPackageName(packageName: String)
文件是否存在
/**
* @description 文件是否存在
* @param path string 文件路径
* @returns boolean
*/
fileExists(path : string)
获取网络类型
/**
* @description 网络类型
* @return {string} 'none | wifi | 移动网络 | 以太网 | 未知网络'
*/
networkType()
file: unifile:转base64
/**
* @description path转base64
* @param path /storage/emulated/ 如果是file: unifile: 需要UTSAndroid.convert2AbsFullPath转一下
* @return base64 不带base64前缀
*/
pathToBase64(path: string)
content://转path (uni.chooseFile)
/**
* @description chooseFile返回的tempFiles中的content协议文件转File
* @param name string 文件名
* @param contentPath string content协议文件
* @return File| null 返回File
*/
contentToFile(name: string, contentPath: string)