博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
小程序安全设置-弹出框输入获取值
阅读量:7087 次
发布时间:2019-06-28

本文共 7131 字,大约阅读时间需要 23 分钟。

小程序安全设置

Page({  /**   * 页面的初始数据   */  data: {    anquan: '',    detailanquan: '',    hiddenmodalput: true,    //可以通过hidden是否掩藏弹出框的属性,来指定那个弹出框    idCard: '',    password: '',    phone: '',    email: '',    wxUnionid: '',    // 修改密码    psd: "",    newpsd: '',  },  // 获取身份认证:  idCard: function(e) {    this.setData({      idCard: e.detail.value,    })    console.log("获取身份认证:" + this.data.idCard);  },  // 获取登录密码:  password: function(e) {    this.setData({      password: e.detail.value,    })    console.log("获取登录密码:" + this.data.password);  },  // 获取绑定手机:  phone: function(e) {    this.setData({      phone: e.detail.value,    })    console.log("获取绑定手机:" + this.data.phone);  },  // 获取绑定邮箱:  email: function(e) {    this.setData({      email: e.detail.value,    })    console.log("获取绑定邮箱:" + this.data.email);  },  // 获取微信绑定:  wxUnionid: function(e) {    this.setData({      wxUnionid: e.detail.value,    })    console.log("获取微信绑定:" + this.data.wxUnionid);  },  // 修改按钮  sfrz: function(e) {    console.log("身份认证", this.data.idCard);    wx.request({      method: 'POST',      header: {        'Authorization': 'Bearer' + wx.getStorageSync('token'),      },      success(res) {        console.log("保存成功", res.data);        if (res == null || res.data == null) {          console.error('网络请求失败');          return;        }        wx.showToast({          title: '保存成功',          icon: 'success',          duration: 500        })      }    })  },  // 修改登录密码  dlmm: function(e) {    this.setData({      hiddenmodalput: !this.data.hiddenmodalput    })  },  cancelM: function(e) {    this.setData({      hiddenmodalput: true,    })  },  confirmM: function(e) {    console.log("原密码" + this.data.psd + "新密码" + this.data.newpsd);    this.setData({      hiddenmodalput: true,    })    wx.request({      method: 'POST',      header: {        'Authorization': 'Bearer' + wx.getStorageSync('token'),      },      success(res) {        console.log("保存成功", res.data);        if (res.data.code == 0) {          wx.showToast({            title: '保存失败',            icon: 'success',            duration: 500          })        }        if (res == null || res.data == null) {          console.error('网络请求失败');          return;        }        wx.showToast({          title: '保存成功',          icon: 'success',          duration: 500        })      }    })  },  ipsd: function(e) {    this.setData({      psd: e.detail.value    })  },  newipsd: function(e) {    this.setData({      newpsd: e.detail.value    })  },  // 绑定手机  bdsj: function(e) {    console.log("绑定手机", this.data.phone);    wx.request({      method: 'POST',      header: {        'Authorization': 'Bearer' + wx.getStorageSync('token'),      },      success(res) {        console.log("保存成功", res.data);        if (res == null || res.data == null) {          console.error('网络请求失败');          return;        }        wx.showToast({          title: '保存成功',          icon: 'success',          duration: 500        })      }    })  },  bdyx: function(e) {    console.log("绑定邮箱", this.data.email);    wx.request({      method: 'POST',      header: {        'Authorization': 'Bearer' + wx.getStorageSync('token'),      },      success(res) {        console.log("保存成功", res.data);        if (res == null || res.data == null) {          console.error('网络请求失败');          return;        }        wx.showToast({          title: '保存成功',          icon: 'success',          duration: 500        })      }    })  },  wxbd: function(e) {    console.log("微信绑定", this.data.wxUnionid);    wx.showModal({      title: '提示',      content: '解除微信绑定,注销账号! 是否确定?',      success(res) {        if (res.confirm) {          console.log('用户点击确定')          wx.request({             data: this.data.wxUnionid,            method: 'POST',            header: {              'Authorization': 'Bearer' + wx.getStorageSync('token'),            },            success(res) {              console.log("解绑成功", res.data);              if (res == null || res.data == null) {                console.error('网络请求失败');                return;              }              wx.showToast({                title: '保存成功',                icon: 'success',                duration: 500              })            }          })        } else if (res.cancel) {          console.log('用户点击取消')        }      }    })  },  /**   * 生命周期函数--监听页面加载   */  onLoad: function(options) {    var that = this;    wx.request({      method: 'GET',      header: {        'Authorization': 'Bearer' + wx.getStorageSync('token')      },      success(res) {        console.log("安全设置", res.data.data);        var pass = res.data.data.user.password        if (pass != null) {          let password = "**********";          let passs = password;          that.setData({            idCard: res.data.data.userDetail.idCard,            // password: res.data.data.user.password,            password: passs,            phone: res.data.data.user.phone,            email: res.data.data.user.email,            wxUnionid: res.data.data.user.wxUnionid,          })        } else {          that.setData({            idCard: res.data.data.userDetail.idCard,            password: res.data.data.user.password,            phone: res.data.data.user.phone,            email: res.data.data.user.email,            wxUnionid: res.data.data.user.wxUnionid,          })        }        wx.showToast({          title: '加载成功',          icon: 'loading',          duration: 500        })      }    })  },  /**   * 生命周期函数--监听页面初次渲染完成   */  onReady: function() {  },  /**   * 生命周期函数--监听页面显示   */  onShow: function() {  },  /**   * 生命周期函数--监听页面隐藏   */  onHide: function() {  },  /**   * 生命周期函数--监听页面卸载   */  onUnload: function() {  },  /**   * 页面相关事件处理函数--监听用户下拉动作   */  onPullDownRefresh: function() {    var that = this;    wx.request({      method: 'GET',      header: {        'Authorization': 'Bearer' + wx.getStorageSync('token')      },      success(res) {        console.log("安全设置", res.data.data);        var pass = res.data.data.user.password        if (pass != null) {          let password = "**********";          let passs = password;          that.setData({            idCard: res.data.data.userDetail.idCard,            // password: res.data.data.user.password,            password: passs,            phone: res.data.data.user.phone,            email: res.data.data.user.email,            wxUnionid: res.data.data.user.wxUnionid,          })        } else {          that.setData({            idCard: res.data.data.userDetail.idCard,            password: res.data.data.user.password,            phone: res.data.data.user.phone,            email: res.data.data.user.email,            wxUnionid: res.data.data.user.wxUnionid,          })        }        wx.showToast({          title: '加载成功',          icon: 'loading',          duration: 500        })      },      complete: function(res) {        wx.stopPullDownRefresh();      }    })  },  /**   * 页面上拉触底事件的处理函数   */  onReachBottom: function() {  },  /**   * 用户点击右上角分享   */  onShareAppMessage: function() {  }})复制代码
登录密码
复制代码

转载地址:http://hqbql.baihongyu.com/

你可能感兴趣的文章
C# IEnumerable和IEnumerator的区别,如何实现
查看>>
android adb命令行工具使用
查看>>
[转]聊聊.net程序设计——浅谈使用VS2010建模拓展
查看>>
Central Europe Regional Contest 2011
查看>>
每天一个linux命令(12):more命令
查看>>
javascript 正则替换字符的新方法!
查看>>
OSGI:从面向接口编程来理解OSGI
查看>>
前端之JavaScript(1) - 浅谈JavaScript函数与栈
查看>>
WayOs 帐号到期自动清理工具,致浪费在清理到期用户的青春
查看>>
新买的mac笔记本,发现vi编辑器没有颜色的解决方案
查看>>
object-c 混编 调用C,C++接口
查看>>
JQuery Ajax实例总结
查看>>
CentOS中文件夹基本操作命令
查看>>
VS2008 Project : error PRJ0019: 某个工具从以下位置返回了错误代码: "正在执行生成后事件..."解决方案...
查看>>
js判断图片是否存在,并做处理
查看>>
触摸屏
查看>>
webservice 测试窗体只能用于来自本地计算机的请求
查看>>
Java 中队列的使用
查看>>
再见 2014,你好 2015
查看>>
13 SELECT 以外的内容
查看>>