index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // pages/ucenter/accountsecurity/accountsecurity.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. isLogin: false,
  8. isBindPhone: 0,
  9. reviserPasswordScene: 'MDF_PWD',
  10. unbindPhoneScene: 'UN_PHONE'
  11. },
  12. goModifuPassword(e) {
  13. if (!this.data.isLogin) {
  14. let url = `/pages/login/phone_login/phone_login`;
  15. wx.navigateTo({
  16. url
  17. });
  18. return;
  19. }
  20. if(this.phoneCheck()){
  21. let url = '/pages/ucenter/accountsecurity/checkphonesecuirty/checkphonesecruity?scene='+this.data.reviserPasswordScene;
  22. wx.navigateTo({
  23. url
  24. });
  25. }
  26. },
  27. goModifyPhone(e) {
  28. if (!this.data.isLogin) {
  29. let url = `/pages/login/phone_login/phone_login`;
  30. wx.navigateTo({
  31. url
  32. });
  33. return;
  34. }
  35. if(this.phoneCheck()){
  36. let url = '/pages/ucenter/accountsecurity/checkphonesecuirty/checkphonesecruity?scene='+this.data.unbindPhoneScene;
  37. wx.navigateTo({
  38. url
  39. });
  40. }
  41. },
  42. phoneCheck(){
  43. if (this.data.isBindPhone==0) {
  44. wx.showModal({
  45. title: '提示',
  46. content: '当前账户未绑定手机号,请您进行手机号绑定操作',
  47. showCancel:false,
  48. confirmText: '去绑定',
  49. confirmColor:'#00AADD',
  50. success: function (res1) {
  51. let url = `/pages/bindPhone/bindPhone`;
  52. wx.navigateTo({
  53. url
  54. });
  55. }
  56. })
  57. return false;
  58. }else{
  59. return true;
  60. }
  61. },
  62. /**
  63. * 生命周期函数--监听页面加载
  64. */
  65. onLoad(options) {
  66. },
  67. /**
  68. * 生命周期函数--监听页面初次渲染完成
  69. */
  70. onReady() {
  71. },
  72. /**
  73. * 生命周期函数--监听页面显示
  74. */
  75. onShow() {
  76. let userInfo = wx.getStorageSync('userInfo');
  77. let isLogin = wx.getStorageSync('isLogin');
  78. if (userInfo && isLogin) {
  79. this.setData({
  80. isLogin,
  81. isBindPhone: userInfo.bindingPhone
  82. });
  83. }else{
  84. this.setData({
  85. isLogin: false,
  86. isBindPhone: 0
  87. });
  88. }
  89. },
  90. /**
  91. * 生命周期函数--监听页面隐藏
  92. */
  93. onHide() {
  94. },
  95. /**
  96. * 生命周期函数--监听页面卸载
  97. */
  98. onUnload() {
  99. },
  100. /**
  101. * 页面相关事件处理函数--监听用户下拉动作
  102. */
  103. onPullDownRefresh() {
  104. },
  105. /**
  106. * 页面上拉触底事件的处理函数
  107. */
  108. onReachBottom() {
  109. },
  110. /**
  111. * 用户点击右上角分享
  112. */
  113. onShareAppMessage() {
  114. }
  115. })