BUG: #144182 图形密码解锁逻辑修复以及失败次数与settings.json关联

This commit is contained in:
duanzhijiang 2022-11-08 20:11:49 +08:00
parent 43b56ef4b4
commit 667a47e9e1
1 changed files with 12 additions and 11 deletions

View File

@ -118,17 +118,23 @@ export class StarPatternView extends LitElement {
this.changeText = '密码设置成功'
break
case 'passcode-verify-success':
console.log('图案正确')
this.getRed = false
this.errors = 0
this.changeText = '绘制图案'
break
case 'passcode-verify-error':
this.passwd = event.detail.passwd
this.getRed = true
this.changeText = '绘制图案错误'
//当密码失败三次后
this.errors += 1
console.log(this.errors)
this.errors = event.detail.value
if (this.errors == 3) {
console.log('进入已锁定页面')
this.changeText = '绘制图案'
this.cxt.clearRect(0, 0, this.canvasWidth, this.canvasHeight)
this.passwd = []
this.getRed = false
this.Draw()
this.dispatchEvent(
new CustomEvent('star-pattern-view-passwd-error-third', {
detail: {
@ -138,7 +144,6 @@ export class StarPatternView extends LitElement {
composed: true,
})
)
this.errors = 0
}
break
@ -147,6 +152,7 @@ export class StarPatternView extends LitElement {
}
}
touchStart(e: TouchEvent) {
// this.cxt.clearRect(0, 0, this.canvasWidth, this.canvasHeight)
this.lessfourinfo = ''
this.passwd = []
this.getRed = false
@ -174,10 +180,8 @@ export class StarPatternView extends LitElement {
})
}
touchEnd(_e: TouchEvent) {
console.log('###', this.passwd.length)
if (this.saveMode && this.passwd.length < 4) {
this.cxt.clearRect(0, 0, this.canvasWidth, this.canvasHeight)
// this.cxt.clearRect(0, 0, this.canvasWidth, this.canvasHeight)
this.getRed = true
this.lessfourinfo = '至少连接四个点'
} else {
@ -301,7 +305,7 @@ export class StarPatternView extends LitElement {
var dir = Math.pow(xdiff * xdiff + ydiff * ydiff, 0.5)
if (dir > this.R || passwd.indexOf(i) >= 0) continue
passwd.push(i)
console.log(this.passwd)
// console.log(this.passwd)
break
}
}
@ -310,7 +314,6 @@ export class StarPatternView extends LitElement {
console.log('请确认密码', this.savewd.toString())
this.confirm = true
this.changeText = '请确认图案'
console.log('###', this.passwd)
this.dispatchEvent(
new CustomEvent('star-pattern-view-settings-change', {
@ -324,7 +327,6 @@ export class StarPatternView extends LitElement {
}
confirmPasswd() {
if (this.savewd.toString() == this.passwd.toString()) {
console.log('###', this.passwd)
this.dispatchEvent(
new CustomEvent('star-pattern-view-settings-confirm', {
detail: {
@ -336,7 +338,6 @@ export class StarPatternView extends LitElement {
)
} else {
this.changeText = '请重新绘制图案'
console.log('###', this.passwd)
this.confirm = false
this.passwd = []
}