diff --git a/App.vue b/App.vue
index b2795b5..6b24e74 100644
--- a/App.vue
+++ b/App.vue
@@ -39,6 +39,8 @@
this.updateMiniProgram()
// 监听蓝牙开关状态
this.onBluetoothState()
+ // 设置voip配置
+ this.setVoipConfig()
// 检查蓝牙权限
const checkResult = await this.checkSetting()
console.log(checkResult)
@@ -65,6 +67,24 @@
'initAndListenBluetooth'
]),
...mapActions(useUserStore, ['updateLoginStatus']),
+ // voip设置
+ setVoipConfig() {
+ const wmpfVoip = requirePlugin('wmpf-voip').default
+ wmpfVoip.setUIConfig({
+ btnText: '去开门',
+ customBoxHeight: '75vh',
+ listenerUI: {
+ cameraRotation: 270,
+ objectFit: 'fill',
+ enableToggleCamera: false
+ }
+ })
+ wmpfVoip.setVoipEndPagePath({
+ url: '/pages/main/home',
+ key: 'Call',
+ routeType: 'switchTab'
+ })
+ },
// 强制升级
updateMiniProgram() {
const updateManager = uni.getUpdateManager()
diff --git a/api/p2p.js b/api/sdk.js
similarity index 64%
rename from api/p2p.js
rename to api/sdk.js
index fb0d2a0..5ec215c 100644
--- a/api/p2p.js
+++ b/api/sdk.js
@@ -1,9 +1,9 @@
import request from '../utils/request'
-// p2p 模块
+// sdk 模块
-// 获取p2pInfo
-export function getP2pInfo(data) {
+// 透传
+export function passthrough(data) {
return request({
url: '/passthrough',
method: 'POST',
diff --git a/manifest.json b/manifest.json
index ae4600e..fdb5525 100644
--- a/manifest.json
+++ b/manifest.json
@@ -29,6 +29,15 @@
"version": "latest",
"provider": "wx1319af22356934bf",
"export": "exportForXp2pPlugin.js"
+ },
+ "wmpf-voip": {
+ "version": "latest",
+ "provider": "wxf830863afde621eb",
+ "genericsImplementation": {
+ "call-page-plugin": {
+ "custombox": "pages/main/customBox"
+ }
+ }
}
}
},
diff --git a/pages.json b/pages.json
index be1321e..fbe944f 100644
--- a/pages.json
+++ b/pages.json
@@ -38,10 +38,6 @@
"version": "latest",
"provider": "wx9e8fbc98ceac2628",
"export": "exportForPlayerPlugin.js"
- },
- "wmpf-voip": {
- "version": "latest",
- "provider": "wxf830863afde621eb"
}
}
},
@@ -579,6 +575,9 @@
{
"path": "pages/main/mine"
},
+ {
+ "path": "pages/main/customBox"
+ },
{
"path": "pages/main/notificationList",
"style": {
diff --git a/pages/main/customBox.vue b/pages/main/customBox.vue
new file mode 100644
index 0000000..0893cda
--- /dev/null
+++ b/pages/main/customBox.vue
@@ -0,0 +1,185 @@
+
+
+
+
+
+
+ 点击开锁
+
+
+
+
+
+
diff --git a/pages/main/lockDetail.vue b/pages/main/lockDetail.vue
index 018f1be..b2a3cee 100644
--- a/pages/main/lockDetail.vue
+++ b/pages/main/lockDetail.vue
@@ -223,7 +223,7 @@
- 授权微信
+ 授权后,设备可呼叫该微信
+
+
+ 授权
+
+
+ 您已授权
+
+ 您已拒绝授权,请去设置中
+ 打开语音、视频通话提醒开关
+
+ 打开设置
+
+
+
+
\ No newline at end of file
+
+ const openSetting = () => {
+ uni.openSetting({
+ success: res => {
+ console.log(res)
+ }
+ })
+ }
+
+ const getInfo = async () => {
+ const result = await passthrough({
+ request_method: 'GET',
+ request_uri: '/api/v1/tencentYun/getWechatDeviceTicket',
+ post_args: {
+ lockId: $bluetooth.currentLockInfo.lockId
+ }
+ })
+ return result
+ }
+
+ const handleAuthorize = async () => {
+ if (pending.value) return
+ pending.value = true
+ uni.showLoading({
+ title: '授权中...'
+ })
+ const result = await getInfo()
+ if (result.code === 0) {
+ wx.requestDeviceVoIP({
+ sn: result.data.WXIoTDeviceInfo.SN,
+ snTicket: result.data.WXIoTDeviceInfo.SNTicket,
+ modelId: result.data.WXIoTDeviceInfo.ModelId,
+ deviceName: '智能',
+ success() {
+ isAuthorized.value = true
+ uni.hideLoading()
+ pending.value = false
+ uni.showToast({
+ title: '授权成功',
+ icon: 'none'
+ })
+ },
+ fail() {
+ isAuthorized.value = true
+ reject.value = true
+ uni.hideLoading()
+ pending.value = false
+ uni.showToast({
+ title: '授权失败',
+ icon: 'none'
+ })
+ }
+ })
+ } else {
+ uni.hideLoading()
+ pending.value = false
+ uni.showToast({
+ title: result.message,
+ icon: 'none'
+ })
+ }
+ }
+
diff --git a/pages/p2p/p2pPlayer.vue b/pages/p2p/p2pPlayer.vue
index 323f519..3057b2b 100644
--- a/pages/p2p/p2pPlayer.vue
+++ b/pages/p2p/p2pPlayer.vue
@@ -123,7 +123,7 @@
import { useBasicStore } from '@/stores/basic'
import { onMounted, ref } from 'vue'
import { onUnload } from '@dcloudio/uni-app'
- import { getP2pInfo } from '@/api/p2p'
+ import { passthrough } from '@/api/sdk'
const $bluetooth = useBluetoothStore()
const $basic = useBasicStore()
@@ -148,7 +148,7 @@
onMounted(async () => {
buttonInfo.value = await $basic.getButtonInfo()
- const { code, data, message } = await getP2pInfo({
+ const { code, data, message } = await passthrough({
request_method: 'GET',
request_uri: '/api/v1/tencentYun/getDeviceDetailData',
post_args: {