index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. if (this.data.active == true) {
  47. this.data.menuList.shift()
  48. this.setData({
  49. menuList:this.data.menuList
  50. })
  51. }
  52. },
  53. getBtnInfo() {
  54. this.setData({
  55. btnInfo: app.globalData.btnInfo
  56. })
  57. },
  58. toUrl(e){
  59. let url = e.currentTarget.dataset.url
  60. wx.navigateTo({
  61. url,
  62. })
  63. },
  64. getUserProfile(e) {
  65. // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
  66. // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
  67. wx.getUserProfile({
  68. desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  69. success: (res) => {
  70. this.setData({
  71. userInfo: res.userInfo,
  72. hasUserInfo: true
  73. })
  74. }
  75. })
  76. },
  77. getPhoneNumber (e){
  78. console.log(e)
  79. this.setData({
  80. code: e.detail.code,
  81. })
  82. }
  83. })