waterfall-card.ts 1018 B

12345678910111213141516171819202122232425262728293031323334
  1. // module/article/components/waterfall-card/waterfall-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. // const url = `https://${HOST}/admin/editor/preview.html?popularScienceArticleId=${id}`;
  15. try {
  16. const res = await Get(`/psarticle/clickPsarticle`, {
  17. params: { popularScienceArticleId: id },
  18. });
  19. const url = res?.data;
  20. const item = {
  21. url,
  22. };
  23. wx.navigateTo({
  24. url: `/module/article/pages/science-info/science-info`,
  25. }).then((res) => {
  26. res.eventChannel.emit("load", item);
  27. });
  28. } catch (error) {
  29. console.log(error);
  30. }
  31. },
  32. },
  33. });