reportList.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view class="report-list-page">
  3. <van-sticky style="background: #fff">
  4. <view class="flex search-wrap">
  5. <searchBox style="flex: 1" :focus="focus" placeholder="请输入报告标题或关键字" :hasRightBtn="false" @change="onChange" @search="onSearch"></searchBox>
  6. <view class="filter-box" @click="showFilter=true" v-if="classifyList.length>0">
  7. <image src="./static/filter-icon.png" mode="aspectFill"></image>
  8. <text>筛选</text>
  9. </view>
  10. </view>
  11. </van-sticky>
  12. <view class="report-empty-box" v-if="finished&&list.length==0">
  13. <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
  14. <view>找不到对应报告,试试别的搜索词吧</view>
  15. </view>
  16. <view class="report-list-wrap" v-else>
  17. <view class="flex item" v-for="item in list" :key="item.report_id" @click="goReportDetail(item)">
  18. <image class="img" :src="item.report_img_url" mode="aspectFill" />
  19. <view class="con">
  20. <view class="title" v-html="item.title"></view>
  21. <view class="van-ellipsis tips" v-html="item.abstract"></view>
  22. <view class="time">{{item.publish_time|formatReportTime}}</view>
  23. <view :class="['audio-box',!item.auth_ok&&'grey-audio-box']">
  24. <image src="./static/audio.png" mode="aspectFill"/>
  25. <text>播放</text>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- 筛选 -->
  31. <van-popup :show="showFilter" position="bottom" :safe-area-inset-bottom="false" round @close="showFilter=false">
  32. <view class="filter-wrap">
  33. <view class="flex top">
  34. <text style="color:#000">筛选</text>
  35. <text style="color:#E3B377" @click="showFilter=false">取消</text>
  36. </view>
  37. <view class="list-box">
  38. <van-row gutter="10">
  39. <van-col span="8" v-for="item in classifyList" :key="item">
  40. <view
  41. :class="['item',item.classify_id_second==selectSecClassifyId&&'active']"
  42. @click="handleSelectSecClassifyId(item)"
  43. >{{item.classify_second_simple}}</view>
  44. </van-col>
  45. </van-row>
  46. </view>
  47. </view>
  48. </van-popup>
  49. </view>
  50. </template>
  51. <script>
  52. import searchBox from "./components/searchBox.vue";
  53. import {apiReportList,apiSubClassifyList} from '@/api/report'
  54. export default {
  55. components: {
  56. searchBox,
  57. },
  58. data() {
  59. return {
  60. classifyId:0,
  61. classifyList:[],
  62. selectSecClassifyId:0,
  63. searchVal: "",
  64. showFilter:false,
  65. list:[],
  66. finished:false,
  67. page:1,
  68. pageSize:20
  69. };
  70. },
  71. onLoad(options) {
  72. this.classifyId=options.classifyId
  73. // 设置title
  74. uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName)+'列表' })
  75. this.getList()
  76. this.getClassifyList()
  77. },
  78. onPullDownRefresh() {
  79. this.page=1
  80. this.list=[]
  81. this.finished=false
  82. this.getList()
  83. this.getClassifyList()
  84. setTimeout(() => {
  85. uni.stopPullDownRefresh()
  86. }, 1500);
  87. },
  88. onReachBottom() {
  89. if(this.finished) return
  90. this.page++
  91. this.getList()
  92. },
  93. methods: {
  94. //获取研报列表
  95. async getList(){
  96. const res=await apiReportList({
  97. classify_id_first:Number(this.classifyId),
  98. classify_id_second:Number(this.selectSecClassifyId),
  99. key_word:this.searchVal,
  100. current_index:this.page,
  101. page_size:this.pageSize
  102. })
  103. if(res.code===200){
  104. let arr=res.data.list||[]
  105. this.list=[...this.list,...arr]
  106. if(res.data.paging.is_end){
  107. this.finished=true
  108. }
  109. }
  110. },
  111. //分类数据
  112. async getClassifyList(){
  113. const res=await apiSubClassifyList({classify_id_first:Number(this.classifyId)})
  114. if(res.code===200){
  115. this.classifyList=res.data
  116. }
  117. },
  118. handleSelectSecClassifyId(item){
  119. this.selectSecClassifyId=item.classify_id_second
  120. this.showFilter=false
  121. this.page=1
  122. this.finished=false
  123. this.list=[]
  124. this.getList()
  125. },
  126. onChange(e) {
  127. this.searchVal = e;
  128. },
  129. onSearch() {
  130. console.log("搜索", this.searchVal);
  131. this.page=1
  132. this.finished=false
  133. this.list=[]
  134. this.getList()
  135. },
  136. goReportDetail(item){
  137. uni.navigateTo({ url: '/pages-report/reportDetail?reportId='+item.report_id })
  138. }
  139. },
  140. };
  141. </script>
  142. <style>
  143. page{
  144. padding-bottom: 0;
  145. }
  146. </style>
  147. <style lang="scss" scoped>
  148. .search-wrap {
  149. background-color: #fff;
  150. padding: 30rpx 34rpx;
  151. align-items: center;
  152. .filter-box {
  153. margin-left: 20rpx;
  154. image {
  155. width: 52rpx;
  156. height: 52rpx;
  157. vertical-align: middle;
  158. }
  159. text {
  160. vertical-align: middle;
  161. color: #e3b377;
  162. font-size: 32rpx;
  163. }
  164. }
  165. }
  166. .report-list-wrap {
  167. padding: 0 34rpx;
  168. .item {
  169. margin-bottom: 30rpx;
  170. .img {
  171. width: 120rpx;
  172. height: 160rpx;
  173. border-radius: 16rpx;
  174. background-color: #f5f5f5;
  175. flex-shrink: 0;
  176. margin-right: 20rpx;
  177. }
  178. .con {
  179. flex: 1;
  180. position: relative;
  181. overflow: hidden;
  182. .title {
  183. font-size: 32rpx;
  184. font-weight: bold;
  185. margin-bottom: 8rpx;
  186. }
  187. .tips {
  188. color: #666666;
  189. margin-bottom: 10rpx;
  190. }
  191. .time {
  192. color: #666666;
  193. }
  194. .audio-box {
  195. position: absolute;
  196. bottom: 0;
  197. right: 0;
  198. width: 99rpx;
  199. height: 39rpx;
  200. background: linear-gradient(100deg, #e3b377 0%, #ffddb1 100%);
  201. border-radius: 20rpx;
  202. color: #fff;
  203. font-size: 24rpx;
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. image{
  208. width: 30rpx;
  209. height: 30rpx;
  210. margin-right: 4rpx;
  211. }
  212. }
  213. .grey-audio-box {
  214. background: linear-gradient(114deg, #b0b0b0 0%, #e5e2e2 100%);
  215. }
  216. }
  217. }
  218. }
  219. .filter-wrap{
  220. background-color: #fff;
  221. padding-top: 53rpx;
  222. .top{
  223. font-size: 32rpx;
  224. justify-content: space-between;
  225. margin-bottom: 40rpx;
  226. padding: 0 34rpx;
  227. }
  228. .list-box{
  229. min-height: 30vh;
  230. max-height: 60vh;
  231. overflow-y: auto;
  232. padding: 0 34rpx;
  233. .item{
  234. background-color: #F6F6F6;
  235. color: #000000;
  236. // text-align: center;
  237. height: 76rpx;
  238. overflow: hidden;
  239. display: flex;
  240. align-items: center;
  241. justify-content: center;
  242. // line-height: 76rpx;
  243. margin-bottom: 20rpx;
  244. }
  245. .active{
  246. background-color: #FAEEDE;
  247. }
  248. }
  249. }
  250. </style>