diff --git a/src/router/index.js b/src/router/index.js
index b806ff3..5558e27 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -12,10 +12,11 @@ import SettingManagement from "@/views/setting/SettingManagement.vue";
import HeadquartersManagement from "@/views/headquarters/HeadquartersManagement.vue";
import Login from "@/views/login/Login.vue";
import useUserInfoStore from "@/stores/useUserInfoStore";
+import useBuildingStore from "@/stores/useBuildingStore";
import useGetCookie from "@/hooks/useGetCookie";
import System from "@/views/system/System.vue";
import SystemFloor from "@/views/system/SystemFloor.vue";
-
+
import Test from "@/views/Test.vue";
import SystemMain from "@/views/system/SystemMain.vue";
@@ -112,9 +113,11 @@ router.beforeEach(async (to, from, next) => {
const auth = useUserInfoStore();
const token = useGetCookie("JWT-Authorization");
const user_name = useGetCookie("user_name");
+ const buildingStore = useBuildingStore();
if ((authRequired && !token) || to.path === "/") {
auth.user.token = "";
+ buildingStore.deleteBuilding();
next({ path: "/login" });
} else if (!authRequired) {
document.cookie = "JWT-Authorization=; Max-Age=0";
diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue
index aef0243..ea8eea3 100644
--- a/src/views/dashboard/Dashboard.vue
+++ b/src/views/dashboard/Dashboard.vue
@@ -35,16 +35,23 @@ watch(
(newBuilding) => {
if (newBuilding) {
formState.value.building_guid = newBuilding.building_guid;
- imgBaseUrl.value = store.previewImageExt
- ? `${FILE_BASEURL}/upload/setting/previewImage/${newBuilding.building_guid}${store.previewImageExt}`
- : import.meta.env.MODE === "production"
- ? "dist/build_img.jpg"
- : "/build_img.jpg";
}
},
{ immediate: true, deep: true }
);
+watch(
+ () => store.previewImageExt,
+ (newExt) => {
+ if (formState.value.building_guid) {
+ imgBaseUrl.value = newExt
+ ? `${FILE_BASEURL}/upload/setting/previewImage/${formState.value.building_guid}${newExt}`
+ : "/build_img.jpg";
+ }
+ },
+ { immediate: true }
+);
+
watch(
() => formState.value,
(newVal) => {
@@ -139,7 +146,7 @@ onUnmounted(() => {
diff --git a/src/views/dashboard/components/DashboardSysProgressModal.vue b/src/views/dashboard/components/DashboardSysProgressModal.vue
index d6d63c9..170e3cc 100644
--- a/src/views/dashboard/components/DashboardSysProgressModal.vue
+++ b/src/views/dashboard/components/DashboardSysProgressModal.vue
@@ -88,7 +88,7 @@ watch(