mixinsAuthorTheme.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId + "&pageRouter=" + source });
  32. },
  33. //关注
  34. async isAttention(item, val) {
  35. await this.$store.dispatch("showLoginModal");
  36. const res =
  37. val === "主题"
  38. ? await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId, PageRouter: this.$store.state.pageRouterReport })
  39. : await Reports.reportFllowDepartment({ DepartmentId: item.DepartmentId, PageRouter: this.$store.state.pageRouterReport });
  40. if (res.Ret === 200) {
  41. item.IsFollw = !item.IsFollw;
  42. if (res.Data.Status == 1) {
  43. this.goFollowShow = true;
  44. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  45. if (res.Data.GoFollow) {
  46. this.accounts = `${val == "主题" ? "产业" : "作者"}关注成功 <br> 想要及时获取该${val === "主题" ? "产业内容的更新推送" : "作者的报告更新提示"},请关注【查研观向小助手】公众号`;
  47. this.isCancelBtn = true;
  48. } else {
  49. this.accounts = `${val == "主题" ? "产业" : "作者"}` + `关注成功<br>请关注【查研观向小助手】公众号,及时获取${val === "主题" ? "产业" : "作者"}报告更新提醒`;
  50. }
  51. } else {
  52. uni.showToast({
  53. title: "已取消关注",
  54. icon: "none",
  55. duration: 2000,
  56. });
  57. }
  58. }
  59. },
  60. //去关注
  61. goFollowShowBtn() {
  62. if (this.confirmText == "去关注") {
  63. uni.navigateTo({
  64. url: "/activityPages/accountsOfficial/accountsOfficial",
  65. });
  66. }
  67. this.goFollowShow = false;
  68. },
  69. },
  70. onLoad() {
  71. this.getDataList();
  72. },
  73. onReachBottom() {
  74. if (this.status === "nomore") return;
  75. this.status = "loading";
  76. this.page_no++;
  77. this.getDataList();
  78. },
  79. onPullDownRefresh() {
  80. this.refresh = true;
  81. this.dataList = [];
  82. this.page_no = 1;
  83. this.getDataList();
  84. },
  85. };