purchaser-report-list-mixins.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Reports, Research, Report, purchaserApi } from "@/config/api.js";
  2. export default {
  3. data() {
  4. return {};
  5. },
  6. methods: {
  7. //收藏
  8. async collectClick(item) {
  9. await this.$store.dispatch("showLoginModal");
  10. const res =
  11. item.IsSpecial == 1
  12. ? await purchaserApi.yanxuanSpecialCollect({
  13. Id: item.ArticleId,
  14. Status: item.IsCollect ? 2 : 1,
  15. })
  16. : await Report.collectRpt({ ArticleId: item.ArticleId, PageRouter: "月度收藏榜" });
  17. if (res.Ret === 200) {
  18. item.IsCollect = !item.IsCollect;
  19. item.IsCollect
  20. ? (item.CollectNum += 1) &&
  21. uni.showToast({
  22. title: "收藏成功",
  23. icon: "none",
  24. duration: 2000,
  25. })
  26. : (item.CollectNum -= 1);
  27. !item.IsCollect &&
  28. uni.showToast({
  29. title: "已取消收藏",
  30. icon: "none",
  31. duration: 2000,
  32. });
  33. }
  34. },
  35. //去往作者详情
  36. authorDetails(item) {
  37. if (item.IsSpecial == 1) {
  38. uni.navigateTo({ url: "/pages-purchaser/columnDetail/columnDetail?id=" + item.UserId });
  39. return;
  40. }
  41. uni.navigateTo({
  42. url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
  43. });
  44. },
  45. //去往文章详情页面
  46. goDetail(item) {
  47. if (item.IsSpecial == 1) {
  48. uni.navigateTo({ url: "/pages-purchaser/noteAndViewpoint/noteAndViewpoint?id=" + item.ArticleId });
  49. return;
  50. }
  51. this.$store.commit("setRouterReport", "月度收藏榜");
  52. uni.navigateTo({ url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId });
  53. },
  54. //去往主题详情
  55. themeDetails(item, source) {
  56. if (item.IsSpecial == 1) return;
  57. uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId + "&pageRouter=" + source });
  58. },
  59. },
  60. };