diff --git a/.env.test b/.env.test new file mode 100644 index 00000000..469b307d --- /dev/null +++ b/.env.test @@ -0,0 +1,36 @@ +NODE_ENV=production +# Whether to open mock +VITE_USE_MOCK = true + +# public path +VITE_PUBLIC_PATH = / + +# Delete console +VITE_DROP_CONSOLE = true + +# Whether to enable gzip or brotli compression +# Optional: gzip | brotli | none +# If you need multiple forms, you can use `,` to separate +VITE_BUILD_COMPRESS = 'none' + +# Whether to delete origin files when using compress, default false +VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false + +# Basic interface address SPA +VITE_GLOB_API_URL=/basic-api + +# File upload address, optional +# It can be forwarded by nginx or write the actual address directly +VITE_GLOB_UPLOAD_URL=/upload + +# Interface prefix +VITE_GLOB_API_URL_PREFIX= + +# Whether to enable image compression +VITE_USE_IMAGEMIN= true + +# use pwa +VITE_USE_PWA = false + +# Is it compatible with older browsers +VITE_LEGACY = false diff --git a/.eslintrc.js b/.eslintrc.js index d4c9c6cb..f2dbfa16 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -61,6 +61,7 @@ module.exports = defineConfig({ 'vue/singleline-html-element-content-newline': 'off', 'vue/attribute-hyphenation': 'off', 'vue/require-default-prop': 'off', + 'vue/script-setup-uses-vars': 'off', 'vue/html-self-closing': [ 'error', { diff --git a/.vscode/settings.json b/.vscode/settings.json index ac88043f..7addde02 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -130,6 +130,23 @@ "sider", "pinia", "sider", - "nprogress" + "nprogress", + "INTLIFY", + "stylelint", + "esno", + "vitejs", + "sortablejs", + "mockjs", + "codemirror", + "iconify", + "commitlint", + "vditor", + "echarts", + "cropperjs", + "logicflow", + "vueuse", + "zxcvbn", + "lintstagedrc", + "brotli" ] } diff --git a/CHANGELOG.en_US.md b/CHANGELOG.en_US.md index 7aaec5e1..2aab7bb8 100644 --- a/CHANGELOG.en_US.md +++ b/CHANGELOG.en_US.md @@ -1,3 +1,52 @@ +## 2.6.1(2021-07-19) + +### ✨ Features + +- **NoticeList** Add pagination, auto omit for overlength, title click event, title strikethrough, etc. +- **MixSider** Optimize the style of the bottom collapse button in the Mix menu layout to be consistent with the style of other menu layouts +- **ApiTreeSelect** Extend `TreeSelect` component of `antdv` to support remote data source, similar to `ApiSelect`. +- **BasicTable** New `ApiTreeSelect` editing component +- Different backend home pages can be specified for different users. + - Add `homePath` field (optional) to the user information returned by the `getUserInfo` interface to customize the home page path for the current user + +### 🐛 Bug Fixes + +- **BasicTable** + - Fix scrollbar style issue (removed scroll style patch) + - Fix the alignment problem of cells with expanded icons in tree tables + - Add `headerTop` slot. + - Fix the color display of the operation column button in disabled state. + - Repair the problem that the values of editable cells cannot be updated by modifying `dataSource` directly. + - Repair the problem of data replay when using `ApiSelect` to edit components. + - Repair the problem that editing components may report `onXXX` type error in some scenarios. +- **TableAction** + - Create Tooltip component only if `action.tooltip` exists. + - Fix the problem that the content of the round button inside the component is not centered +- **AppSearch** Fix the problem that the hidden menu may be searched. +- **BasicUpload** Repair the problem of error when handling non-`array` values. +- **Form** Repair the `suffix` slot style problem of `FormItem`. +- **Menu** + - Repair the hovering trigger logic of the left mixed menu + - Repair the problem that the top bar menu is wrong when displaying menu items that need to be hidden. + - Fix the left mixed menu in hover trigger mode will jump to route directly when there is no submenu and it is activated +- **Breadcrumb** Repair the problem that the menu with redirection cannot be jumped when clicked +- **Markdown** fixes an initialization exception and an issue where value was not set dynamically correctly +- **Modal** Make sure props are passed correctly +- **MultipleTab** fixes an issue that could accidentally create login route tabs +- **BasicTree** Fix the problem that the search function may cause `checkedKeys` to be lost +- **CodeEditor** Fix the problem that value does not support v-model usage. +- **CountdownInput** Fix the problem that `input` slot is not supported. +- **ApiSelect** Fix the problem that the `options-change` event parameter is not the standard `options` data used by `select +- **Other** + - Fix the problem that the configuration of default menu collapse does not work + - Repair the problem that `safari` browser reports an error and the website cannot be opened. + - Repair the problem that eslint keeps error due to endOfLine after pulling the code on window. + - Fix `Vue Router warn` caused by dynamic routing + +### 🎫 Chores + +- Add test environment test command + ## 2.6.0(2021-07-04) ### ✨ Features diff --git a/CHANGELOG.md b/CHANGELOG.md index 00ff5c44..0a8fdd97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,68 @@ +## [2.6.1](https://github.com/anncwb/vue-vben-admin/compare/v2.6.0...v2.6.1) (2021-07-19) + +### Bug Fixes + +- **api-select:** fix `options-change` event data ([897bed9](https://github.com/anncwb/vue-vben-admin/commit/897bed97295a0b9101d33102340749689a4368de)) +- **api-tree-select:** auto load data if necessary ([1b3058f](https://github.com/anncwb/vue-vben-admin/commit/1b3058f8253effe974feaf08a12250a111ab58c0)) +- **api-tree-select:** fix `event` checked in form ([d9d0071](https://github.com/anncwb/vue-vben-admin/commit/d9d00714011fa7914c61f990ce1159351ee21a1a)) +- **app-search:** exclude hidden items ([faf5c9f](https://github.com/anncwb/vue-vben-admin/commit/faf5c9fd7ea40c407419a5a5c473f9b0c32c2a53)) +- **app-search:** exclude items by `hideChildrenInMenu` ([02d3dca](https://github.com/anncwb/vue-vben-admin/commit/02d3dca57efedc1322ae38e3f432cf1f6c2cf839)) +- **basic-tree:** `checkedKeys` not worked with `search` ([b06a7ab](https://github.com/anncwb/vue-vben-admin/commit/b06a7ab77b99abee63dd55770ffd55b594ee42f9)), closes [#915](https://github.com/anncwb/vue-vben-admin/issues/915) +- **breadcrumb:** `redirect` not worked ([f5e31fe](https://github.com/anncwb/vue-vben-admin/commit/f5e31febbd18372a34166cac390b1d9b914fe80e)) +- **code-editor:** `value` not support use as `v-model` ([8832a07](https://github.com/anncwb/vue-vben-admin/commit/8832a074dceb44f057c87289d3a99feef58c08fd)), closes [#933](https://github.com/anncwb/vue-vben-admin/issues/933) +- **countdown-input:** add `slots` support ([a764a95](https://github.com/anncwb/vue-vben-admin/commit/a764a95ae9a6cff831f75aa97b00724cadc48e92)) +- **CountTo:** Fix displaying empty string when the value is 0 ([#864](https://github.com/anncwb/vue-vben-admin/issues/864)) ([82eb72b](https://github.com/anncwb/vue-vben-admin/commit/82eb72bbced931ba7f50069211f9511035ad09f4)) +- **demo:** `setup` page route config ([d5d5c4b](https://github.com/anncwb/vue-vben-admin/commit/d5d5c4b4bfb3e3a5e54f9993966adc46a09a8b90)) +- **demo:** add mock data `account detail` route ([993e19d](https://github.com/anncwb/vue-vben-admin/commit/993e19dcc319e2b4c68df2ab76174b7b4d7b0428)), closes [#858](https://github.com/anncwb/vue-vben-admin/issues/858) +- **demo:** fix display problem of editable table with `apiSelect` ([535bddd](https://github.com/anncwb/vue-vben-admin/commit/535bdddf91785e20295c18cf80c8a22cc2172681)) +- **demo:** form pages support `keepAlive` ([9228282](https://github.com/anncwb/vue-vben-admin/commit/9228282ae27daaa246f42e441e27b1b05eb30464)) +- **demo:** resolve `key not exist` warnings ([45a94e4](https://github.com/anncwb/vue-vben-admin/commit/45a94e41c1397b84d08373f84f766204d2488714)) +- **form:** fix `suffix` slot style ([a9bbed1](https://github.com/anncwb/vue-vben-admin/commit/a9bbed19739376ab2bf67a14b04e872f14ca84cc)) +- **formItem:** Fix labelcol type mismatch ([#903](https://github.com/anncwb/vue-vben-admin/issues/903)) ([03b17a8](https://github.com/anncwb/vue-vben-admin/commit/03b17a8f8bdb50322aa10e3b614bcc40b9e9dcc8)) +- **markdown:** resolving markdown exceptions ([d95815b](https://github.com/anncwb/vue-vben-admin/commit/d95815b5031984e224140eb1b1d46e2dbf80abc1)) +- **markdown:** set `value` error ([35e1347](https://github.com/anncwb/vue-vben-admin/commit/35e1347029e29a83a9648b6b398e6863cc40fca9)) +- **menu:** display error when contains hidden items ([5ceeefd](https://github.com/anncwb/vue-vben-admin/commit/5ceeefd17d9ddc0e8844b900069b100f24d9c00e)) +- **menu:** fix mix-menu incorrect jumping in `hover` mode ([cad021c](https://github.com/anncwb/vue-vben-admin/commit/cad021c34b71fa109640af75a0c2b72179e9e257)) +- **mix-sider:** fix mix-sider hover logic ([0595a72](https://github.com/anncwb/vue-vben-admin/commit/0595a72da9c666af81a0916663e8e6a014e6fa69)) +- **modal:** ensure that props are passed correctly,fix [#897](https://github.com/anncwb/vue-vben-admin/issues/897) ([ae7821e](https://github.com/anncwb/vue-vben-admin/commit/ae7821e29690bea8934ea724bfd0ae4e2cf30c77)) +- **modal:** fixed `fullscreen` not worked ([5baaa58](https://github.com/anncwb/vue-vben-admin/commit/5baaa58581f22a915cda9fa39e4cb9f094254d3b)), closes [#918](https://github.com/anncwb/vue-vben-admin/issues/918) +- **model:** auto validate on value change ([f844017](https://github.com/anncwb/vue-vben-admin/commit/f8440175f35076073c9f53483cf6c0164d427ff4)), closes [#920](https://github.com/anncwb/vue-vben-admin/issues/920) +- **table:** fix index column style ([c7c0a7e](https://github.com/anncwb/vue-vben-admin/commit/c7c0a7e4c88a895000b1621981e4d4b2020c64b1)) +- **table:** `value` show problem in editable cell ([61ce25b](https://github.com/anncwb/vue-vben-admin/commit/61ce25be1b40d7a0e26205ca6a6757c6c43fc21e)), closes [#922](https://github.com/anncwb/vue-vben-admin/issues/922) +- **table-action:** fixed icon `margin` without label ([dc51e6a](https://github.com/anncwb/vue-vben-admin/commit/dc51e6a8d4e4f2c97b387b37959944c9bb49d779)) +- **tree:** fixed `checkedKeys` with `search` mode ([f707541](https://github.com/anncwb/vue-vben-admin/commit/f707541dda78146bda89814ddccbb259d9f5d8a2)) +- fix homePage affix error ([c117802](https://github.com/anncwb/vue-vben-admin/commit/c1178027f0fab2791d02efcd7c52beff5fc7dc25)) +- **table-action:** fix `circle` button style ([db7254a](https://github.com/anncwb/vue-vben-admin/commit/db7254a5e0ac6d10a7ea37334ad523b150facb19)) +- `menuSetting` can not set collapsed to false as default ([808291b](https://github.com/anncwb/vue-vben-admin/commit/808291b503d59e3026f5f0b5e7a38b9c69bcc451)) +- ensure PAGE_NOT_FOUND_ROUTE exist ([87583c8](https://github.com/anncwb/vue-vben-admin/commit/87583c8b54d335ddf1c416859ef62bbde189c809)) +- ensure that safari is running properly, fix [#875](https://github.com/anncwb/vue-vben-admin/issues/875) ([dafcdd8](https://github.com/anncwb/vue-vben-admin/commit/dafcdd898caae57104f1155b0ec660ea333e7b19)) +- infinite redirect in `BACK` mode ([4b46a84](https://github.com/anncwb/vue-vben-admin/commit/4b46a84c2b85e8da799426c54b3381ae93183db4)) +- **multiple-tab:** ignore login page ([1e63379](https://github.com/anncwb/vue-vben-admin/commit/1e63379088e1d7c823f29f607ab49d62ca22cb25)) +- resolving `Vue Router warn` ([237e65e](https://github.com/anncwb/vue-vben-admin/commit/237e65eac909368c4b4857da6c8deb1dc18e7684)) +- **table:** fix tree node align ([1e61da6](https://github.com/anncwb/vue-vben-admin/commit/1e61da644f65a79ce10fde98ee017aba7d36be10)), closes [#829](https://github.com/anncwb/vue-vben-admin/issues/829) +- **table:** scrollbar style ([d8c3820](https://github.com/anncwb/vue-vben-admin/commit/d8c38207c08510d805a8dc66ffbba210e0cf4215)) +- **table-action:** incorrect button color of `disabled` state ([0f28e80](https://github.com/anncwb/vue-vben-admin/commit/0f28e803d0b65537216cd9f40ad5cad63c20db9b)), closes [#891](https://github.com/anncwb/vue-vben-admin/issues/891) +- **upload:** ensure the value type is correct ([05329ce](https://github.com/anncwb/vue-vben-admin/commit/05329ce9501eb899a0bbb45320e5807c83372317)) +- **useWatermark:** fix `func` call `createWatermark` call `clear` to resizeEvent removed ([#901](https://github.com/anncwb/vue-vben-admin/issues/901)) ([a1d956d](https://github.com/anncwb/vue-vben-admin/commit/a1d956d3697cd07e0ba8910768f2a73e55f18491)) + +### Features + +- **api-tree-select:** add `api` options to tree-select ([d81db89](https://github.com/anncwb/vue-vben-admin/commit/d81db890dfeb533d60f378ddb86f8ac50a31252b)) +- **basic-table:** add `ApiTreeSelect` edit component ([52af1dd](https://github.com/anncwb/vue-vben-admin/commit/52af1dd0d494e66c0af20f886dcc2b983cbb096f)) +- **demo:** multi-modal in one page usage ([7a7dab0](https://github.com/anncwb/vue-vben-admin/commit/7a7dab0c4b3602b7bd3e9381408e4168d7494c52)) +- customized user home page ([0a3683a](https://github.com/anncwb/vue-vben-admin/commit/0a3683a186ab55d34a12a5a3c6d794dfa1094ad4)) +- **api-select:** clear options before fetch ([9cf070d](https://github.com/anncwb/vue-vben-admin/commit/9cf070dd6305bb69a67ab6be85ef00bddc86fda0)) +- **demo:** add basicTree with async data expand all ([5421211](https://github.com/anncwb/vue-vben-admin/commit/542121129eb5bf65f61e7b484835591756c80f04)) +- **demo:** add search demo for apiSelect ([41e6d94](https://github.com/anncwb/vue-vben-admin/commit/41e6d94b3b64dc0d40b7ec57ecfaa4d966f202ae)) +- **demo:** demo default expanded tree table ([5f1a6cd](https://github.com/anncwb/vue-vben-admin/commit/5f1a6cdc599d5840df2dfebdaad029aac093cd81)) +- **notice-list:** add `pagination` support ([c16be2c](https://github.com/anncwb/vue-vben-admin/commit/c16be2c499d90126dfa35d699da9294c21a4ab48)), closes [#894](https://github.com/anncwb/vue-vben-admin/issues/894) +- **table:** add `headerTop` slot ([540423e](https://github.com/anncwb/vue-vben-admin/commit/540423ecf741a815d28d7a6baa1541ac884efe95)), closes [#881](https://github.com/anncwb/vue-vben-admin/issues/881) + +### Performance Improvements + +- **menu:** Optimize the style of the bottom collapse button in the Mix menu layout ([#896](https://github.com/anncwb/vue-vben-admin/issues/896)) ([6f83070](https://github.com/anncwb/vue-vben-admin/commit/6f830703a2607c33e5d25d6d17d0e453fc2fac2e)) +- image compression configuration optimization ([cf840e3](https://github.com/anncwb/vue-vben-admin/commit/cf840e3e73b9572de0ba7bf7b32d83f6a353a8ad)) + # [2.6.0](https://github.com/anncwb/vue-vben-admin/compare/v2.5.2...v2.6.0) (2021-07-04) ### Bug Fixes diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index c4415288..d8671f91 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -1,3 +1,52 @@ +## 2.6.1(2021-07-19) + +### ✨ Features + +- **NoticeList** 添加分页、超长自动省略、标题点击事件、标题删除线等功能 +- **MixSider** 优化 Mix 菜单布局时 底部折叠按钮 的样式,与其它菜单布局时的风格保持一致 +- **ApiTreeSelect** 扩展`antdv`的`TreeSelect`组件,支持远程数据源,用法类似`ApiSelect` +- **BasicTable** 新增`ApiTreeSelect`编辑组件 +- 可以为不同的用户指定不同的后台首页: + - 在`getUserInfo`接口返回的用户信息中增加`homePath`字段(可选)即可为当前用户定制首页路径 + +### 🐛 Bug Fixes + +- **BasicTable** + - 修复滚动条样式问题(移除了滚动样式补丁) + - 修复树形表格的带有展开图标的单元格的内容对齐问题 + - 新增`headerTop`插槽 + - 修复操作列的按钮在 disabled 状态下的颜色显示 + - 修复可编辑单元格的值不能直接通过修改`dataSource`来更新显示的问题 + - 修复使用`ApiSelect`编辑组件时的数据回显问题 + - 修复在部分场景下编辑组件可能会报`onXXX`类型错误的问题 +- **TableAction** + - 仅在 `action.tooltip`存在的情况下 才创建 Tooltip 组件 + - 修复组件内的圆形按钮内容没有居中的问题 +- **AppSearch** 修复可能会搜索隐藏菜单的问题 +- **BasicUpload** 修复处理非`array`值时报错的问题 +- **Form** 修复`FormItem`的`suffix`插槽样式问题 +- **Menu** + - 修复左侧混合菜单的悬停触发逻辑 + - 修复顶栏菜单在显示包含需要隐藏的菜单项目时出错的问题 + - 修复悬停触发模式下左侧混合菜单会在没有子菜单且被激活时直接跳转路由 +- **Breadcrumb** 修复带有重定向的菜单点击无法跳转的问题 +- **Markdown** 修复初始化异常以及不能正确地动态设置 value 的问题 +- **Modal** 确保 props 正确被传递 +- **MultipleTab** 修复可能会意外创建登录路由标签的问题 +- **BasicTree** 修复搜索功能可能导致`checkedKeys`丢失的问题 +- **CodeEditor** 修复 value 不支持 v-model 用法的问题 +- **CountdownInput** 修复不支持`input`插槽的问题 +- **ApiSelect** 修复`options-change`事件参数不是`select`所使用的标准`options`数据的问题 +- **其它** + - 修复菜单默认折叠的配置不起作用的问题 + - 修复`safari`浏览器报错导致网站打不开 + - 修复在 window 上,拉取代码后 eslint 因 endOfLine 而保错问题 + - 修复因动态路由而产生的 `Vue Router warn` + +### 🎫 Chores + +- 添加 test 环境测试命令 + ## 2.6.0(2021-07-04) ### ✨ Features diff --git a/build/utils.ts b/build/utils.ts index 4a0ce500..f610363b 100644 --- a/build/utils.ts +++ b/build/utils.ts @@ -44,7 +44,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv { */ function getConfFiles() { const script = process.env.npm_lifecycle_script; - const reg = new RegExp('--mode ([a-z]+) '); + const reg = new RegExp('--mode ([a-z]+)'); const result = reg.exec(script as string) as any; if (result) { const mode = result[1] as string; diff --git a/build/vite/plugin/imagemin.ts b/build/vite/plugin/imagemin.ts index 31bd387c..fb086167 100644 --- a/build/vite/plugin/imagemin.ts +++ b/build/vite/plugin/imagemin.ts @@ -13,7 +13,7 @@ export function configImageminPlugin() { optimizationLevel: 7, }, mozjpeg: { - quality: 8, + quality: 20, }, pngquant: { quality: [0.8, 0.9], @@ -22,10 +22,11 @@ export function configImageminPlugin() { svgo: { plugins: [ { - removeViewBox: false, + name: 'removeViewBox', }, { - removeEmptyAttrs: false, + name: 'removeEmptyAttrs', + active: false, }, ], }, diff --git a/commitlint.config.js b/commitlint.config.js index 7189e8f8..ac977af1 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,31 +1,6 @@ module.exports = { ignores: [(commit) => commit.includes('init')], extends: ['@commitlint/config-conventional'], - parserPreset: { - parserOpts: { - headerPattern: /^(\w*|[\u4e00-\u9fa5]*)(?:[\(\(](.*)[\)\)])?[\:\:] (.*)/, - headerCorrespondence: ['type', 'scope', 'subject'], - referenceActions: [ - 'close', - 'closes', - 'closed', - 'fix', - 'fixes', - 'fixed', - 'resolve', - 'resolves', - 'resolved', - ], - issuePrefixes: ['#'], - noteKeywords: ['BREAKING CHANGE'], - fieldPattern: /^-(.*?)-$/, - revertPattern: /^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\./, - revertCorrespondence: ['header', 'hash'], - warn() {}, - mergePattern: null, - mergeCorrespondence: null, - }, - }, rules: { 'body-leading-blank': [2, 'always'], 'footer-leading-blank': [1, 'always'], diff --git a/mock/demo/select-demo.ts b/mock/demo/select-demo.ts index 49692292..fc35a395 100644 --- a/mock/demo/select-demo.ts +++ b/mock/demo/select-demo.ts @@ -1,28 +1,28 @@ import { MockMethod } from 'vite-plugin-mock'; import { resultSuccess } from '../_util'; -const list: any[] = []; -const demoList = (() => { +const demoList = (keyword) => { const result = { - list: list, + list: [] as any[], }; for (let index = 0; index < 20; index++) { result.list.push({ - name: `选项${index}`, + name: `${keyword ?? ''}选项${index}`, id: `${index}`, }); } return result; -})(); +}; export default [ { url: '/basic-api/select/getDemoOptions', timeout: 1000, - method: 'post', + method: 'get', response: ({ query }) => { - console.log(query); - return resultSuccess(demoList); + const { keyword } = query; + console.log(keyword); + return resultSuccess(demoList(keyword)); }, }, ] as MockMethod[]; diff --git a/mock/demo/tree-demo.ts b/mock/demo/tree-demo.ts new file mode 100644 index 00000000..6fdcb859 --- /dev/null +++ b/mock/demo/tree-demo.ts @@ -0,0 +1,38 @@ +import { MockMethod } from 'vite-plugin-mock'; +import { resultSuccess } from '../_util'; + +const demoTreeList = (keyword) => { + const result = { + list: [] as Recordable[], + }; + for (let index = 0; index < 5; index++) { + const children: Recordable[] = []; + for (let j = 0; j < 3; j++) { + children.push({ + title: `${keyword ?? ''}选项${index}-${j}`, + value: `${index}-${j}`, + key: `${index}-${j}`, + }); + } + result.list.push({ + title: `${keyword ?? ''}选项${index}`, + value: `${index}`, + key: `${index}`, + children, + }); + } + return result; +}; + +export default [ + { + url: '/basic-api/tree/getDemoOptions', + timeout: 1000, + method: 'get', + response: ({ query }) => { + const { keyword } = query; + console.log(keyword); + return resultSuccess(demoTreeList(keyword)); + }, + }, +] as MockMethod[]; diff --git a/mock/sys/menu.ts b/mock/sys/menu.ts index bc7bfe02..1c47e667 100644 --- a/mock/sys/menu.ts +++ b/mock/sys/menu.ts @@ -5,13 +5,40 @@ import { createFakeUserList } from './user'; // single const dashboardRoute = { path: '/dashboard', - name: 'Welcome', - component: '/dashboard/analysis/index', + name: 'Dashboard', + component: 'LAYOUT', + redirect: '/dashboard/analysis', meta: { - title: 'routes.dashboard.analysis', - affix: true, + title: 'routes.dashboard.dashboard', + hideChildrenInMenu: true, icon: 'bx:bx-home', }, + children: [ + { + path: 'analysis', + name: 'Analysis', + component: '/dashboard/analysis/index', + meta: { + hideMenu: true, + hideBreadcrumb: true, + title: 'routes.dashboard.analysis', + currentActiveMenu: '/dashboard', + icon: 'bx:bx-home', + }, + }, + { + path: 'workbench', + name: 'Workbench', + component: '/dashboard/workbench/index', + meta: { + hideMenu: true, + hideBreadcrumb: true, + title: 'routes.dashboard.workbench', + currentActiveMenu: '/dashboard', + icon: 'bx:bx-home', + }, + }, + ], }; const backRoute = { @@ -128,6 +155,18 @@ const sysRoute = { }, component: '/demo/system/account/index', }, + { + path: 'account_detail/:id', + name: 'AccountDetail', + meta: { + hideMenu: true, + title: 'routes.demo.system.account_detail', + ignoreKeepAlive: true, + showMenu: false, + currentActiveMenu: '/system/account', + }, + component: '/demo/system/account/AccountDetail', + }, { path: 'role', name: 'RoleManagement', @@ -211,12 +250,21 @@ export default [ return resultError('Invalid user token!'); } const id = checkUser.userId; - if (!id || id === '1') { - return resultSuccess([dashboardRoute, authRoute, levelRoute, sysRoute, linkRoute]); - } - if (id === '2') { - return resultSuccess([dashboardRoute, authRoute, levelRoute, linkRoute]); + let menu: Object[]; + switch (id) { + case '1': + dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[0].path; + menu = [dashboardRoute, authRoute, levelRoute, sysRoute, linkRoute]; + break; + case '2': + dashboardRoute.redirect = dashboardRoute.path + '/' + dashboardRoute.children[1].path; + menu = [dashboardRoute, authRoute, levelRoute, linkRoute]; + break; + default: + menu = []; } + + return resultSuccess(menu); }, }, ] as MockMethod[]; diff --git a/mock/sys/user.ts b/mock/sys/user.ts index f5447222..a8608f1b 100644 --- a/mock/sys/user.ts +++ b/mock/sys/user.ts @@ -11,6 +11,7 @@ export function createFakeUserList() { desc: 'manager', password: '123456', token: 'fakeToken1', + homePath: '/dashboard/analysis', roles: [ { roleName: 'Super Admin', @@ -26,6 +27,7 @@ export function createFakeUserList() { avatar: 'https://q1.qlogo.cn/g?b=qq&nk=339449197&s=640', desc: 'tester', token: 'fakeToken2', + homePath: '/dashboard/workbench', roles: [ { roleName: 'Tester', diff --git a/package.json b/package.json index 941ff4ab..b5e2530c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vben-admin", - "version": "2.6.0", + "version": "2.6.1", "author": { "name": "vben", "email": "anncwb@126.com", @@ -11,6 +11,7 @@ "serve": "npm run dev", "dev": "vite", "build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", + "build:test": "cross-env vite build --mode test && esno ./build/script/postBuild.ts", "build:no-cache": "yarn clean:cache && npm run build", "report": "cross-env REPORT=true npm run build", "type:check": "vue-tsc --noEmit --skipLibCheck", @@ -20,7 +21,7 @@ "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite", "clean:lib": "rimraf node_modules", "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", - "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", + "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", "lint:pretty": "pretty-quick --staged", @@ -34,11 +35,11 @@ }, "dependencies": { "@iconify/iconify": "^2.0.3", - "@logicflow/core": "^0.5.0", - "@logicflow/extension": "^0.5.0", - "@vueuse/core": "^5.0.3", + "@logicflow/core": "^0.6.1", + "@logicflow/extension": "^0.6.1", + "@vueuse/core": "^5.1.4", "@zxcvbn-ts/core": "^1.0.0-beta.0", - "ant-design-vue": "2.2.0-rc.1", + "ant-design-vue": "2.2.2", "axios": "^0.21.1", "crypto-js": "^4.0.0", "echarts": "^5.1.2", @@ -46,11 +47,11 @@ "mockjs": "^1.1.0", "nprogress": "^0.2.0", "path-to-regexp": "^6.2.0", - "pinia": "^2.0.0-beta.3", + "pinia": "^2.0.0-beta.5", "qrcode": "^1.4.4", "resize-observer-polyfill": "^1.5.1", - "sortablejs": "^1.13.0", - "vue": "3.1.4", + "sortablejs": "^1.14.0", + "vue": "3.1.5", "vue-i18n": "9.1.6", "vue-router": "^4.0.10", "vue-types": "^4.0.0" @@ -58,79 +59,79 @@ "devDependencies": { "@commitlint/cli": "^12.1.4", "@commitlint/config-conventional": "^12.1.4", - "@iconify/json": "^1.1.369", + "@iconify/json": "^1.1.374", "@purge-icons/generated": "^0.7.0", - "@types/codemirror": "^5.60.1", - "@types/crypto-js": "^4.0.1", - "@types/fs-extra": "^9.0.11", - "@types/inquirer": "^7.3.2", - "@types/intro.js": "^3.0.1", - "@types/jest": "^26.0.23", + "@types/codemirror": "^5.60.2", + "@types/crypto-js": "^4.0.2", + "@types/fs-extra": "^9.0.12", + "@types/inquirer": "^7.3.3", + "@types/intro.js": "^3.0.2", + "@types/jest": "^26.0.24", "@types/lodash-es": "^4.17.4", - "@types/mockjs": "^1.0.3", - "@types/node": "^16.0.0", + "@types/mockjs": "^1.0.4", + "@types/node": "^16.3.3", "@types/nprogress": "^0.2.0", - "@types/qrcode": "^1.4.0", - "@types/qs": "^6.9.6", - "@types/sortablejs": "^1.10.6", - "@typescript-eslint/eslint-plugin": "^4.28.1", - "@typescript-eslint/parser": "^4.28.1", - "@vitejs/plugin-legacy": "^1.4.3", - "@vitejs/plugin-vue": "^1.2.4", + "@types/qrcode": "^1.4.1", + "@types/qs": "^6.9.7", + "@types/sortablejs": "^1.10.7", + "@typescript-eslint/eslint-plugin": "^4.28.3", + "@typescript-eslint/parser": "^4.28.3", + "@vitejs/plugin-legacy": "^1.4.4", + "@vitejs/plugin-vue": "^1.2.5", "@vitejs/plugin-vue-jsx": "^1.1.6", - "@vue/compiler-sfc": "3.1.4", - "@vue/test-utils": "^2.0.0-rc.9", - "autoprefixer": "^10.2.6", + "@vue/compiler-sfc": "3.1.5", + "@vue/test-utils": "^2.0.0-rc.10", + "autoprefixer": "^10.3.1", "commitizen": "^4.2.4", "conventional-changelog-cli": "^2.1.1", "cross-env": "^7.0.3", "dotenv": "^10.0.0", - "eslint": "^7.30.0", + "eslint": "^7.31.0", "eslint-config-prettier": "^8.3.0", "eslint-define-config": "^1.0.9", "eslint-plugin-jest": "^24.3.6", "eslint-plugin-prettier": "^3.4.0", - "eslint-plugin-vue": "^7.12.1", + "eslint-plugin-vue": "^7.14.0", "esno": "^0.7.3", "fs-extra": "^10.0.0", "http-server": "^0.12.3", - "husky": "^7.0.0", - "inquirer": "^8.1.1", + "husky": "^7.0.1", + "inquirer": "^8.1.2", "is-ci": "^3.0.0", "jest": "^27.0.6", "less": "^4.1.1", - "lint-staged": "^11.0.0", + "lint-staged": "^11.0.1", "npm-run-all": "^4.1.5", "postcss": "^8.3.5", "prettier": "^2.3.2", "pretty-quick": "^3.1.1", "rimraf": "^3.0.2", - "rollup-plugin-visualizer": "5.5.1", + "rollup-plugin-visualizer": "5.5.2", "stylelint": "^13.13.1", "stylelint-config-prettier": "^8.0.2", "stylelint-config-standard": "^22.0.0", "stylelint-order": "^4.1.0", "tailwindcss": "^2.2.4", "ts-jest": "^27.0.3", - "ts-node": "^10.0.0", + "ts-node": "^10.1.0", "typescript": "4.3.5", - "vite": "2.4.0-beta.2", - "vite-plugin-compression": "^0.2.5", + "vite": "2.3.6", + "vite-plugin-compression": "^0.3.1", "vite-plugin-html": "^2.0.7", - "vite-plugin-imagemin": "^0.3.2", - "vite-plugin-mock": "^2.8.0", + "vite-plugin-imagemin": "^0.4.1", + "vite-plugin-mock": "^2.9.3", "vite-plugin-purge-icons": "^0.7.0", "vite-plugin-pwa": "^0.8.1", "vite-plugin-style-import": "^1.0.1", - "vite-plugin-svg-icons": "^1.0.0", + "vite-plugin-svg-icons": "^1.0.1", "vite-plugin-theme": "^0.8.1", - "vue-eslint-parser": "^7.7.2", - "vue-tsc": "^0.2.0" + "vue-eslint-parser": "^7.9.0", + "vue-tsc": "^0.2.1" }, "resolutions": { "//": "Used to install imagemin dependencies, because imagemin may not be installed in China. If it is abroad, you can delete it", "bin-wrapper": "npm:bin-wrapper-china", - "rollup": "^2.52.7" + "rollup": "^2.53.2" }, "repository": { "type": "git", diff --git a/prettier.config.js b/prettier.config.js index 0c20bc90..b4e993ae 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -15,6 +15,6 @@ module.exports = { requirePragma: false, proseWrap: 'never', htmlWhitespaceSensitivity: 'strict', - endOfLine: 'lf', + endOfLine: 'auto', rangeStart: 0, }; diff --git a/src/api/demo/tree.ts b/src/api/demo/tree.ts new file mode 100644 index 00000000..8b8a94f1 --- /dev/null +++ b/src/api/demo/tree.ts @@ -0,0 +1,11 @@ +import { defHttp } from '/@/utils/http/axios'; + +enum Api { + TREE_OPTIONS_LIST = '/tree/getDemoOptions', +} + +/** + * @description: Get sample options value + */ +export const treeOptionsListApi = (params?: Recordable) => + defHttp.get({ url: Api.TREE_OPTIONS_LIST, params }); diff --git a/src/components/Application/src/AppLogo.vue b/src/components/Application/src/AppLogo.vue index 927000eb..d1cdeb57 100644 --- a/src/components/Application/src/AppLogo.vue +++ b/src/components/Application/src/AppLogo.vue @@ -17,6 +17,7 @@ import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'; import { useDesign } from '/@/hooks/web/useDesign'; import { PageEnum } from '/@/enums/pageEnum'; + import { useUserStore } from '/@/store/modules/user'; const props = { /** @@ -39,6 +40,7 @@ setup(props) { const { prefixCls } = useDesign('app-logo'); const { getCollapsedShowTitle } = useMenuSetting(); + const userStore = useUserStore(); const { title } = useGlobSetting(); const go = useGo(); @@ -56,7 +58,7 @@ ]); function goHome() { - go(PageEnum.BASE_HOME); + go(userStore.getUserInfo.homePath || PageEnum.BASE_HOME); } return { diff --git a/src/components/Application/src/search/useMenuSearch.ts b/src/components/Application/src/search/useMenuSearch.ts index df6f3957..9101b4ac 100644 --- a/src/components/Application/src/search/useMenuSearch.ts +++ b/src/components/Application/src/search/useMenuSearch.ts @@ -55,7 +55,7 @@ export function useMenuSearch(refs: Ref, scrollWrap: Ref, } const reg = createSearchReg(unref(keyword)); const filterMenu = filter(menuList, (item) => { - return reg.test(item.name); + return reg.test(item.name) && !item.hideMenu; }); searchResult.value = handlerSearchResult(filterMenu, reg); activeIndex.value = 0; @@ -64,15 +64,15 @@ export function useMenuSearch(refs: Ref, scrollWrap: Ref, function handlerSearchResult(filterMenu: Menu[], reg: RegExp, parent?: Menu) { const ret: SearchResult[] = []; filterMenu.forEach((item) => { - const { name, path, icon, children } = item; - if (reg.test(name) && !children?.length) { + const { name, path, icon, children, hideMenu, meta } = item; + if (!hideMenu && reg.test(name) && (!children?.length || meta?.hideChildrenInMenu)) { ret.push({ name: parent?.name ? `${parent.name} > ${name}` : name, path, icon, }); } - if (Array.isArray(children) && children.length) { + if (!meta?.hideChildrenInMenu && Array.isArray(children) && children.length) { ret.push(...handlerSearchResult(children, reg, item)); } }); diff --git a/src/components/Button/src/PopConfirmButton.vue b/src/components/Button/src/PopConfirmButton.vue index 8862b40b..8576a050 100644 --- a/src/components/Button/src/PopConfirmButton.vue +++ b/src/components/Button/src/PopConfirmButton.vue @@ -1,5 +1,5 @@ diff --git a/src/components/Form/src/components/FormAction.vue b/src/components/Form/src/components/FormAction.vue index 1666dfe8..60d84e7f 100644 --- a/src/components/Form/src/components/FormAction.vue +++ b/src/components/Form/src/components/FormAction.vue @@ -1,40 +1,42 @@ @@ -67,6 +143,10 @@ display: none; } + ::v-deep(.ant-pagination-disabled) { + display: inline-block !important; + } + &-item { padding: 6px; overflow: hidden; diff --git a/src/layouts/default/header/components/notify/data.ts b/src/layouts/default/header/components/notify/data.ts index 07bc4a86..15d524d7 100644 --- a/src/layouts/default/header/components/notify/data.ts +++ b/src/layouts/default/header/components/notify/data.ts @@ -1,7 +1,10 @@ export interface ListItem { id: string; avatar: string; + // 通知的标题内容 title: string; + // 是否在标题上显示删除线 + titleDelete?: boolean; datetime: string; type: string; read?: boolean; @@ -56,6 +59,55 @@ export const tabListData: TabItem[] = [ datetime: '2017-08-07', type: '1', }, + { + id: '000000005', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: + '标题可以设置自动显示省略号,本例中标题行数已设为1行,如果内容超过1行将自动截断并支持tooltip显示完整标题。', + description: '', + datetime: '2017-08-07', + type: '1', + }, + { + id: '000000006', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + description: '', + datetime: '2017-08-07', + type: '1', + }, + { + id: '000000007', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + description: '', + datetime: '2017-08-07', + type: '1', + }, + { + id: '000000008', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + description: '', + datetime: '2017-08-07', + type: '1', + }, + { + id: '000000009', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + description: '', + datetime: '2017-08-07', + type: '1', + }, + { + id: '000000010', + avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', + title: '左侧图标用于区分不同的类型', + description: '', + datetime: '2017-08-07', + type: '1', + }, ], }, { @@ -84,7 +136,8 @@ export const tabListData: TabItem[] = [ id: '000000008', avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', title: '标题', - description: '这种模板用于提醒谁与你发生了互动', + description: + '请将鼠标移动到此处,以便测试超长的消息在此处将如何处理。本例中设置的描述最大行数为2,超过2行的描述内容将被省略并且可以通过tooltip查看完整内容', datetime: '2017-08-07', type: '2', clickClose: true, diff --git a/src/layouts/default/header/components/notify/index.vue b/src/layouts/default/header/components/notify/index.vue index d0f28086..da66affb 100644 --- a/src/layouts/default/header/components/notify/index.vue +++ b/src/layouts/default/header/components/notify/index.vue @@ -6,13 +6,15 @@