IndustryReport.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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. pcTabActive: "",
  74. };
  75. },
  76. onLoad(option) {
  77. this.industrialManagementId = option.id;
  78. this.tabAct_id = option.tab;
  79. this.toArticleCategoryList();
  80. },
  81. onShow() {
  82. this.$store.dispatch("statistics", { PageType: "IndustryList", IndustrialManagementId: this.industrialManagementId });
  83. },
  84. components: {
  85. freeCharge,
  86. },
  87. watch: {
  88. //监听tabs的变化
  89. tabAct_id: {
  90. handler() {
  91. if (this.tabAct_id) {
  92. (this.page_no = 1), (this.collectList = []);
  93. this.getCollectList();
  94. }
  95. },
  96. immediate: true,
  97. },
  98. },
  99. methods: {
  100. //tabs切换事件
  101. toggleTab(item, index) {
  102. this.toggleTabIndex = index;
  103. if (this.tabAct_id !== item.CategoryId) {
  104. this.tabAct_id = item.CategoryId;
  105. this.pageNum = 1;
  106. uni.pageScrollTo({
  107. scrollTop: 0,
  108. duration: 0,
  109. });
  110. }
  111. },
  112. toArticleCategoryList() {
  113. Reports.toArticleCategoryList({
  114. IndustrialManagementId: this.industrialManagementId,
  115. }).then((res) => {
  116. if (res.Ret == 200) {
  117. uni.setNavigationBarTitle({
  118. title: res.Data.IndustryName,
  119. });
  120. this.titleReport = res.Data.IndustryName;
  121. this.layoutTime = res.Data.LayoutTime;
  122. if (res.Data.List) {
  123. this.tabAct_id = res.Data.List[0].CategoryId;
  124. this.tabBars = res.Data.List;
  125. }
  126. }
  127. });
  128. },
  129. /* 获取列表 */
  130. getCollectList() {
  131. Reports.getArticleList({
  132. PageSize: this.pageSize,
  133. CurrentIndex: this.page_no,
  134. CategoryId: this.tabAct_id,
  135. IndustrialManagementId: this.industrialManagementId,
  136. }).then((res) => {
  137. if (res.Ret === 200) {
  138. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  139. this.totalPage = res.Data.Paging.Pages; //总页数
  140. if (this.page_no === 1) {
  141. this.pcTabActive = res.Data.ChartPermissionId;
  142. this.collectList = res.Data.List || [];
  143. this.haveData = this.collectList.length ? true : false;
  144. if (this.refresh) {
  145. uni.stopPullDownRefresh();
  146. this.refresh = false;
  147. }
  148. } else {
  149. this.collectList = this.collectList.concat(res.Data.List);
  150. }
  151. }
  152. });
  153. },
  154. async goDetail(item, index) {
  155. /* 无需授权且已绑定 检验是或否有权限 */
  156. if (index == 0) {
  157. this.tabBars[this.toggleTabIndex].IsRed = false;
  158. }
  159. this.collectList[index].IsRed = false;
  160. await this.$store.dispatch("checkHandle");
  161. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  162. // 已授权已绑定
  163. if (item.IsHaveVideo) {
  164. //跳转路演精华
  165. uni.navigateTo({
  166. url: "/reportPages/roadEssence/roadEssence?id=" + item.ArticleId,
  167. });
  168. } else {
  169. uni.navigateTo({
  170. url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId,
  171. });
  172. }
  173. }
  174. },
  175. },
  176. /* 触底 */
  177. onReachBottom: Throttle(function () {
  178. if (this.status === "nomore") return;
  179. this.status = "loading";
  180. this.page_no++;
  181. if (this.tabAct_id) {
  182. this.getCollectList();
  183. }
  184. }),
  185. /* 下拉刷新 */
  186. onPullDownRefresh: Throttle(function () {
  187. if (this.tabAct_id) {
  188. this.page_no = 1;
  189. this.refresh = true;
  190. this.getCollectList();
  191. }
  192. }),
  193. /**
  194. * 用户点击分享
  195. */
  196. onShareAppMessage: function (res) {
  197. return {
  198. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.titleReport,
  199. path: "/reportPages/IndustryReport/IndustryReport?id=" + this.industrialManagementId + "&tab=" + this.tabAct_id + "&tabs=" + this.pcTabActive,
  200. success: (res) => {},
  201. fail: (err) => {},
  202. };
  203. },
  204. };
  205. </script>
  206. <style lang="scss">
  207. .industry-content {
  208. background-color: #f7f7f7;
  209. // height: 100vh;
  210. .top-bg {
  211. position: fixed;
  212. top: 0;
  213. left: 0;
  214. width: 100%;
  215. z-index: 999;
  216. background-color: #d1ebff;
  217. height: 73rpx;
  218. color: #2c83ff;
  219. font-size: 24rpx;
  220. line-height: 73rpx;
  221. text-align: center;
  222. }
  223. .top-box {
  224. position: fixed;
  225. width: 100%;
  226. top: 73rpx;
  227. left: 0;
  228. z-index: 999;
  229. }
  230. .top-tab-cont {
  231. .lucency {
  232. position: absolute;
  233. top: 0;
  234. right: 0;
  235. width: 32px;
  236. height: 30px;
  237. opacity: 0.9;
  238. background-color: #fff;
  239. }
  240. .tab-cont {
  241. padding: retu;
  242. padding: 30rpx 26rpx 0;
  243. background-color: #fff;
  244. font-size: 32rpx;
  245. box-shadow: 0 3rpx 6rpx rgba(187, 216, 255, 0.2);
  246. .scroll-tab {
  247. width: 100%;
  248. white-space: nowrap;
  249. }
  250. .scroll-tab-item {
  251. // flex-grow: 1;
  252. text-align: center;
  253. display: inline-block;
  254. padding: 0rpx 8rpx 30rpx 8rpx;
  255. margin-right: 60rpx;
  256. border-bottom: 8rpx solid transparent;
  257. position: relative;
  258. &:last-child {
  259. margin-right: 0;
  260. }
  261. &.active {
  262. border-bottom: none;
  263. color: #2c83ff;
  264. font-weight: 700;
  265. }
  266. .border_act {
  267. width: 100%;
  268. height: 8rpx;
  269. position: absolute;
  270. bottom: 0;
  271. left: 0;
  272. }
  273. .reg-hint {
  274. position: absolute;
  275. top: 0rpx;
  276. right: -10rpx;
  277. width: 14rpx;
  278. height: 14rpx;
  279. background-color: #ff0000;
  280. border-radius: 50%;
  281. }
  282. }
  283. }
  284. }
  285. .collect-ul {
  286. // margin-top: 30rpx;s
  287. padding-top: 175rpx;
  288. // padding-top: 4rpx;
  289. .collect-ltem {
  290. display: flex;
  291. padding: 30rpx 34rpx;
  292. background: #fff;
  293. margin-bottom: 4rpx;
  294. align-items: center;
  295. justify-content: space-between;
  296. .title {
  297. position: relative;
  298. max-width: 625rpx;
  299. color: #4a4a4a;
  300. font-size: 34rpx;
  301. padding-left: 28rpx;
  302. .reg-text {
  303. position: absolute;
  304. top: 15rpx;
  305. left: 0rpx;
  306. width: 14rpx;
  307. height: 14rpx;
  308. background-color: #ff0000;
  309. border-radius: 50%;
  310. z-index: 9;
  311. }
  312. }
  313. .desc {
  314. margin-top: 17rpx;
  315. padding-left: 28rpx;
  316. width: 625rpx;
  317. color: #999;
  318. }
  319. }
  320. }
  321. }
  322. </style>