shareMaster.js 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const util = require("../../../utils/util");
  2. const api = require('../../../api/api.js');
  3. Page({
  4. data: {
  5. rid:'',
  6. },
  7. onLoad(options) {
  8. if(options.rid){
  9. this.setData({
  10. rid:options.rid
  11. });
  12. }
  13. wx.showShareMenu({
  14. withShareTicket: true,
  15. menus: ['shareAppMessage', 'shareTimeline']
  16. })
  17. },
  18. onShareAppMessage: function () {
  19. let rid=this.data.rid;
  20. const promise =new Promise( resolve=> util.request(api.recordZzyShare, {
  21. userId: rid
  22. }, 'GET').then(res=>{
  23. console.log(res);
  24. if (res.errno === 0) {
  25. resolve({
  26. title: '鲸致生活,欢迎您的加入!',
  27. path: '/pages/upgrade/joinMaster/joinMaster?scene=rid%2C'+rid,
  28. imageUrl:'https://jzmall.lifejingzhi.com/file/wx-servant/share-card.jpg'
  29. })
  30. }
  31. })
  32. );
  33. return {
  34. // title: '立即加入',
  35. // path: '/pages/upgrade/joinMaster/joinMaster?scene=rid%2C'+rid,
  36. promise
  37. }
  38. },
  39. })