usercenter.js 2.0 KB

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