feat(competition): 新增比赛活动管理功能模块
实现比赛活动的创建、编辑、详情查看功能,包括基础信息配置、分组管理、题库配置和硬件绑定 添加比赛列表页面的路由跳转逻辑,优化卡片点击交互 完善比赛详情页的编辑状态管理,支持基础信息和题包配置的修改 新增本地SVG图标资源,更新系统Logo组件样式
This commit is contained in:
@ -2,13 +2,14 @@ import type { RouteKey } from '@elegant-router/types'
|
||||
import type { RouteLocationRaw } from 'vue-router'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { router as globalRouter } from '@/router'
|
||||
import { useRouteStore } from '@/store/modules/route'
|
||||
|
||||
/**
|
||||
* Router push
|
||||
* 路由跳转
|
||||
*
|
||||
* Jump to the specified route, it can replace function router.push
|
||||
* 跳转到指定路由,可替换函数 router.push
|
||||
*
|
||||
* @param inSetup Whether is in vue script setup
|
||||
* @param inSetup 是否在 vue script setup 中
|
||||
*/
|
||||
export function useRouterPush(inSetup = true) {
|
||||
const router = inSetup ? useRouter() : globalRouter
|
||||
@ -36,10 +37,27 @@ export function useRouterPush(inSetup = true) {
|
||||
return routerPush(routeLocation)
|
||||
}
|
||||
|
||||
/**
|
||||
* 路由跳转并携带 meta 中的 query 参数
|
||||
*
|
||||
* @param key 路由名称
|
||||
*/
|
||||
function routerPushByKeyWithMetaQuery(key: RouteKey) {
|
||||
const routeStore = useRouteStore()
|
||||
const allRoutes = router.getRoutes()
|
||||
const meta = allRoutes.find(item => item.name === key)?.meta || null
|
||||
|
||||
const menu = routeStore.menus.find(item => item.key === key)
|
||||
if (menu?.children && menu.children.length > 0) {
|
||||
const visibleChildren = menu.children.filter((child) => {
|
||||
const childRoute = allRoutes.find(r => r.name === child.key)
|
||||
return childRoute && !childRoute.meta?.hideInMenu
|
||||
})
|
||||
if (visibleChildren.length === 1) {
|
||||
return routerPushByKey(visibleChildren[0].key as RouteKey)
|
||||
}
|
||||
}
|
||||
|
||||
const query: Record<string, string> = {}
|
||||
|
||||
meta?.query?.forEach((item) => {
|
||||
@ -54,10 +72,10 @@ export function useRouterPush(inSetup = true) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate to login page
|
||||
* 跳转到登录页
|
||||
*
|
||||
* @param loginModule The login module
|
||||
* @param redirectUrl The redirect url, if not specified, it will be the current route fullPath
|
||||
* @param loginModule 登录模块
|
||||
* @param redirectUrl 重定向地址,若未指定,则为当前路由 fullPath
|
||||
*/
|
||||
async function toLogin(loginModule?: UnionKey.LoginModule, redirectUrl?: string) {
|
||||
const module = loginModule || 'pwd-login'
|
||||
@ -78,7 +96,7 @@ export function useRouterPush(inSetup = true) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle login module
|
||||
* 切换登录模块
|
||||
*
|
||||
* @param module
|
||||
*/
|
||||
@ -89,9 +107,9 @@ export function useRouterPush(inSetup = true) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect from login
|
||||
* 从登录页重定向
|
||||
*
|
||||
* @param [needRedirect] Whether to redirect after login. Default is `true`
|
||||
* @param [needRedirect] 登录后是否需要重定向。默认为 `true`
|
||||
*/
|
||||
async function redirectFromLogin(needRedirect = true) {
|
||||
const redirect = route.value.query?.redirect as string
|
||||
|
||||
Reference in New Issue
Block a user