diff --git a/src/components/digicipher/digicipher.ts b/src/components/digicipher/digicipher.ts index 31dae6d..2ac37c8 100644 --- a/src/components/digicipher/digicipher.ts +++ b/src/components/digicipher/digicipher.ts @@ -144,6 +144,11 @@ export class StarLockNumber extends StarBaseElement { this.spanContainer.style.visibility = `hidden` this.parent.style.visibility = `hidden` this.changeText = this.$l('create-password-success') + for (let i = 0; i < 6; i++) { + this.savemode + ? this.changeBgColor('#000000', i, 0.1) + : this.changeBgColor('#F4F4F4', i, 0.4) + } break case 'digicipher-passcode-verify-success': this.guess = '' @@ -203,30 +208,23 @@ export class StarLockNumber extends StarBaseElement { this.makeZero() //点击反馈 this.changeNumberBgColor() - if (this.clicks < 5) { + if (this.clicks <= 6) { //圆点变化 this.savemode ? this.changeBgColor('#000000', this.clicks, 1) : this.changeBgColor('#F4F4F4', this.clicks, 1) this.clicks += 1 this.guess += (e.target as HTMLElement).dataset.num - // console.log('###this.guess', this.guess) - } else if (this.clicks == 5) { - this.guess += (e.target as HTMLElement).dataset.num - // console.log('guess', this.guess) - for (let i = 0; i < 6; i++) { - this.savemode - ? this.changeBgColor('#000000', i, 0.1) - : this.changeBgColor('#F4F4F4', i, 0.4) - } - if (this.savemode) { - if (!this.confirm) { - this.changePasswd() + if (this.clicks == 6) { + if (this.savemode) { + if (!this.confirm) { + this.changePasswd() + } else { + this.confirmPasswd() + } } else { - this.confirmPasswd() + this.dispatchPasswd() } - } else { - this.dispatchPasswd() } } } else if ((e.target as Element).className === 'delete') { @@ -294,14 +292,8 @@ export class StarLockNumber extends StarBaseElement { //发送密码 dispatchPasswd() { this.passwd = this.guess - // console.log('send passwd', this.passwd) this.guess = '' this.clicks = 0 - for (let i = 0; i < 6; i++) { - this.savemode - ? this.changeBgColor('#000000', i, 0.1) - : this.changeBgColor('#F4F4F4', i, 0.4) - } this.dispatchEvent( new CustomEvent('star-digicipher-passwd', { detail: { @@ -331,11 +323,6 @@ export class StarLockNumber extends StarBaseElement { if (this.savewd.toString() == this.guess.toString()) { this.passwd = this.savewd this.savewd = '' - for (let i = 0; i < 6; i++) { - this.savemode - ? this.changeBgColor('#000000', i, 0.1) - : this.changeBgColor('#F4F4F4', i, 0.4) - } this.guess = '' this.clicks = 0 this.changeText = this.$l('create-password-success')