mixinsAuthorTheme.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { Reports, Research, Report } from "@/config/api.js";
  2. export default {
  3. data() {
  4. return {
  5. confirmText: "知道了",
  6. accounts: "",
  7. isCancelBtn: false,
  8. goFollowShow: false,
  9. tabBarActive: 2,
  10. dataList: [],
  11. status: "loadmore",
  12. loadText: {
  13. loadmore: "上拉加载更多",
  14. loading: "加载中",
  15. nomore: "已经到底了",
  16. },
  17. page_no: 1,
  18. pageSize: 10,
  19. refresh: false, //正在下拉
  20. };
  21. },
  22. methods: {
  23. // tab bar 切换
  24. tabBarSwitchHandel(item) {
  25. this.tabBarActive = item.value;
  26. this.page_no = 1;
  27. this.getDataList();
  28. },
  29. //去往主题详情
  30. themeDetails(item, source) {
  31. this.$store.dispatch("checkHandle", "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId + "&pageRouter=" + source);
  32. },
  33. //关注
  34. async isAttention(item, val) {
  35. const res =
  36. val === "主题"
  37. ? await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId, PageRouter: this.$store.state.pageRouterReport })
  38. : await Reports.reportFllowDepartment({ DepartmentId: item.DepartmentId, PageRouter: this.$store.state.pageRouterReport });
  39. if (res.Ret === 200) {
  40. item.IsFollw = !item.IsFollw;
  41. if (res.Data.Status == 1) {
  42. this.goFollowShow = true;
  43. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  44. if (res.Data.GoFollow) {
  45. this.accounts = `${val == "主题" ? "产业" : "作者"}关注成功 <br> 想要及时获取该${val === "主题" ? "产业内容的更新推送" : "作者的报告更新提示"},请关注【查研观向小助手】公众号`;
  46. this.isCancelBtn = true;
  47. } else {
  48. this.accounts = `${val == "主题" ? "产业" : "作者"}` + `关注成功<br>请关注【查研观向小助手】公众号,及时获取${val === "主题" ? "产业" : "作者"}报告更新提醒`;
  49. }
  50. } else {
  51. uni.showToast({
  52. title: "已取消关注",
  53. icon: "none",
  54. duration: 2000,
  55. });
  56. }
  57. }
  58. },
  59. //去关注
  60. goFollowShowBtn() {
  61. if (this.confirmText == "去关注") {
  62. uni.navigateTo({
  63. url: "/activityPages/accountsOfficial/accountsOfficial",
  64. });
  65. }
  66. this.goFollowShow = false;
  67. },
  68. },
  69. onLoad() {
  70. this.getDataList();
  71. },
  72. onReachBottom() {
  73. if (this.status === "nomore") return;
  74. this.status = "loading";
  75. this.page_no++;
  76. this.getDataList();
  77. },
  78. onPullDownRefresh() {
  79. this.refresh = true;
  80. this.dataList = [];
  81. this.page_no = 1;
  82. this.getDataList();
  83. },
  84. };