From de4b93eb85352eb9e814fbfc9d41a7e6664640eb Mon Sep 17 00:00:00 2001 From: OBKoro1 <1677593011@qq.com> Date: Mon, 31 Aug 2020 11:32:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B6=85=E8=BF=87=E4=B8=80=E5=AE=9A?= =?UTF-8?q?=E5=A4=A9=E6=95=B0=E8=8C=83=E5=9B=B4=E5=86=85=EF=BC=8C=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E9=83=A8=E5=88=86=E5=A4=A9=E6=95=B0=E4=B8=8D=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/commitHandle.ts | 25 ++++++++++++++---- src/views/autoCommit.html | 52 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 7 deletions(-) diff --git a/src/models/commitHandle.ts b/src/models/commitHandle.ts index 6578837..8dd471f 100644 --- a/src/models/commitHandle.ts +++ b/src/models/commitHandle.ts @@ -1,9 +1,9 @@ /* * Author : OBKoro1 * Date : 2019-12-30 16:59:30 - * @LastEditors : OBKoro1 - * @LastEditTime : 2020-01-15 11:46:52 - * FilePath : /autoCommit/src/models/commitHandle.ts + * LastEditors : OBKoro1 + * LastEditTime : 2020-08-29 14:21:47 + * FilePath : \autoCommit\src\models\commitHandle.ts * Description : commit 具体操作 * https://github.com/OBKoro1 */ @@ -34,11 +34,13 @@ interface dayTime { class CommitHandle { public paramsObj: any; + public moreObj: any; public timeArr: Array; public autoCommitView: WebView; private userCancel: boolean; constructor(message: webviewMsg) { - this.paramsObj = message.data; + this.paramsObj = message.data.form; + this.moreObj = message.data.moreObj; this.timeArr = []; console.log('seb',sep) this.timeHandle(); @@ -88,7 +90,20 @@ class CommitHandle { } } ); - this.commitFn(); + this.deleteDayArrDay() + this.commitFn() + } + // 随机删除日期数组中的某几天 + deleteDayArrDay() { + const noCommitDay = this.moreObj.noCommitDay + const scopeDay = this.moreObj.scopeDay + if(scopeDay < 1 || noCommitDay < 1) return // 必须大于1 + if(scopeDay > this.timeArr.length) return // 日期不够 + // 删除 + for(let i = 0; i < noCommitDay; i++){ + let ranDomNum = Math.floor(Math.random() * this.timeArr.length); // 随机数 + this.timeArr.splice(ranDomNum, 1); + } } async commitFn() { await outputLog('将要commit的日期:', JSON.stringify(this.timeArr)); diff --git a/src/views/autoCommit.html b/src/views/autoCommit.html index fd882c7..f9a1699 100644 --- a/src/views/autoCommit.html +++ b/src/views/autoCommit.html @@ -43,6 +43,32 @@ + + + + + + + + + 超出时间范围: + + 超出这个范围随机不提交天数: + + +