home.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. // console.log(res.data);
  48. that.setData({
  49. authenticationnum: res.data
  50. })
  51. }
  52. })
  53. // 会员状态
  54. let memberstatus_url = 'pay/recharge/memberstatus';
  55. let memberstatus_data = {
  56. };
  57. app.postRequest(memberstatus_url, memberstatus_data, function (res) {
  58. if (res.code == 201) {
  59. // console.log(res.data);
  60. that.setData({
  61. memberstatus: res.data.msg
  62. })
  63. }
  64. })
  65. },
  66. // 分享
  67. onShareAppMessage: function (res) {
  68. var that = this;
  69. var code = '';
  70. // getApp().showLoading(); //提示加载中
  71. // 头部信息
  72. let datum_url = 'my/other/share';
  73. let datum_data = {
  74. };
  75. app.postRequest(datum_url, datum_data, function (res) {
  76. if (res.code == 201) {
  77. console.log(res.data.code);
  78. that.setData({
  79. code: res.data.code,
  80. })
  81. }
  82. })
  83. if (res.from === 'button') {
  84. console.log("来自页面内转发按钮");
  85. console.log(res.target);
  86. }
  87. else {
  88. console.log("来自右上角转发菜单")
  89. }
  90. return {
  91. title: '妹子图片',
  92. // path: '/pages/share/share?code=' + _that.data.code + '',
  93. success: (res) => {
  94. console.log("转发成功", res);
  95. },
  96. fail: (res) => {
  97. console.log("转发失败", res);
  98. }
  99. }
  100. }
  101. })