recruit.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. var app = getApp();
  2. var util = require('../../utils/util.js');
  3. var WxParse = require('../../wxParse/wxParse.js');
  4. var status = require('../../utils/index.js');
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function(options) {
  15. status.setNavBgColor();
  16. status.setGroupInfo().then((groupInfo) => {
  17. let commiss_diy_name = groupInfo && groupInfo.commiss_diy_name || '分销';
  18. wx.setNavigationBarTitle({
  19. title: `会员${commiss_diy_name}`,
  20. })
  21. });
  22. let that = this;
  23. if (!util.check_login()) {
  24. this.setData({
  25. needAuth: true
  26. })
  27. }
  28. app.util.request({
  29. url: 'entry/wxapp/index',
  30. data: {
  31. controller: 'distribution.get_instruct'
  32. },
  33. dataType: 'json',
  34. success: function(res) {
  35. if (res.data.code == 0) {
  36. let article = res.data.content || '';
  37. WxParse.wxParse('article', 'html', article, that, 5);
  38. }
  39. }
  40. })
  41. },
  42. /**
  43. * 授权成功回调
  44. */
  45. authSuccess: function() {
  46. this.setData({
  47. needAuth: false
  48. })
  49. },
  50. subCommis: function() {
  51. wx.showLoading();
  52. var token = wx.getStorageSync('token');
  53. let that = this;
  54. app.util.request({
  55. url: 'entry/wxapp/index',
  56. data: {
  57. controller: 'distribution.sub_commission_info',
  58. token
  59. },
  60. dataType: 'json',
  61. success: function (res) {
  62. wx.hideLoading();
  63. if (res.data.code == 0) {
  64. if (res.data.msg == "申请成功,平台将尽快审核"){
  65. wx.navigateTo({
  66. url: '/lionfish_comshop/pages/distribution/apply',
  67. })
  68. } else {
  69. wx.redirectTo({
  70. url: '/lionfish_comshop/pages/distribution/me',
  71. })
  72. }
  73. } else {
  74. if (res.data.msg=="请先登录"){
  75. that.setData({ needAuth: true })
  76. return;
  77. }
  78. if (res.data.msg == "您未填写表单!") {
  79. wx.navigateTo({
  80. url: '/lionfish_comshop/pages/distribution/apply',
  81. })
  82. return;
  83. }
  84. wx.showToast({
  85. title: res.data.msg ? res.data.msg:'申请失败,请重试!',
  86. icon: 'none'
  87. })
  88. }
  89. }
  90. })
  91. }
  92. })