IndustryReport.vue 8.7 KB

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