您好,登錄后才能下訂單哦!
本文小編為大家詳細(xì)介紹“微信小程序怎么實(shí)現(xiàn)手勢(shì)解鎖”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“微信小程序怎么實(shí)現(xiàn)手勢(shì)解鎖”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來學(xué)習(xí)新知識(shí)吧。
這是一款簡(jiǎn)單實(shí)用的手勢(shì)解鎖工具
手勢(shì)解鎖是當(dāng)下常用的解鎖方式
本實(shí)例以工具的形式
可以嵌入到不同的項(xiàng)目之中
wxlocker.prototype.storePass = function(psw,cb) {// touchend結(jié)束之后對(duì)密碼和狀態(tài)的處理 if (this.pswObj.step == 1) {//step==1表示還沒有設(shè)置密碼狀態(tài) if (this.checkPass(this.pswObj.fpassword, psw)) { this.pswObj.step = 2; this.pswObj.spassword = psw; this.resetHidden = false; this.title = "密碼保存成功"; this.titleColor = "succ"; this.drawStatusPoint('#09bb07'); wx.setStorageSync('passwordxx', JSON.stringify(this.pswObj.spassword)); // wx.setStorageSync('chooseType', this.chooseType); } else { this.title = "兩次繪制不一致,重新繪制"; this.titleColor = "error"; this.drawStatusPoint('#e64340'); delete this.pswObj.step; } } else if (this.pswObj.step == 2) { if (this.checkPass(this.pswObj.spassword, psw)) { this.title = "解鎖成功"; this.titleColor = "succ"; this.drawStatusPoint('#09bb07'); cb(); } else { this.title = "解鎖失敗"; this.titleColor = "error"; this.drawStatusPoint('#e64340'); } } else { if(this.lastPoint.length<4){ this.title="密碼過于簡(jiǎn)單,請(qǐng)至少連接4個(gè)點(diǎn)"; this.resetHidden = true; this.titleColor = "error"; return false; }else{ this.pswObj.step = 1; this.pswObj.fpassword = psw; this.titleColor = ""; this.title = "再次輸入"; } } }
效果圖如下:
手勢(shì)設(shè)置:
手勢(shì)解鎖(成功):
手勢(shì)解鎖(失敗):
wxlocker.prototype.updatePassword = function(){//點(diǎn)擊重置按鈕,重置密碼 wx.removeStorageSync("passwordxx"); // wx.removeStorageSync("chooseType"); this.pswObj = {}; this.title="請(qǐng)?jiān)O(shè)置手勢(shì)密碼"; this.resetHidden = true; this.titleColor = ""; this.reset(); }
讀到這里,這篇“微信小程序怎么實(shí)現(xiàn)手勢(shì)解鎖”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。