Merge pull request #221 in YR/star-web-components from star-swiper-lockscreen-setting to master

* commit 'da13b6a89ef2befe4de152e4b1eb6a24a835bb70':
  swiper remove log
  BUG : #151739 lockscreen passcode & setting
This commit is contained in:
汪昌棋 2023-01-12 15:20:50 +08:00
commit 260bca156e
4 changed files with 38 additions and 53 deletions

View File

@ -51,41 +51,22 @@ export class StarLockNumber extends StarBaseElement {
@property({type: String}) passwd = '' @property({type: String}) passwd = ''
@property({type: String}) savewd = '' @property({type: String}) savewd = ''
// protected update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void { constructor() {
// super.update(changedProperties) super()
// if (this.savemode) { }
// this.changeText = '请输入数字锁屏密码'
// /* this.slideUp.style.setProperty('top', 'var(--auto-370px)') */
// this.spanContainer.style.setProperty(
// 'margin',
// 'var(--auto-80px) 0 var(--auto-100px) 0'
// )
// this.text.style.setProperty('font-size', 'var(--auto-32px)')
// this.bottomText.style.setProperty('margin-top', 'var(--auto-100px)')
// } else {
// this.changeText = '输入密码'
// }
// for (let i = 0; i < 6; i++) {
// this.savemode
// ? this.changeBgColor('#000000', i, 0.1)
// : this.changeBgColor('#F4F4F4', i, 0.4)
// }
// this.spanContainer.style.visibility = `visible`
// this.parent.style.visibility = `visible`
// }
protected firstUpdated( protected firstUpdated(
_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown> _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>
): void { ): void {
window.addEventListener('lockswiperup', () => {
this.requestUpdate()
})
if (this.savemode) { if (this.savemode) {
this.changeText = this.$l('please-enter-the-digital-lockscreen-password')
this.spanContainer.style.setProperty( this.spanContainer.style.setProperty(
'margin', 'margin',
'var(--auto-80px) 0 var(--auto-100px) 0' 'var(--auto-80px) 0 var(--auto-100px) 0'
) )
this.text.style.setProperty('font-size', 'var(--auto-32px)') this.text.style.setProperty('font-size', 'var(--auto-32px)')
this.bottomText.style.setProperty('margin-top', 'var(--auto-100px)') this.bottomText.style.setProperty('margin-top', 'var(--auto-100px)')
} else {
this.changeText = this.$l('enter-password')
} }
for (let i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
this.savemode this.savemode
@ -101,6 +82,11 @@ export class StarLockNumber extends StarBaseElement {
} }
render() { render() {
this.savemode
? (this.changeText = this.$l(
'please-enter-the-digital-lockscreen-password'
))
: (this.changeText = this.$l('enter-password'))
return html` return html`
<div id="slideUp"> <div id="slideUp">
<div id="textcenter"> <div id="textcenter">

View File

@ -50,9 +50,12 @@ export class StarPatternView extends StarBaseElement {
@property({type: Array}) passwdArr = [] @property({type: Array}) passwdArr = []
@property({type: String}) mode = '' @property({type: String}) mode = ''
@property({type: String}) changeText = '' @property({type: String}) changeText = ''
@property({type: String}) cancel = '取消' @property({type: String}) cancel = ''
@property({type: String}) lessfourinfo = '' @property({type: String}) lessfourinfo = ''
render() { render() {
this.changeText = this.savemode
? this.$l('please-draw-a-pattern')
: this.$l('draw-a-pattern')
if (!this.savemode) { if (!this.savemode) {
return html` return html`
<div id="content"> <div id="content">
@ -91,6 +94,9 @@ export class StarPatternView extends StarBaseElement {
protected firstUpdated( protected firstUpdated(
_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown> _changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>
): void { ): void {
window.addEventListener('lockswiperup', () => {
this.requestUpdate()
})
//settings中图形密码上下的文字以及图形密码的位置都有所变化 //settings中图形密码上下的文字以及图形密码的位置都有所变化
if (this.savemode) { if (this.savemode) {
this.textTop.style.setProperty('margin-bottom', 'var(--auto-100px)') this.textTop.style.setProperty('margin-bottom', 'var(--auto-100px)')
@ -106,9 +112,7 @@ export class StarPatternView extends StarBaseElement {
this.Y = (this.canvasHeight - 2 * this.OffsetY - this.R * 2 * 3) / 2 this.Y = (this.canvasHeight - 2 * this.OffsetY - this.R * 2 * 3) / 2
this.createCirclePoint(this.X, this.Y) this.createCirclePoint(this.X, this.Y)
this.Draw() this.Draw()
this.changeText = this.savemode
? this.$l('please-draw-a-pattern')
: this.$l('draw-a-pattern')
this.addEventListener('passcode-create-success', this) this.addEventListener('passcode-create-success', this)
this.addEventListener('pattern-passcode-verify-success', this) this.addEventListener('pattern-passcode-verify-success', this)
this.addEventListener('pattern-passcode-verify-error', this) this.addEventListener('pattern-passcode-verify-error', this)
@ -346,6 +350,7 @@ export class StarPatternView extends StarBaseElement {
) )
} else { } else {
this.changeText = this.$l('please-redraw-the-pattern') this.changeText = this.$l('please-redraw-the-pattern')
this.lessfourinfo = this.$l('pattern-do-not-match-please-reset')
this.confirm = false this.confirm = false
this.passwd = [] this.passwd = []
} }

View File

@ -156,7 +156,7 @@ export const sharedStyles: CSSResult = css`
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-direction: column; flex-direction: column;
bottom: -200px; bottom: -18%;
width: var(--auto-520px); width: var(--auto-520px);
height: var(--auto-310px); height: var(--auto-310px);
left: 50%; left: 50%;
@ -184,7 +184,7 @@ export const sharedStyles: CSSResult = css`
} }
@keyframes slider { @keyframes slider {
0% { 0% {
bottom: -200px; bottom: -18%;
} }
100% { 100% {
bottom: var(--auto-9px); bottom: var(--auto-9px);
@ -195,7 +195,7 @@ export const sharedStyles: CSSResult = css`
bottom: var(--auto-9px); bottom: var(--auto-9px);
} }
100% { 100% {
bottom: -200px; bottom: -18%;
} }
} }
` `

View File

@ -101,7 +101,7 @@ export class StarLockNumber extends StarBaseElement {
}) })
this.changeTimeFormatter() this.changeTimeFormatter()
this.menu.removeAttribute('style') this.menu.removeAttribute('style')
this.menu.style.setProperty('bottom', '-200px') this.menu.style.setProperty('bottom', '-18%')
//全面阻止移动端事件的默认行为 //全面阻止移动端事件的默认行为
document.addEventListener('touchstart', function (ev: TouchEvent) { document.addEventListener('touchstart', function (ev: TouchEvent) {
ev.preventDefault() ev.preventDefault()
@ -190,7 +190,7 @@ export class StarLockNumber extends StarBaseElement {
} }
ulWidth(enlarge: Boolean) { ulWidth(enlarge: Boolean) {
if (enlarge) { if (enlarge) {
console.log('预览') /* 预览 */
this.cur_ul_width = this.cur_ul_width =
(this.figure_arr.length + 1) * (this.figure_arr.length + 1) *
(this.cur_li_width + this.cur_li_margin_right) * (this.cur_li_width + this.cur_li_margin_right) *
@ -198,16 +198,12 @@ export class StarLockNumber extends StarBaseElement {
this.cur_ul.style.setProperty('width', this.cur_ul_width + 'px') this.cur_ul.style.setProperty('width', this.cur_ul_width + 'px')
this.cur_ul.style.setProperty('left', 487 - 124 * this.index + 'vw') this.cur_ul.style.setProperty('left', 487 - 124 * this.index + 'vw')
} else { } else {
console.log('非预览') /* 非预览 */
this.cur_ul_width = this.cur_ul_width =
(this.figure_arr.length + 1) * (this.figure_arr.length + 1) *
(this.cur_li_width + this.cur_li_margin_right) (this.cur_li_width + this.cur_li_margin_right)
this.cur_ul.style.setProperty('width', this.cur_ul_width + 'px') this.cur_ul.style.setProperty('width', this.cur_ul_width + 'px')
this.cur_ul.style.setProperty('left', 28.4 - 53.6 * this.index + 'vw') this.cur_ul.style.setProperty('left', 28.4 - 53.6 * this.index + 'vw')
console.log('this.cur_li_width', this.cur_li_width)
console.log('this.cur_li_margin_right', this.cur_li_margin_right)
console.log('this.figure_arr.length + 1', this.figure_arr.length + 1)
console.log('this.cur_ul_width', this.cur_ul_width)
} }
} }
touchStart(e: TouchEvent) { touchStart(e: TouchEvent) {
@ -253,7 +249,6 @@ export class StarLockNumber extends StarBaseElement {
'transition', 'transition',
'left .3s cubic-bezier(.05,.62,.42,.9)' 'left .3s cubic-bezier(.05,.62,.42,.9)'
) )
console.log('index', this.index)
//清零移动距离 //清零移动距离
this.distanceX = 0 this.distanceX = 0
} else { } else {
@ -283,7 +278,6 @@ export class StarLockNumber extends StarBaseElement {
'transition', 'transition',
'left .3s cubic-bezier(.05,.62,.42,.9)' 'left .3s cubic-bezier(.05,.62,.42,.9)'
) )
console.log('index', this.index)
//清零移动距离 //清零移动距离
this.distanceX = 0 this.distanceX = 0
} }
@ -292,7 +286,7 @@ export class StarLockNumber extends StarBaseElement {
if ((e.target as Element).id === 'cancel') { if ((e.target as Element).id === 'cancel') {
//点击取消 //点击取消
this.menu.removeAttribute('style') this.menu.removeAttribute('style')
this.menu.style.setProperty('bottom', '-200px') this.menu.style.setProperty('bottom', '-18%')
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('star-swiper-cancel', { new CustomEvent('star-swiper-cancel', {
detail: { detail: {
@ -305,7 +299,7 @@ export class StarLockNumber extends StarBaseElement {
} else if ((e.target as Element).id === 'preview') { } else if ((e.target as Element).id === 'preview') {
//点击预览 //点击预览
this.menu.removeAttribute('style') this.menu.removeAttribute('style')
this.menu.style.setProperty('bottom', '-200px') this.menu.style.setProperty('bottom', '-18%')
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('star-swiper-preview', { new CustomEvent('star-swiper-preview', {
detail: { detail: {
@ -342,11 +336,11 @@ export class StarLockNumber extends StarBaseElement {
touchStartMenu(e: TouchEvent) { touchStartMenu(e: TouchEvent) {
this.type = data.type[this.index] this.type = data.type[this.index]
if ((e.target as Element).id === 'onlyStyle') { if ((e.target as Element).id === 'onlyStyle') {
console.log('onlyStyle') // console.log('onlyStyle')
this.menu.removeAttribute('style') this.menu.removeAttribute('style')
this.menu.style.setProperty('animation', 'sliderBack .5s') // this.menu.style.setProperty('animation', 'sliderBack .5s')
this.menu.style.setProperty('animation-fill-mode', 'forwards') // this.menu.style.setProperty('animation-fill-mode', 'forwards')
this.menu.style.setProperty('bottom', '-200px') this.menu.style.setProperty('bottom', '-18%')
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('star-swiper-onlyStyle', { new CustomEvent('star-swiper-onlyStyle', {
detail: { detail: {
@ -360,11 +354,11 @@ export class StarLockNumber extends StarBaseElement {
//预览时点击应用会保存预览变大的状态 //预览时点击应用会保存预览变大的状态
this.enlarge ? this.preview() : '' this.enlarge ? this.preview() : ''
} else if ((e.target as Element).id === 'styleAndWallpaper') { } else if ((e.target as Element).id === 'styleAndWallpaper') {
console.log('styleAndWallpaper') // console.log('styleAndWallpaper')
this.menu.removeAttribute('style') this.menu.removeAttribute('style')
this.menu.style.setProperty('bottom', '-200px') // this.menu.style.setProperty('animation', 'sliderBack .5s')
this.menu.style.setProperty('animation', 'sliderBack .5s') // this.menu.style.setProperty('animation-fill-mode', 'forwards')
this.menu.style.setProperty('animation-fill-mode', 'forwards') this.menu.style.setProperty('bottom', '-18%')
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('star-swiper-styleAndWallpaper', { new CustomEvent('star-swiper-styleAndWallpaper', {
detail: { detail: {
@ -378,11 +372,11 @@ export class StarLockNumber extends StarBaseElement {
//预览时点击应用会保存预览变大的状态 //预览时点击应用会保存预览变大的状态
this.enlarge ? this.preview() : '' this.enlarge ? this.preview() : ''
} else if ((e.target as Element).id === 'menuCancel') { } else if ((e.target as Element).id === 'menuCancel') {
console.log('menuCancel') // console.log('menuCancel')
this.menu.removeAttribute('style') this.menu.removeAttribute('style')
this.menu.style.setProperty('animation', 'sliderBack .5s') this.menu.style.setProperty('animation', 'sliderBack .5s')
this.menu.style.setProperty('animation-fill-mode', 'forwards') this.menu.style.setProperty('animation-fill-mode', 'forwards')
this.menu.style.setProperty('bottom', '-200px') this.menu.style.setProperty('bottom', '-18%')
} }
} }