diff --git a/ui/src/layout/app-main/index.vue b/ui/src/layout/app-main/index.vue new file mode 100644 index 000000000..1598772f2 --- /dev/null +++ b/ui/src/layout/app-main/index.vue @@ -0,0 +1,24 @@ + + + diff --git a/ui/src/layout/components/breadcrumb/index.vue b/ui/src/layout/components/breadcrumb/index.vue new file mode 100644 index 000000000..9140e8209 --- /dev/null +++ b/ui/src/layout/components/breadcrumb/index.vue @@ -0,0 +1,267 @@ + + + + + diff --git a/ui/src/layout/components/index.ts b/ui/src/layout/components/index.ts new file mode 100644 index 000000000..c6d38f7c4 --- /dev/null +++ b/ui/src/layout/components/index.ts @@ -0,0 +1,4 @@ +export { default as Sidebar } from './sidebar/index.vue' +export { default as AppMain } from './app-main/index.vue' +export { default as TopBar } from './top-bar/index.vue' +export { default as AppHeader } from './app-header/index.vue' diff --git a/ui/src/layout/components/sidebar/SidebarItem.vue b/ui/src/layout/components/sidebar/SidebarItem.vue new file mode 100644 index 000000000..f89feeda2 --- /dev/null +++ b/ui/src/layout/components/sidebar/SidebarItem.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/ui/src/layout/components/sidebar/index.vue b/ui/src/layout/components/sidebar/index.vue new file mode 100644 index 000000000..4fc452395 --- /dev/null +++ b/ui/src/layout/components/sidebar/index.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/ui/src/layout/hooks/useResize.ts b/ui/src/layout/hooks/useResize.ts new file mode 100644 index 000000000..3b0e46577 --- /dev/null +++ b/ui/src/layout/hooks/useResize.ts @@ -0,0 +1,38 @@ +import { nextTick, onBeforeMount, onMounted, onBeforeUnmount } from 'vue' +import { useRoute } from 'vue-router' +import useStore from '@/stores' +import { DeviceType } from '@/enums/common' +/** 参考 Bootstrap 的响应式设计 WIDTH = 768 */ +const WIDTH = 768 + +/** 根据大小变化重新布局 */ +export default () => { + const { common } = useStore() + const _isMobile = () => { + const rect = document.body?.getBoundingClientRect() + return rect.width - 1 < WIDTH + } + + const _resizeHandler = () => { + if (!document.hidden) { + const isMobile = _isMobile() + common.toggleDevice(isMobile ? DeviceType.Mobile : DeviceType.Desktop) + } + } + + onBeforeMount(() => { + window.addEventListener('resize', _resizeHandler) + }) + + onMounted(() => { + nextTick(() => { + if (_isMobile()) { + common.toggleDevice(DeviceType.Mobile) + } + }) + }) + + onBeforeUnmount(() => { + window.removeEventListener('resize', _resizeHandler) + }) +} diff --git a/ui/src/layout/layout-header/UserHeader.vue b/ui/src/layout/layout-header/UserHeader.vue new file mode 100644 index 000000000..b1ebb5328 --- /dev/null +++ b/ui/src/layout/layout-header/UserHeader.vue @@ -0,0 +1,23 @@ +· + + + diff --git a/ui/src/layout/layout-header/avatar/APIKeyDialog.vue b/ui/src/layout/layout-header/avatar/APIKeyDialog.vue new file mode 100644 index 000000000..a03337792 --- /dev/null +++ b/ui/src/layout/layout-header/avatar/APIKeyDialog.vue @@ -0,0 +1,164 @@ + + + diff --git a/ui/src/layout/layout-header/avatar/AboutDialog.vue b/ui/src/layout/layout-header/avatar/AboutDialog.vue new file mode 100644 index 000000000..59ecfc076 --- /dev/null +++ b/ui/src/layout/layout-header/avatar/AboutDialog.vue @@ -0,0 +1,143 @@ + + + diff --git a/ui/src/layout/layout-header/avatar/ResetPassword.vue b/ui/src/layout/layout-header/avatar/ResetPassword.vue new file mode 100644 index 000000000..35f538f1b --- /dev/null +++ b/ui/src/layout/layout-header/avatar/ResetPassword.vue @@ -0,0 +1,216 @@ + + + diff --git a/ui/src/layout/layout-header/avatar/index.vue b/ui/src/layout/layout-header/avatar/index.vue new file mode 100644 index 000000000..ac1fcbb9e --- /dev/null +++ b/ui/src/layout/layout-header/avatar/index.vue @@ -0,0 +1,140 @@ + + + diff --git a/ui/src/layout/layout-header/top-menu/MenuItem.vue b/ui/src/layout/layout-header/top-menu/MenuItem.vue new file mode 100644 index 000000000..946d1e544 --- /dev/null +++ b/ui/src/layout/layout-header/top-menu/MenuItem.vue @@ -0,0 +1,61 @@ + + + diff --git a/ui/src/layout/layout-header/top-menu/index.vue b/ui/src/layout/layout-header/top-menu/index.vue new file mode 100644 index 000000000..b8b7390ed --- /dev/null +++ b/ui/src/layout/layout-header/top-menu/index.vue @@ -0,0 +1,23 @@ + + + diff --git a/ui/src/layout/layout-header/top-url-menu/index.vue b/ui/src/layout/layout-header/top-url-menu/index.vue new file mode 100644 index 000000000..1981775d9 --- /dev/null +++ b/ui/src/layout/layout-header/top-url-menu/index.vue @@ -0,0 +1,48 @@ + + diff --git a/ui/src/layout/layout-template/AppLayout.vue b/ui/src/layout/layout-template/AppLayout.vue new file mode 100644 index 000000000..97c6771ec --- /dev/null +++ b/ui/src/layout/layout-template/AppLayout.vue @@ -0,0 +1,19 @@ + + + + diff --git a/ui/src/layout/layout-template/DetailLayout.vue b/ui/src/layout/layout-template/DetailLayout.vue new file mode 100644 index 000000000..9e1a6c201 --- /dev/null +++ b/ui/src/layout/layout-template/DetailLayout.vue @@ -0,0 +1,18 @@ + + + + diff --git a/ui/src/layout/layout-template/SystemLayout.vue b/ui/src/layout/layout-template/SystemLayout.vue new file mode 100644 index 000000000..41d6bb45d --- /dev/null +++ b/ui/src/layout/layout-template/SystemLayout.vue @@ -0,0 +1,24 @@ + + + + diff --git a/ui/src/layout/layout-template/index.scss b/ui/src/layout/layout-template/index.scss new file mode 100644 index 000000000..327f0c219 --- /dev/null +++ b/ui/src/layout/layout-template/index.scss @@ -0,0 +1,35 @@ +.app-layout { + background-color: var(--app-layout-bg-color); + height: 100%; +} + +.app-header { + background: var(--app-header-bg-color); + position: fixed; + width: 100%; + left: 0; + top: 0; + z-index: 100; +} + +.app-main { + position: relative; + height: 100%; + padding: var(--app-header-height) 0 0 !important; + box-sizing: border-box; + overflow: auto; + &.isExpire { + padding-top: calc(var(--app-header-height) + 40px) !important; + } +} + +.sidebar-container { + box-sizing: border-box; + transition: width 0.28s; + width: var(--sidebar-width); + min-width: var(--sidebar-width); + background-color: var(--sidebar-bg-color); +} +.view-container { + width: calc(100% - var(--sidebar-width)); +} diff --git a/ui/src/request/index.ts b/ui/src/request/index.ts index b7073e2f6..e67aa05ec 100644 --- a/ui/src/request/index.ts +++ b/ui/src/request/index.ts @@ -99,7 +99,6 @@ const promise: ( } request .then((response) => { - console.log(response) // blob类型的返回状态是response.status if (response.status === 200) { resolve(response?.data?.data || response) diff --git a/ui/src/router/modules/model.ts b/ui/src/router/modules/model.ts new file mode 100644 index 000000000..ff0f45e2b --- /dev/null +++ b/ui/src/router/modules/model.ts @@ -0,0 +1,17 @@ +const ModelRouter = { + path: '/model', + name: 'model', + meta: { title: 'views.model.title', permission: 'MODEL:READ' }, + redirect: '/model', + component: () => import('@/layout/layout-template/AppLayout.vue'), + children: [ + { + path: '/model', + name: 'model-index', + meta: { title: '模型主页', activeMenu: '/function-lib' }, + component: () => import('@/views/model/index.vue') + } + ] +} + +export default ModelRouter diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts index e32cf4b1f..dedec972b 100644 --- a/ui/src/router/routes.ts +++ b/ui/src/router/routes.ts @@ -1,12 +1,13 @@ import type { RouteRecordRaw } from 'vue-router' -// const modules: any = import.meta.glob('./modules/*.ts', { eager: true }) -// const rolesRoutes: RouteRecordRaw[] = [...Object.keys(modules).map((key) => modules[key].default)] +const modules: any = import.meta.glob('./modules/*.ts', { eager: true }) +const rolesRoutes: RouteRecordRaw[] = [...Object.keys(modules).map((key) => modules[key].default)] export const routes: Array = [ { path: '/', name: 'home', - component: () => import('@/views/HomeView.vue'), + redirect: '/model', + children: [...rolesRoutes], }, { @@ -17,12 +18,12 @@ export const routes: Array = [ { path: '/forget_password', name: 'ForgetPassword', - component: () => import('@/views/login/ForgetPassword.vue') + component: () => import('@/views/login/ForgetPassword.vue'), }, { path: '/reset_password/:code/:email', name: 'ResetPassword', - component: () => import('@/views/login/ResetPassword.vue') + component: () => import('@/views/login/ResetPassword.vue'), }, // { // path: '/:pathMatch(.*)', diff --git a/ui/src/stores/modules/login.ts b/ui/src/stores/modules/login.ts index 4cb12cb9b..024c8c601 100644 --- a/ui/src/stores/modules/login.ts +++ b/ui/src/stores/modules/login.ts @@ -34,7 +34,7 @@ const useLoginStore = defineStore('login', { this.token = ok.token localStorage.setItem('token', ok.token) const user = useUserStore() - return user.profile() + return user.profile(loading) }) }, }, diff --git a/ui/src/stores/modules/user.ts b/ui/src/stores/modules/user.ts index 528212b7d..d8ff185de 100644 --- a/ui/src/stores/modules/user.ts +++ b/ui/src/stores/modules/user.ts @@ -35,9 +35,9 @@ const useLoginStore = defineStore('user', { isDefaultTheme() { return !this.themeInfo?.theme || this.themeInfo?.theme === '#3370FF' }, - async profile() { - return UserApi.getUserProfile().then((ok) => { - this.userInfo = ok + async profile(loading?: Ref) { + return UserApi.getUserProfile(loading).then((ok: { data: User }) => { + this.userInfo = ok.data useLocalStorage(localeConfigKey, 'en-US').value = ok.data?.language || this.getLanguage() // return this.asyncGetProfile() diff --git a/ui/src/views/model/component/AddInternalFunctionDialog.vue b/ui/src/views/model/component/AddInternalFunctionDialog.vue new file mode 100644 index 000000000..2f6514bc4 --- /dev/null +++ b/ui/src/views/model/component/AddInternalFunctionDialog.vue @@ -0,0 +1,88 @@ + + + diff --git a/ui/src/views/model/component/EditAvatarDialog.vue b/ui/src/views/model/component/EditAvatarDialog.vue new file mode 100644 index 000000000..0b1c57f67 --- /dev/null +++ b/ui/src/views/model/component/EditAvatarDialog.vue @@ -0,0 +1,127 @@ + + + diff --git a/ui/src/views/model/component/FieldFormDialog.vue b/ui/src/views/model/component/FieldFormDialog.vue new file mode 100644 index 000000000..635382a72 --- /dev/null +++ b/ui/src/views/model/component/FieldFormDialog.vue @@ -0,0 +1,129 @@ + + + diff --git a/ui/src/views/model/component/FunctionDebugDrawer.vue b/ui/src/views/model/component/FunctionDebugDrawer.vue new file mode 100644 index 000000000..484e4d607 --- /dev/null +++ b/ui/src/views/model/component/FunctionDebugDrawer.vue @@ -0,0 +1,184 @@ + + + + diff --git a/ui/src/views/model/component/FunctionFormDrawer.vue b/ui/src/views/model/component/FunctionFormDrawer.vue new file mode 100644 index 000000000..8e2fb5df6 --- /dev/null +++ b/ui/src/views/model/component/FunctionFormDrawer.vue @@ -0,0 +1,518 @@ + + + + diff --git a/ui/src/views/model/component/InitParamDrawer.vue b/ui/src/views/model/component/InitParamDrawer.vue new file mode 100644 index 000000000..ec6db25c1 --- /dev/null +++ b/ui/src/views/model/component/InitParamDrawer.vue @@ -0,0 +1,97 @@ + + + + diff --git a/ui/src/views/model/component/InternalDescDrawer.vue b/ui/src/views/model/component/InternalDescDrawer.vue new file mode 100644 index 000000000..8940471da --- /dev/null +++ b/ui/src/views/model/component/InternalDescDrawer.vue @@ -0,0 +1,100 @@ + + + + diff --git a/ui/src/views/model/component/PermissionDialog.vue b/ui/src/views/model/component/PermissionDialog.vue new file mode 100644 index 000000000..829de9f07 --- /dev/null +++ b/ui/src/views/model/component/PermissionDialog.vue @@ -0,0 +1,106 @@ + + + diff --git a/ui/src/views/model/index.vue b/ui/src/views/model/index.vue new file mode 100644 index 000000000..d7c61fd6c --- /dev/null +++ b/ui/src/views/model/index.vue @@ -0,0 +1,623 @@ + + +