index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. const app = require('../../utils/util.js');
  2. const tool = require('../../utils/tool.js');
  3. Page({
  4. data: {
  5. currentIndex: 0,
  6. arr: [],
  7. arr1: [],
  8. isInfo: false,
  9. isTargetInfo: false
  10. },
  11. // 轮播
  12. handleChange: function (e) {
  13. this.setData({
  14. currentIndex: e.detail.current
  15. })
  16. },
  17. // 跳转活动详情页面
  18. goActive(e) {
  19. console.log(e)
  20. let id = e.currentTarget.dataset.id
  21. let openId = e.currentTarget.dataset.openid
  22. wx.navigateTo({
  23. url: '/pages/activeDetail/activeDetail?id=' + id + '&openId=' + openId,
  24. })
  25. },
  26. // 获取活动列表
  27. getActivies() {
  28. wx.request({
  29. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
  30. method: "get",
  31. data: {
  32. activeStatus: 0
  33. },
  34. success: (res) => {
  35. console.log(res)
  36. if (res.data.code == 0) {
  37. let arr1 = res.data.actives;
  38. wx.request({
  39. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/actives',
  40. method: "get",
  41. data: {
  42. activeStatus: 1
  43. },
  44. success: (res1) => {
  45. if (res1.data.code == 0) {
  46. this.setData({
  47. arr: arr1.concat(res1.data.actives)
  48. })
  49. wx.hideLoading();
  50. }
  51. }
  52. })
  53. }
  54. }
  55. })
  56. },
  57. //判断是否登录
  58. // 判断是否完善个人信息
  59. isFinishInfo() {
  60. wx.request({
  61. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/info',
  62. method: "get",
  63. success: (res) => {
  64. console.log(res)
  65. if (res.data.code == 0) {
  66. this.setData({
  67. isInfo: true
  68. })
  69. } else {
  70. this.setData({
  71. isInfo: false
  72. })
  73. }
  74. }
  75. })
  76. },
  77. //判断是否完善择偶信息
  78. isFinishTargetInfo() {
  79. wx.request({
  80. url: app.globalData.publicUrl + '/wx/member/' + this.data.openid + '/standard',
  81. method: "get",
  82. success: (res) => {
  83. console.log(res)
  84. if (res.data.code == 0) {
  85. this.setData({
  86. isTargetInfo: true
  87. })
  88. } else {
  89. this.setData({
  90. isTargetInfo: false
  91. })
  92. }
  93. }
  94. })
  95. },
  96. async onShow() {
  97. wx.showLoading({
  98. title: '加载中',
  99. })
  100. tool.openidStatus().then(result => {
  101. this.setData({
  102. openid: result[0],
  103. sessionkey: result[1]
  104. })
  105. this.getActivies();
  106. this.isFinishInfo();
  107. this.isFinishTargetInfo();
  108. })
  109. }
  110. })