industrialReport.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <!-- 季度策略 -->
  3. <view class="container 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.$store.dispatch("checkHandle",{type:'load',val:option}).then(res=>{
  47. this.categoryId= option.id-0
  48. this.getCollectList()
  49. })
  50. },
  51. onShow() {
  52. },
  53. methods:{
  54. /* 获取列表 */
  55. getCollectList() {
  56. Reports.getTactics({
  57. PageSize: this.pageSize,
  58. CurrentIndex: this.page_no,
  59. CategoryId:this.categoryId
  60. }).then(res => {
  61. if(res.Ret === 200) {
  62. uni.setNavigationBarTitle({
  63. title: res.Data.MatchTypeName
  64. });
  65. this.titleReport=res.Data.MatchTypeName
  66. this.status = this.page_no < res.Data.Paging.Pages ? 'loadmore' : 'nomore';
  67. this.totalPage = res.Data.Paging.Pages;//总页数
  68. if(this.page_no === 1) {
  69. this.collectList = res.Data.List || [];
  70. this.haveData = this.collectList.length ? true : false
  71. if(this.refresh) {
  72. uni.stopPullDownRefresh();
  73. this.refresh = false;
  74. }
  75. }else {
  76. this.collectList = this.collectList.concat(res.Data.List)
  77. }
  78. }
  79. })
  80. },
  81. goDetail(item,index) {
  82. /* 无需授权且已绑定 检验是或否有权限 */
  83. this.collectList[index].IsRed=false
  84. this.$store.dispatch('checkHandle').then(res => {
  85. app.globalData.isAuth = res.IsAuth;
  86. app.globalData.isBind = res.IsBind;
  87. if((!res.IsAuth) && (!res.IsBind)) { // 已授权已绑定
  88. uni.navigateTo({
  89. url:'/pages/reportDetail/reportDetail?idReport=' + item.ArticleId,
  90. });
  91. }else if(res.IsAuth) { //未授权
  92. uni.navigateTo({
  93. url:'/pages/authGuide/authGuide'
  94. })
  95. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  96. uni.navigateTo({
  97. url:'/pages/login/login'
  98. })
  99. }
  100. })
  101. },
  102. },
  103. /* 触底 */
  104. onReachBottom: Throttle(function() {
  105. if(this.status === 'nomore') return ;
  106. this.status = 'loading';
  107. this.page_no++;
  108. this.getCollectList()
  109. }),
  110. /* 下拉刷新 */
  111. onPullDownRefresh: Throttle(function() {
  112. this.page_no = 1;
  113. this.refresh = true;
  114. this.getCollectList()
  115. }),
  116. /**
  117. * 用户点击分享
  118. */
  119. onShareAppMessage: function (res) {
  120. return {
  121. title: this.titleReport,
  122. path: '/reportPages/industrialReport/industrialReport?id='+this.categoryId,
  123. success: (res)=> {
  124. },
  125. fail: (err)=> {
  126. }
  127. }
  128. },
  129. }
  130. </script>
  131. <style scoped lang="scss">
  132. .industrial-container {
  133. background-color: #f6f6f6;
  134. .collect-ul {
  135. // margin-top: 30rpx;s
  136. padding-top: 4rpx;
  137. .collect-ltem {
  138. display: flex;
  139. padding: 30rpx 34rpx;
  140. background: #fff;
  141. margin-bottom: 4rpx;
  142. align-items: center;
  143. justify-content: space-between;
  144. .title {
  145. position: relative;
  146. max-width: 625rpx;
  147. color: #4A4A4A;
  148. font-size: 34rpx;
  149. padding-left: 28rpx;
  150. .reg-text {
  151. position: absolute;
  152. top: 15rpx;
  153. left:0rpx;
  154. width: 14rpx;
  155. height: 14rpx;
  156. background-color: #FF0000;
  157. border-radius: 50%;
  158. z-index: 9;
  159. }
  160. }
  161. .desc {
  162. margin-top: 17rpx;
  163. padding-left: 28rpx;
  164. width: 625rpx;
  165. color: #999;
  166. }
  167. }
  168. }
  169. }
  170. </style>