IndustryReport.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view class="container industry-content">
  3. <view v-if="haveData">
  4. <view class="content-top">
  5. <view class="top-bg">产业赛道布局于{{ layoutTime }}</view>
  6. <view class="top-box">
  7. <view class="top-tab-cont">
  8. <view class="tab-cont">
  9. <scroll-view scroll-x="true" scroll-with-animation class="scroll-tab" :scroll-into-view="'_' + tabIndex">
  10. <block v-for="(item, index) in tabBars" :key="item.CategoryId">
  11. <view :id="'_' + index" class="scroll-tab-item" :class="{ active: tabAct_id == item.CategoryId }" @click.stop="toggleTab(item, index)">
  12. {{ item.MatchTypeName }}
  13. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/border_act.png" mode="" class="border_act" v-if="tabAct_id == item.CategoryId"></image>
  14. <text class="reg-hint" v-if="item.IsRed"></text>
  15. </view>
  16. </block>
  17. </scroll-view>
  18. </view>
  19. <view class="lucency" v-if="tabBars.length > 6"></view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="collect-ul">
  24. <view class="collect-ltem" v-for="(item, index) in collectList" :key="index" @click="goDetail(item, index)">
  25. <view class="item-left">
  26. <text class="title text_twoLine"
  27. >{{ item.Title }}
  28. <text class="reg-text" v-if="item.IsRed"></text>
  29. </text>
  30. <text class="text_twoLine desc">{{ item.PublishDate }}</text>
  31. </view>
  32. <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
  33. </view>
  34. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1" />
  35. </view>
  36. </view>
  37. <view class="nodata" v-else>
  38. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  39. <text>暂时没有报告的内容</text>
  40. </view>
  41. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree"/>
  42. </view>
  43. </template>
  44. <script>
  45. import { Mine } from "@/config/api.js"; //模拟
  46. import { Reports } from "@/config/api.js"; //模拟
  47. import { Throttle } from "@/config/util.js";
  48. import freeCharge from '@/components/freeCharge'
  49. let app = getApp({ allowDefault: true });
  50. export default {
  51. data() {
  52. return {
  53. tabAct_id: "",
  54. tabBars: [],
  55. industrialManagementId: "",
  56. layoutTime: "",
  57. refresh: false, //正在下拉
  58. page_no: 1,
  59. pageSize: 10,
  60. categoryId: "",
  61. collectList: [],
  62. isShow: false,
  63. haveData: true,
  64. status: "loadmore",
  65. loadText: {
  66. loadmore: "上拉加载更多",
  67. loading: "加载中",
  68. nomore: "已经到底了",
  69. },
  70. totalPage: "",
  71. toggleTabIndex: 0,
  72. titleReport: "",
  73. };
  74. },
  75. onLoad(option) {
  76. this.industrialManagementId = option.id;
  77. this.tabAct_id = option.tab;
  78. this.toArticleCategoryList();
  79. },
  80. onShow() {
  81. this.$store.dispatch("statistics", { PageType: "IndustryList", IndustrialManagementId: this.industrialManagementId });
  82. },
  83. components: {
  84. freeCharge
  85. },
  86. watch: {
  87. //监听tabs的变化
  88. tabAct_id: {
  89. handler() {
  90. if (this.tabAct_id) {
  91. (this.page_no = 1), (this.collectList = []);
  92. this.getCollectList();
  93. }
  94. },
  95. immediate: true,
  96. },
  97. },
  98. methods: {
  99. //tabs切换事件
  100. toggleTab(item, index) {
  101. this.toggleTabIndex = index;
  102. if (this.tabAct_id !== item.CategoryId) {
  103. this.tabAct_id = item.CategoryId;
  104. this.pageNum = 1;
  105. uni.pageScrollTo({
  106. scrollTop: 0,
  107. duration: 0,
  108. });
  109. }
  110. },
  111. toArticleCategoryList() {
  112. Reports.toArticleCategoryList({
  113. IndustrialManagementId: this.industrialManagementId,
  114. }).then((res) => {
  115. if (res.Ret == 200) {
  116. uni.setNavigationBarTitle({
  117. title: res.Data.IndustryName,
  118. });
  119. this.titleReport = res.Data.IndustryName;
  120. this.layoutTime = res.Data.LayoutTime;
  121. if (res.Data.List) {
  122. this.tabAct_id = res.Data.List[0].CategoryId;
  123. this.tabBars = res.Data.List;
  124. }
  125. }
  126. });
  127. },
  128. /* 获取列表 */
  129. getCollectList() {
  130. Reports.getArticleList({
  131. PageSize: this.pageSize,
  132. CurrentIndex: this.page_no,
  133. CategoryId: this.tabAct_id,
  134. IndustrialManagementId: this.industrialManagementId,
  135. }).then((res) => {
  136. if (res.Ret === 200) {
  137. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  138. this.totalPage = res.Data.Paging.Pages; //总页数
  139. if (this.page_no === 1) {
  140. this.collectList = res.Data.List || [];
  141. this.haveData = this.collectList.length ? true : false;
  142. if (this.refresh) {
  143. uni.stopPullDownRefresh();
  144. this.refresh = false;
  145. }
  146. } else {
  147. this.collectList = this.collectList.concat(res.Data.List);
  148. }
  149. }
  150. });
  151. },
  152. async goDetail(item, index) {
  153. /* 无需授权且已绑定 检验是或否有权限 */
  154. if (index == 0) {
  155. this.tabBars[this.toggleTabIndex].IsRed = false;
  156. }
  157. this.collectList[index].IsRed = false;
  158. await this.$store.dispatch("checkHandle");
  159. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  160. // 已授权已绑定
  161. if (item.IsHaveVideo) {
  162. //跳转路演精华
  163. uni.navigateTo({
  164. url: "/reportPages/roadEssence/roadEssence?id=" + item.ArticleId,
  165. });
  166. } else {
  167. uni.navigateTo({
  168. url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId,
  169. });
  170. }
  171. }
  172. },
  173. },
  174. /* 触底 */
  175. onReachBottom: Throttle(function () {
  176. if (this.status === "nomore") return;
  177. this.status = "loading";
  178. this.page_no++;
  179. if (this.tabAct_id) {
  180. this.getCollectList();
  181. }
  182. }),
  183. /* 下拉刷新 */
  184. onPullDownRefresh: Throttle(function () {
  185. if (this.tabAct_id) {
  186. this.page_no = 1;
  187. this.refresh = true;
  188. this.getCollectList();
  189. }
  190. }),
  191. /**
  192. * 用户点击分享
  193. */
  194. onShareAppMessage: function (res) {
  195. return {
  196. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.titleReport,
  197. path: "/reportPages/IndustryReport/IndustryReport?id=" + this.industrialManagementId + "&tab=" + this.tabAct_id,
  198. success: (res) => {},
  199. fail: (err) => {},
  200. };
  201. },
  202. };
  203. </script>
  204. <style lang="scss">
  205. .industry-content {
  206. background-color: #f7f7f7;
  207. // height: 100vh;
  208. .top-bg {
  209. position: fixed;
  210. top: 0;
  211. left: 0;
  212. width: 100%;
  213. z-index: 999;
  214. background-color: #d1ebff;
  215. height: 73rpx;
  216. color: #2c83ff;
  217. font-size: 24rpx;
  218. line-height: 73rpx;
  219. text-align: center;
  220. }
  221. .top-box {
  222. position: fixed;
  223. width: 100%;
  224. top: 73rpx;
  225. left: 0;
  226. z-index: 999;
  227. }
  228. .top-tab-cont {
  229. .lucency {
  230. position: absolute;
  231. top: 0;
  232. right: 0;
  233. width: 32px;
  234. height: 30px;
  235. opacity: 0.9;
  236. background-color: #fff;
  237. }
  238. .tab-cont {
  239. padding: retu;
  240. padding: 30rpx 26rpx 0;
  241. background-color: #fff;
  242. font-size: 32rpx;
  243. box-shadow: 0 3rpx 6rpx rgba(187, 216, 255, 0.2);
  244. .scroll-tab {
  245. width: 100%;
  246. white-space: nowrap;
  247. }
  248. .scroll-tab-item {
  249. // flex-grow: 1;
  250. text-align: center;
  251. display: inline-block;
  252. padding: 0rpx 8rpx 30rpx 8rpx;
  253. margin-right: 60rpx;
  254. border-bottom: 8rpx solid transparent;
  255. position: relative;
  256. &:last-child {
  257. margin-right: 0;
  258. }
  259. &.active {
  260. border-bottom: none;
  261. color: #2c83ff;
  262. font-weight: 700;
  263. }
  264. .border_act {
  265. width: 100%;
  266. height: 8rpx;
  267. position: absolute;
  268. bottom: 0;
  269. left: 0;
  270. }
  271. .reg-hint {
  272. position: absolute;
  273. top: 0rpx;
  274. right: -10rpx;
  275. width: 14rpx;
  276. height: 14rpx;
  277. background-color: #ff0000;
  278. border-radius: 50%;
  279. }
  280. }
  281. }
  282. }
  283. .collect-ul {
  284. // margin-top: 30rpx;s
  285. padding-top: 175rpx;
  286. // padding-top: 4rpx;
  287. .collect-ltem {
  288. display: flex;
  289. padding: 30rpx 34rpx;
  290. background: #fff;
  291. margin-bottom: 4rpx;
  292. align-items: center;
  293. justify-content: space-between;
  294. .title {
  295. position: relative;
  296. max-width: 625rpx;
  297. color: #4a4a4a;
  298. font-size: 34rpx;
  299. padding-left: 28rpx;
  300. .reg-text {
  301. position: absolute;
  302. top: 15rpx;
  303. left: 0rpx;
  304. width: 14rpx;
  305. height: 14rpx;
  306. background-color: #ff0000;
  307. border-radius: 50%;
  308. z-index: 9;
  309. }
  310. }
  311. .desc {
  312. margin-top: 17rpx;
  313. padding-left: 28rpx;
  314. width: 625rpx;
  315. color: #999;
  316. }
  317. }
  318. }
  319. }
  320. </style>