diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index 5f9f77a7..9c0924a0 100644 --- a/build/vite/plugin/index.ts +++ b/build/vite/plugin/index.ts @@ -4,6 +4,7 @@ import vueJsx from '@vitejs/plugin-vue-jsx'; import legacy from '@vitejs/plugin-legacy'; import purgeIcons from 'vite-plugin-purge-icons'; import windiCSS from 'vite-plugin-windicss'; +import vueSetupExtend from 'vite-plugin-vue-setup-extend'; import { configHtmlPlugin } from './html'; import { configPwaConfig } from './pwa'; import { configMockPlugin } from './mock'; @@ -29,6 +30,8 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { vue(), // have to vueJsx(), + // support name + vueSetupExtend(), ]; // vite-plugin-windicss diff --git a/build/vite/plugin/theme.ts b/build/vite/plugin/theme.ts index 0fff0710..c54f1a83 100644 --- a/build/vite/plugin/theme.ts +++ b/build/vite/plugin/theme.ts @@ -66,7 +66,7 @@ export function configThemePlugin(isBuild: boolean): Plugin[] { 'border-color-base': '#303030', // 'border-color-split': '#30363d', 'item-active-bg': '#111b26', - 'app-content-background': 'rgb(255 255 255 / 4%)', + 'app-content-background': '#1e1e1e', 'tree-node-selected-bg': '#11263c', 'alert-success-border-color': '#274916', diff --git a/package.json b/package.json index e5affac4..d01e16df 100644 --- a/package.json +++ b/package.json @@ -58,10 +58,10 @@ "vditor": "^3.8.6", "vue": "3.2.4", "vue-i18n": "9.1.7", + "vue-json-pretty": "1.8.1", "vue-router": "^4.0.11", "vue-types": "^4.0.3", - "xlsx": "^0.17.1", - "vue-json-pretty": "1.8.1" + "xlsx": "^0.17.1" }, "devDependencies": { "@commitlint/cli": "^13.1.0", @@ -102,7 +102,7 @@ "esno": "^0.9.1", "fs-extra": "^10.0.0", "http-server": "^13.0.1", - "husky": "^7.0.1", + "husky": "^7.0.2", "inquirer": "^8.1.2", "is-ci": "^3.0.0", "jest": "^27.0.6", @@ -121,17 +121,18 @@ "ts-jest": "^27.0.5", "ts-node": "^10.2.1", "typescript": "4.3.5", - "vite": "2.5.0", + "vite": "2.5.1", "vite-plugin-compression": "^0.3.5", "vite-plugin-html": "^2.1.0", "vite-plugin-imagemin": "^0.4.5", "vite-plugin-mock": "^2.9.6", "vite-plugin-purge-icons": "^0.7.0", - "vite-plugin-pwa": "^0.11.0", + "vite-plugin-pwa": "^0.11.2", "vite-plugin-style-import": "^1.2.1", "vite-plugin-svg-icons": "^1.0.4", "vite-plugin-theme": "^0.8.1", - "vite-plugin-windicss": "^1.2.8", + "vite-plugin-vue-setup-extend": "^0.1.0", + "vite-plugin-windicss": "^1.3.0", "vue-eslint-parser": "^7.10.0", "vue-tsc": "^0.3.0" }, diff --git a/src/components/CardList/index.ts b/src/components/CardList/index.ts new file mode 100644 index 00000000..b977c1b1 --- /dev/null +++ b/src/components/CardList/index.ts @@ -0,0 +1,4 @@ +import { withInstall } from '/@/utils'; +import cardList from './src/CardList.vue'; + +export const CardList = withInstall(cardList); diff --git a/src/components/CardList/src/CardList.vue b/src/components/CardList/src/CardList.vue new file mode 100644 index 00000000..310bed89 --- /dev/null +++ b/src/components/CardList/src/CardList.vue @@ -0,0 +1,178 @@ + + diff --git a/src/components/CardList/src/data.ts b/src/components/CardList/src/data.ts new file mode 100644 index 00000000..ac56cad9 --- /dev/null +++ b/src/components/CardList/src/data.ts @@ -0,0 +1,25 @@ +import { ref } from 'vue'; +//每行个数 +export const grid = ref(12); +// slider属性 +export const useSlider = (min = 6, max = 12) => { + // 每行显示个数滑动条 + const getMarks = () => { + const l = {}; + for (let i = min; i < max + 1; i++) { + l[i] = { + style: { + color: '#fff', + }, + label: i, + }; + } + return l; + }; + return { + min, + max, + marks: getMarks(), + step: 1, + }; +}; diff --git a/src/components/Markdown/src/Markdown.vue b/src/components/Markdown/src/Markdown.vue index 4026e21d..0727fb7b 100644 --- a/src/components/Markdown/src/Markdown.vue +++ b/src/components/Markdown/src/Markdown.vue @@ -90,6 +90,9 @@ theme: getDarkMode.value === 'dark' ? 'dark' : 'classic', lang: unref(getCurrentLang), mode: 'sv', + fullscreen: { + index: 520, + }, preview: { actions: [], }, diff --git a/src/components/Menu/src/BasicMenu.vue b/src/components/Menu/src/BasicMenu.vue index d4cfc82c..80cfd70a 100644 --- a/src/components/Menu/src/BasicMenu.vue +++ b/src/components/Menu/src/BasicMenu.vue @@ -126,9 +126,6 @@ emit('menuClick', key); isClickGo.value = true; - // const parentPath = await getCurrentParentPath(key); - - // menuState.openKeys = [parentPath]; menuState.selectedKeys = [key]; } diff --git a/src/components/Menu/src/components/BasicMenuItem.vue b/src/components/Menu/src/components/BasicMenuItem.vue index 3318b3c8..2a565627 100644 --- a/src/components/Menu/src/components/BasicMenuItem.vue +++ b/src/components/Menu/src/components/BasicMenuItem.vue @@ -1,13 +1,11 @@ diff --git a/src/components/Modal/src/index.less b/src/components/Modal/src/index.less index 3e476bdf..be64b204 100644 --- a/src/components/Modal/src/index.less +++ b/src/components/Modal/src/index.less @@ -19,7 +19,7 @@ width: 520px; padding-bottom: 0; - .scrollbar { + .ant-modal-body > .scrollbar { padding: 14px; } diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index f2cfc473..b584e73d 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -334,6 +334,13 @@ @prefix-cls: ~'@{namespace}-basic-table'; + [data-theme='dark'] { + .ant-table-tbody > tr:hover.ant-table-row-selected > td, + .ant-table-tbody > tr.ant-table-row-selected td { + background-color: #262626; + } + } + .@{prefix-cls} { max-width: 100%; diff --git a/src/components/registerGlobComp.ts b/src/components/registerGlobComp.ts index d44c618e..feb060e7 100644 --- a/src/components/registerGlobComp.ts +++ b/src/components/registerGlobComp.ts @@ -1,5 +1,4 @@ import type { App } from 'vue'; -// import { Icon } from './Icon'; import { Button } from './Button'; import { // Need diff --git a/src/locales/lang/en/routes/demo.ts b/src/locales/lang/en/routes/demo.ts index 5fb7950d..6941314f 100644 --- a/src/locales/lang/en/routes/demo.ts +++ b/src/locales/lang/en/routes/demo.ts @@ -45,6 +45,7 @@ export default { time: 'Relative Time', cropperImage: 'Cropper Image', + cardList: 'Card List', }, editor: { editor: 'Editor', diff --git a/src/locales/lang/zh-CN/routes/demo.ts b/src/locales/lang/zh-CN/routes/demo.ts index f3d439a8..4cadfd9b 100644 --- a/src/locales/lang/zh-CN/routes/demo.ts +++ b/src/locales/lang/zh-CN/routes/demo.ts @@ -44,6 +44,7 @@ export default { time: '相对时间', cropperImage: '图片裁剪', + cardList: '卡片列表', }, editor: { editor: '编辑器', diff --git a/src/router/guard/permissionGuard.ts b/src/router/guard/permissionGuard.ts index 09027b82..4d394142 100644 --- a/src/router/guard/permissionGuard.ts +++ b/src/router/guard/permissionGuard.ts @@ -29,14 +29,24 @@ export function createPermissionGuard(router: Router) { return; } + const token = userStore.getToken; + // Whitelist can be directly entered if (whitePathList.includes(to.path as PageEnum)) { + if (to.path === LOGIN_PATH && token) { + const isSessionTimeout = userStore.getSessionTimeout; + try { + await userStore.afterLoginAction(); + if (!isSessionTimeout) { + next((to.query?.redirect as string) || '/'); + return; + } + } catch {} + } next(); return; } - const token = userStore.getToken; - // token does not exist if (!token) { // You can access without permission. You need to set the routing meta.ignoreAuth to true diff --git a/src/router/routes/modules/demo/comp.ts b/src/router/routes/modules/demo/comp.ts index c7648ba7..88e21993 100644 --- a/src/router/routes/modules/demo/comp.ts +++ b/src/router/routes/modules/demo/comp.ts @@ -534,6 +534,14 @@ const comp: AppRouteModule = { title: t('routes.demo.comp.loading'), }, }, + { + path: 'cardList', + name: 'CardListDemo', + component: () => import('/@/views/demo/comp/card-list/index.vue'), + meta: { + title: t('routes.demo.comp.cardList'), + }, + }, ], }; diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 8260e549..b9fe9a6f 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -14,6 +14,7 @@ import { router } from '/@/router'; import { usePermissionStore } from '/@/store/modules/permission'; import { RouteRecordRaw } from 'vue-router'; import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; +import { isArray } from '/@/utils/is'; interface UserState { userInfo: Nullable; @@ -117,10 +118,15 @@ export const useUserStore = defineStore({ }, async getUserInfoAction(): Promise { const userInfo = await getUserInfo(); - const { roles } = userInfo; - const roleList = roles.map((item) => item.value) as RoleEnum[]; + const { roles = [] } = userInfo; + if (isArray(roles)) { + const roleList = roles.map((item) => item.value) as RoleEnum[]; + this.setRoleList(roleList); + } else { + userInfo.roles = []; + this.setRoleList([]); + } this.setUserInfo(userInfo); - this.setRoleList(roleList); return userInfo; }, /** diff --git a/src/views/demo/comp/card-list/index.vue b/src/views/demo/comp/card-list/index.vue new file mode 100644 index 00000000..f13af04c --- /dev/null +++ b/src/views/demo/comp/card-list/index.vue @@ -0,0 +1,32 @@ + + diff --git a/tests/server/package.json b/tests/server/package.json index a423e65c..d530d59f 100644 --- a/tests/server/package.json +++ b/tests/server/package.json @@ -29,7 +29,7 @@ "pm2": "^5.1.1", "rimraf": "^3.0.2", "ts-node": "^10.2.1", - "tsconfig-paths": "^3.10.1", + "tsconfig-paths": "^3.11.0", "tsup": "^4.14.0", "typescript": "^4.3.5" } diff --git a/windi.config.ts b/windi.config.ts index 97e4aad5..fa642bba 100644 --- a/windi.config.ts +++ b/windi.config.ts @@ -29,7 +29,7 @@ export default defineConfig({ * Used for animation when the element is displayed * @param maxOutput The larger the maxOutput output, the larger the generated css volume */ -function createEnterPlugin(maxOutput = 10) { +function createEnterPlugin(maxOutput = 8) { const createCss = (index: number, d = 'x') => { const upd = d.toUpperCase(); return {