From f1b9c623d9891ad01d6908096de14a17880c6f3f Mon Sep 17 00:00:00 2001 From: SaarHV Date: Fri, 30 Dec 2022 17:24:28 +0800 Subject: [PATCH 1/3] Add .eslintignore --- .eslintignore | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..cfc877d --- /dev/null +++ b/.eslintignore @@ -0,0 +1,18 @@ + +*.sh +node_modules +lib +*.md +*.scss +*.woff +*.ttf +.vscode +.idea +dist +mock +public +bin +build +config +index.html +src/assets \ No newline at end of file -- Gitee From ad22bee669ae4649fc6eb612e835dc214ba261fc Mon Sep 17 00:00:00 2001 From: SaarHV Date: Fri, 30 Dec 2022 17:25:37 +0800 Subject: [PATCH 2/3] Update package.json,Add the command of eslint --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 263a7ee..35fda17 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "0.0.0", "scripts": { "dev": "vite", - "build": "vite build" + "build": "vite build", + "lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/" }, "dependencies": { "element-plus": "^2.2.2", @@ -20,11 +21,11 @@ "@types/js-cookie": "^3.0.2", "@types/sortablejs": "^1.10.6", "@typescript-eslint/eslint-plugin": "^5.27.0", - "@typescript-eslint/parser": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", "@vitejs/plugin-vue": "^2.3.3", "@vue/compiler-sfc": "^3.0.4", "eslint": "^8.17.0", - "eslint-plugin-vue": "^9.1.0", + "eslint-plugin-vue": "^9.1.0", "sass": "^1.30.0", "sass-loader": "^10.1.0", "typescript": "^4.1.2", -- Gitee From c11afe3df86e96377917c5f4266a4e28dac5b9e4 Mon Sep 17 00:00:00 2001 From: SaarHV Date: Fri, 30 Dec 2022 17:32:37 +0800 Subject: [PATCH 3/3] Use prettier format the code --- src/App.vue | 2 +- src/layout/component/aside.vue | 96 ++++----- src/layout/component/header.vue | 12 +- src/layout/component/main.vue | 56 ++--- src/layout/fashion.vue | 28 +-- src/layout/index.vue | 8 +- src/layout/logo/index.vue | 4 +- src/layout/navBars/breadcrumb/breadcrumb.vue | 78 +++---- src/layout/navBars/breadcrumb/index.vue | 16 +- src/layout/navBars/breadcrumb/seting.vue | 4 +- src/layout/navBars/breadcrumb/user.vue | 44 ++-- src/layout/navBars/index.vue | 16 +- src/layout/navBars/tagsView/contextmenu.vue | 120 +++++------ src/layout/navBars/tagsView/scroll.vue | 108 +++++----- src/layout/navBars/tagsView/tagsView.vue | 204 +++++++++---------- src/layout/navMenu/subItem.vue | 68 +++---- src/layout/navMenu/vertical.vue | 90 ++++---- src/utils/formatTime.ts | 131 ++++++------ src/views/home/index.vue | 17 +- 19 files changed, 551 insertions(+), 551 deletions(-) diff --git a/src/App.vue b/src/App.vue index 94305eb..1c3ae78 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,7 +5,7 @@ \ No newline at end of file diff --git a/src/layout/component/header.vue b/src/layout/component/header.vue index e3ee2c1..67df5e7 100644 --- a/src/layout/component/header.vue +++ b/src/layout/component/header.vue @@ -1,13 +1,13 @@ \ No newline at end of file diff --git a/src/layout/component/main.vue b/src/layout/component/main.vue index 4298ec8..314f6b2 100644 --- a/src/layout/component/main.vue +++ b/src/layout/component/main.vue @@ -1,35 +1,35 @@ diff --git a/src/layout/fashion.vue b/src/layout/fashion.vue index 91c2d8f..340b731 100644 --- a/src/layout/fashion.vue +++ b/src/layout/fashion.vue @@ -1,15 +1,15 @@ \ No newline at end of file diff --git a/src/layout/index.vue b/src/layout/index.vue index 2634abc..b71dbdd 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,11 +1,11 @@ \ No newline at end of file diff --git a/src/layout/logo/index.vue b/src/layout/logo/index.vue index 8130e47..ee47a58 100644 --- a/src/layout/logo/index.vue +++ b/src/layout/logo/index.vue @@ -1,9 +1,9 @@ \ No newline at end of file diff --git a/src/layout/navBars/breadcrumb/breadcrumb.vue b/src/layout/navBars/breadcrumb/breadcrumb.vue index c100283..b52df53 100644 --- a/src/layout/navBars/breadcrumb/breadcrumb.vue +++ b/src/layout/navBars/breadcrumb/breadcrumb.vue @@ -1,47 +1,47 @@ diff --git a/src/layout/navBars/breadcrumb/index.vue b/src/layout/navBars/breadcrumb/index.vue index 0e4598c..306c42b 100644 --- a/src/layout/navBars/breadcrumb/index.vue +++ b/src/layout/navBars/breadcrumb/index.vue @@ -1,16 +1,16 @@ diff --git a/src/layout/navBars/breadcrumb/seting.vue b/src/layout/navBars/breadcrumb/seting.vue index 88596f7..f913ce1 100644 --- a/src/layout/navBars/breadcrumb/seting.vue +++ b/src/layout/navBars/breadcrumb/seting.vue @@ -1,9 +1,9 @@ \ No newline at end of file diff --git a/src/layout/navBars/breadcrumb/user.vue b/src/layout/navBars/breadcrumb/user.vue index 7b49ec8..f284b9e 100644 --- a/src/layout/navBars/breadcrumb/user.vue +++ b/src/layout/navBars/breadcrumb/user.vue @@ -1,30 +1,30 @@ diff --git a/src/layout/navBars/index.vue b/src/layout/navBars/index.vue index 556a6fc..9ebed20 100644 --- a/src/layout/navBars/index.vue +++ b/src/layout/navBars/index.vue @@ -1,16 +1,16 @@ diff --git a/src/layout/navBars/tagsView/contextmenu.vue b/src/layout/navBars/tagsView/contextmenu.vue index bb28710..7c4cc8e 100644 --- a/src/layout/navBars/tagsView/contextmenu.vue +++ b/src/layout/navBars/tagsView/contextmenu.vue @@ -1,69 +1,69 @@ diff --git a/src/layout/navBars/tagsView/scroll.vue b/src/layout/navBars/tagsView/scroll.vue index 4388ca8..7e27e04 100644 --- a/src/layout/navBars/tagsView/scroll.vue +++ b/src/layout/navBars/tagsView/scroll.vue @@ -1,70 +1,70 @@ \ No newline at end of file diff --git a/src/layout/navBars/tagsView/tagsView.vue b/src/layout/navBars/tagsView/tagsView.vue index 4e3f65c..36e6bcc 100644 --- a/src/layout/navBars/tagsView/tagsView.vue +++ b/src/layout/navBars/tagsView/tagsView.vue @@ -1,111 +1,111 @@ diff --git a/src/layout/navMenu/subItem.vue b/src/layout/navMenu/subItem.vue index 7497a85..964bd0f 100644 --- a/src/layout/navMenu/subItem.vue +++ b/src/layout/navMenu/subItem.vue @@ -1,41 +1,41 @@ diff --git a/src/layout/navMenu/vertical.vue b/src/layout/navMenu/vertical.vue index ceb6494..05c37fd 100644 --- a/src/layout/navMenu/vertical.vue +++ b/src/layout/navMenu/vertical.vue @@ -1,52 +1,52 @@ diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index 81e3a58..0df5f79 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -1,75 +1,76 @@ export function formatDate(date: Date, format: string) { - let we = date.getDay() - let qut = Math.floor((date.getMonth() + 3) / 3).toString() - const opt: any = { - "Y+": date.getFullYear().toString(), - "m+": (date.getMonth() + 1).toString(), - "d+": date.getDate().toString(), - "H+": date.getHours().toString(), - "M+": date.getMinutes().toString(), - "S+": date.getSeconds().toString(), - "q+": qut, - } - const week: any = { - "0": "日", - "1": "一", - "2": "二", - "3": "三", - "4": "四", - "5": "五", - "6": "六", - } - const quarter: any = { - "1": "一", - "2": "二", - "3": "三", - "4": "四", - } - if (/(W+)/.test(format)) format = format.replace(RegExp.$1, RegExp.$1.length > 1 ? RegExp.$1.length > 2 ? "星期" + week[we] : "周" + week[we] : week[we]) - if (/(Q+)/.test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 4 ? "第" + quarter[qut] + "季度" : quarter[qut]) - for (let k in opt) { - let r = new RegExp("(" + k + ")").exec(format); - if (r) format = format.replace(r[1], RegExp.$1.length == 1 ? opt[k] : opt[k].padStart(RegExp.$1.length, "0")) - } - return format + let we = date.getDay(); + let qut = Math.floor((date.getMonth() + 3) / 3).toString(); + const opt: any = { + 'Y+': date.getFullYear().toString(), + 'm+': (date.getMonth() + 1).toString(), + 'd+': date.getDate().toString(), + 'H+': date.getHours().toString(), + 'M+': date.getMinutes().toString(), + 'S+': date.getSeconds().toString(), + 'q+': qut, + }; + const week: any = { + '0': '日', + '1': '一', + '2': '二', + '3': '三', + '4': '四', + '5': '五', + '6': '六', + }; + const quarter: any = { + '1': '一', + '2': '二', + '3': '三', + '4': '四', + }; + if (/(W+)/.test(format)) + format = format.replace(RegExp.$1, RegExp.$1.length > 1 ? (RegExp.$1.length > 2 ? '星期' + week[we] : '周' + week[we]) : week[we]); + if (/(Q+)/.test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 4 ? '第' + quarter[qut] + '季度' : quarter[qut]); + for (let k in opt) { + let r = new RegExp('(' + k + ')').exec(format); + if (r) format = format.replace(r[1], RegExp.$1.length == 1 ? opt[k] : opt[k].padStart(RegExp.$1.length, '0')); + } + return format; } -export function formatPast(param: any, format: string = "YYYY-mm-dd") { - let t: any, s: any - let time: any = new Date().getTime() - typeof param === "string" || "object" ? (t = new Date(param).getTime()) : (t = param) - time = Number.parseInt(`${time - t}`) - if (time < 10000) { - return "刚刚" - } else if (time < 60000 && time >= 10000) { - s = Math.floor(time / 1000) - return `${s}秒前` - } else if (time < 3600000 && time >= 60000) { - s = Math.floor(time / 60000) - return `${s}分钟前` - } else if (time < 86400000 && time >= 3600000) { - s = Math.floor(time / 3600000) - return `${s}小时前` - } else if (time < 259200000 && time >= 86400000) { - s = Math.floor(time / 86400000) - return `${s}天前` - } else { - let date = typeof param === "string" || "object" ? new Date(param) : param - return formatDate(date, format); - } +export function formatPast(param: any, format: string = 'YYYY-mm-dd') { + let t: any, s: any; + let time: any = new Date().getTime(); + typeof param === 'string' || 'object' ? (t = new Date(param).getTime()) : (t = param); + time = Number.parseInt(`${time - t}`); + if (time < 10000) { + return '刚刚'; + } else if (time < 60000 && time >= 10000) { + s = Math.floor(time / 1000); + return `${s}秒前`; + } else if (time < 3600000 && time >= 60000) { + s = Math.floor(time / 60000); + return `${s}分钟前`; + } else if (time < 86400000 && time >= 3600000) { + s = Math.floor(time / 3600000); + return `${s}小时前`; + } else if (time < 259200000 && time >= 86400000) { + s = Math.floor(time / 86400000); + return `${s}天前`; + } else { + let date = typeof param === 'string' || 'object' ? new Date(param) : param; + return formatDate(date, format); + } } /** * formatAxis(new Date()) */ export function formatAxis(param: any) { - let hour: number = new Date(param).getHours() - if (hour < 6) return "凌晨好" - else if (hour < 9) return "早上好" - else if (hour < 12) return "上午好" - else if (hour < 14) return "中午好" - else if (hour < 17) return "下午好" - else if (hour < 19) return "傍晚好" - else if (hour < 22) return "晚上好" - else return "夜里好" + let hour: number = new Date(param).getHours(); + if (hour < 6) return '凌晨好'; + else if (hour < 9) return '早上好'; + else if (hour < 12) return '上午好'; + else if (hour < 14) return '中午好'; + else if (hour < 17) return '下午好'; + else if (hour < 19) return '傍晚好'; + else if (hour < 22) return '晚上好'; + else return '夜里好'; } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 8c7788f..d8ab73f 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,10 +1,9 @@ - - - \ No newline at end of file + home + + + -- Gitee