rule.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. var app = getApp();
  2. Page({
  3. onLoad: function (options) {
  4. let type = options.type || "";
  5. if (!type) {
  6. wx.showModal({
  7. title: '提示',
  8. content: '参数错误',
  9. showCancel: false,
  10. confirmColor: '#F75451',
  11. success(res) {
  12. if (res.confirm) {
  13. wx.navigateBack()
  14. }
  15. }
  16. })
  17. return false;
  18. }
  19. let navTitle = {
  20. vipcard: '权益规则',
  21. pintuan: '拼团规则',
  22. signin: '活动规则',
  23. solitaire: '接龙规则',
  24. pintuanRebate: '拼团返利规则',
  25. }
  26. wx.setNavigationBarTitle({
  27. title: navTitle[type] || '规则'
  28. })
  29. wx.showLoading();
  30. this.getData(type);
  31. },
  32. getData: function (type) {
  33. wx.showLoading();
  34. let urls = {
  35. vipcard: 'vipcard.get_vipcard_baseinfo',
  36. pintuan: 'group.pintuan_slides',
  37. signin: 'signinreward.get_signinreward_baseinfo',
  38. solitaire: 'solitaire.get_rule',
  39. pintuanRebate: 'group.pintuan_slides'
  40. }
  41. var token = wx.getStorageSync('token');
  42. let that = this;
  43. app.util.request({
  44. url: 'entry/wxapp/user',
  45. data: {
  46. controller: urls[type],
  47. token: token
  48. },
  49. dataType: 'json',
  50. success: function (res) {
  51. wx.hideLoading();
  52. if (res.data.code == 0) {
  53. let article = '';
  54. if (type == 'vipcard') {
  55. let { vipcard_buy_pagenotice } = res.data.data;
  56. article = vipcard_buy_pagenotice;
  57. } else if (type == 'pintuan') {
  58. let { pintuan_publish } = res.data;
  59. article = pintuan_publish;
  60. } else if (type == 'signin') {
  61. let { signinreward_pagenotice } = res.data.data;
  62. article = signinreward_pagenotice;
  63. } else if (type == 'solitaire') {
  64. let { solitaire_notice } = res.data;
  65. article = solitaire_notice;
  66. } else if (type == 'pintuanRebate') {
  67. let { pintuan_rebate_publish } = res.data;
  68. article = pintuan_rebate_publish;
  69. }
  70. that.setData({ article })
  71. }
  72. }
  73. })
  74. }
  75. })