init Project

This commit is contained in:
2025-04-09 12:10:46 +08:00
parent 505d08443c
commit 75a1447d66
207 changed files with 26387 additions and 13 deletions

53
src/core/config.js Normal file
View File

@@ -0,0 +1,53 @@
/**
* 网站配置文件
*/
const greenText = (text) => `\x1b[32m${text}\x1b[0m`
const config = {
appName: 'Lckt-Admin',
appLogo: 'logo.png',
showViteLogo: true,
logs: []
}
export const viteLogo = (env) => {
if (config.showViteLogo) {
console.log(
greenText(
`> 欢迎使用Gin-Vue-Admin开源地址https://github.com/flipped-aurora/gin-vue-admin`
)
)
console.log(greenText(`> 当前版本:v2.8.0`))
console.log(greenText(`> 加群方式:微信shouzi_1994 QQ群470239250`))
console.log(
greenText(`> 项目地址https://github.com/flipped-aurora/gin-vue-admin`)
)
console.log(greenText(`> 插件市场:https://plugin.gin-vue-admin.com`))
console.log(
greenText(`> GVA讨论社区:https://support.qq.com/products/371961`)
)
console.log(
greenText(
`> 默认自动化文档地址:http://127.0.0.1:${env.VITE_SERVER_PORT}/swagger/index.html`
)
)
console.log(
greenText(`> 默认前端文件运行地址:http://127.0.0.1:${env.VITE_CLI_PORT}`)
)
console.log(
greenText(
`--------------------------------------版权声明--------------------------------------`
)
)
console.log(greenText(`** 版权所有方flipped-aurora开源团队 **`))
console.log(greenText(`** 版权持有公司:北京翻转极光科技有限责任公司 **`))
console.log(
greenText(
`** 剔除授权标识需购买商用授权https://gin-vue-admin.com/empower/index.html **`
)
)
console.log('\n')
}
}
export default config

27
src/core/gin-vue-admin.js Normal file
View File

@@ -0,0 +1,27 @@
/*
* gin-vue-admin web框架组
*
* */
// 加载网站配置文件夹
import { register } from './global'
export default {
install: (app) => {
register(app)
console.log(`
欢迎使用 Gin-Vue-Admin
当前版本:v2.8.0
加群方式:微信shouzi_1994 QQ群622360840
项目地址https://github.com/flipped-aurora/gin-vue-admin
插件市场:https://plugin.gin-vue-admin.com
GVA讨论社区:https://support.qq.com/products/371961
默认自动化文档地址:http://127.0.0.1:${import.meta.env.VITE_SERVER_PORT}/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:${import.meta.env.VITE_CLI_PORT}
如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/coffee/index.html
--------------------------------------版权声明--------------------------------------
** 版权所有方flipped-aurora开源团队 **
** 版权持有公司:北京翻转极光科技有限责任公司 **
** 剔除授权标识需购买商用授权https://gin-vue-admin.com/empower/index.html **
`)
}
}

59
src/core/global.js Normal file
View File

@@ -0,0 +1,59 @@
import config from './config'
import { h } from 'vue'
// 统一导入el-icon图标
import * as ElIconModules from '@element-plus/icons-vue'
import svgIcon from '@/components/svgIcon/svgIcon.vue'
// 导入转换图标名称的函数
const createIconComponent = (name) => ({
name: 'SvgIcon',
render() {
return h(svgIcon, {
name: name
})
}
})
const registerIcons = async (app) => {
const iconModules = import.meta.glob('@/assets/icons/**/*.svg') // 系统目录 svg 图标
const pluginIconModules = import.meta.glob(
'@/plugin/**/assets/icons/**/*.svg'
) // 插件目录 svg 图标
const mergedIconModules = Object.assign({}, iconModules, pluginIconModules) // 合并所有 svg 图标
for (const path in mergedIconModules) {
let pluginName = ''
if (path.startsWith('/src/plugin/')) {
pluginName = `${path.split('/')[3]}-`
}
const iconName = path
.split('/')
.pop()
.replace(/\.svg$/, '')
// 如果iconName带空格则不加入到图标库中并且提示名称不合法
if (iconName.indexOf(' ') !== -1) {
console.error(`icon ${iconName}.svg includes whitespace in ${path}`)
continue
}
const key = `${pluginName}${iconName}`
// 开发模式下列出所有 svg 图标,方便开发者直接查找复制使用
import.meta.env.MODE == 'development' &&
console.log(`svg-icon-component: <${key} />`)
const iconComponent = createIconComponent(key)
config.logs.push({
key: key,
label: key
})
app.component(key, iconComponent)
}
}
export const register = (app) => {
// 统一注册el-icon图标
for (const iconName in ElIconModules) {
app.component(iconName, ElIconModules[iconName])
}
app.component('SvgIcon', svgIcon)
registerIcons(app)
app.config.globalProperties.$GIN_VUE_ADMIN = config
}