BUG: #144182 设置数字与图案锁定输入3次错误密码就会锁定功能

This commit is contained in:
duanzhijiang 2022-11-07 09:39:46 +08:00
parent a8c522877b
commit 447da9db64
1 changed files with 21 additions and 2 deletions

View File

@ -115,6 +115,7 @@ export class StarLockNumber extends LitElement {
this.changeText = '保存成功' this.changeText = '保存成功'
break break
case 'passcode-verify-success': case 'passcode-verify-success':
this.errors = 0
this.guess = '' this.guess = ''
this.clicks = 0 this.clicks = 0
for (let i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
@ -122,6 +123,22 @@ export class StarLockNumber extends LitElement {
} }
break break
case 'passcode-verify-error': case 'passcode-verify-error':
this.errors += 1
console.log(this.errors)
//当密码失败三次后
if (this.errors == 3) {
console.log('进入已锁定页面')
this.dispatchEvent(
new CustomEvent('star-digicipher-passcode-error-third', {
detail: {
value: true,
},
bubbles: true,
composed: true,
})
)
this.errors = 0
}
// 抖动反馈 // 抖动反馈
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
this.buttons[i].style.setProperty('animation', 'errtips .5s') this.buttons[i].style.setProperty('animation', 'errtips .5s')
@ -164,6 +181,7 @@ export class StarLockNumber extends LitElement {
this.clicks += 1 this.clicks += 1
this.guess += (e.target as HTMLElement).dataset.num this.guess += (e.target as HTMLElement).dataset.num
} else if (this.clicks == 5) { } else if (this.clicks == 5) {
// console.log('guess', this.guess)
this.changeBgColor('#F4F4F4', this.clicks, 1) this.changeBgColor('#F4F4F4', this.clicks, 1)
if (this.mode == 'create') { if (this.mode == 'create') {
if (!this.confirm) { if (!this.confirm) {
@ -194,8 +212,6 @@ export class StarLockNumber extends LitElement {
} }
touchEnd(e: TouchEvent) { touchEnd(e: TouchEvent) {
if ((e.target as Element).tagName === 'BUTTON') { if ((e.target as Element).tagName === 'BUTTON') {
console.log('this.guess', this.guess)
this.removeNumberBgColor() this.removeNumberBgColor()
} }
} }
@ -221,6 +237,7 @@ export class StarLockNumber extends LitElement {
//发送密码 //发送密码
dispatchPasswd() { dispatchPasswd() {
this.passwd = this.guess this.passwd = this.guess
// console.log('passwd', this.passwd)
this.guess = '' this.guess = ''
this.clicks = 0 this.clicks = 0
this.dispatchEvent( this.dispatchEvent(
@ -236,6 +253,7 @@ export class StarLockNumber extends LitElement {
//更改密码 //更改密码
changePasswd() { changePasswd() {
this.savewd = this.guess this.savewd = this.guess
// console.log('更改密码', this.savewd)
this.clicks = 0 this.clicks = 0
for (let i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
this.changeBgColor('#F4F4F4', i, 0.4) this.changeBgColor('#F4F4F4', i, 0.4)
@ -257,6 +275,7 @@ export class StarLockNumber extends LitElement {
this.guess = '' this.guess = ''
this.clicks = 0 this.clicks = 0
this.changeText = '新建密码' this.changeText = '新建密码'
// console.log('确认密码', this.passwd)
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('star-digicipher-passcode-create', { new CustomEvent('star-digicipher-passcode-create', {
detail: { detail: {