share_invite.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const util = require("../../../utils/util.js");
  2. const qrcode = require('../../../utils/qrcode.js');
  3. import { base64src } from '../../../utils/base64src.js';
  4. const app = getApp();
  5. Page({
  6. data: {
  7. invitecode:'',
  8. islogin:false,
  9. invitePrice: util.config.invitePrice
  10. },
  11. onLoad(invitecode) {
  12. if (util.isEmpty(invitecode)){
  13. util.showTips("分享的页面不正确,缺少参数。");
  14. return false;
  15. }
  16. let that = this;
  17. invitecode['nickname'] = decodeURIComponent(invitecode['nickname']);
  18. invitecode['commentContent'] = decodeURIComponent(invitecode['commentContent']);
  19. invitecode['commentSource'] = decodeURIComponent(invitecode['commentSource']);
  20. if (invitecode.code) {
  21. wx.setStorageSync("WX-invite", invitecode.code);
  22. }
  23. if (!util.isEmpty(invitecode.avatar)) {
  24. wx.downloadFile({
  25. url: util.config.apiServer + "file.do?url=" + invitecode.avatar, // 仅为示例,并非真实的资源
  26. success(ret) {
  27. if (ret.statusCode === 200) {
  28. invitecode.avatar = ret.tempFilePath;
  29. }
  30. that.setData({ invitecode, islogin: !util.isObjEmpty(app.globalData.userInfo) });
  31. }
  32. });
  33. }else{
  34. userInfo.avatar = "/images/default_logo.jpg";
  35. this.setData({ invitecode, islogin: !util.isObjEmpty(app.globalData.userInfo) });
  36. }
  37. }
  38. })