secretDetails.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="container container-secret">
  3. <view class="collect-ul" v-if="haveData">
  4. <view class="collect-ltem" v-for="(item,index) in collectList" :key="index" @click="goDetail(item,index)">
  5. <view class="item-left">
  6. <text class="title text_twoLine">{{item.Title}}
  7. <text class="reg-text" v-if="item.IsRed"></text>
  8. </text>
  9. <view class="abstract">{{item.Abstract}}</view>
  10. <view class="desc">
  11. <text class="publishDate">{{item.PublishDate}}</text>
  12. </view>
  13. </view>
  14. <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
  15. </view>
  16. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage>1" />
  17. </view>
  18. <view class="nodata" v-else>
  19. <image src="@/static/img/nodata.png" mode="" class="nodata_ico"></image>
  20. <text>暂时没有报告的内容</text>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import { Reports} from '@/config/api.js'
  26. import { Throttle} from '@/config/util.js'
  27. let app = getApp()
  28. export default {
  29. data() {
  30. return {
  31. isType: '',
  32. refresh: false, //正在下拉
  33. page_no: 1,
  34. pageSize: 10,
  35. collectList: [],
  36. haveData: true,
  37. totalPage:'',
  38. status: 'loadmore',
  39. loadText: {
  40. loadmore: '上拉加载更多',
  41. loading: '加载中',
  42. nomore: '已经到底了'
  43. },
  44. }
  45. },
  46. methods: {
  47. async getList() {
  48. const res = await Reports.reportListByType({
  49. PageSize: this.pageSize,
  50. CurrentIndex: this.page_no,
  51. ReportType: this.isType
  52. })
  53. if (res.Ret == 200) {
  54. this.status = this.page_no < res.Data.Paging.Pages ? 'loadmore' : 'nomore';
  55. this.totalPage = res.Data.Paging.Pages; //总页数
  56. if (this.page_no === 1) {
  57. this.collectList = res.Data.List || [];
  58. this.haveData = this.collectList.length ? true : false
  59. if (this.refresh) {
  60. uni.stopPullDownRefresh();
  61. this.refresh = false;
  62. }
  63. } else {
  64. this.collectList = this.collectList.concat(res.Data.List)
  65. }
  66. }
  67. console.log(res);
  68. },
  69. goDetail(item,index){
  70. /* 无需授权且已绑定 检验是或否有权限 */
  71. this.collectList[index].IsRed=false
  72. this.$store.dispatch('checkHandle').then(res => {
  73. app.globalData.isAuth = res.IsAuth;
  74. app.globalData.isBind = res.IsBind;
  75. if((!res.IsAuth) && (!res.IsBind)) { // 已授权已绑定
  76. uni.navigateTo({
  77. url:'/reportPages/reportSecretDetail/reportSecretDetail?type=' + this.isType + '&id='+item.ArticleId
  78. });
  79. }else if(res.IsAuth) { //未授权
  80. uni.navigateTo({
  81. url:'/pages/authGuide/authGuide'
  82. })
  83. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  84. uni.navigateTo({
  85. url:'/pages/login/login'
  86. })
  87. }
  88. })
  89. }
  90. },
  91. onLoad(option) {
  92. this.$store.dispatch("checkHandle", {
  93. type: 'load',
  94. val: option
  95. }).then(res => {
  96. this.isType = option.type
  97. this.isType == 1 ? uni.hideShareMenu() : ''
  98. uni.setNavigationBarTitle({
  99. title:this.isType==1 ? '报告精选' : this.isType==2 ? '本周研究汇总' : '上周纪要汇总'
  100. })
  101. this.getList()
  102. })
  103. },
  104. /* 触底 */
  105. onReachBottom: Throttle(function() {
  106. if (this.status === 'nomore') return;
  107. this.status = 'loading';
  108. this.page_no++;
  109. this.getList()
  110. }),
  111. /* 下拉刷新 */
  112. onPullDownRefresh: Throttle(function() {
  113. this.page_no = 1;
  114. this.refresh = true;
  115. this.getList()
  116. }),
  117. onShareAppMessage(res){
  118. return {
  119. title: this.isType==2 ? '本周研究汇总' : '上周纪要汇总',
  120. path: '/reportPages/secretDetails/secretDetails?type='+this.isType
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. @import '../index.scss';
  127. .container-secret {
  128. background-color: #f6f6f6;
  129. .title {
  130. color: #333333 !important;
  131. font-size: 30rpx !important;
  132. font-weight: 400 !important;
  133. }
  134. .abstract {
  135. margin:20rpx 0 0 30rpx;
  136. color: #666666;
  137. font-size: 28rpx;
  138. font-weight: 400 !important;
  139. }
  140. }
  141. </style>