12345678910111213141516171819202122232425 |
- export const isDevelopment = import.meta.env.MODE === "development";
- export const getEnvImagePath = (path) => {
- return isDevelopment
- ? "http://192.168.0.18:8080" + path
- : `${window.origin}/project/yz-enamel-exhibition/base${path}`;
- };
- export function isMobile() {
- 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/");
- if (isMobileDevice && !isInMobilePath) {
- window.location.href = currentPath.replace("/pc/", "/mobile/");
- } else if (!isMobileDevice && !isInPCPath) {
- window.location.href = currentPath.replace("/mobile/", "/pc/");
- }
- }
|