This commit is contained in:
5
.browserslistrc
Normal file
5
.browserslistrc
Normal file
@ -0,0 +1,5 @@
|
||||
# 支持浏览器配置
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
||||
|
||||
14
.editorconfig
Normal file
14
.editorconfig
Normal file
@ -0,0 +1,14 @@
|
||||
# 编辑器配置
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
7
.eslintignore
Normal file
7
.eslintignore
Normal file
@ -0,0 +1,7 @@
|
||||
src/assets
|
||||
src/icons
|
||||
public
|
||||
dist
|
||||
node_modules
|
||||
vab-icon
|
||||
layouts
|
||||
123
.eslintrc.js
Normal file
123
.eslintrc.js
Normal file
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @author https://github.com/zxwk1998/vue-admin-better (不想保留author可删除)
|
||||
* @description .eslintrc.js
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
extends: ['plugin:vue/recommended', 'eslint:recommended', '@vue/prettier'],
|
||||
rules: {
|
||||
'no-undef': 'off',
|
||||
'no-console': 'off',
|
||||
'no-debugger': 'off',
|
||||
'prettier/prettier': 'warn',
|
||||
'prefer-template': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'vue/no-reserved-component-names': 'off',
|
||||
'vue/no-v-html': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'vue/no-useless-template-attributes': 'off',
|
||||
'use-isnan': 'off',
|
||||
'vue/html-self-closing': [
|
||||
'error',
|
||||
{
|
||||
html: {
|
||||
void: 'any',
|
||||
normal: 'any',
|
||||
component: 'always',
|
||||
},
|
||||
svg: 'always',
|
||||
math: 'always',
|
||||
},
|
||||
],
|
||||
'vue/component-name-in-template-casing': [
|
||||
'error',
|
||||
'kebab-case',
|
||||
{
|
||||
registeredComponentsOnly: false,
|
||||
ignores: [],
|
||||
},
|
||||
],
|
||||
// 多字组件名称
|
||||
'vue/multi-word-component-names': 'off',
|
||||
// Vue组件排序
|
||||
'vue/order-in-components': [
|
||||
'warn',
|
||||
{
|
||||
order: [
|
||||
'el',
|
||||
'name',
|
||||
'key',
|
||||
'parent',
|
||||
'functional',
|
||||
['delimiters', 'comments'],
|
||||
['components', 'directives', 'filters'],
|
||||
'extends',
|
||||
'mixins',
|
||||
['provide', 'inject'],
|
||||
'ROUTER_GUARDS',
|
||||
'layout',
|
||||
'middleware',
|
||||
'validate',
|
||||
'scrollToTop',
|
||||
'transition',
|
||||
'loading',
|
||||
'inheritAttrs',
|
||||
'model',
|
||||
['props', 'propsData'],
|
||||
'emits',
|
||||
'setup',
|
||||
'fetch',
|
||||
'asyncData',
|
||||
'data',
|
||||
'head',
|
||||
'computed',
|
||||
'watch',
|
||||
'watchQuery',
|
||||
'LIFECYCLE_HOOKS',
|
||||
'methods',
|
||||
['template', 'render'],
|
||||
'renderError',
|
||||
],
|
||||
},
|
||||
],
|
||||
// Vue属性排序
|
||||
'vue/attributes-order': [
|
||||
'warn',
|
||||
{
|
||||
order: [
|
||||
'DEFINITION',
|
||||
'LIST_RENDERING',
|
||||
'CONDITIONALS',
|
||||
'RENDER_MODIFIERS',
|
||||
'GLOBAL',
|
||||
'UNIQUE',
|
||||
'TWO_WAY_BINDING',
|
||||
'OTHER_DIRECTIVES',
|
||||
'OTHER_ATTR',
|
||||
'EVENTS',
|
||||
'CONTENT',
|
||||
],
|
||||
alphabetical: true, //字母顺序
|
||||
},
|
||||
],
|
||||
},
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
14
.gitattributes
vendored
Normal file
14
.gitattributes
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# .gitattributes
|
||||
*.html text eol=lf
|
||||
*.css text eol=lf
|
||||
*.js text eol=lf
|
||||
*.scss text eol=lf
|
||||
*.vue text eol=lf
|
||||
*.hbs text eol=lf
|
||||
*.sh text eol=lf
|
||||
*.md text eol=lf
|
||||
*.json text eol=lf
|
||||
*.yml text eol=lf
|
||||
.browserslistrc text eol=lf
|
||||
.gitignore text eol=lf
|
||||
*.js linguist-language=vue
|
||||
37
.github/workflows/deploy.yml
vendored
Normal file
37
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Deploy to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy to GitHub Pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 24
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build project
|
||||
run: pnpm run build
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./dist
|
||||
publish_branch: gh-pages
|
||||
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
# .gitignore
|
||||
.DS_Store
|
||||
node_modules
|
||||
dist
|
||||
.env.local
|
||||
.env.*.local
|
||||
npm-debug.log*
|
||||
yarn.lock
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
public/video
|
||||
*.zip
|
||||
*.7z
|
||||
/src/layouts/components/layouts
|
||||
/zx-templates
|
||||
/package-lock.json
|
||||
/src/styles/themes/green.scss
|
||||
/src/styles/themes/dark.scss
|
||||
/src/styles/themes/glory.scss
|
||||
/.history
|
||||
7
.stylelintrc.js
Normal file
7
.stylelintrc.js
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @author https://github.com/zxwk1998/vue-admin-better (不想保留author可删除)
|
||||
* @description stylelint
|
||||
*/
|
||||
module.exports = {
|
||||
extends: ['stylelint-config-recess-order', 'stylelint-config-prettier'],
|
||||
}
|
||||
54
.vscode/settings.json
vendored
Normal file
54
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"[vue]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"editor.quickSuggestions": {
|
||||
"strings": true
|
||||
},
|
||||
"workbench.colorTheme": "One Monokai",
|
||||
"editor.tabSize": 2,
|
||||
"editor.detectIndentation": false,
|
||||
"emmet.triggerExpansionOnTab": true,
|
||||
"editor.formatOnSave": true,
|
||||
"javascript.format.enable": true,
|
||||
"git.enableSmartCommit": true,
|
||||
"git.autofetch": true,
|
||||
"git.confirmSync": false,
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"liveServer.settings.donotShowInfoMsg": true,
|
||||
"explorer.confirmDelete": false,
|
||||
"javascript.updateImportsOnFileMove.enabled": "always",
|
||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||
"files.exclude": {
|
||||
"**/.idea": true
|
||||
},
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.stylelint": "explicit",
|
||||
"source.fixAll.eslint": "explicit"
|
||||
},
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[html]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"editor.suggest.snippetsPreventQuickSuggestions": false,
|
||||
"prettier.htmlWhitespaceSensitivity": "ignore",
|
||||
"prettier.vueIndentScriptAndStyle": true,
|
||||
"docthis.authorName": "https://vuejs-core.cn",
|
||||
"docthis.includeAuthorTag": true,
|
||||
"docthis.includeDescriptionTag": true,
|
||||
"docthis.enableHungarianNotationEvaluation": true,
|
||||
"docthis.inferTypesFromNames": true,
|
||||
"vetur.format.defaultFormatter.html": "prettier",
|
||||
"files.autoSave": "onFocusChange",
|
||||
"path-intellisense.mappings": {
|
||||
"@": "${workspaceRoot}/src"
|
||||
},
|
||||
"files.eol": "\n"
|
||||
}
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 good luck
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
203
README.en.md
Normal file
203
README.en.md
Normal file
@ -0,0 +1,203 @@
|
||||
[简体中文](./README.md) | English
|
||||
|
||||
<div align="center"><img width="200" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/logo/vab.png"/>
|
||||
<h1> vue-admin-better(element-ui) </h1>
|
||||
<p>The flying snow all over the sky is a flying note, playing out expectations with blessings. May the epidemic dissipate as soon as possible, may you no longer have regrets next year, may you be warm in winter, may you not be cold in spring, and may you have lights in the dark and an umbrella in the rain.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
[](https://github.com/zxwk1998/vue-admin-better)
|
||||
[](https://gitee.com/chu1204505056/vue-admin-better)
|
||||
[](https://en.wikipedia.org/wiki/MIT_License)
|
||||
|
||||
---
|
||||
|
||||
# 🎉 Characteristic
|
||||
|
||||
- 💪 40 + high quality single page
|
||||
- 💅 RBAC model + JWT permission control
|
||||
- 🌍 100000 + practical application of the project
|
||||
- 👏 Good type definition
|
||||
- 🥳 The open source version supports free commercial use
|
||||
- 🚀 Cross platform PC, mobile terminal and tablet
|
||||
- 📦 Back end route dynamic rendering
|
||||
|
||||
## 🌐 Address
|
||||
|
||||
- [🎉 Vue2. X + element UI (free commercial, PC, tablet and mobile phone supported)](https://vuejs-core.cn/vue-admin-better/)
|
||||
|
||||
<!-- - [⚡️ Vue3. X + element plus (alpha version, free commercial, supporting PC, tablet and mobile phone)](https://vuejs-core.cn/vue-admin-better-plus/) -->
|
||||
|
||||
<!-- - [⚡️ Vue3. X + ant design Vue (beta version, free commercial, supporting PC, tablet and mobile phone)](https://vuejs-core.cn/vue-admin-better-antdv/) -->
|
||||
|
||||
- [⚡️ vue3.x + vite + vue-admin-arco](https://vuejs-core.cn/vue-admin-arco/)
|
||||
|
||||
- [🚀 Admin Pro demo address (vue2.x paid version, supporting PC, tablet and mobile phone)](https://vuejs-core.cn/admin-pro/)
|
||||
|
||||
- [🚀 Admin plus demo address (vue3.x paid version, supporting PC, tablet and mobile phone)](https://vuejs-core.cn/admin-plus/)
|
||||
|
||||
- [📌 Pro and plus purchase address authorization](https://vuejs-core.cn/authorization/)
|
||||
|
||||
- [🌐 Github Warehouse address](https://github.com/zxwk1998/vue-admin-better/)
|
||||
|
||||
- [🌐 Gitee Warehouse address](https://gitee.com/chu1204505056/vue-admin-better/)
|
||||
|
||||
- Recently, the VAB official website has been frequently attacked by DDoS. We have taken relevant preventive measures.
|
||||
If the website cannot be accessed, please visit the backup address
|
||||
|
||||
## 📦️ Desktop applications
|
||||
|
||||
- [Admin Pro](https://gitee.com/chu1204505056/microsoft-store/raw/master/AdminPlus.zip)
|
||||
- [Admin Plus](https://gitee.com/chu1204505056/microsoft-store/raw/master/AdminPlus.zip)
|
||||
|
||||
<!-- ## 🌱 Vue3.x vue3.0-antdv [Click switch branch](https://github.com/zxwk1998/vue-admin-better/tree/vue3.0-antdv)
|
||||
|
||||
```bash
|
||||
git clone -b vue3.0-antdv https://github.com/zxwk1998/vue-admin-better.git
|
||||
npm i --registry=http://mirrors.cloud.tencent.com/npm/
|
||||
npm run serve
|
||||
``` -->
|
||||
|
||||
## 🌱 Vue2.xmain [Click switch branch](https://github.com/zxwk1998/vue-admin-better/tree/master)
|
||||
|
||||
```bash
|
||||
git clone -b master https://github.com/zxwk1998/vue-admin-better.git
|
||||
npm i --registry=http://mirrors.cloud.tencent.com/npm/
|
||||
npm run serve
|
||||
```
|
||||
|
||||
## 🍻 Front end discussion QQ group
|
||||
|
||||
- Let's have a cup of coffee, and then contact QQ 783963206 to invite you to the discussion group. Because of the large
|
||||
number of users, if you haven't passed a friend's request, please contact Alipay on the Alipay payment page, whether
|
||||
you invite or not, you can enjoy the open source code, thank you for your support and trust, and provide the
|
||||
vue-admin-better basic version in the group. Automatic configuration tutorial of development tools and project
|
||||
development documents.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<!-- <td>
|
||||
<img width="200px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/qq_group/hbm.jpg">
|
||||
</td> -->
|
||||
<td>
|
||||
<img width="200px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/zfb_kf.jpg">
|
||||
</td>
|
||||
<td>
|
||||
<img width="200px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/qq_group/vab-2.jpg">
|
||||
</td>
|
||||
<td>
|
||||
<img width="200px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/qq_group/vab-3.jpg">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## 🙈 We promise to sponsor open source projects regularly (thank giant)
|
||||
|
||||
<a title="vue" href="https://opencollective.com/vuejs" target="_blank">
|
||||
<img width="64px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/vue.png"/>
|
||||
</a>
|
||||
<a title="element-plus" href="https://opencollective.com/element-plus" target="_blank">
|
||||
<img width="64px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/element-plus.png"/>
|
||||
</a>
|
||||
<a title="ant-design-vue" href="https://opencollective.com/ant-design-vue" target="_blank">
|
||||
<img width="64px" src="https://images.opencollective.com/ant-design-vue/2ec179b/logo/256.png"/>
|
||||
</a>
|
||||
|
||||
## 🎨 Acknowledge
|
||||
|
||||
| Project |
|
||||
| ---------------------------------------------------------------- |
|
||||
| [vue](https://github.com/vuejs/vue) |
|
||||
| [element-ui](https://github.com/ElemeFE/element) |
|
||||
| [element-plus](https://github.com/element-plus/element-plus) |
|
||||
| [ant-design-vue](https://github.com/vueComponent/ant-design-vue) |
|
||||
| [mock](https://github.com/nuysoft/Mock) |
|
||||
| [axios](https://github.com/axios/axios) |
|
||||
|
||||
## 👷 Outstanding contributors to the framework (in no order)
|
||||
|
||||
<a href="https://github.com/buuing" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/36689704?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/hipi" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/22478003?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/fwfmiao" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/29328241?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/hdtopku" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/14859466?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/shaonialife" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/16135960?s=50"/>
|
||||
</a>
|
||||
|
||||
## 📌 Advantages and precautions
|
||||
|
||||
```
|
||||
Compared with other open source admin frameworks, it has the following advantages:
|
||||
1. Support the front-end control routing permission intelligence and the back-end control routing permission all mode
|
||||
2. It is known that the open source Vue admin framework is the first to support the automatic generation and export function of mock
|
||||
3. More than 50 global fine configurations are provided
|
||||
4. Support SCSS automatic sorting and eslint automatic repair
|
||||
5. Axios fine encapsulation supports multiple data sources, multiple successful code arrays, and application / JSON; charset=UTF-8、application/x-www-form-urlencoded; Charset = UTF-8 multiple parameter transfer modes
|
||||
6. Support login RSA encryption
|
||||
7. Support packaging to automatically generate 7z compressed packages
|
||||
8. Support errorlog error interception
|
||||
9. Support multi theme and multi layout switching
|
||||
Precautions for use:
|
||||
1. The project uses lf line feed instead of CRLF line feed by default. When creating a new file, please pay attention to selecting the file line feed
|
||||
2. The project uses the strictest eslint verification specification (plugin: Vue / recommended) by default. Before using it, it is recommended to configure the development tool to realize automatic repair (vscode development is recommended)
|
||||
3. The project uses the MIT open source agreement with the broadest requirements, and the MIT open source agreement can be used for free
|
||||
|
||||
```
|
||||
|
||||
## 💚 Suitable for people
|
||||
|
||||
- I am developing and want to use element UI / element plus, with 1 year of front-end development experience +.
|
||||
- Familiar with vue.js technology stack and developed several practical projects with it.
|
||||
- Students who are interested in principle and technology and want to improve.
|
||||
|
||||
## 🎉 Function map
|
||||
|
||||

|
||||
|
||||
## 🗃️ design sketch
|
||||
|
||||
The following is a screenshot of the pro version:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/2.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/6.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/8.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/9.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/3.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/5.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## 📄 Commercial considerations
|
||||
|
||||
This project can be used for commercial purposes free of charge. Please abide by the MIT agreement and keep the author's
|
||||
technical support statement. For customized source code copyright information, please contact customer service QQ 783963206.
|
||||
|
||||
<!-- ## 严正声明
|
||||
|
||||
近期发现不少游手好闲之人有组织有预谋的利用码云、知乎、掘金等网站可用国外非法网站提供的匿名手机号注册的账号 bug 冒充 vab 去攻击 vue-element-admin,iview-admin,若依,d2-admin,ant-design-vue 的行为,恶意制造对立,试图让其他开源作者卷入其中,对各位开源作者造成的影响我们深表歉意,我们欢迎 vab 的用户去体验其他更优秀的框架,vue-admin-beautiful 走到今天实属不易,被人冒充,被人发帖诋毁,被人故意发布错误言论假装发帖表扬实则为我们招骂,无意动任何人的奶酪,从 2020 年至今坚持全职维护已过一年时间,说实在的我们靠技术生存并不丢人吧,一年来感谢 vab 的用户对我们不离不弃,也希望大家越来越好,加油! -->
|
||||
307
README.md
Normal file
307
README.md
Normal file
@ -0,0 +1,307 @@
|
||||
<div>
|
||||
|
||||
简体中文 | [English](./README.en.md)
|
||||
|
||||
<div align="center">
|
||||
<img width="200" src="https://assets.rspack.rs/rspack/rspack-logo.svg"/>
|
||||
|
||||
<h1>Vue Admin Better</h1>
|
||||
<p>拒绝过度封装,去除等待时间,让项目回归纯粹,让开发变得简单</p>
|
||||
<p>致力于成为开源社区中运行速度最快、打包等待时间最短、上手难度最低的中后台前端框架</p>
|
||||
</div>
|
||||
|
||||
[](https://github.com/zxwk1998/vue-admin-better)
|
||||
[](https://gitee.com/chu1204505056/vue-admin-better)
|
||||
[](https://en.wikipedia.org/wiki/MIT_License)
|
||||
|
||||
---
|
||||
|
||||
## 🚀 2025 全新启程
|
||||
|
||||
- ⚡️ 项目运行速度提升 10-15 倍,打包速度提升 20-30 倍
|
||||
- 🕒 整体构建时间控制在 5 秒以内,带来飞一般的开发体验
|
||||
|
||||
## 🎉 特性
|
||||
|
||||
- 💪 40+高质量单页
|
||||
- 💅 RBAC 模型 + JWT 权限控制
|
||||
- 🌍 10 万+ 项目实际应用
|
||||
- 👏 良好的类型定义
|
||||
- 🥳 开源版本支持免费商用
|
||||
- 🚀 跨平台 PC、手机端、平板
|
||||
- 📦️ 后端路由动态渲染
|
||||
|
||||
## 🌐 演示地址
|
||||
|
||||
### 💡 免费版演示
|
||||
|
||||
- [🎉 Vue Admin Better - github 实时部署 (vue2.x + element-ui 免费商用,支持 PC、平板、手机)](https://zxwk1998.github.io/vue-admin-better/)
|
||||
- [🎉 Vue Admin Better (vue2.x + element-ui 免费商用,支持 PC、平板、手机)](https://vuejs-core.cn/vue-admin-better)
|
||||
- [🎉 Vue3 Admin Better (vue3.x + element-plus 免费商用,支持 PC、平板、手机)](https://vuejs-core.cn/vue3-admin-better)
|
||||
- [⚡️ Vue Admin Arco (vue3.x + vite7.x + arco2.x 免费商用,支持 PC)](https://vuejs-core.cn/vue-admin-arco/)
|
||||
|
||||
### 💰 付费版演示
|
||||
|
||||
- [🚀 Vue Admin Pro (vue2.x + element-ui 2.x 付费版本,支持 PC、平板、手机)](https://vuejs-core.cn/admin-pro/)
|
||||
- [🚀 Vue Admin Plus (vue3.x + element-plus 2.x 付费版本,支持 PC、平板、手机)](https://vuejs-core.cn/admin-plus/)
|
||||
- [🚀 Vue Shop Vite (vue3.x + vite7.x + element-plus 2.x 付费版本,支持 PC、平板、手机)](https://vuejs-core.cn/shop-vite/)
|
||||
|
||||
<!-- ## 🔊 温馨提示
|
||||
|
||||
近期,我们发现少数不法互联网用户通过 IDC 云服务器、代理 ip、本地计算机等方式对我们的演示地址,发起了大规模攻击,包括但不限于 DDOS 攻击、SQL 注入、大文件上传、端口扫描、目录扫描等方式,我们已第一时间通过技术手段追踪到其攻击服务器部署的网站内容,并由此推断出其所入职公司或相关联的公司,望其迷途知返,切勿再做损人不利己的事情。我们不清楚其这样做的原因,也不愿意通过以牙还牙,以眼还眼的方式,将事态扩大,为保障正常用户的访问演示地址的体验,提升访问速度,目前,演示地址已采取以下防范措施:
|
||||
|
||||
- 1、演示地址服务器已购买 DDOS 高防包,有效防止了大多数恶意攻击。
|
||||
- 2、演示地址服务器已禁止.git、.svn、.env、.php 等后缀文件访问,单个 ip 累计访问以上文件超过 20 次,将被永久封禁,并无法再次打开演示地址。
|
||||
- 3、演示地址每晚 3 点进行备份恢复、重启服务器操作,预计将有 2 到 3 分钟访问超时。
|
||||
- 4、演示地址已加入恶意 ip 共享计划,对于存在恶意扫描服务器端口、服务器文件的问题 ip,我们将立即封禁,并同步至云服务器厂商恶意 ip 名单。
|
||||
|
||||
以上措施真实有效,正常用户切勿因好奇前去尝试 DDOS 高防包的准确性,采取以上措施,实属迫不得已,地球这么大,容得下每一个前端框架,希望大家在各自的人生里各自发光,把余下的时间多用来陪陪家人孩子。(温馨提示:如果您发现自己的 ip 被误封,可联系微信客服申请解除)。 -->
|
||||
|
||||
## 🍻 前端讨论 QQ 群
|
||||
|
||||
- 请我们喝杯咖啡,打赏后联系 QQ 783963206 邀请您进入讨论群(由于用户数较多,如果您打赏后未通过好友请求,可以尝试多加几次),不管您请还是不请,您都可以享受到开源的代码,感谢您的支持和信任,群内提供
|
||||
vue-admin-better 基础版本、开发工具自动配置教程及项目开发文档。
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img width="200px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/zfb_kf.jpg">
|
||||
</td>
|
||||
<td>
|
||||
<img width="200px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/qq_group/vab-2.jpg">
|
||||
</td>
|
||||
<td>
|
||||
<img width="200px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/qq_group/vab-3.jpg">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## 💖 物料市场
|
||||
|
||||
- [🎉 物料市场](https://vuejs-core.cn/store)
|
||||
|
||||
## 💪 找工作
|
||||
|
||||
- [🎉 找好工作就到【好工作就业参考网】查看就业避坑指南](https://job.vuejs-core.cn/)
|
||||
|
||||
## 🌐 仓库地址
|
||||
|
||||
- [🌐 vue-admin-better github 仓库地址](https://github.com/zxwk1998/vue-admin-better/)
|
||||
|
||||
- [🌐 vue3-admin-better github 仓库地址](https://github.com/zxwk1998/vue3-admin-better/)
|
||||
|
||||
- [🌐 vue-admin-arco github 仓库地址](https://github.com/zxwk1998/vue-admin-arco/)
|
||||
|
||||
- [🌐 vue-admin-better 码云仓库地址](https://gitee.com/chu1204505056/vue-admin-better/)
|
||||
|
||||
- [🌐 vue3-admin-better 码云仓库地址](https://gitee.com/chu1204505056/vue3-admin-better/)
|
||||
|
||||
- [🌐 vue-admin-arco 码云仓库地址](https://gitee.com/chu1204505056/vue-admin-arco/)
|
||||
|
||||
## 📦️ 桌面应用程序
|
||||
|
||||
- [Admin Pro](https://gitee.com/chu1204505056/microsoft-store/raw/master/AdminPlus.zip)
|
||||
- [Admin Plus](https://gitee.com/chu1204505056/microsoft-store/raw/master/AdminPlus.zip)
|
||||
|
||||
<!-- ## 🌱 vue3.x vue3.0-antdv 分支(ant-design-vue)[点击切换分支](https://github.com/zxwk1998/vue-admin-better/tree/vue3.0-antdv)
|
||||
|
||||
```bash
|
||||
# 克隆项目
|
||||
git clone -b vue3.0-antdv https://github.com/zxwk1998/vue-admin-better.git
|
||||
# 安装依赖
|
||||
npm i --registry=http://mirrors.cloud.tencent.com/npm/
|
||||
# 本地开发 启动项目
|
||||
npm run serve
|
||||
``` -->
|
||||
|
||||
## 🌱 Vue 2.x (Element UI) - 当前仓库
|
||||
|
||||
```
|
||||
# 克隆项目
|
||||
git clone -b master https://github.com/zxwk1998/vue-admin-better.git
|
||||
|
||||
# 安装依赖
|
||||
pnpm i --registry=http://mirrors.cloud.tencent.com/npm/
|
||||
|
||||
# 本地开发 启动项目
|
||||
npm run serve:rspack
|
||||
```
|
||||
|
||||
## 🌱 Vue 3.x (Element Plus) [点击切换仓库](https://github.com/zxwk1998/vue3-admin-better)
|
||||
|
||||
```
|
||||
# 克隆项目
|
||||
git clone https://github.com/zxwk1998/vue3-admin-better.git
|
||||
|
||||
# 安装依赖
|
||||
pnpm i --registry=http://mirrors.cloud.tencent.com/npm/
|
||||
|
||||
# 本地开发 启动项目
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 🌱 Vue 3.x (Arco Design) [点击切换仓库](https://github.com/zxwk1998/vue-admin-arco)
|
||||
|
||||
```
|
||||
# 克隆项目
|
||||
git clone https://github.com/zxwk1998/vue-admin-arco.git
|
||||
|
||||
# 安装依赖
|
||||
pnpm i --registry=http://mirrors.cloud.tencent.com/npm/
|
||||
|
||||
# 本地开发 启动项目
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 🤝 友情链接
|
||||
|
||||
- [OPSLI 基于 vue-admin-better 开源版的最佳实践](https://github.com/hiparker/opsli-boot)
|
||||
- [uView uni-app 生态最优秀的 UI 框架](https://github.com/YanxinNet/uView/)
|
||||
- [form-generator Element 表单设计代码生成器](https://github.com/JakHuang/form-generator/)
|
||||
- [wangEditor 国产最强开源富文本编辑](https://github.com/wangeditor-team/wangEditor)
|
||||
|
||||
## 💸 赞助支持
|
||||
|
||||
如果您觉得 vue-admin-better 对您有帮助,欢迎赞助支持开源项目发展:
|
||||
|
||||
<a title="vue" href="https://opencollective.com/vuejs" target="_blank">
|
||||
<img width="64px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/vue.png"/>
|
||||
</a>
|
||||
<a title="element-plus" href="https://opencollective.com/element-plus" target="_blank">
|
||||
<img width="64px" src="https://gcore.jsdelivr.net/gh/zxwk1998/image/element-plus.png"/>
|
||||
</a>
|
||||
<a title="ant-design-vue" href="https://opencollective.com/ant-design-vue" target="_blank">
|
||||
<img width="64px" src="https://images.opencollective.com/ant-design-vue/2ec179b/logo/256.png"/>
|
||||
</a>
|
||||
|
||||
## 🏆 框架杰出贡献者
|
||||
|
||||
<a href="https://github.com/fwfmiao" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/29328241?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/buuing" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/36689704?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/hipi" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/22478003?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/hdtopku" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/14859466?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/shaonialife" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/16135960?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/1511578084" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/24790218?s=50"/>
|
||||
</a>
|
||||
<a href="https://github.com/Arooba-git" target="_blank">
|
||||
<img width="50px" style="border-radius:999px" src="https://avatars.githubusercontent.com/u/56495631?s=50"/>
|
||||
</a>
|
||||
|
||||
## 🌟 优势亮点
|
||||
|
||||
### 主要优势:
|
||||
|
||||
1. **灵活权限控制** - 支持前端控制路由权限(intelligence)和后端控制路由权限(all)两种模式
|
||||
2. **开发效率提升** - 独家支持 mock 自动生成和自动导出功能
|
||||
3. **高度可配置** - 提供 50+ 项全局精细化配置选项
|
||||
4. **开发友好** - 支持 SCSS 自动排序,ESLint 自动修复
|
||||
5. **网络请求优化** - Axios 精细化封装,支持多数据源、多成功状态码,支持多种传参方式
|
||||
6. **安全增强** - 支持登录 RSA 加密
|
||||
7. **构建优化** - 支持打包自动生成 7Z 压缩包
|
||||
8. **错误监控** - 支持错误日志拦截(errorlog)
|
||||
9. **多样化支持** - 支持多主题、多布局切换
|
||||
|
||||
### 使用须知:
|
||||
|
||||
1. 项目默认使用 LF 换行符,请注意文件换行符设置
|
||||
2. 使用最严格的 ESLint 校验规范(plugin:vue/recommended),建议配置开发工具自动修复(推荐使用 VSCode)
|
||||
3. 项目采用 MIT 开源协议,保留协议声明即可免费商用
|
||||
|
||||
## 💚 适合人群
|
||||
|
||||
- 正在以及想使用 element-ui/element-plus 开发,前端开发经验 1 年+。
|
||||
- 熟悉 Vue.js 技术栈,使用它开发过几个实际项目。
|
||||
- 对原理技术感兴趣,想进阶和提升的同学。
|
||||
|
||||
## 🎨 Star
|
||||
|
||||
[](https://github.com/zxwk1998/vue-admin-better/stargazers)
|
||||
|
||||
## ✨ Fork
|
||||
|
||||
[](https://github.com/zxwk1998/vue-admin-better/network/members)
|
||||
|
||||
## 🎉 功能地图
|
||||
|
||||

|
||||
|
||||
## 🗃️ 效果图
|
||||
|
||||
以下是截取的是 pro 版的效果图展示:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/2.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/6.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/8.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/9.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/3.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/5.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
以下是截取的是 shop 版的效果图展示:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/16.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/17.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/18.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/19.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/20.png">
|
||||
</td>
|
||||
<td>
|
||||
<img src="https://gcore.jsdelivr.net/gh/zxwk1998/image/21.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## 📄 商用注意事项
|
||||
|
||||
开源版本可免费用于商业用途,如果方便就留个 Star 吧
|
||||
|
||||
<!-- ,请遵守 MIT 协议并保留作者技术支持声明,当然如果不愿意保留可以删掉,毕竟我也拿您没办法,能帮到您也当是给自己积德了,至于[Admin](https://vuejs-core.cn/admin-plus/)、[Shop](https://vuejs-core.cn/shop-vite/) 的付费版本的相关说明如下:
|
||||
本人只参与了前期小部分的开发,所以不必跟开源版做对比,同事的代码功底比我好太多,我自愧不如,关于买这件事,没有强买强卖,您愿意买就买,不愿意买就忽略。我们不高尚,写代码就是为了养家糊口,不是为了用爱发电。这几年看到那么多开源项目借鉴了我们付费版本的布局、主题配置的灵感和创意,一开始我是鄙视的,现在还好状态调整过来了,能够被借鉴,被讨论恰好说明了我们的产品有价值,为了产品卖的更好我们也必须更加用心的去维护付费版本以保持我们产品的竞争力。
|
||||
当然,最后还有几句话不得不说,身处互联网由盛转衰的大变革的洪流中,能活下来就已经是千难万难了,希望所有的程序员哥哥姐姐们,早日实现自己的梦想,完成自己的心愿,也想对刚要毕业准备做一名程序员的学弟学妹们说几句,互联网行业没有你们想象的那么高大上,如果想成为一名程序员那就做好加班的准备,如果有更好的选择那就别选这个行业了。 -->
|
||||
|
||||
</div>
|
||||
7
babel.config.js
Normal file
7
babel.config.js
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @author https://github.com/zxwk1998/vue-admin-better (不想保留author可删除)
|
||||
* @description babel.config
|
||||
*/
|
||||
module.exports = {
|
||||
presets: ['@vue/cli-plugin-babel/preset'],
|
||||
}
|
||||
20
deploy.sh
Normal file
20
deploy.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#强制推送
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
npm run build
|
||||
cd dist
|
||||
touch .nojekyll
|
||||
git init
|
||||
git add -A
|
||||
git commit -m 'deploy'
|
||||
git push -f "https://${access_token}@gitee.com/chu1204505056/vue-admin-better.git" master:gh-pages
|
||||
git push -f "https://${access_token}@gitee.com/chu1204505056/vue-admin-better-element.git" master:gh-pages
|
||||
start "https://gitee.com/chu1204505056/vue-admin-better/pages"
|
||||
start "https://gitee.com/chu1204505056/vue-admin-better-element/pages"
|
||||
git push -f "https://${access_token}@github.com/zxwk1998/vue-admin-better.git" master:gh-pages
|
||||
cd -
|
||||
exec /bin/bash
|
||||
|
||||
|
||||
|
||||
|
||||
13
layouts/Permissions/index.js
Normal file
13
layouts/Permissions/index.js
Normal file
@ -0,0 +1,13 @@
|
||||
import permissions from './permissions'
|
||||
|
||||
const install = function (Vue) {
|
||||
Vue.directive('permissions', permissions)
|
||||
}
|
||||
|
||||
if (window.Vue) {
|
||||
window['permissions'] = permissions
|
||||
Vue.use(install)
|
||||
}
|
||||
|
||||
permissions.install = install
|
||||
export default permissions
|
||||
13
layouts/Permissions/permissions.js
Normal file
13
layouts/Permissions/permissions.js
Normal file
@ -0,0 +1,13 @@
|
||||
import store from '@/store'
|
||||
|
||||
export default {
|
||||
inserted(element, binding) {
|
||||
const { value } = binding
|
||||
const permissions = store.getters['user/permissions']
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const hasPermission = permissions.some((role) => value.includes(role))
|
||||
if (!hasPermission)
|
||||
element.parentNode && element.parentNode.removeChild(element)
|
||||
}
|
||||
},
|
||||
}
|
||||
57
layouts/index.js
Normal file
57
layouts/index.js
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @description Vue Admin Better 项目配置
|
||||
*/
|
||||
|
||||
const webpackBarName = 'vue-admin-better'
|
||||
const webpackBanner = (time) =>
|
||||
`vue-admin-better
|
||||
GitHub: https://github.com/zxwk1998/vue-admin-better
|
||||
Gitee: https://gitee.com/chu1204505056/vue-admin-better
|
||||
|
||||
版权所有 (c) 2025 vue-admin-better
|
||||
本项目使用 MIT 许可证
|
||||
构建时间: ${time}`
|
||||
|
||||
/**
|
||||
* @description 在控制台打印项目信息
|
||||
*/
|
||||
function donationConsole() {
|
||||
const chalk = require('chalk')
|
||||
console.log(
|
||||
chalk.green(
|
||||
`> 欢迎使用vue-admin-better,github开源地址:https://github.com/zxwk1998/vue-admin-better`
|
||||
)
|
||||
)
|
||||
console.log(
|
||||
chalk.green(
|
||||
`> 欢迎使用vue-admin-better,码云开源地址:https://gitee.com/chu1204505056/vue-admin-better`
|
||||
)
|
||||
)
|
||||
|
||||
console.log(chalk.green(`> pro版演示地址:http://vuejs-core.cn/admin-pro`))
|
||||
|
||||
console.log(chalk.green(`> plus版演示地址:http://vuejs-core.cn/admin-plus`))
|
||||
|
||||
console.log(chalk.green(`> shop版演示地址:http://vuejs-core.cn/shop-vite`))
|
||||
|
||||
console.log(
|
||||
chalk.green(
|
||||
`> 找好工作就到【好工作就业参考网】查看就业避坑指南:https://job.vuejs-core.cn/`
|
||||
)
|
||||
)
|
||||
|
||||
console.log(
|
||||
chalk.green(
|
||||
`> 使用中出现任何问题可加QQ群反馈,获取基础版、文档,请我们喝杯咖啡(如若情况不允许,请勿勉强):https://gitee.com/chu1204505056/vue-admin-better#-%E5%89%8D%E7%AB%AF%E8%AE%A8%E8%AE%BA-qq-%E7%BE%A4`
|
||||
)
|
||||
)
|
||||
|
||||
console.log(chalk.green(`> 如果您不希望显示以上信息,可在config中配置关闭`))
|
||||
console.log('\n')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
webpackBarName,
|
||||
webpackBanner,
|
||||
donationConsole,
|
||||
}
|
||||
5
layouts/package.json
Normal file
5
layouts/package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "layouts",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js"
|
||||
}
|
||||
16
layouts/prettier.config.js
Normal file
16
layouts/prettier.config.js
Normal file
@ -0,0 +1,16 @@
|
||||
module.exports = {
|
||||
printWidth: 80,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
quoteProps: 'as-needed',
|
||||
jsxSingleQuote: false,
|
||||
trailingComma: 'es5',
|
||||
bracketSpacing: true,
|
||||
jsxBracketSameLine: false,
|
||||
arrowParens: 'always',
|
||||
htmlWhitespaceSensitivity: 'ignore',
|
||||
vueIndentScriptAndStyle: true,
|
||||
endOfLine: 'lf',
|
||||
}
|
||||
321
mock/controller/colorfulIcon.js
Normal file
321
mock/controller/colorfulIcon.js
Normal file
@ -0,0 +1,321 @@
|
||||
const data = [
|
||||
'alphabetical_sorting',
|
||||
'alphabetical_sorting',
|
||||
'alarm_clock',
|
||||
'area_chart',
|
||||
'approval',
|
||||
'answers',
|
||||
'approve',
|
||||
'assistant',
|
||||
'automotive',
|
||||
'automatic',
|
||||
'bad_decision',
|
||||
'bar_chart',
|
||||
'bearish',
|
||||
'biomass',
|
||||
'biohazard',
|
||||
'binoculars',
|
||||
'bookmark',
|
||||
'briefcase',
|
||||
'biotech',
|
||||
'broken_link',
|
||||
'business',
|
||||
'bullish',
|
||||
'business_contact',
|
||||
'businesswoman',
|
||||
'cable_release',
|
||||
'calculator',
|
||||
'businessman',
|
||||
'calendar',
|
||||
'butting_in',
|
||||
'call_transfer',
|
||||
'callback',
|
||||
'camcorder',
|
||||
'camera',
|
||||
'camcorder_pro',
|
||||
'cancel',
|
||||
'camera_addon',
|
||||
'camera_identificatio',
|
||||
'capacitor',
|
||||
'candle_sticks',
|
||||
'checkmark',
|
||||
'circuit',
|
||||
'charge_battery',
|
||||
'clear_filters',
|
||||
'clapperboard',
|
||||
'clock',
|
||||
'close_up_mode',
|
||||
'collaboration',
|
||||
'cell_phone',
|
||||
'collapse',
|
||||
'collect',
|
||||
'cloth',
|
||||
'combo_chart',
|
||||
'comments',
|
||||
'conference_call',
|
||||
'compact_camera',
|
||||
'contacts',
|
||||
'copyleft',
|
||||
'copyright',
|
||||
'crystal_oscillator',
|
||||
'cursor',
|
||||
'currency_exchange',
|
||||
'customer_support',
|
||||
'dam',
|
||||
'data_backup',
|
||||
'data_configuration',
|
||||
'data_encryption',
|
||||
'data_protection',
|
||||
'data_recovery',
|
||||
'database',
|
||||
'data_sheet',
|
||||
'debt',
|
||||
'decision',
|
||||
'delete_column',
|
||||
'delete_database',
|
||||
'department',
|
||||
'delete_row',
|
||||
'deployment',
|
||||
'dislike',
|
||||
'disapprove',
|
||||
'disclaimer',
|
||||
'display',
|
||||
'document',
|
||||
'do_not_insert',
|
||||
'do_not_mix',
|
||||
'do_not_inhale',
|
||||
'donate',
|
||||
'down',
|
||||
'doughnut_chart',
|
||||
'down_left',
|
||||
'down_right',
|
||||
'download',
|
||||
'edit_image',
|
||||
'electrical_sensor',
|
||||
'electrical_threshold',
|
||||
'electricity',
|
||||
'electro_devices',
|
||||
'electronics',
|
||||
'empty_battery',
|
||||
'empty_filter',
|
||||
'empty_trash',
|
||||
'end_call',
|
||||
'engineering',
|
||||
'entering_heaven_aliv',
|
||||
'expand',
|
||||
'export',
|
||||
'expired',
|
||||
'factory',
|
||||
'factory_breakdown',
|
||||
'external',
|
||||
'faq',
|
||||
'feed_in',
|
||||
'file',
|
||||
'feedback',
|
||||
'film',
|
||||
'filled_filter',
|
||||
'filing_cabinet',
|
||||
'film_reel',
|
||||
'flash_auto',
|
||||
'fine_print',
|
||||
'flash_off',
|
||||
'flash_on',
|
||||
'flow_chart',
|
||||
'folder',
|
||||
'frame',
|
||||
'full_battery',
|
||||
'full_trash',
|
||||
'gallery',
|
||||
'generic_sorting_asc',
|
||||
'generic_sorting_desc',
|
||||
'genealogy',
|
||||
'globe',
|
||||
'good_decision',
|
||||
'headset',
|
||||
'grid',
|
||||
'graduation_cap',
|
||||
'heat_map',
|
||||
'high_priority',
|
||||
'high_battery',
|
||||
'image_file',
|
||||
'home',
|
||||
'idea',
|
||||
'import',
|
||||
'in_transit',
|
||||
'integrated_webcam',
|
||||
'inspection',
|
||||
'invite',
|
||||
'internal',
|
||||
'ipad',
|
||||
'info',
|
||||
'iphone',
|
||||
'kindle',
|
||||
'key',
|
||||
'landscape',
|
||||
'left',
|
||||
'left_down',
|
||||
'left_up',
|
||||
'leave',
|
||||
'like_placeholder',
|
||||
'light_at_the_end_of_',
|
||||
'library',
|
||||
'line_chart',
|
||||
'link',
|
||||
'like',
|
||||
'lock',
|
||||
'list',
|
||||
'lock_landscape',
|
||||
'low_battery',
|
||||
'lock_portrait',
|
||||
'low_priority',
|
||||
'make_decision',
|
||||
'medium_priority',
|
||||
'manager',
|
||||
'menu',
|
||||
'middle_battery',
|
||||
'minus',
|
||||
'missed_call',
|
||||
'mind_map',
|
||||
'mms',
|
||||
'multiple_cameras',
|
||||
'money_transfer',
|
||||
'music',
|
||||
'multiple_devices',
|
||||
'multiple_smartphones',
|
||||
'multiple_inputs',
|
||||
'negative_dynamic',
|
||||
'neutral_decision',
|
||||
'night_landscape',
|
||||
'news',
|
||||
'neutral_trading',
|
||||
'night_portrait',
|
||||
'no_idea',
|
||||
'next',
|
||||
'no_video',
|
||||
'nook',
|
||||
'ok',
|
||||
'org_unit',
|
||||
'opened_folder',
|
||||
'old_time_camera',
|
||||
'online_support',
|
||||
'organization',
|
||||
'package',
|
||||
'paid',
|
||||
'parallel_tasks',
|
||||
'overtime',
|
||||
'panorama',
|
||||
'phone',
|
||||
'phone_android',
|
||||
'photo_reel',
|
||||
'pie_chart',
|
||||
'picture',
|
||||
'planner',
|
||||
'plus',
|
||||
'podium_with_audience',
|
||||
'podium_without_speak',
|
||||
'podium_with_speaker',
|
||||
'previous',
|
||||
'portrait_mode',
|
||||
'positive_dynamic',
|
||||
'privacy',
|
||||
'process',
|
||||
'puzzle',
|
||||
'questions',
|
||||
'print',
|
||||
'radar_plot',
|
||||
'rating',
|
||||
'ratings',
|
||||
'reading',
|
||||
'redo',
|
||||
'reading_ebook',
|
||||
'refresh',
|
||||
'registered_trademark',
|
||||
'right',
|
||||
'reuse',
|
||||
'remove_image',
|
||||
'right_down',
|
||||
'right_up',
|
||||
'rotate_to_portrait',
|
||||
'rules',
|
||||
'rotate_camera',
|
||||
'rotate_to_landscape',
|
||||
'ruler',
|
||||
'scatter_plot',
|
||||
'search',
|
||||
'safe',
|
||||
'self_service_kiosk',
|
||||
'selfie',
|
||||
'serial_tasks',
|
||||
'sales_performance',
|
||||
'settings',
|
||||
'services',
|
||||
'share',
|
||||
'shipped',
|
||||
'sim_card',
|
||||
'shop',
|
||||
'service_mark',
|
||||
'sim_card_chip',
|
||||
'signature',
|
||||
'smartphone_tablet',
|
||||
'sound_recording_copy',
|
||||
'sms',
|
||||
'speaker',
|
||||
'slr_back_side',
|
||||
'start',
|
||||
'stack_of_photos',
|
||||
'statistics',
|
||||
'sports_mode',
|
||||
'support',
|
||||
'synchronize',
|
||||
'switch_camera',
|
||||
'survey',
|
||||
'tablet_android',
|
||||
'template',
|
||||
'trademark',
|
||||
'todo_list',
|
||||
'touchscreen_smartpho',
|
||||
'timeline',
|
||||
'tree_structure',
|
||||
'undo',
|
||||
'up_left',
|
||||
'two_smartphones',
|
||||
'unlock',
|
||||
'up',
|
||||
'up_right',
|
||||
'upload',
|
||||
'video_call',
|
||||
'video_file',
|
||||
'view_details',
|
||||
'video_projector',
|
||||
'vip',
|
||||
'voice_presentation',
|
||||
'webcam',
|
||||
'voicemail',
|
||||
'workflow',
|
||||
'about',
|
||||
'accept_database',
|
||||
'add_image',
|
||||
'add_column',
|
||||
'add_database',
|
||||
'add_row',
|
||||
]
|
||||
module.exports = [
|
||||
{
|
||||
url: '/colorfulIcon/getList',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { title, pageNo = 1, pageSize = 72 } = config.body
|
||||
let mockList = data.filter((item) => {
|
||||
if (title && item.indexOf(title) < 0) return false
|
||||
return true
|
||||
})
|
||||
const pageList = mockList.filter((item, index) => index < pageSize * pageNo && index >= pageSize * (pageNo - 1))
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount: mockList.length,
|
||||
data: pageList,
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
40
mock/controller/goodsList.js
Normal file
40
mock/controller/goodsList.js
Normal file
@ -0,0 +1,40 @@
|
||||
const { mock } = require('mockjs')
|
||||
|
||||
const List = []
|
||||
const count = 999
|
||||
let num = 0
|
||||
for (let i = 0; i < count; i++) {
|
||||
List.push(
|
||||
mock({
|
||||
uuid: '@uuid',
|
||||
image: `https://picsum.photos/300/600?random=${num++}`,
|
||||
title: '@ctitle',
|
||||
description: '@csentence',
|
||||
link: 'https://www.baidu.com',
|
||||
price: '@integer(100, 500)',
|
||||
'status|1': [1, 0],
|
||||
'isRecommend|1': [1, 0],
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/goodsList/getList',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { title = '', pageNo = 1, pageSize = 20 } = config.body
|
||||
let mockList = List.filter((item) => {
|
||||
if (title && item.title.indexOf(title) < 0) return false
|
||||
return true
|
||||
})
|
||||
const pageList = mockList.filter((item, index) => index < pageSize * pageNo && index >= pageSize * (pageNo - 1))
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount: count,
|
||||
data: pageList,
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
982
mock/controller/icon.js
Normal file
982
mock/controller/icon.js
Normal file
@ -0,0 +1,982 @@
|
||||
const data = [
|
||||
'air-freshener',
|
||||
'align-center',
|
||||
'align-justify',
|
||||
'align-left',
|
||||
'align-right',
|
||||
'allergies',
|
||||
'ambulance',
|
||||
'american-sign-language-interpreting',
|
||||
'anchor',
|
||||
'angle-double-down',
|
||||
'angle-double-left',
|
||||
'angle-double-right',
|
||||
'angle-double-up',
|
||||
'angle-down',
|
||||
'angle-left',
|
||||
'angle-right',
|
||||
'angle-up',
|
||||
'angry',
|
||||
'ankh',
|
||||
'apple-alt',
|
||||
'archive',
|
||||
'archway',
|
||||
'arrow-alt-circle-down',
|
||||
'arrow-alt-circle-left',
|
||||
'arrow-alt-circle-right',
|
||||
'arrow-alt-circle-up',
|
||||
'arrow-circle-down',
|
||||
'arrow-circle-left',
|
||||
'arrow-circle-right',
|
||||
'arrow-circle-up',
|
||||
'arrow-down',
|
||||
'arrow-left',
|
||||
'arrow-right',
|
||||
'arrow-up',
|
||||
'arrows-alt',
|
||||
'arrows-alt-h',
|
||||
'arrows-alt-v',
|
||||
'assistive-listening-systems',
|
||||
'asterisk',
|
||||
'at',
|
||||
'atlas',
|
||||
'atom',
|
||||
'audio-description',
|
||||
'award',
|
||||
'baby',
|
||||
'baby-carriage',
|
||||
'backspace',
|
||||
'backward',
|
||||
'bacon',
|
||||
'bahai',
|
||||
'balance-scale',
|
||||
'balance-scale-left',
|
||||
'balance-scale-right',
|
||||
'ban',
|
||||
'band-aid',
|
||||
'barcode',
|
||||
'bars',
|
||||
'baseball-ball',
|
||||
'basketball-ball',
|
||||
'bath',
|
||||
'battery-empty',
|
||||
'battery-full',
|
||||
'battery-half',
|
||||
'battery-quarter',
|
||||
'battery-three-quarters',
|
||||
'bed',
|
||||
'beer',
|
||||
'bell',
|
||||
'bell-slash',
|
||||
'bezier-curve',
|
||||
'bible',
|
||||
'bicycle',
|
||||
'biking',
|
||||
'binoculars',
|
||||
'biohazard',
|
||||
'birthday-cake',
|
||||
'blender',
|
||||
'blender-phone',
|
||||
'blind',
|
||||
'blog',
|
||||
'bold',
|
||||
'bolt',
|
||||
'bomb',
|
||||
'bone',
|
||||
'bong',
|
||||
'book',
|
||||
'book-dead',
|
||||
'book-medical',
|
||||
'book-open',
|
||||
'book-reader',
|
||||
'bookmark',
|
||||
'border-all',
|
||||
'border-none',
|
||||
'border-style',
|
||||
'bowling-ball',
|
||||
'box',
|
||||
'box-open',
|
||||
'boxes',
|
||||
'braille',
|
||||
'brain',
|
||||
'bread-slice',
|
||||
'briefcase',
|
||||
'briefcase-medical',
|
||||
'broadcast-tower',
|
||||
'broom',
|
||||
'brush',
|
||||
'bug',
|
||||
'building',
|
||||
'bullhorn',
|
||||
'bullseye',
|
||||
'burn',
|
||||
'bus',
|
||||
'bus-alt',
|
||||
'business-time',
|
||||
'calculator',
|
||||
'calendar',
|
||||
'calendar-alt',
|
||||
'calendar-check',
|
||||
'calendar-day',
|
||||
'calendar-minus',
|
||||
'calendar-plus',
|
||||
'calendar-times',
|
||||
'calendar-week',
|
||||
'camera',
|
||||
'camera-retro',
|
||||
'campground',
|
||||
'candy-cane',
|
||||
'cannabis',
|
||||
'capsules',
|
||||
'car',
|
||||
'car-alt',
|
||||
'car-battery',
|
||||
'car-crash',
|
||||
'car-side',
|
||||
'caravan',
|
||||
'caret-down',
|
||||
'caret-left',
|
||||
'caret-right',
|
||||
'caret-square-down',
|
||||
'caret-square-left',
|
||||
'caret-square-right',
|
||||
'caret-square-up',
|
||||
'caret-up',
|
||||
'carrot',
|
||||
'cart-arrow-down',
|
||||
'cart-plus',
|
||||
'cash-register',
|
||||
'cat',
|
||||
'certificate',
|
||||
'chair',
|
||||
'chalkboard',
|
||||
'chalkboard-teacher',
|
||||
'charging-station',
|
||||
'chart-area',
|
||||
'chart-bar',
|
||||
'chart-line',
|
||||
'chart-pie',
|
||||
'check',
|
||||
'check-circle',
|
||||
'check-double',
|
||||
'check-square',
|
||||
'cheese',
|
||||
'chess',
|
||||
'chess-bishop',
|
||||
'chess-board',
|
||||
'chess-king',
|
||||
'chess-knight',
|
||||
'chess-pawn',
|
||||
'chess-queen',
|
||||
'chess-rook',
|
||||
'chevron-circle-down',
|
||||
'chevron-circle-left',
|
||||
'chevron-circle-right',
|
||||
'chevron-circle-up',
|
||||
'chevron-down',
|
||||
'chevron-left',
|
||||
'chevron-right',
|
||||
'chevron-up',
|
||||
'child',
|
||||
'church',
|
||||
'circle',
|
||||
'circle-notch',
|
||||
'city',
|
||||
'clinic-medical',
|
||||
'clipboard',
|
||||
'clipboard-check',
|
||||
'clipboard-list',
|
||||
'clock',
|
||||
'clone',
|
||||
'closed-captioning',
|
||||
'cloud',
|
||||
'cloud-download-alt',
|
||||
'cloud-meatball',
|
||||
'cloud-moon',
|
||||
'cloud-moon-rain',
|
||||
'cloud-rain',
|
||||
'cloud-showers-heavy',
|
||||
'cloud-sun',
|
||||
'cloud-sun-rain',
|
||||
'cloud-upload-alt',
|
||||
'cocktail',
|
||||
'code',
|
||||
'code-branch',
|
||||
'coffee',
|
||||
'cog',
|
||||
'cogs',
|
||||
'coins',
|
||||
'columns',
|
||||
'comment',
|
||||
'comment-alt',
|
||||
'comment-dollar',
|
||||
'comment-dots',
|
||||
'comment-medical',
|
||||
'comment-slash',
|
||||
'comments',
|
||||
'comments-dollar',
|
||||
'compact-disc',
|
||||
'compass',
|
||||
'compress',
|
||||
'compress-alt',
|
||||
'compress-arrows-alt',
|
||||
'concierge-bell',
|
||||
'cookie',
|
||||
'cookie-bite',
|
||||
'copy',
|
||||
'copyright',
|
||||
'couch',
|
||||
'credit-card',
|
||||
'crop',
|
||||
'crop-alt',
|
||||
'cross',
|
||||
'crosshairs',
|
||||
'crow',
|
||||
'crown',
|
||||
'crutch',
|
||||
'cube',
|
||||
'cubes',
|
||||
'cut',
|
||||
'database',
|
||||
'deaf',
|
||||
'democrat',
|
||||
'desktop',
|
||||
'dharmachakra',
|
||||
'diagnoses',
|
||||
'dice',
|
||||
'dice-d20',
|
||||
'dice-d6',
|
||||
'dice-five',
|
||||
'dice-four',
|
||||
'dice-one',
|
||||
'dice-six',
|
||||
'dice-three',
|
||||
'dice-two',
|
||||
'digital-tachograph',
|
||||
'directions',
|
||||
'divide',
|
||||
'dizzy',
|
||||
'dna',
|
||||
'dog',
|
||||
'dollar-sign',
|
||||
'dolly',
|
||||
'dolly-flatbed',
|
||||
'donate',
|
||||
'door-closed',
|
||||
'door-open',
|
||||
'dot-circle',
|
||||
'dove',
|
||||
'download',
|
||||
'drafting-compass',
|
||||
'dragon',
|
||||
'draw-polygon',
|
||||
'drum',
|
||||
'drum-steelpan',
|
||||
'drumstick-bite',
|
||||
'dumbbell',
|
||||
'dumpster',
|
||||
'dumpster-fire',
|
||||
'dungeon',
|
||||
'edit',
|
||||
'egg',
|
||||
'eject',
|
||||
'ellipsis-h',
|
||||
'ellipsis-v',
|
||||
'envelope',
|
||||
'envelope-open',
|
||||
'envelope-open-text',
|
||||
'envelope-square',
|
||||
'equals',
|
||||
'eraser',
|
||||
'ethernet',
|
||||
'euro-sign',
|
||||
'exchange-alt',
|
||||
'exclamation',
|
||||
'exclamation-circle',
|
||||
'exclamation-triangle',
|
||||
'expand',
|
||||
'expand-alt',
|
||||
'expand-arrows-alt',
|
||||
'external-link-alt',
|
||||
'external-link-square-alt',
|
||||
'eye',
|
||||
'eye-dropper',
|
||||
'eye-slash',
|
||||
'fan',
|
||||
'fast-backward',
|
||||
'fast-forward',
|
||||
'fax',
|
||||
'feather',
|
||||
'feather-alt',
|
||||
'female',
|
||||
'fighter-jet',
|
||||
'file',
|
||||
'file-alt',
|
||||
'file-archive',
|
||||
'file-audio',
|
||||
'file-code',
|
||||
'file-contract',
|
||||
'file-csv',
|
||||
'file-download',
|
||||
'file-excel',
|
||||
'file-export',
|
||||
'file-image',
|
||||
'file-import',
|
||||
'file-invoice',
|
||||
'file-invoice-dollar',
|
||||
'file-medical',
|
||||
'file-medical-alt',
|
||||
'file-pdf',
|
||||
'file-powerpoint',
|
||||
'file-prescription',
|
||||
'file-signature',
|
||||
'file-upload',
|
||||
'file-video',
|
||||
'file-word',
|
||||
'fill',
|
||||
'fill-drip',
|
||||
'film',
|
||||
'filter',
|
||||
'fingerprint',
|
||||
'fire',
|
||||
'fire-alt',
|
||||
'fire-extinguisher',
|
||||
'first-aid',
|
||||
'fish',
|
||||
'fist-raised',
|
||||
'flag',
|
||||
'flag-checkered',
|
||||
'flag-usa',
|
||||
'flask',
|
||||
'flushed',
|
||||
'folder',
|
||||
'folder-minus',
|
||||
'folder-open',
|
||||
'folder-plus',
|
||||
'font',
|
||||
'football-ball',
|
||||
'forward',
|
||||
'frog',
|
||||
'frown',
|
||||
'frown-open',
|
||||
'funnel-dollar',
|
||||
'futbol',
|
||||
'gamepad',
|
||||
'gas-pump',
|
||||
'gavel',
|
||||
'gem',
|
||||
'genderless',
|
||||
'ghost',
|
||||
'gift',
|
||||
'gifts',
|
||||
'glass-cheers',
|
||||
'glass-martini',
|
||||
'glass-martini-alt',
|
||||
'glass-whiskey',
|
||||
'glasses',
|
||||
'globe',
|
||||
'globe-africa',
|
||||
'globe-americas',
|
||||
'globe-asia',
|
||||
'globe-europe',
|
||||
'golf-ball',
|
||||
'gopuram',
|
||||
'graduation-cap',
|
||||
'greater-than',
|
||||
'greater-than-equal',
|
||||
'grimace',
|
||||
'grin',
|
||||
'grin-alt',
|
||||
'grin-beam',
|
||||
'grin-beam-sweat',
|
||||
'grin-hearts',
|
||||
'grin-squint',
|
||||
'grin-squint-tears',
|
||||
'grin-stars',
|
||||
'grin-tears',
|
||||
'grin-tongue',
|
||||
'grin-tongue-squint',
|
||||
'grin-tongue-wink',
|
||||
'grin-wink',
|
||||
'grip-horizontal',
|
||||
'grip-lines',
|
||||
'grip-lines-vertical',
|
||||
'grip-vertical',
|
||||
'guitar',
|
||||
'h-square',
|
||||
'hamburger',
|
||||
'hammer',
|
||||
'hamsa',
|
||||
'hand-holding',
|
||||
'hand-holding-heart',
|
||||
'hand-holding-usd',
|
||||
'hand-lizard',
|
||||
'hand-middle-finger',
|
||||
'hand-paper',
|
||||
'hand-peace',
|
||||
'hand-point-down',
|
||||
'hand-point-left',
|
||||
'hand-point-right',
|
||||
'hand-point-up',
|
||||
'hand-pointer',
|
||||
'hand-rock',
|
||||
'hand-scissors',
|
||||
'hand-spock',
|
||||
'hands',
|
||||
'hands-helping',
|
||||
'handshake',
|
||||
'hanukiah',
|
||||
'hard-hat',
|
||||
'hashtag',
|
||||
'hat-cowboy',
|
||||
'hat-cowboy-side',
|
||||
'hat-wizard',
|
||||
'hdd',
|
||||
'heading',
|
||||
'headphones',
|
||||
'headphones-alt',
|
||||
'headset',
|
||||
'heart',
|
||||
'heart-broken',
|
||||
'heartbeat',
|
||||
'helicopter',
|
||||
'highlighter',
|
||||
'hiking',
|
||||
'hippo',
|
||||
'history',
|
||||
'hockey-puck',
|
||||
'holly-berry',
|
||||
'home',
|
||||
'horse',
|
||||
'horse-head',
|
||||
'hospital',
|
||||
'hospital-alt',
|
||||
'hospital-symbol',
|
||||
'hot-tub',
|
||||
'hotdog',
|
||||
'hotel',
|
||||
'hourglass',
|
||||
'hourglass-end',
|
||||
'hourglass-half',
|
||||
'hourglass-start',
|
||||
'house-damage',
|
||||
'hryvnia',
|
||||
'i-cursor',
|
||||
'ice-cream',
|
||||
'icicles',
|
||||
'icons',
|
||||
'id-badge',
|
||||
'id-card',
|
||||
'id-card-alt',
|
||||
'igloo',
|
||||
'image',
|
||||
'images',
|
||||
'inbox',
|
||||
'indent',
|
||||
'industry',
|
||||
'infinity',
|
||||
'info',
|
||||
'info-circle',
|
||||
'italic',
|
||||
'jedi',
|
||||
'joint',
|
||||
'journal-whills',
|
||||
'kaaba',
|
||||
'key',
|
||||
'keyboard',
|
||||
'khanda',
|
||||
'kiss',
|
||||
'kiss-beam',
|
||||
'kiss-wink-heart',
|
||||
'kiwi-bird',
|
||||
'landmark',
|
||||
'language',
|
||||
'laptop',
|
||||
'laptop-code',
|
||||
'laptop-medical',
|
||||
'laugh',
|
||||
'laugh-beam',
|
||||
'laugh-squint',
|
||||
'laugh-wink',
|
||||
'layer-group',
|
||||
'leaf',
|
||||
'lemon',
|
||||
'less-than',
|
||||
'less-than-equal',
|
||||
'level-down-alt',
|
||||
'level-up-alt',
|
||||
'life-ring',
|
||||
'lightbulb',
|
||||
'link',
|
||||
'lira-sign',
|
||||
'list',
|
||||
'list-alt',
|
||||
'list-ol',
|
||||
'list-ul',
|
||||
'location-arrow',
|
||||
'lock',
|
||||
'lock-open',
|
||||
'long-arrow-alt-down',
|
||||
'long-arrow-alt-left',
|
||||
'long-arrow-alt-right',
|
||||
'long-arrow-alt-up',
|
||||
'low-vision',
|
||||
'luggage-cart',
|
||||
'magic',
|
||||
'magnet',
|
||||
'mail-bulk',
|
||||
'male',
|
||||
'map',
|
||||
'map-marked',
|
||||
'map-marked-alt',
|
||||
'map-marker',
|
||||
'map-marker-alt',
|
||||
'map-pin',
|
||||
'map-signs',
|
||||
'marker',
|
||||
'mars',
|
||||
'mars-double',
|
||||
'mars-stroke',
|
||||
'mars-stroke-h',
|
||||
'mars-stroke-v',
|
||||
'mask',
|
||||
'medal',
|
||||
'medkit',
|
||||
'meh',
|
||||
'meh-blank',
|
||||
'meh-rolling-eyes',
|
||||
'memory',
|
||||
'menorah',
|
||||
'mercury',
|
||||
'meteor',
|
||||
'microchip',
|
||||
'microphone',
|
||||
'microphone-alt',
|
||||
'microphone-alt-slash',
|
||||
'microphone-slash',
|
||||
'microscope',
|
||||
'minus',
|
||||
'minus-circle',
|
||||
'minus-square',
|
||||
'mitten',
|
||||
'mobile',
|
||||
'mobile-alt',
|
||||
'money-bill',
|
||||
'money-bill-alt',
|
||||
'money-bill-wave',
|
||||
'money-bill-wave-alt',
|
||||
'money-check',
|
||||
'money-check-alt',
|
||||
'monument',
|
||||
'moon',
|
||||
'mortar-pestle',
|
||||
'mosque',
|
||||
'motorcycle',
|
||||
'mountain',
|
||||
'mouse',
|
||||
'mouse-pointer',
|
||||
'mug-hot',
|
||||
'music',
|
||||
'network-wired',
|
||||
'neuter',
|
||||
'newspaper',
|
||||
'not-equal',
|
||||
'notes-medical',
|
||||
'object-group',
|
||||
'object-ungroup',
|
||||
'oil-can',
|
||||
'om',
|
||||
'otter',
|
||||
'outdent',
|
||||
'pager',
|
||||
'paint-brush',
|
||||
'paint-roller',
|
||||
'palette',
|
||||
'pallet',
|
||||
'paper-plane',
|
||||
'paperclip',
|
||||
'parachute-box',
|
||||
'paragraph',
|
||||
'parking',
|
||||
'passport',
|
||||
'pastafarianism',
|
||||
'paste',
|
||||
'pause',
|
||||
'pause-circle',
|
||||
'paw',
|
||||
'peace',
|
||||
'pen',
|
||||
'pen-alt',
|
||||
'pen-fancy',
|
||||
'pen-nib',
|
||||
'pen-square',
|
||||
'pencil-alt',
|
||||
'pencil-ruler',
|
||||
'people-carry',
|
||||
'pepper-hot',
|
||||
'percent',
|
||||
'percentage',
|
||||
'person-booth',
|
||||
'phone',
|
||||
'phone-alt',
|
||||
'phone-slash',
|
||||
'phone-square',
|
||||
'phone-square-alt',
|
||||
'phone-volume',
|
||||
'photo-video',
|
||||
'piggy-bank',
|
||||
'pills',
|
||||
'pizza-slice',
|
||||
'place-of-worship',
|
||||
'plane',
|
||||
'plane-arrival',
|
||||
'plane-departure',
|
||||
'play',
|
||||
'play-circle',
|
||||
'plug',
|
||||
'plus',
|
||||
'plus-circle',
|
||||
'plus-square',
|
||||
'podcast',
|
||||
'poll',
|
||||
'poll-h',
|
||||
'poo',
|
||||
'poo-storm',
|
||||
'poop',
|
||||
'portrait',
|
||||
'pound-sign',
|
||||
'power-off',
|
||||
'pray',
|
||||
'praying-hands',
|
||||
'prescription',
|
||||
'prescription-bottle',
|
||||
'prescription-bottle-alt',
|
||||
'print',
|
||||
'procedures',
|
||||
'project-diagram',
|
||||
'puzzle-piece',
|
||||
'qrcode',
|
||||
'question',
|
||||
'question-circle',
|
||||
'quidditch',
|
||||
'quote-left',
|
||||
'quote-right',
|
||||
'quran',
|
||||
'radiation',
|
||||
'radiation-alt',
|
||||
'rainbow',
|
||||
'random',
|
||||
'receipt',
|
||||
'record-vinyl',
|
||||
'recycle',
|
||||
'redo',
|
||||
'redo-alt',
|
||||
'registered',
|
||||
'remove-format',
|
||||
'reply',
|
||||
'reply-all',
|
||||
'republican',
|
||||
'restroom',
|
||||
'retweet',
|
||||
'ribbon',
|
||||
'ring',
|
||||
'road',
|
||||
'robot',
|
||||
'rocket',
|
||||
'route',
|
||||
'rss',
|
||||
'rss-square',
|
||||
'ruble-sign',
|
||||
'ruler',
|
||||
'ruler-combined',
|
||||
'ruler-horizontal',
|
||||
'ruler-vertical',
|
||||
'running',
|
||||
'rupee-sign',
|
||||
'sad-cry',
|
||||
'sad-tear',
|
||||
'satellite',
|
||||
'satellite-dish',
|
||||
'save',
|
||||
'school',
|
||||
'screwdriver',
|
||||
'scroll',
|
||||
'sd-card',
|
||||
'search',
|
||||
'search-dollar',
|
||||
'search-location',
|
||||
'search-minus',
|
||||
'search-plus',
|
||||
'seedling',
|
||||
'server',
|
||||
'shapes',
|
||||
'share',
|
||||
'share-alt',
|
||||
'share-alt-square',
|
||||
'share-square',
|
||||
'shekel-sign',
|
||||
'shield-alt',
|
||||
'ship',
|
||||
'shipping-fast',
|
||||
'shoe-prints',
|
||||
'shopping-bag',
|
||||
'shopping-basket',
|
||||
'shopping-cart',
|
||||
'shower',
|
||||
'shuttle-van',
|
||||
'sign',
|
||||
'sign-in-alt',
|
||||
'sign-language',
|
||||
'sign-out-alt',
|
||||
'signal',
|
||||
'signature',
|
||||
'sim-card',
|
||||
'sitemap',
|
||||
'skating',
|
||||
'skiing',
|
||||
'skiing-nordic',
|
||||
'skull',
|
||||
'skull-crossbones',
|
||||
'slash',
|
||||
'sleigh',
|
||||
'sliders-h',
|
||||
'smile',
|
||||
'smile-beam',
|
||||
'smile-wink',
|
||||
'smog',
|
||||
'smoking',
|
||||
'smoking-ban',
|
||||
'sms',
|
||||
'snowboarding',
|
||||
'snowflake',
|
||||
'snowman',
|
||||
'snowplow',
|
||||
'socks',
|
||||
'solar-panel',
|
||||
'sort',
|
||||
'sort-alpha-down',
|
||||
'sort-alpha-down-alt',
|
||||
'sort-alpha-up',
|
||||
'sort-alpha-up-alt',
|
||||
'sort-amount-down',
|
||||
'sort-amount-down-alt',
|
||||
'sort-amount-up',
|
||||
'sort-amount-up-alt',
|
||||
'sort-down',
|
||||
'sort-numeric-down',
|
||||
'sort-numeric-down-alt',
|
||||
'sort-numeric-up',
|
||||
'sort-numeric-up-alt',
|
||||
'sort-up',
|
||||
'spa',
|
||||
'space-shuttle',
|
||||
'spell-check',
|
||||
'spider',
|
||||
'spinner',
|
||||
'splotch',
|
||||
'spray-can',
|
||||
'square',
|
||||
'square-full',
|
||||
'square-root-alt',
|
||||
'stamp',
|
||||
'star',
|
||||
'star-and-crescent',
|
||||
'star-half',
|
||||
'star-half-alt',
|
||||
'star-of-david',
|
||||
'star-of-life',
|
||||
'step-backward',
|
||||
'step-forward',
|
||||
'stethoscope',
|
||||
'sticky-note',
|
||||
'stop',
|
||||
'stop-circle',
|
||||
'stopwatch',
|
||||
'store',
|
||||
'store-alt',
|
||||
'stream',
|
||||
'street-view',
|
||||
'strikethrough',
|
||||
'stroopwafel',
|
||||
'subscript',
|
||||
'subway',
|
||||
'suitcase',
|
||||
'suitcase-rolling',
|
||||
'sun',
|
||||
'superscript',
|
||||
'surprise',
|
||||
'swatchbook',
|
||||
'swimmer',
|
||||
'swimming-pool',
|
||||
'synagogue',
|
||||
'sync',
|
||||
'sync-alt',
|
||||
'syringe',
|
||||
'table',
|
||||
'table-tennis',
|
||||
'tablet',
|
||||
'tablet-alt',
|
||||
'tablets',
|
||||
'tachometer-alt',
|
||||
'tag',
|
||||
'tags',
|
||||
'tape',
|
||||
'tasks',
|
||||
'taxi',
|
||||
'teeth',
|
||||
'teeth-open',
|
||||
'temperature-high',
|
||||
'temperature-low',
|
||||
'tenge',
|
||||
'terminal',
|
||||
'text-height',
|
||||
'text-width',
|
||||
'th',
|
||||
'th-large',
|
||||
'th-list',
|
||||
'theater-masks',
|
||||
'thermometer',
|
||||
'thermometer-empty',
|
||||
'thermometer-full',
|
||||
'thermometer-half',
|
||||
'thermometer-quarter',
|
||||
'thermometer-three-quarters',
|
||||
'thumbs-down',
|
||||
'thumbs-up',
|
||||
'thumbtack',
|
||||
'ticket-alt',
|
||||
'times',
|
||||
'times-circle',
|
||||
'tint',
|
||||
'tint-slash',
|
||||
'tired',
|
||||
'toggle-off',
|
||||
'toggle-on',
|
||||
'toilet',
|
||||
'toilet-paper',
|
||||
'toolbox',
|
||||
'tools',
|
||||
'tooth',
|
||||
'torah',
|
||||
'torii-gate',
|
||||
'tractor',
|
||||
'trademark',
|
||||
'traffic-light',
|
||||
'trailer',
|
||||
'train',
|
||||
'tram',
|
||||
'transgender',
|
||||
'transgender-alt',
|
||||
'trash',
|
||||
'trash-alt',
|
||||
'trash-restore',
|
||||
'trash-restore-alt',
|
||||
'tree',
|
||||
'trophy',
|
||||
'truck',
|
||||
'truck-loading',
|
||||
'truck-monster',
|
||||
'truck-moving',
|
||||
'truck-pickup',
|
||||
'tshirt',
|
||||
'tty',
|
||||
'tv',
|
||||
'umbrella',
|
||||
'umbrella-beach',
|
||||
'underline',
|
||||
'undo',
|
||||
'undo-alt',
|
||||
'universal-access',
|
||||
'university',
|
||||
'unlink',
|
||||
'unlock',
|
||||
'unlock-alt',
|
||||
'upload',
|
||||
'user',
|
||||
'user-alt',
|
||||
'user-alt-slash',
|
||||
'user-astronaut',
|
||||
'user-check',
|
||||
'user-circle',
|
||||
'user-clock',
|
||||
'user-cog',
|
||||
'user-edit',
|
||||
'user-friends',
|
||||
'user-graduate',
|
||||
'user-injured',
|
||||
'user-lock',
|
||||
'user-md',
|
||||
'user-minus',
|
||||
'user-ninja',
|
||||
'user-nurse',
|
||||
'user-plus',
|
||||
'user-secret',
|
||||
'user-shield',
|
||||
'user-slash',
|
||||
'user-tag',
|
||||
'user-tie',
|
||||
'user-times',
|
||||
'users',
|
||||
'users-cog',
|
||||
'utensil-spoon',
|
||||
'utensils',
|
||||
'vector-square',
|
||||
'venus',
|
||||
'venus-double',
|
||||
'venus-mars',
|
||||
'vial',
|
||||
'vials',
|
||||
'video',
|
||||
'video-slash',
|
||||
'vihara',
|
||||
'voicemail',
|
||||
'volleyball-ball',
|
||||
'volume-down',
|
||||
'volume-mute',
|
||||
'volume-off',
|
||||
'volume-up',
|
||||
'vote-yea',
|
||||
'vr-cardboard',
|
||||
'walking',
|
||||
'wallet',
|
||||
'warehouse',
|
||||
'water',
|
||||
'wave-square',
|
||||
'weight',
|
||||
'weight-hanging',
|
||||
'wheelchair',
|
||||
'wifi',
|
||||
'wind',
|
||||
'window-close',
|
||||
'window-maximize',
|
||||
'window-minimize',
|
||||
'window-restore',
|
||||
'wine-bottle',
|
||||
'wine-glass',
|
||||
'wine-glass-alt',
|
||||
'won-sign',
|
||||
'wrench',
|
||||
'x-ray',
|
||||
'yen-sign',
|
||||
'yin-yang',
|
||||
]
|
||||
module.exports = [
|
||||
{
|
||||
url: '/icon/getList',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { title, pageNo = 1, pageSize = 72 } = config.body
|
||||
let mockList = data.filter((item) => {
|
||||
if (title && item.indexOf(title) < 0) return false
|
||||
return true
|
||||
})
|
||||
const pageList = mockList.filter((item, index) => index < pageSize * pageNo && index >= pageSize * (pageNo - 1))
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount: mockList.length,
|
||||
data: pageList,
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
51
mock/controller/menuManagement.js
Normal file
51
mock/controller/menuManagement.js
Normal file
@ -0,0 +1,51 @@
|
||||
module.exports = [
|
||||
{
|
||||
url: '/menuManagement/getTree',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount: 999,
|
||||
data: [
|
||||
{
|
||||
id: 'root',
|
||||
label: '全部角色',
|
||||
children: [
|
||||
{
|
||||
id: '@id',
|
||||
permission: 'admin',
|
||||
label: 'admin角色',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
permission: 'editor',
|
||||
label: 'editor角色',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/menuManagement/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/menuManagement/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
42
mock/controller/personalCenter.js
Normal file
42
mock/controller/personalCenter.js
Normal file
@ -0,0 +1,42 @@
|
||||
const { mock } = require('mockjs')
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/personalCenter/getList',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount: 999,
|
||||
data: mock({
|
||||
'data|10': [
|
||||
{
|
||||
id: '@id',
|
||||
},
|
||||
],
|
||||
}).data,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/personalCenter/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/personalCenter/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
50
mock/controller/roleManagement.js
Normal file
50
mock/controller/roleManagement.js
Normal file
@ -0,0 +1,50 @@
|
||||
const totalCount = 2
|
||||
const List = [
|
||||
{
|
||||
id: '@id',
|
||||
permission: 'admin',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
permission: 'editor',
|
||||
},
|
||||
]
|
||||
module.exports = [
|
||||
{
|
||||
url: '/roleManagement/getList',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { title = '', pageNo = 1, pageSize = 20 } = config.body
|
||||
let mockList = List.filter((item) => {
|
||||
return !(title && item.title.indexOf(title) < 0)
|
||||
})
|
||||
const pageList = mockList.filter((item, index) => index < pageSize * pageNo && index >= pageSize * (pageNo - 1))
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount,
|
||||
data: pageList,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/roleManagement/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/roleManagement/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
256
mock/controller/router.js
Normal file
256
mock/controller/router.js
Normal file
@ -0,0 +1,256 @@
|
||||
const data = [
|
||||
{
|
||||
path: '/',
|
||||
component: 'Layout',
|
||||
redirect: 'index',
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
name: 'Index',
|
||||
component: '@/views/index/index',
|
||||
meta: {
|
||||
title: '首页',
|
||||
icon: 'home',
|
||||
affix: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/personnelManagement',
|
||||
component: 'Layout',
|
||||
redirect: 'noRedirect',
|
||||
name: 'PersonnelManagement',
|
||||
meta: { title: '人员', icon: 'users-cog', permissions: ['admin'] },
|
||||
children: [
|
||||
{
|
||||
path: 'userManagement',
|
||||
name: 'UserManagement',
|
||||
component: '@/views/personnelManagement/userManagement/index',
|
||||
meta: { title: '用户管理' },
|
||||
},
|
||||
{
|
||||
path: 'roleManagement',
|
||||
name: 'RoleManagement',
|
||||
component: '@/views/personnelManagement/roleManagement/index',
|
||||
meta: { title: '角色管理' },
|
||||
},
|
||||
{
|
||||
path: 'menuManagement',
|
||||
name: 'MenuManagement',
|
||||
component: '@/views/personnelManagement/menuManagement/index',
|
||||
meta: { title: '菜单管理', badge: 'New' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/vab',
|
||||
component: 'Layout',
|
||||
redirect: 'noRedirect',
|
||||
name: 'Vab',
|
||||
alwaysShow: true,
|
||||
meta: { title: '组件', icon: 'cloud' },
|
||||
children: [
|
||||
{
|
||||
path: 'permissions',
|
||||
name: 'Permission',
|
||||
component: '@/views/vab/permissions/index',
|
||||
meta: {
|
||||
title: '权限控制',
|
||||
permissions: ['admin', 'editor'],
|
||||
badge: 'New',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'icon',
|
||||
component: 'EmptyLayout',
|
||||
redirect: 'noRedirect',
|
||||
name: 'Icon',
|
||||
meta: {
|
||||
title: '图标',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'awesomeIcon',
|
||||
name: 'AwesomeIcon',
|
||||
component: '@/views/vab/icon/index',
|
||||
meta: { title: '常规图标' },
|
||||
},
|
||||
{
|
||||
path: 'colorfulIcon',
|
||||
name: 'ColorfulIcon',
|
||||
component: '@/views/vab/icon/colorfulIcon',
|
||||
meta: { title: '多彩图标' },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'table',
|
||||
component: '@/views/vab/table/index',
|
||||
name: 'Table',
|
||||
meta: {
|
||||
title: '表格',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'webSocket',
|
||||
name: 'WebSocket',
|
||||
component: '@/views/vab/webSocket/index',
|
||||
meta: { title: 'webSocket', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'form',
|
||||
name: 'Form',
|
||||
component: '@/views/vab/form/index',
|
||||
meta: { title: '表单', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'element',
|
||||
name: 'Element',
|
||||
component: '@/views/vab/element/index',
|
||||
meta: { title: '常用组件', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'tree',
|
||||
name: 'Tree',
|
||||
component: '@/views/vab/tree/index',
|
||||
meta: { title: '树', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'verify',
|
||||
name: 'Verify',
|
||||
component: '@/views/vab/verify/index',
|
||||
meta: { title: '验证码', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'menu1',
|
||||
component: '@/views/vab/nested/menu1/index',
|
||||
name: 'Menu1',
|
||||
alwaysShow: true,
|
||||
meta: {
|
||||
title: '嵌套路由 1',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'menu1-1',
|
||||
name: 'Menu1-1',
|
||||
alwaysShow: true,
|
||||
meta: { title: '嵌套路由 1-1' },
|
||||
component: '@/views/vab/nested/menu1/menu1-1/index',
|
||||
|
||||
children: [
|
||||
{
|
||||
path: 'menu1-1-1',
|
||||
name: 'Menu1-1-1',
|
||||
meta: { title: '嵌套路由 1-1-1' },
|
||||
component: '@/views/vab/nested/menu1/menu1-1/menu1-1-1/index',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'loading',
|
||||
name: 'Loading',
|
||||
component: '@/views/vab/loading/index',
|
||||
meta: { title: 'loading', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'backToTop',
|
||||
name: 'BackToTop',
|
||||
component: '@/views/vab/backToTop/index',
|
||||
meta: { title: '返回顶部', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'lodash',
|
||||
name: 'Lodash',
|
||||
component: '@/views/vab/lodash/index',
|
||||
meta: { title: 'lodash', permissions: ['admin'] },
|
||||
},
|
||||
|
||||
{
|
||||
path: 'upload',
|
||||
name: 'Upload',
|
||||
component: '@/views/vab/upload/index',
|
||||
meta: { title: '上传', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'log',
|
||||
name: 'Log',
|
||||
component: '@/views/vab/errorLog/index',
|
||||
meta: { title: '错误日志模拟', permissions: ['admin'] },
|
||||
},
|
||||
{
|
||||
path: 'more',
|
||||
name: 'More',
|
||||
component: '@/views/vab/more/index',
|
||||
meta: { title: '关于', permissions: ['admin'] },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/mall',
|
||||
component: 'Layout',
|
||||
redirect: 'noRedirect',
|
||||
name: 'Mall',
|
||||
meta: {
|
||||
title: '商城',
|
||||
icon: 'shopping-cart',
|
||||
permissions: ['admin'],
|
||||
},
|
||||
|
||||
children: [
|
||||
{
|
||||
path: 'pay',
|
||||
name: 'Pay',
|
||||
component: '@/views/mall/pay/index',
|
||||
meta: {
|
||||
title: '支付',
|
||||
noKeepAlive: true,
|
||||
},
|
||||
children: null,
|
||||
},
|
||||
{
|
||||
path: 'goodsList',
|
||||
name: 'GoodsList',
|
||||
component: '@/views/mall/goodsList/index',
|
||||
meta: {
|
||||
title: '商品列表',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/error',
|
||||
component: 'EmptyLayout',
|
||||
redirect: 'noRedirect',
|
||||
name: 'Error',
|
||||
meta: { title: '错误页', icon: 'bug' },
|
||||
children: [
|
||||
{
|
||||
path: '401',
|
||||
name: 'Error401',
|
||||
component: '@/views/401',
|
||||
meta: { title: '401' },
|
||||
},
|
||||
{
|
||||
path: '404',
|
||||
name: 'Error404',
|
||||
component: '@/views/404',
|
||||
meta: { title: '404' },
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
module.exports = [
|
||||
{
|
||||
url: '/menu/navigate',
|
||||
type: 'post',
|
||||
response() {
|
||||
return { code: 200, msg: 'success', data: data }
|
||||
},
|
||||
},
|
||||
]
|
||||
85
mock/controller/table.js
Normal file
85
mock/controller/table.js
Normal file
@ -0,0 +1,85 @@
|
||||
const { mock } = require('mockjs')
|
||||
const { handleRandomImage } = require('../utils')
|
||||
|
||||
const List = []
|
||||
const count = 999
|
||||
for (let i = 0; i < count; i++) {
|
||||
List.push(
|
||||
mock({
|
||||
uuid: '@uuid',
|
||||
id: '@id',
|
||||
title: '@csentence(1, 2)',
|
||||
'status|1': ['published', 'draft', 'deleted'],
|
||||
author: '@cname',
|
||||
datetime: '@datetime',
|
||||
pageViews: '@integer(300, 5000)',
|
||||
img: handleRandomImage(200, 200),
|
||||
smallImg: handleRandomImage(40, 40),
|
||||
switch: '@boolean',
|
||||
percent: '@integer(80,99)',
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/table/getList',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
if (!config.body) {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount: count,
|
||||
data: mock({
|
||||
'data|50': [
|
||||
{
|
||||
id: '@id',
|
||||
title: '@csentence(1, 2)',
|
||||
'status|1': ['published', 'draft', 'deleted'],
|
||||
author: '@cname',
|
||||
datetime: '@datetime',
|
||||
pageViews: '@integer(300, 5000)',
|
||||
img: handleRandomImage(200, 200),
|
||||
smallImg: handleRandomImage(40, 40),
|
||||
switch: '@boolean',
|
||||
percent: '@integer(80,99)',
|
||||
},
|
||||
],
|
||||
}).data,
|
||||
}
|
||||
}
|
||||
const { title = '', pageNo = 1, pageSize = 20 } = config.body
|
||||
let mockList = List.filter((item) => {
|
||||
return !(title && item.title.indexOf(title) < 0)
|
||||
})
|
||||
const pageList = mockList.filter((item, index) => index < pageSize * pageNo && index >= pageSize * (pageNo - 1))
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount: count,
|
||||
data: pageList,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/table/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/table/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
54
mock/controller/tree.js
Normal file
54
mock/controller/tree.js
Normal file
@ -0,0 +1,54 @@
|
||||
const data = [
|
||||
{
|
||||
id: '1',
|
||||
parentId: '0',
|
||||
name: 'root',
|
||||
title: 'root',
|
||||
text: 'root',
|
||||
value: '1',
|
||||
rank: 1,
|
||||
children: [
|
||||
{
|
||||
id: '32816b88ff72423f960e7d492a386131',
|
||||
parentId: '1',
|
||||
name: '一级',
|
||||
title: '一级',
|
||||
text: '一级',
|
||||
value: '32816b88ff72423f960e7d492a386131',
|
||||
rank: 2,
|
||||
children: [
|
||||
{
|
||||
id: '9e11afc35d55475fb0bd3164b9684cbe',
|
||||
parentId: '32816b88ff72423f960e7d492a386131',
|
||||
name: '二级',
|
||||
title: '二级',
|
||||
text: '二级',
|
||||
value: '9e11afc35d55475fb0bd3164b9684cbe',
|
||||
rank: 3,
|
||||
children: [
|
||||
{
|
||||
id: '4cc1b04635e4444292526c5391699077',
|
||||
parentId: '9e11afc35d55475fb0bd3164b9684cbe',
|
||||
name: '三级',
|
||||
title: '三级',
|
||||
text: '三级',
|
||||
value: '4cc1b04635e4444292526c5391699077',
|
||||
rank: 4,
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
module.exports = [
|
||||
{
|
||||
url: '/tree/list',
|
||||
type: 'post',
|
||||
response() {
|
||||
return { code: 200, msg: 'success', data }
|
||||
},
|
||||
},
|
||||
]
|
||||
92
mock/controller/user.js
Normal file
92
mock/controller/user.js
Normal file
@ -0,0 +1,92 @@
|
||||
const accessTokens = {
|
||||
admin: 'admin-accessToken',
|
||||
editor: 'editor-accessToken',
|
||||
test: 'test-accessToken',
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/publicKey',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
mockServer: true,
|
||||
publicKey:
|
||||
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBT2vr+dhZElF73FJ6xiP181txKWUSNLPQQlid6DUJhGAOZblluafIdLmnUyKE8mMHhT3R+Ib3ssZcJku6Hn72yHYj/qPkCGFv0eFo7G+GJfDIUeDyalBN0QsuiE/XzPHJBuJDfRArOiWvH0BXOv5kpeXSXM8yTt5Na1jAYSiQ/wIDAQAB',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/login',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { username } = config.body
|
||||
const accessToken = accessTokens[username]
|
||||
if (!accessToken) {
|
||||
return {
|
||||
code: 500,
|
||||
msg: '帐户或密码不正确。',
|
||||
}
|
||||
}
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { accessToken },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/register',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟注册成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/userInfo',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { accessToken } = config.body
|
||||
let permissions = ['admin']
|
||||
let username = 'admin'
|
||||
if ('admin-accessToken' === accessToken) {
|
||||
permissions = ['admin']
|
||||
username = 'admin'
|
||||
}
|
||||
if ('editor-accessToken' === accessToken) {
|
||||
permissions = ['editor']
|
||||
username = 'editor'
|
||||
}
|
||||
if ('test-accessToken' === accessToken) {
|
||||
permissions = ['admin', 'editor']
|
||||
username = 'test'
|
||||
}
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
permissions,
|
||||
username,
|
||||
'avatar|1': ['https://gcore.jsdelivr.net/gh/zxwk1998/image/avatar/avatar_1.png'],
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/logout',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
67
mock/controller/userManagement.js
Normal file
67
mock/controller/userManagement.js
Normal file
@ -0,0 +1,67 @@
|
||||
const totalCount = 3
|
||||
const List = [
|
||||
{
|
||||
id: '@id',
|
||||
username: 'admin',
|
||||
password: 'admin',
|
||||
email: '@email',
|
||||
permissions: ['admin'],
|
||||
datatime: '@datetime',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
username: 'editor',
|
||||
password: 'editor',
|
||||
email: '@email',
|
||||
permissions: ['editor'],
|
||||
datatime: '@datetime',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
username: 'test',
|
||||
password: 'test',
|
||||
email: '@email',
|
||||
permissions: ['admin', 'editor'],
|
||||
datatime: '@datetime',
|
||||
},
|
||||
]
|
||||
module.exports = [
|
||||
{
|
||||
url: '/userManagement/getList',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { title = '', pageNo = 1, pageSize = 20 } = config.body
|
||||
let mockList = List.filter((item) => {
|
||||
if (title && item.title.indexOf(title) < 0) return false
|
||||
return true
|
||||
})
|
||||
const pageList = mockList.filter((item, index) => index < pageSize * pageNo && index >= pageSize * (pageNo - 1))
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
totalCount,
|
||||
data: pageList,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/userManagement/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/userManagement/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
101
mock/index.js
Normal file
101
mock/index.js
Normal file
@ -0,0 +1,101 @@
|
||||
const chokidar = require('chokidar')
|
||||
const bodyParser = require('body-parser')
|
||||
const chalk = require('chalk')
|
||||
const path = require('path')
|
||||
const { mock } = require('mockjs')
|
||||
const { baseURL } = require('../src/config')
|
||||
const mockDir = path.join(process.cwd(), 'mock')
|
||||
const { handleMockArray } = require('./utils')
|
||||
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
* @returns {{mockStartIndex: number, mockRoutesLength: number}}
|
||||
*/
|
||||
const registerRoutes = (app) => {
|
||||
let mockLastIndex
|
||||
const mocks = []
|
||||
const mockArray = handleMockArray()
|
||||
mockArray.forEach((item) => {
|
||||
const obj = require(item)
|
||||
mocks.push(...obj)
|
||||
})
|
||||
const mocksForServer = mocks.map((route) => {
|
||||
return responseFake(route.url, route.type, route.response)
|
||||
})
|
||||
for (const mock of mocksForServer) {
|
||||
app[mock.type](mock.url, mock.response)
|
||||
mockLastIndex = app._router.stack.length
|
||||
}
|
||||
const mockRoutesLength = Object.keys(mocksForServer).length
|
||||
return {
|
||||
mockRoutesLength: mockRoutesLength,
|
||||
mockStartIndex: mockLastIndex - mockRoutesLength,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url
|
||||
* @param type
|
||||
* @param respond
|
||||
* @returns {{response(*=, *=): void, type: (*|string), url: RegExp}}
|
||||
*/
|
||||
const responseFake = (url, type, respond) => {
|
||||
// 处理baseURL和url,确保不会出现双斜杠
|
||||
const base = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL
|
||||
const apiUrl = url.startsWith('/') ? url : `/${url}`
|
||||
return {
|
||||
url: new RegExp(`${base}${apiUrl}`),
|
||||
type: type || 'get',
|
||||
response(req, res) {
|
||||
res.status(200)
|
||||
if (JSON.stringify(req.body) !== '{}') {
|
||||
console.log(chalk.green(`> 请求地址:${req.path}`))
|
||||
console.log(chalk.green(`> 请求参数:${JSON.stringify(req.body)}\n`))
|
||||
} else {
|
||||
console.log(chalk.green(`> 请求地址:${req.path}\n`))
|
||||
}
|
||||
res.json(mock(respond instanceof Function ? respond(req, res) : respond))
|
||||
},
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
module.exports = (app) => {
|
||||
app.use(bodyParser.json())
|
||||
app.use(
|
||||
bodyParser.urlencoded({
|
||||
extended: true,
|
||||
})
|
||||
)
|
||||
|
||||
const mockRoutes = registerRoutes(app)
|
||||
let mockRoutesLength = mockRoutes.mockRoutesLength
|
||||
let mockStartIndex = mockRoutes.mockStartIndex
|
||||
chokidar
|
||||
.watch(mockDir, {
|
||||
ignored: /mock-server/,
|
||||
ignoreInitial: true,
|
||||
})
|
||||
.on('all', (event) => {
|
||||
if (event === 'change' || event === 'add') {
|
||||
try {
|
||||
app._router.stack.splice(mockStartIndex, mockRoutesLength)
|
||||
|
||||
Object.keys(require.cache).forEach((item) => {
|
||||
if (item.includes(mockDir)) {
|
||||
delete require.cache[require.resolve(item)]
|
||||
}
|
||||
})
|
||||
const mockRoutes = registerRoutes(app)
|
||||
mockRoutesLength = mockRoutes.mockRoutesLength
|
||||
mockStartIndex = mockRoutes.mockStartIndex
|
||||
} catch (error) {
|
||||
console.log(chalk.red(error))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
44
mock/utils/index.js
Normal file
44
mock/utils/index.js
Normal file
@ -0,0 +1,44 @@
|
||||
const { Random } = require('mockjs')
|
||||
const { join } = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
/**
|
||||
* @author https://github.com/zxwk1998/vue-admin-better (不想保留author可删除)
|
||||
* @description 随机生成图片url。
|
||||
* @param width
|
||||
* @param height
|
||||
* @returns {string}
|
||||
*/
|
||||
function handleRandomImage(width = 50, height = 50) {
|
||||
return `https://picsum.photos/${width}/${height}?random=${Random.guid()}`
|
||||
}
|
||||
|
||||
/**
|
||||
* @author https://github.com/zxwk1998/vue-admin-better (不想保留author可删除)
|
||||
* @description 处理所有 controller 模块,npm run serve时在node环境中自动输出controller文件夹下Mock接口,请勿修改。
|
||||
* @returns {[]}
|
||||
*/
|
||||
function handleMockArray() {
|
||||
const mockArray = []
|
||||
const getFiles = (jsonPath) => {
|
||||
const jsonFiles = []
|
||||
const findJsonFile = (path) => {
|
||||
const files = fs.readdirSync(path)
|
||||
files.forEach((item) => {
|
||||
const fPath = join(path, item)
|
||||
const stat = fs.statSync(fPath)
|
||||
if (stat.isDirectory() === true) findJsonFile(item)
|
||||
if (stat.isFile() === true) jsonFiles.push(item)
|
||||
})
|
||||
}
|
||||
findJsonFile(jsonPath)
|
||||
jsonFiles.forEach((item) => mockArray.push(`./controller/${item}`))
|
||||
}
|
||||
getFiles('mock/controller')
|
||||
return mockArray
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
handleRandomImage,
|
||||
handleMockArray,
|
||||
}
|
||||
100
package.json
Normal file
100
package.json
Normal file
@ -0,0 +1,100 @@
|
||||
{
|
||||
"name": "vue-admin-better",
|
||||
"version": "3.0.0",
|
||||
"author": "zxwk1998",
|
||||
"participants": [],
|
||||
"homepage": "https://vuejs-core.cn",
|
||||
"scripts": {
|
||||
"serve:rspack": "node --no-deprecation rspack.js serve",
|
||||
"build": "node --no-deprecation rspack.js build",
|
||||
"print-info": "node -e \"require('./layouts').donationConsole()\"",
|
||||
"lint": "eslint {src,mock,library}/**/*.{vue,js} --fix",
|
||||
"lint:prettier": "prettier {src,mock,library}/**/*.{html,vue,css,sass,scss,js,ts,md} --write",
|
||||
"clear": "rimraf node_modules&&npm install --registry=--registry=https://registry.npmmirror.com",
|
||||
"update": "ncu -u --reject vue-loader,vue-echarts,webpack,eslint-plugin-prettier,@vue/eslint-config-prettier,prettier,layouts,sass-loader,sass,screenfull,eslint,chalk,vue,vue-template-compiler,vue-router,vuex,@vue/cli-plugin-babel,@vue/cli-plugin-eslint,@vue/cli-service,eslint-plugin-vue --registry=https://registry.npmmirror.com&&pnpm i",
|
||||
"push": "start ./push.sh"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zxwk1998/vue-admin-better.git"
|
||||
},
|
||||
"gitHooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,vue}": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.11.0",
|
||||
"bcryptjs": "^3.0.3",
|
||||
"caniuse-lite": "^1.0.30001734",
|
||||
"clipboard": "^2.0.11",
|
||||
"core-js": "^3.45.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"echarts": "6.0.0",
|
||||
"element-ui": "^2.15.14",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"layouts": "file:layouts",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "^16.1.2",
|
||||
"mockjs": "^1.1.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"qs": "^6.14.0",
|
||||
"screenfull": "^5.2.0",
|
||||
"sortablejs": "^1.15.6",
|
||||
"vab-icon": "file:vab-icon",
|
||||
"vue": "~2.7.14",
|
||||
"vue-echarts": "6.7.3",
|
||||
"vue-router": "^3.6.5",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rspack/cli": "^1.4.11",
|
||||
"@rspack/core": "^1.4.11",
|
||||
"@rspack/dev-server": "^1.1.4",
|
||||
"@vue/cli-plugin-babel": "^5.0.8",
|
||||
"archiver": "^7.0.1",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-loader": "^10.0.0",
|
||||
"body-parser": "^2.2.0",
|
||||
"chalk": "^4.1.2",
|
||||
"chokidar": "^4.0.3",
|
||||
"css-loader": "^7.1.2",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"eslint-plugin-vue": "^9.1.1",
|
||||
"fs-extra": "^11.3.1",
|
||||
"html-rspack-plugin": "^6.1.2",
|
||||
"lint-staged": "^16.1.5",
|
||||
"path-browserify": "^1.0.1",
|
||||
"prettier": "^2.8.8",
|
||||
"sass": "~1.32.13",
|
||||
"sass-loader": "^10.1.1",
|
||||
"style-loader": "^4.0.0",
|
||||
"stylelint": "^16.23.1",
|
||||
"stylelint-config-prettier": "^9.0.5",
|
||||
"stylelint-config-recess-order": "^7.2.0",
|
||||
"vue-loader": "15.9.8",
|
||||
"vue-template-compiler": "~2.7.14"
|
||||
},
|
||||
"keywords": [
|
||||
"vue",
|
||||
"admin",
|
||||
"dashboard",
|
||||
"element-ui",
|
||||
"vue-admin",
|
||||
"element-admin",
|
||||
"boilerplate",
|
||||
"admin-template",
|
||||
"management-system"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8.9",
|
||||
"npm": ">= 3.0.0"
|
||||
}
|
||||
}
|
||||
10558
pnpm-lock.yaml
generated
Normal file
10558
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
prettier.config.js
Normal file
20
prettier.config.js
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @author https://vuejs-core.cn (不想保留author可删除)
|
||||
* @description 代码规范
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
printWidth: 140,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
quoteProps: 'as-needed',
|
||||
jsxSingleQuote: false,
|
||||
trailingComma: 'es5',
|
||||
bracketSpacing: true,
|
||||
arrowParens: 'always',
|
||||
htmlWhitespaceSensitivity: 'ignore',
|
||||
vueIndentScriptAndStyle: true,
|
||||
endOfLine: 'lf',
|
||||
}
|
||||
12
push.sh
Normal file
12
push.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#强制推送
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
git init
|
||||
git add -A
|
||||
git commit -m '🎉 feat: init project'
|
||||
git push -f "https://${access_token}@github.com/zxwk1998/vue-admin-better.git" master
|
||||
exec /bin/bash
|
||||
|
||||
|
||||
|
||||
|
||||
287
rspack.config.js
Normal file
287
rspack.config.js
Normal file
@ -0,0 +1,287 @@
|
||||
const path = require('path')
|
||||
const { Configuration, DefinePlugin, BannerPlugin } = require('@rspack/core')
|
||||
const HtmlRspackPlugin = require('html-rspack-plugin')
|
||||
const { VueLoaderPlugin } = require('vue-loader')
|
||||
const { publicPath, assetsDir, outputDir, title, devPort } = require('./src/config')
|
||||
const dayjs = require('dayjs')
|
||||
const time = dayjs().format('YYYY-M-D HH:mm:ss')
|
||||
const fs = require('fs-extra')
|
||||
const { webpackBanner } = require('./layouts')
|
||||
|
||||
// 设置环境变量
|
||||
process.env.VUE_APP_TITLE = title || 'Wagoo'
|
||||
process.env.VUE_APP_UPDATE_TIME = time
|
||||
process.env.BASE_URL = publicPath
|
||||
// 删除这一行,避免覆盖rspack.js中设置的值
|
||||
// process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
process.env.VUE_APP_MOCK_ENABLE = 'false' // 启用mock
|
||||
process.env.VUE_APP_AUTHOR = 'Wagoo' // 设置作者
|
||||
|
||||
const resolve = (dir) => path.join(__dirname, dir)
|
||||
// 定义一个模式变量,避免冲突
|
||||
const mode = process.env.NODE_ENV || 'development'
|
||||
|
||||
/**
|
||||
* @type {Configuration}
|
||||
*/
|
||||
module.exports = {
|
||||
mode: mode,
|
||||
context: __dirname,
|
||||
entry: {
|
||||
app: './src/main.js',
|
||||
},
|
||||
output: {
|
||||
path: resolve(outputDir),
|
||||
publicPath: publicPath,
|
||||
filename: 'js/[name].[contenthash:8].js',
|
||||
chunkFilename: 'js/[name].[contenthash:8].js',
|
||||
assetModuleFilename: `${assetsDir}/[name].[hash][ext][query]`,
|
||||
},
|
||||
// 增加性能提示配置
|
||||
performance: {
|
||||
// 提高阈值以减少警告
|
||||
maxEntrypointSize: 3000000, // 3MB
|
||||
maxAssetSize: 1000000, // 1MB
|
||||
// 只在生产环境显示性能警告
|
||||
hints: mode === 'production' ? 'warning' : false,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
compilerOptions: {
|
||||
preserveWhitespace: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@vue/cli-plugin-babel/preset'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
modules: {
|
||||
auto: true,
|
||||
localIdentName: '[path][name]__[local]--[hash:base64:5]',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
additionalData: (content, loaderContext) => {
|
||||
const { resourcePath, rootContext } = loaderContext
|
||||
const relativePath = path.relative(rootContext, resourcePath)
|
||||
if (relativePath.replace(/\\/g, '/') !== 'src/styles/variables.scss') {
|
||||
return `@import "~@/styles/variables.scss";${content}`
|
||||
}
|
||||
return content
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg)$/,
|
||||
type: 'asset',
|
||||
parser: {
|
||||
dataUrlCondition: {
|
||||
maxSize: 10 * 1024, // 10KB
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|eot|ttf|otf)$/,
|
||||
type: 'asset',
|
||||
parser: {
|
||||
dataUrlCondition: {
|
||||
maxSize: 30 * 1024, // 增加到30KB
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
resourceQuery: /raw/,
|
||||
type: 'asset/source',
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: {
|
||||
'@': resolve('src'),
|
||||
vue$: 'vue/dist/vue.esm.js',
|
||||
path: 'path-browserify',
|
||||
fs: false,
|
||||
},
|
||||
fallback: {
|
||||
path: require.resolve('path-browserify'),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new DefinePlugin({
|
||||
// 完全移除可能引起冲突的NODE_ENV定义,让rspack.js来处理
|
||||
'process.env.BASE_URL': JSON.stringify(process.env.BASE_URL),
|
||||
'process.env.VUE_APP_TITLE': JSON.stringify(process.env.VUE_APP_TITLE),
|
||||
'process.env.VUE_APP_MOCK_ENABLE': JSON.stringify(process.env.VUE_APP_MOCK_ENABLE),
|
||||
'process.env.VUE_APP_AUTHOR': JSON.stringify(process.env.VUE_APP_AUTHOR),
|
||||
'process.env.VUE_APP_UPDATE_TIME': JSON.stringify(process.env.VUE_APP_UPDATE_TIME),
|
||||
}),
|
||||
new HtmlRspackPlugin({
|
||||
template: './public/index.html',
|
||||
filename: 'index.html',
|
||||
title: title || 'vue-admin-better',
|
||||
inject: 'body',
|
||||
templateParameters: {
|
||||
BASE_URL: publicPath,
|
||||
VUE_APP_TITLE: process.env.VUE_APP_TITLE,
|
||||
VUE_APP_AUTHOR: process.env.VUE_APP_AUTHOR,
|
||||
},
|
||||
minify:
|
||||
mode === 'production'
|
||||
? {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true,
|
||||
collapseBooleanAttributes: true,
|
||||
removeScriptTypeAttributes: true,
|
||||
}
|
||||
: false,
|
||||
}),
|
||||
// 添加版权信息到打包文件头部
|
||||
new BannerPlugin({
|
||||
banner: webpackBanner(time),
|
||||
entryOnly: false,
|
||||
include: /\.(js|css)$/,
|
||||
}),
|
||||
// 添加CopyPlugin功能,将public目录下除index.html外的文件复制到dist目录
|
||||
{
|
||||
apply(compiler) {
|
||||
compiler.hooks.afterEmit.tap('CopyPublicFolderPlugin', (compilation) => {
|
||||
// 确保目标目录存在
|
||||
const targetPath = path.resolve(__dirname, 'dist');
|
||||
fs.ensureDirSync(targetPath);
|
||||
|
||||
// 复制public目录下的所有文件(除了index.html)
|
||||
fs.copySync(
|
||||
path.resolve(__dirname, 'public'),
|
||||
targetPath,
|
||||
{
|
||||
filter: (src) => {
|
||||
// 不复制index.html文件,因为HtmlRspackPlugin会处理它
|
||||
return !src.endsWith('index.html');
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
],
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
automaticNameDelimiter: '-',
|
||||
chunks: 'all',
|
||||
// 增加maxInitialRequests以允许更多的初始化块
|
||||
maxInitialRequests: 6,
|
||||
// 减小最小块大小,允许更细粒度的分割
|
||||
minSize: 20000,
|
||||
cacheGroups: {
|
||||
chunk: {
|
||||
name: 'vab-chunk',
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
minSize: 131072,
|
||||
maxSize: 524288,
|
||||
chunks: 'async',
|
||||
minChunks: 2,
|
||||
priority: 10,
|
||||
},
|
||||
vue: {
|
||||
name: 'vue',
|
||||
test: /[\\/]node_modules[\\/](vue(.*)|core-js)[\\/]/,
|
||||
chunks: 'initial',
|
||||
priority: 20,
|
||||
},
|
||||
elementUI: {
|
||||
name: 'element-ui',
|
||||
test: /[\\/]node_modules[\\/]element-ui(.*)[\\/]/,
|
||||
priority: 30,
|
||||
},
|
||||
// 单独拆分常用工具库
|
||||
vendors: {
|
||||
name: 'vendors',
|
||||
test: /[\\/]node_modules[\\/](lodash|axios|qs|dayjs)[\\/]/,
|
||||
chunks: 'all',
|
||||
priority: 35,
|
||||
},
|
||||
// 拆分样式资源
|
||||
styles: {
|
||||
name: 'styles',
|
||||
test: /\.(css|scss)$/,
|
||||
chunks: 'all',
|
||||
enforce: true,
|
||||
priority: 40,
|
||||
},
|
||||
extra: {
|
||||
name: 'vab-layouts',
|
||||
test: resolve('src/layouts'),
|
||||
priority: 40,
|
||||
},
|
||||
},
|
||||
},
|
||||
// 添加压缩配置
|
||||
minimize: mode === 'production',
|
||||
// 如果是生产环境,增加tree shaking
|
||||
usedExports: mode === 'production',
|
||||
},
|
||||
devServer: {
|
||||
hot: true,
|
||||
// 修改端口,避免冲突
|
||||
port: 8090,
|
||||
historyApiFallback: true,
|
||||
static: {
|
||||
directory: path.join(__dirname, 'public'),
|
||||
},
|
||||
client: {
|
||||
overlay: {
|
||||
errors: true,
|
||||
warnings: false,
|
||||
},
|
||||
},
|
||||
open: {
|
||||
target: ['http://localhost:8090'],
|
||||
},
|
||||
setupMiddlewares: (middlewares, devServer) => {
|
||||
if (!devServer) {
|
||||
throw new Error('dev-server is not defined')
|
||||
}
|
||||
|
||||
if (process.env.VUE_APP_MOCK_ENABLE === 'true') {
|
||||
const mockServer = require('./mock/index')
|
||||
mockServer(devServer.app)
|
||||
}
|
||||
|
||||
return middlewares
|
||||
},
|
||||
},
|
||||
}
|
||||
205
rspack.js
Normal file
205
rspack.js
Normal file
@ -0,0 +1,205 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// 禁用弃用警告
|
||||
process.noDeprecation = true
|
||||
|
||||
const { rspack } = require('@rspack/core')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
// 引入layouts中的donationConsole函数
|
||||
const { donationConsole } = require('./layouts')
|
||||
|
||||
// 在命令行控制台打印信息
|
||||
donationConsole()
|
||||
|
||||
const configPath = path.resolve(__dirname, 'rspack.config.js')
|
||||
const config = require(configPath)
|
||||
const mode = process.argv[2] === 'build' ? 'production' : 'development'
|
||||
|
||||
// 增加archiver依赖用于创建压缩包
|
||||
const archiver = require('archiver')
|
||||
const { promisify } = require('util')
|
||||
const pipeline = promisify(require('stream').pipeline)
|
||||
|
||||
// 增强环境变量设置,确保所有编译阶段都使用相同的NODE_ENV值
|
||||
process.env.NODE_ENV = mode
|
||||
// 设置webpack特定的环境变量,以避免冲突
|
||||
process.env.WEBPACK_ENV = mode
|
||||
process.env.BABEL_ENV = mode
|
||||
console.log('设置环境变量 NODE_ENV =', process.env.NODE_ENV)
|
||||
|
||||
// 读取配置
|
||||
config.mode = mode
|
||||
|
||||
if (mode === 'production') {
|
||||
// 生产环境配置
|
||||
console.log('正在极速打包中,预计用时5秒,请稍后...')
|
||||
|
||||
// 生产环境下增加额外配置
|
||||
config.optimization = {
|
||||
...config.optimization,
|
||||
moduleIds: 'deterministic', // 稳定的模块ID以优化长期缓存
|
||||
chunkIds: 'deterministic', // 稳定的chunk ID以优化长期缓存
|
||||
removeEmptyChunks: true, // 移除空的chunks
|
||||
}
|
||||
|
||||
// 在构建前删除dist目录
|
||||
const distPath = path.resolve(__dirname, 'dist')
|
||||
if (fs.existsSync(distPath)) {
|
||||
fs.rmSync(distPath, { recursive: true })
|
||||
console.log('已删除旧的dist目录')
|
||||
}
|
||||
|
||||
rspack(config).run((err, stats) => {
|
||||
if (err) {
|
||||
console.error(err.stack || err)
|
||||
if (err.details) {
|
||||
console.error(err.details)
|
||||
}
|
||||
process.exit(1)
|
||||
return
|
||||
}
|
||||
|
||||
const info = stats.toJson()
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
console.error(info.errors)
|
||||
}
|
||||
|
||||
if (stats.hasWarnings()) {
|
||||
console.warn(info.warnings)
|
||||
}
|
||||
|
||||
console.log(
|
||||
stats.toString({
|
||||
colors: true,
|
||||
modules: false,
|
||||
children: false,
|
||||
chunks: false,
|
||||
chunkModules: false,
|
||||
})
|
||||
)
|
||||
|
||||
// 打包完成后创建压缩包
|
||||
createArchive()
|
||||
})
|
||||
} else {
|
||||
// 开发环境配置
|
||||
try {
|
||||
// 尝试使用rspack的dev server
|
||||
const { RspackDevServer } = require('@rspack/dev-server')
|
||||
|
||||
const compiler = rspack(config)
|
||||
|
||||
// 使用rspack.config.js中的所有devServer配置
|
||||
const devServerOptions = config.devServer || {}
|
||||
|
||||
// 设置mock服务器
|
||||
if (process.env.VUE_APP_MOCK_ENABLE === 'true' && !devServerOptions.setupMiddlewares) {
|
||||
devServerOptions.setupMiddlewares = (middlewares, devServer) => {
|
||||
if (!devServer) {
|
||||
throw new Error('dev-server is not defined')
|
||||
}
|
||||
|
||||
const mockServer = require('./mock/index')
|
||||
mockServer(devServer.app)
|
||||
|
||||
return middlewares
|
||||
}
|
||||
}
|
||||
|
||||
const server = new RspackDevServer(devServerOptions, compiler)
|
||||
|
||||
server.start().catch((err) => {
|
||||
console.error('启动RspackDevServer失败:', err)
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('加载@rspack/dev-server失败,尝试使用webpack-dev-server:', error)
|
||||
|
||||
// 如果rspack dev server失败,尝试回退到webpack
|
||||
try {
|
||||
const webpack = require('webpack')
|
||||
const WebpackDevServer = require('webpack-dev-server')
|
||||
|
||||
const webpackConfig = {
|
||||
...config,
|
||||
// 添加webpack特定配置
|
||||
mode: config.mode,
|
||||
}
|
||||
|
||||
const compiler = webpack(webpackConfig)
|
||||
const devServerOptions = config.devServer || {}
|
||||
|
||||
if (process.env.VUE_APP_MOCK_ENABLE === 'true') {
|
||||
const originalBefore = devServerOptions.before
|
||||
devServerOptions.before = (app, server) => {
|
||||
if (originalBefore) {
|
||||
originalBefore(app, server)
|
||||
}
|
||||
const mockServer = require('./mock/index')
|
||||
mockServer(app)
|
||||
}
|
||||
}
|
||||
|
||||
const server = new WebpackDevServer(devServerOptions, compiler)
|
||||
|
||||
server.start().catch((err) => {
|
||||
console.error('启动WebpackDevServer失败:', err)
|
||||
})
|
||||
} catch (webpackError) {
|
||||
console.error('回退到webpack-dev-server也失败:', webpackError)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 创建压缩包的函数
|
||||
async function createArchive() {
|
||||
const outputPath = path.resolve(__dirname, 'dist')
|
||||
// 修改为在dist目录内创建压缩包
|
||||
const archivePath = path.resolve(__dirname, 'dist', 'dist.zip')
|
||||
|
||||
// 检查dist目录是否存在
|
||||
if (!fs.existsSync(outputPath)) {
|
||||
console.error('dist目录不存在,请先执行构建')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('正在创建压缩包...')
|
||||
|
||||
try {
|
||||
// 创建写入流
|
||||
const output = fs.createWriteStream(archivePath)
|
||||
// 创建archiver实例
|
||||
const archive = archiver('zip', {
|
||||
zlib: { level: 9 } // 设置压缩级别
|
||||
})
|
||||
|
||||
// 监听完成事件
|
||||
output.on('close', function() {
|
||||
console.log(`压缩包创建完成: ${archivePath}`)
|
||||
console.log(`压缩包大小: ${(archive.pointer() / 1024 / 1024).toFixed(2)} MB`)
|
||||
})
|
||||
|
||||
// 监听错误事件
|
||||
archive.on('error', function(err) {
|
||||
throw err
|
||||
})
|
||||
|
||||
// 关联archiver和输出流
|
||||
archive.pipe(output)
|
||||
|
||||
// 添加整个dist目录到压缩包,但排除dist.zip自身
|
||||
archive.glob('**/*', {
|
||||
cwd: outputPath,
|
||||
ignore: 'dist.zip' // 忽略压缩包自身
|
||||
})
|
||||
|
||||
// 完成归档
|
||||
await archive.finalize()
|
||||
|
||||
console.log('打包并压缩完成!')
|
||||
} catch (error) {
|
||||
console.error('创建压缩包时出错:', error)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user