s_password.js 1.91 KB
var util = require('../../utils/util.js')
var uri=require('../../utils/uri.js')
Page({
    data:{
        showpass:false,
        pass:'',
        closepass:'',
    },
    onLoad:function(opt){
        util.setBarTitle('查看密码');
        this.setData({
            sellerid:util.cache('sellerid'),
            account:opt.account,
            id:opt.id,
            totalheight:util.cache('system.info').windowHeight
        })
    },
    onShow:function(){
        this.resetpass();
        this.alert=this.selectComponent('#alert');
        var that=this;
        util.postSuccessFun=function(json,uri_code){
            switch(uri_code){
                case uri.CGI_USER_GETPASSWORD__CODE:
                    if(json.ret==200){
                        var closepass='';
                        var pass=json.data;
                        for(var i=0;i<pass.length;i++){
                            if(i>0 && i<pass.length-1){
                                closepass+='*'
                            }else{
                                closepass+=pass[i]
                            }

                        }
                        that.setData({
                            pass:json.data,
                            closepass:closepass
                        })
                    }else{
                        that.alert.show('该账号已被移除');
                    }

                break;
            }

        }
    },
    //查看密码
    lookpass:function(){
        this.setData({
            showpass:!this.data.showpass
        })
    },
    //重置密码
    resetpassword:function(){
        wx.navigateTo({
            url:'s_repass?id='+this.data.id
        })
    },
    resetpass:function(){
        util.post(uri.CGI_USER_GETPASSWORD,{sellerid:this.data.sellerid,account:this.data.account,key:'xiaotao666'},uri.CGI_USER_GETPASSWORD__CODE)
    },
    netchange:function () {
        this.onShow()
    }
})