import { Reports, Research, Report } from "@/config/api.js";
export default {
data() {
return {
confirmText: "知道了",
accounts: "",
isCancelBtn: false,
goFollowShow: false,
tabBarActive: 2,
dataList: [],
status: "loadmore",
loadText: {
loadmore: "上拉加载更多",
loading: "加载中",
nomore: "已经到底了",
},
page_no: 1,
pageSize: 10,
refresh: false, //正在下拉
};
},
methods: {
// tab bar 切换
tabBarSwitchHandel(item) {
this.tabBarActive = item.value;
this.page_no = 1;
this.getDataList();
},
//去往主题详情
themeDetails(item, source) {
uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId + "&pageRouter=" + source });
},
//关注
async isAttention(item, val) {
await this.$store.dispatch("showLoginModal");
const res =
val === "主题"
? await Reports.reportFllow({ IndustrialManagementId: item.IndustrialManagementId, PageRouter: this.$store.state.pageRouterReport })
: await Reports.reportFllowDepartment({ DepartmentId: item.DepartmentId, PageRouter: this.$store.state.pageRouterReport });
if (res.Ret === 200) {
item.IsFollw = !item.IsFollw;
if (res.Data.Status == 1) {
this.goFollowShow = true;
this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
if (res.Data.GoFollow) {
this.accounts = `${val == "主题" ? "产业" : "作者"}关注成功
想要及时获取该${val === "主题" ? "产业内容的更新推送" : "作者的报告更新提示"},请关注【查研观向小助手】公众号`;
this.isCancelBtn = true;
} else {
this.accounts = `${val == "主题" ? "产业" : "作者"}` + `关注成功
请关注【查研观向小助手】公众号,及时获取${val === "主题" ? "产业" : "作者"}报告更新提醒`;
}
} else {
uni.showToast({
title: "已取消关注",
icon: "none",
duration: 2000,
});
}
}
},
//去关注
goFollowShowBtn() {
if (this.confirmText == "去关注") {
uni.navigateTo({
url: "/activityPages/accountsOfficial/accountsOfficial",
});
}
this.goFollowShow = false;
},
},
onLoad() {
this.getDataList();
},
onReachBottom() {
if (this.status === "nomore") return;
this.status = "loading";
this.page_no++;
this.getDataList();
},
onPullDownRefresh() {
this.refresh = true;
this.dataList = [];
this.page_no = 1;
this.getDataList();
},
};