|
@@ -1,25 +1,25 @@
|
|
|
-export const isDevelopment = import.meta.env.MODE === "development"
|
|
|
+export const isDevelopment = import.meta.env.MODE === "development";
|
|
|
|
|
|
export const getEnvImagePath = (path) => {
|
|
|
return isDevelopment
|
|
|
- ? `http://192.168.0.68:8080${path}`
|
|
|
- : `${window.origin}/project/lbc-memorial-hall/base${path}`
|
|
|
-}
|
|
|
+ ? `http://192.168.0.18:8080${path}`
|
|
|
+ : `${window.origin}/project/lbc-memorial-hall/base${path}`;
|
|
|
+};
|
|
|
|
|
|
export function isMobile() {
|
|
|
- const userAgent = navigator.userAgent.toLowerCase()
|
|
|
- return /iphone|ipod|android|windows phone|blackberry|mobile/i.test(userAgent)
|
|
|
+ const userAgent = navigator.userAgent.toLowerCase();
|
|
|
+ return /iphone|ipod|android|windows phone|blackberry|mobile/i.test(userAgent);
|
|
|
}
|
|
|
|
|
|
export function checkDeviceAndRedirect() {
|
|
|
- const isMobileDevice = isMobile()
|
|
|
- const currentPath = window.location.pathname
|
|
|
- const isInMobilePath = currentPath.includes("/mobile/")
|
|
|
- const isInPCPath = currentPath.includes("/pc/")
|
|
|
+ const isMobileDevice = isMobile();
|
|
|
+ const currentPath = window.location.pathname;
|
|
|
+ const isInMobilePath = currentPath.includes("/mobile/");
|
|
|
+ const isInPCPath = currentPath.includes("/pc/");
|
|
|
|
|
|
if (isMobileDevice && !isInMobilePath) {
|
|
|
- window.location.href = currentPath.replace("/pc/", "/mobile/")
|
|
|
+ window.location.href = currentPath.replace("/pc/", "/mobile/");
|
|
|
} else if (!isMobileDevice && !isInPCPath) {
|
|
|
- window.location.href = currentPath.replace("/mobile/", "/pc/")
|
|
|
+ window.location.href = currentPath.replace("/mobile/", "/pc/");
|
|
|
}
|
|
|
}
|