From b9c7cc14c241d25193a764ee846a268c683e57f6 Mon Sep 17 00:00:00 2001 From: OBKoro1 <1677593011@qq.com> Date: Wed, 1 Jan 2020 18:06:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=90=E5=A4=A9=E7=9A=84=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- src/models/commitHandle.ts | 25 ++++++++++++++++++++----- src/views/autoCommit.html | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5259f24..892f116 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,6 @@ # 用于学习交流 - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/models/commitHandle.ts b/src/models/commitHandle.ts index cd12f58..2a590cb 100644 --- a/src/models/commitHandle.ts +++ b/src/models/commitHandle.ts @@ -2,7 +2,7 @@ * Author : OBKoro1 * Date : 2019-12-30 16:59:30 * LastEditors : OBKoro1 - * LastEditTime : 2020-01-01 17:32:41 + * LastEditTime : 2020-01-01 18:06:25 * FilePath : /autoCommit/src/models/commitHandle.ts * Description : commit 具体操作 * https://github.com/OBKoro1 @@ -109,7 +109,7 @@ class CommitHandle { ); const isDebug = true; // 手动更改调试模拟是否提交git if (!isProduction() && !isDebug) { - // TODO: 测试提交 以及接受log + // TODO: 测试提交 以及接受log const res = this.myExecSync( `cd ${this.paramsObj.itemSrc} && git add . && git commit -m 'autoCommit' --date='${time}' && git pull && git push origin master` ); @@ -140,7 +140,7 @@ class CommitHandle { } commitEnd(totalNum: number) { this.userCancel = false; // 重新打开终止开关 - this.autoCommitView.postMessage('commit 完成', 'commit 完成') + this.autoCommitView.postMessage('commit 完成', 'commit 完成'); outputLog('自动commit完成', `总commit次数${totalNum}`); } cancelCommit() { @@ -152,9 +152,24 @@ class CommitHandle { public closeCommit() { this.userCancel = true; } - // 格式化日期 + // 当天的随机时间 + // formatTime(time: string) { + // const hour = `${RandomNumber(0, 1)}${RandomNumber(0, 9)}`; + // const minute = `${RandomNumber(0, 5)}${RandomNumber(0, 9)}`; + // return `${time} ${hour}:${minute}`; + // } + // TODO: 某天的随机时间 代码块 + // 获取当天的随机时间 formatTime(time: string) { - return `${time} 08:00`; + const hour1 = RandomNumber(0, 2); + let hour2 = RandomNumber(0, 9); + if (hour1 === 2) { + // 小时第一个数字为2 则小时第二个数字最多为4 + hour2 = RandomNumber(0, 3); + } + const minute = `${RandomNumber(0, 5)}${RandomNumber(0, 9)}`; + const hour = `${hour1}${hour2}`; + return `${time} ${hour}:${minute}`; } // 获取两个日期之间的间隔: [ '2019-02-02', '2019-02-03' ... ] getAllDay(begin: string, end: string) { diff --git a/src/views/autoCommit.html b/src/views/autoCommit.html index 91e420d..ebf286a 100644 --- a/src/views/autoCommit.html +++ b/src/views/autoCommit.html @@ -103,6 +103,7 @@ :autosize="{ minRows: 1, maxRows: 4}" placeholder="无法输入 仅用于展示" v-model="showText.paramsStr" :disabled="showText.paramsStr === ''"> + Readme 更新日志