index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // pages/personalcenter/index.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. },
  8. //跳转到地址
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad: function (options) {
  13. },
  14. /**
  15. * 生命周期函数--监听页面初次渲染完成
  16. */
  17. onReady: function () {
  18. },
  19. /**
  20. * 生命周期函数--监听页面显示
  21. */
  22. onShow: function () {
  23. let that=this
  24. wx.getStorage({
  25. key: 'user_name',
  26. success: function(res) {},
  27. fail: function(res) {},
  28. complete: function(res) {
  29. that.setData({
  30. userName:res.data
  31. })
  32. },
  33. })
  34. wx.getStorage({
  35. key: 'tel',
  36. success: function (res) { },
  37. fail: function (res) { },
  38. complete: function (res) {
  39. that.setData({
  40. tel: res.data
  41. })
  42. },
  43. })
  44. },
  45. outLogin:function(){
  46. wx.setStorage({
  47. key: 'cwxcx_token',
  48. data: '',
  49. success: function(res) {},
  50. fail: function(res) {},
  51. complete: function(res) {
  52. wx.reLaunch({
  53. url: '../login/login',
  54. success: function(res) {},
  55. fail: function(res) {},
  56. complete: function(res) {},
  57. })
  58. },
  59. })
  60. },
  61. /**
  62. * 生命周期函数--监听页面隐藏
  63. */
  64. onHide: function () {
  65. },
  66. /**
  67. * 生命周期函数--监听页面卸载
  68. */
  69. onUnload: function () {
  70. },
  71. /**
  72. * 页面相关事件处理函数--监听用户下拉动作
  73. */
  74. onPullDownRefresh: function () {
  75. },
  76. /**
  77. * 页面上拉触底事件的处理函数
  78. */
  79. onReachBottom: function () {
  80. },
  81. /**
  82. * 用户点击右上角分享
  83. */
  84. onShareAppMessage: function () {
  85. }
  86. })