index.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // pages/tabber/my/index.js
  2. const app =getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. btnInfo: null,
  9. menuList: [
  10. {
  11. icon: '/image/my/youhuiquan.png',
  12. text: '优惠券',
  13. url:'/pages/my/coupon/coupon'
  14. },
  15. {
  16. icon: '/image/my/fenxianghaoyou.png',
  17. text: '分享好友'
  18. }, {
  19. icon: '/image/my/dizhiguanli.png',
  20. text: '地址管理',
  21. url:'/pages/my/address/address'
  22. }, {
  23. icon: '/image/my/fuwuliucheng.png',
  24. text: '服务流程'
  25. }, {
  26. icon: '/image/my/yonghuxieyi.png',
  27. text: '用户协议'
  28. }, {
  29. icon: '/image/my/lipeixize.png',
  30. text: '理赔细则'
  31. }, {
  32. icon: '/image/my/kefurexian.png',
  33. text: '客服热线'
  34. }
  35. ],
  36. active: false,
  37. userInfo:"",
  38. hasUserInfo:false,
  39. code:""
  40. },
  41. /**
  42. * 生命周期函数--监听页面加载
  43. */
  44. onLoad: function (options) {
  45. this.getBtnInfo()
  46. this.setData({
  47. code:wx.getStorageSync('phone'),
  48. })
  49. if (this.data.active == true) {
  50. this.data.menuList.shift()
  51. this.setData({
  52. code:wx.getStorageSync('phone'),
  53. menuList:this.data.menuList
  54. })
  55. }
  56. },
  57. getBtnInfo() {
  58. this.setData({
  59. btnInfo: app.globalData.btnInfo
  60. })
  61. },
  62. toUrl(e){
  63. let url = e.currentTarget.dataset.url
  64. wx.navigateTo({
  65. url,
  66. })
  67. },
  68. getUserProfile(e) {
  69. // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
  70. // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
  71. wx.getUserProfile({
  72. desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  73. success: (res) => {
  74. this.setData({
  75. userInfo: res.userInfo,
  76. hasUserInfo: true
  77. })
  78. }
  79. })
  80. },
  81. getPhoneNumber (e){
  82. console.log(e)
  83. this.setData({
  84. code: e.detail.code,
  85. })
  86. }
  87. })