Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
feat(views): add about page
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Jan 26, 2022
1 parent dca3b4b commit 0a34802
Show file tree
Hide file tree
Showing 25 changed files with 668 additions and 492 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ env:
on:
push:
branches: [main]

jobs:
repo-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'

- name: Setup Node.js v14.x
uses: actions/setup-node@v1
with:
Expand Down
44 changes: 44 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399

declare module 'vue' {
export interface GlobalComponents {
ACard: typeof import('ant-design-vue/es')['Card'];
AForm: typeof import('ant-design-vue/es')['Form'];
AFormItem: typeof import('ant-design-vue/es')['FormItem'];
AInput: typeof import('ant-design-vue/es')['Input'];
AInputSearch: typeof import('ant-design-vue/es')['InputSearch'];
ALayout: typeof import('ant-design-vue/es')['Layout'];
ALayoutContent: typeof import('ant-design-vue/es')['LayoutContent'];
ALayoutSider: typeof import('ant-design-vue/es')['LayoutSider'];
BasicBasicHelp: typeof import('./src/components/basic/basic-help/index.vue')['default'];
BasicButtonButton: typeof import('./src/components/basic/button/button.vue')['default'];
BasicCheckBox: typeof import('./src/components/basic/check-box/index.vue')['default'];
BasicContextMenuSrcContextMenu: typeof import('./src/components/basic/context-menu/src/ContextMenu.vue')['default'];
BasicExcelSrcImportExcel: typeof import('./src/components/basic/excel/src/ImportExcel.vue')['default'];
BasicIconsSelect: typeof import('./src/components/basic/icons-select/index.vue')['default'];
BasicLocalePicker: typeof import('./src/components/basic/locale-picker/index.vue')['default'];
BasicLockscreen: typeof import('./src/components/basic/lockscreen/index.vue')['default'];
BasicLockscreenHuaweiCharge: typeof import('./src/components/basic/lockscreen/huawei-charge.vue')['default'];
BasicLockscreenLockscreen: typeof import('./src/components/basic/lockscreen/lockscreen.vue')['default'];
BasicLockscreenXiaomiCharge: typeof import('./src/components/basic/lockscreen/xiaomi-charge.vue')['default'];
BasicProgress: typeof import('./src/components/basic/progress/index.vue')['default'];
BasicSplitPanel: typeof import('./src/components/basic/split-panel/index.vue')['default'];
BasicSvgIconSvgIcon: typeof import('./src/components/basic/svg-icon/svg-icon.vue')['default'];
BasicTitleI18n: typeof import('./src/components/basic/title-i18n/index.vue')['default'];
CoreDraggableModal: typeof import('./src/components/core/draggable-modal/index.vue')['default'];
CoreDynamicTableComponentsQueryForm: typeof import('./src/components/core/dynamic-table/components/query-form/index.vue')['default'];
CoreDynamicTableComponentsTableAction: typeof import('./src/components/core/dynamic-table/components/table-action.vue')['default'];
CoreDynamicTableComponentsTableSettings: typeof import('./src/components/core/dynamic-table/components/table-settings/index.vue')['default'];
CoreDynamicTableComponentsTableSettingsColumnSetting: typeof import('./src/components/core/dynamic-table/components/table-settings/column-setting.vue')['default'];
CoreDynamicTableComponentsTableSettingsRefreshSetting: typeof import('./src/components/core/dynamic-table/components/table-settings/refresh-setting.vue')['default'];
CoreDynamicTableComponentsTableSettingsSizeSetting: typeof import('./src/components/core/dynamic-table/components/table-settings/size-setting.vue')['default'];
CoreDynamicTableComponentsToolBar: typeof import('./src/components/core/dynamic-table/components/tool-bar/index.vue')['default'];
CoreDynamicTableDynamicTable: typeof import('./src/components/core/dynamic-table/dynamic-table.vue')['default'];
CoreSchemaFormSchemaForm: typeof import('./src/components/core/schema-form/schema-form.vue')['default'];
CoreSchemaFormSchemaFormItem: typeof import('./src/components/core/schema-form/schema-form-item.vue')['default'];
}
}

export {};
60 changes: 34 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "vite-vue3-admin",
"version": "0.1.0",
"private": true,
"author": {
"name": "buqiyuan",
"email": "1743369777@qq.com",
"url": "https://github.com/buqiyuan"
},
"scripts": {
"serve": "npm run dev",
"dev": "vite",
Expand All @@ -18,67 +22,71 @@
"test:br": "npx http-server dist --cors --brotli -c-1"
},
"dependencies": {
"@vueuse/core": "^7.5.3",
"ant-design-vue": "3.0.0-beta.4",
"axios": "^0.24.0",
"core-js": "^3.20.2",
"@vueuse/core": "^7.5.5",
"ant-design-vue": "3.0.0-beta.8",
"axios": "^0.25.0",
"core-js": "^3.20.3",
"dayjs": "^1.10.7",
"file-saver": "^2.0.5",
"lodash-es": "^4.17.21",
"mitt": "^3.0.0",
"nprogress": "^1.0.0-1",
"pinia": "2.0.9",
"qs": "^6.10.2",
"qs": "^6.10.3",
"socket.io-client": "^4.4.1",
"sortablejs": "^1.14.0",
"vue": "^3.2.26",
"vue-i18n": "^9.2.0-beta.26",
"vue": "^3.2.29",
"vue-i18n": "^9.2.0-beta.29",
"vue-router": "^4.0.12",
"xlsx": "^0.17.4"
"xlsx": "^0.17.5"
},
"devDependencies": {
"@commitlint/cli": "^16.0.2",
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@types/lodash-es": "^4.17.5",
"@types/node": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"@types/node": "^17.0.12",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"@vitejs/plugin-legacy": "^1.6.4",
"@vitejs/plugin-vue": "^2.0.1",
"@vitejs/plugin-vue": "^2.1.0",
"@vitejs/plugin-vue-jsx": "^1.3.3",
"@vue/compiler-sfc": "^3.2.26",
"@vue/compiler-sfc": "^3.2.29",
"commitizen": "^4.2.4",
"cross-env": "^7.0.3",
"eslint": "^8.6.0",
"eslint": "^8.7.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.2.0",
"eslint-plugin-vue": "^8.3.0",
"gh-pages": "^3.2.3",
"husky": "^7.0.4",
"less": "^4.1.2",
"less-loader": "10.2.0",
"lint-staged": "^12.1.7",
"lint-staged": "^12.3.1",
"lodash-webpack-plugin": "^0.11.6",
"mockjs": "^1.1.0",
"postcss-html": "^1.3.0",
"prettier": "^2.5.1",
"stylelint": "^14.2.0",
"stylelint": "^14.3.0",
"stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^6.0.0",
"stylelint-config-standard": "^24.0.0",
"stylelint-order": "^5.0.0",
"typescript": "^4.5.4",
"unplugin-vue-components": "^0.17.11",
"vite": "^2.7.10",
"typescript": "^4.5.5",
"unplugin-vue-components": "^0.17.14",
"vite": "^2.7.13",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-svg-icons": "^1.1.0",
"vite-plugin-windicss": "^1.6.2",
"vue-eslint-parser": "^8.0.1",
"windicss": "^3.4.2"
"vite-plugin-windicss": "^1.6.3",
"vue-eslint-parser": "^8.2.0",
"windicss": "^3.4.3"
},
"__npminstall_done": false,
"homepage": "git@buqiyuan.github.io/vite-vue3-admin",
"repository": {
"type": "git",
"url": "https://github.com/buqiyuan/vue3-antd-admin"
},
"homepage": "https://buqiyuan.gitee.io/vite-vue3-admin",
"keywords": [
"vue",
"ant-design-vue",
Expand Down
37 changes: 0 additions & 37 deletions public/index.html

This file was deleted.

3 changes: 2 additions & 1 deletion src/components/core/draggable-modal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@
left: 0 !important;
width: 100% !important;
height: 100% !important;
max-width: 100vw !important;
}
.ant-modal-content {
width: 100% !important;
Expand Down Expand Up @@ -305,7 +306,7 @@
}
}
.ant-modal-content {
// width: ~'v-bind("props.width")px';
/* width: ~'v-bind("props.width")px'; */
display: flex;
flex-direction: column;
width: 100%;
Expand Down
7 changes: 5 additions & 2 deletions src/layout/header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@
<Avatar :src="userInfo.headImg" :alt="userInfo.name">{{ userInfo.name }}</Avatar>
<template #overlay>
<Menu>
<Menu.Item>
<div>个人中心</div>
<Menu.Item @click="$router.push({ name: 'account-about' })">
{{ $t('routes.account.about') }}
</Menu.Item>
<Menu.Item @click="$router.push({ name: 'account-settings' })">
{{ $t('routes.account.settings') }}
</Menu.Item>
<Menu.Divider />
<Menu.Item>
Expand Down
2 changes: 1 addition & 1 deletion src/layout/logo/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="logo">
<img src="@/assets/images/logo.png" alt="" />
<img src="~@/assets/images/logo.png" alt="" />
<h2 v-show="!collapsed" class="title">One Piece</h2>
</div>
</template>
Expand Down
10 changes: 8 additions & 2 deletions src/layout/menu/menu-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<TitleI18n :title="props.menuInfo?.meta?.title" />
</span>
</template>
<template v-for="item in props.menuInfo?.children" :key="item.name">
<template v-for="item in menuChildren" :key="item.name">
<!-- 递归生成菜单 -->
<MyMenuItem :menuInfo="item" />
</template>
Expand All @@ -34,7 +34,7 @@
</script>
<script setup lang="ts">
import { PropType } from 'vue';
import { type PropType, computed } from 'vue';
import { Menu } from 'ant-design-vue';
import type { RouteRecordRaw } from 'vue-router';
import { IconFont } from '@/components/basic/iconfont';
Expand All @@ -45,6 +45,12 @@
type: Object as PropType<RouteRecordRaw>,
},
});
const menuChildren = computed(() =>
[...(props.menuInfo?.children || [])].sort(
(a, b) => (a?.meta?.orderNum || 0) - (b?.meta?.orderNum || 0),
),
);
</script>
<style scoped></style>
23 changes: 14 additions & 9 deletions src/layout/menu/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import { Menu } from 'ant-design-vue';
import MenuItem from './menu-item.vue';
import { useUserStore } from '@/store/modules/user';
import { useRoute, useRouter } from 'vue-router';
import { type RouteRecordName, useRoute, useRouter } from 'vue-router';
import { LOGIN_NAME } from '@/router/constant';
const props = defineProps({
Expand All @@ -34,28 +34,33 @@
// 当前路由
const currentRoute = useRoute();
const router = useRouter();
const state = reactive({
openKeys: [] as (RouteRecordName | undefined)[],
selectedKeys: [currentRoute.name],
});
const menus = computed(() => userStore.menus);
const menus = computed(() =>
[...userStore.menus].sort((a, b) => (a?.meta?.orderNum || 0) - (b?.meta?.orderNum || 0)),
);
console.log('menus', menus.value);
// 根据activeMenu获取指定的menu
const getTargetMenuByActiveMenuName = (activeMenu: string) => {
return router.getRoutes().find((n) => [n.name, n.path].includes(activeMenu));
};
// 获取当前打开的子菜单
const getOpenKeys = () => {
function getOpenKeys() {
const meta = currentRoute.meta;
if (meta?.activeMenu) {
const targetMenu = getTargetMenuByActiveMenuName(meta.activeMenu);
return targetMenu?.meta?.namePath ?? [meta?.activeMenu];
}
return currentRoute.meta?.namePath ?? currentRoute.matched.slice(1).map((n) => n.name);
};
const state = reactive({
openKeys: getOpenKeys(),
selectedKeys: [currentRoute.name],
});
return meta?.hideInMenu
? state?.openKeys || []
: currentRoute.meta?.namePath ?? currentRoute.matched.slice(1).map((n) => n.name);
}
// 监听菜单收缩状态
watch(
Expand Down
4 changes: 4 additions & 0 deletions src/locales/lang/en-US/routes/account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
settings: 'settings',
about: 'about',
};
4 changes: 4 additions & 0 deletions src/locales/lang/zh-CN/routes/account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
settings: '个人设置',
about: '关于',
};
2 changes: 0 additions & 2 deletions src/publicPath.ts

This file was deleted.

33 changes: 33 additions & 0 deletions src/router/staticModules/account.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { type RouteRecordRaw } from 'vue-router';
import RouterView from '@/layout/routerView/index.vue';
import { t } from '@/hooks/useI18n';

const moduleName = 'account';

const routes: Array<RouteRecordRaw> = [
{
path: '/account',
component: RouterView,
redirect: '/account/settings',
meta: {
title: '个人中心',
hideInMenu: true,
},
children: [
{
path: 'settings',
name: `${moduleName}-settings`,
component: () => import('@/views/account/settings.vue'),
meta: { title: t('routes.account.settings'), hideInMenu: true },
},
{
path: 'about',
name: `${moduleName}-about`,
component: () => import('@/views/account/about.vue'),
meta: { title: t('routes.account.about'), hideInMenu: true },
},
],
},
];

export default routes;
3 changes: 2 additions & 1 deletion src/router/staticModules/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dashboard from './dashboard';
import demos from './demos';
import externaLink from './externa-link';
import account from './account';

export default [...dashboard, ...demos, ...externaLink];
export default [...dashboard, ...demos, ...externaLink, ...account];

0 comments on commit 0a34802

Please sign in to comment.