奇淼(piexlmax
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 359 additions and 123 deletions
-
4server/middleware/casbin_rbac.go
-
2server/resource/rbac_model.conf
-
28server/service/system/sys_casbin.go
-
11web/index.html
-
206web/package-lock.json
-
5web/package.json
-
50web/src/core/config.js
-
8web/src/view/login/index.vue
-
151web/vite.config.js
-
13web/yarn.lock
@ -1,15 +1,18 @@ |
|||||
|
|
||||
<!DOCTYPE html> |
<!DOCTYPE html> |
||||
<html lang="en"> |
<html lang="en"> |
||||
|
|
||||
<head> |
<head> |
||||
<meta charset="utf-8"> |
<meta charset="utf-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
||||
|
<meta content="Gin,Vue,Admin.Gin-Vue-Admin,GVA,gin-vue-admin,后台管理框架,vue后台管理框架,gin-vue-admin文档,gin-vue-admin首页,gin-vue-admin" name="keywords" /> |
||||
<link rel="icon" href="favicon.ico"> |
<link rel="icon" href="favicon.ico"> |
||||
<title></title> |
<title></title> |
||||
</head> |
|
||||
|
</head> |
||||
|
|
||||
<body> |
<body> |
||||
<div id="app"></div> |
|
||||
<script type="module" src="./src/main.js"></script> |
|
||||
|
<div id="app"></div> |
||||
|
<script type="module" src="./src/main.js"></script> |
||||
</body> |
</body> |
||||
|
|
||||
</html> |
</html> |
@ -1,83 +1,92 @@ |
|||||
/* eslint-disable */ |
|
||||
import legacyPlugin from '@vitejs/plugin-legacy'; |
|
||||
|
import legacyPlugin from '@vitejs/plugin-legacy' |
||||
// import usePluginImport from 'vite-plugin-importer';
|
// import usePluginImport from 'vite-plugin-importer';
|
||||
import * as path from 'path'; |
|
||||
import * as dotenv from 'dotenv'; |
|
||||
import * as fs from 'fs'; |
|
||||
import vuePlugin from '@vitejs/plugin-vue'; |
|
||||
|
import { viteLogo } from './src/core/config' |
||||
|
import Banner from 'vite-plugin-banner' |
||||
|
import * as path from 'path' |
||||
|
import * as dotenv from 'dotenv' |
||||
|
import * as fs from 'fs' |
||||
|
import vuePlugin from '@vitejs/plugin-vue' |
||||
// @see https://cn.vitejs.dev/config/
|
// @see https://cn.vitejs.dev/config/
|
||||
export default ({ |
export default ({ |
||||
command, |
|
||||
mode |
|
||||
|
command, |
||||
|
mode |
||||
}) => { |
}) => { |
||||
let NODE_ENV = process.env.NODE_ENV || 'development' |
|
||||
let envFiles=[ |
|
||||
`.env.${NODE_ENV}` |
|
||||
] |
|
||||
for (const file of envFiles) { |
|
||||
const envConfig = dotenv.parse(fs.readFileSync(file)) |
|
||||
for (const k in envConfig) { |
|
||||
process.env[k] = envConfig[k] |
|
||||
} |
|
||||
} |
|
||||
|
const NODE_ENV = process.env.NODE_ENV || 'development' |
||||
|
const envFiles = [ |
||||
|
`.env.${NODE_ENV}` |
||||
|
] |
||||
|
for (const file of envFiles) { |
||||
|
const envConfig = dotenv.parse(fs.readFileSync(file)) |
||||
|
for (const k in envConfig) { |
||||
|
process.env[k] = envConfig[k] |
||||
|
} |
||||
|
} |
||||
|
|
||||
let rollupOptions = {}; |
|
||||
|
viteLogo(process.env) |
||||
|
|
||||
|
const timestamp = Date.parse(new Date()) |
||||
|
|
||||
let optimizeDeps = {}; |
|
||||
|
const rollupOptions = { |
||||
|
output: { |
||||
|
entryFileNames: `gva/gin-vue-admin-[name].${timestamp}.js`, |
||||
|
chunkFileNames: `js/gin-vue-admin-[name].${timestamp}.js`, |
||||
|
assetFileNames: `assets/gin-vue-admin-[name].${timestamp}.[ext]` |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const optimizeDeps = {} |
||||
|
|
||||
let alias = { |
|
||||
'@': path.resolve(__dirname, './src'), |
|
||||
'vue$': 'vue/dist/vue.runtime.esm-bundler.js', |
|
||||
} |
|
||||
|
const alias = { |
||||
|
'@': path.resolve(__dirname, './src'), |
||||
|
'vue$': 'vue/dist/vue.runtime.esm-bundler.js', |
||||
|
} |
||||
|
|
||||
let esbuild = {} |
|
||||
|
const esbuild = {} |
||||
|
|
||||
return { |
|
||||
base: './', // index.html文件所在位置
|
|
||||
root: './', // js导入的资源路径,src
|
|
||||
resolve: { |
|
||||
alias, |
|
||||
}, |
|
||||
define: { |
|
||||
'process.env': {} |
|
||||
}, |
|
||||
server: { |
|
||||
open:true, |
|
||||
port: process.env.VITE_CLI_PORT, |
|
||||
proxy:{ |
|
||||
// 把key的路径代理到target位置
|
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
|
||||
[process.env.VITE_BASE_API]: { // 需要代理的路径 例如 '/api'
|
|
||||
target: `${process.env.VITE_BASE_PATH}:${process.env.VITE_SERVER_PORT}/`, // 代理到 目标路径
|
|
||||
changeOrigin: true, |
|
||||
rewrite: path => path.replace(new RegExp('^' + process.env.VITE_BASE_API), ''), |
|
||||
} |
|
||||
}, |
|
||||
}, |
|
||||
build: { |
|
||||
target: 'es2015', |
|
||||
minify: 'terser', // 是否进行压缩,boolean | 'terser' | 'esbuild',默认使用terser
|
|
||||
manifest: false, // 是否产出maifest.json
|
|
||||
sourcemap: false, // 是否产出soucemap.json
|
|
||||
outDir: 'dist', // 产出目录
|
|
||||
rollupOptions, |
|
||||
}, |
|
||||
esbuild, |
|
||||
optimizeDeps, |
|
||||
plugins: [ |
|
||||
legacyPlugin({ |
|
||||
targets: ['Android > 39', 'Chrome >= 60', 'Safari >= 10.1', 'iOS >= 10.3', 'Firefox >= 54', 'Edge >= 15'], |
|
||||
}), vuePlugin(), |
|
||||
], |
|
||||
css: { |
|
||||
preprocessorOptions: { |
|
||||
less: { |
|
||||
// 支持内联 JavaScript
|
|
||||
javascriptEnabled: true, |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
} |
|
||||
|
return { |
||||
|
base: './', // index.html文件所在位置
|
||||
|
root: './', // js导入的资源路径,src
|
||||
|
resolve: { |
||||
|
alias, |
||||
|
}, |
||||
|
define: { |
||||
|
'process.env': {} |
||||
|
}, |
||||
|
server: { |
||||
|
open: true, |
||||
|
port: process.env.VITE_CLI_PORT, |
||||
|
proxy: { |
||||
|
// 把key的路径代理到target位置
|
||||
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
|
[process.env.VITE_BASE_API]: { // 需要代理的路径 例如 '/api'
|
||||
|
target: `${process.env.VITE_BASE_PATH}:${process.env.VITE_SERVER_PORT}/`, // 代理到 目标路径
|
||||
|
changeOrigin: true, |
||||
|
rewrite: path => path.replace(new RegExp('^' + process.env.VITE_BASE_API), ''), |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
build: { |
||||
|
target: 'es2015', |
||||
|
minify: 'terser', // 是否进行压缩,boolean | 'terser' | 'esbuild',默认使用terser
|
||||
|
manifest: false, // 是否产出maifest.json
|
||||
|
sourcemap: false, // 是否产出soucemap.json
|
||||
|
outDir: 'dist', // 产出目录
|
||||
|
rollupOptions, |
||||
|
}, |
||||
|
esbuild, |
||||
|
optimizeDeps, |
||||
|
plugins: [ |
||||
|
legacyPlugin({ |
||||
|
targets: ['Android > 39', 'Chrome >= 60', 'Safari >= 10.1', 'iOS >= 10.3', 'Firefox >= 54', 'Edge >= 15'], |
||||
|
}), vuePlugin(), [Banner(`\n Build based on gin-vue-admin \n Time : ${timestamp}`)] |
||||
|
], |
||||
|
css: { |
||||
|
preprocessorOptions: { |
||||
|
less: { |
||||
|
// 支持内联 JavaScript
|
||||
|
javascriptEnabled: true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
} |
||||
} |
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue