IndustryReport.vue 8.5 KB

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