IndustryReport.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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:null,
  55. tabBars: [],
  56. industrialManagementId:null,
  57. layoutTime:'',
  58. refresh: false,//正在下拉
  59. page_no:1,
  60. pageSize:10,
  61. categoryId:null,
  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. uni.navigateTo({
  167. url:'/pages/reportDetail/reportDetail?idReport=' + item.ArticleId,
  168. // url:'/pages/landscape/landscape?id=' + item.ArticleId,
  169. });
  170. }else if(res.IsAuth) { //未授权
  171. uni.navigateTo({
  172. url:'/pages/authGuide/authGuide'
  173. })
  174. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  175. uni.navigateTo({
  176. url:'/pages/login/login'
  177. })
  178. }
  179. })
  180. }
  181. },
  182. /* 触底 */
  183. onReachBottom: Throttle(function() {
  184. if(this.status === 'nomore') return ;
  185. this.status = 'loading';
  186. this.page_no++;
  187. if(this.tabAct_id){
  188. this.getCollectList()
  189. }
  190. }),
  191. /* 下拉刷新 */
  192. onPullDownRefresh: Throttle(function() {
  193. if(this.tabAct_id){
  194. this.page_no = 1;
  195. this.refresh = true;
  196. this.getCollectList()
  197. }
  198. }),
  199. /**
  200. * 用户点击分享
  201. */
  202. onShareAppMessage: function (res) {
  203. return {
  204. title: this.titleReport,
  205. path: '/reportPages/IndustryReport/IndustryReport?id='+this.industrialManagementId+'&tab='+this.tabAct_id,
  206. success: (res)=> {
  207. },
  208. fail: (err)=> {
  209. }
  210. }
  211. },
  212. }
  213. </script>
  214. <style lang="scss">
  215. .industry-content {
  216. background-color: #F7F7F7;
  217. // height: 100vh;
  218. .top-bg {
  219. position: fixed;
  220. top: 0;
  221. left: 0;
  222. width: 100%;
  223. z-index: 999;
  224. background-color: #D1EBFF;
  225. height: 73rpx;
  226. color: #2C83FF;
  227. font-size: 24rpx;
  228. line-height: 73rpx;
  229. text-align: center;
  230. }
  231. .top-box {
  232. position: fixed;
  233. width: 100%;
  234. top: 73rpx;
  235. left: 0;
  236. z-index: 999;}
  237. .top-tab-cont{
  238. .lucency{
  239. position: absolute;
  240. top: 0;
  241. right: 0;
  242. width: 32px;
  243. height: 30px;
  244. opacity:0.9;
  245. background-color: #fff;
  246. }
  247. .tab-cont {
  248. padding: retu;
  249. padding: 30rpx 26rpx 0;
  250. background-color: #fff;
  251. font-size: 32rpx;
  252. box-shadow: 0 3rpx 6rpx rgba(187,216,255,0.2);
  253. .scroll-tab {
  254. width: 100%;
  255. white-space: nowrap;
  256. }
  257. .scroll-tab-item {
  258. // flex-grow: 1;
  259. text-align: center;
  260. display: inline-block;
  261. padding: 0rpx 8rpx 30rpx 8rpx;
  262. margin-right: 60rpx;
  263. border-bottom: 8rpx solid transparent;
  264. position: relative;
  265. &:last-child {
  266. margin-right: 0;
  267. }
  268. &.active {
  269. border-bottom: none;
  270. color: #2C83FF;
  271. font-weight: 700;
  272. }
  273. .border_act {
  274. width: 100%;
  275. height: 8rpx;
  276. position: absolute;
  277. bottom: 0;
  278. left: 0;
  279. }
  280. .reg-hint {
  281. position: absolute;
  282. top: 0rpx;
  283. right: -10rpx;
  284. width: 14rpx;
  285. height: 14rpx;
  286. background-color: #FF0000;
  287. border-radius: 50%;
  288. }
  289. }
  290. }
  291. }
  292. .collect-ul {
  293. // margin-top: 30rpx;s
  294. padding-top: 175rpx;
  295. // padding-top: 4rpx;
  296. .collect-ltem {
  297. display: flex;
  298. padding: 30rpx 34rpx;
  299. background: #fff;
  300. margin-bottom: 4rpx;
  301. align-items: center;
  302. justify-content: space-between;
  303. .title {
  304. position: relative;
  305. max-width: 625rpx;
  306. color: #4A4A4A;
  307. font-size: 34rpx;
  308. padding-left: 28rpx;
  309. .reg-text {
  310. position: absolute;
  311. top: 15rpx;
  312. left:0rpx;
  313. width: 14rpx;
  314. height: 14rpx;
  315. background-color: #FF0000;
  316. border-radius: 50%;
  317. z-index: 9;
  318. }
  319. }
  320. .desc {
  321. margin-top: 17rpx;
  322. padding-left: 28rpx;
  323. width: 625rpx;
  324. color: #999;
  325. }
  326. }
  327. }
  328. }
  329. </style>