瀏覽代碼

语音通话

wangming 2 月之前
父節點
當前提交
4d41cb9194
共有 1 個文件被更改,包括 49 次插入20 次删除
  1. 49 20
      src/components/component/alarModel.vue

+ 49 - 20
src/components/component/alarModel.vue

@@ -81,6 +81,7 @@ export default {
     data() {
         return {
             alarmModel: false,
+            eventListId: "",
             nowTime: "",
             devName: "",
             authorizeFlag: true,
@@ -108,7 +109,10 @@ export default {
         authorizeIot() {
             this.sn = this.clientId;
             this.alarmModel = false;
-            const { name, sn, voipDevices } = this;
+            // const { name, sn, voipDevices } = this;
+            const name = this.name;
+            const sn = this.clientId;
+            const voipDevices = this.voipDevices;
             console.log(name, sn, voipDevices, 88888888888);
             if (!name || name.length === 0 || !sn || sn.length === 0) {
                 wx.showToast({
@@ -141,17 +145,25 @@ export default {
                         icon: "none",
                     });
                     const key = `voipDevices[${voipDevices.length}]`;
-                    that.setData({
-                        [key]: {
-                            sn,
-                            modelId,
-                            status: 1,
-                        },
+                    // that.setData({
+                    //     [key]: {
+                    //         sn,
+                    //         modelId,
+                    //         status: 1,
+                    //     },
+                    // });
+                    that.voipDevices.push({
+                        sn,
+                        modelId,
+                        status: 1,
                     });
+                    that.sn = sn;
+                    that.modelId = modelId;
+                    that.status = 1;
                     that.gotoCallPage();
                 },
                 fail(err) {
-                    console.error(`requestDeviceVoIP fail`, err);
+                    console.error(`requestDeviceVoIP failOne`, err);
                     wx.showToast({
                         title: "授权失败, 请前往设置页开启",
                         icon: "none",
@@ -177,9 +189,13 @@ export default {
             }
         },
         async authorizeIot() {
-            this.sn = this.dev_id;
-            this.alarmModel = false;
-            const { name, sn, voipDevices } = this;
+            this.sn = this.clientId;
+            // this.alarmModel = false;
+            const name = this.name;
+            const sn = this.sn;
+            const voipDevices = this.voipDevices;
+            console.log(name, sn, voipDevices, 9999999999999);
+            // const { name, sn, voipDevices } = this;
             if (!name || name.length === 0 || !sn || sn.length === 0) {
                 wx.showToast({
                     title: "请输入授权人名称和设备dev_id",
@@ -211,17 +227,22 @@ export default {
                         icon: "none",
                     });
                     const key = `voipDevices[${voipDevices.length}]`;
-                    that.setData({
-                        [key]: {
-                            sn,
-                            modelId,
-                            status: 1,
-                        },
+                    // that.setData({
+                    //     [key]: {
+                    //         sn,
+                    //         modelId,
+                    //         status: 1,
+                    //     },
+                    // });
+                    that.voipDevices.push({
+                        sn,
+                        modelId,
+                        status: 1,
                     });
                     that.gotoCallPage();
                 },
                 fail(err) {
-                    console.error(`requestDeviceVoIP fail`, err);
+                    console.error(`requestDeviceVoIP failTwo`, err);
                     wx.showToast({
                         title: "授权失败, 请前往设置页开启",
                         icon: "none",
@@ -235,7 +256,7 @@ export default {
                 icon: "loading",
                 duration: 2000, //持续的时间
             });
-            this.alarmModel = false;
+            // this.alarmModel = false;
             this._caller = new AsyncValue();
             let options = {
                 sn: this.sn,
@@ -451,6 +472,15 @@ export default {
                 this.clientId = data.clientId;
                 this.devName = data.devName;
                 this.sn = data.clientId;
+                this.eventListId = data.eventListId;
+
+                console.log(
+                    "接收到消息:",
+                    this.clientId,
+                    this.devName,
+                    this.sn,
+                    this.eventListId
+                );
                 const now = new Date();
                 const year = now.getFullYear();
                 const month = (now.getMonth() + 1).toString().padStart(2, "0");
@@ -464,7 +494,6 @@ export default {
         },
     },
     beforeMount() {
-        console.log("子组件打印了");
         if (!isWmpf) {
             this.getVoipDevices();
         }