education-card.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // module/article/components/science-card/science-card.ts
  2. // import { HOST } from "../../../../app.config";
  3. import { Get } from "../../../../lib/request/method";
  4. Component({
  5. properties: {
  6. item: { type: Object, value: {} },
  7. index: { type: Number, value: 0 },
  8. replace: { type: Boolean, value: false },
  9. },
  10. data: {},
  11. methods: {
  12. async toInfoPage(event: WechatMiniprogram.TouchEvent) {
  13. const id = event.currentTarget.id;
  14. if (this.data.replace) {
  15. wx.redirectTo({
  16. url: `/module/article/pages/science-info/science-info?id=${id}`,
  17. });
  18. } else {
  19. const id = event.currentTarget.id;
  20. // const url = `https://${HOST}/admin/editor/preview.html?popularScienceArticleId=${id}`;
  21. try {
  22. const res = await Get(`/psarticle/clickPsaNotice`, {
  23. params: { noticeSendRecordId: id },
  24. });
  25. const url = res?.data;
  26. const item = {
  27. url,
  28. };
  29. wx.navigateTo({
  30. url: `/module/article/pages/science-info/science-info`,
  31. }).then((res) => {
  32. res.eventChannel.emit("load", item);
  33. });
  34. } catch (error) {
  35. console.log(error);
  36. }
  37. // wx.navigateTo({ url: `/module/article/pages/science-info/science-info?id=${id}` })
  38. // .then(res => { res.eventChannel.emit('load', this.data.item) })
  39. }
  40. },
  41. },
  42. });