usercenter.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // pages/usercenter/usercenter.js
  2. import bindLog,{logs} from "../../module/logs/logs"
  3. import stylemap from "../../common/stylemap"
  4. var app = getApp();
  5. Page(Object.assign({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. windowh: app.globalData.windowh
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. bindLog(this);
  17. try{
  18. var number = wx.getStorageSync("mobile");
  19. }catch(e){
  20. }
  21. if(!number){
  22. this.openLog();
  23. }else{
  24. this.getPhone(number);
  25. }
  26. this.setData(stylemap);
  27. },
  28. /**
  29. * 生命周期函数--监听页面初次渲染完成
  30. */
  31. onReady: function () {
  32. },
  33. /**
  34. * 生命周期函数--监听页面显示
  35. */
  36. onShow: function () {
  37. },
  38. /**
  39. * 生命周期函数--监听页面隐藏
  40. */
  41. onHide: function () {
  42. },
  43. /**
  44. * 生命周期函数--监听页面卸载
  45. */
  46. onUnload: function () {
  47. },
  48. /**
  49. * 页面相关事件处理函数--监听用户下拉动作
  50. */
  51. onPullDownRefresh: function () {
  52. },
  53. /**
  54. * 页面上拉触底事件的处理函数
  55. */
  56. onReachBottom: function () {
  57. },
  58. /**
  59. * 用户点击右上角分享
  60. */
  61. onShareAppMessage: function () {
  62. },
  63. checkLogin:function(){
  64. try{
  65. var number = wx.getStorageSync("mobile");
  66. }catch(e){
  67. }
  68. if(!number){
  69. this.openLog();
  70. }
  71. },
  72. getPhone:function(number){
  73. var numbers = number.split("");
  74. numbers.splice(3,4,"****");
  75. number = numbers.join("");
  76. this.setData({phonenumber:number});
  77. },
  78. closeLogBack:function(){
  79. var number = wx.getStorageSync("mobile");
  80. if(!number){
  81. wx.redirectTo({url:"../index/index"});
  82. }
  83. },
  84. loginback:function(){
  85. var number = wx.getStorageSync("mobile");
  86. this.getPhone(number);
  87. },
  88. logOut:function(){
  89. wx.removeStorageSync("mobile");
  90. wx.removeStorageSync("authorization");
  91. this.openLog();
  92. }
  93. },logs))