feat:更新uniapp文档
This commit is contained in:
parent
eb93ce805b
commit
c431071421
207
uni.md
207
uni.md
@ -14,14 +14,14 @@ npm install star-cloud-uni
|
||||
|
||||
```javascript
|
||||
// Result类是所有有返回结果的方法,统一的返回结构,以下接口文档的返回只列出data中的数据结构
|
||||
import { Result } from 'star-cloud-uni'
|
||||
import {Result} from 'star-cloud-uni'
|
||||
// Result.Success中code=0,message='成功',data根据不同方法返回不同数据,默认为{}
|
||||
const { code, data, message } = Result.Success
|
||||
const {code, data, message} = Result.Success
|
||||
// 常用判断方式
|
||||
if (code === Result.Success.code) {
|
||||
// 逻辑代码
|
||||
// 逻辑代码
|
||||
} else {
|
||||
// 错误处理
|
||||
// 错误处理
|
||||
}
|
||||
```
|
||||
|
||||
@ -104,7 +104,7 @@ if (code === Result.Success.code) {
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { init } from 'star-cloud-uni'
|
||||
import {init} from 'star-cloud-uni'
|
||||
|
||||
init(params)
|
||||
```
|
||||
@ -129,7 +129,7 @@ init(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { register } from 'star-cloud-uni'
|
||||
import {register} from 'star-cloud-uni'
|
||||
|
||||
register()
|
||||
```
|
||||
@ -150,7 +150,7 @@ register()
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { logout } from 'star-cloud-uni'
|
||||
import {logout} from 'star-cloud-uni'
|
||||
|
||||
logout(params)
|
||||
```
|
||||
@ -171,10 +171,11 @@ logout(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { searchDevice } from 'star-cloud-uni'
|
||||
import {searchDevice} from 'star-cloud-uni'
|
||||
|
||||
searchDevice(callback)
|
||||
const callback = async result => {}
|
||||
const callback = async result => {
|
||||
}
|
||||
```
|
||||
|
||||
**入参**
|
||||
@ -206,7 +207,7 @@ DeviceInfo 设备信息
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { stopSearchDevice } from 'star-cloud-uni'
|
||||
import {stopSearchDevice} from 'star-cloud-uni'
|
||||
|
||||
const result = await stopSearchDevice()
|
||||
```
|
||||
@ -222,7 +223,7 @@ const result = await stopSearchDevice()
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { bindDevice } from 'star-cloud-uni'
|
||||
import {bindDevice} from 'star-cloud-uni'
|
||||
|
||||
bindDevice(params)
|
||||
```
|
||||
@ -247,7 +248,7 @@ bindDevice(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { selectLock } from 'star-cloud-uni'
|
||||
import {selectLock} from 'star-cloud-uni'
|
||||
|
||||
selectLock(params)
|
||||
```
|
||||
@ -267,7 +268,7 @@ selectLock(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { openDoor } from 'star-cloud-uni'
|
||||
import {openDoor} from 'star-cloud-uni'
|
||||
|
||||
openDoor(params)
|
||||
```
|
||||
@ -288,7 +289,7 @@ openDoor(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { deleteLock } from 'star-cloud-uni'
|
||||
import {deleteLock} from 'star-cloud-uni'
|
||||
|
||||
deleteLock(params)
|
||||
```
|
||||
@ -307,7 +308,7 @@ deleteLock(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { getLockSupportFeatures } from 'star-cloud-uni'
|
||||
import {getLockSupportFeatures} from 'star-cloud-uni'
|
||||
|
||||
getLockSupportFeatures(params)
|
||||
```
|
||||
@ -396,7 +397,7 @@ getLockSupportFeatures(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { getOfflinePassword } from 'star-cloud-uni'
|
||||
import {getOfflinePassword} from 'star-cloud-uni'
|
||||
|
||||
getOfflinePassword(params)
|
||||
```
|
||||
@ -453,7 +454,7 @@ keyboardPwdType 密码类型
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { checkPassword } from 'star-cloud-uni'
|
||||
import {checkPassword} from 'star-cloud-uni'
|
||||
|
||||
checkPassword(params)
|
||||
```
|
||||
@ -483,7 +484,7 @@ CheckInfo 检查密码信息
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { updateAdminPassword } from 'star-cloud-uni'
|
||||
import {updateAdminPassword} from 'star-cloud-uni'
|
||||
|
||||
updateAdminPassword(params)
|
||||
```
|
||||
@ -504,7 +505,7 @@ updateAdminPassword(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { customPassword } from 'star-cloud-uni'
|
||||
import {customPassword} from 'star-cloud-uni'
|
||||
|
||||
customPassword(params)
|
||||
```
|
||||
@ -552,7 +553,7 @@ operate=0时返回
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { syncOpenDoorRecord } from 'star-cloud-uni'
|
||||
import {syncOpenDoorRecord} from 'star-cloud-uni'
|
||||
|
||||
syncOpenDoorRecord(params)
|
||||
```
|
||||
@ -574,7 +575,7 @@ syncOpenDoorRecord(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { getServerTime } from 'star-cloud-uni'
|
||||
import {getServerTime} from 'star-cloud-uni'
|
||||
|
||||
getServerTime()
|
||||
```
|
||||
@ -593,7 +594,7 @@ getServerTime()
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { removeBadLock } from 'star-cloud-uni'
|
||||
import {removeBadLock} from 'star-cloud-uni'
|
||||
|
||||
removeBadLock(params)
|
||||
```
|
||||
@ -608,7 +609,6 @@ removeBadLock(params)
|
||||
**返回**
|
||||
无
|
||||
|
||||
|
||||
# 电表
|
||||
|
||||
## 更新电表信息
|
||||
@ -616,7 +616,7 @@ removeBadLock(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { refreshElecInfo } from 'star-cloud-web'
|
||||
import {refreshElecInfo} from 'star-cloud-web'
|
||||
|
||||
refreshElecInfo(params)
|
||||
```
|
||||
@ -631,7 +631,6 @@ refreshElecInfo(params)
|
||||
**返回**
|
||||
无
|
||||
|
||||
|
||||
# 冷水表
|
||||
|
||||
## 更新冷水表信息
|
||||
@ -639,7 +638,7 @@ refreshElecInfo(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { refreshColdWaterInfo } from 'star-cloud-web'
|
||||
import {refreshColdWaterInfo} from 'star-cloud-web'
|
||||
|
||||
refreshColdWaterInfo(params)
|
||||
```
|
||||
@ -654,8 +653,6 @@ refreshColdWaterInfo(params)
|
||||
**返回**
|
||||
无
|
||||
|
||||
|
||||
|
||||
# 热水表
|
||||
|
||||
## 更新热水表信息
|
||||
@ -663,7 +660,7 @@ refreshColdWaterInfo(params)
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import { refreshHotWaterInfo } from 'star-cloud-web'
|
||||
import {refreshHotWaterInfo} from 'star-cloud-web'
|
||||
|
||||
refreshHotWaterInfo(params)
|
||||
```
|
||||
@ -677,3 +674,155 @@ refreshHotWaterInfo(params)
|
||||
|
||||
**返回**
|
||||
无
|
||||
|
||||
# 注册扩展功能
|
||||
|
||||
## 注册
|
||||
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import {registerExtendedProducts} from 'star-cloud-web'
|
||||
|
||||
registerExtendedProducts(params)
|
||||
```
|
||||
|
||||
**入参**
|
||||
|
||||
| 参数名称 | 数据类型 | 必须 | 描述 | 说明 |
|
||||
|-------------------|---------------|----|----------|-----------------------------------------------------------------------------------------------------------------|
|
||||
| type | String | Y | 功能类型 | ['card','fingerprint','face','remote','palmVein'] |
|
||||
| keyId | String | Y | 钥匙 ID |
|
||||
| uid | String | Y | 用户uid |
|
||||
| userCountLimit | Number | Y | 使用次数限制 | 0xFFFF 表示不限次数 |
|
||||
| operate | Number | Y | 操作类型 | 0: 注册, 1: 修改, 2: 删除, 3: 删除全部 |
|
||||
| isAdmin | Number | Y | 是否管理员 | 1 表示是,0 表示否 |
|
||||
| isForce | Number | Y | 是否胁迫 | 1 表示是,0 表示否 |
|
||||
| isRound | Number | Y | 是否循环 | 1 表示是,0 表示否 |
|
||||
| weekDays | Array<Number> | N | 循环周期 | 0 -- 6 置位分别代表周日 -- 周六;例如:循环星期一、星期二、星期四,对应为:[1,2,4] |
|
||||
| startDate | Number | Y | 生效日期 | 时间戳,永久则填0 |
|
||||
| endDate | Number | Y | 失效日期 | 时间戳,永久则填0 |
|
||||
| startTime | String | N | 生效时间 | 例如:'00:00' |
|
||||
| endTime | String | N | 失效时间 | 例如:'00:00' |
|
||||
| cardId | Number | N | 卡片Id | 添加后由监听事件返回,仅当 type 为 'card' 且operate!=1 时需要 |
|
||||
| cardNumber | Number | N | 卡片序号 | 仅当 type 为 'card' 时需要 |
|
||||
| cardName | String | N | 卡片名称 | 仅当 type 为 'card' 时需要 |
|
||||
| cardType | Number | N | 卡片类型 | 仅当 type 为 'card' 时需要,1:永久,2:期限,4:循环, |
|
||||
| cardUserNo | Number | N | 卡UserNo | 仅当 type 为 'card' 时需要 (选填) |
|
||||
| fingerprintId | Number | N | 指纹Id | 添加后由监听事件返回,仅当 type 为 'fingerprint' 且operate!=1 时需要 |
|
||||
| fingerprintName | String | N | 指纹序号 | 仅当 type 为 'fingerprint' 时需要 |
|
||||
| fingerprintNumber | Number | N | 指纹名称 | 仅当 type 为 'fingerprint' 时需要 |
|
||||
| fingerprintType | Number | N | 指纹类型 | 仅当 type 为 'fingerprint' 时需要,1:永久,2:期限,3:单次,4:循环 |
|
||||
| fingerprintUserNo | Number | N | 指纹UserNo | 仅当 type 为 'fingerprint' 时需要 (选填) |
|
||||
| deleteType | Number | N | 删除方式 | 仅当 type 为 'fingerprint' 时需要 1:通过APP走蓝牙删除,必需先通过APP蓝牙删除后再调用该接口,2:通过网关或WiFi锁删除,如果是WiFi锁或有连接网关,则可以传2,直接调用该接口从锁里删除指纹 |
|
||||
|
||||
**返回**
|
||||
> Result 统一返回结果格式
|
||||
>
|
||||
> 收到锁版提示后,将卡片放置读卡器
|
||||
|
||||
|
||||
**监听相关事件**
|
||||
|
||||
| 事件名 | 描述 | 返回值示例 |
|
||||
|----------------------------|--------|-------------------------------------------------------|
|
||||
| registerCardConfirm | 卡片注册成功 | {cardNumber:1,cardId:1} |
|
||||
| registerFingerprintProcess | 指纹注册进度 | {status: 0,process: 0};**process总步数在上方统一`Result`中返回** |
|
||||
| registerFingerprintConfirm | 指纹注册成功 | {fingerprintNumber:1,fingerprintId:1} |
|
||||
|
||||
**监听事件示例**
|
||||
|
||||
```js
|
||||
// uniapp 监听注册卡片完成事件
|
||||
uni.$on('registerCardConfirm', async data => {
|
||||
// TODO
|
||||
})
|
||||
// uniapp 监听注册指纹进度
|
||||
uni.$on('registerFingerprintProcess', async data => {
|
||||
// TODO
|
||||
})
|
||||
// uniapp 指纹注册成功
|
||||
uni.$on('registerFingerprintConfirm', async data => {
|
||||
// TODO
|
||||
})
|
||||
```
|
||||
|
||||
## 取消注册
|
||||
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import {registerExtendedProductsCancel} from 'star-cloud-web'
|
||||
|
||||
registerExtendedProductsCancel(params)
|
||||
```
|
||||
|
||||
**入参**
|
||||
|
||||
| 参数名称 | 数据类型 | 必须 | 描述 | 说明 |
|
||||
|-------|--------|----|-------|---------------------------------------------------|
|
||||
| type | String | Y | 功能类型 | ['card','fingerprint','face','remote','palmVein'] |
|
||||
| keyId | String | Y | 钥匙 ID |
|
||||
| uid | String | Y | 用户uid |
|
||||
|
||||
**返回**
|
||||
无
|
||||
|
||||
## 获取ic卡列表
|
||||
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import {getIcCardList} from 'star-cloud-web'
|
||||
|
||||
getIcCardList(params)
|
||||
```
|
||||
|
||||
**入参**
|
||||
|
||||
| 参数名称 | 数据类型 | 必须 | 描述 |
|
||||
|----------|--------|----|-------|
|
||||
| lockId | String | Y | 锁id | |
|
||||
| pageNo | String | N | 页码 |
|
||||
| pageSize | String | N | 每页显示数 |
|
||||
|
||||
**返回**
|
||||
```json
|
||||
{
|
||||
"list": [],
|
||||
"pageNo": 1,
|
||||
"pageSize": 0,
|
||||
"pages": 0,
|
||||
"total": 0
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 获取指纹列表
|
||||
|
||||
**调用方法**
|
||||
|
||||
```javascript
|
||||
import {getFingerprintList} from 'star-cloud-web'
|
||||
|
||||
getFingerprintList(params)
|
||||
```
|
||||
|
||||
**入参**
|
||||
|
||||
| 参数名称 | 数据类型 | 必须 | 描述 |
|
||||
|----------|--------|----|-------|
|
||||
| lockId | String | Y | 锁id | |
|
||||
| pageNo | String | N | 页码 |
|
||||
| pageSize | String | N | 每页显示数 |
|
||||
|
||||
**返回**
|
||||
```json
|
||||
{
|
||||
"list": [],
|
||||
"pageNo": 1,
|
||||
"pageSize": 0,
|
||||
"pages": 0,
|
||||
"total": 0
|
||||
}
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user