IndustryReport.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="industry-content">
  3. <view v-if="haveDatas">
  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:null,
  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.toArticleCategoryList()
  80. },
  81. watch:{
  82. //监听tabs的变化
  83. tabAct_id: {
  84. handler() {
  85. if(this.tabAct_id){
  86. this.page_no=1,
  87. this.collectList=[]
  88. this.getCollectList()
  89. }
  90. },
  91. immediate:true
  92. }
  93. },
  94. methods:{
  95. //tabs切换事件
  96. toggleTab (item,index) {
  97. this.toggleTabIndex=index
  98. if(this.tabAct_id !== item.CategoryId) {
  99. this.tabAct_id = item.CategoryId;
  100. this.pageNum = 1;
  101. uni.pageScrollTo({
  102. scrollTop: 0,
  103. duration: 0,
  104. });
  105. }
  106. },
  107. toArticleCategoryList(){
  108. Reports.toArticleCategoryList({
  109. IndustrialManagementId:this.industrialManagementId
  110. }).then(res=>{
  111. if(res.Ret==200){
  112. uni.setNavigationBarTitle({
  113. title: res.Data.IndustryName
  114. });
  115. this.titleReport=res.Data.IndustryName
  116. this.layoutTime=res.Data.LayoutTime
  117. if(res.Data.List){
  118. this.tabAct_id=res.Data.List[0].CategoryId
  119. this.tabBars=res.Data.List
  120. }else {
  121. this.haveDatas=false
  122. }
  123. }
  124. })
  125. },
  126. /* 获取列表 */
  127. getCollectList() {
  128. Reports.getArticleList({
  129. PageSize: this.pageSize,
  130. CurrentIndex: this.page_no,
  131. CategoryId:this.tabAct_id,
  132. IndustrialManagementId:this.industrialManagementId
  133. }).then(res => {
  134. if(res.Ret === 200) {
  135. this.status = this.page_no < res.Data.Paging.Pages ? 'loadmore' : 'nomore';
  136. this.totalPage = res.Data.Paging.Pages;//总页数
  137. if(this.page_no === 1) {
  138. this.collectList = res.Data.List || [];
  139. this.haveData = this.collectList.length ? true : false
  140. if(this.refresh) {
  141. uni.stopPullDownRefresh();
  142. this.refresh = false;
  143. }
  144. }else {
  145. this.collectList = this.collectList.concat(res.Data.List)
  146. }
  147. }
  148. })
  149. },
  150. goDetail(item,index) {
  151. /* 无需授权且已绑定 检验是或否有权限 */
  152. if(index==0) {
  153. this.tabBars[this.toggleTabIndex].IsRed=false
  154. }
  155. this.collectList[index].IsRed=false
  156. this.$store.dispatch('checkHandle').then(res => {
  157. app.globalData.isAuth = res.IsAuth;
  158. app.globalData.isBind = res.IsBind;
  159. if((!res.IsAuth) && (!res.IsBind)) { // 已授权已绑定
  160. uni.navigateTo({
  161. url:'/pages/reportDetail/reportDetail?idReport=' + item.ArticleId,
  162. // url:'/pages/landscape/landscape?id=' + item.ArticleId,
  163. });
  164. }else if(res.IsAuth) { //未授权
  165. uni.navigateTo({
  166. url:'/pages/authGuide/authGuide'
  167. })
  168. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  169. uni.navigateTo({
  170. url:'/pages/login/login'
  171. })
  172. }
  173. })
  174. }
  175. },
  176. /* 触底 */
  177. onReachBottom: Throttle(function() {
  178. if(this.status === 'nomore') return ;
  179. this.status = 'loading';
  180. this.page_no++;
  181. this.getCollectList()
  182. }),
  183. /* 下拉刷新 */
  184. onPullDownRefresh: Throttle(function() {
  185. this.page_no = 1;
  186. this.refresh = true;
  187. this.getCollectList()
  188. }),
  189. onBackPress () {
  190. console.log(123000000000000)
  191. },
  192. /**
  193. * 用户点击分享
  194. */
  195. onShareAppMessage: function (res) {
  196. console.log(this.industrialManagementId)
  197. return {
  198. title: this.titleReport,
  199. path: '/pages/IndustryReport/IndustryReport?id='+this.industrialManagementId,
  200. success: (res)=> {
  201. },
  202. fail: (err)=> {
  203. }
  204. }
  205. },
  206. }
  207. </script>
  208. <style lang="scss">
  209. .industry-content {
  210. background-color: #F7F7F7;
  211. // height: 100vh;
  212. .top-bg {
  213. position: fixed;
  214. top: 0;
  215. left: 0;
  216. width: 100%;
  217. z-index: 999;
  218. background-color: #D1EBFF;
  219. height: 73rpx;
  220. color: #2C83FF;
  221. font-size: 24rpx;
  222. line-height: 73rpx;
  223. text-align: center;
  224. }
  225. .top-box {
  226. position: fixed;
  227. width: 100%;
  228. top: 73rpx;
  229. left: 0;
  230. z-index: 999;}
  231. .top-tab-cont{
  232. .lucency{
  233. position: absolute;
  234. top: 0;
  235. right: 0;
  236. width: 32px;
  237. height: 30px;
  238. opacity:0.9;
  239. background-color: #fff;
  240. }
  241. .tab-cont {
  242. padding: retu;
  243. padding: 30rpx 26rpx 0;
  244. background-color: #fff;
  245. font-size: 32rpx;
  246. box-shadow: 0 3rpx 6rpx rgba(187,216,255,0.2);
  247. .scroll-tab {
  248. width: 100%;
  249. white-space: nowrap;
  250. }
  251. .scroll-tab-item {
  252. // flex-grow: 1;
  253. text-align: center;
  254. display: inline-block;
  255. padding: 0rpx 8rpx 30rpx 8rpx;
  256. margin-right: 60rpx;
  257. border-bottom: 8rpx solid transparent;
  258. position: relative;
  259. &:last-child {
  260. margin-right: 0;
  261. }
  262. &.active {
  263. border-bottom: none;
  264. color: #2C83FF;
  265. font-weight: 700;
  266. }
  267. .border_act {
  268. width: 100%;
  269. height: 8rpx;
  270. position: absolute;
  271. bottom: 0;
  272. left: 0;
  273. }
  274. .reg-hint {
  275. position: absolute;
  276. top: 0rpx;
  277. right: -10rpx;
  278. width: 14rpx;
  279. height: 14rpx;
  280. background-color: #FF0000;
  281. border-radius: 50%;
  282. }
  283. }
  284. }
  285. }
  286. .collect-ul {
  287. // margin-top: 30rpx;s
  288. padding-top: 175rpx;
  289. // padding-top: 4rpx;
  290. .collect-ltem {
  291. display: flex;
  292. padding: 30rpx 34rpx;
  293. background: #fff;
  294. margin-bottom: 4rpx;
  295. align-items: center;
  296. justify-content: space-between;
  297. .title {
  298. position: relative;
  299. max-width: 625rpx;
  300. color: #4A4A4A;
  301. font-size: 34rpx;
  302. padding-left: 28rpx;
  303. .reg-text {
  304. position: absolute;
  305. top: 15rpx;
  306. left:0rpx;
  307. width: 14rpx;
  308. height: 14rpx;
  309. background-color: #FF0000;
  310. border-radius: 50%;
  311. z-index: 9;
  312. }
  313. }
  314. .desc {
  315. margin-top: 17rpx;
  316. padding-left: 28rpx;
  317. width: 625rpx;
  318. color: #999;
  319. }
  320. }
  321. }
  322. }
  323. </style>