reportList.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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" :style="{paddingBottom:showAudioPop&&'90px'}" 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-info" v-html="item.title_info"></view>
  21. <view class="title" v-html="item.title"></view>
  22. <view class="tips" v-html="item.abstract"></view>
  23. <view class="time">{{item.publish_time|formatReportTime}}</view>
  24. <view :class="['audio-box',!item.auth_ok&&'grey-audio-box']" @click.stop="handleClickAudio(item)">
  25. <image :src="curAudioReportId==item.report_id&&!curAudioPaused?'./static/audio-s.png':'./static/audio.png'" mode="aspectFill"/>
  26. <text>{{curAudioReportId==item.report_id&&!curAudioPaused?'暂停':'播放'}}</text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 筛选 -->
  32. <van-popup :show="showFilter" position="bottom" :safe-area-inset-bottom="false" round @close="showFilter=false">
  33. <view class="filter-wrap">
  34. <view class="flex top">
  35. <text style="color:#000">筛选</text>
  36. <text style="color:#E3B377" @click="showFilter=false">取消</text>
  37. </view>
  38. <view class="list-box">
  39. <van-row gutter="10">
  40. <van-col span="8" v-for="item in classifyList" :key="item">
  41. <view
  42. :class="['item',item.classify_id_second==selectSecClassifyId&&'active']"
  43. @click="handleSelectSecClassifyId(item)"
  44. >{{item.classify_second_simple}}</view>
  45. </van-col>
  46. </van-row>
  47. </view>
  48. </view>
  49. </van-popup>
  50. <!-- 音频弹窗 -->
  51. <audioBox v-if="showAudioPop"></audioBox>
  52. </view>
  53. </template>
  54. <script>
  55. import searchBox from "./components/searchBox.vue";
  56. import audioBox from './components/audioBox.vue'
  57. import {apiReportList,apiSubClassifyList} from '@/api/report'
  58. export default {
  59. computed: {
  60. showAudioPop(){//是否显示音频弹窗
  61. return this.$store.state.report.audioData.show
  62. },
  63. curAudioReportId(){//当前播放的音频所属报告
  64. return this.$store.state.report.audioData.reportId
  65. },
  66. curAudioPaused(){//当前音频是否暂停状态
  67. return this.$store.state.report.audioData.paused
  68. }
  69. },
  70. components: {
  71. searchBox,
  72. audioBox
  73. },
  74. data() {
  75. return {
  76. classifyId:0,
  77. classifyName:'',
  78. classifyList:[],
  79. selectSecClassifyId:0,
  80. searchVal: "",
  81. showFilter:false,
  82. list:[],
  83. finished:false,
  84. page:1,
  85. pageSize:20
  86. };
  87. },
  88. onLoad(options) {
  89. this.classifyId=options.classifyId
  90. this.classifyName=options.classifyName
  91. // 设置title
  92. uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName)+'列表' })
  93. this.getList()
  94. this.getClassifyList()
  95. },
  96. onPullDownRefresh() {
  97. this.page=1
  98. this.list=[]
  99. this.finished=false
  100. this.getList()
  101. this.getClassifyList()
  102. setTimeout(() => {
  103. uni.stopPullDownRefresh()
  104. }, 1500);
  105. },
  106. onReachBottom() {
  107. if(this.finished) return
  108. this.page++
  109. this.getList()
  110. },
  111. onShareAppMessage() {
  112. return {
  113. title:this.classifyName+'列表'
  114. }
  115. },
  116. methods: {
  117. //获取研报列表
  118. async getList(){
  119. const res=await apiReportList({
  120. classify_id_first:Number(this.classifyId),
  121. classify_id_second:Number(this.selectSecClassifyId),
  122. key_word:this.searchVal,
  123. current_index:this.page,
  124. page_size:this.pageSize
  125. })
  126. if(res.code===200){
  127. let arr=res.data.list||[]
  128. this.list=[...this.list,...arr]
  129. if(res.data.paging.is_end){
  130. this.finished=true
  131. }
  132. }
  133. },
  134. //分类数据
  135. async getClassifyList(){
  136. const res=await apiSubClassifyList({classify_id_first:Number(this.classifyId)})
  137. if(res.code===200){
  138. this.classifyList=res.data
  139. }
  140. },
  141. handleSelectSecClassifyId(item){
  142. this.selectSecClassifyId=item.classify_id_second
  143. this.showFilter=false
  144. this.page=1
  145. this.finished=false
  146. this.list=[]
  147. this.getList()
  148. },
  149. onChange(e) {
  150. this.searchVal = e;
  151. },
  152. onSearch() {
  153. console.log("搜索", this.searchVal);
  154. this.page=1
  155. this.finished=false
  156. this.list=[]
  157. this.getList()
  158. },
  159. goReportDetail(item){
  160. uni.navigateTo({ url: '/pages-report/reportDetail?reportId='+item.report_id })
  161. },
  162. handleClickAudio(item){
  163. if(!item.auth_ok) return
  164. if(!item.video_list||item.video_list.length==0){
  165. uni.showToast({
  166. title: '暂无音频',
  167. icon: 'none'
  168. })
  169. return
  170. }
  171. // 判断是否为同一个音频
  172. if(this.$store.state.report.audioData.reportId==item.report_id){
  173. if(this.globalBgMusic.paused){
  174. this.globalBgMusic.play()
  175. }else{
  176. this.globalBgMusic.pause()
  177. }
  178. }else{
  179. this.$store.commit('addAudio', {list:item.video_list,reportId:item.report_id})
  180. }
  181. }
  182. },
  183. };
  184. </script>
  185. <style>
  186. page{
  187. padding-bottom: 0;
  188. }
  189. </style>
  190. <style lang="scss" scoped>
  191. .search-wrap {
  192. background-color: #fff;
  193. padding: 30rpx 34rpx;
  194. align-items: center;
  195. .filter-box {
  196. margin-left: 20rpx;
  197. image {
  198. width: 52rpx;
  199. height: 52rpx;
  200. vertical-align: middle;
  201. }
  202. text {
  203. vertical-align: middle;
  204. color: #e3b377;
  205. font-size: 32rpx;
  206. }
  207. }
  208. }
  209. .report-list-wrap {
  210. padding: 0 34rpx;
  211. .item {
  212. margin-bottom: 30rpx;
  213. .img {
  214. width: 120rpx;
  215. height: 160rpx;
  216. border-radius: 16rpx;
  217. background-color: #f5f5f5;
  218. flex-shrink: 0;
  219. margin-right: 20rpx;
  220. }
  221. .con {
  222. flex: 1;
  223. position: relative;
  224. overflow: hidden;
  225. .title {
  226. font-size: 32rpx;
  227. font-weight: bold;
  228. margin-bottom: 8rpx;
  229. }
  230. .title-info{
  231. font-size: 28rpx;
  232. }
  233. .tips {
  234. color: #666666;
  235. margin-bottom: 10rpx;
  236. }
  237. .time {
  238. color: #666666;
  239. }
  240. .audio-box {
  241. position: absolute;
  242. bottom: 0;
  243. right: 0;
  244. width: 99rpx;
  245. height: 39rpx;
  246. background: linear-gradient(100deg, #e3b377 0%, #ffddb1 100%);
  247. border-radius: 20rpx;
  248. color: #fff;
  249. font-size: 24rpx;
  250. display: flex;
  251. justify-content: center;
  252. align-items: center;
  253. image{
  254. width: 30rpx;
  255. height: 30rpx;
  256. margin-right: 4rpx;
  257. }
  258. }
  259. .grey-audio-box {
  260. background: linear-gradient(114deg, #b0b0b0 0%, #e5e2e2 100%);
  261. }
  262. }
  263. }
  264. }
  265. .filter-wrap{
  266. background-color: #fff;
  267. padding-top: 53rpx;
  268. .top{
  269. font-size: 32rpx;
  270. justify-content: space-between;
  271. margin-bottom: 40rpx;
  272. padding: 0 34rpx;
  273. }
  274. .list-box{
  275. min-height: 30vh;
  276. max-height: 60vh;
  277. overflow-y: auto;
  278. padding: 0 34rpx;
  279. .item{
  280. background-color: #F6F6F6;
  281. color: #000000;
  282. // text-align: center;
  283. height: 76rpx;
  284. overflow: hidden;
  285. display: flex;
  286. align-items: center;
  287. justify-content: center;
  288. // line-height: 76rpx;
  289. margin-bottom: 20rpx;
  290. }
  291. .active{
  292. background-color: #FAEEDE;
  293. }
  294. }
  295. }
  296. </style>