From 17efc8b0fb7d3fa66eb8e22f32b81e3e14bcd7f6 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 06 一月 2026 17:37:57 +0800
Subject: [PATCH] 测试完成

---
 src/components/CallButton/index.vue |   61 +++++++++++++++++++++++++-----
 1 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/src/components/CallButton/index.vue b/src/components/CallButton/index.vue
index bc17eea..7c7798c 100644
--- a/src/components/CallButton/index.vue
+++ b/src/components/CallButton/index.vue
@@ -11,10 +11,17 @@
 
     <!-- 鍛煎彨鎸夐挳 -->
     <button
-      :class="['call-btn', { calling: isCalling }]"
+      :class="[
+        'call-btn',
+        {
+          calling: isCalling,
+          registering: isRegistering,
+        },
+      ]"
       @click="startCall"
-      :disabled="isCalling || sipStatus !== '宸叉敞鍐�'"
+      :disabled="isButtonDisabled"
     >
+      <i v-if="isRegistering" class="el-icon-loading"></i>
       {{ callButtonText }}
     </button>
 
@@ -41,14 +48,16 @@
     const randomNum = Math.floor(Math.random() * 20) + 1000; // 瀹氫箟闅忔満鍒嗘満鍙�
     return {
       isCalling: false,
+      isRegistering: true, // 鍒濆涓烘敞鍐屼腑鐘舵��
       randomNum: randomNum,
       randomID: null,
       callStatus: "idle", // idle, calling, connected, ended
       sipStatus: "鏈繛鎺�",
       sipStatusClass: "status-disconnected",
       sipConfig: {
-        wsUrl: "wss://192.168.10.124:7443",
-        sipUri: "",
+        // 绉婚櫎纭紪鐮佺殑wsUrl鍜宒omain
+        wsUrl:'',
+        sipUri:'',
         password: "Smartor@2023",
         displayName: "Web 灏忛緳",
         // realm: "9.208.5.18:8090",
@@ -74,11 +83,17 @@
       }
       return "";
     },
-    callStatusClass() {
-      return `status-${this.callStatus}`;
+    isButtonDisabled() {
+      return (
+        this.isCalling || this.sipStatus !== "宸叉敞鍐�" || this.isRegistering
+      );
     },
     callButtonText() {
+      if (this.isRegistering) return "娉ㄥ唽涓�...";
       return this.isCalling ? "閫氳瘽涓�..." : "涓�閿懠鍙�";
+    },
+    callStatusClass() {
+      return `status-${this.callStatus}`;
     },
   },
   created() {
@@ -86,16 +101,29 @@
   },
 
   async mounted() {
+    const orgName = localStorage.getItem("orgname");
+    if (orgName == "鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�") {
+      return;
+    }
     await this.CallgetList();
+    this.isRegistering = true; // 寮�濮嬫敞鍐�
     sipService.init(this.sipConfig);
     // 璁剧疆鐘舵�佸洖璋�
     sipService.onStatusChange = (status) => {
       this.sipStatus = status.text;
       this.sipStatusClass = `status-${status.type}`;
-
+      // 娉ㄥ唽鎴愬姛鎴栧け璐ユ椂鍙栨秷鍔犺浇鐘舵��
+      if (status.type === "registered" || status.type === "failed") {
+        this.isRegistering = false;
+      }
+      // 娉ㄥ唽鎴愬姛
+      if (status.type === "registered") {
+        this.startCallsetState();
+      }
       // 澶勭悊娉ㄥ唽澶辫触鍜屾柇寮�杩炴帴鎯呭喌
       if (status.type === "failed" || status.type === "disconnected") {
         this.overCallsetState(); // 閲婃斁鍒嗘満鍙�
+        this.isRegistering = false;
       }
     };
 
@@ -107,6 +135,13 @@
       // 閫氱煡鐖剁粍浠堕�氳瘽鐘舵�佸彉鍖�
       this.$emit("call-status-change", status);
     };
+    // 娣诲姞娉ㄥ唽瓒呮椂澶勭悊
+    setTimeout(() => {
+      if (this.isRegistering && this.sipStatus !== "宸叉敞鍐�") {
+        this.isRegistering = false;
+        this.$message.warning("SIP娉ㄥ唽瓒呮椂锛岃妫�鏌ョ綉缁滆繛鎺�");
+      }
+    }, 10000); // 10绉掕秴鏃�
   },
   methods: {
     async startCall() {
@@ -158,12 +193,16 @@
         const res = await CallgetList();
         this.randomNum = res.data[0].tel;
         this.randomID = res.data[0].id;
-        // 姝g‘璁剧疆 sipUri
-        this.sipConfig.sipUri = `${this.randomNum}@192.168.10.124`;
-        this.startCallsetState();
+        // 鍔ㄦ�佽缃畇ipUri锛屽煙鍚嶉儴鍒嗕細鍦╯ipService涓姩鎬佸鐞�
+        const orgName = localStorage.getItem("orgname");
+        if (orgName == "涓芥按甯備腑鍖婚櫌") {
+          this.sipConfig.sipUri = `${this.randomNum}@192.168.10.124`;
+        } else if (orgName == "榫欐硥甯備汉姘戝尰闄�") {
+          this.sipConfig.sipUri = `${this.randomNum}@10.10.0.220`;
+        }
       } catch (error) {
         console.error("鑾峰彇鍒嗘満鍙峰け璐�:", error);
-        this.updateStatus("failed", "鑾峰彇鍒嗘満鍙峰け璐�");
+        // this.updateStatus("failed", "鑾峰彇鍒嗘満鍙峰け璐�");
       }
     },
     async startCallsetState() {

--
Gitblit v1.9.3