qrcode.js 879 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const App = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. },
  8. /**
  9. * 生命周期函数--监听页面加载
  10. */
  11. onLoad: function(options) {
  12. },
  13. /**
  14. * 生命周期函数--监听页面显示
  15. */
  16. onShow: function() {
  17. // 获取推广二维码
  18. this.getPoster();
  19. },
  20. /**
  21. * 获取推广二维码
  22. */
  23. getPoster: function() {
  24. let _this = this;
  25. wx.showLoading({
  26. title: '加载中',
  27. });
  28. App._get('user.dealer.qrcode/poster', {}, function(result) {
  29. // 设置当前页面标题
  30. wx.setNavigationBarTitle({
  31. title: result.data.words.qrcode.title.value
  32. })
  33. _this.setData(result.data);
  34. }, null, function() {
  35. wx.hideLoading();
  36. });
  37. },
  38. previewImage: function() {
  39. wx.previewImage({
  40. current: this.data.qrcode,
  41. urls: [this.data.qrcode]
  42. })
  43. },
  44. })