feat: new feat

This commit is contained in:
JaguarJack 2023-01-11 17:21:16 +08:00
parent 2a1afa3e1a
commit dcd6b7a9d7
7 changed files with 22 additions and 23 deletions

View File

@ -1,6 +1,6 @@
<template>
<div :style="bgColor" class="flex flex-col w-full">
<img src="/admin/assets/404.png" class="w-full sm:w-3/5 m-auto" />
<img :src="notFound" class="w-full sm:w-3/5 m-auto" />
<div class="mr-auto w-full bottom-0 m-auto">
<div class="w-full text-center text-base text-gray-400">抱歉您访问的页面不存在</div>
<div @click="push('/')" class="text-center w-full mt-2">
@ -14,6 +14,7 @@
import { useRouter } from 'vue-router'
import { useAppStore } from '/admin/stores/modules/app'
import { computed } from 'vue'
import notFound from '/admin/assets/404.png'
const { push } = useRouter()

View File

@ -18,6 +18,8 @@ export function useCreate(path: string, id: string | number | null = null, _form
// 更新前 hook
const beforeUpdate = ref()
const afterCreate = ref()
// store
function store(path: string, id: string | number | null = null) {
loading.value = true
@ -41,6 +43,13 @@ export function useCreate(path: string, id: string | number | null = null, _form
if (r.data.code === Code.SUCCESS) {
isClose.value = true
Message.success(r.data.message)
// 创建后的操作
if (!id) {
if (isFunction(afterCreate.value)) {
afterCreate.value()
}
}
} else {
Message.error(r.data.message)
}
@ -72,5 +81,5 @@ export function useCreate(path: string, id: string | number | null = null, _form
})
}
return { formData, loading, form, submitForm, close, beforeCreate, beforeUpdate }
return { formData, loading, form, submitForm, close, beforeCreate, beforeUpdate, afterCreate }
}

View File

@ -1,11 +1,14 @@
import { RouteRecordRaw } from 'vue-router'
import { isUndefined } from '/admin/support/helper'
// @ts-ignore
export function getModuleRoutes() {
const modules = import.meta.glob('@/module/**/views/router.ts', { eager: true })
let moduleRoutes: RouteRecordRaw[] = []
Object.keys(modules).forEach(routePath => {
moduleRoutes = moduleRoutes.concat(modules[routePath].default)
if (!isUndefined(modules[routePath].default)) {
moduleRoutes = moduleRoutes.concat(modules[routePath].default)
}
})
return moduleRoutes

View File

@ -140,7 +140,7 @@ export const useUserStore = defineStore('UserStore', {
this.setStatus(status)
this.setAvatar(avatar)
this.setPermissions(permissions)
console.log(this.getAvatar)
resolve(response.data.data)
})
.catch(e => {

View File

@ -129,7 +129,7 @@ export const usePermissionsStore = defineStore('PermissionsStore', {
// menu
let importComponent
if (permission.type === MenuType.TOP_TYPE) {
importComponent = () => import('/admin/layout/index')
importComponent = () => import('/admin/layout/index.vue')
} else {
importComponent = viewComponents['/modules' + permission.component]
}

View File

@ -1,27 +1,15 @@
export interface Permission {
id: number
parent_id: number
permission_name: string
type: number
icon: string
component: string
module: string
permission_mark: string
route: string
redirect: string
keepAlive: boolean
hidden: boolean
is_inner: boolean
}

View File

@ -1,7 +1,5 @@
export default interface ResponseData{
code: number;
message: string;
data: any
export default interface ResponseData {
code: number
message: string
data: any
}