From 1f4db481c48e6beb5c787f126576e63363b10a13 Mon Sep 17 00:00:00 2001
From: eight <641137800@qq.com>
Date: 星期二, 20 八月 2024 15:02:00 +0800
Subject: [PATCH] update
---
src/views/ecg/room/RoomLoginSelect.vue | 47 ++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/src/views/ecg/room/RoomLoginSelect.vue b/src/views/ecg/room/RoomLoginSelect.vue
index d32c7c0..8c30904 100644
--- a/src/views/ecg/room/RoomLoginSelect.vue
+++ b/src/views/ecg/room/RoomLoginSelect.vue
@@ -1,17 +1,31 @@
<template>
- <div style="display: flex; flex-wrap: wrap; margin-bottom: 20px">
- <div class=wrap v-for="(value, key) in bedMap" :key="key">
- <RoomBedSelect :title="key" :bedList="value" v-model="curSel"/>
+ <div style="display: flex; flex-direction: column; align-items: center;">
+ <div style="display: flex; flex-wrap: wrap; justify-content: center; margin-bottom: 20px">
+ <div class=roomwrap v-for="(value, key) in bedMap" :key="key">
+ <RoomBedSelect :title="key" :bedList="value" v-model="curSel"/>
+ </div>
</div>
+ <el-button type="primary" @click="roomConfirm">纭</el-button>
+ <el-button type="primary" @click="test">TEST</el-button>
</div>
- <el-button type="primary" @click="roomConfirm">纭</el-button>
</template>
<script setup lang="ts">
import {RoomBedSelect} from "@/components/RoomBedSelect"
import { RoomApi, RoomVO } from '@/api/ecg/room'
+import {useUserStore} from "@/store/modules/user";
+import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
+import {ElMessage} from "element-plus";
+import {isStringEmpty} from "@/utils/stringUtil"
+
+const { push } = useRouter()
+const { wsCache } = useCache()
defineOptions({ name: 'RoomLoginSelect' })
+
+const route = useRoute();
+
+const userStore = useUserStore()
const bedMap = ref<Map<String, RoomVO[]>>() // 鍒楄〃鐨勬暟鎹�
@@ -31,6 +45,29 @@
const roomConfirm = () => {
console.info(curSel.value)
+
+ if (curSel.value.roomId === 0) {
+ ElMessage({
+ message: '璇峰厛閫夋嫨宸ヤ綔鐨勪綅缃�!',
+ type: 'info',
+ duration: 3000 // 鑷姩鍏抽棴鏃堕棿锛岄粯璁や负3000ms
+ });
+ return
+ }
+
+ userStore.setRoomInfoAction(curSel.value)
+ if (isStringEmpty(route.redirectedFrom?.fullPath))
+ push({ path: "/"})
+ else
+ push({ path: route.redirectedFrom?.fullPath})
+}
+
+const test = () => {
+ userStore.getRoom;
+ console.info(userStore.getRoom);
+
+ const userInfo = wsCache.get(CACHE_KEY.USER)
+ console.info(userInfo);
}
/** 鍒濆鍖� **/
@@ -41,7 +78,7 @@
</script>
<style scoped lang="scss">
-.wrap {
+.roomwrap {
margin-right: 20px;
}
</style>
--
Gitblit v1.9.3