IndustryReport.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <template>
  2. <view class="container industry-content" id="industry-content">
  3. <block v-if="haveData">
  4. <view class="is-track-follow" v-if="dataFollow.IsShowFollowButton">
  5. <is-track-follow :isShowFollowButton.sync="dataFollow.IsShowFollowButton" source="resources" :sourceId="industrialManagementId" :isFollowData.sync="dataFollow.IsFollowButton" />
  6. </view>
  7. <view class="top-video-content">
  8. <!-- 详情封面图 -->
  9. <image :src="industryVideo.DetailImgUrl" class="industry-video-poster" v-show="industryVideo.Id && industryVideo.DetailImgUrl && !havePlayed" @click="handelVideoPlay"></image>
  10. <!-- 视频 -->
  11. <video :src="industryVideo.ResourceUrl" class="industry-video" id="industry-video" v-show="industryVideo.ResourceUrl && (havePlayed || !industryVideo.DetailImgUrl)" controls></video>
  12. </view>
  13. <view class="title-tabs-content" :style="{ top: dataFollow.IsShowFollowButton ? '60rpx' : 0 }">
  14. <view class="top-bg-title">产业赛道布局于{{ layoutTime }}</view>
  15. <view class="tab-content">
  16. <block v-for="(item, index) in tabBars" :key="item.CategoryId">
  17. <view :id="'__' + index" class="scroll-tab-item" :class="{ active: tabAct_id == item.CategoryId }" @click.stop="toggleTab(item, index)">
  18. {{ item.MatchTypeName }}
  19. <text class="reg-text" v-if="item.IsRed"></text>
  20. </view>
  21. </block>
  22. </view>
  23. </view>
  24. <view class="collect-ul">
  25. <!-- 其他tab -->
  26. <block v-if="tabAct_id !== 99999">
  27. <view class="global_card_content collect-ltem" v-for="(item, index) in collectList" :key="index" @click="goDetail(item, index)">
  28. <view>
  29. <view class="item-left">
  30. <text class="title global_title text_twoLine">
  31. {{ item.Title }}
  32. <text class="reg-text" v-if="item.IsRed"></text>
  33. </text>
  34. </view>
  35. <view class="item-more">
  36. <text>{{ item.PublishDate }}</text>
  37. <view class="global_pv-ollect">
  38. <view>
  39. <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/examine_icon.png"></image>
  40. {{ item.Pv }}
  41. </view>
  42. <view @click.stop="collectClick(item)">
  43. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collect_act.png"></image>
  44. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collect_ico.png"></image>
  45. {{ item.CollectNum }}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
  51. </view>
  52. </block>
  53. <!-- 时间线 -->
  54. <block v-if="tabAct_id === 99999">
  55. <time-line ref="timeChild" :dataList="timeLine" @setRouter="setRouter" />
  56. </block>
  57. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1" />
  58. </view>
  59. </block>
  60. <view class="nodata" v-else>
  61. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  62. <text>暂时没有报告的内容</text>
  63. </view>
  64. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  65. <!-- 权限弹窗 -->
  66. <modalDialog :isShowhasPermission="isShowhasPermission" :applyForIsShow="applyForIsShow" :jurisdictionList="jurisdictionList" :hasPermission="hasPermission" />
  67. <Loading />
  68. </view>
  69. </template>
  70. <script>
  71. import { Mine, Home, Reports, Report } from "@/config/api.js";
  72. import freeCharge from "@/components/freeCharge";
  73. import modalDialog from "@/components/modalDialog.vue";
  74. import IsTrackFollow from "@/components/isTrackFollow.vue";
  75. import TimeLine from "@/components/report/timeLine.vue";
  76. export default {
  77. data() {
  78. return {
  79. tabAct_id: "",
  80. tabBars: [],
  81. industrialManagementId: "",
  82. layoutTime: "",
  83. refresh: false, //正在下拉
  84. page_no: 1,
  85. pageSize: 10,
  86. categoryId: "",
  87. collectList: [],
  88. isShow: false,
  89. haveData: true,
  90. status: "loadmore",
  91. loadText: {
  92. loadmore: "上拉加载更多",
  93. loading: "加载中",
  94. nomore: "已经到底了",
  95. },
  96. totalPage: "",
  97. toggleTabIndex: 0,
  98. titleReport: "",
  99. pcTabActive: "",
  100. industryVideo: {},
  101. authInfo: {},
  102. havePlayed: false,
  103. isShowhasPermission: false, // 联系销售的提交申请
  104. applyForIsShow: false, // 提交申请
  105. jurisdictionList: {},
  106. hasPermission: "", //权限
  107. timeLine: [], //时间线数据
  108. mockTimeLine: [
  109. {
  110. date: "不重要",
  111. Content: "<p>hello,world</p><p>hello,world</p><p>hello,world</p>",
  112. }, //第一项是为了获取当前手机下,三行是多少相对高度
  113. ],
  114. dataFollow: {},
  115. isSendWx: "",
  116. };
  117. },
  118. onLoad(option) {
  119. this.industrialManagementId = option.id;
  120. this.isSendWx = option.IsSendWx || "";
  121. this.tabAct_id = +option.tab || "";
  122. this.toArticleCategoryList();
  123. },
  124. onShow() {
  125. this.$store.dispatch("statistics", { PageType: "IndustryList", IndustrialManagementId: this.industrialManagementId });
  126. },
  127. components: {
  128. freeCharge,
  129. modalDialog,
  130. IsTrackFollow,
  131. TimeLine,
  132. },
  133. watch: {
  134. //监听tabs的变化
  135. tabAct_id: {
  136. handler(newVal) {
  137. if (newVal) {
  138. this.page_no = 1;
  139. this.collectList = [];
  140. this.getCollectList();
  141. }
  142. },
  143. immediate: true,
  144. },
  145. },
  146. methods: {
  147. //tabs切换事件
  148. toggleTab(item, index) {
  149. this.toggleTabIndex = index;
  150. if (this.tabAct_id !== item.CategoryId) {
  151. this.tabAct_id = item.CategoryId;
  152. this.pageNum = 1;
  153. this.timeLine = [];
  154. this.totalPage = "";
  155. uni.pageScrollTo({
  156. scrollTop: 0,
  157. duration: 0,
  158. });
  159. }
  160. },
  161. toArticleCategoryList() {
  162. Reports.toArticleCategoryList({
  163. IndustrialManagementId: this.industrialManagementId,
  164. ShowTimeLine: 1,
  165. PageRouter: this.$store.state.pageRouterReport,
  166. IsSendWx: this.isSendWx,
  167. }).then((res) => {
  168. if (res.Ret == 200) {
  169. uni.setNavigationBarTitle({
  170. title: res.Data.IndustryName,
  171. });
  172. this.dataFollow = res.Data;
  173. this.titleReport = res.Data.IndustryName;
  174. this.layoutTime = res.Data.LayoutTime;
  175. this.industryVideo = res.Data.IndustryVideo;
  176. this.authInfo = res.Data.AuthInfo;
  177. if (res.Data.List) {
  178. this.tabAct_id = res.Data.List[0].CategoryId;
  179. this.tabBars = res.Data.List;
  180. }
  181. }
  182. });
  183. },
  184. /* 获取列表 */
  185. getCollectList() {
  186. //just for test
  187. if (this.tabAct_id === 99999) {
  188. Reports.getArticleList({
  189. PageSize: this.pageSize,
  190. CurrentIndex: this.page_no,
  191. CategoryId: 99999,
  192. IndustrialManagementId: this.industrialManagementId,
  193. }).then((res) => {
  194. if (res.Ret === 200) {
  195. this.$refs.timeChild.loadTimeLine = true;
  196. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  197. this.totalPage = res.Data.Paging.Pages;
  198. let list = res.Data.List || [];
  199. list = list.map((item) => {
  200. let temp = item;
  201. temp.date = item.PublishTime.split(" ")[0];
  202. if (item.Content.length) {
  203. temp.isExpand = true;
  204. temp.isShowBtn = true;
  205. }
  206. return temp;
  207. });
  208. if (this.page_no === 1) {
  209. this.timeLine = list;
  210. this.haveData = this.timeLine.length ? true : false;
  211. if (this.refresh) {
  212. uni.stopPullDownRefresh();
  213. this.refresh = false;
  214. }
  215. } else {
  216. this.timeLine = this.timeLine.concat(list);
  217. }
  218. }
  219. this.timeLine.unshift(this.mockTimeLine[0]);
  220. //在获取高度前把所有的晨会展开,收起的话无法获取正确高度
  221. this.timeLine.forEach((item) => {
  222. if (item.Content.length) {
  223. item.isExpand = true;
  224. item.isShowBtn = true;
  225. }
  226. });
  227. setTimeout(() => {
  228. this.$refs.timeChild.getConentsHeight();
  229. }, 0);
  230. });
  231. return;
  232. }
  233. Reports.getArticleList({
  234. PageSize: this.pageSize,
  235. CurrentIndex: this.page_no,
  236. CategoryId: this.tabAct_id,
  237. IndustrialManagementId: this.industrialManagementId,
  238. }).then((res) => {
  239. if (res.Ret === 200) {
  240. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  241. this.totalPage = res.Data.Paging.Pages; //总页数
  242. if (this.page_no === 1) {
  243. this.pcTabActive = res.Data.ChartPermissionId;
  244. this.collectList = res.Data.List || [];
  245. this.haveData = this.collectList.length ? true : false;
  246. if (this.refresh) {
  247. uni.stopPullDownRefresh();
  248. this.refresh = false;
  249. }
  250. } else {
  251. this.collectList = this.collectList.concat(res.Data.List);
  252. }
  253. }
  254. });
  255. },
  256. async goDetail(item, index) {
  257. if (item.SubCategoryName === "路演精华") {
  258. //跳转路演精华
  259. uni.navigateTo({
  260. url: "/reportPages/roadEssence/roadEssence?id=" + item.ArticleId,
  261. });
  262. } else if (item.Resource === 2) {
  263. // 跳转产品内测详情
  264. uni.navigateTo({
  265. url: "/reportPages/internalDetials/internalDetials?id=" + item.ArticleId,
  266. });
  267. } else if (item.Resource === 1) {
  268. this.setRouter();
  269. uni.navigateTo({
  270. url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId,
  271. });
  272. }
  273. },
  274. // 视频播放权限判断
  275. async handelVideoPlay() {
  276. await this.$store.dispatch("showLoginModal");
  277. this.$store.commit("setRouterReport", "资源包详情页");
  278. if (this.authInfo.HasPermission == 1) {
  279. this.playVideo();
  280. } else {
  281. this.hasPermission = this.authInfo.HasPermission;
  282. this.jurisdictionList.ActivityId = this.industryVideo.Id;
  283. this.jurisdictionList.isAudioVideo = 3;
  284. if (this.hasPermission == 2) {
  285. this.jurisdictionList.SellerMobile = this.authInfo.SellerMobile;
  286. this.jurisdictionList.SellerName = this.authInfo.SellerName;
  287. this.jurisdictionList.PopupMsg = this.authInfo.PopupMsg;
  288. this.isShowhasPermission = true;
  289. } else if (this.hasPermission == 3 || this.hasPermission == 4 || this.hasPermission == 5) {
  290. this.jurisdictionList.PopupMsg = this.authInfo.PopupMsg;
  291. this.applyForIsShow = true;
  292. }
  293. }
  294. },
  295. // 播放视频
  296. playVideo() {
  297. const query = uni.createSelectorQuery().in(this);
  298. query
  299. .select("#industry-video")
  300. .context((data) => {
  301. data.context.play();
  302. this.handelVideoBindplay();
  303. setTimeout(() => {
  304. this.havePlayed = true;
  305. }, 10);
  306. })
  307. .exec();
  308. },
  309. //
  310. async handelVideoBindplay() {
  311. const res = await Home.microAideoHistoryAdd({ SourceId: this.industryVideo.Id, SourceType: this.industryVideo.Type, PageRouter: this.$store.state.pageRouterReport });
  312. },
  313. //展开收起晨会内容
  314. handleExpand(item, index) {
  315. this.getRecordTracking("展开收起", { Id: item.Id });
  316. item.isExpand = !item.isExpand;
  317. this.timeLine.splice(index, 1, item);
  318. },
  319. async goDetailFromTimeLine(item, index) {
  320. if (item.Content.length !== 0) return;
  321. // 已授权已绑定
  322. if (item.SubCategoryName === "路演精华") {
  323. //跳转路演精华
  324. uni.navigateTo({
  325. url: "/reportPages/roadEssence/roadEssence?id=" + item.Id,
  326. });
  327. } else {
  328. this.setRouter();
  329. uni.navigateTo({
  330. url: "/pageMy/reportDetail/reportDetail?id=" + item.Id,
  331. });
  332. }
  333. },
  334. getNode(content, isExpand) {
  335. return `<div style='-webkit-line-clamp: ${isExpand ? 9999 : 3};-webkit-box-orient: vertical;display: -webkit-box;overflow: hidden;text-overflow: ellipsis;'>${content}</div>`;
  336. },
  337. // 去往文章详情的
  338. setRouter() {
  339. this.tabBars.forEach((item) => {
  340. if (this.tabAct_id == item.CategoryId) {
  341. this.$store.commit("setRouterReport", item.MatchTypeName);
  342. }
  343. });
  344. },
  345. // 收藏
  346. async collectClick(item) {
  347. const res = await Report.collectRpt({ ArticleId: item.ArticleId, PageRouter: this.$store.state.pageRouterReport });
  348. if (res.Ret === 200) {
  349. item.IsCollect = !item.IsCollect;
  350. item.IsCollect
  351. ? (item.CollectNum += 1) &&
  352. uni.showToast({
  353. title: "收藏成功",
  354. icon: "none",
  355. duration: 2000,
  356. })
  357. : (item.CollectNum -= 1);
  358. !item.IsCollect &&
  359. uni.showToast({
  360. title: "已取消收藏",
  361. icon: "none",
  362. duration: 2000,
  363. });
  364. }
  365. },
  366. },
  367. /* 触底 */
  368. onReachBottom() {
  369. if (this.status === "nomore") return;
  370. this.status = "loading";
  371. this.page_no++;
  372. if (this.tabAct_id) {
  373. this.getCollectList();
  374. }
  375. },
  376. /* 下拉刷新 */
  377. onPullDownRefresh() {
  378. if (this.tabAct_id) {
  379. this.page_no = 1;
  380. this.refresh = true;
  381. this.getCollectList();
  382. }
  383. },
  384. /**
  385. * 用户点击分享
  386. */
  387. onShareAppMessage() {
  388. return {
  389. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.titleReport,
  390. path: "/reportPages/IndustryReport/IndustryReport?id=" + this.industrialManagementId + "&tab=" + this.tabAct_id + "&tabs=" + this.pcTabActive,
  391. };
  392. },
  393. };
  394. </script>
  395. <style lang="scss">
  396. .industry-content {
  397. background-color: $uni-bg-color;
  398. .top-video-content {
  399. width: 100%;
  400. background-color: white;
  401. text-align: center;
  402. .industry-video-poster {
  403. border-radius: 8rpx 8rpx 0 0;
  404. height: 340rpx;
  405. width: 728rpx;
  406. }
  407. .industry-video {
  408. height: 340rpx;
  409. width: 728rpx;
  410. }
  411. .test {
  412. position: relative;
  413. span {
  414. position: absolute;
  415. left: 30rpx;
  416. bottom: 30rpx;
  417. color: white;
  418. }
  419. }
  420. }
  421. .title-tabs-content {
  422. position: sticky;
  423. top: 60rpx;
  424. left: 0;
  425. z-index: 99;
  426. margin-bottom: 20rpx;
  427. .top-bg-title {
  428. height: 60rpx;
  429. color: $uni-color-new;
  430. background-color: #edf4ff;
  431. font-size: 24rpx;
  432. display: flex;
  433. align-items: center;
  434. justify-content: center;
  435. }
  436. .tab-content {
  437. width: 100%;
  438. background-color: #fff;
  439. display: flex;
  440. flex-wrap: wrap;
  441. padding: 30rpx 20rpx 0;
  442. .scroll-tab-item {
  443. position: relative;
  444. display: inline-block;
  445. height: 54rpx;
  446. line-height: 54rpx;
  447. padding: 0 23rpx;
  448. background: #f8f8fa;
  449. border-radius: 27px;
  450. color: #333;
  451. margin: 0rpx 20rpx 20rpx 0;
  452. .reg-text {
  453. position: absolute;
  454. top: -6rpx;
  455. right: -8rpx;
  456. width: 14rpx;
  457. height: 14rpx;
  458. background-color: #ff0000;
  459. border-radius: 50%;
  460. }
  461. }
  462. .active {
  463. color: $uni-color-new !important;
  464. background-color: #e5efff !important;
  465. font-weight: 600;
  466. }
  467. }
  468. }
  469. .collect-ul {
  470. padding-bottom: 50rpx;
  471. padding: 0 25rpx;
  472. .collect-ltem {
  473. display: flex;
  474. background: #fff;
  475. align-items: center;
  476. justify-content: space-between;
  477. margin-bottom: 20rpx;
  478. border-top: 4rpx solid $uni-color-new;
  479. .title {
  480. position: relative;
  481. max-width: 625rpx;
  482. color: #4a4a4a;
  483. font-size: 34rpx;
  484. padding-left: 28rpx;
  485. .reg-text {
  486. position: absolute;
  487. top: 15rpx;
  488. left: 0rpx;
  489. width: 14rpx;
  490. height: 14rpx;
  491. background-color: #ff0000;
  492. border-radius: 50%;
  493. z-index: 9;
  494. }
  495. }
  496. .item-more {
  497. width: 626rpx;
  498. padding: 0 10rpx 0 20rpx;
  499. display: flex;
  500. align-items: center;
  501. justify-content: space-between;
  502. color: #cecece;
  503. margin-top: 20rpx;
  504. }
  505. }
  506. }
  507. .is-track-follow {
  508. height: 60rpx;
  509. position: sticky;
  510. width: 100%;
  511. top: 0rpx;
  512. left: 0;
  513. z-index: 99;
  514. }
  515. }
  516. #industry-content {
  517. .industry-video-module {
  518. .global-video-box {
  519. .video-content {
  520. top: 400rpx !important;
  521. }
  522. .close-icon {
  523. top: 330rpx !important;
  524. }
  525. }
  526. }
  527. }
  528. .item-left {
  529. flex: 1;
  530. .item-more {
  531. padding-left: 20rpx;
  532. }
  533. }
  534. </style>