123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <template>
- <view class="container browseHistory-container">
- <view class="history-ul" v-if="haveData">
- <view class="global_card_content content-item" v-for="item in historyList" :key="item.ArticleId">
- <blok v-if="item.NickName">
- <view class="item-user" v-if="item.Source == 2">
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/user_report.png"></image>
- <text> {{ item.NickName }}</text>
- </view>
- </blok>
- <view class="item-title global_title">
- <text style="display: inline" @click="goDetailReport(item)">
- {{ item.Title }}
- </text>
- <text @click="themeDetails(item, val)" class="item-industry" v-for="val in item.List" :key="val.IndustrialManagementId"> # {{ val.IndustryName }} </text>
- </view>
- <view class="item-more">
- <text>{{ item.PublishDate }}</text>
- <view class="global_pv-ollect" v-if="item.Source == 2">
- <view>
- <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/examine_icon.png"></image>
- {{ item.Pv }}
- </view>
- <view @click="collectClick(item)">
- <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
- <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
- {{ item.CollectNum }}人收藏
- </view>
- </view>
- </view>
- </view>
- <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="10" margin-bottom="10" v-if="totalPage > 1" />
- </view>
- <view class="nodata" v-else>
- <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
- <text>暂时没有浏览历史</text>
- </view>
- <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
- <Loading />
- </view>
- </template>
- <script>
- import { Mine, Report } from "@/config/api.js";
- import { Throttle } from "@/config/util.js";
- import freeCharge from "@/components/freeCharge";
- export default {
- data() {
- return {
- status: "loadmore",
- totalPage: "",
- page_no: 1,
- pageSize: 10,
- haveData: null,
- refresh: false, //正在下拉
- historyList: [],
- loadText: {
- loadmore: "上拉加载更多",
- loading: "加载中",
- nomore: "已经到底了",
- },
- };
- },
- onLoad() {
- this.gethistoryList();
- },
- onShow() {
- this.$store.commit("setRouterReport", "足迹");
- },
- components: {
- freeCharge,
- },
- methods: {
- /* 获取列表 */
- gethistoryList() {
- Mine.getHistory({
- PageSize: this.pageSize,
- CurrentIndex: this.page_no,
- }).then((res) => {
- if (res.Ret === 200) {
- this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
- this.totalPage = res.Data.Paging.Pages; //总页数
- if (this.page_no === 1) {
- this.historyList = res.Data.List || [];
- this.haveData = this.historyList.length ? true : false;
- if (this.refresh) {
- uni.stopPullDownRefresh();
- this.refresh = false;
- }
- } else {
- this.historyList = this.historyList.concat(res.Data.List);
- }
- }
- });
- },
- // 去往文章详情页面
- goDetailReport(item) {
- uni.navigateTo({ url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId });
- },
- // 去往主题详情
- themeDetails(item, val) {
- if (item.Source === 1) {
- //非严选
- uni.navigateTo({ url: "/reportPages/IndustryReport/IndustryReport?id=" + val.IndustrialManagementId });
- } else {
- //严选
- uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + val.IndustrialManagementId + "&pageRouter=足迹" });
- }
- },
- // 收藏
- async collectClick(item) {
- const res = await Report.collectRpt({ ArticleId: item.ArticleId, PageRouter: this.$store.state.pageRouterReport });
- if (res.Ret === 200) {
- item.IsCollect = !item.IsCollect;
- item.IsCollect
- ? (item.CollectNum += 1) &&
- uni.showToast({
- title: "收藏成功",
- icon: "none",
- duration: 2000,
- })
- : (item.CollectNum -= 1);
- !item.IsCollect &&
- uni.showToast({
- title: "已取消收藏",
- icon: "none",
- duration: 2000,
- });
- }
- },
- },
- /* 触底 */
- onReachBottom: Throttle(function () {
- if (this.status === "nomore") return;
- this.status = "loading";
- this.page_no++;
- this.gethistoryList();
- }),
- /* 下拉刷新 */
- onPullDownRefresh: Throttle(function () {
- this.page_no = 1;
- this.refresh = true;
- this.gethistoryList();
- }),
- };
- </script>
- <style lang="scss" scoped>
- .browseHistory-container {
- background-color: $uni-bg-color;
- .history-ul {
- padding: 4rpx 30rpx;
- .content-item {
- background-color: #fff;
- margin-top: 20rpx;
- padding: 35rpx 20rpx 0;
- border-top: 4rpx solid #376cbb;
- .item-title {
- font-weight: 500;
- .item-industry {
- font-size: 28rpx;
- margin-left: 10rpx;
- color: $uni-color-new;
- display: inline-block;
- }
- }
- .item-user {
- display: flex;
- align-items: center;
- color: #999999;
- font-size: 28rpx;
- margin-bottom: 20rpx;
- image {
- width: 23rpx;
- height: 26rpx;
- margin-right: 20rpx;
- }
- }
- .item-more {
- display: flex;
- justify-content: space-between;
- color: #cecece;
- margin: 20rpx 0 0;
- padding-bottom: 30rpx;
- }
- }
- }
- }
- </style>
|