recommend.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. var util = require('../../utils/util.js');
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. qrcode: ''
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad: function (options) {
  14. if (!util.check_login()) {
  15. wx.switchTab({
  16. url: '/lionfish_comshop/pages/user/me',
  17. })
  18. }
  19. wx.showLoading();
  20. },
  21. getData(){
  22. var token = wx.getStorageSync('token');
  23. var that = this;
  24. app.util.request({
  25. 'url': 'entry/wxapp/user',
  26. 'data': {
  27. controller: 'community.get_community_zhitui_qrcode',
  28. token: token
  29. },
  30. dataType: 'json',
  31. success: function (res) {
  32. wx.hideLoading();
  33. if (res.data.code == 0) {
  34. that.setData({ qrcode: res.data.qrcode })
  35. } else {
  36. wx.switchTab({
  37. url: '/lionfish_comshop/pages/user/me',
  38. })
  39. }
  40. }
  41. })
  42. },
  43. /**
  44. * 生命周期函数--监听页面显示
  45. */
  46. onShow: function () {
  47. this.getData();
  48. }
  49. })