单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-09-10 c980edafe5bf00f9cfe5d999896bb3bb971c8943
ID1766-暂存
4个文件已修改
41 ■■■■ 已修改文件
src/store/bedsideAuxiliaryScreen.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/httpApi.ts 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobile/bedsideAuxiliaryScreen/components/Header.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/bedsideAuxiliaryScreen.ts
@@ -15,6 +15,7 @@
import { ElMessage } from "element-plus/es";
import { Local } from "@/utils/storage";
import type { DeviceLoginRecord } from './type/user.type';
import { logoutForSubScreen } from "@/utils/httpApi";
export const useBedsideAuxiliaryScreenStore = defineStore(
  "bedsideAuxiliaryScreen",
@@ -81,8 +82,9 @@
    /** 退出登录 */
    const logout = () => {
    const logout = async (deviceCode: string) => {
      await logoutForSubScreen(deviceCode);
      setUserInfo(null);
    };
    // SSE 相关状态
src/utils/httpApi.ts
@@ -93,4 +93,22 @@
    } catch (error) {
        throw error;
    }
}
/**
 * 推出登录
 * @param deviceCode
 * @returns
 */
export const logoutForSubScreen = async(deviceCode: string) => {
    try {
        const response = await axios.post(`${apiBaseUrl}/user/info/logoutForSubScreen`, { deviceCode }, {
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        });
        return response.data
    } catch (error) {
        throw error;
    }
}
src/views/mobile/bedsideAuxiliaryScreen/components/Header.vue
@@ -249,6 +249,7 @@
    !bedsideAuxiliaryScreenStore.deviceData.deviceCode
  )
    return ElMessage.warning("未初始化或正在进行初始化操作中");
    console.log(loginDialogRef)
    loginDialogRef.value.openDialog();
};
src/views/mobile/bedsideAuxiliaryScreen/components/Login/index.vue
@@ -59,7 +59,7 @@
    });
    const isLoginng = computed(() => {
      return !!bedsideAuxiliaryScreenStore.userInfo.code;
      return !!bedsideAuxiliaryScreenStore.userInfo?.code;
    });
    const qrCodeData = computed(() => {
@@ -78,13 +78,23 @@
    };
    const onLogout = () => {
      if (state.loading) return ElMessage.warning('正在退出中...')
      ElMessageBox.confirm("是否确认退出当前登录用户?", "提示", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
            bedsideAuxiliaryScreenStore.logout();
        .then(async() => {
            state.loading = true
            try {
              await bedsideAuxiliaryScreenStore.logout(bedsideAuxiliaryScreenStore.deviceCode);
              handleCancel();
              ElMessage.success('退出登录成功')
            } catch (error) {
              ElMessage.success('退出登录失败')
            } finally {
              state.loading = false;
            }
          ElMessage({
            type: "success",
            message: "退出成功!",