IndustryReport.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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. <!-- 其他tab -->
  25. <block v-show="tabAct_id!==99999">
  26. <view class="collect-ltem" v-for="(item, index) in collectList" :key="index" @click="goDetail(item, index)">
  27. <view class="item-left">
  28. <text class="title text_twoLine"
  29. >{{ item.Title }}
  30. <text class="reg-text" v-if="item.IsRed"></text>
  31. </text>
  32. <text class="text_twoLine desc">{{ item.PublishDate }}</text>
  33. </view>
  34. <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
  35. </view>
  36. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1&&tabAct_id!==99999" />
  37. </block>
  38. <!-- 时间线 -->
  39. <block v-if="tabAct_id===99999">
  40. <view class="time-line">
  41. <view class="line-item" v-for="(item,index) in timeLine" :key="index" @click="goDetailFromTimeLine(item, index)">
  42. <view class="time">{{item.date}}</view>
  43. <view class="content" v-if="item.Content.length">
  44. <rich-text class="rich-text" :data-index="index" :class="{'expand':item.isExpand}"
  45. :nodes="item.Content">
  46. </rich-text>
  47. <view class="expan-btn" :class="{'pos':!item.isExpand}" @click="handleExpand(item,index)" v-if="item.isShowBtn">{{item.isExpand?'收起':'展开'}}</view>
  48. </view>
  49. <view class="title" v-else>{{item.Title}}</view>
  50. </view>
  51. <view v-show="loadTimeLine" class="loadTimeLine"></view>
  52. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage > 1&&tabAct_id===99999" />
  53. </view>
  54. </block>
  55. </view>
  56. </view>
  57. <view class="nodata" v-else>
  58. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  59. <text>暂时没有报告的内容</text>
  60. </view>
  61. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree"/>
  62. </view>
  63. </template>
  64. <script>
  65. import { Mine } from "@/config/api.js"; //模拟
  66. import { Reports } from "@/config/api.js"; //模拟
  67. import { Throttle } from "@/config/util.js";
  68. import freeCharge from '@/components/freeCharge'
  69. let app = getApp({ allowDefault: true });
  70. export default {
  71. data() {
  72. return {
  73. tabAct_id: "",
  74. tabBars: [],
  75. industrialManagementId: "",
  76. layoutTime: "",
  77. refresh: false, //正在下拉
  78. page_no: 1,
  79. pageSize: 10,
  80. categoryId: "",
  81. collectList: [],
  82. isShow: false,
  83. haveData: true,
  84. status: "loadmore",
  85. loadText: {
  86. loadmore: "上拉加载更多",
  87. loading: "加载中",
  88. nomore: "已经到底了",
  89. },
  90. totalPage: "",
  91. toggleTabIndex: 0,
  92. titleReport: "",
  93. timeLine:[],//时间线数据
  94. mockTimeLine:[
  95. {
  96. date:'不重要',
  97. Content:'<p>hello,world</p><p>hello,world</p><p>hello,world</p>'
  98. },//第一项是为了获取当前手机下,三行是多少相对高度
  99. ],
  100. loadTimeLine:false,//时间线的遮罩
  101. };
  102. },
  103. onLoad(option) {
  104. this.industrialManagementId = option.id;
  105. this.tabAct_id = option.tab;
  106. this.toArticleCategoryList();
  107. },
  108. onShow() {
  109. this.$store.dispatch("statistics", { PageType: "IndustryList", IndustrialManagementId: this.industrialManagementId });
  110. },
  111. components: {
  112. freeCharge
  113. },
  114. watch: {
  115. //监听tabs的变化
  116. tabAct_id: {
  117. handler() {
  118. if (this.tabAct_id) {
  119. (this.page_no = 1), (this.collectList = []);
  120. this.getCollectList();
  121. }
  122. },
  123. immediate: true,
  124. },
  125. },
  126. methods: {
  127. //tabs切换事件
  128. toggleTab(item, index) {
  129. this.toggleTabIndex = index;
  130. if (this.tabAct_id !== item.CategoryId) {
  131. this.tabAct_id = item.CategoryId;
  132. this.pageNum = 1;
  133. this.timeLine=[]
  134. this.totalPage=""
  135. uni.pageScrollTo({
  136. scrollTop: 0,
  137. duration: 0,
  138. });
  139. }
  140. },
  141. toArticleCategoryList() {
  142. Reports.toArticleCategoryList({
  143. IndustrialManagementId: this.industrialManagementId,
  144. ShowTimeLine:1
  145. }).then((res) => {
  146. if (res.Ret == 200) {
  147. uni.setNavigationBarTitle({
  148. title: res.Data.IndustryName,
  149. });
  150. this.titleReport = res.Data.IndustryName;
  151. this.layoutTime = res.Data.LayoutTime;
  152. if (res.Data.List) {
  153. this.tabAct_id = res.Data.List[0].CategoryId;
  154. this.tabBars = res.Data.List;
  155. }
  156. }
  157. });
  158. },
  159. /* 获取列表 */
  160. getCollectList() {
  161. //just for test
  162. if(this.tabAct_id===99999) {
  163. this.loadTimeLine = true
  164. Reports.getArticleList({
  165. PageSize: this.pageSize,
  166. CurrentIndex: this.page_no,
  167. CategoryId: 99999,
  168. IndustrialManagementId: this.industrialManagementId,
  169. }).then((res)=>{
  170. if(res.Ret===200){
  171. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore"
  172. this.totalPage = res.Data.Paging.Pages
  173. let list = res.Data.List||[]
  174. list = list.map(item=>{
  175. let temp = item
  176. temp.date = item.PublishTime.split(" ")[0]
  177. if(item.Content.length){
  178. temp.isExpand = true
  179. temp.isShowBtn = true
  180. }
  181. return temp
  182. })
  183. if(this.page_no===1){
  184. this.timeLine = list
  185. this.haveData = this.timeLine.length ? true : false;
  186. if (this.refresh) {
  187. uni.stopPullDownRefresh();
  188. this.refresh = false;
  189. }
  190. }else{
  191. this.timeLine = this.timeLine.concat(list)
  192. }
  193. }
  194. this.timeLine.unshift(this.mockTimeLine[0])
  195. //在获取高度前把所有的晨会展开,收起的话无法获取正确高度
  196. this.timeLine.forEach(item=>{
  197. if(item.Content.length){
  198. item.isExpand = true
  199. item.isShowBtn = true
  200. }
  201. })
  202. setTimeout(()=>{
  203. this.getConentsHeight()
  204. },300)
  205. })
  206. return
  207. }
  208. Reports.getArticleList({
  209. PageSize: this.pageSize,
  210. CurrentIndex: this.page_no,
  211. CategoryId: this.tabAct_id,
  212. IndustrialManagementId: this.industrialManagementId,
  213. }).then((res) => {
  214. if (res.Ret === 200) {
  215. this.status = this.page_no < res.Data.Paging.Pages ? "loadmore" : "nomore";
  216. this.totalPage = res.Data.Paging.Pages; //总页数
  217. if (this.page_no === 1) {
  218. this.collectList = res.Data.List || [];
  219. this.haveData = this.collectList.length ? true : false;
  220. if (this.refresh) {
  221. uni.stopPullDownRefresh();
  222. this.refresh = false;
  223. }
  224. } else {
  225. this.collectList = this.collectList.concat(res.Data.List);
  226. }
  227. }
  228. });
  229. },
  230. async goDetail(item, index) {
  231. /* 无需授权且已绑定 检验是或否有权限 */
  232. if (index == 0) {
  233. this.tabBars[this.toggleTabIndex].IsRed = false;
  234. }
  235. this.collectList[index].IsRed = false;
  236. await this.$store.dispatch("checkHandle");
  237. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  238. // 已授权已绑定
  239. if (item.IsHaveVideo) {
  240. //跳转路演精华
  241. uni.navigateTo({
  242. url: "/reportPages/roadEssence/roadEssence?id=" + item.ArticleId,
  243. });
  244. } else {
  245. uni.navigateTo({
  246. url: "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId,
  247. });
  248. }
  249. }
  250. },
  251. //展开收起晨会内容
  252. handleExpand(item,index){
  253. item.isExpand = !item.isExpand
  254. this.timeLine.splice(index,1,item)
  255. },
  256. //获取所有晨会内容的高度并决定是否显示展开收起按钮
  257. getConentsHeight(){
  258. const query = wx.createSelectorQuery()
  259. query.selectAll(".rich-text").boundingClientRect()
  260. query.exec(res=>{
  261. //根据timeLine的第一项确定当前手机三行文字的高度
  262. const standardHeight = res[0][0].height
  263. res[0].forEach(item=>{
  264. let temp = this.timeLine[item.dataset.index]
  265. //超过这个高度的,需要显示展开/收起按钮
  266. if(item.height>standardHeight){
  267. temp.isExpand = false
  268. temp.isShowBtn = true
  269. }else{
  270. temp.isExpand = true
  271. temp.isShowBtn = false
  272. }
  273. })
  274. //然后把timeLine的第一项扔掉
  275. this.timeLine.shift()
  276. this.loadTimeLine = false
  277. })
  278. },
  279. async goDetailFromTimeLine(item, index){
  280. if(item.Content.length!==0) return;
  281. await this.$store.dispatch("checkHandle");
  282. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  283. // 已授权已绑定
  284. if (item.IsHaveVideo) {
  285. //跳转路演精华
  286. uni.navigateTo({
  287. url: "/reportPages/roadEssence/roadEssence?id=" + item.Id,
  288. });
  289. } else {
  290. uni.navigateTo({
  291. url: "/pageMy/reportDetail/reportDetail?id=" + item.Id,
  292. });
  293. }
  294. }
  295. }
  296. },
  297. /* 触底 */
  298. onReachBottom: Throttle(function () {
  299. if (this.status === "nomore") return;
  300. this.status = "loading";
  301. this.page_no++;
  302. if (this.tabAct_id) {
  303. this.getCollectList();
  304. }
  305. }),
  306. /* 下拉刷新 */
  307. onPullDownRefresh: Throttle(function () {
  308. if (this.tabAct_id) {
  309. this.page_no = 1;
  310. this.refresh = true;
  311. this.getCollectList();
  312. }
  313. }),
  314. /**
  315. * 用户点击分享
  316. */
  317. onShareAppMessage: function (res) {
  318. return {
  319. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.titleReport,
  320. path: "/reportPages/IndustryReport/IndustryReport?id=" + this.industrialManagementId + "&tab=" + this.tabAct_id,
  321. success: (res) => {},
  322. fail: (err) => {},
  323. };
  324. },
  325. };
  326. </script>
  327. <style lang="scss">
  328. .industry-content {
  329. background-color: #f7f7f7;
  330. // height: 100vh;
  331. .top-bg {
  332. position: fixed;
  333. top: 0;
  334. left: 0;
  335. width: 100%;
  336. z-index: 999;
  337. background-color: #d1ebff;
  338. height: 73rpx;
  339. color: #2c83ff;
  340. font-size: 24rpx;
  341. line-height: 73rpx;
  342. text-align: center;
  343. }
  344. .top-box {
  345. position: fixed;
  346. width: 100%;
  347. top: 73rpx;
  348. left: 0;
  349. z-index: 999;
  350. }
  351. .top-tab-cont {
  352. .lucency {
  353. position: absolute;
  354. top: 0;
  355. right: 0;
  356. width: 32px;
  357. height: 30px;
  358. opacity: 0.9;
  359. background-color: #fff;
  360. }
  361. .tab-cont {
  362. padding: retu;
  363. padding: 30rpx 26rpx 0;
  364. background-color: #fff;
  365. font-size: 32rpx;
  366. box-shadow: 0 3rpx 6rpx rgba(187, 216, 255, 0.2);
  367. .scroll-tab {
  368. width: 100%;
  369. white-space: nowrap;
  370. }
  371. .scroll-tab-item {
  372. // flex-grow: 1;
  373. text-align: center;
  374. display: inline-block;
  375. padding: 0rpx 8rpx 30rpx 8rpx;
  376. margin-right: 60rpx;
  377. border-bottom: 8rpx solid transparent;
  378. position: relative;
  379. &:last-child {
  380. margin-right: 0;
  381. }
  382. &.active {
  383. border-bottom: none;
  384. color: #2c83ff;
  385. font-weight: 700;
  386. }
  387. .border_act {
  388. width: 100%;
  389. height: 8rpx;
  390. position: absolute;
  391. bottom: 0;
  392. left: 0;
  393. }
  394. .reg-hint {
  395. position: absolute;
  396. top: 0rpx;
  397. right: -10rpx;
  398. width: 14rpx;
  399. height: 14rpx;
  400. background-color: #ff0000;
  401. border-radius: 50%;
  402. }
  403. }
  404. }
  405. }
  406. .collect-ul {
  407. // margin-top: 30rpx;s
  408. padding-top: 175rpx;
  409. // padding-top: 4rpx;
  410. .collect-ltem {
  411. display: flex;
  412. padding: 30rpx 34rpx;
  413. background: #fff;
  414. margin-bottom: 4rpx;
  415. align-items: center;
  416. justify-content: space-between;
  417. .title {
  418. position: relative;
  419. max-width: 625rpx;
  420. color: #4a4a4a;
  421. font-size: 34rpx;
  422. padding-left: 28rpx;
  423. .reg-text {
  424. position: absolute;
  425. top: 15rpx;
  426. left: 0rpx;
  427. width: 14rpx;
  428. height: 14rpx;
  429. background-color: #ff0000;
  430. border-radius: 50%;
  431. z-index: 9;
  432. }
  433. }
  434. .desc {
  435. margin-top: 17rpx;
  436. padding-left: 28rpx;
  437. width: 625rpx;
  438. color: #999;
  439. }
  440. }
  441. .time-line{
  442. margin-top:15rpx;
  443. padding:30rpx 40rpx 50rpx 40rpx;
  444. min-height: calc(100vh - 190rpx);
  445. background-color:#FFFFFF;
  446. position: relative;
  447. .loadTimeLine{
  448. top:0;bottom:0;left:0;right:0;
  449. position:absolute;
  450. background-color: #fff;
  451. z-index: 6;
  452. }
  453. .line-item{
  454. position:relative;
  455. padding:0 0 50rpx 40rpx;
  456. /* border-left:1rpx solid #DAE9FD; */
  457. &:last-child{
  458. padding-bottom: 0;
  459. &::after{
  460. height: calc(100% - 25rpx);
  461. }
  462. }
  463. &:first-child{
  464. .time{
  465. &::after{
  466. background-color: #3385FF;
  467. }
  468. }
  469. }
  470. &::before,&::after{
  471. position:absolute;
  472. content: "";
  473. }
  474. &::before{
  475. width:24rpx;
  476. height: 24rpx;
  477. background-color: #DAE9FD;
  478. z-index: 1;
  479. left:0;
  480. top:27rpx;
  481. transform: translate(-50%,-50%);
  482. border-radius: 50%;
  483. }
  484. &::after{
  485. top:17rpx;
  486. left:0;
  487. width:1rpx;
  488. height:calc(100%);
  489. background-color: #DAE9FD;
  490. z-index: 2;
  491. }
  492. .time{
  493. width:245rpx;
  494. height: 55rpx;
  495. text-align: center;
  496. line-height: 45rpx;
  497. padding:5rpx 20rpx;
  498. background-color: #F5F9FF;
  499. border-radius: 64rpx;
  500. color:#5181C9;
  501. font-size: 32rpx;
  502. margin-bottom:20rpx;
  503. position: relative;
  504. &::before,&::after{
  505. position:absolute;
  506. content: "";
  507. left:-36rpx;
  508. top:27rpx;
  509. width:24rpx;
  510. height:1rpx;
  511. background-color:#DAE9FD;
  512. z-index: 1;
  513. }
  514. &::after{
  515. left:-40rpx;
  516. top:27rpx;
  517. width:12rpx;
  518. height:12rpx;
  519. border-radius: 50%;
  520. transform: translate(-50%,-50%);
  521. background-color:#9DC5FF;
  522. z-index: 3;
  523. }
  524. }
  525. .content{
  526. color:#666666;
  527. position: relative;
  528. .rich-text{
  529. overflow: hidden;
  530. text-overflow: ellipsis;
  531. text-align: justify;
  532. display: -webkit-box;
  533. -webkit-line-clamp: 3;
  534. -webkit-box-orient: vertical;
  535. position: relative;
  536. &.expand{
  537. -webkit-line-clamp: 999;
  538. height: auto;
  539. }
  540. }
  541. .expan-btn{
  542. color:#2C83FF;
  543. text-align: right;
  544. &.pos{
  545. padding:0 0 0 20rpx;
  546. background-color: rgba(255, 255, 255, 0.882);
  547. position:absolute;
  548. right:0;
  549. bottom:0;
  550. }
  551. }
  552. }
  553. .title{
  554. color:#3385FF;
  555. }
  556. }
  557. }
  558. }
  559. }
  560. </style>