From a1906d2a36f278d4d480294e849dd7963b923334 Mon Sep 17 00:00:00 2001 From: Echo <1711788888@qq.com> Date: Tue, 2 Sep 2025 22:56:30 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- limit.js | 4 +- package.json | 33 +- postcss.config.js | 6 - src/App.vue | 58 +- src/api/autoCode.js | 37 + src/api/system.js | 2 +- src/api/version.js | 114 ++ src/assets/icons/close.svg | 1 + src/assets/icons/idea.svg | 1 + src/assets/icons/lock.svg | 1 + src/assets/icons/server.svg | 1 + src/assets/icons/warn.svg | 1 + src/components/application/index.vue | 39 + src/components/bottomInfo/bottomInfo.vue | 22 +- src/components/commandMenu/index.vue | 1 - src/components/errorPreview/index.vue | 126 +++ src/components/exportExcel/exportExcel.vue | 9 + src/components/richtext/rich-edit.vue | 193 +--- src/components/selectFile/selectFile.vue | 2 +- src/components/selectImage/selectImage.vue | 56 +- src/core/config.js | 31 +- src/core/gin-vue-admin.js | 16 +- src/directive/auth.js | 17 +- src/main.js | 1 + src/pathInfo.json | 12 + src/permission.js | 4 +- src/pinia/modules/app.js | 24 +- src/pinia/modules/router.js | 49 +- src/pinia/modules/user.js | 13 +- src/plugin/announcement/view/info.vue | 2 +- src/router/index.js | 24 - src/style/element_visiable.scss | 7 +- src/style/main.scss | 29 +- src/style/reset.scss | 2 +- src/utils/request.js | 186 ++-- src/view/error/index.vue | 14 +- src/view/init/index.vue | 22 +- .../layout/aside/asideComponent/index.vue | 2 +- .../layout/aside/asideComponent/menuItem.vue | 14 +- src/view/layout/aside/combinationMode.vue | 4 +- src/view/layout/aside/headMode.vue | 63 +- src/view/layout/aside/index.vue | 7 +- src/view/layout/aside/normalMode.vue | 2 +- src/view/layout/aside/sidebarMode.vue | 300 ++++++ src/view/layout/header/tools.vue | 12 +- src/view/layout/index.vue | 6 +- .../setting/components/layoutModeCard.vue | 219 ++++ .../layout/setting/components/settingItem.vue | 113 ++ .../setting/components/themeColorPicker.vue | 152 +++ .../setting/components/themeModeSelector.vue | 70 ++ src/view/layout/setting/index.vue | 285 +++-- .../setting/modules/appearance/index.vue | 114 ++ .../layout/setting/modules/general/index.vue | 288 +++++ .../layout/setting/modules/layout/index.vue | 164 +++ src/view/layout/tabs/index.vue | 2 +- src/view/superAdmin/api/api.vue | 2 +- .../superAdmin/authority/components/menus.vue | 8 +- src/view/superAdmin/menu/menu.vue | 707 ++++++++----- src/view/superAdmin/params/sysParams.vue | 14 +- src/view/superAdmin/user/user.vue | 123 ++- src/view/systemTools/autoCode/index.vue | 21 +- src/view/systemTools/autoCode/mcp.vue | 151 +++ src/view/systemTools/autoCode/mcpTest.vue | 261 +++++ src/view/systemTools/autoCode/picture.vue | 426 ++++++++ src/view/systemTools/autoPkg/autoPkg.vue | 2 + .../exportTemplate/exportTemplate.vue | 10 +- src/view/systemTools/system/system.vue | 7 +- src/view/systemTools/version/version.vue | 991 ++++++++++++++++++ uno.config.js | 26 + vite.config.js | 24 +- 71 files changed, 4790 insertions(+), 962 deletions(-) delete mode 100644 postcss.config.js create mode 100644 src/api/version.js create mode 100644 src/assets/icons/close.svg create mode 100644 src/assets/icons/idea.svg create mode 100644 src/assets/icons/lock.svg create mode 100644 src/assets/icons/server.svg create mode 100644 src/assets/icons/warn.svg create mode 100644 src/components/application/index.vue create mode 100644 src/components/errorPreview/index.vue create mode 100644 src/view/layout/aside/sidebarMode.vue create mode 100644 src/view/layout/setting/components/layoutModeCard.vue create mode 100644 src/view/layout/setting/components/settingItem.vue create mode 100644 src/view/layout/setting/components/themeColorPicker.vue create mode 100644 src/view/layout/setting/components/themeModeSelector.vue create mode 100644 src/view/layout/setting/modules/appearance/index.vue create mode 100644 src/view/layout/setting/modules/general/index.vue create mode 100644 src/view/layout/setting/modules/layout/index.vue create mode 100644 src/view/systemTools/autoCode/mcp.vue create mode 100644 src/view/systemTools/autoCode/mcpTest.vue create mode 100644 src/view/systemTools/autoCode/picture.vue create mode 100644 src/view/systemTools/version/version.vue create mode 100644 uno.config.js diff --git a/index.html b/index.html index 1d8d87a..eeb87a2 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ content="Gin,Vue,Admin.Gin-Vue-Admin,GVA,gin-vue-admin,后台管理框架,vue后台管理框架,gin-vue-admin文档,gin-vue-admin首页,gin-vue-admin" name="keywords" /> - + diff --git a/src/api/autoCode.js b/src/api/autoCode.js index 8994b3c..cb3443f 100644 --- a/src/api/autoCode.js +++ b/src/api/autoCode.js @@ -173,6 +173,17 @@ export const eye = (data) => { } +export const createWeb = (data) => { + return service({ + url: '/autoCode/llmAuto', + method: 'post', + data: { ...data, mode: 'painter' }, + timeout: 1000 * 60 * 10 + }) +} + + + export const addFunc = (data) => { return service({ url: '/autoCode/addFunc', @@ -196,3 +207,29 @@ export const initAPI = (data) => { data }) } + +export const mcp = (data) => { + return service({ + url: '/autoCode/mcp', + method: 'post', + data + }) +} + + +export const mcpList = (data) => { + return service({ + url: '/autoCode/mcpList', + method: 'post', + data + }) +} + + +export const mcpTest = (data) => { + return service({ + url: '/autoCode/mcpTest', + method: 'post', + data + }) +} diff --git a/src/api/system.js b/src/api/system.js index 9395519..ff41abf 100644 --- a/src/api/system.js +++ b/src/api/system.js @@ -42,7 +42,7 @@ export const getSystemState = () => { } /** - * 重启服务 + * 重载服务 * @param data * @returns {*} */ diff --git a/src/api/version.js b/src/api/version.js new file mode 100644 index 0000000..b5b7dcc --- /dev/null +++ b/src/api/version.js @@ -0,0 +1,114 @@ +import service from '@/utils/request' + +// @Tags SysVersion +// @Summary 删除版本管理 +// @Security ApiKeyAuth +// @Accept application/json +// @Produce application/json +// @Param data body model.SysVersion true "删除版本管理" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Router /sysVersion/deleteSysVersion [delete] +export const deleteSysVersion = (params) => { + return service({ + url: '/sysVersion/deleteSysVersion', + method: 'delete', + params + }) +} + +// @Tags SysVersion +// @Summary 批量删除版本管理 +// @Security ApiKeyAuth +// @Accept application/json +// @Produce application/json +// @Param data body request.IdsReq true "批量删除版本管理" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Router /sysVersion/deleteSysVersion [delete] +export const deleteSysVersionByIds = (params) => { + return service({ + url: '/sysVersion/deleteSysVersionByIds', + method: 'delete', + params + }) +} + +// @Tags SysVersion +// @Summary 用id查询版本管理 +// @Security ApiKeyAuth +// @Accept application/json +// @Produce application/json +// @Param data query model.SysVersion true "用id查询版本管理" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" +// @Router /sysVersion/findSysVersion [get] +export const findSysVersion = (params) => { + return service({ + url: '/sysVersion/findSysVersion', + method: 'get', + params + }) +} + +// @Tags SysVersion +// @Summary 分页获取版本管理列表 +// @Security ApiKeyAuth +// @Accept application/json +// @Produce application/json +// @Param data query request.PageInfo true "分页获取版本管理列表" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Router /sysVersion/getSysVersionList [get] +export const getSysVersionList = (params) => { + return service({ + url: '/sysVersion/getSysVersionList', + method: 'get', + params + }) +} + +// @Tags SysVersion +// @Summary 导出版本数据 +// @Security ApiKeyAuth +// @Accept application/json +// @Produce application/json +// @Param data body object true "导出版本数据" +// @Success 200 {string} string "{\"success\":true,\"data\":{},\"msg\":\"导出成功\"}" +// @Router /sysVersion/exportVersion [post] +export const exportVersion = (data) => { + return service({ + url: '/sysVersion/exportVersion', + method: 'post', + data + }) +} + +// @Tags SysVersion +// @Summary 下载版本JSON数据 +// @Security ApiKeyAuth +// @Accept application/json +// @Produce application/json +// @Param ID query string true "版本ID" +// @Success 200 {string} string "{\"success\":true,\"data\":{},\"msg\":\"下载成功\"}" +// @Router /sysVersion/downloadVersionJson [get] +export const downloadVersionJson = (params) => { + return service({ + url: '/sysVersion/downloadVersionJson', + method: 'get', + params, + responseType: 'blob' + }) +} + +// @Tags SysVersion +// @Summary 导入版本数据 +// @Security ApiKeyAuth +// @Accept application/json +// @Produce application/json +// @Param data body object true "版本JSON数据" +// @Success 200 {string} string "{\"success\":true,\"data\":{},\"msg\":\"导入成功\"}" +// @Router /sysVersion/importVersion [post] +export const importVersion = (data) => { + return service({ + url: '/sysVersion/importVersion', + method: 'post', + data + }) +} diff --git a/src/assets/icons/close.svg b/src/assets/icons/close.svg new file mode 100644 index 0000000..1b1f631 --- /dev/null +++ b/src/assets/icons/close.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/idea.svg b/src/assets/icons/idea.svg new file mode 100644 index 0000000..eac5a0d --- /dev/null +++ b/src/assets/icons/idea.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/lock.svg b/src/assets/icons/lock.svg new file mode 100644 index 0000000..4685191 --- /dev/null +++ b/src/assets/icons/lock.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/server.svg b/src/assets/icons/server.svg new file mode 100644 index 0000000..3b1375a --- /dev/null +++ b/src/assets/icons/server.svg @@ -0,0 +1 @@ + diff --git a/src/assets/icons/warn.svg b/src/assets/icons/warn.svg new file mode 100644 index 0000000..73d7a15 --- /dev/null +++ b/src/assets/icons/warn.svg @@ -0,0 +1 @@ + diff --git a/src/components/application/index.vue b/src/components/application/index.vue new file mode 100644 index 0000000..4dda3ec --- /dev/null +++ b/src/components/application/index.vue @@ -0,0 +1,39 @@ + + + diff --git a/src/components/bottomInfo/bottomInfo.vue b/src/components/bottomInfo/bottomInfo.vue index 9d362bd..376de05 100644 --- a/src/components/bottomInfo/bottomInfo.vue +++ b/src/components/bottomInfo/bottomInfo.vue @@ -11,12 +11,22 @@ EchoGin-Vue-Admin + + + +
+ Copyright + + flipped-aurora团队
- @@ -25,4 +35,10 @@ name: 'BottomInfo' }) + console.log( + `%c powered by %c flipped-aurorae %c`, + 'background:#0081ff; padding: 1px; border-radius: 3px 0 0 3px; color: #fff', + 'background:#354855; padding: 1px 5px; border-radius: 0 3px 3px 0; color: #fff; font-weight: bold;', + 'background:transparent' + ) diff --git a/src/components/commandMenu/index.vue b/src/components/commandMenu/index.vue index 27ef93f..4ab4e20 100644 --- a/src/components/commandMenu/index.vue +++ b/src/components/commandMenu/index.vue @@ -55,7 +55,6 @@ const deepMenus = (menus) => { const arr = [] menus?.forEach((menu) => { - if (!menu?.children) return if (menu.children && menu.children.length > 0) { arr.push(...deepMenus(menu.children)) } else { diff --git a/src/components/errorPreview/index.vue b/src/components/errorPreview/index.vue new file mode 100644 index 0000000..d3d99b0 --- /dev/null +++ b/src/components/errorPreview/index.vue @@ -0,0 +1,126 @@ + + + diff --git a/src/components/exportExcel/exportExcel.vue b/src/components/exportExcel/exportExcel.vue index 6c1189e..1a94db5 100644 --- a/src/components/exportExcel/exportExcel.vue +++ b/src/components/exportExcel/exportExcel.vue @@ -9,6 +9,10 @@ import { exportExcel } from '@/api/exportTemplate' const props = defineProps({ + filterDeleted: { + type: Boolean, + default: true + }, templateId: { type: String, required: true @@ -43,6 +47,11 @@ import { exportExcel } from '@/api/exportTemplate' baseUrl = "" } const paramsCopy = JSON.parse(JSON.stringify(props.condition)) + + if (props.filterDeleted) { + paramsCopy.filterDeleted = 'true' + } + if (props.limit) { paramsCopy.limit = props.limit } diff --git a/src/components/richtext/rich-edit.vue b/src/components/richtext/rich-edit.vue index e238518..cf248fb 100644 --- a/src/components/richtext/rich-edit.vue +++ b/src/components/richtext/rich-edit.vue @@ -1,5 +1,5 @@ diff --git a/src/view/layout/setting/modules/appearance/index.vue b/src/view/layout/setting/modules/appearance/index.vue new file mode 100644 index 0000000..70fb98d --- /dev/null +++ b/src/view/layout/setting/modules/appearance/index.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/src/view/layout/setting/modules/general/index.vue b/src/view/layout/setting/modules/general/index.vue new file mode 100644 index 0000000..31e2a85 --- /dev/null +++ b/src/view/layout/setting/modules/general/index.vue @@ -0,0 +1,288 @@ + + + + + diff --git a/src/view/layout/setting/modules/layout/index.vue b/src/view/layout/setting/modules/layout/index.vue new file mode 100644 index 0000000..bcc4809 --- /dev/null +++ b/src/view/layout/setting/modules/layout/index.vue @@ -0,0 +1,164 @@ + + + + + diff --git a/src/view/layout/tabs/index.vue b/src/view/layout/tabs/index.vue index 4ad54f3..6a6ad8a 100644 --- a/src/view/layout/tabs/index.vue +++ b/src/view/layout/tabs/index.vue @@ -8,7 +8,7 @@ v-model="activeValue" :closable="!(historys.length === 1 && $route.name === defaultRouter)" type="card" - class="bg-white text-slate-700 dark:text-slate-500 dark:bg-slate-900" + class="bg-white text-slate-700 dark:text-slate-500 dark:bg-slate-900 pt-1" @contextmenu.prevent="openContextMenu($event)" @tab-click="changeTab" @tab-remove="removeTab" diff --git a/src/view/superAdmin/api/api.vue b/src/view/superAdmin/api/api.vue index 21e971c..db0d21a 100644 --- a/src/view/superAdmin/api/api.vue +++ b/src/view/superAdmin/api/api.vue @@ -531,7 +531,7 @@ if (res.code === 0) { ElMessage({ type: 'success', - message: '添加成功', + message: '添加成功,请到角色管理页面分配权限', showClose: true }) syncApiData.value.newApis = syncApiData.value.newApis.filter( diff --git a/src/view/superAdmin/authority/components/menus.vue b/src/view/superAdmin/authority/components/menus.vue index 8e2d1c6..fd00f8d 100644 --- a/src/view/superAdmin/authority/components/menus.vue +++ b/src/view/superAdmin/authority/components/menus.vue @@ -23,7 +23,7 @@ - - - - - - 如果菜单包含子菜单,请创建router-view二级路由页面或者 - - 点我设置 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- + + + + + + + +
+ + +
+

高级配置

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+

菜单参数配置

+ 新增菜单参数
- - - - - - - - - - - - - - - -
- - 新增可控按钮 - - - - -
- - - - - - - - - - - - + + + + + + + + + + + + + +
+ + +
+
+

可控按钮配置

+
+ + 新增可控按钮 + + + + + + +
+
+ + + + + + + + + + + +
@@ -417,7 +524,7 @@ import { canRemoveAuthorityBtnApi } from '@/api/authorityBtn' import { reactive, ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' - import { QuestionFilled } from '@element-plus/icons-vue' + import { QuestionFilled, InfoFilled, Delete } from '@element-plus/icons-vue' import { toDoc } from '@/utils/doc' import { toLowerCase } from '@/utils/stringFun' import ComponentsCascader from '@/view/superAdmin/menu/components/components-cascader.vue' @@ -593,7 +700,7 @@ if (res.code === 0) { ElMessage({ type: 'success', - message: isEdit.value ? '编辑成功' : '添加成功!' + message: isEdit.value ? '编辑成功' : '添加成功,请到角色管理页面分配权限' }) getTableData() } @@ -677,4 +784,52 @@ margin-right: 8px; } } + + + + .form-tip { + margin-top: 8px; + font-size: 12px; + color: #909399; + display: flex; + align-items: center; + gap: 8px; + + .el-icon { + color: #409eff; + } + } + + .label-with-tooltip { + display: flex; + align-items: center; + gap: 6px; + + .el-icon { + color: #909399; + cursor: help; + + &:hover { + color: #409eff; + } + } + } + + .parameter-table, + .button-table { + border: 1px solid #ebeef5; + border-radius: 6px; + + :deep(.el-table__header) { + background-color: #fafafa; + } + + :deep(.el-table__body) { + .el-table__row { + &:hover { + background-color: #f5f7fa; + } + } + } + } diff --git a/src/view/superAdmin/params/sysParams.vue b/src/view/superAdmin/params/sysParams.vue index 89fe6f9..f18520c 100644 --- a/src/view/superAdmin/params/sysParams.vue +++ b/src/view/superAdmin/params/sysParams.vue @@ -268,16 +268,16 @@ > - {{ detailFrom.name }} + {{ detailForm.name }} - {{ detailFrom.key }} + {{ detailForm.key }} - {{ detailFrom.value }} + {{ detailForm.value }} - {{ detailFrom.desc }} + {{ detailForm.desc }} @@ -574,7 +574,7 @@ }) } - const detailFrom = ref({}) + const detailForm = ref({}) // 查看详情控制标记 const detailShow = ref(false) @@ -589,7 +589,7 @@ // 打开弹窗 const res = await findSysParams({ ID: row.ID }) if (res.code === 0) { - detailFrom.value = res.data + detailForm.value = res.data openDetailShow() } } @@ -597,7 +597,7 @@ // 关闭详情弹窗 const closeDetailShow = () => { detailShow.value = false - detailFrom.value = {} + detailForm.value = {} } diff --git a/src/view/superAdmin/user/user.vue b/src/view/superAdmin/user/user.vue index 1561ef1..974edc1 100644 --- a/src/view/superAdmin/user/user.vue +++ b/src/view/superAdmin/user/user.vue @@ -143,6 +143,38 @@ /> + + + + + + + + + + +
+ + + 生成随机密码 + +
+
+
+ +
+ { - ElMessageBox.confirm('是否将此用户密码重置为123456?', '警告', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(async () => { - const res = await resetPassword({ - ID: row.ID + // 重置密码对话框相关 + const resetPwdDialog = ref(false) + const resetPwdForm = ref(null) + const resetPwdInfo = ref({ + ID: '', + userName: '', + nickName: '', + password: '' + }) + + // 生成随机密码 + const generateRandomPassword = () => { + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*' + let password = '' + for (let i = 0; i < 12; i++) { + password += chars.charAt(Math.floor(Math.random() * chars.length)) + } + resetPwdInfo.value.password = password + // 复制到剪贴板 + navigator.clipboard.writeText(password).then(() => { + ElMessage({ + type: 'success', + message: '密码已复制到剪贴板' + }) + }).catch(() => { + ElMessage({ + type: 'error', + message: '复制失败,请手动复制' }) - if (res.code === 0) { - ElMessage({ - type: 'success', - message: res.msg - }) - } else { - ElMessage({ - type: 'error', - message: res.msg - }) - } }) } + + // 打开重置密码对话框 + const resetPasswordFunc = (row) => { + resetPwdInfo.value.ID = row.ID + resetPwdInfo.value.userName = row.userName + resetPwdInfo.value.nickName = row.nickName + resetPwdInfo.value.password = '' + resetPwdDialog.value = true + } + + // 确认重置密码 + const confirmResetPassword = async () => { + if (!resetPwdInfo.value.password) { + ElMessage({ + type: 'warning', + message: '请输入或生成密码' + }) + return + } + + const res = await resetPassword({ + ID: resetPwdInfo.value.ID, + password: resetPwdInfo.value.password + }) + + if (res.code === 0) { + ElMessage({ + type: 'success', + message: res.msg || '密码重置成功' + }) + resetPwdDialog.value = false + } else { + ElMessage({ + type: 'error', + message: res.msg || '密码重置失败' + }) + } + } + + // 关闭重置密码对话框 + const closeResetPwdDialog = () => { + resetPwdInfo.value.password = '' + resetPwdDialog.value = false + } const setAuthorityIds = () => { tableData.value && tableData.value.forEach((user) => { diff --git a/src/view/systemTools/autoCode/index.vue b/src/view/systemTools/autoCode/index.vue index a1a9cff..a9c4f5c 100644 --- a/src/view/systemTools/autoCode/index.vue +++ b/src/view/systemTools/autoCode/index.vue @@ -206,7 +206,7 @@ - + @@ -1010,7 +1013,7 @@ } initForm() const reload = () => { - ElMessageBox.confirm('确定要重启服务?', '警告', { + ElMessageBox.confirm('确定要重载服务?', '警告', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' diff --git a/src/view/systemTools/version/version.vue b/src/view/systemTools/version/version.vue new file mode 100644 index 0000000..6f48382 --- /dev/null +++ b/src/view/systemTools/version/version.vue @@ -0,0 +1,991 @@ + + + + + diff --git a/uno.config.js b/uno.config.js new file mode 100644 index 0000000..779a77e --- /dev/null +++ b/uno.config.js @@ -0,0 +1,26 @@ +import { defineConfig } from '@unocss/vite'; +import presetWind3 from '@unocss/preset-wind3'; +import transformerDirectives from '@unocss/transformer-directives' + +export default defineConfig({ + theme: { + backgroundColor: { + main: '#F5F5F5' + }, + textColor: { + active: 'var(--el-color-primary)' + }, + boxShadowColor: { + active: 'var(--el-color-primary)' + }, + borderColor: { + 'table-border': 'var(--el-border-color-lighter)' + } + }, + presets: [ + presetWind3({ dark: 'class' }) + ], + transformers: [ + transformerDirectives(), + ], +}) diff --git a/vite.config.js b/vite.config.js index 45a40a9..c653ce2 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,4 +1,5 @@ import legacyPlugin from '@vitejs/plugin-legacy' +import { viteLogo } from './src/core/config' import Banner from 'vite-plugin-banner' import * as path from 'path' import * as dotenv from 'dotenv' @@ -8,6 +9,8 @@ import vueDevTools from 'vite-plugin-vue-devtools' import VueFilePathPlugin from './vitePlugin/componentName/index.js' import { svgBuilder } from 'vite-auto-import-svg' import { AddSecret } from './vitePlugin/secret' +import UnoCSS from '@unocss/vite' + // @see https://cn.vitejs.dev/config/ export default ({ mode }) => { AddSecret('') @@ -20,6 +23,8 @@ export default ({ mode }) => { } } + viteLogo(process.env) + const timestamp = Date.parse(new Date()) const optimizeDeps = {} @@ -39,9 +44,13 @@ export default ({ mode }) => { } } + const base = "/" + const root = "./" + const outDir = "dist" + const config = { - base: '/', // 编译后js导入的资源路径 - root: './', // index.html文件所在位置 + base: base, // 编译后js导入的资源路径 + root: root, // index.html文件所在位置 publicDir: 'public', // 静态资源文件夹 resolve: { alias @@ -70,14 +79,13 @@ export default ({ mode }) => { rewrite: (path) => path.replace(new RegExp('^' + process.env.VITE_BASE_API), '') } - }, - allowedHosts: ['all','lckt.echol.top','lckt.hnlc5588.cn'], + } }, build: { minify: 'terser', // 是否进行压缩,boolean | 'terser' | 'esbuild',默认使用terser manifest: false, // 是否产出manifest.json sourcemap: false, // 是否产出sourcemap.json - outDir: 'dist', // 产出目录 + outDir: outDir, // 产出目录 terserOptions: { compress: { //生产环境时移除console @@ -103,10 +111,10 @@ export default ({ mode }) => { ] }), vuePlugin(), - svgBuilder('./src/assets/icons/'), - svgBuilder('./src/plugin/'), + svgBuilder(['./src/plugin/','./src/assets/icons/'],base, outDir,'assets', NODE_ENV), [Banner(`\n Build based on gin-vue-admin \n Time : ${timestamp}`)], - VueFilePathPlugin('./src/pathInfo.json') + VueFilePathPlugin('./src/pathInfo.json'), + UnoCSS() ] } return config