home.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. const app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. datum: [], //头部信息
  8. headurl: [], //个人头像
  9. authenticationnum: [], //认证信息
  10. memberstatus:'', //会员状态
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onShow: function (options) {
  16. var that =this;
  17. // 头部信息
  18. let datum_url = 'my/personaldata/datum';
  19. let datum_data = {
  20. };
  21. app.postRequest(datum_url, datum_data, function (res) {
  22. if (res.code == 201) {
  23. // console.log(res.data);
  24. that.setData({
  25. datum: res.data
  26. })
  27. }
  28. })
  29. // 个人头像
  30. let headurl_url = 'my/images/headurl';
  31. let headurl_data = {
  32. };
  33. app.postRequest(headurl_url, headurl_data, function (res) {
  34. if (res.code == 201) {
  35. // console.log(res.data);
  36. that.setData({
  37. headurl: res.data
  38. })
  39. }
  40. })
  41. // 认证信息
  42. let authenticationnum_url = 'my/authentication/authenticationnum';
  43. let authenticationnum_data = {
  44. };
  45. app.postRequest(authenticationnum_url, authenticationnum_data, function (res) {
  46. if (res.code == 201) {
  47. that.setData({
  48. authenticationnum: res.data
  49. })
  50. }
  51. })
  52. // 会员状态
  53. let memberstatus_url = 'pay/recharge/memberstatus';
  54. let memberstatus_data = {
  55. };
  56. app.postRequest(memberstatus_url, memberstatus_data, function (res) {
  57. if (res.code == 201) {
  58. // console.log(res.data,6666);
  59. that.setData({
  60. memberstatus: res.data.messages
  61. })
  62. }
  63. })
  64. },
  65. // 分享
  66. onShareAppMessage: function (res) {
  67. var that = this;
  68. var code = '';
  69. // getApp().showLoading(); //提示加载中
  70. // 头部信息
  71. let datum_url = 'my/other/share';
  72. let datum_data = {
  73. };
  74. app.postRequest(datum_url, datum_data, function (res) {
  75. if (res.code == 201) {
  76. console.log(res.data.code);
  77. that.setData({
  78. code: res.data.code,
  79. })
  80. }
  81. })
  82. if (res.from === 'button') {
  83. console.log("来自页面内转发按钮");
  84. console.log(res.target);
  85. }
  86. else {
  87. console.log("来自右上角转发菜单")
  88. }
  89. return {
  90. title: 'jia',
  91. // path: '/pages/share/share?code=' + _that.data.code + '',
  92. success: (res) => {
  93. console.log("转发成功", res);
  94. },
  95. fail: (res) => {
  96. console.log("转发失败", res);
  97. }
  98. }
  99. }
  100. })