industrialReport.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. <!-- <view class="text_twoLine desc">{{item.PublishDate}} <text>1231231</text></vive> -->
  11. <view class="desc">
  12. <text :class="item.IsResearch ? 'publishDate' : ''">{{item.PublishDate}}</text>
  13. <text v-if="item.IsResearch" class="text_oneLine text-name">{{item.IndustryName}}</text>
  14. </view>
  15. </view>
  16. <u-icon name="arrow-right" color="#BDBDBD" size="34"></u-icon>
  17. </view>
  18. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="totalPage>1"/>
  19. </view>
  20. <view class="nodata" v-else>
  21. <image src="@/static/img/nodata.png" mode="" class="nodata_ico"></image>
  22. <text>暂时没有报告的内容</text>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { Reports } from '@/config/api.js'
  28. import { Throttle } from '@/config/util.js'
  29. let app = getApp()
  30. export default {
  31. data() {
  32. return {
  33. refresh: false,//正在下拉
  34. page_no:1,
  35. pageSize:10,
  36. categoryId:null,
  37. collectList:[],
  38. haveData:true,
  39. status:'loadmore',
  40. loadText: {
  41. loadmore: '上拉加载更多',
  42. loading: '加载中',
  43. nomore: '已经到底了'
  44. },
  45. typeIsPost:'',//
  46. genreIs:'',//作者还是文章
  47. totalPage:'',
  48. titleReport:'',
  49. idGenre:'',
  50. articleId:''
  51. };
  52. },
  53. onLoad(option) {
  54. this.$store.dispatch("checkHandle",{type:'load',val:option}).then(res=>{
  55. this.categoryId=Number(option.id)||''
  56. this.idGenre=Number(option.idGenre) ||''
  57. this.articleId=Number(option.idArticle) ||''
  58. this.typeIsPost=option.type || ''
  59. this.genreIs=option.isGenre || ''
  60. this.getCollectList()
  61. })
  62. },
  63. onShow() {
  64. },
  65. methods:{
  66. /* 获取列表 */
  67. async getCollectList() {
  68. if(this.typeIsPost =='研选'&& this.genreIs!=='标的') {
  69. Reports.industryReportList({
  70. PageSize: this.pageSize,
  71. CurrentIndex: this.page_no,
  72. DepartmentId:this.idGenre,
  73. IndustrialManagementId:this.categoryId,
  74. ArticleId:this.articleId
  75. }).then(res => {
  76. if(res.Ret === 200) {
  77. if(!res.Data.HaveResearch){
  78. this.$util.modalShow('','您暂无查看研选权限','',()=>{
  79. uni.reLaunch({
  80. url:'/pages/index/index'
  81. })
  82. })
  83. }
  84. uni.setNavigationBarTitle({
  85. title: this.genreIs=='作者' ? res.Data.NickName :res.Data.IndustryName
  86. });
  87. if(res.Data.List.length>0){
  88. res.Data.List.forEach(item =>{
  89. item.PublishDate=item.PublishDate.slice(0,10)
  90. })
  91. }
  92. this.titleReport = this.genreIs=='作者' ? res.Data.NickName :res.Data.IndustryName
  93. this.status = this.page_no < res.Data.Paging.Pages ? 'loadmore' : 'nomore';
  94. this.totalPage = res.Data.Paging.Pages;//总页数
  95. if(this.page_no === 1) {
  96. this.collectList = res.Data.List || [];
  97. this.haveData = this.collectList.length ? true : false
  98. if(this.refresh) {
  99. uni.stopPullDownRefresh();
  100. this.refresh = false;
  101. }
  102. }else {
  103. this.collectList = this.collectList.concat(res.Data.List)
  104. }
  105. }
  106. })
  107. return
  108. }else {
  109. const res = this.genreIs==='标的' ? await Reports.reportListNew({
  110. PageSize: this.pageSize,
  111. CurrentIndex: this.page_no,
  112. ArticleId:this.articleId
  113. }) : await Reports.getTactics({
  114. PageSize: this.pageSize,
  115. CurrentIndex: this.page_no,
  116. CategoryId:this.categoryId
  117. })
  118. if(res.Ret === 200) {
  119. uni.setNavigationBarTitle({
  120. title:this.genreIs==='标的' ? res.Data.IndustryName : res.Data.MatchTypeName
  121. });
  122. this.titleReport=this.genreIs==='标的' ? res.Data.IndustryName : res.Data.MatchTypeName
  123. this.status = this.page_no < res.Data.Paging.Pages ? 'loadmore' : 'nomore';
  124. this.totalPage = res.Data.Paging.Pages;//总页数
  125. if(this.page_no === 1) {
  126. this.collectList = res.Data.List || [];
  127. this.haveData = this.collectList.length ? true : false
  128. if(this.refresh) {
  129. uni.stopPullDownRefresh();
  130. this.refresh = false;
  131. }
  132. }else {
  133. this.collectList = this.collectList.concat(res.Data.List)
  134. }
  135. }
  136. }
  137. },
  138. goDetail(item,index) {
  139. /* 无需授权且已绑定 检验是或否有权限 */
  140. this.collectList[index].IsRed=false
  141. this.$store.dispatch('checkHandle').then(res => {
  142. app.globalData.isAuth = res.IsAuth;
  143. app.globalData.isBind = res.IsBind;
  144. if((!res.IsAuth) && (!res.IsBind)) { // 已授权已绑定
  145. uni.navigateTo({
  146. url:'/pages/reportDetail/reportDetail?id=' + item.ArticleId,
  147. });
  148. }else if(res.IsAuth) { //未授权
  149. uni.navigateTo({
  150. url:'/pages/authGuide/authGuide'
  151. })
  152. }else if(res.IsBind && !res.IsAuth){ //已授权未绑定
  153. uni.navigateTo({
  154. url:'/pages/login/login'
  155. })
  156. }
  157. })
  158. },
  159. },
  160. /* 触底 */
  161. onReachBottom: Throttle(function() {
  162. if(this.status === 'nomore') return ;
  163. this.status = 'loading';
  164. this.page_no++;
  165. this.getCollectList()
  166. }),
  167. /* 下拉刷新 */
  168. onPullDownRefresh: Throttle(function() {
  169. this.page_no = 1;
  170. this.refresh = true;
  171. this.getCollectList()
  172. }),
  173. /**
  174. * 用户点击分享
  175. */
  176. onShareAppMessage: function (res) {
  177. return {
  178. title: this.titleReport,
  179. path: '/reportPages/industrialReport/industrialReport?id='+this.categoryId+'&type='+this.typeIsPost+'&isGenre='+this.genreIs+'&idGenre='+this.idGenre+'&idArticle='+this.articleId,
  180. success: (res)=> {
  181. },
  182. fail: (err)=> {
  183. }
  184. }
  185. },
  186. }
  187. </script>
  188. <style scoped lang="scss">
  189. @import '../index.scss';
  190. .industrial-container {
  191. background-color: #f6f6f6;
  192. }
  193. </style>