zhengxb 发表于 2018-12-6 10:09:53

_PASSWORD原型继承方法使用说明

本帖最后由 zhengxb 于 2018-12-21 08:11 编辑

应用于密码提示框,参考简单约模式主模版
应用示例可查看_MATRIX 和_AUDIO方法,可自行修改相关方法属性及添加方法属性。有任何问题建议可在下方留言,功能持续改进更新
附:
1.28.2更新
修改设置页面的参数可选择为实际页面或方法,方便多个页或其它命令传参时,可通过方法传参

function _PASSWORD(vpasscode,vpasspage,vnextpage)
{
       
        this.passcode = vpasscode;
        this.passtext = 'txtPassword';
        this.passpage = vpasspage;
        this.nextPage = vnextpage;
        this.strpass = "";
        this.txtpass = "";
        this.setpop = function()
        {
                this.strpass = "";
                this.txtpass = "";
                setPageShow(this.passpage);
                setButtonText(this.passtext, "Input Pass Code!");
        }
        this.set = function(vNum)
        {
                this.strpass = this.strpass + vNum;
                this.txtpass = this.txtpass + "*";
                setButtonText(this.passtext,this.txtpass)
        }
        this.del = function()
        {
                if(this.strpass.length<=1)
                {
                        this.strpass = "";
                        this.txtpass = "";
                        setButtonText(this.passtext, "Input Pass Code!");
                }
                else
                {
                        this.strpass = this.strpass.substring(-1,this.strpass.length-1);
                        this.txtpass = this.txtpass.substring(-1,this.txtpass.length-1);
                        setButtonText(this.passtext,this.txtpass)
                }
        }
        this.enter = function()
        {
               if(this.strpass == this.passcode)
                {
                       setPageHide(this.passpage);
                       
                       if(typeof(this.nextPage) == 'function'){
                               this.nextPage();
                       }else{
                                  setPageShow(this.nextPage);
                       }
                       this.strpass = "";
                       this.txtpass = "";
                }
                else
                {
                       setButtonText(this.passtext,"Error Pass Code!")
                       this.strpass = "";
                       this.txtpass = "";
                }
               
        }
}


页: [1]
查看完整版本: _PASSWORD原型继承方法使用说明