chore: remove console && update components

This commit is contained in:
JaguarJack 2023-03-04 18:23:07 +08:00
parent 67545252fe
commit 8fe6d5c827
7 changed files with 22 additions and 23 deletions

View File

@ -5,18 +5,18 @@ const router: RouteRecordRaw[] = [
{ {
path: '/develop', path: '/develop',
component: () => import('/admin/layout/index.vue'), component: () => import('/admin/layout/index.vue'),
meta: { title: '开发工具', icon: 'wrench-screwdriver', hidden: false }, meta: { title: '开发工具', icon: 'wrench-screwdriver' },
children: [ children: [
{ {
path: 'modules', path: 'modules',
name: 'modules', name: 'modules',
meta: { title: '模块管理', icon: 'home', hidden: false }, meta: { title: '模块管理', icon: 'queue-list' },
component: () => import('./module/index.vue'), component: () => import('./module/index.vue'),
}, },
{ {
path: 'schemas', path: 'schemas',
name: 'schemas', name: 'schemas',
meta: { title: 'Schemas', icon: 'home', hidden: false }, meta: { title: 'Schemas', icon: 'list-bullet' },
component: () => import('./schema/index.vue'), component: () => import('./schema/index.vue'),
}, },
{ {

View File

@ -18,7 +18,6 @@ const next = () => {
active.value = 2 active.value = 2
} }
} }
console.log(123)
const prev = () => { const prev = () => {
if (active.value-- === 1) { if (active.value-- === 1) {
active.value = 1 active.value = 1

View File

@ -9,13 +9,13 @@ const router: RouteRecordRaw[] = [
children: [ children: [
{ {
path: 'index', path: 'index',
name: 'users', name: 'user-account',
meta: { title: '账号管理', icon: 'home' }, meta: { title: '账号管理', icon: 'home' },
component: () => import('./user/index.vue'), component: () => import('./user/index.vue'),
}, },
{ {
path: 'center', path: 'center',
name: 'center', name: 'user-center',
meta: { title: '个人中心', icon: 'home' }, meta: { title: '个人中心', icon: 'home' },
component: () => import('./user/center.vue'), component: () => import('./user/center.vue'),
}, },

View File

@ -23,23 +23,27 @@ watch(router.currentRoute, (newValue, oldValue) => {
if (newValue.meta.active_menu) { if (newValue.meta.active_menu) {
appStore.setActiveMenu(newValue.meta.active_menu) appStore.setActiveMenu(newValue.meta.active_menu)
} }
setActiveMenu(newValue)
getBreadcrumbs(newValue) getBreadcrumbs(newValue)
}) })
// get init breadcrumb // get init breadcrumb
onMounted(() => { onMounted(() => {
if (router.currentRoute.value.path !== '/') { setActiveMenu(router.currentRoute.value)
//
if (router.currentRoute.value.meta.active_menu) {
appStore.setActiveMenu(router.currentRoute.value.meta.active_menu)
} else {
appStore.setActiveMenu(router.currentRoute.value.path)
}
}
getBreadcrumbs(router.currentRoute.value) getBreadcrumbs(router.currentRoute.value)
}) })
const setActiveMenu = route => {
if (route.path !== '/') {
//
if (route.meta.active_menu) {
appStore.setActiveMenu(route.meta.active_menu)
} else {
appStore.setActiveMenu(route.path)
}
}
}
// get breadcrums // get breadcrums
function getBreadcrumbs(newRoute: RouteLocationNormalizedLoaded) { function getBreadcrumbs(newRoute: RouteLocationNormalizedLoaded) {
breadcrumbs.value = [] breadcrumbs.value = []

View File

@ -63,7 +63,6 @@ const uploaded = (blobInfo, progress) =>
params.append('image', blobInfo.blob()) params.append('image', blobInfo.blob())
Http.post(env('VITE_BASE_URL') + 'upload/image', params) Http.post(env('VITE_BASE_URL') + 'upload/image', params)
.then(res => { .then(res => {
console.log(res)
if (res.data.code === 10000) { if (res.data.code === 10000) {
resolve(res.data.data.path) resolve(res.data.data.path)
} else { } else {

View File

@ -7,9 +7,7 @@
</div> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu class="w-28"> <el-dropdown-menu class="w-28">
<el-dropdown-item> <el-dropdown-item> <Icon name="user" /> <router-link :to="{ name: 'user-center' }"> 个人信息</router-link> </el-dropdown-item>
<Icon name="user"/> <router-link to="/users/center"> 个人信息</router-link>
</el-dropdown-item>
<el-dropdown-item divided @click="logout"> <el-dropdown-item divided @click="logout">
<Icon name="power" className="mr-1 w-4 h-4" /> <Icon name="power" className="mr-1 w-4 h-4" />
退 退

View File

@ -43,11 +43,11 @@ const guard = (router: Router) => {
}) })
// 在动态路由之后挂载匹配 404 路由 // 在动态路由之后挂载匹配 404 路由
router.addRoute({ router.addRoute({
path: '/:pathMatch(.*)*', path: '/:pathMatch(.*)*',
redirect: '/404', redirect: '/404',
}) })
} }
next({ ...to, replace: true }); next({ ...to, replace: true })
} catch (e) { } catch (e) {
removeAuthToken() removeAuthToken()
next({ path: `${WhiteListPage.LOGIN_PATH}?redirect=/${to.path}` }) next({ path: `${WhiteListPage.LOGIN_PATH}?redirect=/${to.path}` })
@ -58,7 +58,6 @@ const guard = (router: Router) => {
} else { } else {
// 如果不在白名单 // 如果不在白名单
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
console.log(123)
next() next()
} else { } else {
next({ path: WhiteListPage.LOGIN_PATH }) next({ path: WhiteListPage.LOGIN_PATH })