Browse Source

💗 integrated packaging analysis

pull/12/head
就眠仪式 3 years ago
parent
commit
faa712b7ab
  1. 14
      README.md
  2. 9
      package.json
  3. 2
      src/assets/css/theme.less
  4. 1
      src/store/getters.js
  5. 12
      src/store/modules/user.js
  6. 2
      src/view/account/center.vue
  7. 2
      src/view/permission/permission.vue
  8. 3279
      stats.html
  9. 16
      vite.config.js

14
README.md

@ -93,15 +93,21 @@ Github 开源地址: [前往下载](https://github.com/PearAdmin/Pear-Admin-Ant)
npm install
// 开发预览
// 运行项目
npm run serve
npm run serve-vite
// 开发打包
npm run build
// 构建项目
// 生产打包
npm run build-vite
npm run build-prod
// 项目分析
npm run analyzer
```

9
package.json

@ -3,8 +3,11 @@
"version": "2.0.1-Release",
"private": true,
"scripts": {
"serve-vite": "vite",
"build-vite": "vite build"
"//": "开发预览",
"serve": "vite",
"build": "vite build",
"build-prod": "vite build --mode production",
"analyzer": "set vis=true && vite build"
},
"dependencies": {
"@ant-design-vue/use": "^0.0.1-alpha.10",
@ -17,6 +20,7 @@
"lodash.get": "^4.4.2",
"moment": "^2.27.0",
"nprogress": "^0.2.0",
"rollup-plugin-visualizer": "^5.5.2",
"vue": "^3.2.12",
"vue-i18n": "^9.1.7",
"vue-router": "^4.0.10",
@ -33,6 +37,7 @@
"less-loader": "^7.1.0",
"mockjs2": "^1.0.8",
"node-sass": "^6.0.0",
"rollup-plugin-analyzer": "^4.0.0",
"sass-loader": "^10.0.2",
"vite": "^2.5.8"
},

2
src/assets/css/theme.less

@ -326,4 +326,4 @@
}
.ant-menu-submenu-title>span{
font-size: 13.8px!important;
}
}

1
src/store/getters.js

@ -21,5 +21,6 @@ const getters = {
menu: state => state.user.userRoutes,
power: state => state.user.userPowers,
userInfo: state => state.user.userInfo,
token: state => state.user.token
};
export default getters;

12
src/store/modules/user.js

@ -3,10 +3,10 @@ import { createRouteByList, createRouteByTree} from "@/route/permission";
import { message } from "ant-design-vue";
const state = {
token: localStorage.getItem("USER_TOKEN") ? localStorage.getItem("token") : "",
userInfo: localStorage.getItem('USER_INFO') ? localStorage.getItem('USER_INFO') : null,
userRoutes: localStorage.getItem("USER_ROUTES") ? localStorage.getItem("USER_ROUTES") : [],
userPowers: localStorage.getItem("USER_POWERS") ? localStorage.getItem("USER_POWERS") : []
token: localStorage.getItem("USER_TOKEN") != null ? localStorage.getItem("USER_TOKEN") : "",
userInfo: localStorage.getItem('USER_INFO') != null ? localStorage.getItem('USER_INFO') : null,
userRoutes: localStorage.getItem("USER_ROUTES") != null ? localStorage.getItem("USER_ROUTES") : [],
userPowers: localStorage.getItem("USER_POWERS") != null ? localStorage.getItem("USER_POWERS") : []
}
const mutations = {
@ -21,7 +21,7 @@ const mutations = {
},
SET_USER_INFO(state, userInfo) {
state.userInfo = userInfo
localStorage.setItem('USER_INFO', JSON.stringify(userInfo))
localStorage.setItem('USER_INFO', userInfo)
},
SET_USER_MENU(state, menuList) {
if (menuList && menuList.length === 0) {
@ -56,7 +56,7 @@ const actions = {
const response = await login(data)
const {code, message, result: userInfo} = response
if (code === 200) {
const {token} = userInfo
const { token } = userInfo
delete userInfo.menuList
delete userInfo.token
commit('SET_USER_TOKEN', token)

2
src/view/account/center.vue

@ -9,7 +9,7 @@
:size="64"
src="https://portrait.gitee.com/uploads/avatars/user/2813/8441097_shaynas_1610801433.png!avatar200"
/>
<div class="username">夏娜</div>
<div class="username">就眠仪式</div>
<div class="address">China</div>
<a-divider />
<div class="desc">江湖无名安心练剑</div>

2
src/view/permission/permission.vue

@ -8,7 +8,7 @@
<a-row :gutter="[10,10]">
<a-col :span="24">
<a-card>
<h3>[ {{ useInfo?.permissions[0]?.role }} ]</h3>
<h3>[ {{ useInfo.username }} ]</h3>
</a-card>
</a-col>
<a-col :span="24">

3279
stats.html
File diff suppressed because it is too large
View File

16
vite.config.js

@ -1,12 +1,22 @@
import { resolve } from 'path/posix';
import { defineConfig } from 'vite';
import vue from "@vitejs/plugin-vue";
import visualizer from "rollup-plugin-visualizer";
const plugins = [vue()];
if (process.env.vis) {
plugins.push(
visualizer({
open: true,
gzipSize: true,
brotliSize: true,
})
);
}
export default defineConfig({
plugins: [
vue()
],
plugins,
server: {
port: 8080
},

Loading…
Cancel
Save