index.js 865 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * 营销广告展位
  3. */
  4. // @ts-nocheck
  5. import qs from 'qs';
  6. Component({
  7. data: {
  8. pluginAppId: '2021002191638959',
  9. pluginPageUrl: '/group-coupon',
  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 = { ...query,
  27. ...pageQuery
  28. };
  29. my.loadPlugin({
  30. plugin: `${pluginAppId}@${pluginVersion}`,
  31. success: () => {
  32. const fmcg = query && qs.stringify(query) || '';
  33. my.reLaunch({
  34. url: `dynamic-plugin://${pluginAppId}${pluginPageUrl}${fmcg ? `?${fmcg}` : ''}`
  35. });
  36. }
  37. });
  38. }
  39. }
  40. });