mine.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // pages/mine/mine.ts
  2. import Dialog from '@vant/weapp/dialog/dialog';
  3. import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast';
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. // 功能菜单项
  10. menulists: [{id: 1, title: '我的库存', img: 'medal', path: '/mMine/pages/myinventorys/list/list'},
  11. {id: 2, title: "我的订单", img: 'invitation', path: '/mMine/pages/myorders/list/list'},
  12. {id: 3, title: '我的履约', img: 'underway', path: '/mMine/pages/myperformance/list/list'},
  13. {id: 4, title: '我的出境', img: 'hot', path: '/mHome/pages/inspection/list/list'},
  14. {id: 5, title: '我的保税', img: 'fire-o', path: '/mHome/pages/bond/list/list'}],
  15. // 列表菜单项
  16. tablelists: [{id: 1, title: '签约账户', path: '/mMine/pages/bank/bank'},
  17. {id: 2, title: '收货地址', path: '/mMine/pages/address/list/list'},
  18. {id: 3, title: '发票信息', path: '/mMine/pages/invoice/list/list'},
  19. {id: 4, title: '账户安全', path: '/mMine/pages/modifypwd/modifypwd'},
  20. {id: 5, title: '关于我们', path: '/mMine/pages/about/about/about'}],
  21. /// 微信头像
  22. avatarUrl: "",
  23. /// 微信昵称
  24. nickName: ""
  25. },
  26. /**
  27. * 按钮点击响应事件
  28. */
  29. onButtonPressed(e: any) {
  30. switch (e.target.id) {
  31. case 'into-gold': /// 充值
  32. wx.navigateTo({ url: '/mMine/pages/inoutgold/inoutgold' })
  33. break;
  34. case 'out-gold': /// 提现
  35. wx.navigateTo({ url: '/mMine/pages/inoutgold/inoutgold' })
  36. break;
  37. default:
  38. break;
  39. }
  40. },
  41. /**
  42. * 进入系统设置
  43. */
  44. goToSettings() {
  45. wx.navigateTo({
  46. url: '/mMine/pages/settings/settings'
  47. })
  48. },
  49. /**
  50. * 生命周期函数--监听页面加载
  51. */
  52. onLoad() {
  53. /// 获取微信头像
  54. let url = wx.getStorageSync('avatarUrl')
  55. if (url) {
  56. this.setData({
  57. avatarUrl: url
  58. })
  59. }
  60. },
  61. /**
  62. * 系统登出响应
  63. */
  64. onLoginOut() {
  65. Dialog.confirm({
  66. title: '提示',
  67. message: '确定要退出系统吗?',
  68. }).then(() => {
  69. /// 清楚所有的缓存数据
  70. wx.clearStorage()
  71. /// loding....
  72. Toast.loading('登出中....')
  73. /// 登出
  74. setTimeout(function () {
  75. Toast.clear()
  76. // on confirm
  77. wx.reLaunch({ url: '/pages/login/login' })
  78. }, 2000)
  79. }).catch(() => {
  80. // on cancel
  81. });
  82. },
  83. /**
  84. * 生命周期函数--监听页面初次渲染完成
  85. */
  86. onReady() {
  87. },
  88. /**
  89. * 生命周期函数--监听页面显示
  90. */
  91. onShow() {
  92. this.getTabBar().init()
  93. },
  94. /**
  95. * 生命周期函数--监听页面隐藏
  96. */
  97. onHide() {
  98. },
  99. /**
  100. * 生命周期函数--监听页面卸载
  101. */
  102. onUnload() {
  103. },
  104. /**
  105. * 页面相关事件处理函数--监听用户下拉动作
  106. */
  107. onPullDownRefresh() {
  108. },
  109. /**
  110. * 页面上拉触底事件的处理函数
  111. */
  112. onReachBottom() {
  113. },
  114. /**
  115. * 用户点击右上角分享
  116. */
  117. onShareAppMessage() {
  118. }
  119. })