remove all semicolons

This commit is contained in:
RuoYi
2025-04-27 09:58:29 +08:00
parent 7de94e2ea3
commit 2f8a257efd
83 changed files with 2178 additions and 2178 deletions

View File

@@ -40,126 +40,127 @@ import useSettingsStore from '@/store/modules/settings'
import usePermissionStore from '@/store/modules/permission'
// 顶部栏初始数
const visibleNumber = ref(null);
const visibleNumber = ref(null)
// 当前激活菜单的 index
const currentIndex = ref(null);
const currentIndex = ref(null)
// 隐藏侧边栏路由
const hideList = ['/index', '/user/profile'];
const hideList = ['/index', '/user/profile']
const appStore = useAppStore()
const settingsStore = useSettingsStore()
const permissionStore = usePermissionStore()
const route = useRoute();
const router = useRouter();
const route = useRoute()
const router = useRouter()
// 主题颜色
const theme = computed(() => settingsStore.theme);
const theme = computed(() => settingsStore.theme)
// 所有的路由信息
const routers = computed(() => permissionStore.topbarRouters);
const routers = computed(() => permissionStore.topbarRouters)
// 顶部显示菜单
const topMenus = computed(() => {
let topMenus = [];
let topMenus = []
routers.value.map((menu) => {
if (menu.hidden !== true) {
// 兼容顶部栏一级菜单内部跳转
if (menu.path === '/' && menu.children) {
topMenus.push(menu.children[0]);
topMenus.push(menu.children[0])
} else {
topMenus.push(menu);
topMenus.push(menu)
}
}
})
return topMenus;
return topMenus
})
// 设置子路由
const childrenMenus = computed(() => {
let childrenMenus = [];
let childrenMenus = []
routers.value.map((router) => {
for (let item in router.children) {
if (router.children[item].parentPath === undefined) {
if(router.path === "/") {
router.children[item].path = "/" + router.children[item].path;
router.children[item].path = "/" + router.children[item].path
} else {
if(!isHttp(router.children[item].path)) {
router.children[item].path = router.path + "/" + router.children[item].path;
router.children[item].path = router.path + "/" + router.children[item].path
}
}
router.children[item].parentPath = router.path;
router.children[item].parentPath = router.path
}
childrenMenus.push(router.children[item]);
childrenMenus.push(router.children[item])
}
})
return constantRoutes.concat(childrenMenus);
return constantRoutes.concat(childrenMenus)
})
// 默认激活的菜单
const activeMenu = computed(() => {
const path = route.path;
let activePath = path;
const path = route.path
let activePath = path
if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) {
const tmpPath = path.substring(1, path.length);
const tmpPath = path.substring(1, path.length)
if (!route.meta.link) {
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
appStore.toggleSideBarHide(false);
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"))
appStore.toggleSideBarHide(false)
}
} else if(!route.children) {
activePath = path;
appStore.toggleSideBarHide(true);
activePath = path
appStore.toggleSideBarHide(true)
}
activeRoutes(activePath);
return activePath;
activeRoutes(activePath)
return activePath
})
function setVisibleNumber() {
const width = document.body.getBoundingClientRect().width / 3;
visibleNumber.value = parseInt(width / 85);
const width = document.body.getBoundingClientRect().width / 3
visibleNumber.value = parseInt(width / 85)
}
function handleSelect(key, keyPath) {
currentIndex.value = key;
const route = routers.value.find(item => item.path === key);
currentIndex.value = key
const route = routers.value.find(item => item.path === key)
if (isHttp(key)) {
// http(s):// 路径新窗口打开
window.open(key, "_blank");
window.open(key, "_blank")
} else if (!route || !route.children) {
// 没有子路由路径内部打开
const routeMenu = childrenMenus.value.find(item => item.path === key);
const routeMenu = childrenMenus.value.find(item => item.path === key)
if (routeMenu && routeMenu.query) {
let query = JSON.parse(routeMenu.query);
router.push({ path: key, query: query });
let query = JSON.parse(routeMenu.query)
router.push({ path: key, query: query })
} else {
router.push({ path: key });
router.push({ path: key })
}
appStore.toggleSideBarHide(true);
appStore.toggleSideBarHide(true)
} else {
// 显示左侧联动菜单
activeRoutes(key);
appStore.toggleSideBarHide(false);
activeRoutes(key)
appStore.toggleSideBarHide(false)
}
}
function activeRoutes(key) {
let routes = [];
let routes = []
if (childrenMenus.value && childrenMenus.value.length > 0) {
childrenMenus.value.map((item) => {
if (key == item.parentPath || (key == "index" && "" == item.path)) {
routes.push(item);
routes.push(item)
}
});
})
}
if(routes.length > 0) {
permissionStore.setSidebarRouters(routes);
permissionStore.setSidebarRouters(routes)
} else {
appStore.toggleSideBarHide(true);
appStore.toggleSideBarHide(true)
}
return routes;
return routes
}
onMounted(() => {
window.addEventListener('resize', setVisibleNumber)
})
onBeforeUnmount(() => {
window.removeEventListener('resize', setVisibleNumber)
})