industrialReport.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <!-- 季度策略 -->
  3. <view class="industrial-container">
  4. <view class="collect-ul" v-if="haveData">
  5. <view class="collect-ltem" v-for="(item,index) in collectList" :key="index" @click="goDetail(item,index)">
  6. <view class="item-left">
  7. <text class="title text_twoLine">{{item.Title}}
  8. <text class="reg-text" v-if="item.IsRed"></text>
  9. </text>
  10. <text class="text_twoLine desc">{{item.PublishDate}}</text>
  11. </view>
  12. <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
  13. </view>
  14. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage>1"/>
  15. </view>
  16. <view class="nodata" v-else>
  17. <image src="@/static/img/nodata.png" mode="" class="nodata_ico"></image>
  18. <text>暂时没有报告的内容</text>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import { Reports } from '@/config/api.js'
  24. import { Throttle } from '@/config/util.js'
  25. let app = getApp()
  26. export default {
  27. data() {
  28. return {
  29. refresh: false,//正在下拉
  30. page_no:1,
  31. pageSize:10,
  32. categoryId:null,
  33. collectList:[],
  34. haveData:true,
  35. status:'loadmore',
  36. loadText: {
  37. loadmore: '上拉加载更多',
  38. loading: '加载中',
  39. nomore: '已经到底了'
  40. },
  41. totalPage:'',
  42. titleReport:''
  43. };
  44. },
  45. onLoad(option) {
  46. this.categoryId= option.id-0
  47. this.getCollectList()
  48. },
  49. methods:{
  50. /* 获取列表 */
  51. getCollectList() {
  52. Reports.getTactics({
  53. PageSize: this.pageSize,
  54. CurrentIndex: this.page_no,
  55. CategoryId:this.categoryId
  56. }).then(res => {
  57. if(res.Ret === 200) {
  58. uni.setNavigationBarTitle({
  59. title: res.Data.MatchTypeName
  60. });
  61. this.titleReport=res.Data.MatchTypeName
  62. this.status = this.page_no < res.Data.Paging.Pages ? 'loadmore' : 'nomore';
  63. this.totalPage = res.Data.Paging.Pages;//总页数
  64. if(this.page_no === 1) {
  65. this.collectList = res.Data.List || [];
  66. this.haveData = this.collectList.length ? true : false
  67. if(this.refresh) {
  68. uni.stopPullDownRefresh();
  69. this.refresh = false;
  70. }
  71. }else {
  72. this.collectList = this.collectList.concat(res.Data.List)
  73. }
  74. }
  75. })
  76. },
  77. goDetail(item,index) {
  78. /* 无需授权且已绑定 检验是或否有权限 */
  79. this.collectList[index].IsRed=false
  80. this.$store.dispatch('checkHandle').then(res => {
  81. app.globalData.isAuth = res.IsAuth;
  82. app.globalData.isBind = res.IsBind;
  83. if((!res.IsAuth) && (!res.IsBind)) { // 已授权已绑定
  84. uni.navigateTo({
  85. url:'/pages/reportDetail/reportDetail?idReport=' + item.ArticleId,
  86. });
  87. }else if(res.IsAuth) { //未授权
  88. uni.navigateTo({
  89. url:'/pages/authGuide/authGuide'
  90. })
  91. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  92. uni.navigateTo({
  93. url:'/pages/login/login'
  94. })
  95. }
  96. })
  97. },
  98. },
  99. /* 触底 */
  100. onReachBottom: Throttle(function() {
  101. if(this.status === 'nomore') return ;
  102. this.status = 'loading';
  103. this.page_no++;
  104. this.getCollectList()
  105. }),
  106. /* 下拉刷新 */
  107. onPullDownRefresh: Throttle(function() {
  108. this.page_no = 1;
  109. this.refresh = true;
  110. this.getCollectList()
  111. }),
  112. /**
  113. * 用户点击分享
  114. */
  115. onShareAppMessage: function (res) {
  116. return {
  117. title: this.titleReport,
  118. path: '/pages/industrialReport/industrialReport?id='+this.categoryId,
  119. success: (res)=> {
  120. },
  121. fail: (err)=> {
  122. }
  123. }
  124. },
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. .industrial-container {
  129. background-color: #f6f6f6;
  130. .collect-ul {
  131. // margin-top: 30rpx;s
  132. padding-top: 4rpx;
  133. .collect-ltem {
  134. display: flex;
  135. padding: 30rpx 34rpx;
  136. background: #fff;
  137. margin-bottom: 4rpx;
  138. align-items: center;
  139. justify-content: space-between;
  140. .title {
  141. position: relative;
  142. max-width: 625rpx;
  143. color: #4A4A4A;
  144. font-size: 34rpx;
  145. padding-left: 28rpx;
  146. .reg-text {
  147. position: absolute;
  148. top: 15rpx;
  149. left:0rpx;
  150. width: 14rpx;
  151. height: 14rpx;
  152. background-color: #FF0000;
  153. border-radius: 50%;
  154. z-index: 9;
  155. }
  156. }
  157. .desc {
  158. margin-top: 17rpx;
  159. padding-left: 28rpx;
  160. width: 625rpx;
  161. color: #999;
  162. }
  163. }
  164. }
  165. }
  166. </style>