index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. pathList: [{
  8. name: "团队管理",
  9. icon: "icon-a-wodetuanduiguanli",
  10. color: "var(--assist)",
  11. path: "/pages/teams/index"
  12. }, {
  13. name: "修改登录密码",
  14. icon: "icon-a-wodeguanyuyingyong",
  15. color: "var(--warning)",
  16. path: "/pages/tabbar/mine/changePassword/index"
  17. }, {
  18. name: "绑定微信",
  19. icon: "icon-a-wodebangdingweixin",
  20. color: "var(--success)",
  21. path: "#"
  22. }]
  23. },
  24. /**
  25. * 生命周期函数--监听页面加载
  26. */
  27. onLoad(options) {
  28. this.queryUserMsg();
  29. },
  30. /* 查询用户信息 */
  31. queryUserMsg() {
  32. _Http.basic({
  33. "classname": "common.usercenter.usercenter",
  34. "method": "queryUserMsg",
  35. "content": {}
  36. }).then(res => {
  37. if (res.msg != '成功') return wx.showToast({
  38. title: res.data,
  39. icon: "none"
  40. })
  41. this.setData({
  42. userMsg: res.data
  43. })
  44. })
  45. },
  46. /**
  47. * 生命周期函数--监听页面初次渲染完成
  48. */
  49. onReady() {
  50. },
  51. /**
  52. * 生命周期函数--监听页面显示
  53. */
  54. onShow() {
  55. this.getTabBar().init();
  56. },
  57. /**
  58. * 生命周期函数--监听页面隐藏
  59. */
  60. onHide() {
  61. },
  62. /**
  63. * 生命周期函数--监听页面卸载
  64. */
  65. onUnload() {
  66. },
  67. /**
  68. * 页面相关事件处理函数--监听用户下拉动作
  69. */
  70. onPullDownRefresh() {
  71. },
  72. /**
  73. * 页面上拉触底事件的处理函数
  74. */
  75. onReachBottom() {
  76. },
  77. /**
  78. * 用户点击右上角分享
  79. */
  80. onShareAppMessage() {
  81. },
  82. /* 退出登录 */
  83. outLogin() {
  84. _Http.logout().then(res => {
  85. wx.showToast({
  86. title: '退出成功'
  87. });
  88. setTimeout(() => {
  89. wx.reLaunch({
  90. url: '/pages/login/index',
  91. })
  92. }, 300)
  93. })
  94. },
  95. /* 去修改用户信息 */
  96. toChangeUserMsg() {
  97. wx.navigateTo({
  98. url: './userMsg/index'
  99. })
  100. },
  101. listClick(e) {
  102. const {
  103. name
  104. } = e.currentTarget.dataset;
  105. console.log(name)
  106. if (name == '绑定微信') {
  107. wx.showModal({
  108. title: "提示",
  109. content: "是否使用当前微信绑定此账号?",
  110. success: res => {
  111. console.log(res)
  112. if (res.confirm) {
  113. wx.login({
  114. success(res) {
  115. if (res.code) _Http.basic({
  116. "classname": "common.usercenter.usercenter",
  117. "method": "WechatBinding",
  118. "content": {
  119. "wechat_code": res.code
  120. }
  121. }).then(res => {
  122. if (res.code == 0) return wx.showToast({
  123. title: res.msg,
  124. icon: "none"
  125. });
  126. wx.showToast({
  127. title: '绑定成功',
  128. })
  129. })
  130. }
  131. })
  132. }
  133. }
  134. })
  135. }
  136. }
  137. })