index.js 965 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * 单次抽发奖活动
  3. */
  4. // @ts-nocheck
  5. import qs from 'qs';
  6. Component({
  7. data: {
  8. pluginAppId: '2021002191638959',
  9. pluginPageUrl: '/lucky-draw',
  10. pluginVersion: '*'
  11. },
  12. didMount() {
  13. this.loadPlugin();
  14. },
  15. methods: {
  16. loadPlugin() {
  17. const {
  18. pluginAppId,
  19. pluginPageUrl,
  20. pluginVersion
  21. } = this.data;
  22. let {
  23. query = {}
  24. } = my.getLaunchOptionsSync();
  25. const pageQuery = this.$page.data.query || {};
  26. query = { ...{
  27. activityId: this.props.componentData.componentExtInfo.activityId
  28. },
  29. ...query,
  30. ...pageQuery
  31. };
  32. my.loadPlugin({
  33. plugin: `${pluginAppId}@${pluginVersion}`,
  34. success: () => {
  35. const fmcg = query && qs.stringify(query) || '';
  36. my.reLaunch({
  37. url: `dynamic-plugin://${pluginAppId}${pluginPageUrl}${fmcg ? `?${fmcg}` : ''}`
  38. });
  39. }
  40. });
  41. }
  42. }
  43. });