From a99886eb9c73018235e2c373f3d82a2b0b2311d5 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期二, 16 九月 2025 13:36:40 +0800
Subject: [PATCH] Merge branch 'ID1766-添加推送登录功能' into test

---
 src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue
index 43c53fc..a30b281 100644
--- a/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue
@@ -59,13 +59,24 @@
     });
 
     const isLoginng = computed(() => {
-      return !!bedsideAuxiliaryScreenStore.token;
+      return !!bedsideAuxiliaryScreenStore.userInfo?.code;
     });
 
     const qrCodeData = computed(() => {
       return {
         deviceCode: bedsideAuxiliaryScreenStore.deviceCode,
+        deviceNo: bedsideAuxiliaryScreenStore.deviceData.devicdeNo,
       };
+    });
+
+    const userInfo = computed(() => {
+      const userInfo = bedsideAuxiliaryScreenStore.userInfo;
+      if (!userInfo) return null;
+      return {
+        ...userInfo,
+        床号: bedsideAuxiliaryScreenStore.deviceData.devicdeNo,
+        设备编号: bedsideAuxiliaryScreenStore.deviceCode
+      }
     });
 
     const openDialog = () => {
@@ -77,17 +88,25 @@
     };
 
     const onLogout = () => {
+      if (state.loading) return ElMessage.warning('正在退出中...')
       ElMessageBox.confirm("是否确认退出当前登录用户?", "提示", {
         confirmButtonText: "确认",
         cancelButtonText: "取消",
         type: "warning",
       })
-        .then(() => {
-            bedsideAuxiliaryScreenStore.logout();
-          ElMessage({
-            type: "success",
-            message: "退出成功!",
-          });
+        .then(async() => {
+            state.loading = true
+            try {
+              await bedsideAuxiliaryScreenStore.logout(`deviceCode=${bedsideAuxiliaryScreenStore.deviceCode}`);
+              handleCancel();
+              ElMessage.success('退出登录成功')
+              handleCancel();
+            } catch (error) {
+              console.error('error: ', error)
+              // ElMessage.error('退出登录失败')
+            } finally {
+              state.loading = false;
+            }
         })
         .catch(() => {});
     };
@@ -100,6 +119,7 @@
       handleCancel,
       openDialog,
       onLogout,
+      userInfo,
     };
   },
 };

--
Gitblit v1.8.0