From b64aa13a65fad3bd2835a713d44c467be6df03e9 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Thu, 11 Jun 2026 19:02:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/date.js | 38 ++++++++++++++++++++++++++++++++++++++ src/utils/format.js | 10 +++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/utils/date.js diff --git a/src/utils/date.js b/src/utils/date.js new file mode 100644 index 0000000..0c0159c --- /dev/null +++ b/src/utils/date.js @@ -0,0 +1,38 @@ +// 对Date的扩展,将 Date 转化为指定格式的String +// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, +// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) +// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 +// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 +// eslint-disable-next-line no-extend-native +Date.prototype.Format = function (fmt) { + const o = { + 'M+': this.getMonth() + 1, // 月份 + 'd+': this.getDate(), // 日 + 'h+': this.getHours(), // 小时 + 'm+': this.getMinutes(), // 分 + 's+': this.getSeconds(), // 秒 + 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度 + S: this.getMilliseconds() // 毫秒 + } + const reg = /(y+)/ + if (reg.test(fmt)) { + const t = reg.exec(fmt)[1] + fmt = fmt.replace(t, (this.getFullYear() + '').substring(4 - t.length)) + } + for (let k in o) { + const regx = new RegExp('(' + k + ')') + if (regx.test(fmt)) { + const t = regx.exec(fmt)[1] + fmt = fmt.replace(t, t.length === 1 ? o[k] : ('00' + o[k]).substring(('' + o[k]).length)) + } + } + return fmt +} + +export function formatTimeToStr(times, pattern) { + let d = new Date(times).Format('yyyy-MM-dd hh:mm:ss') + if (pattern) { + d = new Date(times).Format(pattern) + } + return d.toLocaleString() +} diff --git a/src/utils/format.js b/src/utils/format.js index 78b84e0..1792379 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -1,3 +1,4 @@ +import { formatTimeToStr } from '@/utils/date' import { getDict } from '@/utils/dictionary' import { ref } from 'vue' @@ -8,7 +9,14 @@ export const formatBoolean = (bool) => { return '' } } - +export const formatDate = (time) => { + if (time !== null && time !== '') { + var date = new Date(time) + return formatTimeToStr(date, 'yyyy-MM-dd hh:mm:ss') + } else { + return '' + } +} export const filterDict = (value, options) => { // 递归查找函数 const findInOptions = (opts, targetValue) => { From bfd98785971dfe868f740e65b92ae130a8c3956f Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Thu, 11 Jun 2026 19:06:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugin/.gitkeep | 0 vitePlugin/componentName/index.js | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 src/plugin/.gitkeep diff --git a/src/plugin/.gitkeep b/src/plugin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vitePlugin/componentName/index.js b/vitePlugin/componentName/index.js index bae9f0f..8f87c68 100644 --- a/vitePlugin/componentName/index.js +++ b/vitePlugin/componentName/index.js @@ -12,6 +12,9 @@ const clearAndUpper = (text) => { // 递归获取目录下所有的 .vue 文件 const getAllVueFiles = (dir, fileList = []) => { + if (!fs.existsSync(dir)) { + return fileList + } const files = fs.readdirSync(dir) files.forEach((file) => { const filePath = path.join(dir, file) From aa8368e4fb415b42c1e854f8f50bcfa4ab1c310c Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Thu, 11 Jun 2026 19:10:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openDocument.js | 20 -------------------- package.json | 4 ++-- src/core/gin-vue-admin.js | 16 ---------------- 3 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 openDocument.js diff --git a/openDocument.js b/openDocument.js deleted file mode 100644 index 03a886b..0000000 --- a/openDocument.js +++ /dev/null @@ -1,20 +0,0 @@ -/* -此文件受版权保护,未经授权禁止修改!如果您尚未获得授权,请通过微信(shouzi_1994)联系我们以购买授权。在未授权状态下,只需保留此代码,不会影响任何正常使用。 - 未经授权的商用使用可能会被我们的资产搜索引擎爬取,并可能导致后续索赔。索赔金额将不低于高级授权费的十倍。请您遵守版权法律法规,尊重知识产权。 -*/ - -import child_process from 'child_process' - -var url = 'https://www.gin-vue-admin.com' -var cmd = '' -switch (process.platform) { - case 'win32': - cmd = 'start' - child_process.exec(cmd + ' ' + url) - break - - case 'darwin': - cmd = 'open' - child_process.exec(cmd + ' ' + url) - break -} diff --git a/package.json b/package.json index 76c75ac..121ece6 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "2.8.6", "private": true, "scripts": { - "dev": "node openDocument.js && vite --host --mode development", - "serve": "node openDocument.js && vite --host --mode development", + "dev": "vite --host --mode development", + "serve": "vite --host --mode development", "build": "vite build --mode production", "limit-build": "npm install increase-memory-limit-fixbug cross-env -g && npm run fix-memory-limit && node ./limit && npm run build", "preview": "vite preview", diff --git a/src/core/gin-vue-admin.js b/src/core/gin-vue-admin.js index 075bc41..e0d8306 100644 --- a/src/core/gin-vue-admin.js +++ b/src/core/gin-vue-admin.js @@ -9,21 +9,5 @@ import packageInfo from '../../package.json' export default { install: (app) => { register(app) - console.log(` - 欢迎使用 Gin-Vue-Admin - 当前版本:v${packageInfo.version} - 加群方式:微信: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 ** - ** 感谢您对Gin-Vue-Admin的支持与关注 合法授权使用更有利于项目的长久发展** - `) } }